mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge pull request #12315 from Dentomologist/interfacepane_add_balloontips
InterfacePane: Add BalloonTips
This commit is contained in:
@@ -30,3 +30,60 @@ void ConfigChoice::Update(int choice)
|
||||
{
|
||||
Config::SetBaseOrCurrent(m_setting, choice);
|
||||
}
|
||||
|
||||
ConfigStringChoice::ConfigStringChoice(const std::vector<std::string>& options,
|
||||
const Config::Info<std::string>& setting)
|
||||
: m_setting(setting), m_text_is_data(true)
|
||||
{
|
||||
for (const auto& op : options)
|
||||
addItem(QString::fromStdString(op));
|
||||
|
||||
Connect();
|
||||
Load();
|
||||
}
|
||||
|
||||
ConfigStringChoice::ConfigStringChoice(const std::vector<std::pair<QString, QString>>& options,
|
||||
const Config::Info<std::string>& setting)
|
||||
: m_setting(setting), m_text_is_data(false)
|
||||
{
|
||||
for (const auto& [option_text, option_data] : options)
|
||||
addItem(option_text, option_data);
|
||||
|
||||
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)
|
||||
{
|
||||
if (m_text_is_data)
|
||||
{
|
||||
Config::SetBaseOrCurrent(m_setting, itemText(index).toStdString());
|
||||
}
|
||||
else
|
||||
{
|
||||
Config::SetBaseOrCurrent(m_setting, itemData(index).toString().toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigStringChoice::Load()
|
||||
{
|
||||
const QString setting_value = QString::fromStdString(Config::Get(m_setting));
|
||||
|
||||
const int index = m_text_is_data ? findText(setting_value) : findData(setting_value);
|
||||
const QSignalBlocker blocker(this);
|
||||
setCurrentIndex(index);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "DolphinQt/Config/ToolTipControls/ToolTipComboBox.h"
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
@@ -18,3 +22,21 @@ private:
|
||||
|
||||
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);
|
||||
ConfigStringChoice(const std::vector<std::pair<QString, QString>>& options,
|
||||
const Config::Info<std::string>& setting);
|
||||
|
||||
private:
|
||||
void Connect();
|
||||
void Update(int index);
|
||||
void Load();
|
||||
|
||||
Config::Info<std::string> m_setting;
|
||||
bool m_text_is_data = false;
|
||||
};
|
||||
|
||||
@@ -27,8 +27,13 @@ ConfigRadioInt::ConfigRadioInt(const QString& label, const Config::Info<int>& se
|
||||
|
||||
void ConfigRadioInt::Update()
|
||||
{
|
||||
if (!isChecked())
|
||||
return;
|
||||
|
||||
Config::SetBaseOrCurrent(m_setting, m_value);
|
||||
if (isChecked())
|
||||
{
|
||||
Config::SetBaseOrCurrent(m_setting, m_value);
|
||||
emit OnSelected(m_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
emit OnDeselected(m_value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,12 @@ class ConfigRadioInt : public ToolTipRadioButton
|
||||
public:
|
||||
ConfigRadioInt(const QString& label, const Config::Info<int>& setting, int value);
|
||||
|
||||
signals:
|
||||
// Since selecting a new radio button deselects the old one, ::toggled will generate two signals.
|
||||
// These are convenience functions so you can receive only one signal if desired.
|
||||
void OnSelected(int new_value);
|
||||
void OnDeselected(int old_value);
|
||||
|
||||
private:
|
||||
void Update();
|
||||
|
||||
|
||||
@@ -118,9 +118,8 @@ QSettings& Settings::GetQSettings()
|
||||
return settings;
|
||||
}
|
||||
|
||||
void Settings::SetThemeName(const QString& theme_name)
|
||||
void Settings::TriggerThemeChanged()
|
||||
{
|
||||
Config::SetBaseOrCurrent(Config::MAIN_THEME_NAME, theme_name.toStdString());
|
||||
emit ThemeChanged();
|
||||
}
|
||||
|
||||
@@ -419,23 +418,11 @@ void Settings::SetStateSlot(int slot)
|
||||
GetQSettings().setValue(QStringLiteral("Emulation/StateSlot"), slot);
|
||||
}
|
||||
|
||||
void Settings::SetCursorVisibility(Config::ShowCursor hideCursor)
|
||||
{
|
||||
Config::SetBaseOrCurrent(Config::MAIN_SHOW_CURSOR, hideCursor);
|
||||
emit CursorVisibilityChanged();
|
||||
}
|
||||
|
||||
Config::ShowCursor Settings::GetCursorVisibility() const
|
||||
{
|
||||
return Config::Get(Config::MAIN_SHOW_CURSOR);
|
||||
}
|
||||
|
||||
void Settings::SetLockCursor(bool lock_cursor)
|
||||
{
|
||||
Config::SetBaseOrCurrent(Config::MAIN_LOCK_CURSOR, lock_cursor);
|
||||
emit LockCursorChanged();
|
||||
}
|
||||
|
||||
bool Settings::GetLockCursor() const
|
||||
{
|
||||
return Config::Get(Config::MAIN_LOCK_CURSOR);
|
||||
@@ -446,7 +433,6 @@ void Settings::SetKeepWindowOnTop(bool top)
|
||||
if (IsKeepWindowOnTopEnabled() == top)
|
||||
return;
|
||||
|
||||
Config::SetBaseOrCurrent(Config::MAIN_KEEP_WINDOW_ON_TOP, top);
|
||||
emit KeepWindowOnTopChanged(top);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
static QSettings& GetQSettings();
|
||||
|
||||
// UI
|
||||
void SetThemeName(const QString& theme_name);
|
||||
void TriggerThemeChanged();
|
||||
void InitDefaultPalette();
|
||||
void UpdateSystemDark();
|
||||
void SetSystemDark(bool dark);
|
||||
@@ -122,9 +122,7 @@ public:
|
||||
void SetUSBKeyboardConnected(bool connected);
|
||||
|
||||
// Graphics
|
||||
void SetCursorVisibility(Config::ShowCursor hideCursor);
|
||||
Config::ShowCursor GetCursorVisibility() const;
|
||||
void SetLockCursor(bool lock_cursor);
|
||||
bool GetLockCursor() const;
|
||||
void SetKeepWindowOnTop(bool top);
|
||||
bool IsKeepWindowOnTopEnabled() const;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,12 +5,13 @@
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QCheckBox;
|
||||
class QComboBox;
|
||||
class ConfigBool;
|
||||
class ConfigRadioInt;
|
||||
class ConfigStringChoice;
|
||||
class QLabel;
|
||||
class QRadioButton;
|
||||
class QVBoxLayout;
|
||||
class ToolTipCheckBox;
|
||||
class ToolTipComboBox;
|
||||
|
||||
class InterfacePane final : public QWidget
|
||||
{
|
||||
@@ -22,34 +23,33 @@ private:
|
||||
void CreateLayout();
|
||||
void CreateUI();
|
||||
void CreateInGame();
|
||||
void AddDescriptions();
|
||||
void ConnectLayout();
|
||||
void LoadConfig();
|
||||
void OnSaveConfig();
|
||||
void OnCursorVisibleMovement();
|
||||
void OnCursorVisibleNever();
|
||||
void OnCursorVisibleAlways();
|
||||
void UpdateShowDebuggingCheckbox();
|
||||
void LoadUserStyle();
|
||||
void OnUserStyleChanged();
|
||||
void OnLanguageChanged();
|
||||
|
||||
QVBoxLayout* m_main_layout;
|
||||
QComboBox* m_combobox_language;
|
||||
ConfigStringChoice* m_combobox_language;
|
||||
|
||||
QComboBox* m_combobox_theme;
|
||||
QComboBox* m_combobox_userstyle;
|
||||
ConfigStringChoice* m_combobox_theme;
|
||||
ToolTipComboBox* m_combobox_userstyle;
|
||||
QLabel* m_label_userstyle;
|
||||
QCheckBox* m_checkbox_top_window;
|
||||
QCheckBox* m_checkbox_use_builtin_title_database;
|
||||
QCheckBox* m_checkbox_use_userstyle;
|
||||
ConfigBool* m_checkbox_top_window;
|
||||
ConfigBool* m_checkbox_use_builtin_title_database;
|
||||
ToolTipCheckBox* m_checkbox_show_debugging_ui;
|
||||
QCheckBox* m_checkbox_focused_hotkeys;
|
||||
QCheckBox* m_checkbox_use_covers;
|
||||
QCheckBox* m_checkbox_disable_screensaver;
|
||||
ConfigBool* m_checkbox_focused_hotkeys;
|
||||
ConfigBool* m_checkbox_use_covers;
|
||||
ConfigBool* m_checkbox_disable_screensaver;
|
||||
|
||||
QCheckBox* m_checkbox_confirm_on_stop;
|
||||
QCheckBox* m_checkbox_use_panic_handlers;
|
||||
QCheckBox* m_checkbox_enable_osd;
|
||||
QCheckBox* m_checkbox_show_active_title;
|
||||
QCheckBox* m_checkbox_pause_on_focus_lost;
|
||||
QRadioButton* m_radio_cursor_visible_movement;
|
||||
QRadioButton* m_radio_cursor_visible_never;
|
||||
QRadioButton* m_radio_cursor_visible_always;
|
||||
QCheckBox* m_checkbox_lock_mouse;
|
||||
ConfigBool* m_checkbox_confirm_on_stop;
|
||||
ConfigBool* m_checkbox_use_panic_handlers;
|
||||
ConfigBool* m_checkbox_enable_osd;
|
||||
ConfigBool* m_checkbox_show_active_title;
|
||||
ConfigBool* m_checkbox_pause_on_focus_lost;
|
||||
ConfigRadioInt* m_radio_cursor_visible_movement;
|
||||
ConfigRadioInt* m_radio_cursor_visible_never;
|
||||
ConfigRadioInt* m_radio_cursor_visible_always;
|
||||
ConfigBool* m_checkbox_lock_mouse;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user