2019-01-29 23:35:24 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
2023-08-02 17:35:35 +01:00
|
|
|
#include <QString>
|
|
|
|
#include <map>
|
2019-01-29 23:35:24 +00:00
|
|
|
|
2023-08-02 17:35:35 +01:00
|
|
|
struct GameOptionItem {
|
2019-01-29 23:35:24 +00:00
|
|
|
QString key;
|
|
|
|
QString value;
|
|
|
|
};
|
|
|
|
|
2023-08-02 17:35:35 +01:00
|
|
|
class GameOptions : public QAbstractListModel {
|
2019-01-29 23:35:24 +00:00
|
|
|
Q_OBJECT
|
2023-08-02 17:35:35 +01:00
|
|
|
public:
|
2019-01-29 23:35:24 +00:00
|
|
|
explicit GameOptions(const QString& path);
|
|
|
|
virtual ~GameOptions() = default;
|
|
|
|
|
2023-08-02 17:35:35 +01:00
|
|
|
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;
|
2019-01-29 23:35:24 +00:00
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
|
|
|
|
|
|
|
bool isLoaded() const;
|
|
|
|
bool reload();
|
|
|
|
bool save();
|
|
|
|
|
2023-08-02 17:35:35 +01:00
|
|
|
private:
|
2019-01-29 23:35:24 +00:00
|
|
|
std::vector<GameOptionItem> contents;
|
|
|
|
bool loaded = false;
|
|
|
|
QString path;
|
|
|
|
int version = 0;
|
|
|
|
};
|