2018-12-21 15:25:28 +00:00
|
|
|
#ifndef CONFIG_H
|
|
|
|
#define CONFIG_H
|
|
|
|
|
|
|
|
#include <QString>
|
2018-12-25 21:26:13 +00:00
|
|
|
#include <QObject>
|
2018-12-21 15:25:28 +00:00
|
|
|
|
|
|
|
enum MapSortOrder {
|
|
|
|
Group = 0,
|
|
|
|
Area = 1,
|
|
|
|
Layout = 2,
|
|
|
|
};
|
|
|
|
|
2018-12-25 21:26:13 +00:00
|
|
|
class KeyValueConfigBase : public QObject
|
2018-12-21 15:25:28 +00:00
|
|
|
{
|
|
|
|
public:
|
2018-12-25 20:41:06 +00:00
|
|
|
void save();
|
|
|
|
void load();
|
|
|
|
virtual ~KeyValueConfigBase();
|
|
|
|
protected:
|
2018-12-25 21:26:13 +00:00
|
|
|
virtual QString getConfigFilepath() = 0;
|
2018-12-25 20:41:06 +00:00
|
|
|
virtual void parseConfigKeyValue(QString key, QString value) = 0;
|
|
|
|
virtual QMap<QString, QString> getKeyValueMap() = 0;
|
2018-12-25 21:26:13 +00:00
|
|
|
virtual void onNewConfigFileCreated() = 0;
|
2018-12-25 20:41:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class PorymapConfig: public KeyValueConfigBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PorymapConfig() {
|
|
|
|
this->recentProject = "";
|
|
|
|
this->recentMap = "";
|
|
|
|
this->mapSortOrder = MapSortOrder::Group;
|
|
|
|
this->prettyCursors = true;
|
2019-01-06 18:53:31 +00:00
|
|
|
this->collisionOpacity = 50;
|
2018-12-25 20:41:06 +00:00
|
|
|
}
|
|
|
|
void setRecentProject(QString project);
|
|
|
|
void setRecentMap(QString map);
|
|
|
|
void setMapSortOrder(MapSortOrder order);
|
|
|
|
void setPrettyCursors(bool enabled);
|
2019-01-06 18:53:31 +00:00
|
|
|
void setCollisionOpacity(int opacity);
|
2018-12-25 20:41:06 +00:00
|
|
|
QString getRecentProject();
|
|
|
|
QString getRecentMap();
|
|
|
|
MapSortOrder getMapSortOrder();
|
|
|
|
bool getPrettyCursors();
|
2019-01-06 18:53:31 +00:00
|
|
|
int getCollisionOpacity();
|
2018-12-25 20:41:06 +00:00
|
|
|
protected:
|
2018-12-25 21:26:13 +00:00
|
|
|
QString getConfigFilepath();
|
2018-12-25 20:41:06 +00:00
|
|
|
void parseConfigKeyValue(QString key, QString value);
|
|
|
|
QMap<QString, QString> getKeyValueMap();
|
2018-12-25 21:26:13 +00:00
|
|
|
void onNewConfigFileCreated() {}
|
2018-12-21 15:25:28 +00:00
|
|
|
private:
|
2018-12-25 20:41:06 +00:00
|
|
|
QString recentProject;
|
|
|
|
QString recentMap;
|
|
|
|
MapSortOrder mapSortOrder;
|
|
|
|
bool prettyCursors;
|
2019-01-06 18:53:31 +00:00
|
|
|
int collisionOpacity;
|
2018-12-21 15:25:28 +00:00
|
|
|
};
|
|
|
|
|
2018-12-25 20:41:06 +00:00
|
|
|
extern PorymapConfig porymapConfig;
|
|
|
|
|
2018-12-25 21:26:13 +00:00
|
|
|
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;
|
|
|
|
|
2018-12-21 15:25:28 +00:00
|
|
|
#endif // CONFIG_H
|