InterfacePane: Add BalloonTip to user style combobox

This commit is contained in:
Dentomologist 2023-11-13 15:08:09 -08:00 committed by Admiral H. Curtiss
parent 33b64d6c91
commit de9326bd53
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
2 changed files with 18 additions and 13 deletions

View File

@ -27,6 +27,7 @@
#include "DolphinQt/Config/ConfigControls/ConfigChoice.h" #include "DolphinQt/Config/ConfigControls/ConfigChoice.h"
#include "DolphinQt/Config/ConfigControls/ConfigRadio.h" #include "DolphinQt/Config/ConfigControls/ConfigRadio.h"
#include "DolphinQt/Config/ToolTipControls/ToolTipCheckBox.h" #include "DolphinQt/Config/ToolTipControls/ToolTipCheckBox.h"
#include "DolphinQt/Config/ToolTipControls/ToolTipComboBox.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h" #include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/SignalBlocking.h" #include "DolphinQt/QtUtils/SignalBlocking.h"
#include "DolphinQt/Settings.h" #include "DolphinQt/Settings.h"
@ -88,7 +89,8 @@ static ConfigStringChoice* MakeLanguageComboBox()
InterfacePane::InterfacePane(QWidget* parent) : QWidget(parent) InterfacePane::InterfacePane(QWidget* parent) : QWidget(parent)
{ {
CreateLayout(); CreateLayout();
LoadConfig(); UpdateShowDebuggingCheckbox();
LoadUserStyle();
ConnectLayout(); ConnectLayout();
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
@ -136,7 +138,7 @@ void InterfacePane::CreateUI()
combobox_layout->addRow(tr("&Theme:"), m_combobox_theme); combobox_layout->addRow(tr("&Theme:"), m_combobox_theme);
// User Style Combobox // User Style Combobox
m_combobox_userstyle = new QComboBox; m_combobox_userstyle = new ToolTipComboBox;
m_label_userstyle = new QLabel(tr("Style:")); m_label_userstyle = new QLabel(tr("Style:"));
combobox_layout->addRow(m_label_userstyle, m_combobox_userstyle); combobox_layout->addRow(m_label_userstyle, m_combobox_userstyle);
@ -239,7 +241,7 @@ void InterfacePane::ConnectLayout()
connect(m_combobox_theme, &QComboBox::currentIndexChanged, this, connect(m_combobox_theme, &QComboBox::currentIndexChanged, this,
[this](int index) { Settings::Instance().TriggerThemeChanged(); }); [this](int index) { Settings::Instance().TriggerThemeChanged(); });
connect(m_combobox_userstyle, &QComboBox::currentIndexChanged, this, connect(m_combobox_userstyle, &QComboBox::currentIndexChanged, this,
&InterfacePane::OnSaveConfig); &InterfacePane::OnUserStyleChanged);
connect(m_combobox_language, &QComboBox::currentIndexChanged, this, connect(m_combobox_language, &QComboBox::currentIndexChanged, this,
[this]() { OnLanguageChanged(); }); [this]() { OnLanguageChanged(); });
connect(m_checkbox_top_window, &QCheckBox::toggled, &Settings::Instance(), connect(m_checkbox_top_window, &QCheckBox::toggled, &Settings::Instance(),
@ -284,10 +286,8 @@ void InterfacePane::UpdateShowDebuggingCheckbox()
#endif // USE_RETRO_ACHIEVEMENTS #endif // USE_RETRO_ACHIEVEMENTS
} }
void InterfacePane::LoadConfig() void InterfacePane::LoadUserStyle()
{ {
UpdateShowDebuggingCheckbox();
const Settings::StyleType style_type = Settings::Instance().GetStyleType(); const Settings::StyleType style_type = Settings::Instance().GetStyleType();
const QString userstyle = Settings::Instance().GetUserStyleName(); const QString userstyle = Settings::Instance().GetUserStyleName();
const int index = style_type == Settings::StyleType::User ? const int index = style_type == Settings::StyleType::User ?
@ -298,7 +298,7 @@ void InterfacePane::LoadConfig()
SignalBlocking(m_combobox_userstyle)->setCurrentIndex(index); SignalBlocking(m_combobox_userstyle)->setCurrentIndex(index);
} }
void InterfacePane::OnSaveConfig() void InterfacePane::OnUserStyleChanged()
{ {
const auto selected_style = m_combobox_userstyle->currentData(); const auto selected_style = m_combobox_userstyle->currentData();
bool is_builtin_type = false; bool is_builtin_type = false;
@ -309,8 +309,6 @@ void InterfacePane::OnSaveConfig()
if (!is_builtin_type) if (!is_builtin_type)
Settings::Instance().SetUserStyleName(selected_style.toString()); Settings::Instance().SetUserStyleName(selected_style.toString());
Settings::Instance().ApplyStyle(); Settings::Instance().ApplyStyle();
Config::Save();
} }
void InterfacePane::OnLanguageChanged() void InterfacePane::OnLanguageChanged()
@ -380,6 +378,10 @@ void InterfacePane::AddDescriptions()
static constexpr char TR_CURSOR_VISIBLE_ALWAYS_DESCRIPTION[] = QT_TR_NOOP( static constexpr char TR_CURSOR_VISIBLE_ALWAYS_DESCRIPTION[] = QT_TR_NOOP(
"Shows the Mouse Cursor at all times." "Shows the Mouse Cursor at all times."
"<br><br><dolphin_emphasis>If unsure, select &quot;On Movement&quot;.</dolphin_emphasis>"); "<br><br><dolphin_emphasis>If unsure, select &quot;On Movement&quot;.</dolphin_emphasis>");
static constexpr char TR_USER_STYLE_DESCRIPTION[] =
QT_TR_NOOP("Sets the style of Dolphin's User Interface. Any Custom User Styles that you have "
"loaded will be presented here, allowing you to switch to them."
"<br><br><dolphin_emphasis>If unsure, select (System).</dolphin_emphasis>");
m_checkbox_use_builtin_title_database->SetDescription(tr(TR_TITLE_DATABASE_DESCRIPTION)); m_checkbox_use_builtin_title_database->SetDescription(tr(TR_TITLE_DATABASE_DESCRIPTION));
@ -414,4 +416,7 @@ void InterfacePane::AddDescriptions()
m_radio_cursor_visible_never->SetDescription(tr(TR_CURSOR_VISIBLE_NEVER_DESCRIPTION)); m_radio_cursor_visible_never->SetDescription(tr(TR_CURSOR_VISIBLE_NEVER_DESCRIPTION));
m_radio_cursor_visible_always->SetDescription(tr(TR_CURSOR_VISIBLE_ALWAYS_DESCRIPTION)); m_radio_cursor_visible_always->SetDescription(tr(TR_CURSOR_VISIBLE_ALWAYS_DESCRIPTION));
m_combobox_userstyle->SetTitle(tr("Style"));
m_combobox_userstyle->SetDescription(tr(TR_USER_STYLE_DESCRIPTION));
} }

