forked from mirror/openmw-tes3mp
700d55f1fb
Implemented updating editor application from preferences menu, loading settings when editor loads, adding Record Status Display prefernce. Fixed multiple bugs, made changes to CSM(V)Settings classes to make implementing new prefrences easier. Rewrote CSMSettings::UserSettings to retain last-loaded settings. Adjusted icon position in Record Status column Capitalized status text Added delegate to referenceables table
67 lines
1.6 KiB
C++
67 lines
1.6 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;
|
|
UserSettings *mUserSettingsInstance;
|
|
QStringList mPaths;
|
|
Files::ConfigurationManager mCfgMgr;
|
|
|
|
QString mReadOnlyMessage;
|
|
QString mReadWriteMessage;
|
|
|
|
public:
|
|
|
|
static UserSettings &instance()
|
|
{
|
|
static UserSettings instance;
|
|
|
|
return instance;
|
|
}
|
|
|
|
bool writeFile(QMap<QString, SettingList *> §ions);
|
|
const SectionMap &getSettings ();
|
|
void updateSettings (const QString §ionName, const QString &settingName = "");
|
|
void loadSettings (const QString &fileName);
|
|
|
|
private:
|
|
|
|
UserSettings();
|
|
~UserSettings();
|
|
|
|
UserSettings (UserSettings const &); //not implemented
|
|
void operator= (UserSettings const &); //not implemented
|
|
|
|
QTextStream *openFileStream (const QString &filePath, bool isReadOnly = false);
|
|
void loadFromFile (const QString &filePath = "");
|
|
|
|
signals:
|
|
void signalUpdateEditorSetting (const QString &settingName, const QString &settingValue);
|
|
|
|
};
|
|
}
|
|
#endif // USERSETTINGS_HPP
|