Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the Settings screen - reload theme, restore defaults #463

Merged
merged 3 commits into from
Feb 11, 2021

Conversation

Crystalwarrior
Copy link
Contributor

@Crystalwarrior Crystalwarrior commented Feb 11, 2021

Add two new buttons - Reload Theme and Restore Defaults
Reload Theme button works even in lobby
Restore Defaults will rename the config.ini to config.temp and initialize the default values.
If the user presses "Cancel", the .temp file is reinstated as the config.ini file.

This also slightly overhauls the code for settings, moving all the funcs that set the checkbox values etc. into its own update_values() func

PR is tested, seems to be working just fine
Closes #454

…tings screen

Add a "restore to defaults" option that allows you to restore all the configuration to its default values.
Set up a .temp settings file that allows you to undo the effects of restoring default options.
@Crystalwarrior Crystalwarrior added enhancement Request for functionality not present ui Issues related to the user interface (non-viewport related) labels Feb 11, 2021
@Crystalwarrior Crystalwarrior added this to the 2.9 milestone Feb 11, 2021
Copy link
Member

@in1tiate in1tiate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me. @oldmud0?

Comment on lines +984 to +988
QFile::rename(ao_app->get_base_path() + "config.ini", ao_app->get_base_path() + "config.temp");
// Load up the default settings
ao_app->configini->clear();
// Update the values on the settings ui
update_values();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds complicated. You just want to read an empty file for QSettings, right? Perhaps read config.temp, update values, and delete the file right away.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I tried but QSettings behavior overwrote the file lol

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No but like delete the qsettings instance right after reading.

@Crystalwarrior Crystalwarrior merged commit b78479f into master Feb 11, 2021
@Crystalwarrior Crystalwarrior deleted the feature/settings-bonanza branch February 12, 2021 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Request for functionality not present ui Issues related to the user interface (non-viewport related)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Settings option to restore default value for that specific option / just an option in general
3 participants