diff --git a/include/ui/mainwindow.h b/include/ui/mainwindow.h index 9e6b281..a180043 100644 --- a/include/ui/mainwindow.h +++ b/include/ui/mainwindow.h @@ -213,11 +213,8 @@ private: QMutex mu_remoteRouteProfiles; // search - bool searchEnabled = false; QString searchString; - void setSearchState(bool enable); - QList> filterProfilesList(const QList& profiles); QList> get_now_selected_list(); diff --git a/include/ui/mainwindow.ui b/include/ui/mainwindow.ui index b64930a..d08b87f 100644 --- a/include/ui/mainwindow.ui +++ b/include/ui/mainwindow.ui @@ -20,7 +20,7 @@ nya - + @@ -204,11 +204,18 @@ - - - + + + + Search Filter... + + + true + + + diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 69574e2..7633cb0 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -326,10 +326,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi ui->proxyListTable->setTabKeyNavigation(false); // search box - setSearchState(false); connect(shortcut_ctrl_f, &QShortcut::activated, this, [=, this] { - setSearchState(true); ui->search_input->setFocus(); }); connect(ui->search_input, &QLineEdit::textChanged, this, [=,this](const QString& currentText) @@ -343,7 +341,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi select_mode = false; refresh_status(); } - if (searchEnabled) setSearchState(false); + if (ui->search_input->hasFocus()) ui->search_input->clear(); }); // refresh @@ -1316,31 +1314,6 @@ void MainWindow::UpdateConnectionListWithRecreate(const QListconnections->setUpdatesEnabled(true); } -void MainWindow::setSearchState(bool enable) -{ - searchEnabled = enable; - if (enable) - { - ui->data_view->hide(); - ui->search_input->show(); - adjustSize(); - } else - { - ui->search_input->blockSignals(true); - ui->search_input->clear(); - ui->search_input->blockSignals(false); - - ui->search_input->hide(); - ui->data_view->show(); - adjustSize(); - if (!searchString.isEmpty()) - { - searchString.clear(); - refresh_proxy_list(-1); - } - } -} - QList> MainWindow::filterProfilesList(const QList& profiles) { QList> res;