Skip to content

Commit

Permalink
add extension filter
Browse files Browse the repository at this point in the history
  • Loading branch information
kk-mats committed Jun 8, 2019
1 parent 070ae36 commit a21d699
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions gui/tools/invoke_ccfindersw_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,5 @@ invoker_t invoke_ccfindersw_dialog::create_invoker() const noexcept
{
return ccfindersw_invoker();
}

}
1 change: 1 addition & 0 deletions gui/tools/invoke_ccvolti_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ invoke_ccvolti_dialog::invoke_ccvolti_dialog(const QString &target, QWidget *par
: invoke_dialog(target, parent)
{
this->setWindowTitle(tr("CCVolti"));
this->set_filter("CCVolti(*.csv)");
this->begin_setup_parameters_layout();
this->end_setup_parameters_layout();
}
Expand Down
7 changes: 6 additions & 1 deletion gui/tools/invoke_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void invoke_dialog::get_target_path() noexcept

void invoke_dialog::get_output_filename() noexcept
{
if(const auto path=QFileDialog::getSaveFileName(this, tr("Save code clone detection result")); !path.isEmpty())
if(const auto path=QFileDialog::getSaveFileName(this, tr("Save code clone detection result"), QString(), this->filter_); !path.isEmpty())
{
this->output_path_edit_->setText(path);
}
Expand All @@ -108,6 +108,11 @@ void invoke_dialog::dispatch_invoker() noexcept
emit invoker_dispatched(this->create_invoker());
}

void invoke_dialog::set_filter(const QString &filter) noexcept
{
this->filter_=filter;
}

void invoke_dialog::end_setup_parameters_layout() noexcept
{
this->layout_->addLayout(this->parameters_layout_);
Expand Down
5 changes: 4 additions & 1 deletion gui/tools/invoke_dialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ private slots:
QLineEdit *output_path_edit_=new QLineEdit(this);
key_arg_box *language_;

virtual void begin_setup_parameters_layout() noexcept=0;
void set_filter(const QString &filter) noexcept;

virtual void begin_setup_parameters_layout() noexcept=0;
void end_setup_parameters_layout() noexcept;

private:
Expand All @@ -88,6 +89,8 @@ private slots:
QDialogButtonBox *button_box_=new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, Qt::Horizontal);

QGridLayout *directory_layout_=new QGridLayout;

QString filter_;
};

}
Expand Down

0 comments on commit a21d699

Please sign in to comment.