Qt: Add a context menu to the toolbar's Settings button when the game is running
A new small context menu that allows to select between global settings and game settings.
This commit is contained in:
parent
f34b17446c
commit
6f0280afc2
|
@ -1555,6 +1555,10 @@ void MainWindow::setupAdditionalUi()
|
|||
m_status_vps_widget->setFixedSize(125, 16);
|
||||
m_status_vps_widget->hide();
|
||||
|
||||
m_settings_toolbar_menu = new QMenu(m_ui.toolBar);
|
||||
m_settings_toolbar_menu->addAction(m_ui.actionSettings);
|
||||
m_settings_toolbar_menu->addAction(m_ui.actionViewGameProperties);
|
||||
|
||||
m_ui.actionGridViewShowTitles->setChecked(m_game_list_widget->getShowGridCoverTitles());
|
||||
|
||||
updateDebugMenuVisibility();
|
||||
|
@ -1943,6 +1947,7 @@ void MainWindow::connectSignals()
|
|||
connect(m_ui.actionExit, &QAction::triggered, this, &MainWindow::close);
|
||||
connect(m_ui.actionFullscreen, &QAction::triggered, g_emu_thread, &EmuThread::toggleFullscreen);
|
||||
connect(m_ui.actionSettings, &QAction::triggered, [this]() { doSettings(); });
|
||||
connect(m_ui.actionSettings2, &QAction::triggered, this, &MainWindow::onSettingsTriggeredFromToolbar);
|
||||
connect(m_ui.actionGeneralSettings, &QAction::triggered, [this]() { doSettings("General"); });
|
||||
connect(m_ui.actionBIOSSettings, &QAction::triggered, [this]() { doSettings("BIOS"); });
|
||||
connect(m_ui.actionConsoleSettings, &QAction::triggered, [this]() { doSettings("Console"); });
|
||||
|
@ -2750,6 +2755,18 @@ void MainWindow::onToolsOpenDataDirectoryTriggered()
|
|||
QtUtils::OpenURL(this, QUrl::fromLocalFile(QString::fromStdString(EmuFolders::DataRoot)));
|
||||
}
|
||||
|
||||
void MainWindow::onSettingsTriggeredFromToolbar()
|
||||
{
|
||||
if (s_system_valid)
|
||||
{
|
||||
m_settings_toolbar_menu->exec(QCursor::pos());
|
||||
}
|
||||
else
|
||||
{
|
||||
doSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::checkForUpdates(bool display_message)
|
||||
{
|
||||
if (!AutoUpdaterDialog::isSupported())
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <QtCore/QThread>
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <QtWidgets/QMainWindow>
|
||||
#include <QtWidgets/QMenu>
|
||||
#include <QtWidgets/QStackedWidget>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
@ -156,6 +157,7 @@ private Q_SLOTS:
|
|||
void onToolsCoverDownloaderTriggered();
|
||||
void onToolsCheatManagerTriggered();
|
||||
void onToolsOpenDataDirectoryTriggered();
|
||||
void onSettingsTriggeredFromToolbar();
|
||||
|
||||
void onGameListRefreshComplete();
|
||||
void onGameListRefreshProgress(const QString& status, int current, int total);
|
||||
|
@ -264,6 +266,8 @@ private:
|
|||
QLabel* m_status_vps_widget = nullptr;
|
||||
QLabel* m_status_resolution_widget = nullptr;
|
||||
|
||||
QMenu* m_settings_toolbar_menu = nullptr;
|
||||
|
||||
SettingsDialog* m_settings_dialog = nullptr;
|
||||
ControllerSettingsDialog* m_controller_settings_dialog = nullptr;
|
||||
|
||||
|
|
|
@ -277,7 +277,7 @@
|
|||
<addaction name="actionSaveState"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionFullscreen"/>
|
||||
<addaction name="actionSettings"/>
|
||||
<addaction name="actionSettings2"/>
|
||||
<addaction name="actionControllerSettings"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
|
@ -610,7 +610,22 @@
|
|||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Settings...</string>
|
||||
<string>&Settings</string>
|
||||
</property>
|
||||
<property name="menuRole">
|
||||
<enum>QAction::PreferencesRole</enum>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSettings2">
|
||||
<property name="icon">
|
||||
<iconset theme="settings-3-line">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Settings</string>
|
||||
</property>
|
||||
<property name="menuRole">
|
||||
<enum>QAction::PreferencesRole</enum>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionChangeDiscFromFile">
|
||||
|
|
Loading…
Reference in New Issue