Save mirroring in config

This commit is contained in:
GriffinR 2024-08-04 17:39:56 -04:00
parent 4e04e57c05
commit b5c7f9f86b
5 changed files with 14 additions and 2 deletions

View file

@ -58,6 +58,7 @@ public:
this->reopenOnLaunch = true; this->reopenOnLaunch = true;
this->mapSortOrder = MapSortOrder::Group; this->mapSortOrder = MapSortOrder::Group;
this->prettyCursors = true; this->prettyCursors = true;
this->mirrorConnectingMaps = true;
this->showDiveEmergeMaps = false; this->showDiveEmergeMaps = false;
this->diveEmergeMapOpacity = 30; this->diveEmergeMapOpacity = 30;
this->diveMapOpacity = 15; this->diveMapOpacity = 15;
@ -107,6 +108,7 @@ public:
bool projectManuallyClosed; bool projectManuallyClosed;
MapSortOrder mapSortOrder; MapSortOrder mapSortOrder;
bool prettyCursors; bool prettyCursors;
bool mirrorConnectingMaps;
bool showDiveEmergeMaps; bool showDiveEmergeMaps;
int diveEmergeMapOpacity; int diveEmergeMapOpacity;
int diveMapOpacity; int diveMapOpacity;

View file

@ -269,6 +269,7 @@ private slots:
void eventTabChanged(int index); void eventTabChanged(int index);
void on_checkBox_MirrorConnections_stateChanged(int selected);
void on_actionDive_Emerge_Map_triggered(); void on_actionDive_Emerge_Map_triggered();
void on_groupBox_DiveMapOpacity_toggled(bool on); void on_groupBox_DiveMapOpacity_toggled(bool on);
void on_slider_DiveEmergeMapOpacity_valueChanged(int value); void on_slider_DiveEmergeMapOpacity_valueChanged(int value);

View file

@ -330,6 +330,8 @@ void PorymapConfig::parseConfigKeyValue(QString key, QString value) {
this->mainSplitterState = bytesFromString(value); this->mainSplitterState = bytesFromString(value);
} else if (key == "metatiles_splitter_state") { } else if (key == "metatiles_splitter_state") {
this->metatilesSplitterState = bytesFromString(value); this->metatilesSplitterState = bytesFromString(value);
} else if (key == "mirror_connecting_maps") {
this->mirrorConnectingMaps = getConfigBool(key, value);
} else if (key == "show_dive_emerge_maps") { } else if (key == "show_dive_emerge_maps") {
this->showDiveEmergeMaps = getConfigBool(key, value); this->showDiveEmergeMaps = getConfigBool(key, value);
} else if (key == "dive_emerge_map_opacity") { } else if (key == "dive_emerge_map_opacity") {
@ -447,6 +449,7 @@ QMap<QString, QString> PorymapConfig::getKeyValueMap() {
map.insert("project_settings_editor_state", stringFromByteArray(this->projectSettingsEditorState)); map.insert("project_settings_editor_state", stringFromByteArray(this->projectSettingsEditorState));
map.insert("custom_scripts_editor_geometry", stringFromByteArray(this->customScriptsEditorGeometry)); map.insert("custom_scripts_editor_geometry", stringFromByteArray(this->customScriptsEditorGeometry));
map.insert("custom_scripts_editor_state", stringFromByteArray(this->customScriptsEditorState)); map.insert("custom_scripts_editor_state", stringFromByteArray(this->customScriptsEditorState));
map.insert("mirror_connecting_maps", this->mirrorConnectingMaps ? "1" : "0");
map.insert("show_dive_emerge_maps", this->showDiveEmergeMaps ? "1" : "0"); map.insert("show_dive_emerge_maps", this->showDiveEmergeMaps ? "1" : "0");
map.insert("dive_emerge_map_opacity", QString::number(this->diveEmergeMapOpacity)); map.insert("dive_emerge_map_opacity", QString::number(this->diveEmergeMapOpacity));
map.insert("dive_map_opacity", QString::number(this->diveMapOpacity)); map.insert("dive_map_opacity", QString::number(this->diveMapOpacity));

View file

@ -905,7 +905,7 @@ void Editor::removeConnection(MapConnection* connection, bool removeMirror) {
} }
MapConnection* Editor::getMirroredConnection(MapConnection* source) { MapConnection* Editor::getMirroredConnection(MapConnection* source) {
if (!source || !ui->checkBox_MirrorConnections->isChecked()) if (!source || !porymapConfig.mirrorConnectingMaps)
return nullptr; return nullptr;
// Note: It's possible (and ok) for connectedMap == this->map // Note: It's possible (and ok) for connectedMap == this->map
@ -925,7 +925,7 @@ MapConnection* Editor::getMirroredConnection(MapConnection* source) {
} }
void Editor::addMirroredConnection(MapConnection* source) { void Editor::addMirroredConnection(MapConnection* source) {
if (!source || !ui->checkBox_MirrorConnections->isChecked()) if (!source || !porymapConfig.mirrorConnectingMaps)
return; return;
addConnection(source->createMirror(), false); addConnection(source->createMirror(), false);
} }

View file

@ -486,6 +486,7 @@ void MainWindow::loadUserSettings() {
this->editor->settings->cursorTileRectEnabled = porymapConfig.showCursorTile; this->editor->settings->cursorTileRectEnabled = porymapConfig.showCursorTile;
ui->checkBox_ToggleBorder->setChecked(porymapConfig.showBorder); ui->checkBox_ToggleBorder->setChecked(porymapConfig.showBorder);
ui->checkBox_ToggleGrid->setChecked(porymapConfig.showGrid); ui->checkBox_ToggleGrid->setChecked(porymapConfig.showGrid);
ui->checkBox_MirrorConnections->setChecked(porymapConfig.mirrorConnectingMaps);
mapSortOrder = porymapConfig.mapSortOrder; mapSortOrder = porymapConfig.mapSortOrder;
this->editor->collisionOpacity = static_cast<qreal>(porymapConfig.collisionOpacity) / 100; this->editor->collisionOpacity = static_cast<qreal>(porymapConfig.collisionOpacity) / 100;
@ -2807,6 +2808,11 @@ void MainWindow::on_checkBox_ToggleBorder_stateChanged(int selected)
editor->toggleBorderVisibility(selected != 0); editor->toggleBorderVisibility(selected != 0);
} }
void MainWindow::on_checkBox_MirrorConnections_stateChanged(int selected)
{
porymapConfig.mirrorConnectingMaps = (selected == Qt::Checked);
}
void MainWindow::on_actionTileset_Editor_triggered() void MainWindow::on_actionTileset_Editor_triggered()
{ {
if (!this->tilesetEditor) { if (!this->tilesetEditor) {