Qt: Persist use-serial-file-names in cover downloader

pull/3800/head
Stenzek 1 week ago
parent 63d72ac156
commit d7036f3470
No known key found for this signature in database

@ -3036,6 +3036,9 @@ void FullscreenUI::DrawCoverDownloaderWindow()
StringUtil::Strlcpy(s_settings_locals.cover_downloader_template_urls, StringUtil::JoinString(urls, '\n'), StringUtil::Strlcpy(s_settings_locals.cover_downloader_template_urls, StringUtil::JoinString(urls, '\n'),
sizeof(s_settings_locals.cover_downloader_template_urls)); sizeof(s_settings_locals.cover_downloader_template_urls));
} }
s_settings_locals.cover_downloader_use_serial_names =
Core::GetBaseBoolSettingValue("UI", "CoverDownloaderUseSerialFileNames", false);
} }
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f)); ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
@ -3135,8 +3138,18 @@ void FullscreenUI::SaveCoverDownloaderURLs()
{ {
const std::vector<std::string> urls = const std::vector<std::string> urls =
StringUtil::SplitNewString(s_settings_locals.cover_downloader_template_urls, '\n'); StringUtil::SplitNewString(s_settings_locals.cover_downloader_template_urls, '\n');
if (urls != Core::GetBaseStringListSetting("UI", "CoverDownloaderURL")) bool changed = (urls != Core::GetBaseStringListSetting("UI", "CoverDownloaderURL"));
if (changed)
Core::SetBaseStringListSettingValue("UI", "CoverDownloaderURL", urls); Core::SetBaseStringListSettingValue("UI", "CoverDownloaderURL", urls);
if (s_settings_locals.cover_downloader_use_serial_names !=
Core::GetBaseBoolSettingValue("UI", "CoverDownloaderUseSerialFileNames", false))
{
Core::SetBaseBoolSettingValue("UI", "CoverDownloaderUseSerialFileNames",
s_settings_locals.cover_downloader_use_serial_names);
changed = true;
}
if (changed)
Host::CommitBaseSettingChanges();
} }
void FullscreenUI::DrawBIOSSettingsPage() void FullscreenUI::DrawBIOSSettingsPage()

@ -30,6 +30,8 @@ CoverDownloadWindow::CoverDownloadWindow() : QWidget()
const std::vector<std::string> urls = Core::GetBaseStringListSetting("UI", "CoverDownloaderURL"); const std::vector<std::string> urls = Core::GetBaseStringListSetting("UI", "CoverDownloaderURL");
if (!urls.empty()) if (!urls.empty())
m_ui.urls->setPlainText(QString::fromStdString(StringUtil::JoinString(urls, "\n"))); m_ui.urls->setPlainText(QString::fromStdString(StringUtil::JoinString(urls, "\n")));
m_ui.useSerialFileNames->setChecked(Core::GetBaseBoolSettingValue("UI", "CoverDownloaderUseSerialFileNames", false));
} }
CoverDownloadWindow::~CoverDownloadWindow() = default; CoverDownloadWindow::~CoverDownloadWindow() = default;
@ -44,8 +46,18 @@ void CoverDownloadWindow::closeEvent(QCloseEvent* ev)
if (!url.empty()) if (!url.empty())
urls.push_back(std::move(url)); urls.push_back(std::move(url));
} }
if (urls != Core::GetBaseStringListSetting("UI", "CoverDownloaderURL"))
bool changed = (urls != Core::GetBaseStringListSetting("UI", "CoverDownloaderURL"));
if (changed)
Core::SetBaseStringListSettingValue("UI", "CoverDownloaderURL", urls); Core::SetBaseStringListSettingValue("UI", "CoverDownloaderURL", urls);
if (const bool use_serial_filenames = m_ui.useSerialFileNames->isChecked();
use_serial_filenames != Core::GetBaseBoolSettingValue("UI", "CoverDownloaderUseSerialFileNames", false))
{
Core::SetBaseBoolSettingValue("UI", "CoverDownloaderUseSerialFileNames", use_serial_filenames);
changed = true;
}
if (changed)
Host::CommitBaseSettingChanges();
QtUtils::SaveWindowGeometry(this); QtUtils::SaveWindowGeometry(this);
QWidget::closeEvent(ev); QWidget::closeEvent(ev);

Loading…
Cancel
Save