Qt: Add per-page help to settings dialog
This commit is contained in:
parent
1d9bcb2a48
commit
7b9be0a586
|
@ -9,7 +9,28 @@
|
|||
#include "qthostinterface.h"
|
||||
#include <QtWidgets/QTextEdit>
|
||||
|
||||
static constexpr char DEFAULT_SETTING_HELP_TEXT[] = "Mouse over an option for additional information.";
|
||||
static constexpr char DEFAULT_SETTING_HELP_TEXT[] = "";
|
||||
|
||||
static constexpr std::array<const char*, static_cast<int>(SettingsDialog::Category::Count)> s_category_help_text = {
|
||||
{"<strong>General Settings</strong><hr>These options control how the emulator looks and behaves.<br><br>Mouse over "
|
||||
"an option for additional information.",
|
||||
"<strong>Console Settings</strong><hr>These options determine the configuration of the simulated "
|
||||
"console.<br><br>Mouse over an option for additional information.",
|
||||
"<strong>Game List Settings</strong><hr>The list above shows the directories which will be searched by DuckStation "
|
||||
"to populate the game list. Search directories can be added, removed, and switched to recursive/non-recursive. "
|
||||
"Additionally, the redump.org database can be downloaded or updated to provide titles for discs, as the discs "
|
||||
"themselves do not provide title information.",
|
||||
"<strong>Hotkey Settings</strong><hr>Binding a hotkey allows you to trigger events such as a resetting, powering "
|
||||
"off, taking screenshots or saving/loading states at the press of a key/controller button. Hotkey titles are "
|
||||
"self-explanatory.",
|
||||
"<strong>Port Settings</strong><hr>This page lets you choose the type of controller you wish to simulate for the "
|
||||
"console, and rebind the keys or host game controller buttons to your choosing. Clicking a binding will start a "
|
||||
"count-down, in which case you should press the key or controller button/axis you wish to bind. If no button is "
|
||||
"pressed and the timer lapses, the binding will be unchanged. To clear a binding, right-click the button.",
|
||||
"<strong>GPU Settings</strong><hr>These options control the simulation of the GPU in the console. Various "
|
||||
"enhancements are available, mouse over each for additional information.",
|
||||
"<strong>Audio Settings</strong><hr>These options control the audio output of the console. Mouse over an option for "
|
||||
"additional information."}};
|
||||
|
||||
SettingsDialog::SettingsDialog(QtHostInterface* host_interface, QWidget* parent /* = nullptr */)
|
||||
: QDialog(parent), m_host_interface(host_interface)
|
||||
|
@ -34,9 +55,8 @@ SettingsDialog::SettingsDialog(QtHostInterface* host_interface, QWidget* parent
|
|||
|
||||
m_ui.settingsCategory->setCurrentRow(0);
|
||||
m_ui.settingsContainer->setCurrentIndex(0);
|
||||
m_ui.helpText->setText(tr(s_category_help_text[0]));
|
||||
connect(m_ui.settingsCategory, &QListWidget::currentRowChanged, this, &SettingsDialog::onCategoryCurrentRowChanged);
|
||||
|
||||
m_ui.helpText->setText(tr(DEFAULT_SETTING_HELP_TEXT));
|
||||
}
|
||||
|
||||
SettingsDialog::~SettingsDialog() = default;
|
||||
|
@ -51,7 +71,9 @@ void SettingsDialog::setCategory(Category category)
|
|||
|
||||
void SettingsDialog::onCategoryCurrentRowChanged(int row)
|
||||
{
|
||||
Q_ASSERT(row < static_cast<int>(Category::Count));
|
||||
m_ui.settingsContainer->setCurrentIndex(row);
|
||||
m_ui.helpText->setText(tr(s_category_help_text[row]));
|
||||
}
|
||||
|
||||
void SettingsDialog::registerWidgetHelp(QObject* object, const char* title, const char* recommended_value,
|
||||
|
@ -88,7 +110,7 @@ bool SettingsDialog::eventFilter(QObject* object, QEvent* event)
|
|||
if (m_current_help_widget)
|
||||
{
|
||||
m_current_help_widget = nullptr;
|
||||
m_ui.helpText->setText(tr(DEFAULT_SETTING_HELP_TEXT));
|
||||
m_ui.helpText->setText(tr(s_category_help_text[m_ui.settingsCategory->currentRow()]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue