summaryrefslogtreecommitdiff
path: root/src/settings.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings.h')
-rw-r--r--src/settings.h928
1 files changed, 647 insertions, 281 deletions
diff --git a/src/settings.h b/src/settings.h
index 63718089..91b87e29 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -21,380 +21,746 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#define SETTINGS_H
#include "loadmechanism.h"
+#include <questionboxmemory.h>
#include <log.h>
+#include <usvfsparameters.h>
+
+#ifdef interface
+ #undef interface
+#endif
namespace MOBase {
class IPlugin;
class IPluginGame;
}
-class PluginContainer;
-struct ServerInfo;
+class QSplitter;
-/**
- * manages the settings for Mod Organizer. The settings are not cached
- * inside the class but read/written directly from/to disc
- **/
-class Settings : public QObject
+class ServerList;
+class Settings;
+class ExpanderWidget;
+
+
+// helper class that calls restoreGeometry() in the constructor and
+// saveGeometry() in the destructor
+//
+class GeometrySaver
{
- Q_OBJECT
+public:
+ GeometrySaver(Settings& s, QDialog* dialog);
+ ~GeometrySaver();
+private:
+ Settings& m_settings;
+ QDialog* m_dialog;
+};
+
+
+// setting for the currently managed game
+//
+class GameSettings
+{
public:
- Settings(const QSettings &settingsSource);
- ~Settings();
+ GameSettings(QSettings& setting);
- static Settings &instance();
+ // game plugin
+ //
+ const MOBase::IPluginGame* plugin();
+ void setPlugin(const MOBase::IPluginGame* gamePlugin);
+
+ // whether files of the core game are forced-enabled so the user can't
+ // accidentally disable them
+ //
+ bool forceEnableCoreFiles() const;
+ void setForceEnableCoreFiles(bool b);
+
+ // the directory where the managed game is stored
+ //
+ std::optional<QString> directory() const;
+ void setDirectory(const QString& path);
+
+ // the name of the managed game
+ //
+ std::optional<QString> name() const;
+ void setName(const QString& name);
+
+ // the edition of the managed game
+ //
+ std::optional<QString> edition() const;
+ void setEdition(const QString& name);
+
+ // the current profile name
+ //
+ std::optional<QString> selectedProfileName() const;
+ void setSelectedProfileName(const QString& name);
+
+ // load mechanism type
+ //
+ LoadMechanism::EMechanism loadMechanismType() const;
+ void setLoadMechanism(LoadMechanism::EMechanism m);
+
+ // load mechanism object
+ //
+ const LoadMechanism& loadMechanism() const;
+ LoadMechanism& loadMechanism();
+
+ // whether the user wants unchecked plugins (esp, esm) to be hidden from
+ // the virtual data directory
+ //
+ bool hideUncheckedPlugins() const;
+ void setHideUncheckedPlugins(bool b);
+
+private:
+ QSettings& m_Settings;
+ const MOBase::IPluginGame* m_GamePlugin;
+ LoadMechanism m_LoadMechanism;
+};
+
+
+// geometry settings for various widgets; this should contain any setting that
+// can get invalid through UI changes or when users change display settings
+// (resolution, monitors, etc.); see WidgetSettings for the counterpart
+//
+// all these settings are stored under [Geometry] and get wiped when the
+// "reset geometry settings" button is clicked in the settings
+//
+// saveGeometry(), restoreGeometry(), saveState() and restoreState() call the
+// same functions on the given widget
+//
+class GeometrySettings
+{
+public:
+ GeometrySettings(QSettings& s);
+
+ // asks the settings to get reset
+ //
+ // this gets called from the settings dialog and gets picked up in
+ // resetIfNeeded(), called from runApplication() just before exiting
+ //
+ void requestReset();
+ void resetIfNeeded();
+
+
+ void saveGeometry(const QWidget* w);
+ bool restoreGeometry(QWidget* w) const;
+
+ void saveState(const QMainWindow* window);
+ bool restoreState(QMainWindow* window) const;
+
+ void saveState(const QHeaderView* header);
+ bool restoreState(QHeaderView* header) const;
+
+ void saveState(const QSplitter* splitter);
+ bool restoreState(QSplitter* splitter) const;
+
+ void saveState(const ExpanderWidget* expander);
+ bool restoreState(ExpanderWidget* expander) const;
+
+ void saveVisibility(const QWidget* w);
+ bool restoreVisibility(QWidget* w, std::optional<bool> def={}) const;
+
+ void saveToolbars(const QMainWindow* w);
+ void restoreToolbars(QMainWindow* w) const;
+
+ void saveDocks(const QMainWindow* w);
+ void restoreDocks(QMainWindow* w) const;
+
+ // this should be a generic "tab order" setting, but it only happens for the
+ // mod info dialog right now
+ //
+ QStringList modInfoTabOrder() const;
+ void setModInfoTabOrder(const QString& names);
+
+ // assumes the given widget is a top-level
+ //
+ void centerOnMainWindowMonitor(QWidget* w);
+
+ // saves the monitor number of the given window
+ //
+ void saveMainWindowMonitor(const QMainWindow* w);
+
+private:
+ QSettings& m_Settings;
+ bool m_Reset;
+};
+
+
+// widget settings that should stay valid regardless of UI changes or when users
+// change display settings (resolution, monitors, etc.); see GeometrySettings
+// for the counterpart
+//
+class WidgetSettings
+{
+public:
+ WidgetSettings(QSettings& s);
+
+ // selected index for a combobox
+ //
+ std::optional<int> index(const QComboBox* cb) const;
+ void saveIndex(const QComboBox* cb);
+ void restoreIndex(QComboBox* cb, std::optional<int> def={}) const;
- /**
- * unregister all plugins from settings
- */
+ // selected tab index for a tab widget
+ //
+ std::optional<int> index(const QTabWidget* w) const;
+ void saveIndex(const QTabWidget* w);
+ void restoreIndex(QTabWidget* w, std::optional<int> def={}) const;
+
+ // check state for a checkable button
+ //
+ std::optional<bool> checked(const QAbstractButton* w) const;
+ void saveChecked(const QAbstractButton* w);
+ void restoreChecked(QAbstractButton* w, std::optional<bool> def={}) const;
+
+ // returns the remembered button for a question dialog, or NoButton if the
+ // user hasn't saved the choice
+ //
+ MOBase::QuestionBoxMemory::Button questionButton(
+ const QString& windowName, const QString& filename) const;
+
+ // sets the button to be remembered for the given window
+ //
+ void setQuestionWindowButton(
+ const QString& windowName, MOBase::QuestionBoxMemory::Button button);
+
+ // sets the button to be remembered for the given file
+ //
+ void setQuestionFileButton(
+ const QString& windowName, const QString& filename,
+ MOBase::QuestionBoxMemory::Button choice);
+
+ // wipes all the remembered buttons
+ //
+ void resetQuestionButtons();
+
+private:
+ QSettings& m_Settings;
+};
+
+
+// various color settings
+//
+class ColorSettings
+{
+public:
+ ColorSettings(QSettings& s);
+
+ QColor modlistOverwrittenLoose() const;
+ void setModlistOverwrittenLoose(const QColor& c);
+
+ QColor modlistOverwritingLoose() const;
+ void setModlistOverwritingLoose(const QColor& c);
+
+ QColor modlistOverwrittenArchive() const;
+ void setModlistOverwrittenArchive(const QColor& c);
+
+ QColor modlistOverwritingArchive() const;
+ void setModlistOverwritingArchive(const QColor& c);
+
+ QColor modlistContainsPlugin() const;
+ void setModlistContainsPlugin(const QColor& c);
+
+ QColor pluginListContained() const;
+ void setPluginListContained(const QColor& c) ;
+
+ std::optional<QColor> previousSeparatorColor() const;
+ void setPreviousSeparatorColor(const QColor& c) const;
+ void removePreviousSeparatorColor();
+
+ // whether the scrollbar of the mod list should have colors for custom
+ // separator colors
+ //
+ bool colorSeparatorScrollbar() const;
+ void setColorSeparatorScrollbar(bool b);
+
+ // returns a color with a good contrast for the given background
+ //
+ static QColor idealTextColor(const QColor& rBackgroundColor);
+
+private:
+ QSettings& m_Settings;
+};
+
+
+// settings about plugins
+//
+class PluginSettings
+{
+public:
+ PluginSettings(QSettings& settings);
+
+
+ // forgets all the plugins
+ //
void clearPlugins();
- /**
- * @brief register plugin to be configurable
- * @param plugin the plugin to register
- * @return true if the plugin may be registered, false if it is blacklisted
- */
+ // adds the given plugin to the list and loads all of its settings
+ //
void registerPlugin(MOBase::IPlugin *plugin);
- /**
- * set up the settings for the specified plugins
- **/
- void addPluginSettings(const std::vector<MOBase::IPlugin*> &plugins);
+ // returns all the registered plugins
+ //
+ std::vector<MOBase::IPlugin*> plugins() const;
- /**
- * @return true if the user wants unchecked plugins (esp, esm) should be hidden from
- * the virtual dat adirectory
- **/
- bool hideUncheckedPlugins() const;
- /**
- * @return true if files of the core game are forced-enabled so the user can't accidentally disable them
- */
- bool forceEnableCoreFiles() const;
+ // returns the plugin setting for the given key
+ //
+ QVariant setting(const QString &pluginName, const QString &key) const;
- /**
- * @return true if the GUI should be locked when running executables
- */
- bool lockGUI() const;
+ // sets the plugin setting for the given key
+ //
+ void setSetting(const QString &pluginName, const QString &key, const QVariant &value);
- /**
- * @brief register download speed
- * @param url complete download url
- * @param bytesPerSecond download size in bytes per second
- */
- void setDownloadSpeed(const QString &serverName, int bytesPerSecond);
+ // returns all settings
+ //
+ QVariantMap settings(const QString &pluginName) const;
+
+ // overwrites all settings
+ //
+ void setSettings(const QString &pluginName, const QVariantMap& map);
+
+ // returns all descriptions
+ //
+ QVariantMap descriptions(const QString &pluginName) const;
+
+ // overwrites all descriptions
+ //
+ void setDescriptions(const QString &pluginName, const QVariantMap& map);
- /**
- * the steam appid is assigned by the steam platform to each product sold there.
- * The appid may differ between different versions of a game so it may be impossible
- * for Mod Organizer to automatically recognize it, though usually it does
- * @return the steam appid for the game
- **/
- QString getSteamAppID() const;
- /**
- * retrieves the base directory under which the other directories usually
- * reside
- */
- QString getBaseDirectory() const;
+ // ?
+ QVariant persistent(const QString &pluginName, const QString &key, const QVariant &def) const;
+ void setPersistent(const QString &pluginName, const QString &key, const QVariant &value, bool sync);
- /**
- * retrieve the directory where downloads are stored (with native separators)
- **/
- QString getDownloadDirectory(bool resolve = true) const;
- /**
- * retrieve a sorted list of preferred servers
- */
- std::map<QString, int> getPreferredServers();
+ // adds the given plugin to the blacklist
+ //
+ void addBlacklist(const QString &fileName);
- /**
- * retrieve the directory where mods are stored (with native separators)
- **/
- QString getModDirectory(bool resolve = true) const;
+ // returns whether the given plugin is blacklisted
+ //
+ bool blacklisted(const QString &fileName) const;
- /**
- * retrieve the directory where the web cache is stored (with native separators)
- **/
- QString getCacheDirectory(bool resolve = true) const;
+ // overwrites the whole blacklist
+ //
+ void setBlacklist(const QStringList& pluginNames);
- /**
- * retrieve the directory where the managed game is stored (with native separators)
- **/
- QString getManagedGameDirectory() const;
+ // returns the blacklist
+ //
+ const QSet<QString>& blacklist() const;
- /**
- * retrieve the directory where profiles stored (with native separators)
- **/
- QString getProfileDirectory(bool resolve = true) const;
- /**
- * retrieve the directory were new files are stored that can't be assigned
- * to a mod (with native separators)
- */
- QString getOverwriteDirectory(bool resolve = true) const;
+ // commits all the settings to the ini
+ //
+ void save();
- /**
- * @return true if the user has set up automatic login to nexus
- **/
- bool automaticLoginEnabled() const;
+private:
+ QSettings& m_Settings;
+ std::vector<MOBase::IPlugin*> m_Plugins;
+ QMap<QString, QVariantMap> m_PluginSettings;
+ QMap<QString, QVariantMap> m_PluginDescriptions;
+ QSet<QString> m_PluginBlacklist;
+
+ // commits the blacklist to the ini
+ //
+ void writeBlacklist();
+
+ // reads the blacklist from the ini
+ //
+ QSet<QString> readBlacklist() const;
+};
+
+
+// paths for the game and various components
+//
+// if the 'resolve' parameter is true, %BASE_DIR% is expanded; it's set to
+// false mostly in the settings dialog
+//
+class PathSettings
+{
+public:
+ PathSettings(QSettings& settings);
- /**
- * @brief retrieve the login information for nexus
- *
- * @param username (out) receives the user name for nexus
- * @param password (out) received the password for nexus
- * @return true if automatic login is active, false otherwise
- **/
- bool getNexusApiKey(QString &apiKey) const;
+ QString base() const;
+ void setBase(const QString& path);
- /**
- * @brief set the nexus login information
- *
- * @param username username
- * @param password password
- */
- bool setNexusApiKey(const QString& apiKey);
+ QString downloads(bool resolve = true) const;
+ void setDownloads(const QString& path);
- /**
- * @brief clears the nexus login information
- */
- bool clearNexusApiKey();
+ QString mods(bool resolve = true) const;
+ void setMods(const QString& path);
- /**
- * @brief returns whether an API key is currently stored
- */
- bool hasNexusApiKey() const;
+ QString cache(bool resolve = true) const;
+ void setCache(const QString& path);
- /**
- * @brief retrieve the login information for steam
- *
- * @param username (out) receives the user name for nexus
- * @param password (out) received the password for nexus
- * @return true if a username has been specified, false otherwise
- **/
- bool getSteamLogin(QString &username, QString &password) const;
+ QString profiles(bool resolve = true) const;
+ void setProfiles(const QString& path);
- /**
- * @return true if the user disabled internet features
- */
+ QString overwrite(bool resolve = true) const;
+ void setOverwrite(const QString& path);
+
+
+ // map of names to directories, used to remember the last directory used in
+ // various file pickers
+ //
+ std::map<QString, QString> recent() const;
+ void setRecent(const std::map<QString, QString>& map);
+
+private:
+ QSettings& m_Settings;
+
+ QString getConfigurablePath(const QString &key, const QString &def, bool resolve) const;
+ void setConfigurablePath(const QString &key, const QString& path);
+};
+
+
+class NetworkSettings
+{
+public:
+ NetworkSettings(QSettings& settings);
+
+ // whether the user has disabled online features
+ //
bool offlineMode() const;
+ void setOfflineMode(bool b);
- /**
- * @return true if the user chose compact downloads
- */
- bool compactDownloads() const;
+ // whether the user wants to use the system proxy
+ //
+ bool useProxy() const;
+ void setUseProxy(bool b);
- /**
- * @return true if the user chose meta downloads
- */
- bool metaDownloads() const;
+ // add a new download speed to the list for the given server; each server
+ // remembers the last couple of download speeds and displays the average in
+ // the network settings
+ //
+ void setDownloadSpeed(const QString &serverName, int bytesPerSecond);
- /**
- * @return the configured log level
- */
- MOBase::log::Levels logLevel() const;
+ // known servers
+ //
+ ServerList servers() const;
- /**
- * sets the log level setting
- */
- void setLogLevel(MOBase::log::Levels level);
+ // sets the servers
+ //
+ void updateServers(ServerList servers);
- /**
- * @return the configured crash dumps type
- */
- int crashDumpsType() const;
+ // for 2.2.1 and before, rewrites the old byte array map to the new format
+ //
+ void updateFromOldMap();
- /**
- * @return the configured crash dumps max
- */
- int crashDumpsMax() const;
+ void dump() const;
- QColor modlistOverwrittenLooseColor() const;
+private:
+ QSettings& m_Settings;
- QColor modlistOverwritingLooseColor() const;
+ // for pre 2.2.1 ini files
+ //
+ ServerList serversFromOldMap() const;
+};
- QColor modlistOverwrittenArchiveColor() const;
- QColor modlistOverwritingArchiveColor() const;
+enum class EndorsementState
+{
+ Accepted = 1,
+ Refused,
+ NoDecision
+};
- QColor modlistContainsPluginColor() const;
+EndorsementState endorsementStateFromString(const QString& s);
+QString toString(EndorsementState s);
- QColor pluginListContainedColor() const;
- QString executablesBlacklist() const;
+class NexusSettings
+{
+public:
+ NexusSettings(Settings& parent, QSettings& settings);
- /**
- * @brief set the steam login information
- *
- * @param username username
- * @param password password
- */
- void setSteamLogin(QString username, QString password);
+ // if the key exists from the credentials store, puts it in `apiKey` and
+ // returns true; otherwise, returns false and leaves `apiKey` untouched
+ //
+ bool apiKey(QString& apiKey) const;
- /**
- * @return the load mechanism to be used
- **/
- LoadMechanism::EMechanism getLoadMechanism() const;
+ // sets the api key in the credentials store, removes it if empty; returns
+ // false on errors
+ //
+ bool setApiKey(const QString& apiKey);
- /**
- * @brief activate the load mechanism selected by the user
- **/
- void setupLoadMechanism();
+ // removes the api key from the credentials store; returns false on errors
+ //
+ bool clearApiKey();
- /**
- * @return true if the user configured the use of a network proxy
- */
- bool useProxy() const;
+ // returns whether an API key is currently stored
+ //
+ bool hasApiKey() const;
- /**
- * @return true if endorsement integration is enabled
- */
+ // returns whether endorsement integration is enabled
+ //
bool endorsementIntegration() const;
+ void setEndorsementIntegration(bool b) const;
+
+ // returns the endorsement state of MO itself
+ //
+ EndorsementState endorsementState() const;
+ void setEndorsementState(EndorsementState s);
+
+ // registers MO as the handler for nxm links
+ //
+ // if 'force' is true, the registration dialog will be shown even if the user
+ // said earlier not to
+ //
+ void registerAsNXMHandler(bool force);
+
+private:
+ Settings& m_Parent;
+ QSettings& m_Settings;
+};
+
+
+class SteamSettings
+{
+public:
+ SteamSettings(Settings& parent, QSettings& settings);
+
+ // the steam appid is assigned by the steam platform to each product sold
+ // there.
+ //
+ // the appid may differ between different versions of a game so it may be
+ // impossible for MO to automatically recognize it, though usually it does
+ //
+ QString appID() const;
+ void setAppID(const QString& id);
+
+ // the steam username is stored in the ini, but the password is in the
+ // windows credentials store; both values are independent and either can be
+ // empty
+ //
+ // if the username exists in the ini, it is assigned to `username`; if not
+ // `username` is set to an empty string
+ //
+ // if the password exists in the credentials store, it is assigned to
+ // `password`; if not, `password` is set to an empty string
+ //
+ // returns whether _both_ the username and password have a value
+ //
+ bool login(QString &username, QString &password) const;
+
+ // sets the steam login; the username is saved in the ini file and the
+ // password in the credentials store
+ //
+ // if a value is empty, it is removed from its backing store
+ //
+ void setLogin(QString username, QString password);
+
+private:
+ Settings& m_Parent;
+ QSettings& m_Settings;
+};
+
+
+class InterfaceSettings
+{
+public:
+ InterfaceSettings(QSettings& settings);
+
+ // whether the GUI should be locked when running executables
+ //
+ bool lockGUI() const;
+ void setLockGUI(bool b);
+
+ // filename of the theme
+ //
+ std::optional<QString> styleName() const;
+ void setStyleName(const QString& name);
- /**
- * @return true if the API counter should be hidden
- */
+ // whether to show compact downloads
+ //
+ bool compactDownloads() const;
+ void setCompactDownloads(bool b);
+
+ // whether to show meta information for downloads
+ //
+ bool metaDownloads() const;
+ void setMetaDownloads(bool b);
+
+ // whether the API counter should be hidden
+ //
bool hideAPICounter() const;
+ void setHideAPICounter(bool b);
- /**
- * @return true if the user wants to see non-official plugins installed outside MO in his mod list
- */
+ // whether the user wants to see non-official plugins installed outside MO in
+ // the mod list
+ //
bool displayForeign() const;
+ void setDisplayForeign(bool b);
- /**
- * @brief sets the new motd hash
- **/
- void setMotDHash(uint hash);
+ // short code of the configured language (corresponding to the translation
+ // files)
+ //
+ QString language();
+ void setLanguage(const QString& name);
- /**
- * @return true if the user wants to have archives being parsed to show conflicts and contents
- */
- bool archiveParsing() const;
+ // whether the given tutorial has been completed
+ //
+ bool isTutorialCompleted(const QString& windowName) const;
+ void setTutorialCompleted(const QString& windowName, bool b=true);
- /**
- * @return hash of the last displayed message of the day
- **/
- uint getMotDHash() const;
+private:
+ QSettings& m_Settings;
+};
- /**
- * @brief allows direct access to the wrapped QSettings object
- * @return the wrapped QSettings object
- */
- QSettings &directInterface() { return m_Settings; }
- const QSettings &directInterface() const { return m_Settings; }
- /**
- * @brief retrieve a setting for one of the installed plugins
- * @param pluginName name of the plugin
- * @param key name of the setting to retrieve
- * @return the requested value as a QVariant
- * @note an invalid QVariant is returned if the the plugin/setting is not declared
- */
- QVariant pluginSetting(const QString &pluginName, const QString &key) const;
+class DiagnosticsSettings
+{
+public:
+ DiagnosticsSettings(QSettings& settings);
- /**
- * @brief set a setting for one of the installed mods
- * @param pluginName name of the plugin
- * @param key name of the setting to change
- * @param value the new value to set
- * @throw an exception is thrown if pluginName is invalid
- */
- void setPluginSetting(const QString &pluginName, const QString &key, const QVariant &value);
+ // log level for both MO and usvfs
+ //
+ MOBase::log::Levels logLevel() const;
+ void setLogLevel(MOBase::log::Levels level);
- /**
- * @brief retrieve a persistent value for a plugin
- * @param pluginName name of the plugin to store data for
- * @param key id of the value to retrieve
- * @param def default value to return if the value is not set
- * @return the requested value
- */
- QVariant pluginPersistent(const QString &pluginName, const QString &key, const QVariant &def) const;
+ // crash dump type for both MO and usvfs
+ //
+ CrashDumpsType crashDumpsType() const;
+ void setCrashDumpsType(CrashDumpsType type);
- /**
- * @brief set a persistent value for a plugin
- * @param pluginName name of the plugin to store data for
- * @param key id of the value to retrieve
- * @param value value to set
- * @throw an exception is thrown if pluginName is invalid
- */
- void setPluginPersistent(const QString &pluginName, const QString &key, const QVariant &value, bool sync);
+ // maximum number of dump files keps, for both MO and usvfs
+ //
+ int crashDumpsMax() const;
+ void setCrashDumpsMax(int n);
- /**
- * @return short code of the configured language (corresponding to the translation files)
- */
- QString language();
+private:
+ QSettings& m_Settings;
+};
+
+
+// manages the settings for MO; the settings are accessed directly through a
+// QSettings and so are not cached here
+//
+class Settings : public QObject
+{
+ Q_OBJECT;
+
+public:
+ Settings(const QString& path);
+ ~Settings();
+
+ static Settings &instance();
- /**
- * @brief updates the list of known servers
- * @param list of servers from a recent query
- */
- void updateServers(const QList<ServerInfo> &servers);
+ // name of the ini file
+ //
+ QString filename() const;
- /**
- * @brief add a plugin that is to be blacklisted
- * @param fileName name of the plugin to blacklist
- */
- void addBlacklistPlugin(const QString &fileName);
+ // version of MO stored in the ini; this may be different from the current
+ // version if the user just updated
+ //
+ std::optional<QVersionNumber> version() const;
- /**
- * @brief test if a plugin is blacklisted and shouldn't be loaded
- * @param fileName name of the plugin
- * @return true if the file is blacklisted
- */
- bool pluginBlacklisted(const QString &fileName) const;
+ // updates the settings to bring them up to date
+ //
+ void processUpdates(const QVersionNumber& current, const QVersionNumber& last);
- /**
- * @return all loaded MO plugins
- */
- std::vector<MOBase::IPlugin*> plugins() const { return m_Plugins; }
+ // whether MO has been started for the first time
+ //
+ bool firstStart() const;
+ void setFirstStart(bool b);
+ // configured executables
+ //
+ std::vector<std::map<QString, QVariant>> executables() const;
+ void setExecutables(const std::vector<std::map<QString, QVariant>>& v);
+
+ // whether to backup existing mods on install
+ //
+ bool keepBackupOnInstall() const;
+ void setKeepBackupOnInstall(bool b);
+
+ // blacklisted executables do not get hooked by usvfs; this list is managed
+ // by MO but given to usvfs when starting an executable
+ //
+ QString executablesBlacklist() const;
+ void setExecutablesBlacklist(const QString& s);
+
+ // ? looks obsolete, only used by dead code
+ //
+ unsigned int motdHash() const;
+ void setMotdHash(unsigned int hash);
+
+ // whether archives should be parsed to show conflicts and contents
+ //
+ bool archiveParsing() const;
+ void setArchiveParsing(bool b);
+
+ // whether the user wants to upgrade to pre-releases
+ //
bool usePrereleases() const;
+ void setUsePrereleases(bool b);
- /**
- * @brief register MO as the handler for nxm links
- * @param force set to true to enforce the registration dialog to show up,
- * even if the user said earlier not to
- */
- void registerAsNXMHandler(bool force);
- /**
- * @brief color the scrollbar of the mod list for custom separator colors?
- * @return the state of the setting
- */
- bool colorSeparatorScrollbar() const;
+ GameSettings& game();
+ const GameSettings& game() const;
- static QColor getIdealTextColor(const QColor& rBackgroundColor);
+ GeometrySettings& geometry();
+ const GeometrySettings& geometry() const;
- MOBase::IPluginGame const *gamePlugin() { return m_GamePlugin; }
- const LoadMechanism& loadMechanism() const { return m_LoadMechanism; }
+ WidgetSettings& widgets();
+ const WidgetSettings& widgets() const;
- // temp
- QMap<QString, QVariantMap> m_PluginSettings;
- QMap<QString, QVariantMap> m_PluginDescriptions;
- QSet<QString> m_PluginBlacklist;
- void writePluginBlacklist();
+ ColorSettings& colors();
+ const ColorSettings& colors() const;
+
+ PluginSettings& plugins();
+ const PluginSettings& plugins() const;
+
+ PathSettings& paths();
+ const PathSettings& paths() const;
+
+ NetworkSettings& network();
+ const NetworkSettings& network() const;
+
+ NexusSettings& nexus();
+ const NexusSettings& nexus() const;
+
+ SteamSettings& steam();
+ const SteamSettings& steam() const;
+
+ InterfaceSettings& interface();
+ const InterfaceSettings& interface() const;
+
+ DiagnosticsSettings& diagnostics();
+ const DiagnosticsSettings& diagnostics() const;
+
+ // makes sure the ini file is written to disk
+ //
+ QSettings::Status sync() const;
+
+ void dump() const;
public slots:
+ // this slot is connected to by various parts of MO
+ //
void managedGameChanged(MOBase::IPluginGame const *gamePlugin);
signals:
+ // these are fired from outside the settings, mostly by the settings dialog
+ //
void languageChanged(const QString &newLanguage);
void styleChanged(const QString &newStyle);
private:
static Settings *s_Instance;
- MOBase::IPluginGame const *m_GamePlugin;
mutable QSettings m_Settings;
- LoadMechanism m_LoadMechanism;
- std::vector<MOBase::IPlugin*> m_Plugins;
-
- static bool obfuscate(const QString key, const QString data);
- static QString deObfuscate(const QString key);
- void readPluginBlacklist();
- QString getConfigurablePath(const QString &key, const QString &def, bool resolve) const;
+ GameSettings m_Game;
+ GeometrySettings m_Geometry;
+ WidgetSettings m_Widgets;
+ ColorSettings m_Colors;
+ PluginSettings m_Plugins;
+ PathSettings m_Paths;
+ NetworkSettings m_Network;
+ NexusSettings m_Nexus;
+ SteamSettings m_Steam;
+ InterfaceSettings m_Interface;
+ DiagnosticsSettings m_Diagnostics;
};
#endif // SETTINGS_H