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