mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-10 15:39:02 +00:00
101c147217
preference 1. Included updated status icons, added base.png 2. Added doxygen comments CSV / CSM Settings classes 3. Implemented Glorf's code for window size preference 4. Minor changes code that searches maps in CSV / CSM Settings classes 5. Removed CSVSettings::SamplePage class 6. Other minor code maintenance / improvements
82 lines
2.5 KiB
C++
82 lines
2.5 KiB
C++
#ifndef USERSETTINGS_HPP
|
|
#define USERSETTINGS_HPP
|
|
|
|
#include <QTextStream>
|
|
#include <QStringList>
|
|
#include <QString>
|
|
#include <QMap>
|
|
|
|
#include <boost/filesystem/path.hpp>
|
|
|
|
#include "support.hpp"
|
|
|
|
#ifndef Q_MOC_RUN
|
|
#include <components/files/configurationmanager.hpp>
|
|
#endif
|
|
|
|
namespace Files { typedef std::vector<boost::filesystem::path> PathContainer;
|
|
struct ConfigurationManager;}
|
|
|
|
class QFile;
|
|
|
|
namespace CSMSettings {
|
|
|
|
struct UserSettings: public QObject
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
SectionMap mSectionSettings;
|
|
static UserSettings *mUserSettingsInstance;
|
|
QStringList mPaths;
|
|
Files::ConfigurationManager mCfgMgr;
|
|
QString mReadOnlyMessage;
|
|
QString mReadWriteMessage;
|
|
|
|
public:
|
|
|
|
/// Singleton implementation
|
|
static UserSettings& instance();
|
|
|
|
UserSettings();
|
|
~UserSettings();
|
|
|
|
UserSettings (UserSettings const &); //not implemented
|
|
void operator= (UserSettings const &); //not implemented
|
|
|
|
/// Writes settings to the last loaded settings file
|
|
bool writeSettings(QMap<QString, SettingList *> §ions);
|
|
|
|
/// Called from editor to trigger signal to update the specified setting.
|
|
/// If no setting name is specified, all settings found in the specified section are updated.
|
|
void updateSettings (const QString §ionName, const QString &settingName = "");
|
|
|
|
/// Retrieves the settings file at all three levels (global, local and user).
|
|
|
|
/// TODO: Multi-valued settings are not fully implemented. Setting values
|
|
/// loaded in later files will always overwrite previously loaded values.
|
|
void loadSettings (const QString &fileName);
|
|
|
|
/// Returns the entire map of settings across all sections
|
|
const SectionMap &getSettings () const;
|
|
|
|
/// Retrieves the value as a QString of the specified setting in the specified section
|
|
QString getSetting(const QString §ion, const QString &setting) const;
|
|
|
|
private:
|
|
|
|
|
|
/// Opens a QTextStream from the provided path as read-only or read-write.
|
|
QTextStream *openFileStream (const QString &filePath, bool isReadOnly = false) const;
|
|
|
|
/// Parses a setting file specified in filePath from the provided text stream.
|
|
void loadFromFile (const QString &filePath = "");
|
|
|
|
signals:
|
|
|
|
void signalUpdateEditorSetting (const QString &settingName, const QString &settingValue);
|
|
|
|
};
|
|
}
|
|
#endif // USERSETTINGS_HPP
|