From 1b919459b5214642129fa642f48e858548771d3e Mon Sep 17 00:00:00 2001 From: tarapn79 Date: Tue, 26 Sep 2023 15:16:14 +0200 Subject: [PATCH] added setOptions to SearchDialog --- .../gui/include/gui/searchbar/searchoptions_dialog.h | 1 + plugins/gui/src/searchbar/searchbar.cpp | 1 + plugins/gui/src/searchbar/searchoptions_dialog.cpp | 12 ++++++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/gui/include/gui/searchbar/searchoptions_dialog.h b/plugins/gui/include/gui/searchbar/searchoptions_dialog.h index fbc868eada0..c12ba34396c 100644 --- a/plugins/gui/include/gui/searchbar/searchoptions_dialog.h +++ b/plugins/gui/include/gui/searchbar/searchoptions_dialog.h @@ -49,6 +49,7 @@ namespace hal SearchOptionsDialog(QWidget *parent = nullptr); void emitOptions(); SearchOptions* getOptions() const; + void setOptions(SearchOptions* opts, bool incSearch, int minIncSearch) const; QString getText() const; int getMinIncSearchValue(); bool getIncrementalSearch(); diff --git a/plugins/gui/src/searchbar/searchbar.cpp b/plugins/gui/src/searchbar/searchbar.cpp index bcbd5e28d6f..f01b0077c5b 100644 --- a/plugins/gui/src/searchbar/searchbar.cpp +++ b/plugins/gui/src/searchbar/searchbar.cpp @@ -275,6 +275,7 @@ namespace hal //TODO discuss if previous options should be passed back to the dialog to build dialog from them. // otherwise the use has to enter the same options again SearchOptionsDialog sd; + sd.setOptions(mCurrentOptions, mIncrementalSearch, mMinCharsToStartIncSearch); if (sd.exec() == QDialog::Accepted) { mCurrentOptions = sd.getOptions(); diff --git a/plugins/gui/src/searchbar/searchoptions_dialog.cpp b/plugins/gui/src/searchbar/searchoptions_dialog.cpp index 68b300b9c8e..a4990914add 100644 --- a/plugins/gui/src/searchbar/searchoptions_dialog.cpp +++ b/plugins/gui/src/searchbar/searchoptions_dialog.cpp @@ -54,8 +54,6 @@ namespace hal } - - void SearchOptionsDialog::emitStartSearch() { qInfo() << "emitStartSearch from searchOptionsDialog"; @@ -80,6 +78,16 @@ namespace hal return retval; } + void SearchOptionsDialog::setOptions(SearchOptions* opts, bool incSearch, int minIncSearch) const + { + mExactMatchBox->setChecked(opts->isMExactMatch()); + mCaseSensitiveBox->setChecked(opts->isMCaseSensitive()); + mRegExBox->setChecked(opts->isMRegularExpression()); + mIncrementalSearchBox->setChecked(incSearch); + + mSpinBox->setValue(minIncSearch); + } + QString SearchOptionsDialog::getText() const { return mSearchText;