View File

@ -8,10 +8,10 @@
class ConfigBool; class ConfigBool;
class ConfigRadioInt; class ConfigRadioInt;
class ConfigStringChoice; class ConfigStringChoice;
class QComboBox;
class QLabel; class QLabel;
class QVBoxLayout; class QVBoxLayout;
class ToolTipCheckBox; class ToolTipCheckBox;
class ToolTipComboBox;
class InterfacePane final : public QWidget class InterfacePane final : public QWidget
{ {
@ -26,15 +26,15 @@ private:
void AddDescriptions(); void AddDescriptions();
void ConnectLayout(); void ConnectLayout();
void UpdateShowDebuggingCheckbox(); void UpdateShowDebuggingCheckbox();
void LoadConfig(); void LoadUserStyle();
void OnSaveConfig(); void OnUserStyleChanged();
void OnLanguageChanged(); void OnLanguageChanged();
QVBoxLayout* m_main_layout; QVBoxLayout* m_main_layout;
ConfigStringChoice* m_combobox_language; ConfigStringChoice* m_combobox_language;
ConfigStringChoice* m_combobox_theme; ConfigStringChoice* m_combobox_theme;
QComboBox* m_combobox_userstyle; ToolTipComboBox* m_combobox_userstyle;
QLabel* m_label_userstyle; QLabel* m_label_userstyle;
ConfigBool* m_checkbox_top_window; ConfigBool* m_checkbox_top_window;
ConfigBool* m_checkbox_use_builtin_title_database; ConfigBool* m_checkbox_use_builtin_title_database;