From 629bd9dbd099af60812e80f851afb7902fc28c37 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Wed, 26 Jul 2017 21:46:51 +0200 Subject: Change GuiForm::add_file must_exists argument to flags FILE_OPEN/FILE_SAVE --- src/gui_qt.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/gui_qt.cc') diff --git a/src/gui_qt.cc b/src/gui_qt.cc index ec67527..3e7c696 100644 --- a/src/gui_qt.cc +++ b/src/gui_qt.cc @@ -857,10 +857,10 @@ public: void add_file(std::string const& id, std::string const& label, std::string const& value, std::string const& description, - bool must_exist, + uint8_t flags, std::vector const& filter) override { values_.emplace_back(new FileValue(id, label, description, value, - must_exist, filter)); + flags, filter)); } std::string get_string(std::string const& id) const override { @@ -965,15 +965,15 @@ protected: struct FileValue : public Value { std::string value_; - bool must_exist_; + uint8_t flags_; std::vector filter_; FileValue(std::string const& id, std::string const& label, std::string const& description, std::string const& value, - bool must_exist, std::vector const& filter) + uint8_t flags, std::vector const& filter) : Value(FILE, id, label, description), value_(value), - must_exist_(must_exist), filter_(filter) { + flags_(flags), filter_(filter) { } }; @@ -1112,7 +1112,7 @@ protected: } filter.append(')'); } - if (value->must_exist_) { + if (!(value->flags_ & FILE_SAVE)) { auto file = QFileDialog::getOpenFileName( dialog_, QString::fromStdString(value->label_), value->edit_->text(), filter); @@ -1590,6 +1590,10 @@ GuiForm* GuiForm::create(std::string const& title, return new QtGuiForm(title, text); } +// static +uint8_t const GuiForm::FILE_OPEN = 0; +uint8_t const GuiForm::FILE_SAVE = 1; + // static GuiFormApply* GuiFormApply::create(std::string const& title, std::string const& text, -- cgit v1.2.3-70-g09d2