summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2026-04-05 11:27:56 +0200
committerJosJuice <josjuice@gmail.com>2026-04-06 17:23:40 +0200
commit7e98245ca47ff2ea0203930049cc725b4c433f72 (patch)
tree18962e038e980ca5e4162f0b4cd64e023527a5a8 /Source
parentd3275b9ffe3c6412cb0a10bc3a4fec7883894981 (diff)
DolphinQt: Remove Presets from GameConfigEdit
Back in 2018, a Presets system was added to DolphinQt's GameConfigEdit. Presets was a dropdown menu where you could select a particular setting to add to your custom game INI. Only a small number of settings were made available, with the intent that more would be added over time. 8 years later, the set of available settings hasn't been expanded at all, and I don't know of anyone who uses these presets. On top of this, we have now made good progress in exposing per-game settings graphically. I think the Presets system is best off removed. In place of the Presets menu, we now have "Refresh" and "Open in External Editor" buttons. These more useful actions were previously hidden away in the Presets menu.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/DolphinQt/Config/GameConfigEdit.cpp107
-rw-r--r--Source/Core/DolphinQt/Config/GameConfigEdit.h9
2 files changed, 15 insertions, 101 deletions
diff --git a/Source/Core/DolphinQt/Config/GameConfigEdit.cpp b/Source/Core/DolphinQt/Config/GameConfigEdit.cpp
index 3c49fcae05..e43c222293 100644
--- a/Source/Core/DolphinQt/Config/GameConfigEdit.cpp
+++ b/Source/Core/DolphinQt/Config/GameConfigEdit.cpp
@@ -7,9 +7,8 @@
#include <QCompleter>
#include <QDesktopServices>
#include <QFile>
+#include <QHBoxLayout>
#include <QKeyEvent>
-#include <QMenu>
-#include <QMenuBar>
#include <QPushButton>
#include <QRegularExpression>
#include <QScrollBar>
@@ -72,7 +71,6 @@ GameConfigEdit::GameConfigEdit(QWidget* parent, QString path, bool read_only)
m_completer->setCompletionMode(QCompleter::PopupCompletion);
m_completer->setWidget(m_edit);
- AddMenubarOptions();
ConnectWidgets();
}
@@ -82,17 +80,15 @@ void GameConfigEdit::CreateWidgets()
m_edit->setReadOnly(m_read_only);
m_edit->setAcceptRichText(false);
- auto* layout = new QVBoxLayout;
-
- auto* menu_button = new QPushButton;
-
- menu_button->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
- menu_button->setText(tr("Presets"));
+ m_refresh_button = new QPushButton(tr("Refresh"));
+ m_external_editor_button = new QPushButton(tr("Open in External Editor"));
- m_menu = new QMenu(menu_button);
- menu_button->setMenu(m_menu);
+ auto* button_layout = new QHBoxLayout;
+ button_layout->addWidget(m_refresh_button);
+ button_layout->addWidget(m_external_editor_button);
- layout->addWidget(menu_button);
+ auto* layout = new QVBoxLayout;
+ layout->addLayout(button_layout);
layout->addWidget(m_edit);
setLayout(layout);
@@ -138,6 +134,10 @@ void GameConfigEdit::ConnectWidgets()
connect(m_edit, &QTextEdit::selectionChanged, this, &GameConfigEdit::OnSelectionChanged);
connect(m_completer, qOverload<const QString&>(&QCompleter::activated), this,
&GameConfigEdit::OnAutoComplete);
+
+ connect(m_refresh_button, &QPushButton::clicked, this, &GameConfigEdit::LoadFile);
+ connect(m_external_editor_button, &QPushButton::clicked, this,
+ &GameConfigEdit::OpenExternalEditor);
}
void GameConfigEdit::OnSelectionChanged()
@@ -148,47 +148,6 @@ void GameConfigEdit::OnSelectionChanged()
QWhatsThis::showText(QCursor::pos(), m_keyword_map[keyword], this);
}
-void GameConfigEdit::AddBoolOption(QMenu* menu, const QString& name, const QString& section,
- const QString& key)
-{
- auto* option = menu->addMenu(name);
-
- option->addAction(tr("On"), this,
- [this, section, key] { SetOption(section, key, QStringLiteral("True")); });
- option->addAction(tr("Off"), this,
- [this, section, key] { SetOption(section, key, QStringLiteral("False")); });
-}
-
-void GameConfigEdit::SetOption(const QString& section, const QString& key, const QString& value)
-{
- auto section_cursor =
- m_edit->document()->find(QRegularExpression(QStringLiteral("^\\[%1\\]").arg(section)), 0);
-
- // Check if the section this belongs in can be found
- if (section_cursor.isNull())
- {
- m_edit->append(QStringLiteral("[%1]\n\n%2 = %3\n").arg(section).arg(key).arg(value));
- }
- else
- {
- auto value_cursor = m_edit->document()->find(
- QRegularExpression(QStringLiteral("^%1 = .*").arg(key)), section_cursor);
-
- const QString new_line = QStringLiteral("%1 = %2").arg(key).arg(value);
-
- // Check if the value that has to be set already exists
- if (value_cursor.isNull())
- {
- section_cursor.clearSelection();
- section_cursor.insertText(QLatin1Char{'\n'} + new_line);
- }
- else
- {
- value_cursor.insertText(new_line);
- }
- }
-}
-
QString GameConfigEdit::GetTextUnderCursor()
{
QTextCursor tc = m_edit->textCursor();
@@ -196,48 +155,6 @@ QString GameConfigEdit::GetTextUnderCursor()
return tc.selectedText();
}
-void GameConfigEdit::AddMenubarOptions()
-{
- auto* editor = m_menu->addMenu(tr("Editor"));
-
- editor->addAction(tr("Refresh"), this, &GameConfigEdit::LoadFile);
- editor->addAction(tr("Open in External Editor"), this, &GameConfigEdit::OpenExternalEditor);
-
- if (!m_read_only)
- {
- m_menu->addSeparator();
- auto* core_menubar = m_menu->addMenu(tr("Core"));
-
- AddBoolOption(core_menubar, tr("Dual Core"), QStringLiteral("Core"),
- QStringLiteral("CPUThread"));
- AddBoolOption(core_menubar, tr("MMU"), QStringLiteral("Core"), QStringLiteral("MMU"));
-
- auto* video_menubar = m_menu->addMenu(tr("Video"));
-
- AddBoolOption(video_menubar, tr("Store EFB Copies to Texture Only"),
- QStringLiteral("Video_Hacks"), QStringLiteral("EFBToTextureEnable"));
-
- AddBoolOption(video_menubar, tr("Store XFB Copies to Texture Only"),
- QStringLiteral("Video_Hacks"), QStringLiteral("XFBToTextureEnable"));
-
- {
- auto* texture_cache = video_menubar->addMenu(tr("Texture Cache"));
- texture_cache->addAction(tr("Safe"), this, [this] {
- SetOption(QStringLiteral("Video_Settings"), QStringLiteral("SafeTextureCacheColorSamples"),
- QStringLiteral("0"));
- });
- texture_cache->addAction(tr("Medium"), this, [this] {
- SetOption(QStringLiteral("Video_Settings"), QStringLiteral("SafeTextureCacheColorSamples"),
- QStringLiteral("512"));
- });
- texture_cache->addAction(tr("Fast"), this, [this] {
- SetOption(QStringLiteral("Video_Settings"), QStringLiteral("SafeTextureCacheColorSamples"),
- QStringLiteral("128"));
- });
- }
- }
-}
-
void GameConfigEdit::OnAutoComplete(const QString& completion)
{
QTextCursor cursor = m_edit->textCursor();
diff --git a/Source/Core/DolphinQt/Config/GameConfigEdit.h b/Source/Core/DolphinQt/Config/GameConfigEdit.h
index 1fceaedb8a..73184c2b13 100644
--- a/Source/Core/DolphinQt/Config/GameConfigEdit.h
+++ b/Source/Core/DolphinQt/Config/GameConfigEdit.h
@@ -4,6 +4,7 @@
#pragma once
#include <QMap>
+#include <QPushButton>
#include <QString>
#include <QStringList>
#include <QWidget>
@@ -24,7 +25,6 @@ protected:
private:
void CreateWidgets();
void ConnectWidgets();
- void AddMenubarOptions();
void LoadFile();
void SaveFile();
@@ -35,15 +35,12 @@ private:
QString GetTextUnderCursor();
- void AddBoolOption(QMenu* menu, const QString& name, const QString& section, const QString& key);
-
- void SetOption(const QString& section, const QString& key, const QString& value);
-
void AddDescription(const QString& keyword, const QString& description);
QCompleter* m_completer;
QStringList m_completions;
- QMenu* m_menu;
+ QPushButton* m_refresh_button;
+ QPushButton* m_external_editor_button;
QTextEdit* m_edit;
const QString m_path;