From 4b79ae6f49778bcc88ad95efd407be950d08deac Mon Sep 17 00:00:00 2001 From: maelstrom Date: Mon, 31 Mar 2025 21:50:46 +0200 Subject: [PATCH] feat(editor): save as --- editor/mainwindow.cpp | 7 +++++++ editor/mainwindow.ui | 15 +++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/editor/mainwindow.cpp b/editor/mainwindow.cpp index dcfa2b8..83c38bd 100644 --- a/editor/mainwindow.cpp +++ b/editor/mainwindow.cpp @@ -123,6 +123,13 @@ MainWindow::MainWindow(QWidget *parent) dataModel->SaveToFile(path); }); + connect(ui->actionSaveAs, &QAction::triggered, this, [&]() { + std::optional path = openFileDialog("Openblocks Level (*.obl)", ".obl", QFileDialog::AcceptSave, QString::fromStdString("Save as " + dataModel->name)); + if (path == "") return; + + dataModel->SaveToFile(path); + }); + connect(ui->actionOpen, &QAction::triggered, this, [&]() { std::optional path = openFileDialog("Openblocks Level (*.obl)", ".obl", QFileDialog::AcceptOpen); if (!path) return; diff --git a/editor/mainwindow.ui b/editor/mainwindow.ui index a12e229..5c4d6de 100644 --- a/editor/mainwindow.ui +++ b/editor/mainwindow.ui @@ -51,6 +51,7 @@ + @@ -480,6 +481,20 @@ QAction::MenuRole::NoRole + + + + + + Save As... + + + Ctrl+Shift+S + + + QAction::MenuRole::NoRole + +