diff --git a/CHANGELOG.md b/CHANGELOG.md index 67e9a0b3..51520783 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ The **"Breaking Changes"** listed below are changes that have been made in the d - Fix config files being written before the project is opened successfully. - Fix the map and other project info still displaying if a new project fails to open. - Fix unsaved changes being ignored when quitting (such as with Cmd+Q on macOS). +- Fix `About porymap` opening a new window each time it's activated. +- Fix the `Edit History` window not raising to the front when reactivated. ## [5.4.1] - 2024-03-21 ### Fixed diff --git a/include/mainwindow.h b/include/mainwindow.h index 41bf8a1e..93f0d265 100644 --- a/include/mainwindow.h +++ b/include/mainwindow.h @@ -28,6 +28,7 @@ #include "projectsettingseditor.h" #include "customscriptseditor.h" #include "updatepromoter.h" +#include "aboutporymap.h" @@ -312,6 +313,7 @@ private: QPointer customScriptsEditor = nullptr; QPointer updatePromoter = nullptr; QPointer networkAccessManager = nullptr; + QPointer aboutWindow = nullptr; FilterChildrenProxyModel *mapListProxyModel; QStandardItemModel *mapListModel; QList *mapGroupItemsList; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 721a3fa3..37f45f20 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1,6 +1,5 @@ #include "mainwindow.h" #include "ui_mainwindow.h" -#include "aboutporymap.h" #include "project.h" #include "log.h" #include "editor.h" @@ -330,7 +329,7 @@ void MainWindow::initEditor() { QAction *showHistory = new QAction("Show Edit History...", this); showHistory->setObjectName("action_ShowEditHistory"); showHistory->setShortcut(QKeySequence("Ctrl+E")); - connect(showHistory, &QAction::triggered, [undoView](){ undoView->show(); }); + connect(showHistory, &QAction::triggered, [this, undoView](){ openSubWindow(undoView); }); ui->menuEdit->addAction(showHistory); @@ -2774,9 +2773,9 @@ void MainWindow::on_toolButton_CollapseAll_clicked() void MainWindow::on_actionAbout_Porymap_triggered() { - AboutPorymap *window = new AboutPorymap(this); - window->setAttribute(Qt::WA_DeleteOnClose); - window->show(); + if (!this->aboutWindow) + this->aboutWindow = new AboutPorymap(this); + openSubWindow(this->aboutWindow); } void MainWindow::on_actionOpen_Log_File_triggered() { diff --git a/src/ui/aboutporymap.cpp b/src/ui/aboutporymap.cpp index 38c28144..22c5fabc 100644 --- a/src/ui/aboutporymap.cpp +++ b/src/ui/aboutporymap.cpp @@ -7,6 +7,7 @@ AboutPorymap::AboutPorymap(QWidget *parent) : ui(new Ui::AboutPorymap) { ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); this->ui->label_Version->setText(QString("Version %1 - %2").arg(QCoreApplication::applicationVersion()).arg(QStringLiteral(__DATE__))); this->ui->textBrowser->setSource(QUrl("qrc:/CHANGELOG.md"));