diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index aed9d5d..3401bff 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -35,7 +35,7 @@ MainWindow::~MainWindow() void MainWindow::open_project() noexcept { - if(auto filepath=QFileDialog::getOpenFileName(this, tr("Open Project"), "", tr("Asterism Project (*.jcln)")); !filepath.isEmpty()) + if(auto filepath=to_canonical_file_path(QFileDialog::getOpenFileName(this, tr("Open Project"), "", tr("Asterism Project (*.jcln)"))); !filepath.isEmpty()) { if(auto results=clone_io::read_jcln(filepath); results) { @@ -58,6 +58,14 @@ void MainWindow::open_file() noexcept } } +void MainWindow::save_project() noexcept +{ + if(const auto filepath=QFileDialog::getSaveFileName(this, tr("Save Project"), "", tr("Asterism Project(*.jcln)")); !filepath.isEmpty()) + { + clone_io::write_jcln(filepath, this->results_); + } +} + void MainWindow::fuse_results() noexcept { if(const auto filepath=QFileDialog::getSaveFileName(this, tr("Export Fusion Result"), "", tr(".csv")); !filepath.isEmpty()) @@ -159,6 +167,11 @@ void MainWindow::create_actions() noexcept this->open_file_act_->setStatusTip(tr("Open file")); connect(this->open_file_act_, &QAction::triggered, this, &MainWindow::open_file); + this->save_project_act_=new QAction(tr("&Save"), this); + this->save_project_act_->setShortcut(QKeySequence::Save); + this->save_project_act_->setStatusTip(tr("Save project")); + connect(this->save_project_act_, &QAction::triggered, this, &MainWindow::save_project); + //this->fuse_results_act_=new QAction(tr("&Fuse Results"), this); //connect(this->fuse_results_act_, &QAction::triggered, this, &MainWindow::fuse_results); @@ -205,6 +218,7 @@ void MainWindow::create_menus() noexcept this->file_menu_->addAction(this->open_project_act_); this->file_menu_->addAction(this->open_file_act_); this->file_menu_->addSeparator(); + this->file_menu_->addAction(this->save_project_act_); this->export_menu_=this->file_menu_->addMenu(tr("Export")); //this->export_menu_->addAction(this->fuse_results_act_); this->export_menu_->addAction(this->export_current_scatter_plot_act_); diff --git a/gui/mainwindow.hpp b/gui/mainwindow.hpp index e82f302..e24b3a0 100644 --- a/gui/mainwindow.hpp +++ b/gui/mainwindow.hpp @@ -32,6 +32,7 @@ class MainWindow private slots: void open_project() noexcept; void open_file() noexcept; + void save_project() noexcept; void fuse_results() noexcept; void export_current_scatter_plot() noexcept; @@ -63,6 +64,7 @@ private slots: QMenu *file_menu_; QAction *open_project_act_; QAction *open_file_act_; + QAction *save_project_act_; // File.Export QMenu *export_menu_;