Clarify save prompt when closing tileset editor

This commit is contained in:
Marcus Huderle 2018-10-10 18:07:55 -05:00
parent e8d33c04db
commit 62c1ed2dc7

View file

@ -382,20 +382,27 @@ void TilesetEditor::importTilesetTiles(Tileset *tileset, bool primary) {
void TilesetEditor::closeEvent(QCloseEvent *event)
{
bool close = true;
if (this->hasUnsavedChanges) {
QMessageBox::StandardButton result = QMessageBox::question(this, "porymap",
"Discard unsaved Tileset changes?",
QMessageBox::No | QMessageBox::Yes,
QMessageBox::Yes);
close = result == QMessageBox::Yes;
}
QMessageBox::StandardButton result = QMessageBox::question(
this,
"porymap",
"Tileset has been modified, save changes?",
QMessageBox::No | QMessageBox::Yes | QMessageBox::Cancel,
QMessageBox::Yes);
if (close) {
if (result == QMessageBox::Yes) {
this->on_actionSave_Tileset_triggered();
event->accept();
emit closed();
} else if (result == QMessageBox::No) {
event->accept();
emit closed();
} else if (result == QMessageBox::Cancel) {
event->ignore();
}
} else {
event->accept();
emit closed();
} else {
event->ignore();
}
}