mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-24 10:33:15 +08:00
imporve layout
This commit is contained in:
parent
fcc41efee7
commit
a67b0fe5e2
@ -213,11 +213,8 @@ 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">
|
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="0,0,0,0">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
@ -204,11 +204,18 @@
|
|||||||
</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,10 +326,8 @@ 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)
|
||||||
@ -343,7 +341,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||||||
select_mode = false;
|
select_mode = false;
|
||||||
refresh_status();
|
refresh_status();
|
||||||
}
|
}
|
||||||
if (searchEnabled) setSearchState(false);
|
if (ui->search_input->hasFocus()) ui->search_input->clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
// refresh
|
// refresh
|
||||||
@ -1316,31 +1314,6 @@ 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