Qt: Simplify settings version check

This commit is contained in:
Connor McLaughlin
2020-10-09 18:26:21 +10:00
parent 74880ac047
commit cb6502afa3
7 changed files with 15 additions and 31 deletions

View File

@ -55,8 +55,6 @@ int main(int argc, char* argv[])
window->startupUpdateCheck();
}
window->reportSettingsVersionMismatchString();
int result = app.exec();
window.reset();

View File

@ -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);

View File

@ -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();

View File

@ -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);
}

View File

@ -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;