TOra uses Qt's QSettings class to store and retrieve all settings. ToConfiguration::setQSettignsEnv() sets organisation name, domain and application name for QCoreApplication which is later used in determining actual filename storing configuration on linux (or branch in registry for redmond) (see Qt QSettings documentation for more details). Values for these parameters are defined in toconf.h.
Class toConfigurationPrivate contains method loadConfig which is getting values from configuration storage. Note that calls to getter methods contain default values for configuration items.
File toconf.h contains a number of static (build time specified) settings as C++ #defines. This also includes actual names for configuration items. So if there is a configuration item for say “maximum delay” then actual string used when calling QSetting methods will be defined in toconf.h in this way:
#define CONF_MAXIMUM_DELAY “maximum delay”
This define will be used in actual calls to QSetting methods. This is done in order not to repeat the same string more than once raising a risk of mistyping setting name. This file will also contain defines for default values. For example:
#define DEFAULT_MAXIMUM_DELAY 1000
Base for user interface for preferences (edit→preferences) is topreferences.ui, but it only describes base of preferences dialog without any actual preferences. Actual preferences are added dynamically (in class toPreferences) and are defined in topreferences.h/cpp. Following settings (representing one item of choice in setting list and one corresponding set of options) are added:
In order to add a new configuration option you will have to:
From now on if you need to use configuration option value you have to include toconfiguration.h and call a getter (or setter) method you've just created:
#include "toconfiguration.h" ... toConfigurationSingle::Instance().getMyOption();