mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-27 17:39:34 -06:00
Merge pull request #13761 from Dentomologist/qt_use_nonautodismissiblemenu_in_more_places
Qt: Use NonAutodismissibleMenu in more places
This commit is contained in:
@ -66,6 +66,7 @@
|
|||||||
#include "DolphinQt/QtUtils/DolphinFileDialog.h"
|
#include "DolphinQt/QtUtils/DolphinFileDialog.h"
|
||||||
#include "DolphinQt/QtUtils/DoubleClickEventFilter.h"
|
#include "DolphinQt/QtUtils/DoubleClickEventFilter.h"
|
||||||
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
||||||
|
#include "DolphinQt/QtUtils/NonAutodismissibleMenu.h"
|
||||||
#include "DolphinQt/QtUtils/ParallelProgressDialog.h"
|
#include "DolphinQt/QtUtils/ParallelProgressDialog.h"
|
||||||
#include "DolphinQt/Resources.h"
|
#include "DolphinQt/Resources.h"
|
||||||
#include "DolphinQt/Settings.h"
|
#include "DolphinQt/Settings.h"
|
||||||
@ -519,7 +520,8 @@ void GameList::ShowContextMenu(const QPoint&)
|
|||||||
|
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
|
||||||
auto* tags_menu = menu->addMenu(tr("Tags"));
|
auto* const tags_menu{new QtUtils::NonAutodismissibleMenu(tr("Tags"), menu)};
|
||||||
|
menu->addMenu(tags_menu);
|
||||||
|
|
||||||
auto path = game->GetFilePath();
|
auto path = game->GetFilePath();
|
||||||
auto game_tags = m_model.GetGameTags(path);
|
auto game_tags = m_model.GetGameTags(path);
|
||||||
|
@ -470,6 +470,13 @@ void GameListModel::AddGameTag(const std::string& path, const QString& name)
|
|||||||
|
|
||||||
m_game_tags[QString::fromStdString(path)] = tags;
|
m_game_tags[QString::fromStdString(path)] = tags;
|
||||||
Settings::GetQSettings().setValue(QStringLiteral("gamelist/game_tags"), m_game_tags);
|
Settings::GetQSettings().setValue(QStringLiteral("gamelist/game_tags"), m_game_tags);
|
||||||
|
|
||||||
|
const int row = FindGameIndex(path);
|
||||||
|
if (row >= 0)
|
||||||
|
{
|
||||||
|
const QModelIndex index = createIndex(row, static_cast<int>(Column::Tags));
|
||||||
|
emit dataChanged(index, index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameListModel::RemoveGameTag(const std::string& path, const QString& name)
|
void GameListModel::RemoveGameTag(const std::string& path, const QString& name)
|
||||||
@ -481,6 +488,13 @@ void GameListModel::RemoveGameTag(const std::string& path, const QString& name)
|
|||||||
m_game_tags[QString::fromStdString(path)] = tags;
|
m_game_tags[QString::fromStdString(path)] = tags;
|
||||||
|
|
||||||
Settings::GetQSettings().setValue(QStringLiteral("gamelist/game_tags"), m_game_tags);
|
Settings::GetQSettings().setValue(QStringLiteral("gamelist/game_tags"), m_game_tags);
|
||||||
|
|
||||||
|
const int row = FindGameIndex(path);
|
||||||
|
if (row >= 0)
|
||||||
|
{
|
||||||
|
const QModelIndex index = createIndex(row, static_cast<int>(Column::Tags));
|
||||||
|
emit dataChanged(index, index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameListModel::NewTag(const QString& name)
|
void GameListModel::NewTag(const QString& name)
|
||||||
|
@ -352,22 +352,23 @@ void MenuBar::AddToolsMenu()
|
|||||||
m_export_wii_saves =
|
m_export_wii_saves =
|
||||||
tools_menu->addAction(tr("Export All Wii Saves"), this, &MenuBar::ExportWiiSaves);
|
tools_menu->addAction(tr("Export All Wii Saves"), this, &MenuBar::ExportWiiSaves);
|
||||||
|
|
||||||
QMenu* menu = new QMenu(tr("Connect Wii Remotes"), tools_menu);
|
auto* const connect_wii_remotes_menu{
|
||||||
|
new QtUtils::NonAutodismissibleMenu(tr("Connect Wii Remotes"), tools_menu)};
|
||||||
|
|
||||||
tools_menu->addSeparator();
|
tools_menu->addSeparator();
|
||||||
tools_menu->addMenu(menu);
|
tools_menu->addMenu(connect_wii_remotes_menu);
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
m_wii_remotes[i] = menu->addAction(tr("Connect Wii Remote %1").arg(i + 1), this,
|
m_wii_remotes[i] = connect_wii_remotes_menu->addAction(
|
||||||
[this, i] { emit ConnectWiiRemote(i); });
|
tr("Connect Wii Remote %1").arg(i + 1), this, [this, i] { emit ConnectWiiRemote(i); });
|
||||||
m_wii_remotes[i]->setCheckable(true);
|
m_wii_remotes[i]->setCheckable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
menu->addSeparator();
|
connect_wii_remotes_menu->addSeparator();
|
||||||
|
|
||||||
m_wii_remotes[4] =
|
m_wii_remotes[4] = connect_wii_remotes_menu->addAction(tr("Connect Balance Board"), this,
|
||||||
menu->addAction(tr("Connect Balance Board"), this, [this] { emit ConnectWiiRemote(4); });
|
[this] { emit ConnectWiiRemote(4); });
|
||||||
m_wii_remotes[4]->setCheckable(true);
|
m_wii_remotes[4]->setCheckable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -601,7 +602,8 @@ void MenuBar::AddViewMenu()
|
|||||||
|
|
||||||
void MenuBar::AddOptionsMenu()
|
void MenuBar::AddOptionsMenu()
|
||||||
{
|
{
|
||||||
QMenu* options_menu = addMenu(tr("&Options"));
|
auto* const options_menu{new QtUtils::NonAutodismissibleMenu(tr("&Options"), this)};
|
||||||
|
addMenu(options_menu);
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
|
||||||
options_menu->addAction(tr("Co&nfiguration"), QKeySequence::Preferences, this,
|
options_menu->addAction(tr("Co&nfiguration"), QKeySequence::Preferences, this,
|
||||||
&MenuBar::Configure);
|
&MenuBar::Configure);
|
||||||
@ -892,7 +894,8 @@ void MenuBar::AddMovieMenu()
|
|||||||
|
|
||||||
void MenuBar::AddJITMenu()
|
void MenuBar::AddJITMenu()
|
||||||
{
|
{
|
||||||
m_jit = addMenu(tr("JIT"));
|
m_jit = new QtUtils::NonAutodismissibleMenu(tr("JIT"), this);
|
||||||
|
addMenu(m_jit);
|
||||||
|
|
||||||
m_jit_interpreter_core = m_jit->addAction(tr("Interpreter Core"));
|
m_jit_interpreter_core = m_jit->addAction(tr("Interpreter Core"));
|
||||||
m_jit_interpreter_core->setCheckable(true);
|
m_jit_interpreter_core->setCheckable(true);
|
||||||
|
Reference in New Issue
Block a user