mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-19 05:30:06 +08:00
parent
0513a570b0
commit
83fde955a4
@ -213,8 +213,11 @@ private:
|
||||
QMutex mu_remoteRouteProfiles;
|
||||
|
||||
// search
|
||||
bool searchEnabled = false;
|
||||
QString searchString;
|
||||
|
||||
void setSearchState(bool enable);
|
||||
|
||||
QList<std::shared_ptr<Configs::ProxyEntity>> filterProfilesList(const QList<int>& profiles);
|
||||
|
||||
QList<std::shared_ptr<Configs::ProxyEntity>> get_now_selected_list();
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<string notr="true">nya</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="0,0,0,0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="0,0,0">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
@ -204,18 +204,11 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="search_input"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="search_input">
|
||||
<property name="placeholderText">
|
||||
<string>Search Filter...</string>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
|
||||
@ -326,8 +326,10 @@ 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)
|
||||
@ -341,7 +343,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
||||
select_mode = false;
|
||||
refresh_status();
|
||||
}
|
||||
if (ui->search_input->hasFocus()) ui->search_input->clear();
|
||||
if (searchEnabled) setSearchState(false);
|
||||
});
|
||||
|
||||
// refresh
|
||||
@ -1314,6 +1316,31 @@ void MainWindow::UpdateConnectionListWithRecreate(const QList<Stats::ConnectionM
|
||||
ui->connections->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<std::shared_ptr<Configs::ProxyEntity>> MainWindow::filterProfilesList(const QList<int>& profiles)
|
||||
{
|
||||
QList<std::shared_ptr<Configs::ProxyEntity>> res;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user