mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
InterfacePane: Add BalloonTip to theme combobox
This commit is contained in:
parent
ae0914174f
commit
55aaa323ec
@ -30,3 +30,39 @@ void ConfigChoice::Update(int choice)
|
|||||||
{
|
{
|
||||||
Config::SetBaseOrCurrent(m_setting, choice);
|
Config::SetBaseOrCurrent(m_setting, choice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConfigStringChoice::ConfigStringChoice(const std::vector<std::string>& options,
|
||||||
|
const Config::Info<std::string>& setting)
|
||||||
|
: m_setting(setting)
|
||||||
|
{
|
||||||
|
for (const auto& op : options)
|
||||||
|
addItem(QString::fromStdString(op));
|
||||||
|
|
||||||
|
Connect();
|
||||||
|
Load();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigStringChoice::Connect()
|
||||||
|
{
|
||||||
|
const auto on_config_changed = [this]() {
|
||||||
|
QFont bf = font();
|
||||||
|
bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base);
|
||||||
|
setFont(bf);
|
||||||
|
|
||||||
|
Load();
|
||||||
|
};
|
||||||
|
|
||||||
|
connect(&Settings::Instance(), &Settings::ConfigChanged, this, on_config_changed);
|
||||||
|
connect(this, &QComboBox::currentIndexChanged, this, &ConfigStringChoice::Update);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigStringChoice::Update(int index)
|
||||||
|
{
|
||||||
|
Config::SetBaseOrCurrent(m_setting, itemText(index).toStdString());
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigStringChoice::Load()
|
||||||
|
{
|
||||||
|
const QSignalBlocker blocker(this);
|
||||||
|
setCurrentIndex(findText(QString::fromStdString(Config::Get(m_setting))));
|
||||||
|
}
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "DolphinQt/Config/ToolTipControls/ToolTipComboBox.h"
|
#include "DolphinQt/Config/ToolTipControls/ToolTipComboBox.h"
|
||||||
|
|
||||||
#include "Common/Config/Config.h"
|
#include "Common/Config/Config.h"
|
||||||
@ -18,3 +21,18 @@ private:
|
|||||||
|
|
||||||
Config::Info<int> m_setting;
|
Config::Info<int> m_setting;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ConfigStringChoice : public ToolTipComboBox
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
ConfigStringChoice(const std::vector<std::string>& options,
|
||||||
|
const Config::Info<std::string>& setting);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void Connect();
|
||||||
|
void Update(int index);
|
||||||
|
void Load();
|
||||||
|
|
||||||
|
Config::Info<std::string> m_setting;
|
||||||
|
};
|
||||||
|
@ -118,9 +118,8 @@ QSettings& Settings::GetQSettings()
|
|||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::SetThemeName(const QString& theme_name)
|
void Settings::TriggerThemeChanged()
|
||||||
{
|
{
|
||||||
Config::SetBaseOrCurrent(Config::MAIN_THEME_NAME, theme_name.toStdString());
|
|
||||||
emit ThemeChanged();
|
emit ThemeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public:
|
|||||||
static QSettings& GetQSettings();
|
static QSettings& GetQSettings();
|
||||||
|
|
||||||
// UI
|
// UI
|
||||||
void SetThemeName(const QString& theme_name);
|
void TriggerThemeChanged();
|
||||||
void InitDefaultPalette();
|
void InitDefaultPalette();
|
||||||
void UpdateSystemDark();
|
void UpdateSystemDark();
|
||||||
void SetSystemDark(bool dark);
|
void SetSystemDark(bool dark);
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "Core/Config/UISettings.h"
|
#include "Core/Config/UISettings.h"
|
||||||
|
|
||||||
#include "DolphinQt/Config/ConfigControls/ConfigBool.h"
|
#include "DolphinQt/Config/ConfigControls/ConfigBool.h"
|
||||||
|
#include "DolphinQt/Config/ConfigControls/ConfigChoice.h"
|
||||||
#include "DolphinQt/Config/ToolTipControls/ToolTipCheckBox.h"
|
#include "DolphinQt/Config/ToolTipControls/ToolTipCheckBox.h"
|
||||||
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
||||||
#include "DolphinQt/QtUtils/SignalBlocking.h"
|
#include "DolphinQt/QtUtils/SignalBlocking.h"
|
||||||
@ -120,18 +121,17 @@ void InterfacePane::CreateUI()
|
|||||||
m_combobox_language = MakeLanguageComboBox();
|
m_combobox_language = MakeLanguageComboBox();
|
||||||
combobox_layout->addRow(tr("&Language:"), m_combobox_language);
|
combobox_layout->addRow(tr("&Language:"), m_combobox_language);
|
||||||
|
|
||||||
// Theme Combobox
|
|
||||||
m_combobox_theme = new QComboBox;
|
|
||||||
combobox_layout->addRow(tr("&Theme:"), m_combobox_theme);
|
|
||||||
|
|
||||||
// List avalable themes
|
// List avalable themes
|
||||||
auto theme_search_results =
|
auto theme_paths =
|
||||||
Common::DoFileSearch({File::GetUserPath(D_THEMES_IDX), File::GetSysDirectory() + THEMES_DIR});
|
Common::DoFileSearch({File::GetUserPath(D_THEMES_IDX), File::GetSysDirectory() + THEMES_DIR});
|
||||||
for (const std::string& path : theme_search_results)
|
std::vector<std::string> theme_names;
|
||||||
{
|
theme_names.reserve(theme_paths.size());
|
||||||
const QString qt_name = QString::fromStdString(PathToFileName(path));
|
std::transform(theme_paths.cbegin(), theme_paths.cend(), std::back_inserter(theme_names),
|
||||||
m_combobox_theme->addItem(qt_name);
|
PathToFileName);
|
||||||
}
|
|
||||||
|
// Theme Combobox
|
||||||
|
m_combobox_theme = new ConfigStringChoice(theme_names, Config::MAIN_THEME_NAME);
|
||||||
|
combobox_layout->addRow(tr("&Theme:"), m_combobox_theme);
|
||||||
|
|
||||||
// User Style Combobox
|
// User Style Combobox
|
||||||
m_combobox_userstyle = new QComboBox;
|
m_combobox_userstyle = new QComboBox;
|
||||||
@ -229,9 +229,8 @@ void InterfacePane::ConnectLayout()
|
|||||||
connect(m_checkbox_disable_screensaver, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
connect(m_checkbox_disable_screensaver, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
||||||
connect(m_checkbox_show_debugging_ui, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
connect(m_checkbox_show_debugging_ui, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
||||||
connect(m_checkbox_focused_hotkeys, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
connect(m_checkbox_focused_hotkeys, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
||||||
connect(m_combobox_theme, &QComboBox::currentIndexChanged, this, [this](int index) {
|
connect(m_combobox_theme, &QComboBox::currentIndexChanged, this,
|
||||||
Settings::Instance().SetThemeName(m_combobox_theme->itemText(index));
|
[this](int index) { Settings::Instance().TriggerThemeChanged(); });
|
||||||
});
|
|
||||||
connect(m_combobox_userstyle, &QComboBox::currentIndexChanged, this,
|
connect(m_combobox_userstyle, &QComboBox::currentIndexChanged, this,
|
||||||
&InterfacePane::OnSaveConfig);
|
&InterfacePane::OnSaveConfig);
|
||||||
connect(m_combobox_language, &QComboBox::currentIndexChanged, this, &InterfacePane::OnSaveConfig);
|
connect(m_combobox_language, &QComboBox::currentIndexChanged, this, &InterfacePane::OnSaveConfig);
|
||||||
@ -273,9 +272,6 @@ void InterfacePane::LoadConfig()
|
|||||||
SignalBlocking(m_combobox_language)
|
SignalBlocking(m_combobox_language)
|
||||||
->setCurrentIndex(m_combobox_language->findData(
|
->setCurrentIndex(m_combobox_language->findData(
|
||||||
QString::fromStdString(Config::Get(Config::MAIN_INTERFACE_LANGUAGE))));
|
QString::fromStdString(Config::Get(Config::MAIN_INTERFACE_LANGUAGE))));
|
||||||
SignalBlocking(m_combobox_theme)
|
|
||||||
->setCurrentIndex(
|
|
||||||
m_combobox_theme->findText(QString::fromStdString(Config::Get(Config::MAIN_THEME_NAME))));
|
|
||||||
|
|
||||||
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();
|
||||||
@ -375,6 +371,12 @@ void InterfacePane::AddDescriptions()
|
|||||||
static constexpr char TR_TITLE_DATABASE_DESCRIPTION[] = QT_TR_NOOP(
|
static constexpr char TR_TITLE_DATABASE_DESCRIPTION[] = QT_TR_NOOP(
|
||||||
"Uses Dolphin's database of properly formatted names in the Game List Title column."
|
"Uses Dolphin's database of properly formatted names in the Game List Title column."
|
||||||
"<br><br><dolphin_emphasis>If unsure, leave this checked.</dolphin_emphasis>");
|
"<br><br><dolphin_emphasis>If unsure, leave this checked.</dolphin_emphasis>");
|
||||||
|
static constexpr char TR_THEME_DESCRIPTION[] =
|
||||||
|
QT_TR_NOOP("Changes the appearance and color of Dolphin's buttons."
|
||||||
|
"<br><br><dolphin_emphasis>If unsure, select Clean.</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));
|
||||||
|
|
||||||
|
m_combobox_theme->SetTitle(tr("Theme"));
|
||||||
|
m_combobox_theme->SetDescription(tr(TR_THEME_DESCRIPTION));
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class ConfigBool;
|
class ConfigBool;
|
||||||
|
class ConfigStringChoice;
|
||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
@ -34,7 +35,7 @@ private:
|
|||||||
QVBoxLayout* m_main_layout;
|
QVBoxLayout* m_main_layout;
|
||||||
QComboBox* m_combobox_language;
|
QComboBox* m_combobox_language;
|
||||||
|
|
||||||
QComboBox* m_combobox_theme;
|
ConfigStringChoice* m_combobox_theme;
|
||||||
QComboBox* m_combobox_userstyle;
|
QComboBox* m_combobox_userstyle;
|
||||||
QLabel* m_label_userstyle;
|
QLabel* m_label_userstyle;
|
||||||
QCheckBox* m_checkbox_top_window;
|
QCheckBox* m_checkbox_top_window;
|
||||||
|
Loading…
Reference in New Issue
Block a user