mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-30 20:06:56 -05:00
Add project-specific configuration file. Only contains base_game_version right now.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define CONFIG_H
|
||||
|
||||
#include <QString>
|
||||
#include <QObject>
|
||||
|
||||
enum MapSortOrder {
|
||||
Group = 0,
|
||||
@@ -9,23 +10,23 @@ enum MapSortOrder {
|
||||
Layout = 2,
|
||||
};
|
||||
|
||||
class KeyValueConfigBase
|
||||
class KeyValueConfigBase : public QObject
|
||||
{
|
||||
public:
|
||||
void save();
|
||||
void load();
|
||||
virtual ~KeyValueConfigBase();
|
||||
protected:
|
||||
QString configFilename;
|
||||
virtual QString getConfigFilepath() = 0;
|
||||
virtual void parseConfigKeyValue(QString key, QString value) = 0;
|
||||
virtual QMap<QString, QString> getKeyValueMap() = 0;
|
||||
virtual void onNewConfigFileCreated() = 0;
|
||||
};
|
||||
|
||||
class PorymapConfig: public KeyValueConfigBase
|
||||
{
|
||||
public:
|
||||
PorymapConfig() {
|
||||
this->configFilename = "porymap.cfg";
|
||||
this->recentProject = "";
|
||||
this->recentMap = "";
|
||||
this->mapSortOrder = MapSortOrder::Group;
|
||||
@@ -40,8 +41,10 @@ public:
|
||||
MapSortOrder getMapSortOrder();
|
||||
bool getPrettyCursors();
|
||||
protected:
|
||||
QString getConfigFilepath();
|
||||
void parseConfigKeyValue(QString key, QString value);
|
||||
QMap<QString, QString> getKeyValueMap();
|
||||
void onNewConfigFileCreated() {}
|
||||
private:
|
||||
QString recentProject;
|
||||
QString recentMap;
|
||||
@@ -51,4 +54,30 @@ private:
|
||||
|
||||
extern PorymapConfig porymapConfig;
|
||||
|
||||
enum BaseGameVersion {
|
||||
pokeruby,
|
||||
pokeemerald,
|
||||
};
|
||||
|
||||
class ProjectConfig: public KeyValueConfigBase
|
||||
{
|
||||
public:
|
||||
ProjectConfig() {
|
||||
this->baseGameVersion = BaseGameVersion::pokeemerald;
|
||||
}
|
||||
void setBaseGameVersion(BaseGameVersion baseGameVersion);
|
||||
BaseGameVersion getBaseGameVersion();
|
||||
void setProjectDir(QString projectDir);
|
||||
protected:
|
||||
QString getConfigFilepath();
|
||||
void parseConfigKeyValue(QString key, QString value);
|
||||
QMap<QString, QString> getKeyValueMap();
|
||||
void onNewConfigFileCreated();
|
||||
private:
|
||||
BaseGameVersion baseGameVersion;
|
||||
QString projectDir;
|
||||
};
|
||||
|
||||
extern ProjectConfig projectConfig;
|
||||
|
||||
#endif // CONFIG_H
|
||||
|
||||
Reference in New Issue
Block a user