diff --git a/include/core/maplayout.h b/include/core/maplayout.h index fb4c0118..c6231fee 100644 --- a/include/core/maplayout.h +++ b/include/core/maplayout.h @@ -25,6 +25,7 @@ public: bool loaded = false; + bool hasUnsavedDataChanges = false; QString id; QString name; diff --git a/include/mainwindow.h b/include/mainwindow.h index 64d5e38f..69e56b3c 100644 --- a/include/mainwindow.h +++ b/include/mainwindow.h @@ -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(); diff --git a/src/core/maplayout.cpp b/src/core/maplayout.cpp index 79e3b832..4fae085c 100644 --- a/src/core/maplayout.cpp +++ b/src/core/maplayout.cpp @@ -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(); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 57daee1d..c2e9881a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -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(); } }