mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-24 20:35:01 +00:00
parent
bb6cca3056
commit
16451b01e8
1 changed files with 34 additions and 13 deletions
|
@ -59,6 +59,9 @@ QStringList languageNames = {"Arabic",
|
||||||
const QVector<int> languageIndexes = {21, 23, 14, 6, 18, 1, 12, 22, 2, 4, 25, 24, 29, 5, 0, 9,
|
const QVector<int> languageIndexes = {21, 23, 14, 6, 18, 1, 12, 22, 2, 4, 25, 24, 29, 5, 0, 9,
|
||||||
15, 16, 17, 7, 26, 8, 11, 20, 3, 13, 27, 10, 19, 30, 28};
|
15, 16, 17, 7, 26, 8, 11, 20, 3, 13, 27, 10, 19, 30, 28};
|
||||||
QMap<QString, QString> channelMap;
|
QMap<QString, QString> channelMap;
|
||||||
|
QMap<QString, QString> logTypeMap;
|
||||||
|
QMap<QString, QString> fullscreenModeMap;
|
||||||
|
QMap<QString, QString> chooseHomeTabMap;
|
||||||
|
|
||||||
SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
|
SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
|
||||||
std::shared_ptr<CompatibilityInfoClass> m_compat_info,
|
std::shared_ptr<CompatibilityInfoClass> m_compat_info,
|
||||||
|
@ -73,6 +76,12 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
|
||||||
ui->buttonBox->button(QDialogButtonBox::StandardButton::Close)->setFocus();
|
ui->buttonBox->button(QDialogButtonBox::StandardButton::Close)->setFocus();
|
||||||
|
|
||||||
channelMap = {{tr("Release"), "Release"}, {tr("Nightly"), "Nightly"}};
|
channelMap = {{tr("Release"), "Release"}, {tr("Nightly"), "Nightly"}};
|
||||||
|
logTypeMap = {{tr("async"), "async"}, {tr("sync"), "sync"}};
|
||||||
|
fullscreenModeMap = {{tr("Borderless"), "Borderless"}, {tr("True"), "True"}};
|
||||||
|
chooseHomeTabMap = {{tr("General"), "General"}, {tr("GUI"), "GUI"},
|
||||||
|
{tr("Graphics"), "Graphics"}, {tr("User"), "User"},
|
||||||
|
{tr("Input"), "Input"}, {tr("Paths"), "Paths"},
|
||||||
|
{tr("Debug"), "Debug"}};
|
||||||
|
|
||||||
// Add list of available GPUs
|
// Add list of available GPUs
|
||||||
ui->graphicsAdapterBox->addItem(tr("Auto Select")); // -1, auto selection
|
ui->graphicsAdapterBox->addItem(tr("Auto Select")); // -1, auto selection
|
||||||
|
@ -374,15 +383,19 @@ void SettingsDialog::LoadValuesFromConfig() {
|
||||||
ui->discordRPCCheckbox->setChecked(
|
ui->discordRPCCheckbox->setChecked(
|
||||||
toml::find_or<bool>(data, "General", "enableDiscordRPC", true));
|
toml::find_or<bool>(data, "General", "enableDiscordRPC", true));
|
||||||
ui->fullscreenCheckBox->setChecked(toml::find_or<bool>(data, "General", "Fullscreen", false));
|
ui->fullscreenCheckBox->setChecked(toml::find_or<bool>(data, "General", "Fullscreen", false));
|
||||||
ui->fullscreenModeComboBox->setCurrentText(QString::fromStdString(
|
QString translatedText_FullscreenMode =
|
||||||
toml::find_or<std::string>(data, "General", "FullscreenMode", "Borderless")));
|
fullscreenModeMap.key(QString::fromStdString(Config::getFullscreenMode()));
|
||||||
|
if (!translatedText_FullscreenMode.isEmpty()) {
|
||||||
|
ui->fullscreenModeComboBox->setCurrentText(translatedText_FullscreenMode);
|
||||||
|
}
|
||||||
ui->separateUpdatesCheckBox->setChecked(
|
ui->separateUpdatesCheckBox->setChecked(
|
||||||
toml::find_or<bool>(data, "General", "separateUpdateEnabled", false));
|
toml::find_or<bool>(data, "General", "separateUpdateEnabled", false));
|
||||||
ui->gameSizeCheckBox->setChecked(toml::find_or<bool>(data, "GUI", "loadGameSizeEnabled", true));
|
ui->gameSizeCheckBox->setChecked(toml::find_or<bool>(data, "GUI", "loadGameSizeEnabled", true));
|
||||||
ui->showSplashCheckBox->setChecked(toml::find_or<bool>(data, "General", "showSplash", false));
|
ui->showSplashCheckBox->setChecked(toml::find_or<bool>(data, "General", "showSplash", false));
|
||||||
std::string logType = Config::getLogType();
|
QString translatedText_logType = logTypeMap.key(QString::fromStdString(Config::getLogType()));
|
||||||
ui->logTypeComboBox->setCurrentText(logType == "async" ? tr("async")
|
if (!translatedText_logType.isEmpty()) {
|
||||||
: (logType == "sync" ? tr("sync") : ""));
|
ui->logTypeComboBox->setCurrentText(translatedText_logType);
|
||||||
|
}
|
||||||
ui->logFilterLineEdit->setText(
|
ui->logFilterLineEdit->setText(
|
||||||
QString::fromStdString(toml::find_or<std::string>(data, "General", "logFilter", "")));
|
QString::fromStdString(toml::find_or<std::string>(data, "General", "logFilter", "")));
|
||||||
ui->userNameLineEdit->setText(
|
ui->userNameLineEdit->setText(
|
||||||
|
@ -421,13 +434,19 @@ void SettingsDialog::LoadValuesFromConfig() {
|
||||||
: updateChannel));
|
: updateChannel));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string chooseHomeTab = toml::find_or<std::string>(data, "General", "chooseHomeTab", "");
|
std::string chooseHomeTab =
|
||||||
ui->chooseHomeTabComboBox->setCurrentText(QString::fromStdString(chooseHomeTab));
|
toml::find_or<std::string>(data, "General", "chooseHomeTab", "General");
|
||||||
|
QString translatedText = chooseHomeTabMap.key(QString::fromStdString(chooseHomeTab));
|
||||||
|
if (translatedText.isEmpty()) {
|
||||||
|
translatedText = tr("General");
|
||||||
|
}
|
||||||
|
ui->chooseHomeTabComboBox->setCurrentText(translatedText);
|
||||||
|
|
||||||
QStringList tabNames = {tr("General"), tr("GUI"), tr("Graphics"), tr("User"),
|
QStringList tabNames = {tr("General"), tr("GUI"), tr("Graphics"), tr("User"),
|
||||||
tr("Input"), tr("Paths"), tr("Debug")};
|
tr("Input"), tr("Paths"), tr("Debug")};
|
||||||
QString chooseHomeTabQString = QString::fromStdString(chooseHomeTab);
|
int indexTab = tabNames.indexOf(translatedText);
|
||||||
int indexTab = tabNames.indexOf(chooseHomeTabQString);
|
if (indexTab == -1)
|
||||||
indexTab = (indexTab == -1) ? 0 : indexTab;
|
indexTab = 0;
|
||||||
ui->tabWidgetSettings->setCurrentIndex(indexTab);
|
ui->tabWidgetSettings->setCurrentIndex(indexTab);
|
||||||
|
|
||||||
QString backButtonBehavior = QString::fromStdString(
|
QString backButtonBehavior = QString::fromStdString(
|
||||||
|
@ -634,12 +653,13 @@ void SettingsDialog::UpdateSettings() {
|
||||||
const QVector<std::string> TouchPadIndex = {"left", "center", "right", "none"};
|
const QVector<std::string> TouchPadIndex = {"left", "center", "right", "none"};
|
||||||
Config::setBackButtonBehavior(TouchPadIndex[ui->backButtonBehaviorComboBox->currentIndex()]);
|
Config::setBackButtonBehavior(TouchPadIndex[ui->backButtonBehaviorComboBox->currentIndex()]);
|
||||||
Config::setIsFullscreen(ui->fullscreenCheckBox->isChecked());
|
Config::setIsFullscreen(ui->fullscreenCheckBox->isChecked());
|
||||||
Config::setFullscreenMode(ui->fullscreenModeComboBox->currentText().toStdString());
|
Config::setFullscreenMode(
|
||||||
|
fullscreenModeMap.value(ui->fullscreenModeComboBox->currentText()).toStdString());
|
||||||
Config::setIsMotionControlsEnabled(ui->motionControlsCheckBox->isChecked());
|
Config::setIsMotionControlsEnabled(ui->motionControlsCheckBox->isChecked());
|
||||||
Config::setisTrophyPopupDisabled(ui->disableTrophycheckBox->isChecked());
|
Config::setisTrophyPopupDisabled(ui->disableTrophycheckBox->isChecked());
|
||||||
Config::setPlayBGM(ui->playBGMCheckBox->isChecked());
|
Config::setPlayBGM(ui->playBGMCheckBox->isChecked());
|
||||||
Config::setAllowHDR(ui->enableHDRCheckBox->isChecked());
|
Config::setAllowHDR(ui->enableHDRCheckBox->isChecked());
|
||||||
Config::setLogType((ui->logTypeComboBox->currentText() == tr("async") ? "async" : "sync"));
|
Config::setLogType(logTypeMap.value(ui->logTypeComboBox->currentText()).toStdString());
|
||||||
Config::setLogFilter(ui->logFilterLineEdit->text().toStdString());
|
Config::setLogFilter(ui->logFilterLineEdit->text().toStdString());
|
||||||
Config::setUserName(ui->userNameLineEdit->text().toStdString());
|
Config::setUserName(ui->userNameLineEdit->text().toStdString());
|
||||||
Config::setTrophyKey(ui->trophyKeyLineEdit->text().toStdString());
|
Config::setTrophyKey(ui->trophyKeyLineEdit->text().toStdString());
|
||||||
|
@ -669,7 +689,8 @@ void SettingsDialog::UpdateSettings() {
|
||||||
Config::setAutoUpdate(ui->updateCheckBox->isChecked());
|
Config::setAutoUpdate(ui->updateCheckBox->isChecked());
|
||||||
Config::setAlwaysShowChangelog(ui->changelogCheckBox->isChecked());
|
Config::setAlwaysShowChangelog(ui->changelogCheckBox->isChecked());
|
||||||
Config::setUpdateChannel(channelMap.value(ui->updateComboBox->currentText()).toStdString());
|
Config::setUpdateChannel(channelMap.value(ui->updateComboBox->currentText()).toStdString());
|
||||||
Config::setChooseHomeTab(ui->chooseHomeTabComboBox->currentText().toStdString());
|
Config::setChooseHomeTab(
|
||||||
|
chooseHomeTabMap.value(ui->chooseHomeTabComboBox->currentText()).toStdString());
|
||||||
Config::setCompatibilityEnabled(ui->enableCompatibilityCheckBox->isChecked());
|
Config::setCompatibilityEnabled(ui->enableCompatibilityCheckBox->isChecked());
|
||||||
Config::setCheckCompatibilityOnStartup(ui->checkCompatibilityOnStartupCheckBox->isChecked());
|
Config::setCheckCompatibilityOnStartup(ui->checkCompatibilityOnStartupCheckBox->isChecked());
|
||||||
Config::setBackgroundImageOpacity(ui->backgroundImageOpacitySlider->value());
|
Config::setBackgroundImageOpacity(ui->backgroundImageOpacitySlider->value());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue