mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-19 03:55:46 -04:00
Qt: Simplify settings version check
This commit is contained in:
@ -55,8 +55,6 @@ int main(int argc, char* argv[])
|
||||
window->startupUpdateCheck();
|
||||
}
|
||||
|
||||
window->reportSettingsVersionMismatchString();
|
||||
|
||||
int result = app.exec();
|
||||
|
||||
window.reset();
|
||||
|
@ -1121,13 +1121,6 @@ void MainWindow::startupUpdateCheck()
|
||||
checkForUpdates(false);
|
||||
}
|
||||
|
||||
void MainWindow::reportSettingsVersionMismatchString()
|
||||
{
|
||||
const QString mismatch_str = QString::fromStdString(m_host_interface->GetSettingsVersionMismatchString());
|
||||
if (!mismatch_str.isEmpty())
|
||||
reportError(mismatch_str);
|
||||
}
|
||||
|
||||
void MainWindow::updateDebugMenuVisibility()
|
||||
{
|
||||
const bool visible = m_host_interface->GetBoolSettingValue("Main", "ShowDebugMenu", false);
|
||||
|
@ -30,10 +30,6 @@ public:
|
||||
/// Performs update check if enabled in settings.
|
||||
void startupUpdateCheck();
|
||||
|
||||
/// Reports m_host_interface's settings version mismatch string. Does nothing if string is empty (no settings version
|
||||
/// mismatch detected).
|
||||
void reportSettingsVersionMismatchString();
|
||||
|
||||
public Q_SLOTS:
|
||||
/// Updates debug menu visibility (hides if disabled).
|
||||
void updateDebugMenuVisibility();
|
||||
|
@ -680,8 +680,14 @@ void QtHostInterface::OnSystemStateSaved(bool global, s32 slot)
|
||||
void QtHostInterface::LoadSettings()
|
||||
{
|
||||
m_settings_interface = std::make_unique<INISettingsInterface>(CommonHostInterface::GetSettingsFileName());
|
||||
Log::SetConsoleOutputParams(true);
|
||||
|
||||
if (!CommonHostInterface::CheckSettings(*m_settings_interface.get()))
|
||||
{
|
||||
QTimer::singleShot(1000,
|
||||
[this]() { ReportError("Settings version mismatch, settings have been reset to defaults."); });
|
||||
}
|
||||
|
||||
CommonHostInterface::CheckSettings(*m_settings_interface.get());
|
||||
CommonHostInterface::LoadSettings(*m_settings_interface.get());
|
||||
CommonHostInterface::FixIncompatibleSettings(false);
|
||||
}
|
||||
|
@ -47,10 +47,12 @@ public:
|
||||
bool Initialize() override;
|
||||
void Shutdown() override;
|
||||
|
||||
public Q_SLOTS:
|
||||
void ReportError(const char* message) override;
|
||||
void ReportMessage(const char* message) override;
|
||||
bool ConfirmMessage(const char* message) override;
|
||||
|
||||
public:
|
||||
/// Thread-safe settings access.
|
||||
std::string GetStringSettingValue(const char* section, const char* key, const char* default_value = "") override;
|
||||
bool GetBoolSettingValue(const char* section, const char* key, bool default_value = false) override;
|
||||
|
Reference in New Issue
Block a user