more setting

This commit is contained in:
georgemoralis 2025-06-12 10:18:41 +03:00
parent 5181ff36ff
commit 75f11b95a5
5 changed files with 18 additions and 33 deletions

View File

@ -41,7 +41,6 @@ static s32 gpuId = -1; // Vulkan physical device index. Set to negative for auto
static std::string logFilter;
static std::string logType = "sync";
static std::string userName = "shadPS4";
static std::string updateChannel;
static std::string chooseHomeTab;
static std::string backButtonBehavior = "left";
static bool useSpecialPad = false;
@ -206,10 +205,6 @@ std::string getUserName() {
return userName;
}
std::string getUpdateChannel() {
return updateChannel;
}
std::string getChooseHomeTab() {
return chooseHomeTab;
}
@ -342,7 +337,6 @@ void setShowSplash(bool enable) {
isShowSplash = enable;
}
void setSideTrophy(std::string side) {
isSideTrophy = side;
}
@ -430,9 +424,6 @@ void setUserName(const std::string& type) {
userName = type;
}
void setUpdateChannel(const std::string& type) {
updateChannel = type;
}
void setChooseHomeTab(const std::string& type) {
chooseHomeTab = type;
}
@ -616,11 +607,6 @@ void load(const std::filesystem::path& path) {
logFilter = toml::find_or<std::string>(general, "logFilter", "");
logType = toml::find_or<std::string>(general, "logType", "sync");
userName = toml::find_or<std::string>(general, "userName", "shadPS4");
if (Common::g_is_release) {
updateChannel = toml::find_or<std::string>(general, "updateChannel", "Release");
} else {
updateChannel = toml::find_or<std::string>(general, "updateChannel", "Nightly");
}
isShowSplash = toml::find_or<bool>(general, "showSplash", true);
isSideTrophy = toml::find_or<std::string>(general, "sideTrophy", "right");
compatibilityData = toml::find_or<bool>(general, "compatibilityEnabled", false);
@ -798,7 +784,6 @@ void save(const std::filesystem::path& path) {
data["General"]["logFilter"] = logFilter;
data["General"]["logType"] = logType;
data["General"]["userName"] = userName;
data["General"]["updateChannel"] = updateChannel;
data["General"]["chooseHomeTab"] = chooseHomeTab;
data["General"]["showSplash"] = isShowSplash;
data["General"]["sideTrophy"] = isSideTrophy;
@ -929,11 +914,7 @@ void setDefaultValues() {
logFilter = "";
logType = "sync";
userName = "shadPS4";
if (Common::g_is_release) {
updateChannel = "Release";
} else {
updateChannel = "Nightly";
}
chooseHomeTab = "General";
cursorState = HideCursorState::Idle;
cursorHideTimeout = 5;

View File

@ -38,7 +38,6 @@ bool getPSNSignedIn();
std::string getLogFilter();
std::string getLogType();
std::string getUserName();
std::string getUpdateChannel();
std::string getChooseHomeTab();
s16 getCursorState();
@ -91,7 +90,6 @@ void setEnableDiscordRPC(bool enable);
void setLanguage(u32 language);
void setNeoMode(bool enable);
void setUserName(const std::string& type);
void setUpdateChannel(const std::string& type);
void setChooseHomeTab(const std::string& type);
void setGameInstallDirs(const std::vector<std::filesystem::path>& dirs_config);
void setAllGameInstallDirs(const std::vector<GameInstallDir>& dirs_config);

View File

@ -45,7 +45,7 @@ void CheckUpdate::CheckForUpdates(const bool showMessage) {
bool checkName = true;
while (checkName) {
updateChannel = QString::fromStdString(Config::getUpdateChannel());
updateChannel = m_gui_settings->GetValue(gui::gen_updateChannel).toString();
if (updateChannel == "Nightly") {
url = QUrl("https://api.github.com/repos/shadps4-emu/shadPS4/releases");
checkName = false;
@ -54,12 +54,10 @@ void CheckUpdate::CheckForUpdates(const bool showMessage) {
checkName = false;
} else {
if (Common::g_is_release) {
Config::setUpdateChannel("Release");
m_gui_settings->SetValue(gui::gen_updateChannel, "Release");
} else {
Config::setUpdateChannel("Nightly");
m_gui_settings->SetValue(gui::gen_updateChannel, "Nightly");
}
const auto config_dir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
Config::save(config_dir / "config.toml");
}
}
@ -200,7 +198,7 @@ void CheckUpdate::setupUI(const QString& downloadUrl, const QString& latestDate,
titleLayout->addWidget(titleLabel);
layout->addLayout(titleLayout);
QString updateChannel = QString::fromStdString(Config::getUpdateChannel());
QString updateChannel = m_gui_settings->GetValue(gui::gen_updateChannel).toString();
QString updateText = QString("<p><b>" + tr("Update Channel") + ": </b>" + updateChannel +
"<br>"

View File

@ -16,6 +16,7 @@ const QString game_grid = "game_grid";
// general
const gui_value gen_checkForUpdates = gui_value(general, "checkForUpdates", false);
const gui_value gen_showChangeLog = gui_value(general, "showChangeLog", false);
const gui_value gen_updateChannel = gui_value(general, "updateChannel", "Release");
// main window settings
const gui_value mw_geometry = gui_value(main_window, "geometry", QByteArray());

View File

@ -181,7 +181,8 @@ SettingsDialog::SettingsDialog(std::shared_ptr<gui_settings> gui_settings,
m_gui_settings->SetValue(gui::gen_checkForUpdates, state == Qt::Checked);
});
connect(ui->changelogCheckBox, &QCheckBox::stateChanged, this, [this](int state) { m_gui_settings->SetValue(gui::gen_showChangeLog,state == Qt::Checked);
connect(ui->changelogCheckBox, &QCheckBox::stateChanged, this, [this](int state) {
m_gui_settings->SetValue(gui::gen_showChangeLog, state == Qt::Checked);
});
#else
connect(ui->updateCheckBox, &QCheckBox::checkStateChanged, this,
@ -198,7 +199,7 @@ SettingsDialog::SettingsDialog(std::shared_ptr<gui_settings> gui_settings,
connect(ui->updateComboBox, &QComboBox::currentTextChanged, this,
[this](const QString& channel) {
if (channelMap.contains(channel)) {
Config::setUpdateChannel(channelMap.value(channel).toStdString());
m_gui_settings->SetValue(gui::gen_updateChannel, channelMap.value(channel));
}
});
@ -512,7 +513,7 @@ void SettingsDialog::LoadValuesFromConfig() {
ui->changelogCheckBox->setChecked(
toml::find_or<bool>(data, "General", "alwaysShowChangelog", false));
QString updateChannel = QString::fromStdString(Config::getUpdateChannel());
QString updateChannel = m_gui_settings->GetValue(gui::gen_updateChannel).toString();
ui->updateComboBox->setCurrentText(
channelMap.key(updateChannel != "Release" && updateChannel != "Nightly"
? (Common::g_is_release ? "Release" : "Nightly")
@ -794,8 +795,9 @@ void SettingsDialog::UpdateSettings() {
Config::setCollectShaderForDebug(ui->collectShaderCheckBox->isChecked());
Config::setCopyGPUCmdBuffers(ui->copyGPUBuffersCheckBox->isChecked());
m_gui_settings->SetValue(gui::gen_checkForUpdates, ui->updateCheckBox->isChecked());
m_gui_settings->SetValue(gui::gen_showChangeLog,ui->changelogCheckBox->isChecked());
Config::setUpdateChannel(channelMap.value(ui->updateComboBox->currentText()).toStdString());
m_gui_settings->SetValue(gui::gen_showChangeLog, ui->changelogCheckBox->isChecked());
m_gui_settings->SetValue(gui::gen_updateChannel,
channelMap.value(ui->updateComboBox->currentText()));
Config::setChooseHomeTab(
chooseHomeTabMap.value(ui->chooseHomeTabComboBox->currentText()).toStdString());
Config::setCompatibilityEnabled(ui->enableCompatibilityCheckBox->isChecked());
@ -880,4 +882,9 @@ void SettingsDialog::setDefaultValues() {
m_gui_settings->SetValue(gui::gl_backgroundMusicVolume, 50);
m_gui_settings->SetValue(gui::gen_checkForUpdates, false);
m_gui_settings->SetValue(gui::gen_showChangeLog, false);
if (Common::g_is_release) {
m_gui_settings->SetValue(gui::gen_updateChannel, "Release");
} else {
m_gui_settings->SetValue(gui::gen_updateChannel, "Nightly");
}
}