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