Added logic to Qt GUI to allow for the main menu bar to be hidden. (#296)
This commit is contained in:
parent
6d8cd5f64b
commit
427daa3543
|
@ -491,12 +491,20 @@ void consoleWin_t::createMainMenu(void)
|
|||
fullscreen = new QAction(tr("Fullscreen"), this);
|
||||
fullscreen->setShortcut( QKeySequence(tr("Alt+Return")));
|
||||
fullscreen->setStatusTip(tr("Fullscreen"));
|
||||
//fullscreen->setIcon( style->standardIcon( QStyle::SP_TitleBarMaxButton ) );
|
||||
fullscreen->setIcon( QIcon(":icons/view-fullscreen.png") );
|
||||
connect(fullscreen, SIGNAL(triggered()), this, SLOT(toggleFullscreen(void)) );
|
||||
|
||||
optMenu->addAction(fullscreen);
|
||||
|
||||
// Options -> Hide Menu Screen
|
||||
act = new QAction(tr("Hide Menu"), this);
|
||||
act->setShortcut( QKeySequence(tr("Alt+M")));
|
||||
act->setStatusTip(tr("Hide Menu"));
|
||||
act->setIcon( style->standardIcon( QStyle::SP_TitleBarMaxButton ) );
|
||||
connect(act, SIGNAL(triggered()), this, SLOT(toggleMenuVis(void)) );
|
||||
|
||||
optMenu->addAction(act);
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Emulation
|
||||
emuMenu = menuBar()->addMenu(tr("Emulation"));
|
||||
|
@ -841,6 +849,18 @@ void consoleWin_t::createMainMenu(void)
|
|||
helpMenu->addAction(msgLogAct);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
void consoleWin_t::toggleMenuVis(void)
|
||||
{
|
||||
if ( menuBar()->isVisible() )
|
||||
{
|
||||
menuBar()->setVisible( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
menuBar()->setVisible( true );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void consoleWin_t::closeApp(void)
|
||||
{
|
||||
nes_shm->runEmulator = 0;
|
||||
|
|
|
@ -168,6 +168,8 @@ class consoleWin_t : public QMainWindow
|
|||
void openDebugWindow(void);
|
||||
void openHexEditor(void);
|
||||
void openGamePadConfWin(void);
|
||||
void toggleFullscreen(void);
|
||||
void toggleMenuVis(void);
|
||||
private slots:
|
||||
void closeApp(void);
|
||||
void openROMFile(void);
|
||||
|
@ -192,7 +194,6 @@ class consoleWin_t : public QMainWindow
|
|||
void openCodeDataLogger(void);
|
||||
void openTraceLogger(void);
|
||||
void toggleAutoResume(void);
|
||||
void toggleFullscreen(void);
|
||||
void updatePeriodic(void);
|
||||
void changeState0(void);
|
||||
void changeState1(void);
|
||||
|
|
|
@ -588,21 +588,33 @@ static void KeyboardCommands (void)
|
|||
}
|
||||
|
||||
// Alt-Enter to toggle full-screen
|
||||
// This is already handled by GTK Accelerator
|
||||
//if (keyonly (ENTER) && is_alt)
|
||||
//{
|
||||
// ToggleFS ();
|
||||
//}
|
||||
//
|
||||
// This is already handled by Qt Menu Actions
|
||||
// So only process if menu is hidden or disabled.
|
||||
if ( is_alt )
|
||||
{
|
||||
if (keyonly (ENTER))
|
||||
{
|
||||
if ( consoleWindow )
|
||||
{
|
||||
if ( !consoleWindow->menuBar()->isVisible() )
|
||||
{
|
||||
consoleWindow->toggleFullscreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Alt-M to toggle Main Menu Visibility
|
||||
//if ( is_alt )
|
||||
//{
|
||||
// if (keyonly (M))
|
||||
// {
|
||||
// toggleMenuVis(); // TODO
|
||||
// }
|
||||
//}
|
||||
if ( is_alt )
|
||||
{
|
||||
if (keyonly (M))
|
||||
{
|
||||
if ( consoleWindow )
|
||||
{
|
||||
consoleWindow->toggleMenuVis();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Toggle Movie auto-backup
|
||||
if ( is_shift )
|
||||
|
|
Loading…
Reference in New Issue