diff --git a/forms/mainwindow.ui b/forms/mainwindow.ui index 01566116..86f50047 100644 --- a/forms/mainwindow.ui +++ b/forms/mainwindow.ui @@ -2906,6 +2906,7 @@ + @@ -3278,6 +3279,11 @@ New Layout... + + + Duplicate Current Map/Layout... + + diff --git a/include/mainwindow.h b/include/mainwindow.h index 862ea387..64d5e38f 100644 --- a/include/mainwindow.h +++ b/include/mainwindow.h @@ -361,6 +361,7 @@ private: NewLayoutDialog* createNewLayoutDialog(const Layout *layoutToCopy = nullptr); void openNewLayoutDialog(); void openDuplicateLayoutDialog(const QString &layoutId); + void openDuplicateMapOrLayoutDialog(); void openNewMapGroupDialog(); void openNewLocationDialog(); void openSubWindow(QWidget * window); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index fbe50e75..483004f8 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -297,6 +297,7 @@ void MainWindow::initExtraSignals() { connect(ui->action_NewMap, &QAction::triggered, this, &MainWindow::openNewMapDialog); connect(ui->action_NewLayout, &QAction::triggered, this, &MainWindow::openNewLayoutDialog); + connect(ui->actionDuplicate_Current_Map_Layout, &QAction::triggered, this, &MainWindow::openDuplicateMapOrLayoutDialog); } void MainWindow::on_actionCheck_for_Updates_triggered() { @@ -1412,6 +1413,14 @@ void MainWindow::openDuplicateLayoutDialog(const QString &layoutId) { } } +void MainWindow::openDuplicateMapOrLayoutDialog() { + if (this->editor->map) { + openDuplicateMapDialog(this->editor->map->name()); + } else if (this->editor->layout) { + openDuplicateLayoutDialog(this->editor->layout->id); + } +} + void MainWindow::on_actionNew_Tileset_triggered() { auto dialog = new NewTilesetDialog(editor->project, this); connect(dialog, &NewTilesetDialog::applied, [this](Tileset *tileset) {