Added logic to allow for advanced key sequence options to be shown/hidden on game pad window.
This commit is contained in:
parent
41caf1500f
commit
b810164759
|
@ -115,7 +115,7 @@ GamePadConfDialog_t::GamePadConfDialog_t(QWidget *parent)
|
||||||
bool useScroll = false;
|
bool useScroll = false;
|
||||||
int useNativeMenuBar;
|
int useNativeMenuBar;
|
||||||
QMenuBar *menuBar;
|
QMenuBar *menuBar;
|
||||||
QMenu *fileMenu;
|
QMenu *fileMenu, *extMenu;
|
||||||
QAction *act;
|
QAction *act;
|
||||||
QTreeWidgetItem *item;
|
QTreeWidgetItem *item;
|
||||||
|
|
||||||
|
@ -162,6 +162,18 @@ GamePadConfDialog_t::GamePadConfDialog_t(QWidget *parent)
|
||||||
|
|
||||||
fileMenu->addAction(act);
|
fileMenu->addAction(act);
|
||||||
|
|
||||||
|
// Extensions
|
||||||
|
extMenu = menuBar->addMenu(tr("&Extensions"));
|
||||||
|
|
||||||
|
// Extensions -> Show Adv Bindings
|
||||||
|
act = new QAction(tr("&Show Adv Bindings"), this);
|
||||||
|
//act->setShortcut(QKeySequence::Close);
|
||||||
|
act->setStatusTip(tr("Show Adv Bindings"));
|
||||||
|
act->setCheckable(true);
|
||||||
|
connect(act, SIGNAL(triggered(bool)), this, SLOT(advBindingViewChanged(bool)) );
|
||||||
|
|
||||||
|
extMenu->addAction(act);
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// Menu End
|
// Menu End
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
@ -377,6 +389,16 @@ GamePadConfDialog_t::GamePadConfDialog_t(QWidget *parent)
|
||||||
gpView = new GamePadView_t(this);
|
gpView = new GamePadView_t(this);
|
||||||
|
|
||||||
advOptLayout = new QGroupBox( tr("Advanced Key Bindings") );
|
advOptLayout = new QGroupBox( tr("Advanced Key Bindings") );
|
||||||
|
advOptLayout->setMaximumWidth(0);
|
||||||
|
|
||||||
|
advOptWidthAnimation = new QPropertyAnimation( advOptLayout, "maximumWidth");
|
||||||
|
advOptWidthAnimation->setDuration(500);
|
||||||
|
advOptWidthAnimation->setStartValue(0);
|
||||||
|
advOptWidthAnimation->setEndValue(512);
|
||||||
|
advOptWidthAnimation->setEasingCurve( QEasingCurve::InOutCirc );
|
||||||
|
|
||||||
|
connect( advOptWidthAnimation, SIGNAL(valueChanged(const QVariant &)), this, SLOT(advOptWidthChange(const QVariant &)));
|
||||||
|
connect( advOptWidthAnimation, SIGNAL(finished(void)), this, SLOT(advOptResizeDone(void)) );
|
||||||
|
|
||||||
mainLayoutV->addLayout(vbox1);
|
mainLayoutV->addLayout(vbox1);
|
||||||
mainLayoutV->addWidget(gpView);
|
mainLayoutV->addWidget(gpView);
|
||||||
|
@ -418,7 +440,8 @@ GamePadConfDialog_t::GamePadConfDialog_t(QWidget *parent)
|
||||||
|
|
||||||
keyBindTree->setHeaderItem(item);
|
keyBindTree->setHeaderItem(item);
|
||||||
|
|
||||||
keyBindTree->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
keyBindTree->header()->setSectionResizeMode(QHeaderView::Interactive);
|
||||||
|
keyBindTree->setMinimumWidth( 256 );
|
||||||
|
|
||||||
hbox1->addWidget(keyBindTree);
|
hbox1->addWidget(keyBindTree);
|
||||||
|
|
||||||
|
@ -571,6 +594,32 @@ void GamePadConfDialog_t::loadMapList(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
void GamePadConfDialog_t::advBindingViewChanged(bool state)
|
||||||
|
{
|
||||||
|
if ( state )
|
||||||
|
{
|
||||||
|
advOptWidthAnimation->setStartValue(0);
|
||||||
|
advOptWidthAnimation->setEndValue(512);
|
||||||
|
advOptWidthAnimation->start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
advOptWidthAnimation->setStartValue( advOptLayout->width() );
|
||||||
|
advOptWidthAnimation->setEndValue(0);
|
||||||
|
advOptWidthAnimation->start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------
|
||||||
|
void GamePadConfDialog_t::advOptWidthChange(const QVariant &value)
|
||||||
|
{
|
||||||
|
resize( minimumSizeHint() );
|
||||||
|
}
|
||||||
|
//----------------------------------------------------
|
||||||
|
void GamePadConfDialog_t::advOptResizeDone(void)
|
||||||
|
{
|
||||||
|
resize( minimumSizeHint() );
|
||||||
|
}
|
||||||
|
//----------------------------------------------------
|
||||||
void GamePadConfDialog_t::refreshKeyBindTree( bool reset )
|
void GamePadConfDialog_t::refreshKeyBindTree( bool reset )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
#include <QTreeWidget>
|
#include <QTreeWidget>
|
||||||
|
#include <QPropertyAnimation>
|
||||||
|
|
||||||
#include "Qt/main.h"
|
#include "Qt/main.h"
|
||||||
#include "Qt/input.h"
|
#include "Qt/input.h"
|
||||||
|
@ -138,6 +139,7 @@ protected:
|
||||||
QComboBox *profSel;
|
QComboBox *profSel;
|
||||||
QCheckBox *efs_chkbox;
|
QCheckBox *efs_chkbox;
|
||||||
QGroupBox *advOptLayout;
|
QGroupBox *advOptLayout;
|
||||||
|
QPropertyAnimation *advOptWidthAnimation;
|
||||||
QLabel *guidLbl;
|
QLabel *guidLbl;
|
||||||
QLabel *mapMsg;
|
QLabel *mapMsg;
|
||||||
QLabel *keyName[GAMEPAD_NUM_BUTTONS];
|
QLabel *keyName[GAMEPAD_NUM_BUTTONS];
|
||||||
|
@ -210,6 +212,9 @@ private slots:
|
||||||
void newKeyBindingCallback(void);
|
void newKeyBindingCallback(void);
|
||||||
void editKeyBindingCallback(void);
|
void editKeyBindingCallback(void);
|
||||||
void delKeyBindingCallback(void);
|
void delKeyBindingCallback(void);
|
||||||
|
void advBindingViewChanged(bool state);
|
||||||
|
void advOptResizeDone(void);
|
||||||
|
void advOptWidthChange(const QVariant &value);
|
||||||
};
|
};
|
||||||
|
|
||||||
int openGamePadConfWindow(QWidget *parent);
|
int openGamePadConfWindow(QWidget *parent);
|
||||||
|
|
|
@ -1450,6 +1450,11 @@ static void updateGamePadKeyMappings(void)
|
||||||
{
|
{
|
||||||
std::list <gamepad_function_key_t*>::iterator it;
|
std::list <gamepad_function_key_t*>::iterator it;
|
||||||
|
|
||||||
|
if ( gpKeySeqList.size() == 0 )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (it=gpKeySeqList.begin(); it!=gpKeySeqList.end(); it++)
|
for (it=gpKeySeqList.begin(); it!=gpKeySeqList.end(); it++)
|
||||||
{
|
{
|
||||||
(*it)->updateStatus();
|
(*it)->updateStatus();
|
||||||
|
|
Loading…
Reference in New Issue