lay base for a window with no menubar
This commit is contained in:
parent
881a740cab
commit
b2ae4c7dc5
|
@ -76,11 +76,15 @@ void EmuThread::attachWindow(MainWindow* window)
|
||||||
connect(this, SIGNAL(windowEmuStop()), window, SLOT(onEmuStop()));
|
connect(this, SIGNAL(windowEmuStop()), window, SLOT(onEmuStop()));
|
||||||
connect(this, SIGNAL(windowEmuPause(bool)), window, SLOT(onEmuPause(bool)));
|
connect(this, SIGNAL(windowEmuPause(bool)), window, SLOT(onEmuPause(bool)));
|
||||||
connect(this, SIGNAL(windowEmuReset()), window, SLOT(onEmuReset()));
|
connect(this, SIGNAL(windowEmuReset()), window, SLOT(onEmuReset()));
|
||||||
connect(this, SIGNAL(windowLimitFPSChange()), window->actLimitFramerate, SLOT(trigger()));
|
|
||||||
connect(this, SIGNAL(autoScreenSizingChange(int)), window->panel, SLOT(onAutoScreenSizingChanged(int)));
|
connect(this, SIGNAL(autoScreenSizingChange(int)), window->panel, SLOT(onAutoScreenSizingChanged(int)));
|
||||||
connect(this, SIGNAL(windowFullscreenToggle()), window, SLOT(onFullscreenToggled()));
|
connect(this, SIGNAL(windowFullscreenToggle()), window, SLOT(onFullscreenToggled()));
|
||||||
connect(this, SIGNAL(swapScreensToggle()), window->actScreenSwap, SLOT(trigger()));
|
|
||||||
connect(this, SIGNAL(screenEmphasisToggle()), window, SLOT(onScreenEmphasisToggled()));
|
connect(this, SIGNAL(screenEmphasisToggle()), window, SLOT(onScreenEmphasisToggled()));
|
||||||
|
|
||||||
|
if (window->winHasMenu())
|
||||||
|
{
|
||||||
|
connect(this, SIGNAL(windowLimitFPSChange()), window->actLimitFramerate, SLOT(trigger()));
|
||||||
|
connect(this, SIGNAL(swapScreensToggle()), window->actScreenSwap, SLOT(trigger()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmuThread::detachWindow(MainWindow* window)
|
void EmuThread::detachWindow(MainWindow* window)
|
||||||
|
@ -91,11 +95,15 @@ void EmuThread::detachWindow(MainWindow* window)
|
||||||
disconnect(this, SIGNAL(windowEmuStop()), window, SLOT(onEmuStop()));
|
disconnect(this, SIGNAL(windowEmuStop()), window, SLOT(onEmuStop()));
|
||||||
disconnect(this, SIGNAL(windowEmuPause(bool)), window, SLOT(onEmuPause(bool)));
|
disconnect(this, SIGNAL(windowEmuPause(bool)), window, SLOT(onEmuPause(bool)));
|
||||||
disconnect(this, SIGNAL(windowEmuReset()), window, SLOT(onEmuReset()));
|
disconnect(this, SIGNAL(windowEmuReset()), window, SLOT(onEmuReset()));
|
||||||
disconnect(this, SIGNAL(windowLimitFPSChange()), window->actLimitFramerate, SLOT(trigger()));
|
|
||||||
disconnect(this, SIGNAL(autoScreenSizingChange(int)), window->panel, SLOT(onAutoScreenSizingChanged(int)));
|
disconnect(this, SIGNAL(autoScreenSizingChange(int)), window->panel, SLOT(onAutoScreenSizingChanged(int)));
|
||||||
disconnect(this, SIGNAL(windowFullscreenToggle()), window, SLOT(onFullscreenToggled()));
|
disconnect(this, SIGNAL(windowFullscreenToggle()), window, SLOT(onFullscreenToggled()));
|
||||||
disconnect(this, SIGNAL(swapScreensToggle()), window->actScreenSwap, SLOT(trigger()));
|
|
||||||
disconnect(this, SIGNAL(screenEmphasisToggle()), window, SLOT(onScreenEmphasisToggled()));
|
disconnect(this, SIGNAL(screenEmphasisToggle()), window, SLOT(onScreenEmphasisToggled()));
|
||||||
|
|
||||||
|
if (window->winHasMenu())
|
||||||
|
{
|
||||||
|
disconnect(this, SIGNAL(windowLimitFPSChange()), window->actLimitFramerate, SLOT(trigger()));
|
||||||
|
disconnect(this, SIGNAL(swapScreensToggle()), window->actScreenSwap, SLOT(trigger()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmuThread::run()
|
void EmuThread::run()
|
||||||
|
|
|
@ -271,9 +271,13 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
||||||
setStyleSheet("QMenuBar::item { padding: 4px 8px; }");
|
setStyleSheet("QMenuBar::item { padding: 4px 8px; }");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QMenuBar* menubar = new QMenuBar();
|
hasMenu = (!parent);
|
||||||
|
|
||||||
|
if (hasMenu)
|
||||||
{
|
{
|
||||||
QMenu* menu = menubar->addMenu("File");
|
QMenuBar * menubar = new QMenuBar();
|
||||||
|
{
|
||||||
|
QMenu * menu = menubar->addMenu("File");
|
||||||
|
|
||||||
actOpenROM = menu->addAction("Open ROM...");
|
actOpenROM = menu->addAction("Open ROM...");
|
||||||
connect(actOpenROM, &QAction::triggered, this, &MainWindow::onOpenFile);
|
connect(actOpenROM, &QAction::triggered, this, &MainWindow::onOpenFile);
|
||||||
|
@ -285,7 +289,7 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
||||||
|
|
||||||
recentMenu = menu->addMenu("Open recent");
|
recentMenu = menu->addMenu("Open recent");
|
||||||
Config::Array recentROMs = globalCfg.GetArray("RecentROM");
|
Config::Array recentROMs = globalCfg.GetArray("RecentROM");
|
||||||
int numrecent = std::min(kMaxRecentROMs, (int)recentROMs.Size());
|
int numrecent = std::min(kMaxRecentROMs, (int) recentROMs.Size());
|
||||||
for (int i = 0; i < numrecent; ++i)
|
for (int i = 0; i < numrecent; ++i)
|
||||||
{
|
{
|
||||||
std::string item = recentROMs.GetString(i);
|
std::string item = recentROMs.GetString(i);
|
||||||
|
@ -318,8 +322,8 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
||||||
connect(actInsertGBACart, &QAction::triggered, this, &MainWindow::onInsertGBACart);
|
connect(actInsertGBACart, &QAction::triggered, this, &MainWindow::onInsertGBACart);
|
||||||
|
|
||||||
{
|
{
|
||||||
QMenu* submenu = menu->addMenu("Insert add-on cart");
|
QMenu * submenu = menu->addMenu("Insert add-on cart");
|
||||||
QAction* act;
|
QAction *act;
|
||||||
|
|
||||||
int addons[] = {GBAAddon_RAMExpansion, GBAAddon_RumblePak, -1};
|
int addons[] = {GBAAddon_RAMExpansion, GBAAddon_RumblePak, -1};
|
||||||
for (int i = 0; addons[i] != -1; i++)
|
for (int i = 0; addons[i] != -1; i++)
|
||||||
|
@ -343,12 +347,12 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
|
||||||
{
|
{
|
||||||
QMenu* submenu = menu->addMenu("Save state");
|
QMenu * submenu = menu->addMenu("Save state");
|
||||||
|
|
||||||
for (int i = 1; i < 9; i++)
|
for (int i = 1; i < 9; i++)
|
||||||
{
|
{
|
||||||
actSaveState[i] = submenu->addAction(QString("%1").arg(i));
|
actSaveState[i] = submenu->addAction(QString("%1").arg(i));
|
||||||
actSaveState[i]->setShortcut(QKeySequence(Qt::ShiftModifier | (Qt::Key_F1+i-1)));
|
actSaveState[i]->setShortcut(QKeySequence(Qt::ShiftModifier | (Qt::Key_F1 + i - 1)));
|
||||||
actSaveState[i]->setData(QVariant(i));
|
actSaveState[i]->setData(QVariant(i));
|
||||||
connect(actSaveState[i], &QAction::triggered, this, &MainWindow::onSaveState);
|
connect(actSaveState[i], &QAction::triggered, this, &MainWindow::onSaveState);
|
||||||
}
|
}
|
||||||
|
@ -359,12 +363,12 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
||||||
connect(actSaveState[0], &QAction::triggered, this, &MainWindow::onSaveState);
|
connect(actSaveState[0], &QAction::triggered, this, &MainWindow::onSaveState);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QMenu* submenu = menu->addMenu("Load state");
|
QMenu * submenu = menu->addMenu("Load state");
|
||||||
|
|
||||||
for (int i = 1; i < 9; i++)
|
for (int i = 1; i < 9; i++)
|
||||||
{
|
{
|
||||||
actLoadState[i] = submenu->addAction(QString("%1").arg(i));
|
actLoadState[i] = submenu->addAction(QString("%1").arg(i));
|
||||||
actLoadState[i]->setShortcut(QKeySequence(Qt::Key_F1+i-1));
|
actLoadState[i]->setShortcut(QKeySequence(Qt::Key_F1 + i - 1));
|
||||||
actLoadState[i]->setData(QVariant(i));
|
actLoadState[i]->setData(QVariant(i));
|
||||||
connect(actLoadState[i], &QAction::triggered, this, &MainWindow::onLoadState);
|
connect(actLoadState[i], &QAction::triggered, this, &MainWindow::onLoadState);
|
||||||
}
|
}
|
||||||
|
@ -381,7 +385,8 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
||||||
|
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
actOpenConfig = menu->addAction("Open melonDS directory");
|
actOpenConfig = menu->addAction("Open melonDS directory");
|
||||||
connect(actOpenConfig, &QAction::triggered, this, [&]() {
|
connect(actOpenConfig, &QAction::triggered, this, [&]()
|
||||||
|
{
|
||||||
QDesktopServices::openUrl(QUrl::fromLocalFile(emuDirectory));
|
QDesktopServices::openUrl(QUrl::fromLocalFile(emuDirectory));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -392,7 +397,7 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
||||||
actQuit->setShortcut(QKeySequence(QKeySequence::StandardKey::Quit));
|
actQuit->setShortcut(QKeySequence(QKeySequence::StandardKey::Quit));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QMenu* menu = menubar->addMenu("System");
|
QMenu * menu = menubar->addMenu("System");
|
||||||
|
|
||||||
actPause = menu->addAction("Pause");
|
actPause = menu->addAction("Pause");
|
||||||
actPause->setCheckable(true);
|
actPause->setCheckable(true);
|
||||||
|
@ -440,7 +445,7 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
||||||
|
|
||||||
{
|
{
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
QMenu* submenu = menu->addMenu("Multiplayer");
|
QMenu * submenu = menu->addMenu("Multiplayer");
|
||||||
|
|
||||||
actMPNewInstance = submenu->addAction("Launch new instance");
|
actMPNewInstance = submenu->addAction("Launch new instance");
|
||||||
connect(actMPNewInstance, &QAction::triggered, this, &MainWindow::onMPNewInstance);
|
connect(actMPNewInstance, &QAction::triggered, this, &MainWindow::onMPNewInstance);
|
||||||
|
@ -466,26 +471,26 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QMenu *menu = menubar->addMenu("View");
|
QMenu * menu = menubar->addMenu("View");
|
||||||
|
|
||||||
{
|
{
|
||||||
QMenu* submenu = menu->addMenu("Screen size");
|
QMenu * submenu = menu->addMenu("Screen size");
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
int data = i+1;
|
int data = i + 1;
|
||||||
actScreenSize[i] = submenu->addAction(QString("%1x").arg(data));
|
actScreenSize[i] = submenu->addAction(QString("%1x").arg(data));
|
||||||
actScreenSize[i]->setData(QVariant(data));
|
actScreenSize[i]->setData(QVariant(data));
|
||||||
connect(actScreenSize[i], &QAction::triggered, this, &MainWindow::onChangeScreenSize);
|
connect(actScreenSize[i], &QAction::triggered, this, &MainWindow::onChangeScreenSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QMenu* submenu = menu->addMenu("Screen rotation");
|
QMenu * submenu = menu->addMenu("Screen rotation");
|
||||||
grpScreenRotation = new QActionGroup(submenu);
|
grpScreenRotation = new QActionGroup(submenu);
|
||||||
|
|
||||||
for (int i = 0; i < screenRot_MAX; i++)
|
for (int i = 0; i < screenRot_MAX; i++)
|
||||||
{
|
{
|
||||||
int data = i*90;
|
int data = i * 90;
|
||||||
actScreenRotation[i] = submenu->addAction(QString("%1°").arg(data));
|
actScreenRotation[i] = submenu->addAction(QString("%1°").arg(data));
|
||||||
actScreenRotation[i]->setActionGroup(grpScreenRotation);
|
actScreenRotation[i]->setActionGroup(grpScreenRotation);
|
||||||
actScreenRotation[i]->setData(QVariant(i));
|
actScreenRotation[i]->setData(QVariant(i));
|
||||||
|
@ -495,7 +500,7 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
||||||
connect(grpScreenRotation, &QActionGroup::triggered, this, &MainWindow::onChangeScreenRotation);
|
connect(grpScreenRotation, &QActionGroup::triggered, this, &MainWindow::onChangeScreenRotation);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QMenu* submenu = menu->addMenu("Screen gap");
|
QMenu * submenu = menu->addMenu("Screen gap");
|
||||||
grpScreenGap = new QActionGroup(submenu);
|
grpScreenGap = new QActionGroup(submenu);
|
||||||
|
|
||||||
const int screengap[] = {0, 1, 8, 64, 90, 128};
|
const int screengap[] = {0, 1, 8, 64, 90, 128};
|
||||||
|
@ -512,10 +517,10 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
||||||
connect(grpScreenGap, &QActionGroup::triggered, this, &MainWindow::onChangeScreenGap);
|
connect(grpScreenGap, &QActionGroup::triggered, this, &MainWindow::onChangeScreenGap);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QMenu* submenu = menu->addMenu("Screen layout");
|
QMenu * submenu = menu->addMenu("Screen layout");
|
||||||
grpScreenLayout = new QActionGroup(submenu);
|
grpScreenLayout = new QActionGroup(submenu);
|
||||||
|
|
||||||
const char* screenlayout[] = {"Natural", "Vertical", "Horizontal", "Hybrid"};
|
const char *screenlayout[] = {"Natural", "Vertical", "Horizontal", "Hybrid"};
|
||||||
|
|
||||||
for (int i = 0; i < screenLayout_MAX; i++)
|
for (int i = 0; i < screenLayout_MAX; i++)
|
||||||
{
|
{
|
||||||
|
@ -534,10 +539,11 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
||||||
connect(actScreenSwap, &QAction::triggered, this, &MainWindow::onChangeScreenSwap);
|
connect(actScreenSwap, &QAction::triggered, this, &MainWindow::onChangeScreenSwap);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QMenu* submenu = menu->addMenu("Screen sizing");
|
QMenu * submenu = menu->addMenu("Screen sizing");
|
||||||
grpScreenSizing = new QActionGroup(submenu);
|
grpScreenSizing = new QActionGroup(submenu);
|
||||||
|
|
||||||
const char* screensizing[] = {"Even", "Emphasize top", "Emphasize bottom", "Auto", "Top only", "Bottom only"};
|
const char *screensizing[] = {"Even", "Emphasize top", "Emphasize bottom", "Auto", "Top only",
|
||||||
|
"Bottom only"};
|
||||||
|
|
||||||
for (int i = 0; i < screenSizing_MAX; i++)
|
for (int i = 0; i < screenSizing_MAX; i++)
|
||||||
{
|
{
|
||||||
|
@ -556,16 +562,16 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
||||||
connect(actIntegerScaling, &QAction::triggered, this, &MainWindow::onChangeIntegerScaling);
|
connect(actIntegerScaling, &QAction::triggered, this, &MainWindow::onChangeIntegerScaling);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QMenu* submenu = menu->addMenu("Aspect ratio");
|
QMenu * submenu = menu->addMenu("Aspect ratio");
|
||||||
grpScreenAspectTop = new QActionGroup(submenu);
|
grpScreenAspectTop = new QActionGroup(submenu);
|
||||||
grpScreenAspectBot = new QActionGroup(submenu);
|
grpScreenAspectBot = new QActionGroup(submenu);
|
||||||
actScreenAspectTop = new QAction*[AspectRatiosNum];
|
actScreenAspectTop = new QAction *[AspectRatiosNum];
|
||||||
actScreenAspectBot = new QAction*[AspectRatiosNum];
|
actScreenAspectBot = new QAction *[AspectRatiosNum];
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
QActionGroup* group = grpScreenAspectTop;
|
QActionGroup * group = grpScreenAspectTop;
|
||||||
QAction** actions = actScreenAspectTop;
|
QAction **actions = actScreenAspectTop;
|
||||||
|
|
||||||
if (i == 1)
|
if (i == 1)
|
||||||
{
|
{
|
||||||
|
@ -604,7 +610,7 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
||||||
connect(actShowOSD, &QAction::triggered, this, &MainWindow::onChangeShowOSD);
|
connect(actShowOSD, &QAction::triggered, this, &MainWindow::onChangeShowOSD);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QMenu* menu = menubar->addMenu("Config");
|
QMenu * menu = menubar->addMenu("Config");
|
||||||
|
|
||||||
actEmuSettings = menu->addAction("Emu settings");
|
actEmuSettings = menu->addAction("Emu settings");
|
||||||
connect(actEmuSettings, &QAction::triggered, this, &MainWindow::onOpenEmuSettings);
|
connect(actEmuSettings, &QAction::triggered, this, &MainWindow::onOpenEmuSettings);
|
||||||
|
@ -643,7 +649,7 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
||||||
connect(actPathSettings, &QAction::triggered, this, &MainWindow::onOpenPathSettings);
|
connect(actPathSettings, &QAction::triggered, this, &MainWindow::onOpenPathSettings);
|
||||||
|
|
||||||
{
|
{
|
||||||
QMenu* submenu = menu->addMenu("Savestate settings");
|
QMenu * submenu = menu->addMenu("Savestate settings");
|
||||||
|
|
||||||
actSavestateSRAMReloc = submenu->addAction("Separate savefiles");
|
actSavestateSRAMReloc = submenu->addAction("Separate savefiles");
|
||||||
actSavestateSRAMReloc->setCheckable(true);
|
actSavestateSRAMReloc->setCheckable(true);
|
||||||
|
@ -661,9 +667,10 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
||||||
connect(actAudioSync, &QAction::triggered, this, &MainWindow::onChangeAudioSync);
|
connect(actAudioSync, &QAction::triggered, this, &MainWindow::onChangeAudioSync);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QMenu* menu = menubar->addMenu("Help");
|
QMenu * menu = menubar->addMenu("Help");
|
||||||
actAbout = menu->addAction("About...");
|
actAbout = menu->addAction("About...");
|
||||||
connect(actAbout, &QAction::triggered, this, [&]{
|
connect(actAbout, &QAction::triggered, this, [&]
|
||||||
|
{
|
||||||
auto dialog = AboutDialog(this);
|
auto dialog = AboutDialog(this);
|
||||||
dialog.exec();
|
dialog.exec();
|
||||||
});
|
});
|
||||||
|
@ -673,6 +680,7 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
||||||
|
|
||||||
if (localCfg.GetString("Firmware.Username") == "Arisotura")
|
if (localCfg.GetString("Firmware.Username") == "Arisotura")
|
||||||
actMPNewInstance->setText("Fart");
|
actMPNewInstance->setText("Fart");
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
QPoint screenCenter = screen()->availableGeometry().center();
|
QPoint screenCenter = screen()->availableGeometry().center();
|
||||||
|
@ -695,13 +703,15 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
||||||
|
|
||||||
createScreenPanel();
|
createScreenPanel();
|
||||||
|
|
||||||
|
if (hasMenu)
|
||||||
|
{
|
||||||
actEjectCart->setEnabled(false);
|
actEjectCart->setEnabled(false);
|
||||||
actEjectGBACart->setEnabled(false);
|
actEjectGBACart->setEnabled(false);
|
||||||
|
|
||||||
if (globalCfg.GetInt("Emu.ConsoleType") == 1)
|
if (globalCfg.GetInt("Emu.ConsoleType") == 1)
|
||||||
{
|
{
|
||||||
actInsertGBACart->setEnabled(false);
|
actInsertGBACart->setEnabled(false);
|
||||||
for (auto act : actInsertGBAAddon)
|
for (auto act: actInsertGBAAddon)
|
||||||
act->setEnabled(false);
|
act->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -777,6 +787,7 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
||||||
actPreferences->setEnabled(false);
|
actPreferences->setEnabled(false);
|
||||||
#endif // __APPLE__
|
#endif // __APPLE__
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QObject::connect(qApp, &QApplication::applicationStateChanged, this, &MainWindow::onAppStateChanged);
|
QObject::connect(qApp, &QApplication::applicationStateChanged, this, &MainWindow::onAppStateChanged);
|
||||||
onUpdateInterfaceSettings();
|
onUpdateInterfaceSettings();
|
||||||
|
@ -786,8 +797,11 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
{
|
{
|
||||||
|
if (hasMenu)
|
||||||
|
{
|
||||||
delete[] actScreenAspectTop;
|
delete[] actScreenAspectTop;
|
||||||
delete[] actScreenAspectBot;
|
delete[] actScreenAspectBot;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::osdAddMessage(unsigned int color, const char* msg)
|
void MainWindow::osdAddMessage(unsigned int color, const char* msg)
|
||||||
|
@ -834,6 +848,7 @@ void MainWindow::createScreenPanel()
|
||||||
}
|
}
|
||||||
setCentralWidget(panel);
|
setCentralWidget(panel);
|
||||||
|
|
||||||
|
if (hasMenu)
|
||||||
actScreenFiltering->setEnabled(hasOGL);
|
actScreenFiltering->setEnabled(hasOGL);
|
||||||
panel->osdSetEnabled(showOSD);
|
panel->osdSetEnabled(showOSD);
|
||||||
|
|
||||||
|
@ -1635,6 +1650,8 @@ void MainWindow::onNPTest()
|
||||||
|
|
||||||
void MainWindow::updateMPInterface(MPInterfaceType type)
|
void MainWindow::updateMPInterface(MPInterfaceType type)
|
||||||
{
|
{
|
||||||
|
if (!hasMenu) return;
|
||||||
|
|
||||||
// MP interface was changed, reflect it in the UI
|
// MP interface was changed, reflect it in the UI
|
||||||
|
|
||||||
bool enable = (type == MPInterface_Local);
|
bool enable = (type == MPInterface_Local);
|
||||||
|
@ -1995,24 +2012,28 @@ void MainWindow::onTitleUpdate(QString title)
|
||||||
setWindowTitle(title);
|
setWindowTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToggleFullscreen(MainWindow* mainWindow)
|
void MainWindow::toggleFullscreen()
|
||||||
{
|
{
|
||||||
if (!mainWindow->isFullScreen())
|
if (!isFullScreen())
|
||||||
{
|
{
|
||||||
mainWindow->showFullScreen();
|
showFullScreen();
|
||||||
mainWindow->menuBar()->setFixedHeight(0); // Don't use hide() as menubar actions stop working
|
if (hasMenu)
|
||||||
|
menuBar()->setFixedHeight(0); // Don't use hide() as menubar actions stop working
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mainWindow->showNormal();
|
showNormal();
|
||||||
int menuBarHeight = mainWindow->menuBar()->sizeHint().height();
|
if (hasMenu)
|
||||||
mainWindow->menuBar()->setFixedHeight(menuBarHeight);
|
{
|
||||||
|
int menuBarHeight = menuBar()->sizeHint().height();
|
||||||
|
menuBar()->setFixedHeight(menuBarHeight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onFullscreenToggled()
|
void MainWindow::onFullscreenToggled()
|
||||||
{
|
{
|
||||||
ToggleFullscreen(this);
|
toggleFullscreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onScreenEmphasisToggled()
|
void MainWindow::onScreenEmphasisToggled()
|
||||||
|
@ -2033,6 +2054,8 @@ void MainWindow::onScreenEmphasisToggled()
|
||||||
|
|
||||||
void MainWindow::onEmuStart()
|
void MainWindow::onEmuStart()
|
||||||
{
|
{
|
||||||
|
if (!hasMenu) return;
|
||||||
|
|
||||||
for (int i = 1; i < 9; i++)
|
for (int i = 1; i < 9; i++)
|
||||||
{
|
{
|
||||||
actSaveState[i]->setEnabled(true);
|
actSaveState[i]->setEnabled(true);
|
||||||
|
@ -2056,6 +2079,8 @@ void MainWindow::onEmuStart()
|
||||||
|
|
||||||
void MainWindow::onEmuStop()
|
void MainWindow::onEmuStop()
|
||||||
{
|
{
|
||||||
|
if (!hasMenu) return;
|
||||||
|
|
||||||
for (int i = 0; i < 9; i++)
|
for (int i = 0; i < 9; i++)
|
||||||
{
|
{
|
||||||
actSaveState[i]->setEnabled(false);
|
actSaveState[i]->setEnabled(false);
|
||||||
|
@ -2076,11 +2101,15 @@ void MainWindow::onEmuStop()
|
||||||
|
|
||||||
void MainWindow::onEmuPause(bool pause)
|
void MainWindow::onEmuPause(bool pause)
|
||||||
{
|
{
|
||||||
|
if (!hasMenu) return;
|
||||||
|
|
||||||
actPause->setChecked(pause);
|
actPause->setChecked(pause);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onEmuReset()
|
void MainWindow::onEmuReset()
|
||||||
{
|
{
|
||||||
|
if (!hasMenu) return;
|
||||||
|
|
||||||
actUndoStateLoad->setEnabled(false);
|
actUndoStateLoad->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,10 @@ public:
|
||||||
EmuInstance* getEmuInstance() { return emuInstance; }
|
EmuInstance* getEmuInstance() { return emuInstance; }
|
||||||
Config::Table& getWindowConfig() { return windowCfg; }
|
Config::Table& getWindowConfig() { return windowCfg; }
|
||||||
|
|
||||||
|
bool winHasMenu() { return hasMenu; }
|
||||||
|
|
||||||
|
void toggleFullscreen();
|
||||||
|
|
||||||
bool hasOpenGL() { return hasOGL; }
|
bool hasOpenGL() { return hasOGL; }
|
||||||
GL::Context* getOGLContext();
|
GL::Context* getOGLContext();
|
||||||
void initOpenGL();
|
void initOpenGL();
|
||||||
|
@ -263,6 +267,8 @@ private:
|
||||||
public:
|
public:
|
||||||
ScreenPanel* panel;
|
ScreenPanel* panel;
|
||||||
|
|
||||||
|
bool hasMenu;
|
||||||
|
|
||||||
QAction* actOpenROM;
|
QAction* actOpenROM;
|
||||||
QAction* actBootFirmware;
|
QAction* actBootFirmware;
|
||||||
QAction* actCurrentCart;
|
QAction* actCurrentCart;
|
||||||
|
@ -335,6 +341,4 @@ public:
|
||||||
QAction* actAbout;
|
QAction* actAbout;
|
||||||
};
|
};
|
||||||
|
|
||||||
void ToggleFullscreen(MainWindow* mainWindow);
|
|
||||||
|
|
||||||
#endif // WINDOW_H
|
#endif // WINDOW_H
|
||||||
|
|
|
@ -364,7 +364,7 @@ int main(int argc, char** argv)
|
||||||
win->preloadROMs(dsfile, gbafile, options->boot);
|
win->preloadROMs(dsfile, gbafile, options->boot);
|
||||||
|
|
||||||
if (options->fullscreen)
|
if (options->fullscreen)
|
||||||
ToggleFullscreen(win);
|
win->toggleFullscreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = melon.exec();
|
int ret = melon.exec();
|
||||||
|
|
Loading…
Reference in New Issue