summaryrefslogtreecommitdiffstats
path: root/api/logic/minecraft/gameoptions/GameOptions.h
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2019-01-30 00:35:24 +0100
committerPetr Mrázek <peterix@gmail.com>2019-01-30 00:35:24 +0100
commit62c9fcdc6cd6b80540cdb8d79ce92db32cfd284e (patch)
tree4a83da8a22fbb67281ea4c9a729ef750f0ce37ad /api/logic/minecraft/gameoptions/GameOptions.h
parentc1ea42d3d9b793b52d52310f69174f1c5ab9daef (diff)
downloadMultiMC-62c9fcdc6cd6b80540cdb8d79ce92db32cfd284e.tar
MultiMC-62c9fcdc6cd6b80540cdb8d79ce92db32cfd284e.tar.gz
MultiMC-62c9fcdc6cd6b80540cdb8d79ce92db32cfd284e.tar.lz
MultiMC-62c9fcdc6cd6b80540cdb8d79ce92db32cfd284e.tar.xz
MultiMC-62c9fcdc6cd6b80540cdb8d79ce92db32cfd284e.zip
NOISSUE first step towards having game options management
Diffstat (limited to 'api/logic/minecraft/gameoptions/GameOptions.h')
-rw-r--r--api/logic/minecraft/gameoptions/GameOptions.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/api/logic/minecraft/gameoptions/GameOptions.h b/api/logic/minecraft/gameoptions/GameOptions.h
new file mode 100644
index 00000000..c6d25492
--- /dev/null
+++ b/api/logic/minecraft/gameoptions/GameOptions.h
@@ -0,0 +1,34 @@
+#pragma once
+
+#include <map>
+#include <QString>
+#include <QAbstractListModel>
+
+struct GameOptionItem
+{
+ QString key;
+ QString value;
+};
+
+class GameOptions : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ explicit GameOptions(const QString& path);
+ virtual ~GameOptions() = default;
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex & parent) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
+
+ bool isLoaded() const;
+ bool reload();
+ bool save();
+
+private:
+ std::vector<GameOptionItem> contents;
+ bool loaded = false;
+ QString path;
+ int version = 0;
+};