mirror of https://github.com/mgba-emu/mgba.git
Qt: re-layout menus
This commit is contained in:
parent
b1e6a0df08
commit
bbdb8b513b
|
@ -284,13 +284,13 @@ void Window::setupMenu(QMenuBar* menubar) {
|
||||||
fileMenu->addSeparator();
|
fileMenu->addSeparator();
|
||||||
|
|
||||||
QAction* loadState = new QAction(tr("&Load state"), fileMenu);
|
QAction* loadState = new QAction(tr("&Load state"), fileMenu);
|
||||||
loadState->setShortcut(tr("Ctrl+L"));
|
loadState->setShortcut(tr("F10"));
|
||||||
connect(loadState, &QAction::triggered, [this]() { this->openStateWindow(LoadSave::LOAD); });
|
connect(loadState, &QAction::triggered, [this]() { this->openStateWindow(LoadSave::LOAD); });
|
||||||
m_gameActions.append(loadState);
|
m_gameActions.append(loadState);
|
||||||
fileMenu->addAction(loadState);
|
fileMenu->addAction(loadState);
|
||||||
|
|
||||||
QAction* saveState = new QAction(tr("&Save state"), fileMenu);
|
QAction* saveState = new QAction(tr("&Save state"), fileMenu);
|
||||||
saveState->setShortcut(tr("Ctrl+S"));
|
saveState->setShortcut(tr("Shift+F10"));
|
||||||
connect(saveState, &QAction::triggered, [this]() { this->openStateWindow(LoadSave::SAVE); });
|
connect(saveState, &QAction::triggered, [this]() { this->openStateWindow(LoadSave::SAVE); });
|
||||||
m_gameActions.append(saveState);
|
m_gameActions.append(saveState);
|
||||||
fileMenu->addAction(saveState);
|
fileMenu->addAction(saveState);
|
||||||
|
@ -312,25 +312,6 @@ void Window::setupMenu(QMenuBar* menubar) {
|
||||||
quickSaveMenu->addAction(quickSave);
|
quickSaveMenu->addAction(quickSave);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USE_PNG) || defined(USE_FFMPEG)
|
|
||||||
fileMenu->addSeparator();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_PNG
|
|
||||||
QAction* screenshot = new QAction(tr("Take &screenshot"), fileMenu);
|
|
||||||
screenshot->setShortcut(tr("F12"));
|
|
||||||
connect(screenshot, SIGNAL(triggered()), m_display, SLOT(screenshot()));
|
|
||||||
m_gameActions.append(screenshot);
|
|
||||||
fileMenu->addAction(screenshot);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_FFMPEG
|
|
||||||
QAction* recordOutput = new QAction(tr("Record output..."), fileMenu);
|
|
||||||
recordOutput->setShortcut(tr("F11"));
|
|
||||||
connect(recordOutput, SIGNAL(triggered()), this, SLOT(openVideoWindow()));
|
|
||||||
fileMenu->addAction(recordOutput);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
fileMenu->addSeparator();
|
fileMenu->addSeparator();
|
||||||
fileMenu->addAction(tr("E&xit"), this, SLOT(close()), QKeySequence::Quit);
|
fileMenu->addAction(tr("E&xit"), this, SLOT(close()), QKeySequence::Quit);
|
||||||
|
@ -408,27 +389,27 @@ void Window::setupMenu(QMenuBar* menubar) {
|
||||||
connect(keymap, SIGNAL(triggered()), this, SLOT(openKeymapWindow()));
|
connect(keymap, SIGNAL(triggered()), this, SLOT(openKeymapWindow()));
|
||||||
emulationMenu->addAction(keymap);
|
emulationMenu->addAction(keymap);
|
||||||
|
|
||||||
QMenu* videoMenu = menubar->addMenu(tr("&Video"));
|
QMenu* avMenu = menubar->addMenu(tr("Audio/&Video"));
|
||||||
QMenu* frameMenu = videoMenu->addMenu(tr("Frame size"));
|
QMenu* frameMenu = avMenu->addMenu(tr("Frame size"));
|
||||||
QAction* setSize = new QAction(tr("1x"), videoMenu);
|
QAction* setSize = new QAction(tr("1x"), avMenu);
|
||||||
connect(setSize, &QAction::triggered, [this]() {
|
connect(setSize, &QAction::triggered, [this]() {
|
||||||
showNormal();
|
showNormal();
|
||||||
resize(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);
|
resize(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);
|
||||||
});
|
});
|
||||||
frameMenu->addAction(setSize);
|
frameMenu->addAction(setSize);
|
||||||
setSize = new QAction(tr("2x"), videoMenu);
|
setSize = new QAction(tr("2x"), avMenu);
|
||||||
connect(setSize, &QAction::triggered, [this]() {
|
connect(setSize, &QAction::triggered, [this]() {
|
||||||
showNormal();
|
showNormal();
|
||||||
resize(VIDEO_HORIZONTAL_PIXELS * 2, VIDEO_VERTICAL_PIXELS * 2);
|
resize(VIDEO_HORIZONTAL_PIXELS * 2, VIDEO_VERTICAL_PIXELS * 2);
|
||||||
});
|
});
|
||||||
frameMenu->addAction(setSize);
|
frameMenu->addAction(setSize);
|
||||||
setSize = new QAction(tr("3x"), videoMenu);
|
setSize = new QAction(tr("3x"), avMenu);
|
||||||
connect(setSize, &QAction::triggered, [this]() {
|
connect(setSize, &QAction::triggered, [this]() {
|
||||||
showNormal();
|
showNormal();
|
||||||
resize(VIDEO_HORIZONTAL_PIXELS * 3, VIDEO_VERTICAL_PIXELS * 3);
|
resize(VIDEO_HORIZONTAL_PIXELS * 3, VIDEO_VERTICAL_PIXELS * 3);
|
||||||
});
|
});
|
||||||
frameMenu->addAction(setSize);
|
frameMenu->addAction(setSize);
|
||||||
setSize = new QAction(tr("4x"), videoMenu);
|
setSize = new QAction(tr("4x"), avMenu);
|
||||||
connect(setSize, &QAction::triggered, [this]() {
|
connect(setSize, &QAction::triggered, [this]() {
|
||||||
showNormal();
|
showNormal();
|
||||||
resize(VIDEO_HORIZONTAL_PIXELS * 4, VIDEO_VERTICAL_PIXELS * 4);
|
resize(VIDEO_HORIZONTAL_PIXELS * 4, VIDEO_VERTICAL_PIXELS * 4);
|
||||||
|
@ -436,7 +417,7 @@ void Window::setupMenu(QMenuBar* menubar) {
|
||||||
frameMenu->addAction(setSize);
|
frameMenu->addAction(setSize);
|
||||||
frameMenu->addAction(tr("Fullscreen"), this, SLOT(toggleFullScreen()), QKeySequence("Ctrl+F"));
|
frameMenu->addAction(tr("Fullscreen"), this, SLOT(toggleFullScreen()), QKeySequence("Ctrl+F"));
|
||||||
|
|
||||||
QMenu* skipMenu = videoMenu->addMenu(tr("Frame&skip"));
|
QMenu* skipMenu = avMenu->addMenu(tr("Frame&skip"));
|
||||||
ConfigOption* skip = m_config->addOption("frameskip");
|
ConfigOption* skip = m_config->addOption("frameskip");
|
||||||
skip->connect([this](const QVariant& value) { m_controller->setFrameskip(value.toInt()); });
|
skip->connect([this](const QVariant& value) { m_controller->setFrameskip(value.toInt()); });
|
||||||
for (int i = 0; i <= 10; ++i) {
|
for (int i = 0; i <= 10; ++i) {
|
||||||
|
@ -444,8 +425,9 @@ void Window::setupMenu(QMenuBar* menubar) {
|
||||||
}
|
}
|
||||||
m_config->updateOption("frameskip");
|
m_config->updateOption("frameskip");
|
||||||
|
|
||||||
QMenu* soundMenu = menubar->addMenu(tr("&Sound"));
|
avMenu->addSeparator();
|
||||||
QMenu* buffersMenu = soundMenu->addMenu(tr("Buffer &size"));
|
|
||||||
|
QMenu* buffersMenu = avMenu->addMenu(tr("Buffer &size"));
|
||||||
ConfigOption* buffers = m_config->addOption("audioBuffers");
|
ConfigOption* buffers = m_config->addOption("audioBuffers");
|
||||||
buffers->connect([this](const QVariant& value) { emit audioBufferSamplesChanged(value.toInt()); });
|
buffers->connect([this](const QVariant& value) { emit audioBufferSamplesChanged(value.toInt()); });
|
||||||
buffers->addValue(tr("512"), 512, buffersMenu);
|
buffers->addValue(tr("512"), 512, buffersMenu);
|
||||||
|
@ -455,6 +437,25 @@ void Window::setupMenu(QMenuBar* menubar) {
|
||||||
buffers->addValue(tr("4096"), 4096, buffersMenu);
|
buffers->addValue(tr("4096"), 4096, buffersMenu);
|
||||||
m_config->updateOption("audioBuffers");
|
m_config->updateOption("audioBuffers");
|
||||||
|
|
||||||
|
#if defined(USE_PNG) || defined(USE_FFMPEG)
|
||||||
|
avMenu->addSeparator();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_PNG
|
||||||
|
QAction* screenshot = new QAction(tr("Take &screenshot"), avMenu);
|
||||||
|
screenshot->setShortcut(tr("F12"));
|
||||||
|
connect(screenshot, SIGNAL(triggered()), m_display, SLOT(screenshot()));
|
||||||
|
m_gameActions.append(screenshot);
|
||||||
|
avMenu->addAction(screenshot);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_FFMPEG
|
||||||
|
QAction* recordOutput = new QAction(tr("Record output..."), avMenu);
|
||||||
|
recordOutput->setShortcut(tr("F11"));
|
||||||
|
connect(recordOutput, SIGNAL(triggered()), this, SLOT(openVideoWindow()));
|
||||||
|
avMenu->addAction(recordOutput);
|
||||||
|
#endif
|
||||||
|
|
||||||
QMenu* debuggingMenu = menubar->addMenu(tr("&Debugging"));
|
QMenu* debuggingMenu = menubar->addMenu(tr("&Debugging"));
|
||||||
QAction* viewLogs = new QAction(tr("View &logs..."), debuggingMenu);
|
QAction* viewLogs = new QAction(tr("View &logs..."), debuggingMenu);
|
||||||
connect(viewLogs, SIGNAL(triggered()), m_logView, SLOT(show()));
|
connect(viewLogs, SIGNAL(triggered()), m_logView, SLOT(show()));
|
||||||
|
|
Loading…
Reference in New Issue