Skip to content

Commit

Permalink
use canonical path
Browse files Browse the repository at this point in the history
  • Loading branch information
kk-mats committed Jun 9, 2019
1 parent e2d4ad4 commit 0df44a3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 15 additions & 1 deletion gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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())
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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_);
Expand Down
2 changes: 2 additions & 0 deletions gui/mainwindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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_;
Expand Down

0 comments on commit 0df44a3

Please sign in to comment.