Fix changing tilesets not marking layouts as unsaved

This commit is contained in:
GriffinR 2025-03-02 19:23:19 -05:00
parent 87193158ae
commit 7cfd9fa0f8
4 changed files with 15 additions and 4 deletions

View File

@ -25,6 +25,7 @@ public:
bool loaded = false;
bool hasUnsavedDataChanges = false;
QString id;
QString name;

View File

@ -200,6 +200,7 @@ private slots:
void applyUserShortcuts();
void markMapEdited();
void markSpecificMapEdited(Map*);
void markLayoutEdited();
void on_actionNew_Tileset_triggered();
void on_action_Save_triggered();

View File

@ -438,5 +438,5 @@ QPixmap Layout::getLayoutItemPixmap() {
}
bool Layout::hasUnsavedChanges() const {
return !this->editHistory.isClean() || !this->newFolderPath.isEmpty();
return !this->editHistory.isClean() || this->hasUnsavedDataChanges || !this->newFolderPath.isEmpty();
}

View File

@ -339,7 +339,7 @@ void MainWindow::initEditor() {
connect(this->editor, &Editor::openConnectedMap, this, &MainWindow::onOpenConnectedMap);
connect(this->editor, &Editor::warpEventDoubleClicked, this, &MainWindow::openWarpMap);
connect(this->editor, &Editor::currentMetatilesSelectionChanged, this, &MainWindow::currentMetatilesSelectionChanged);
connect(this->editor, &Editor::wildMonTableEdited, [this] { this->markMapEdited(); });
connect(this->editor, &Editor::wildMonTableEdited, this, &MainWindow::markMapEdited);
connect(this->editor, &Editor::mapRulerStatusChanged, this, &MainWindow::onMapRulerStatusChanged);
connect(this->editor, &Editor::tilesetUpdated, this, &Scripting::cb_TilesetUpdated);
connect(ui->newEventToolButton, &NewEventToolButton::newEventAdded, this->editor, &Editor::addNewEvent);
@ -512,6 +512,15 @@ void MainWindow::markSpecificMapEdited(Map* map) {
updateMapList();
}
void MainWindow::markLayoutEdited() {
if (!this->editor->layout)
return;
this->editor->layout->hasUnsavedDataChanges = true;
updateWindowTitle();
updateMapList();
}
void MainWindow::loadUserSettings() {
// Better Cursors
ui->actionBetter_Cursors->setChecked(porymapConfig.prettyCursors);
@ -2585,7 +2594,7 @@ void MainWindow::on_comboBox_PrimaryTileset_currentTextChanged(const QString &ti
redrawMapScene();
updateTilesetEditor();
prefab.updatePrefabUi(editor->layout);
markMapEdited();
markLayoutEdited();
}
}
@ -2596,7 +2605,7 @@ void MainWindow::on_comboBox_SecondaryTileset_currentTextChanged(const QString &
redrawMapScene();
updateTilesetEditor();
prefab.updatePrefabUi(editor->layout);
markMapEdited();
markLayoutEdited();
}
}