mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-29 05:48:47 +03:00
Merge pull request #2051 from pmzqla/filter-input
Improve input box to filter torrent list
This commit is contained in:
commit
46f3009e4b
2 changed files with 16 additions and 8 deletions
|
@ -181,6 +181,15 @@ MainWindow::MainWindow(QWidget *parent, const QStringList& torrentCmdLine) : QMa
|
||||||
hSplitter->setChildrenCollapsible(false);
|
hSplitter->setChildrenCollapsible(false);
|
||||||
hSplitter->setContentsMargins(0, 4, 0, 0);
|
hSplitter->setContentsMargins(0, 4, 0, 0);
|
||||||
|
|
||||||
|
// Name filter
|
||||||
|
search_filter = new LineEdit();
|
||||||
|
searchFilterAct = toolBar->insertWidget(actionLock_qBittorrent, search_filter);
|
||||||
|
search_filter->setPlaceholderText(tr("Filter torrent list..."));
|
||||||
|
search_filter->setFixedWidth(200);
|
||||||
|
QWidget *spacer = new QWidget(this);
|
||||||
|
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
|
toolBar->insertWidget(searchFilterAct, spacer);
|
||||||
|
|
||||||
// Transfer List tab
|
// Transfer List tab
|
||||||
transferList = new TransferListWidget(hSplitter, this, QBtSession::instance());
|
transferList = new TransferListWidget(hSplitter, this, QBtSession::instance());
|
||||||
properties = new PropertiesWidget(hSplitter, this, transferList);
|
properties = new PropertiesWidget(hSplitter, this, transferList);
|
||||||
|
@ -193,15 +202,9 @@ MainWindow::MainWindow(QWidget *parent, const QStringList& torrentCmdLine) : QMa
|
||||||
vSplitter->setCollapsible(1, false);
|
vSplitter->setCollapsible(1, false);
|
||||||
tabs->addTab(vSplitter, IconProvider::instance()->getIcon("folder-remote"), tr("Transfers"));
|
tabs->addTab(vSplitter, IconProvider::instance()->getIcon("folder-remote"), tr("Transfers"));
|
||||||
|
|
||||||
vboxLayout->addWidget(tabs);
|
|
||||||
// Name filter
|
|
||||||
search_filter = new LineEdit();
|
|
||||||
connect(search_filter, SIGNAL(textChanged(QString)), transferList, SLOT(applyNameFilter(QString)));
|
connect(search_filter, SIGNAL(textChanged(QString)), transferList, SLOT(applyNameFilter(QString)));
|
||||||
QAction *searchFilterAct = toolBar->insertWidget(actionLock_qBittorrent, search_filter);
|
|
||||||
search_filter->setFixedWidth(200);
|
vboxLayout->addWidget(tabs);
|
||||||
QWidget *spacer = new QWidget(this);
|
|
||||||
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
|
||||||
toolBar->insertWidget(searchFilterAct, spacer);
|
|
||||||
|
|
||||||
|
|
||||||
prioSeparator = toolBar->insertSeparator(actionDecreasePriority);
|
prioSeparator = toolBar->insertSeparator(actionDecreasePriority);
|
||||||
|
@ -308,6 +311,7 @@ MainWindow::MainWindow(QWidget *parent, const QStringList& torrentCmdLine) : QMa
|
||||||
|
|
||||||
// Populate the transfer list
|
// Populate the transfer list
|
||||||
transferList->getSourceModel()->populate();
|
transferList->getSourceModel()->populate();
|
||||||
|
transferList->setFocus();
|
||||||
|
|
||||||
// Update the number of torrents (tab)
|
// Update the number of torrents (tab)
|
||||||
updateNbTorrents();
|
updateNbTorrents();
|
||||||
|
@ -495,8 +499,11 @@ void MainWindow::tab_changed(int new_tab) {
|
||||||
if (tabs->currentWidget() == vSplitter) {
|
if (tabs->currentWidget() == vSplitter) {
|
||||||
qDebug("Changed tab to transfer list, refreshing the list");
|
qDebug("Changed tab to transfer list, refreshing the list");
|
||||||
properties->loadDynamicData();
|
properties->loadDynamicData();
|
||||||
|
searchFilterAct->setVisible(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
searchFilterAct->setVisible(false);
|
||||||
if (tabs->currentWidget() == searchEngine) {
|
if (tabs->currentWidget() == searchEngine) {
|
||||||
qDebug("Changed tab to search engine, giving focus to search input");
|
qDebug("Changed tab to search engine, giving focus to search input");
|
||||||
searchEngine->giveFocusToSearchInput();
|
searchEngine->giveFocusToSearchInput();
|
||||||
|
|
|
@ -185,6 +185,7 @@ private:
|
||||||
bool ui_locked;
|
bool ui_locked;
|
||||||
bool unlockDlgShowing;
|
bool unlockDlgShowing;
|
||||||
LineEdit *search_filter;
|
LineEdit *search_filter;
|
||||||
|
QAction *searchFilterAct;
|
||||||
// Keyboard shortcuts
|
// Keyboard shortcuts
|
||||||
QShortcut *switchSearchShortcut;
|
QShortcut *switchSearchShortcut;
|
||||||
QShortcut *switchSearchShortcut2;
|
QShortcut *switchSearchShortcut2;
|
||||||
|
|
Loading…
Reference in a new issue