Skip to content

Commit

Permalink
Added getter for the searchString from searchoptions_dialog.h
Browse files Browse the repository at this point in the history
Removed Proxy member from searchoptions_dialog
Cleanup
  • Loading branch information
HerrKermet committed Sep 25, 2023
1 parent db3f974 commit 631920e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions plugins/gui/include/gui/searchbar/searchoptions_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace hal
SearchOptionsDialog(QWidget *parent = nullptr);
void emitOptions();
SearchOptions getOptions() const;
QString getText() const;

Q_SIGNALS:
void emitOptions(QString text, int options);
Expand All @@ -57,8 +58,7 @@ namespace hal
void emitStartSearch();

private:
SearchProxyModel* searchProxy;
QString searchText;
QString mSearchText;

QGridLayout* mLayout;
QComboBox* mInputBox;
Expand Down
2 changes: 1 addition & 1 deletion plugins/gui/src/searchbar/searchbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ namespace hal
{
mCurrentOptions = sd.getOptions();

QString txt ; // TODO : get modified text from sd
QString txt = sd.getText(); // TODO : get modified text from sd
Q_EMIT triggerNewSearch(txt,mCurrentOptions.toInt());
}
}
Expand Down
16 changes: 10 additions & 6 deletions plugins/gui/src/searchbar/searchoptions_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace hal
SearchOptionsDialog::SearchOptionsDialog(QWidget* parent): QDialog(parent)
{
setWindowTitle("Search");
searchProxy = new SearchProxyModel();
//TODO fix layout size to prevent overlapping
mLayout = new QGridLayout(this);
mLayout->setRowMinimumHeight(0,35);
Expand Down Expand Up @@ -41,10 +40,10 @@ namespace hal

connect(mCloseBtn, &QPushButton::clicked, this, &SearchOptionsDialog::close);

//TODO get corresponding proxy
//TODO add signal logic from searchbutton / enter pressed within mInputBox
connect(mInputBox, &QComboBox::currentTextChanged, this, &SearchOptionsDialog::textEdited);
connect(mSearchBtn, &QPushButton::clicked, this, &SearchOptionsDialog::emitStartSearch);
connect(this, SIGNAL(emitOptions(QString, int)), searchProxy, SLOT(startSearch(QString, int)));
//connect(this, SIGNAL(emitOptions(QString, int)), searchProxy, SLOT(startSearch(QString, int)));

connect(mIncrementalSearchBox, &QCheckBox::stateChanged, this, &SearchOptionsDialog::optionsChanged);
connect(mExactMatchBox, &QCheckBox::stateChanged, this, &SearchOptionsDialog::optionsChanged);
Expand Down Expand Up @@ -73,11 +72,11 @@ namespace hal
}

void SearchOptionsDialog::emitOptions(){
searchText = mInputBox->currentText();
mSearchText = mInputBox->currentText();
int options = SearchOptions::toInt(mExactMatchBox->isChecked(), mCaseSensitiveBox->isChecked(), mRegExBox->isChecked(), {});
qInfo() << "Emit search with string: " << searchText << " and options: " << options;
qInfo() << "Emit search with string: " << mSearchText << " and options: " << options;

Q_EMIT emitOptions(searchText, options);
Q_EMIT emitOptions(mSearchText, options);
}

SearchOptions SearchOptionsDialog::getOptions() const
Expand All @@ -87,4 +86,9 @@ namespace hal
return retval;
}

QString SearchOptionsDialog::getText() const
{
return mSearchText;
}

}

0 comments on commit 631920e

Please sign in to comment.