Bug fix for Qt GUI family keyboard conflicting with new hot key shortcuts.
This commit is contained in:
parent
19891e1155
commit
7f85544e63
|
@ -577,6 +577,7 @@ void consoleWin_t::initHotKeys(void)
|
|||
connect( Hotkeys[ HK_TOGGLE_INPUT_DISPLAY ].getShortcut(), SIGNAL(activated()), this, SLOT(toggleInputDisplay(void)) );
|
||||
connect( Hotkeys[ HK_TOGGLE_BG ].getShortcut(), SIGNAL(activated()), this, SLOT(toggleBackground(void)) );
|
||||
connect( Hotkeys[ HK_TOGGLE_FG ].getShortcut(), SIGNAL(activated()), this, SLOT(toggleForeground(void)) );
|
||||
connect( Hotkeys[ HK_FKB_ENABLE ].getShortcut(), SIGNAL(activated()), this, SLOT(toggleFamKeyBrdEnable(void)) );
|
||||
|
||||
connect( Hotkeys[ HK_SAVE_STATE_0 ].getShortcut(), SIGNAL(activated()), this, SLOT(saveState0(void)) );
|
||||
connect( Hotkeys[ HK_SAVE_STATE_1 ].getShortcut(), SIGNAL(activated()), this, SLOT(saveState1(void)) );
|
||||
|
@ -2375,6 +2376,11 @@ void consoleWin_t::toggleFullscreen(void)
|
|||
}
|
||||
}
|
||||
|
||||
void consoleWin_t::toggleFamKeyBrdEnable(void)
|
||||
{
|
||||
toggleFamilyKeyboardFunc();
|
||||
}
|
||||
|
||||
void consoleWin_t::powerConsoleCB(void)
|
||||
{
|
||||
fceuWrapperLock();
|
||||
|
|
|
@ -317,6 +317,7 @@ class consoleWin_t : public QMainWindow
|
|||
void toggleTurboMode(void);
|
||||
void toggleBackground(void);
|
||||
void toggleForeground(void);
|
||||
void toggleFamKeyBrdEnable(void);
|
||||
void saveState0(void);
|
||||
void saveState1(void);
|
||||
void saveState2(void);
|
||||
|
|
|
@ -195,7 +195,7 @@ _keyonly (int a)
|
|||
|
||||
#define keyonly(__a) _keyonly(MKK(__a))
|
||||
|
||||
static int g_fkbEnabled = 0;
|
||||
static bool g_fkbEnabled = false;
|
||||
|
||||
// this function loads the sdl hotkeys from the config file into the
|
||||
// global scope. this elimates the need for accessing the config file
|
||||
|
@ -670,24 +670,66 @@ unsigned int *GetKeyboard(void)
|
|||
return (unsigned int*)(keystate);
|
||||
}
|
||||
|
||||
static void FKB_CheckShortcutConflicts(void)
|
||||
{
|
||||
bool fkbActv;
|
||||
QShortcut *shortcut;
|
||||
|
||||
fkbActv = g_fkbEnabled && (CurInputType[2] == SIFC_FKB);
|
||||
|
||||
for (int i=0; i<HK_MAX; i++)
|
||||
{
|
||||
shortcut = Hotkeys[i].getShortcut();
|
||||
|
||||
if ( i == HK_FKB_ENABLE )
|
||||
{
|
||||
if ( shortcut )
|
||||
{
|
||||
shortcut->setEnabled(true);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( shortcut )
|
||||
{
|
||||
shortcut->setEnabled( !fkbActv );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void toggleFamilyKeyboardFunc(void)
|
||||
{
|
||||
if (CurInputType[2] == SIFC_FKB)
|
||||
{
|
||||
g_fkbEnabled = !g_fkbEnabled;
|
||||
|
||||
FCEUI_DispMessage ("Family Keyboard %sabled.", 0,
|
||||
g_fkbEnabled ? "En" : "Dis");
|
||||
}
|
||||
else
|
||||
{
|
||||
FCEUI_DispMessage ("Family Keyboard Not Active", 0);
|
||||
g_fkbEnabled = false;
|
||||
}
|
||||
FKB_CheckShortcutConflicts();
|
||||
}
|
||||
|
||||
bool isFamilyKeyboardActv(void)
|
||||
{
|
||||
return ( (CurInputType[2] == SIFC_FKB) && g_fkbEnabled );
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse keyboard commands and execute accordingly.
|
||||
*/
|
||||
static void KeyboardCommands (void)
|
||||
{
|
||||
//int is_shift, is_alt;
|
||||
|
||||
// get the keyboard input
|
||||
|
||||
// check if the family keyboard is enabled
|
||||
if (CurInputType[2] == SIFC_FKB)
|
||||
{
|
||||
if ( Hotkeys[HK_FKB_ENABLE].getRisingEdge() )
|
||||
{
|
||||
g_fkbEnabled ^= 1;
|
||||
FCEUI_DispMessage ("Family Keyboard %sabled.", 0,
|
||||
g_fkbEnabled ? "en" : "dis");
|
||||
}
|
||||
if (g_fkbEnabled)
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -137,6 +137,8 @@ const char* ButtonName(const ButtConfig* bc);
|
|||
int getInputSelection( int port, int *cur, int *usr );
|
||||
int saveInputSettingsToFile( const char *fileBase = NULL );
|
||||
int loadInputSettingsFromFile( const char *filename = NULL );
|
||||
void toggleFamilyKeyboardFunc(void);
|
||||
bool isFamilyKeyboardActv(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue