Provide support for fallback config values (#3551)

Provide support for fallback config values

Makes autosave and some other values checked by default.  Supersedes #3541
This commit is contained in:
Tres Finocchiaro
2017-05-13 23:15:10 -04:00
committed by GitHub
parent 290556e43d
commit 17b37e02a9
3 changed files with 16 additions and 3 deletions

View File

@@ -217,6 +217,9 @@ public:
const QString & value( const QString & cls,
const QString & attribute ) const;
const QString & value( const QString & cls,
const QString & attribute,
const QString & defaultVal ) const;
void setValue( const QString & cls, const QString & attribute,
const QString & value );
void deleteValue( const QString & cls, const QString & attribute);

View File

@@ -318,6 +318,16 @@ const QString & ConfigManager::value( const QString & cls,
const QString & ConfigManager::value( const QString & cls,
const QString & attribute,
const QString & defaultVal ) const
{
const QString & val = value( cls, attribute );
return val.isEmpty() ? defaultVal : val;
}
void ConfigManager::setValue( const QString & cls,
const QString & attribute,

View File

@@ -119,8 +119,8 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
#endif
m_backgroundArtwork( QDir::toNativeSeparators( ConfigManager::inst()->backgroundArtwork() ) ),
m_smoothScroll( ConfigManager::inst()->value( "ui", "smoothscroll" ).toInt() ),
m_enableAutoSave( ConfigManager::inst()->value( "ui", "enableautosave" ).toInt() ),
m_enableRunningAutoSave( ConfigManager::inst()->value( "ui", "enablerunningautosave" ).toInt() ),
m_enableAutoSave( ConfigManager::inst()->value( "ui", "enableautosave", "1" ).toInt() ),
m_enableRunningAutoSave( ConfigManager::inst()->value( "ui", "enablerunningautosave", "1" ).toInt() ),
m_saveInterval( ConfigManager::inst()->value( "ui", "saveinterval" ).toInt() < 1 ?
MainWindow::DEFAULT_SAVE_INTERVAL_MINUTES :
ConfigManager::inst()->value( "ui", "saveinterval" ).toInt() ),
@@ -131,7 +131,7 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
m_syncVSTPlugins( ConfigManager::inst()->value( "ui",
"syncvstplugins" ).toInt() ),
m_animateAFP(ConfigManager::inst()->value( "ui",
"animateafp").toInt() ),
"animateafp", "1" ).toInt() ),
m_printNoteLabels(ConfigManager::inst()->value( "ui",
"printnotelabels").toInt() ),
m_displayWaveform(ConfigManager::inst()->value( "ui",