1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-23 21:14:33 +00:00

Show input box to filter torrent list only when the list is shown

It's misleading to show the filter on every tab when it works only
for the torrent list.
This commit is contained in:
Gabriele 2014-10-19 15:58:00 +02:00
parent d02984cbed
commit 1a63f6af1b
2 changed files with 14 additions and 8 deletions

View File

@ -181,6 +181,14 @@ MainWindow::MainWindow(QWidget *parent, const QStringList& torrentCmdLine) : QMa
hSplitter->setChildrenCollapsible(false);
hSplitter->setContentsMargins(0, 4, 0, 0);
// Name filter
search_filter = new LineEdit();
searchFilterAct = toolBar->insertWidget(actionLock_qBittorrent, search_filter);
search_filter->setFixedWidth(200);
QWidget *spacer = new QWidget(this);
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
toolBar->insertWidget(searchFilterAct, spacer);
// Transfer List tab
transferList = new TransferListWidget(hSplitter, this, QBtSession::instance());
properties = new PropertiesWidget(hSplitter, this, transferList);
@ -193,15 +201,9 @@ MainWindow::MainWindow(QWidget *parent, const QStringList& torrentCmdLine) : QMa
vSplitter->setCollapsible(1, false);
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)));
QAction *searchFilterAct = toolBar->insertWidget(actionLock_qBittorrent, search_filter);
search_filter->setFixedWidth(200);
QWidget *spacer = new QWidget(this);
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
toolBar->insertWidget(searchFilterAct, spacer);
vboxLayout->addWidget(tabs);
prioSeparator = toolBar->insertSeparator(actionDecreasePriority);
@ -495,8 +497,11 @@ void MainWindow::tab_changed(int new_tab) {
if (tabs->currentWidget() == vSplitter) {
qDebug("Changed tab to transfer list, refreshing the list");
properties->loadDynamicData();
searchFilterAct->setVisible(true);
return;
}
else
searchFilterAct->setVisible(false);
if (tabs->currentWidget() == searchEngine) {
qDebug("Changed tab to search engine, giving focus to search input");
searchEngine->giveFocusToSearchInput();

View File

@ -184,6 +184,7 @@ private:
bool force_exit;
bool ui_locked;
LineEdit *search_filter;
QAction *searchFilterAct;
// Keyboard shortcuts
QShortcut *switchSearchShortcut;
QShortcut *switchSearchShortcut2;