mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-05 06:26:49 +00:00
Qt: use config to load translation file on startup
This commit is contained in:
parent
0bba04ef8d
commit
efe907ffae
24 changed files with 835 additions and 635 deletions
|
|
@ -11,9 +11,11 @@ LOG_CHANNEL(cfg_log, "CFG");
|
|||
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
|
||||
|
||||
gui_settings::gui_settings(QObject* parent) : settings(parent)
|
||||
, m_current_name(gui::Settings)
|
||||
{
|
||||
m_settings = new QSettings(ComputeSettingsDir() + gui::Settings + ".ini", QSettings::Format::IniFormat, parent);
|
||||
const Localized localized;
|
||||
|
||||
m_current_name = localized.constants.Settings;
|
||||
m_settings = new QSettings(ComputeSettingsDir() + localized.constants.Settings + ".ini", QSettings::Format::IniFormat, parent);
|
||||
|
||||
const QString settings_name = GetValue(gui::m_currentConfig).toString();
|
||||
|
||||
|
|
@ -47,15 +49,17 @@ bool gui_settings::ChangeToConfig(const QString& friendly_name)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (friendly_name != gui::Settings)
|
||||
const Localized localized;
|
||||
|
||||
if (friendly_name != localized.constants.Settings)
|
||||
{
|
||||
if (m_current_name == gui::Settings)
|
||||
if (m_current_name == localized.constants.Settings)
|
||||
{
|
||||
SetValue(gui::m_currentConfig, friendly_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
QSettings tmp(m_settings_dir.absoluteFilePath(gui::Settings + ".ini"), QSettings::Format::IniFormat, parent());
|
||||
QSettings tmp(m_settings_dir.absoluteFilePath(localized.constants.Settings + ".ini"), QSettings::Format::IniFormat, parent());
|
||||
tmp.beginGroup(gui::m_currentConfig.key);
|
||||
tmp.setValue(gui::m_currentConfig.name, friendly_name);
|
||||
tmp.endGroup();
|
||||
|
|
@ -99,16 +103,18 @@ void gui_settings::Reset(bool removeMeta)
|
|||
QStringList gui_settings::GetGameListCategoryFilters()
|
||||
{
|
||||
QStringList filterList;
|
||||
if (GetCategoryVisibility(Category::HDD_Game)) filterList.append(category::hdd_game);
|
||||
if (GetCategoryVisibility(Category::Disc_Game)) filterList.append(category::disc_game);
|
||||
if (GetCategoryVisibility(Category::PS1_Game)) filterList.append(category::ps1_game);
|
||||
|
||||
if (GetCategoryVisibility(Category::HDD_Game)) filterList.append(category::cat_hdd_game);
|
||||
if (GetCategoryVisibility(Category::Disc_Game)) filterList.append(category::cat_disc_game);
|
||||
if (GetCategoryVisibility(Category::PS1_Game)) filterList.append(category::cat_ps1_game);
|
||||
if (GetCategoryVisibility(Category::PS2_Game)) filterList.append(category::ps2_games);
|
||||
if (GetCategoryVisibility(Category::PSP_Game)) filterList.append(category::psp_games);
|
||||
if (GetCategoryVisibility(Category::Home)) filterList.append(category::home);
|
||||
if (GetCategoryVisibility(Category::Home)) filterList.append(category::cat_home);
|
||||
if (GetCategoryVisibility(Category::Media)) filterList.append(category::media);
|
||||
if (GetCategoryVisibility(Category::Data)) filterList.append(category::data);
|
||||
if (GetCategoryVisibility(Category::Unknown_Cat)) filterList.append(category::unknown);
|
||||
if (GetCategoryVisibility(Category::Unknown_Cat)) filterList.append(category::cat_unknown);
|
||||
if (GetCategoryVisibility(Category::Others)) filterList.append(category::others);
|
||||
|
||||
return filterList;
|
||||
}
|
||||
|
||||
|
|
@ -237,16 +243,18 @@ void gui_settings::SetCustomColor(int col, const QColor& val)
|
|||
|
||||
void gui_settings::SaveCurrentConfig(const QString& friendly_name)
|
||||
{
|
||||
if (friendly_name != gui::Settings)
|
||||
const Localized localized;
|
||||
|
||||
if (friendly_name != localized.constants.Settings)
|
||||
{
|
||||
if (m_current_name == gui::Settings)
|
||||
if (m_current_name == localized.constants.Settings)
|
||||
{
|
||||
SetValue(gui::m_currentConfig, friendly_name);
|
||||
m_settings->sync();
|
||||
}
|
||||
else
|
||||
{
|
||||
QSettings tmp(m_settings_dir.absoluteFilePath(gui::Settings + ".ini"), QSettings::Format::IniFormat, parent());
|
||||
QSettings tmp(m_settings_dir.absoluteFilePath(localized.constants.Settings + ".ini"), QSettings::Format::IniFormat, parent());
|
||||
tmp.beginGroup(gui::m_currentConfig.key);
|
||||
tmp.setValue(gui::m_currentConfig.name, friendly_name);
|
||||
tmp.endGroup();
|
||||
|
|
@ -321,13 +329,15 @@ QStringList gui_settings::GetStylesheetEntries()
|
|||
|
||||
QString gui_settings::GetCurrentStylesheetPath()
|
||||
{
|
||||
const Localized localized;
|
||||
|
||||
QString stylesheet = GetValue(gui::m_currentStylesheet).toString();
|
||||
|
||||
if (stylesheet == gui::Default)
|
||||
if (stylesheet == localized.constants.Default)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
else if (stylesheet == gui::None)
|
||||
else if (stylesheet == localized.constants.None)
|
||||
{
|
||||
return "-";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue