|
|
|
@ -35,11 +35,13 @@
@@ -35,11 +35,13 @@
|
|
|
|
|
#include <QActionGroup> |
|
|
|
|
#include <QClipboard> |
|
|
|
|
#include <QCloseEvent> |
|
|
|
|
#include <QComboBox> |
|
|
|
|
#include <QDebug> |
|
|
|
|
#include <QDesktopServices> |
|
|
|
|
#include <QFileDialog> |
|
|
|
|
#include <QFileSystemWatcher> |
|
|
|
|
#include <QKeyEvent> |
|
|
|
|
#include <QLabel> |
|
|
|
|
#include <QMessageBox> |
|
|
|
|
#include <QMetaObject> |
|
|
|
|
#include <QMimeData> |
|
|
|
@ -187,15 +189,23 @@ MainWindow::MainWindow(IGUIApplication *app, WindowState initialState)
@@ -187,15 +189,23 @@ MainWindow::MainWindow(IGUIApplication *app, WindowState initialState)
|
|
|
|
|
hSplitter->setChildrenCollapsible(false); |
|
|
|
|
hSplitter->setFrameShape(QFrame::NoFrame); |
|
|
|
|
|
|
|
|
|
// Name filter
|
|
|
|
|
// Torrent filter
|
|
|
|
|
m_searchFilter = new LineEdit(this); |
|
|
|
|
m_searchFilter->setPlaceholderText(tr("Filter torrent names...")); |
|
|
|
|
m_searchFilter->setPlaceholderText(tr("Filter torrents...")); |
|
|
|
|
m_searchFilter->setFixedWidth(200); |
|
|
|
|
m_searchFilter->setContextMenuPolicy(Qt::CustomContextMenu); |
|
|
|
|
connect(m_searchFilter, &QWidget::customContextMenuRequested, this, &MainWindow::showFilterContextMenu); |
|
|
|
|
m_searchFilterAction = m_ui->toolBar->insertWidget(m_ui->actionLock, m_searchFilter); |
|
|
|
|
|
|
|
|
|
QWidget *spacer = new QWidget(this); |
|
|
|
|
auto *filterColumnWidget = new QWidget(this); |
|
|
|
|
auto *filterLabel = new QLabel(tr("Filter by:")); |
|
|
|
|
filterLabel->setMargin(7); |
|
|
|
|
m_filterColumnComboBox = new QComboBox(this); |
|
|
|
|
QHBoxLayout *filterColumnLayout = new QHBoxLayout(this); |
|
|
|
|
filterColumnLayout->addWidget(filterLabel); |
|
|
|
|
filterColumnLayout->addWidget(m_filterColumnComboBox); |
|
|
|
|
filterColumnWidget->setLayout(filterColumnLayout); |
|
|
|
|
m_ui->toolBar->insertWidget(m_ui->actionLock, filterColumnWidget); |
|
|
|
|
auto *spacer = new QWidget(this); |
|
|
|
|
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
|
|
|
m_ui->toolBar->insertWidget(m_searchFilterAction, spacer); |
|
|
|
|
|
|
|
|
@ -213,8 +223,15 @@ MainWindow::MainWindow(IGUIApplication *app, WindowState initialState)
@@ -213,8 +223,15 @@ MainWindow::MainWindow(IGUIApplication *app, WindowState initialState)
|
|
|
|
|
UIThemeManager::instance()->getIcon(u"folder-remote"_qs), |
|
|
|
|
#endif |
|
|
|
|
tr("Transfers")); |
|
|
|
|
|
|
|
|
|
connect(m_searchFilter, &LineEdit::textChanged, m_transferListWidget, &TransferListWidget::applyNameFilter); |
|
|
|
|
// Filter types
|
|
|
|
|
const QVector<TransferListModel::Column> filterTypes = {TransferListModel::Column::TR_NAME, TransferListModel::Column::TR_SAVE_PATH}; |
|
|
|
|
for (const TransferListModel::Column type : filterTypes) |
|
|
|
|
{ |
|
|
|
|
const QString typeName = m_transferListWidget->getSourceModel()->headerData(type, Qt::Horizontal, Qt::DisplayRole).value<QString>(); |
|
|
|
|
m_filterColumnComboBox->addItem(typeName, type); |
|
|
|
|
} |
|
|
|
|
connect(m_filterColumnComboBox, &QComboBox::currentIndexChanged, this, &MainWindow::applyTransferListFilter); |
|
|
|
|
connect(m_searchFilter, &LineEdit::textChanged, this, &MainWindow::applyTransferListFilter); |
|
|
|
|
connect(hSplitter, &QSplitter::splitterMoved, this, &MainWindow::saveSettings); |
|
|
|
|
connect(m_splitter, &QSplitter::splitterMoved, this, &MainWindow::saveSplitterSettings); |
|
|
|
|
connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackersChanged, m_propertiesWidget, &PropertiesWidget::loadTrackers); |
|
|
|
@ -670,7 +687,7 @@ void MainWindow::showFilterContextMenu()
@@ -670,7 +687,7 @@ void MainWindow::showFilterContextMenu()
|
|
|
|
|
useRegexAct->setCheckable(true); |
|
|
|
|
useRegexAct->setChecked(pref->getRegexAsFilteringPatternForTransferList()); |
|
|
|
|
connect(useRegexAct, &QAction::toggled, pref, &Preferences::setRegexAsFilteringPatternForTransferList); |
|
|
|
|
connect(useRegexAct, &QAction::toggled, this, [this]() { m_transferListWidget->applyNameFilter(m_searchFilter->text()); }); |
|
|
|
|
connect(useRegexAct, &QAction::toggled, this, &MainWindow::applyTransferListFilter); |
|
|
|
|
|
|
|
|
|
menu->popup(QCursor::pos()); |
|
|
|
|
} |
|
|
|
@ -1917,6 +1934,11 @@ void MainWindow::updatePowerManagementState()
@@ -1917,6 +1934,11 @@ void MainWindow::updatePowerManagementState()
|
|
|
|
|
m_pwr->setActivityState(inhibitSuspend); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void MainWindow::applyTransferListFilter() |
|
|
|
|
{ |
|
|
|
|
m_transferListWidget->applyFilter(m_searchFilter->text(), m_filterColumnComboBox->currentData().value<TransferListModel::Column>()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS) |
|
|
|
|
void MainWindow::checkProgramUpdate(const bool invokedByUser) |
|
|
|
|
{ |
|
|
|
|