Provide support for fallback config values #3551

Merged
merged 2 commits into from May 14, 2017

Conversation

Projects
2 participants
@tresf
Member

tresf commented May 11, 2017

Supersedes #3541 to address autosave regression #181 (comment).

Previous to this PR, there was no way to provide a "default on" style config value. The effect of this was variable names such as disableautosave causing double negatives in our codebase making it hard to read. Attempts to change them have resulted in a mismatch between desired default and actual default. This should allow config values to have default values.

e.g.

- m_enableAutoSave( ConfigManager::inst()->value( "ui", "enableautosave" ).toInt() ),
+ m_enableAutoSave( ConfigManager::inst()->value( "ui", "enableautosave", "1" ).toInt() ),

Booleans are parsed as integers. A default value of 1 will make a checkbox true. This will allow us to start moving toward more properly named variables as explained very well here #3088 (comment).

@tresf tresf added this to the 1.2.0 milestone May 11, 2017

@tresf tresf added this to In Progress in Release 1.2.0 RC3 May 11, 2017

@Umcaruje

This comment has been minimized.

Show comment
Hide comment
@Umcaruje

Umcaruje May 13, 2017

Member

Tested this one out.
image
After removing .lmmsrc.xml autosave and playback cursor is on 👍

Member

Umcaruje commented May 13, 2017

Tested this one out.
image
After removing .lmmsrc.xml autosave and playback cursor is on 👍

@Umcaruje

Other than the two formatting issues, this looks good to me.

include/ConfigManager.h
@@ -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;

This comment has been minimized.

@Umcaruje

Umcaruje May 13, 2017

Member

you should have a space between the parenthesis : defaultVal )

@Umcaruje

Umcaruje May 13, 2017

Member

you should have a space between the parenthesis : defaultVal )

src/gui/SetupDialog.cpp
@@ -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() ),

This comment has been minimized.

@Umcaruje

Umcaruje May 13, 2017

Member

same here: "1" )

@Umcaruje

Umcaruje May 13, 2017

Member

same here: "1" )

@tresf

This comment has been minimized.

Show comment
Hide comment
@tresf

tresf May 13, 2017

Member

Other than the two formatting issues, this looks good to me.

Formatting issues fixed.

Member

tresf commented May 13, 2017

Other than the two formatting issues, this looks good to me.

Formatting issues fixed.

@tresf tresf merged commit 17b37e0 into LMMS:stable-1.2 May 14, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@tresf tresf deleted the tresf:defaultval branch May 14, 2017

@zonkmachine zonkmachine moved this from In Progress to Done in Release 1.2.0 RC3 May 14, 2017

PhysSong added a commit to PhysSong/lmms that referenced this pull request Jul 8, 2017

Provide support for fallback config values (#3551)
Provide support for fallback config values

Makes autosave and some other values checked by default.  Supersedes #3541
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment