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

Settings interface #830

Merged
merged 48 commits into from
Sep 9, 2019
Merged

Settings interface #830

merged 48 commits into from
Sep 9, 2019

Conversation

isanae
Copy link
Contributor

@isanae isanae commented Sep 8, 2019

This removes all access to QSettings and Settings::directInterface() from anywhere in MO. From now on, settings are all managed within the Settings class.

This required moving all the manual QSettings stuff into the Settings class and adding member functions for whatever was missing. Once I ended up with hundreds of functions, I split Settings into various subclasses, like NexusSettings and PathSettings.

The file mainwindow.ui looks completely changed, but it's not. I removed the top level QSplitter that held the content on top and the log widget at the button, because the log has been a dock window since my previous PR, and so was unnecessary. The other change is to make the statusbar a StatusBar instead of a QStatusBar so I can inherit from it.

One major problem I had was with the nexus server information. There was a simple struct ServerInfo, which I turned into a class. The way it was handled was buggy: the "preferred" setting was read as a bool, but it was written as an int that corresponded to its index in the list in the settings.

It also kept a running total of the speed for each download and showed the average in the settings. I changed it to only remember the last 5 download speeds so unusual speeds eventually disappear.

There are a few consequences to all this:

  • Most geometry and widgets settings, like checkbox states, will be reset because they've changed names and/or sections. I haven't bothered writing upgrade code for those because I don't think it's worth it.
  • The servers are now saved as an array of text values instead of QByteArrays, like all the other settings (except for Qt geometries). I have upgrade code to transform the servers into the new format, but it's not forwards compatible: downgrading back to 2.2.1 will reset the servers to a list with one entry named size.

Other stuff I did along the way:

  • moved the creation of byte size strings ("x MB" or "x MB/s") into uibase and made it localizable;
  • in MainWindow, moved all the code that initializes the mod list into setupModList()'
  • moved MainWindow::processUpdates() to Settings;
  • removed dead code in MainWindow::on_bossButton_clicked() that would display the integrated browser for the loot report;
  • changed the "reset window geometries" button to immediately ask for confirmation and restart MO instead of waiting for the dialog to close

isanae added 30 commits August 4, 2019 06:09
added necessary member functions in Settings
removed most of storeSettings() from OrganizerCore: QSettings handles saving by itself, no need for that
removed topLevelSplitter from ui, unused since the log widget is in a dock
removed QSettings from MainWindow::readSettings()
replaced return values for some of the new getters in Settings to std::optional
fixed dialogs not having a parent
use global cache variable instead of an instance inside a function
removed widget-specific functions in GeometrySettings, now using generic functions in Settings
removed some unused member variables in MainWindow
added centerOnMainWindowMonitor(), now also used by validation dialog
added overloads for splitter, used by main splitter
fixed saveState() for QMainWindow calling the wrong function
changed reset button in settings to restart immediately
merged settings into saveVisibility() and restoreVisibility()
call MainWindow::storeSettings() earlier so widget visibility is still valid
added combobox index to settings
finished moving endorsement to settings
…rectly

fixed selected executable being empty after closing the edit dialog
put backup_install inside Settings
…Widget

removed directInterface() from mod info conflicts
added ColorSettings
settings dialog general and diag tabs don't use qsettings anymore
removed logging of setting changes, will be added back to Settings class
settings tab remembered
moved server functions together in Settings
changed preferred to an int
moved all server settings to Settings
isanae added 18 commits August 26, 2019 01:07
existing servers now merged when retrieving the download links
download manager doesn't store the servers any more, queries the settings every time
added scoped classes for QSettings groups and arrays
servers logged on startup
use dedicated functions to set, get or remove settings, allows for logging
removed "get" from the getters that had it
…s when nothing actually changed

changed back section names that were originally lowercase, arrays end up in two different sections
fixed mod info dialog tab order using different settings for read and write
mod info dialog now doesn't complain when no tab order exists in the settings
only remove section when the array is larger, prevents logging changes when nothing actually changed
renamed some PluginSettings members and moved them around
removed unused automaticLoginEnabled()
@isanae isanae merged commit 99fdbb2 into ModOrganizer2:Develop Sep 9, 2019
@isanae isanae deleted the settings-interface branch December 10, 2019 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant