Add preferred text editor to PorymapConfig

This commit is contained in:
BigBahss 2020-11-16 06:46:21 -05:00
parent 5927f3dd7b
commit 0a15dfbf4c
2 changed files with 15 additions and 0 deletions

View file

@ -61,6 +61,7 @@ public:
void setMonitorFiles(bool monitor);
void setRegionMapDimensions(int width, int height);
void setTheme(QString theme);
void setTextEditorCommand(const QString &command);
QString getRecentProject();
QString getRecentMap();
MapSortOrder getMapSortOrder();
@ -76,6 +77,7 @@ public:
bool getMonitorFiles();
QSize getRegionMapDimensions();
QString getTheme();
QString getTextEditorCommand();
protected:
virtual QString getConfigFilepath() override;
virtual void parseConfigKeyValue(QString key, QString value) override;
@ -107,6 +109,7 @@ private:
bool monitorFiles;
QSize regionMapDimensions;
QString theme;
QString textEditorCommand;
};
extern PorymapConfig porymapConfig;

View file

@ -187,6 +187,8 @@ void PorymapConfig::parseConfigKeyValue(QString key, QString value) {
}
} else if (key == "theme") {
this->theme = value;
} else if (key == "text_editor") {
this->textEditorCommand = value;
} else {
logWarn(QString("Invalid config key found in config file %1: '%2'").arg(this->getConfigFilepath()).arg(key));
}
@ -216,6 +218,7 @@ QMap<QString, QString> PorymapConfig::getKeyValueMap() {
map.insert("region_map_dimensions", QString("%1x%2").arg(this->regionMapDimensions.width())
.arg(this->regionMapDimensions.height()));
map.insert("theme", this->theme);
map.insert("text_editor", this->textEditorCommand);
return map;
}
@ -316,6 +319,11 @@ void PorymapConfig::setTheme(QString theme) {
this->theme = theme;
}
void PorymapConfig::setTextEditorCommand(const QString &command) {
this->textEditorCommand = command;
this->save();
}
QString PorymapConfig::getRecentProject() {
return this->recentProject;
}
@ -398,6 +406,10 @@ QString PorymapConfig::getTheme() {
return this->theme;
}
QString PorymapConfig::getTextEditorCommand() {
return this->textEditorCommand;
}
const QMap<BaseGameVersion, QString> baseGameVersionMap = {
{BaseGameVersion::pokeruby, "pokeruby"},
{BaseGameVersion::pokefirered, "pokefirered"},