Skip to content

Commit

Permalink
Provide support for fallback config values (LMMS#3551)
Browse files Browse the repository at this point in the history
Provide support for fallback config values

Makes autosave and some other values checked by default.  Supersedes LMMS#3541
  • Loading branch information
tresf committed May 14, 2017
1 parent 648daee commit 1a0d6e8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions include/ConfigManager.h
Expand Up @@ -217,6 +217,9 @@ class EXPORT ConfigManager

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);
Expand Down
10 changes: 10 additions & 0 deletions src/core/ConfigManager.cpp
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/gui/SetupDialog.cpp
Expand Up @@ -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() ),
Expand All @@ -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",
Expand Down

0 comments on commit 1a0d6e8

Please sign in to comment.