Convert m_disableVersionCheck to new settings API

This commit is contained in:
Vasily
2019-12-10 08:28:41 +01:00
committed by username223
parent c8b271ad3e
commit 598d77a0e7
2 changed files with 7 additions and 20 deletions
+7 -19
View File
@@ -298,12 +298,6 @@ OverlayController::OverlayController( bool desktopMode,
m_customTickRateMs = value.toInt(); m_customTickRateMs = value.toInt();
} }
} }
value
= appSettings()->value( "disableVersionCheck", m_disableVersionCheck );
if ( value.isValid() && !value.isNull() )
{
m_disableVersionCheck = value.toBool();
}
value = appSettings()->value( "debugState", m_debugState ); value = appSettings()->value( "debugState", m_debugState );
if ( value.isValid() && !value.isNull() ) if ( value.isValid() && !value.isNull() )
{ {
@@ -325,7 +319,7 @@ OverlayController::OverlayController( bool desktopMode,
this, this,
SLOT( OnNetworkReply( QNetworkReply* ) ) ); SLOT( OnNetworkReply( QNetworkReply* ) ) );
if ( !m_disableVersionCheck ) if ( !disableVersionCheck() )
{ {
QNetworkRequest netRequest; QNetworkRequest netRequest;
netRequest.setUrl( QUrl( application_strings::versionCheckUrl ) ); netRequest.setUrl( QUrl( application_strings::versionCheckUrl ) );
@@ -772,29 +766,23 @@ void OverlayController::setEnableDebug( bool value, bool notify )
bool OverlayController::disableVersionCheck() const bool OverlayController::disableVersionCheck() const
{ {
return m_disableVersionCheck; return settings::getSetting(
settings::BoolSetting::APPLICATION_disableVersionCheck );
} }
void OverlayController::setDisableVersionCheck( bool value, bool notify ) void OverlayController::setDisableVersionCheck( bool value, bool notify )
{ {
if ( m_disableVersionCheck == value ) if ( !value )
{
return;
}
m_disableVersionCheck = value;
if ( !m_disableVersionCheck )
{ {
QNetworkRequest netRequest; QNetworkRequest netRequest;
netRequest.setUrl( QUrl( application_strings::versionCheckUrl ) ); netRequest.setUrl( QUrl( application_strings::versionCheckUrl ) );
netManager->get( netRequest ); netManager->get( netRequest );
} }
appSettings()->beginGroup( "applicationSettings" ); settings::setSetting(
appSettings()->setValue( "disableVersionCheck", m_disableVersionCheck ); settings::BoolSetting::APPLICATION_disableVersionCheck, value );
appSettings()->endGroup();
appSettings()->sync();
if ( notify ) if ( notify )
{ {
emit disableVersionCheckChanged( m_disableVersionCheck ); emit disableVersionCheckChanged( value );
} }
} }
-1
View File
@@ -121,7 +121,6 @@ private:
bool m_desktopMode; bool m_desktopMode;
bool m_noSound; bool m_noSound;
bool m_disableVersionCheck = false;
bool m_newVersionDetected = false; bool m_newVersionDetected = false;
int m_customTickRateMs = 20; int m_customTickRateMs = 20;
int m_debugState = 0; int m_debugState = 0;