mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-08-17 07:50:13 +00:00
Qt: purge gui settings
This commit is contained in:
parent
a146aabcaf
commit
b7e4de6ea5
9 changed files with 49 additions and 354 deletions
|
@ -15,57 +15,7 @@ inline std::string sstr(const QString& _in) { return _in.toStdString(); }
|
||||||
|
|
||||||
gui_settings::gui_settings(QObject* parent) : settings(parent)
|
gui_settings::gui_settings(QObject* parent) : settings(parent)
|
||||||
{
|
{
|
||||||
m_current_name = gui::Settings;
|
|
||||||
m_settings.reset(new QSettings(ComputeSettingsDir() + gui::Settings + ".ini", QSettings::Format::IniFormat, parent));
|
m_settings.reset(new QSettings(ComputeSettingsDir() + gui::Settings + ".ini", QSettings::Format::IniFormat, parent));
|
||||||
|
|
||||||
const QString settings_name = GetValue(gui::m_currentConfig).toString();
|
|
||||||
|
|
||||||
if (settings_name != m_current_name)
|
|
||||||
{
|
|
||||||
ChangeToConfig(settings_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool gui_settings::ChangeToConfig(const QString& config_name)
|
|
||||||
{
|
|
||||||
if (m_current_name == config_name)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Backup current config
|
|
||||||
SaveCurrentConfig(m_current_name);
|
|
||||||
|
|
||||||
// Save new config name to the default config
|
|
||||||
SaveConfigNameToDefault(config_name);
|
|
||||||
|
|
||||||
// Sync file just in case
|
|
||||||
m_settings->sync();
|
|
||||||
|
|
||||||
// Load new config
|
|
||||||
m_settings.reset(new QSettings(m_settings_dir.absoluteFilePath(config_name + ".ini"), QSettings::IniFormat));
|
|
||||||
|
|
||||||
// Save own name to new config
|
|
||||||
SetValue(gui::m_currentConfig, config_name);
|
|
||||||
m_settings->sync();
|
|
||||||
|
|
||||||
m_current_name = config_name;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gui_settings::Reset(bool remove_meta) const
|
|
||||||
{
|
|
||||||
if (remove_meta)
|
|
||||||
{
|
|
||||||
m_settings->clear();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_settings->remove(gui::logger);
|
|
||||||
m_settings->remove(gui::main_window);
|
|
||||||
m_settings->remove(gui::game_list);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList gui_settings::GetGameListCategoryFilters() const
|
QStringList gui_settings::GetGameListCategoryFilters() const
|
||||||
|
@ -245,13 +195,6 @@ void gui_settings::SetCustomColor(int col, const QColor& val) const
|
||||||
SetValue(gui_save(gui::meta, "CustomColor" + QString::number(col), gui::gl_icon_color), val);
|
SetValue(gui_save(gui::meta, "CustomColor" + QString::number(col), gui::gl_icon_color), val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gui_settings::SaveCurrentConfig(const QString& config_name)
|
|
||||||
{
|
|
||||||
SaveConfigNameToDefault(config_name);
|
|
||||||
BackupSettingsToTarget(config_name);
|
|
||||||
ChangeToConfig(config_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
logs::level gui_settings::GetLogLevel() const
|
logs::level gui_settings::GetLogLevel() const
|
||||||
{
|
{
|
||||||
return logs::level(GetValue(gui::l_level).toUInt());
|
return logs::level(GetValue(gui::l_level).toUInt());
|
||||||
|
@ -267,53 +210,6 @@ QColor gui_settings::GetCustomColor(int col) const
|
||||||
return GetValue(gui_save(gui::meta, "CustomColor" + QString::number(col), gui::gl_icon_color)).value<QColor>();
|
return GetValue(gui_save(gui::meta, "CustomColor" + QString::number(col), gui::gl_icon_color)).value<QColor>();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList gui_settings::GetConfigEntries() const
|
|
||||||
{
|
|
||||||
const QStringList name_filter = QStringList("*.ini");
|
|
||||||
const QFileInfoList entries = m_settings_dir.entryInfoList(name_filter, QDir::Files);
|
|
||||||
|
|
||||||
QStringList res;
|
|
||||||
|
|
||||||
for (const QFileInfo &entry : entries)
|
|
||||||
{
|
|
||||||
res.append(entry.baseName());
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save the name of the used config to the default settings file
|
|
||||||
void gui_settings::SaveConfigNameToDefault(const QString& config_name) const
|
|
||||||
{
|
|
||||||
if (m_current_name == gui::Settings)
|
|
||||||
{
|
|
||||||
SetValue(gui::m_currentConfig, config_name);
|
|
||||||
m_settings->sync();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QSettings tmp(m_settings_dir.absoluteFilePath(gui::Settings + ".ini"), QSettings::Format::IniFormat, parent());
|
|
||||||
tmp.beginGroup(gui::m_currentConfig.key);
|
|
||||||
tmp.setValue(gui::m_currentConfig.name, config_name);
|
|
||||||
tmp.endGroup();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void gui_settings::BackupSettingsToTarget(const QString& config_name) const
|
|
||||||
{
|
|
||||||
QSettings target(ComputeSettingsDir() + config_name + ".ini", QSettings::Format::IniFormat);
|
|
||||||
|
|
||||||
for (const QString& key : m_settings->allKeys())
|
|
||||||
{
|
|
||||||
if (!key.startsWith(gui::meta))
|
|
||||||
{
|
|
||||||
target.setValue(key, m_settings->value(key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
target.sync();
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList gui_settings::GetStylesheetEntries() const
|
QStringList gui_settings::GetStylesheetEntries() const
|
||||||
{
|
{
|
||||||
const QStringList name_filter = QStringList("*.qss");
|
const QStringList name_filter = QStringList("*.qss");
|
||||||
|
|
|
@ -196,7 +196,6 @@ namespace gui
|
||||||
const gui_save rsx_geometry = gui_save(rsx, "geometry", QByteArray());
|
const gui_save rsx_geometry = gui_save(rsx, "geometry", QByteArray());
|
||||||
const gui_save rsx_states = gui_save(rsx, "states", QVariantMap());
|
const gui_save rsx_states = gui_save(rsx, "states", QVariantMap());
|
||||||
|
|
||||||
const gui_save m_currentConfig = gui_save(meta, "currentConfig", Settings);
|
|
||||||
const gui_save m_currentStylesheet = gui_save(meta, "currentStylesheet", DefaultStylesheet);
|
const gui_save m_currentStylesheet = gui_save(meta, "currentStylesheet", DefaultStylesheet);
|
||||||
const gui_save m_showDebugTab = gui_save(meta, "showDebugTab", false);
|
const gui_save m_showDebugTab = gui_save(meta, "showDebugTab", false);
|
||||||
const gui_save m_enableUIColors = gui_save(meta, "enableUIColors", false);
|
const gui_save m_enableUIColors = gui_save(meta, "enableUIColors", false);
|
||||||
|
@ -253,9 +252,6 @@ class gui_settings : public settings
|
||||||
public:
|
public:
|
||||||
explicit gui_settings(QObject* parent = nullptr);
|
explicit gui_settings(QObject* parent = nullptr);
|
||||||
|
|
||||||
/** Changes the settings file to the destination preset*/
|
|
||||||
bool ChangeToConfig(const QString& config_name);
|
|
||||||
|
|
||||||
bool GetCategoryVisibility(int cat) const;
|
bool GetCategoryVisibility(int cat) const;
|
||||||
|
|
||||||
void ShowConfirmationBox(const QString& title, const QString& text, const gui_save& entry, int* result, QWidget* parent);
|
void ShowConfirmationBox(const QString& title, const QString& text, const gui_save& entry, int* result, QWidget* parent);
|
||||||
|
@ -265,13 +261,10 @@ public:
|
||||||
logs::level GetLogLevel() const;
|
logs::level GetLogLevel() const;
|
||||||
bool GetGamelistColVisibility(int col) const;
|
bool GetGamelistColVisibility(int col) const;
|
||||||
QColor GetCustomColor(int col) const;
|
QColor GetCustomColor(int col) const;
|
||||||
QStringList GetConfigEntries() const;
|
|
||||||
QStringList GetStylesheetEntries() const;
|
QStringList GetStylesheetEntries() const;
|
||||||
QStringList GetGameListCategoryFilters() const;
|
QStringList GetGameListCategoryFilters() const;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void Reset(bool remove_meta = false) const;
|
|
||||||
|
|
||||||
/** Sets the visibility of the chosen category. */
|
/** Sets the visibility of the chosen category. */
|
||||||
void SetCategoryVisibility(int cat, const bool& val) const;
|
void SetCategoryVisibility(int cat, const bool& val) const;
|
||||||
|
|
||||||
|
@ -279,13 +272,9 @@ public Q_SLOTS:
|
||||||
|
|
||||||
void SetCustomColor(int col, const QColor& val) const;
|
void SetCustomColor(int col, const QColor& val) const;
|
||||||
|
|
||||||
void SaveCurrentConfig(const QString& config_name);
|
|
||||||
|
|
||||||
static QSize SizeFromSlider(int pos);
|
static QSize SizeFromSlider(int pos);
|
||||||
static gui_save GetGuiSaveForColumn(int col);
|
static gui_save GetGuiSaveForColumn(int col);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SaveConfigNameToDefault(const QString& config_name) const;
|
|
||||||
void BackupSettingsToTarget(const QString& config_name) const;
|
|
||||||
void ShowBox(QMessageBox::Icon icon, const QString& title, const QString& text, const gui_save& entry, int* result, QWidget* parent, bool always_on_top);
|
void ShowBox(QMessageBox::Icon icon, const QString& title, const QString& text, const gui_save& entry, int* result, QWidget* parent, bool always_on_top);
|
||||||
};
|
};
|
||||||
|
|
|
@ -106,7 +106,7 @@ bool main_window::Init(bool with_cli_boot)
|
||||||
setWindowTitle(QString::fromStdString("RPCS3 " + rpcs3::get_version().to_string()));
|
setWindowTitle(QString::fromStdString("RPCS3 " + rpcs3::get_version().to_string()));
|
||||||
|
|
||||||
Q_EMIT RequestGlobalStylesheetChange();
|
Q_EMIT RequestGlobalStylesheetChange();
|
||||||
ConfigureGuiFromSettings(true);
|
ConfigureGuiFromSettings();
|
||||||
|
|
||||||
if (const std::string_view branch_name = rpcs3::get_full_branch(); branch_name != "RPCS3/rpcs3/master" && branch_name != "local_build")
|
if (const std::string_view branch_name = rpcs3::get_full_branch(); branch_name != "RPCS3/rpcs3/master" && branch_name != "local_build")
|
||||||
{
|
{
|
||||||
|
@ -2022,8 +2022,6 @@ void main_window::CreateConnects()
|
||||||
const auto open_settings = [this](int tabIndex)
|
const auto open_settings = [this](int tabIndex)
|
||||||
{
|
{
|
||||||
settings_dialog dlg(m_gui_settings, m_emu_settings, tabIndex, this);
|
settings_dialog dlg(m_gui_settings, m_emu_settings, tabIndex, this);
|
||||||
connect(&dlg, &settings_dialog::GuiSettingsSaveRequest, this, &main_window::SaveWindowState);
|
|
||||||
connect(&dlg, &settings_dialog::GuiSettingsSyncRequest, this, &main_window::ConfigureGuiFromSettings);
|
|
||||||
connect(&dlg, &settings_dialog::GuiStylesheetRequest, this, &main_window::RequestGlobalStylesheetChange);
|
connect(&dlg, &settings_dialog::GuiStylesheetRequest, this, &main_window::RequestGlobalStylesheetChange);
|
||||||
connect(&dlg, &settings_dialog::GuiRepaintRequest, this, &main_window::RepaintGui);
|
connect(&dlg, &settings_dialog::GuiRepaintRequest, this, &main_window::RepaintGui);
|
||||||
connect(&dlg, &settings_dialog::EmuSettingsApplied, this, &main_window::NotifyEmuSettingsChange);
|
connect(&dlg, &settings_dialog::EmuSettingsApplied, this, &main_window::NotifyEmuSettingsChange);
|
||||||
|
@ -2478,7 +2476,7 @@ void main_window::CreateDockWindows()
|
||||||
connect(m_game_list_frame, &game_list_frame::NotifyEmuSettingsChange, this, &main_window::NotifyEmuSettingsChange);
|
connect(m_game_list_frame, &game_list_frame::NotifyEmuSettingsChange, this, &main_window::NotifyEmuSettingsChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
void main_window::ConfigureGuiFromSettings(bool configure_all)
|
void main_window::ConfigureGuiFromSettings()
|
||||||
{
|
{
|
||||||
// Restore GUI state if needed. We need to if they exist.
|
// Restore GUI state if needed. We need to if they exist.
|
||||||
if (!restoreGeometry(m_gui_settings->GetValue(gui::mw_geometry).toByteArray()))
|
if (!restoreGeometry(m_gui_settings->GetValue(gui::mw_geometry).toByteArray()))
|
||||||
|
@ -2566,14 +2564,11 @@ void main_window::ConfigureGuiFromSettings(bool configure_all)
|
||||||
ui->sizeSlider->setSliderPosition(icon_size_index);
|
ui->sizeSlider->setSliderPosition(icon_size_index);
|
||||||
SetIconSizeActions(icon_size_index);
|
SetIconSizeActions(icon_size_index);
|
||||||
|
|
||||||
if (configure_all)
|
// Handle log settings
|
||||||
{
|
m_log_frame->LoadSettings();
|
||||||
// Handle log settings
|
|
||||||
m_log_frame->LoadSettings();
|
|
||||||
|
|
||||||
// Gamelist
|
// Gamelist
|
||||||
m_game_list_frame->LoadSettings();
|
m_game_list_frame->LoadSettings();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void main_window::SetIconSizeActions(int idx) const
|
void main_window::SetIconSizeActions(int idx) const
|
||||||
|
|
|
@ -115,7 +115,7 @@ private Q_SLOTS:
|
||||||
static void show_boot_error(game_boot_result status);
|
static void show_boot_error(game_boot_result status);
|
||||||
|
|
||||||
void SaveWindowState() const;
|
void SaveWindowState() const;
|
||||||
void ConfigureGuiFromSettings(bool configure_all = false);
|
void ConfigureGuiFromSettings();
|
||||||
void SetIconSizeActions(int idx) const;
|
void SetIconSizeActions(int idx) const;
|
||||||
void ResizeIcons(int index);
|
void ResizeIcons(int index);
|
||||||
|
|
||||||
|
|
|
@ -51,5 +51,4 @@ protected:
|
||||||
|
|
||||||
std::unique_ptr<QSettings> m_settings;
|
std::unique_ptr<QSettings> m_settings;
|
||||||
QDir m_settings_dir;
|
QDir m_settings_dir;
|
||||||
QString m_current_name;
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -163,7 +163,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
|
||||||
|
|
||||||
if (!game)
|
if (!game)
|
||||||
{
|
{
|
||||||
ApplyGuiOptions(false);
|
ApplyStylesheet(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1501,34 +1501,19 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
|
||||||
|
|
||||||
if (!game)
|
if (!game)
|
||||||
{
|
{
|
||||||
// Comboboxes
|
|
||||||
SubscribeTooltip(ui->combo_configs, tooltips.settings.configs);
|
|
||||||
|
|
||||||
SubscribeTooltip(ui->gb_stylesheets, tooltips.settings.stylesheets);
|
SubscribeTooltip(ui->gb_stylesheets, tooltips.settings.stylesheets);
|
||||||
|
|
||||||
// Checkboxes:
|
|
||||||
SubscribeTooltip(ui->cb_custom_colors, tooltips.settings.custom_colors);
|
SubscribeTooltip(ui->cb_custom_colors, tooltips.settings.custom_colors);
|
||||||
|
|
||||||
// Checkboxes: gui options
|
|
||||||
SubscribeTooltip(ui->cb_show_welcome, tooltips.settings.show_welcome);
|
SubscribeTooltip(ui->cb_show_welcome, tooltips.settings.show_welcome);
|
||||||
|
|
||||||
SubscribeTooltip(ui->cb_show_exit_game, tooltips.settings.show_exit_game);
|
SubscribeTooltip(ui->cb_show_exit_game, tooltips.settings.show_exit_game);
|
||||||
|
|
||||||
SubscribeTooltip(ui->cb_show_boot_game, tooltips.settings.show_boot_game);
|
SubscribeTooltip(ui->cb_show_boot_game, tooltips.settings.show_boot_game);
|
||||||
|
|
||||||
SubscribeTooltip(ui->cb_show_pkg_install, tooltips.settings.show_pkg_install);
|
SubscribeTooltip(ui->cb_show_pkg_install, tooltips.settings.show_pkg_install);
|
||||||
|
|
||||||
SubscribeTooltip(ui->cb_show_pup_install, tooltips.settings.show_pup_install);
|
SubscribeTooltip(ui->cb_show_pup_install, tooltips.settings.show_pup_install);
|
||||||
|
|
||||||
SubscribeTooltip(ui->cb_show_obsolete_cfg_dialog, tooltips.settings.show_obsolete_cfg);
|
SubscribeTooltip(ui->cb_show_obsolete_cfg_dialog, tooltips.settings.show_obsolete_cfg);
|
||||||
|
|
||||||
SubscribeTooltip(ui->gb_updates, tooltips.settings.check_update_start);
|
SubscribeTooltip(ui->gb_updates, tooltips.settings.check_update_start);
|
||||||
|
|
||||||
SubscribeTooltip(ui->useRichPresence, tooltips.settings.use_rich_presence);
|
|
||||||
|
|
||||||
SubscribeTooltip(ui->discordState, tooltips.settings.discord_state);
|
|
||||||
|
|
||||||
// Discord:
|
// Discord:
|
||||||
|
SubscribeTooltip(ui->useRichPresence, tooltips.settings.use_rich_presence);
|
||||||
|
SubscribeTooltip(ui->discordState, tooltips.settings.discord_state);
|
||||||
ui->useRichPresence->setChecked(m_use_discord);
|
ui->useRichPresence->setChecked(m_use_discord);
|
||||||
ui->label_discordState->setEnabled(m_use_discord);
|
ui->label_discordState->setEnabled(m_use_discord);
|
||||||
ui->discordState->setEnabled(m_use_discord);
|
ui->discordState->setEnabled(m_use_discord);
|
||||||
|
@ -1618,33 +1603,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
|
||||||
ui->pb_sd_icon_color->setEnabled(enable_ui_colors);
|
ui->pb_sd_icon_color->setEnabled(enable_ui_colors);
|
||||||
ui->pb_tr_icon_color->setEnabled(enable_ui_colors);
|
ui->pb_tr_icon_color->setEnabled(enable_ui_colors);
|
||||||
|
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, [this]()
|
connect(ui->pb_apply_stylesheet, &QAbstractButton::clicked, this, [this]() { ApplyStylesheet(false); });
|
||||||
{
|
|
||||||
ApplyGuiOptions(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(ui->pb_reset_default, &QAbstractButton::clicked, this, [this]
|
|
||||||
{
|
|
||||||
if (QMessageBox::question(this, tr("Reset GUI to default?", "Reset"), tr("This will include your stylesheet as well. Do you wish to proceed?", "Reset"),
|
|
||||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes)
|
|
||||||
{
|
|
||||||
ApplyGuiOptions(true);
|
|
||||||
m_gui_settings->Reset(true);
|
|
||||||
Q_EMIT GuiSettingsSyncRequest(true);
|
|
||||||
AddGuiConfigs();
|
|
||||||
AddStylesheets();
|
|
||||||
ApplyGuiOptions(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(ui->pb_backup_config, &QAbstractButton::clicked, this, &settings_dialog::OnBackupCurrentGuiConfig);
|
|
||||||
connect(ui->pb_apply_config, &QAbstractButton::clicked, this, &settings_dialog::OnApplyGuiConfig);
|
|
||||||
connect(ui->pb_apply_stylesheet, &QAbstractButton::clicked, this, &settings_dialog::OnApplyStylesheet);
|
|
||||||
|
|
||||||
connect(ui->pb_open_folder, &QAbstractButton::clicked, [this]()
|
|
||||||
{
|
|
||||||
QDesktopServices::openUrl(m_gui_settings->GetSettingsDir());
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(ui->cb_show_welcome, &QCheckBox::clicked, [this](bool val)
|
connect(ui->cb_show_welcome, &QCheckBox::clicked, [this](bool val)
|
||||||
{
|
{
|
||||||
|
@ -1714,7 +1673,6 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
|
||||||
color_dialog(gui::tr_icon_color, tr("Choose trophy manager icon color", "Settings: color dialog"), ui->pb_tr_icon_color);
|
color_dialog(gui::tr_icon_color, tr("Choose trophy manager icon color", "Settings: color dialog"), ui->pb_tr_icon_color);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddGuiConfigs();
|
|
||||||
AddStylesheets();
|
AddStylesheets();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1859,24 +1817,6 @@ void settings_dialog::SnapSlider(QSlider *slider, int interval)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void settings_dialog::AddGuiConfigs()
|
|
||||||
{
|
|
||||||
ui->combo_configs->clear();
|
|
||||||
ui->combo_configs->addItems(m_gui_settings->GetConfigEntries());
|
|
||||||
|
|
||||||
m_current_gui_config = m_gui_settings->GetValue(gui::m_currentConfig).toString();
|
|
||||||
|
|
||||||
const int index = ui->combo_configs->findText(m_current_gui_config);
|
|
||||||
if (index >= 0)
|
|
||||||
{
|
|
||||||
ui->combo_configs->setCurrentIndex(index);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cfg_log.warning("Trying to set an invalid config index %d", index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void settings_dialog::AddStylesheets()
|
void settings_dialog::AddStylesheets()
|
||||||
{
|
{
|
||||||
ui->combo_stylesheets->clear();
|
ui->combo_stylesheets->clear();
|
||||||
|
@ -1905,69 +1845,14 @@ void settings_dialog::AddStylesheets()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void settings_dialog::OnBackupCurrentGuiConfig()
|
void settings_dialog::ApplyStylesheet(bool reset)
|
||||||
{
|
{
|
||||||
QInputDialog* dialog = new QInputDialog(this);
|
if (reset)
|
||||||
dialog->setWindowTitle(tr("Choose a unique name", "Backup GUI config"));
|
|
||||||
dialog->setLabelText(tr("Configuration Name: ", "Backup GUI config"));
|
|
||||||
dialog->resize(500, 100);
|
|
||||||
|
|
||||||
while (dialog->exec() != QDialog::Rejected)
|
|
||||||
{
|
{
|
||||||
dialog->resize(500, 100);
|
m_current_stylesheet = gui::DefaultStylesheet;
|
||||||
|
ui->combo_stylesheets->setCurrentIndex(0);
|
||||||
const QString gui_config_name = dialog->textValue();
|
|
||||||
|
|
||||||
if (gui_config_name.isEmpty())
|
|
||||||
{
|
|
||||||
QMessageBox::warning(this, tr("Error", "Backup GUI config warning 1"), tr("Name cannot be empty", "Backup GUI config warning 1"));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (gui_config_name.contains("."))
|
|
||||||
{
|
|
||||||
QMessageBox::warning(this, tr("Error", "Backup GUI config warning 2"), tr("Must choose a name with no '.'", "Backup GUI config warning 2"));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (ui->combo_configs->findText(gui_config_name) != -1)
|
|
||||||
{
|
|
||||||
QMessageBox::warning(this, tr("Error", "Backup GUI config warning 3"), tr("Please choose a non-existing name", "Backup GUI config warning 3"));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Q_EMIT GuiSettingsSaveRequest();
|
|
||||||
m_gui_settings->SaveCurrentConfig(gui_config_name);
|
|
||||||
ui->combo_configs->addItem(gui_config_name);
|
|
||||||
ui->combo_configs->setCurrentText(gui_config_name);
|
|
||||||
m_current_gui_config = gui_config_name;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void settings_dialog::OnApplyGuiConfig()
|
|
||||||
{
|
|
||||||
const QString new_config = ui->combo_configs->currentText();
|
|
||||||
|
|
||||||
if (new_config == m_current_gui_config)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Backup current window states
|
|
||||||
Q_EMIT GuiSettingsSaveRequest();
|
|
||||||
|
|
||||||
if (!m_gui_settings->ChangeToConfig(new_config))
|
|
||||||
{
|
|
||||||
const int new_config_idx = ui->combo_configs->currentIndex();
|
|
||||||
ui->combo_configs->setCurrentText(m_current_gui_config);
|
|
||||||
ui->combo_configs->removeItem(new_config_idx);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_current_gui_config = new_config;
|
|
||||||
Q_EMIT GuiSettingsSyncRequest(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void settings_dialog::OnApplyStylesheet()
|
|
||||||
{
|
|
||||||
// NOTE: We're deliberately not using currentText() here. The actual stylesheet is stored in user data.
|
// NOTE: We're deliberately not using currentText() here. The actual stylesheet is stored in user data.
|
||||||
m_current_stylesheet = ui->combo_stylesheets->currentData().toString();
|
m_current_stylesheet = ui->combo_stylesheets->currentData().toString();
|
||||||
|
|
||||||
|
@ -1978,19 +1863,6 @@ void settings_dialog::OnApplyStylesheet()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void settings_dialog::ApplyGuiOptions(bool reset)
|
|
||||||
{
|
|
||||||
if (reset)
|
|
||||||
{
|
|
||||||
m_current_stylesheet = gui::DefaultStylesheet;
|
|
||||||
ui->combo_configs->setCurrentIndex(0);
|
|
||||||
ui->combo_stylesheets->setCurrentIndex(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
OnApplyGuiConfig();
|
|
||||||
OnApplyStylesheet();
|
|
||||||
}
|
|
||||||
|
|
||||||
int settings_dialog::exec()
|
int settings_dialog::exec()
|
||||||
{
|
{
|
||||||
// singleShot Hack to fix following bug:
|
// singleShot Hack to fix following bug:
|
||||||
|
|
|
@ -25,15 +25,9 @@ public:
|
||||||
~settings_dialog();
|
~settings_dialog();
|
||||||
int exec() override;
|
int exec() override;
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void GuiSettingsSyncRequest(bool configure_all);
|
|
||||||
void GuiStylesheetRequest();
|
void GuiStylesheetRequest();
|
||||||
void GuiSettingsSaveRequest();
|
|
||||||
void GuiRepaintRequest();
|
void GuiRepaintRequest();
|
||||||
void EmuSettingsApplied();
|
void EmuSettingsApplied();
|
||||||
private Q_SLOTS:
|
|
||||||
void OnBackupCurrentGuiConfig();
|
|
||||||
void OnApplyGuiConfig();
|
|
||||||
void OnApplyStylesheet();
|
|
||||||
private:
|
private:
|
||||||
void EnhanceSlider(emu_settings_type settings_type, QSlider* slider, QLabel* label, const QString& label_text) const;
|
void EnhanceSlider(emu_settings_type settings_type, QSlider* slider, QLabel* label, const QString& label_text) const;
|
||||||
|
|
||||||
|
@ -42,13 +36,11 @@ private:
|
||||||
QSlider* m_current_slider = nullptr;
|
QSlider* m_current_slider = nullptr;
|
||||||
|
|
||||||
// Gui tab
|
// Gui tab
|
||||||
void AddGuiConfigs();
|
|
||||||
void AddStylesheets();
|
void AddStylesheets();
|
||||||
void ApplyGuiOptions(bool reset);
|
void ApplyStylesheet(bool reset);
|
||||||
QString m_current_stylesheet;
|
QString m_current_stylesheet;
|
||||||
QString m_current_gui_config;
|
|
||||||
// Gpu tab
|
// Gpu tab
|
||||||
QString m_old_renderer = "";
|
QString m_old_renderer;
|
||||||
// Audio tab
|
// Audio tab
|
||||||
QComboBox *m_mics_combo[4];
|
QComboBox *m_mics_combo[4];
|
||||||
|
|
||||||
|
|
|
@ -3128,92 +3128,29 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="guiTabSpacerLeft">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="guiTabSpacerLeft">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="guiTabLayoutMiddle">
|
<layout class="QVBoxLayout" name="guiTabLayoutMiddle">
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="gb_settings">
|
|
||||||
<property name="title">
|
|
||||||
<string>UI Settings</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="gb_settings_layout">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pb_reset_default">
|
|
||||||
<property name="text">
|
|
||||||
<string>Restore default settings</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pb_backup_config">
|
|
||||||
<property name="text">
|
|
||||||
<string>Save current settings</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pb_open_folder">
|
|
||||||
<property name="text">
|
|
||||||
<string>Open configuration folder</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Load Settings:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="combo_configs"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pb_apply_config">
|
|
||||||
<property name="text">
|
|
||||||
<string>Apply</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="guiTabSpacerMiddle">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="gb_log">
|
<widget class="QGroupBox" name="gb_log">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
@ -3296,6 +3233,22 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="guiTabSpacerMiddle">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -171,7 +171,6 @@ public:
|
||||||
|
|
||||||
const QString log_limit = tr("Sets the maximum amount of blocks that the log can display.\nThis usually equals the number of lines.\nSet 0 in order to remove the limit.");
|
const QString log_limit = tr("Sets the maximum amount of blocks that the log can display.\nThis usually equals the number of lines.\nSet 0 in order to remove the limit.");
|
||||||
const QString tty_limit = tr("Sets the maximum amount of blocks that the tty can display.\nThis usually equals the number of lines.\nSet 0 in order to remove the limit.");
|
const QString tty_limit = tr("Sets the maximum amount of blocks that the tty can display.\nThis usually equals the number of lines.\nSet 0 in order to remove the limit.");
|
||||||
const QString configs = tr("Only useful to developers.\nIf unsure, don't use this option.");
|
|
||||||
const QString stylesheets = tr("Changes the overall look of RPCS3.\nChoose a stylesheet and click Apply to change between styles.");
|
const QString stylesheets = tr("Changes the overall look of RPCS3.\nChoose a stylesheet and click Apply to change between styles.");
|
||||||
const QString show_welcome = tr("Shows the initial welcome screen upon starting RPCS3.");
|
const QString show_welcome = tr("Shows the initial welcome screen upon starting RPCS3.");
|
||||||
const QString show_exit_game = tr("Shows a confirmation dialog when the game window is being closed.");
|
const QString show_exit_game = tr("Shows a confirmation dialog when the game window is being closed.");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue