Add palette editor bit depth to config
This commit is contained in:
parent
420e92e912
commit
4fbe8bf5ef
5 changed files with 30 additions and 5 deletions
|
@ -7,6 +7,9 @@ and this project somewhat adheres to [Semantic Versioning](https://semver.org/sp
|
||||||
The **"Breaking Changes"** listed below are changes that have been made in the decompilation projects (e.g. pokeemerald), which porymap requires in order to work properly. It also includes changes to the scripting API that may change the behavior of existing porymap scripts. If porymap is used with a project or API script that is not up-to-date with the breaking changes, then porymap will likely break or behave improperly.
|
The **"Breaking Changes"** listed below are changes that have been made in the decompilation projects (e.g. pokeemerald), which porymap requires in order to work properly. It also includes changes to the scripting API that may change the behavior of existing porymap scripts. If porymap is used with a project or API script that is not up-to-date with the breaking changes, then porymap will likely break or behave improperly.
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
### Changed
|
||||||
|
- The Palette Editor now remembers the Bit Depth setting.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fix text boxes in the Palette Editor calculating color incorrectly.
|
- Fix text boxes in the Palette Editor calculating color incorrectly.
|
||||||
|
|
||||||
|
|
|
@ -5051,7 +5051,7 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label_Palette">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Palette</string>
|
<string>Palette</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -5096,9 +5096,6 @@
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>24</string>
|
<string>24</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -81,6 +81,7 @@ public:
|
||||||
void setTheme(QString theme);
|
void setTheme(QString theme);
|
||||||
void setTextEditorOpenFolder(const QString &command);
|
void setTextEditorOpenFolder(const QString &command);
|
||||||
void setTextEditorGotoLine(const QString &command);
|
void setTextEditorGotoLine(const QString &command);
|
||||||
|
void setPaletteEditorBitDepth(int bitDepth);
|
||||||
QString getRecentProject();
|
QString getRecentProject();
|
||||||
bool getReopenOnLaunch();
|
bool getReopenOnLaunch();
|
||||||
MapSortOrder getMapSortOrder();
|
MapSortOrder getMapSortOrder();
|
||||||
|
@ -100,6 +101,7 @@ public:
|
||||||
QString getTheme();
|
QString getTheme();
|
||||||
QString getTextEditorOpenFolder();
|
QString getTextEditorOpenFolder();
|
||||||
QString getTextEditorGotoLine();
|
QString getTextEditorGotoLine();
|
||||||
|
int getPaletteEditorBitDepth();
|
||||||
protected:
|
protected:
|
||||||
virtual QString getConfigFilepath() override;
|
virtual QString getConfigFilepath() override;
|
||||||
virtual void parseConfigKeyValue(QString key, QString value) override;
|
virtual void parseConfigKeyValue(QString key, QString value) override;
|
||||||
|
@ -135,6 +137,7 @@ private:
|
||||||
QString theme;
|
QString theme;
|
||||||
QString textEditorOpenFolder;
|
QString textEditorOpenFolder;
|
||||||
QString textEditorGotoLine;
|
QString textEditorGotoLine;
|
||||||
|
int paletteEditorBitDepth;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern PorymapConfig porymapConfig;
|
extern PorymapConfig porymapConfig;
|
||||||
|
|
|
@ -246,6 +246,11 @@ void PorymapConfig::parseConfigKeyValue(QString key, QString value) {
|
||||||
this->textEditorOpenFolder = value;
|
this->textEditorOpenFolder = value;
|
||||||
} else if (key == "text_editor_goto_line") {
|
} else if (key == "text_editor_goto_line") {
|
||||||
this->textEditorGotoLine = value;
|
this->textEditorGotoLine = value;
|
||||||
|
} else if (key == "palette_editor_bit_depth") {
|
||||||
|
this->paletteEditorBitDepth = getConfigInteger(key, value, 15, 24, 24);
|
||||||
|
if (this->paletteEditorBitDepth != 15 && this->paletteEditorBitDepth != 24){
|
||||||
|
this->paletteEditorBitDepth = 24;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
logWarn(QString("Invalid config key found in config file %1: '%2'").arg(this->getConfigFilepath()).arg(key));
|
logWarn(QString("Invalid config key found in config file %1: '%2'").arg(this->getConfigFilepath()).arg(key));
|
||||||
}
|
}
|
||||||
|
@ -278,6 +283,7 @@ QMap<QString, QString> PorymapConfig::getKeyValueMap() {
|
||||||
map.insert("theme", this->theme);
|
map.insert("theme", this->theme);
|
||||||
map.insert("text_editor_open_directory", this->textEditorOpenFolder);
|
map.insert("text_editor_open_directory", this->textEditorOpenFolder);
|
||||||
map.insert("text_editor_goto_line", this->textEditorGotoLine);
|
map.insert("text_editor_goto_line", this->textEditorGotoLine);
|
||||||
|
map.insert("palette_editor_bit_depth", QString("%1").arg(this->paletteEditorBitDepth));
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
@ -400,6 +406,11 @@ void PorymapConfig::setTextEditorGotoLine(const QString &command) {
|
||||||
this->save();
|
this->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PorymapConfig::setPaletteEditorBitDepth(int bitDepth) {
|
||||||
|
this->paletteEditorBitDepth = bitDepth;
|
||||||
|
this->save();
|
||||||
|
}
|
||||||
|
|
||||||
QString PorymapConfig::getRecentProject() {
|
QString PorymapConfig::getRecentProject() {
|
||||||
return this->recentProject;
|
return this->recentProject;
|
||||||
}
|
}
|
||||||
|
@ -498,6 +509,10 @@ QString PorymapConfig::getTextEditorGotoLine() {
|
||||||
return this->textEditorGotoLine;
|
return this->textEditorGotoLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int PorymapConfig::getPaletteEditorBitDepth() {
|
||||||
|
return this->paletteEditorBitDepth;
|
||||||
|
}
|
||||||
|
|
||||||
const QMap<BaseGameVersion, QString> baseGameVersionMap = {
|
const QMap<BaseGameVersion, QString> baseGameVersionMap = {
|
||||||
{BaseGameVersion::pokeruby, "pokeruby"},
|
{BaseGameVersion::pokeruby, "pokeruby"},
|
||||||
{BaseGameVersion::pokefirered, "pokefirered"},
|
{BaseGameVersion::pokefirered, "pokefirered"},
|
||||||
|
|
|
@ -87,7 +87,13 @@ PaletteEditor::PaletteEditor(Project *project, Tileset *primaryTileset, Tileset
|
||||||
connect(this->pickButtons[i], &QToolButton::clicked, [this, i](){ this->pickColor(i); });
|
connect(this->pickButtons[i], &QToolButton::clicked, [this, i](){ this->pickColor(i); });
|
||||||
}
|
}
|
||||||
|
|
||||||
setBitDepth(24);
|
int bitDepth = porymapConfig.getPaletteEditorBitDepth();
|
||||||
|
if (bitDepth == 15) {
|
||||||
|
this->ui->bit_depth_15->setChecked(true);
|
||||||
|
} else {
|
||||||
|
this->ui->bit_depth_24->setChecked(true);
|
||||||
|
}
|
||||||
|
setBitDepth(bitDepth);
|
||||||
|
|
||||||
// Connect bit depth buttons
|
// Connect bit depth buttons
|
||||||
connect(this->ui->bit_depth_15, &QRadioButton::toggled, [this](bool checked){ if (checked) this->setBitDepth(15); });
|
connect(this->ui->bit_depth_15, &QRadioButton::toggled, [this](bool checked){ if (checked) this->setBitDepth(15); });
|
||||||
|
@ -227,6 +233,7 @@ void PaletteEditor::setBitDepth(int bits) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this->bitDepth = bits;
|
this->bitDepth = bits;
|
||||||
|
porymapConfig.setPaletteEditorBitDepth(bits);
|
||||||
refreshColorUis();
|
refreshColorUis();
|
||||||
setSignalsEnabled(true);
|
setSignalsEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue