summaryrefslogtreecommitdiff
path: root/src/profile.h
diff options
context:
space:
mode:
authorBrian Munro <brian.alexander.munro@gmail.com>2018-03-05 11:35:58 +0200
committerGitHub <noreply@github.com>2018-03-05 11:35:58 +0200
commitc7e1d9738f06c6c6e7c9b41cdd8d35062d7c06b6 (patch)
treec9c92380fcc82a64df8956face14e22bc3d2b4f7 /src/profile.h
parent7dfe0c9a8feae35ba7554493eea4fdb4e33a64d3 (diff)
parenta540a542a47fe75d0d0e4594158422aef4340b3a (diff)
Merge pull request #252 from LePresidente/new_vfs_library
Update master to latest stable code.
Diffstat (limited to 'src/profile.h')
-rw-r--r--src/profile.h50
1 files changed, 41 insertions, 9 deletions
diff --git a/src/profile.h b/src/profile.h
index 39e8ff5f..1fcad046 100644
--- a/src/profile.h
+++ b/src/profile.h
@@ -29,6 +29,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <QDir>
#include <QObject>
#include <QString>
+#include <QSettings>
#include <boost/shared_ptr.hpp>
@@ -88,7 +89,14 @@ public:
**/
static Profile *createPtrFrom(const QString &name, const Profile &reference, MOBase::IPluginGame const *gamePlugin);
- MOBase::DelayedFileWriter &modlistWriter() { return m_ModListWriter; }
+
+ static void renameModInAllProfiles(const QString& oldName, const QString& newName);
+
+ void writeModlist();
+
+ void writeModlistNow(bool onlyIfPending=false);
+
+ void cancelModlistWrite();
/**
* @brief test if this profile uses archive invalidation
@@ -112,20 +120,32 @@ public:
/**
* @return true if this profile uses local save games
*/
- bool localSavesEnabled() const;
+ virtual bool localSavesEnabled() const override;
/**
* @brief enables or disables the use of local save games for this profile
- * disabling this does not delete exising local saves but they will not be visible
- * in the game
+ * when disabling the user will be asked if he wants to remove the save games
+ * in the profile
* @param enable if true, local saves are enabled, otherewise they are disabled
*/
bool enableLocalSaves(bool enable);
/**
+ * @return true if this profile uses local ini files
+ */
+ virtual bool localSettingsEnabled() const override;
+
+ /**
+ * @brief enables or disables the use of local ini files for this profile
+ * disabling this does not delete existing ini files but the global ones will be used
+ * @param enable
+ */
+ bool enableLocalSettings(bool enable);
+
+ /**
* @return name of the profile (this is identical to its directory name)
**/
- QString name() const { return m_Directory.dirName(); }
+ virtual QString name() const override { return m_Directory.dirName(); }
/**
* @return the path of the plugins file in this profile
@@ -174,7 +194,7 @@ public:
/**
* @return path to this profile
**/
- QString absolutePath() const;
+ virtual QString absolutePath() const override;
/**
* @return path to this profile's save games
@@ -213,7 +233,7 @@ public:
*
* @return number of mods for which the profile has status information
**/
- unsigned int numMods() const { return m_ModStatus.size(); }
+ size_t numMods() const { return m_ModStatus.size(); }
/**
* @return the number of mods that can be enabled and where the priority can be modified
@@ -267,6 +287,13 @@ public:
void dumpModStatus() const;
+ QVariant setting(const QString &section, const QString &name,
+ const QVariant &fallback = QVariant());
+
+ void storeSetting(const QString &section, const QString &name,
+ const QVariant &value);
+ void removeSetting(const QString &section, const QString &name);
+
signals:
/**
@@ -278,7 +305,8 @@ signals:
public slots:
- void writeModlistNow();
+ // should only be called by DelayedFileWriter, use writeModlist() and writeModlistNow() instead
+ void doWriteModlist();
private:
@@ -307,11 +335,15 @@ private:
void touchFile(QString fileName);
void finishChangeStatus() const;
+ static void renameModInList(QFile &modList, const QString &oldName, const QString &newName);
+
private:
QDir m_Directory;
- MOBase::IPluginGame const * const m_GamePlugin;
+ QSettings *m_Settings;
+
+ const MOBase::IPluginGame *m_GamePlugin;
mutable QByteArray m_LastModlistHash;
std::vector<ModStatus> m_ModStatus;