mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
commit
94e2c44840
@ -1,10 +1,13 @@
|
|||||||
add_executable(qBittorrent
|
add_executable(qBittorrent
|
||||||
|
# headers
|
||||||
application.h
|
application.h
|
||||||
applicationinstancemanager.h
|
applicationinstancemanager.h
|
||||||
cmdoptions.h
|
cmdoptions.h
|
||||||
filelogger.h
|
filelogger.h
|
||||||
qtlocalpeer/qtlocalpeer.h
|
qtlocalpeer/qtlocalpeer.h
|
||||||
upgrade.h
|
upgrade.h
|
||||||
|
|
||||||
|
# sources
|
||||||
application.cpp
|
application.cpp
|
||||||
applicationinstancemanager.cpp
|
applicationinstancemanager.cpp
|
||||||
cmdoptions.cpp
|
cmdoptions.cpp
|
||||||
|
@ -4,7 +4,6 @@ set(CMAKE_AUTOUIC True)
|
|||||||
add_library(qbt_gui_headers INTERFACE)
|
add_library(qbt_gui_headers INTERFACE)
|
||||||
target_include_directories(qbt_gui_headers INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(qbt_gui_headers INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
add_subdirectory(lineedit)
|
|
||||||
add_subdirectory(properties)
|
add_subdirectory(properties)
|
||||||
add_subdirectory(powermanagement)
|
add_subdirectory(powermanagement)
|
||||||
add_subdirectory(rss)
|
add_subdirectory(rss)
|
||||||
@ -30,6 +29,7 @@ fspathedit_p.h
|
|||||||
guiiconprovider.h
|
guiiconprovider.h
|
||||||
hidabletabwidget.h
|
hidabletabwidget.h
|
||||||
ipsubnetwhitelistoptionsdialog.h
|
ipsubnetwhitelistoptionsdialog.h
|
||||||
|
lineedit.h
|
||||||
loglistwidget.h
|
loglistwidget.h
|
||||||
mainwindow.h
|
mainwindow.h
|
||||||
optionsdialog.h
|
optionsdialog.h
|
||||||
@ -80,6 +80,7 @@ fspathedit.cpp
|
|||||||
fspathedit_p.cpp
|
fspathedit_p.cpp
|
||||||
guiiconprovider.cpp
|
guiiconprovider.cpp
|
||||||
ipsubnetwhitelistoptionsdialog.cpp
|
ipsubnetwhitelistoptionsdialog.cpp
|
||||||
|
lineedit.cpp
|
||||||
loglistwidget.cpp
|
loglistwidget.cpp
|
||||||
mainwindow.cpp
|
mainwindow.cpp
|
||||||
optionsdialog.cpp
|
optionsdialog.cpp
|
||||||
@ -137,7 +138,7 @@ updownratiodialog.ui
|
|||||||
|
|
||||||
target_link_libraries(qbt_gui
|
target_link_libraries(qbt_gui
|
||||||
PRIVATE
|
PRIVATE
|
||||||
qbt_lineedit qbt_powermanagement qbt_rss qbt_properties qbt_searchengine
|
qbt_powermanagement qbt_rss qbt_properties qbt_searchengine
|
||||||
qbt_base
|
qbt_base
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QHostAddress>
|
#include <QHostAddress>
|
||||||
|
#include <QLabel>
|
||||||
#include <QNetworkInterface>
|
#include <QNetworkInterface>
|
||||||
|
|
||||||
#include "base/bittorrent/session.h"
|
#include "base/bittorrent/session.h"
|
||||||
@ -313,15 +314,20 @@ void AdvancedSettings::loadAdvancedSettings()
|
|||||||
const BitTorrent::Session *const session = BitTorrent::Session::instance();
|
const BitTorrent::Session *const session = BitTorrent::Session::instance();
|
||||||
|
|
||||||
// add section headers
|
// add section headers
|
||||||
labelQbtLink.setText(makeLink("https://github.com/qbittorrent/qBittorrent/wiki/Explanation-of-Options-in-qBittorrent#Advanced"
|
auto *labelQbtLink = new QLabel(
|
||||||
, tr("Open documentation")));
|
makeLink(QLatin1String("https://github.com/qbittorrent/qBittorrent/wiki/Explanation-of-Options-in-qBittorrent#Advanced")
|
||||||
labelQbtLink.setOpenExternalLinks(true);
|
, tr("Open documentation"))
|
||||||
addRow(QBITTORRENT_HEADER, QString("<b>%1</b>").arg(tr("qBittorrent Section")), &labelQbtLink);
|
, this);
|
||||||
|
labelQbtLink->setOpenExternalLinks(true);
|
||||||
|
addRow(QBITTORRENT_HEADER, QString("<b>%1</b>").arg(tr("qBittorrent Section")), labelQbtLink);
|
||||||
static_cast<QLabel *>(cellWidget(QBITTORRENT_HEADER, PROPERTY))->setAlignment(Qt::AlignCenter | Qt::AlignVCenter);
|
static_cast<QLabel *>(cellWidget(QBITTORRENT_HEADER, PROPERTY))->setAlignment(Qt::AlignCenter | Qt::AlignVCenter);
|
||||||
|
|
||||||
labelLibtorrentLink.setText(makeLink("https://www.libtorrent.org/reference.html", tr("Open documentation")));
|
auto *labelLibtorrentLink = new QLabel(
|
||||||
labelLibtorrentLink.setOpenExternalLinks(true);
|
makeLink(QLatin1String("https://www.libtorrent.org/reference.html")
|
||||||
addRow(LIBTORRENT_HEADER, QString("<b>%1</b>").arg(tr("libtorrent Section")), &labelLibtorrentLink);
|
, tr("Open documentation"))
|
||||||
|
, this);
|
||||||
|
labelLibtorrentLink->setOpenExternalLinks(true);
|
||||||
|
addRow(LIBTORRENT_HEADER, QString("<b>%1</b>").arg(tr("libtorrent Section")), labelLibtorrentLink);
|
||||||
static_cast<QLabel *>(cellWidget(LIBTORRENT_HEADER, PROPERTY))->setAlignment(Qt::AlignCenter | Qt::AlignVCenter);
|
static_cast<QLabel *>(cellWidget(LIBTORRENT_HEADER, PROPERTY))->setAlignment(Qt::AlignCenter | Qt::AlignVCenter);
|
||||||
|
|
||||||
// Async IO threads
|
// Async IO threads
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QLabel>
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QTableWidget>
|
#include <QTableWidget>
|
||||||
@ -58,7 +57,6 @@ private:
|
|||||||
void loadAdvancedSettings();
|
void loadAdvancedSettings();
|
||||||
template <typename T> void addRow(int row, const QString &text, T *widget);
|
template <typename T> void addRow(int row, const QString &text, T *widget);
|
||||||
|
|
||||||
QLabel labelQbtLink, labelLibtorrentLink;
|
|
||||||
QSpinBox spinBoxAsyncIOThreads, spinBoxFilePoolSize, spinBoxCheckingMemUsage, spinBoxCache,
|
QSpinBox spinBoxAsyncIOThreads, spinBoxFilePoolSize, spinBoxCheckingMemUsage, spinBoxCache,
|
||||||
spinBoxSaveResumeDataInterval, spinBoxOutgoingPortsMin, spinBoxOutgoingPortsMax, spinBoxListRefresh,
|
spinBoxSaveResumeDataInterval, spinBoxOutgoingPortsMin, spinBoxOutgoingPortsMax, spinBoxListRefresh,
|
||||||
spinBoxTrackerPort, spinBoxCacheTTL, spinBoxSendBufferWatermark, spinBoxSendBufferLowWatermark,
|
spinBoxTrackerPort, spinBoxCacheTTL, spinBoxSendBufferWatermark, spinBoxSendBufferLowWatermark,
|
||||||
|
@ -31,13 +31,13 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
class CookiesModel;
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class CookiesDialog;
|
class CookiesDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CookiesModel;
|
|
||||||
|
|
||||||
class CookiesDialog : public QDialog
|
class CookiesDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -32,11 +32,12 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "base/logger.h"
|
#include "base/logger.h"
|
||||||
|
|
||||||
|
class LogListWidget;
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class ExecutionLogWidget;
|
class ExecutionLogWidget;
|
||||||
}
|
}
|
||||||
class LogListWidget;
|
|
||||||
|
|
||||||
class ExecutionLogWidget : public QWidget
|
class ExecutionLogWidget : public QWidget
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
INCLUDEPATH += $$PWD
|
INCLUDEPATH += $$PWD
|
||||||
|
|
||||||
include(lineedit/lineedit.pri)
|
|
||||||
include(powermanagement/powermanagement.pri)
|
include(powermanagement/powermanagement.pri)
|
||||||
include(properties/properties.pri)
|
include(properties/properties.pri)
|
||||||
unix:!macx:dbus: include(qtnotify/qtnotify.pri)
|
unix:!macx:dbus: include(qtnotify/qtnotify.pri)
|
||||||
@ -24,6 +23,7 @@ HEADERS += \
|
|||||||
$$PWD/guiiconprovider.h \
|
$$PWD/guiiconprovider.h \
|
||||||
$$PWD/hidabletabwidget.h \
|
$$PWD/hidabletabwidget.h \
|
||||||
$$PWD/ipsubnetwhitelistoptionsdialog.h \
|
$$PWD/ipsubnetwhitelistoptionsdialog.h \
|
||||||
|
$$PWD/lineedit.h \
|
||||||
$$PWD/loglistwidget.h \
|
$$PWD/loglistwidget.h \
|
||||||
$$PWD/mainwindow.h \
|
$$PWD/mainwindow.h \
|
||||||
$$PWD/optionsdialog.h \
|
$$PWD/optionsdialog.h \
|
||||||
@ -85,6 +85,7 @@ SOURCES += \
|
|||||||
$$PWD/fspathedit_p.cpp \
|
$$PWD/fspathedit_p.cpp \
|
||||||
$$PWD/guiiconprovider.cpp \
|
$$PWD/guiiconprovider.cpp \
|
||||||
$$PWD/ipsubnetwhitelistoptionsdialog.cpp \
|
$$PWD/ipsubnetwhitelistoptionsdialog.cpp \
|
||||||
|
$$PWD/lineedit.cpp \
|
||||||
$$PWD/loglistwidget.cpp \
|
$$PWD/loglistwidget.cpp \
|
||||||
$$PWD/mainwindow.cpp \
|
$$PWD/mainwindow.cpp \
|
||||||
$$PWD/optionsdialog.cpp \
|
$$PWD/optionsdialog.cpp \
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
add_library(qbt_lineedit STATIC
|
|
||||||
src/lineedit.cpp
|
|
||||||
src/lineedit.h
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(qbt_lineedit
|
|
||||||
PRIVATE
|
|
||||||
qbt_gui_headers
|
|
||||||
PUBLIC
|
|
||||||
Qt5::Widgets
|
|
||||||
)
|
|
||||||
|
|
||||||
target_include_directories(qbt_lineedit PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|
@ -1,3 +0,0 @@
|
|||||||
INCLUDEPATH += $$PWD/src
|
|
||||||
HEADERS += $$PWD/src/lineedit.h
|
|
||||||
SOURCES += $$PWD/src/lineedit.cpp
|
|
@ -1,5 +1,8 @@
|
|||||||
add_library(qbt_powermanagement STATIC
|
add_library(qbt_powermanagement STATIC
|
||||||
|
# headers
|
||||||
powermanagement.h
|
powermanagement.h
|
||||||
|
|
||||||
|
# sources
|
||||||
powermanagement.cpp
|
powermanagement.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ target_link_libraries(qbt_properties
|
|||||||
PRIVATE
|
PRIVATE
|
||||||
qbt_gui_headers
|
qbt_gui_headers
|
||||||
PUBLIC
|
PUBLIC
|
||||||
qbt_base qbt_lineedit Qt5::Widgets
|
qbt_base Qt5::Widgets
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(qbt_properties
|
target_include_directories(qbt_properties
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
#include <QShortcut>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
@ -133,8 +134,8 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent)
|
|||||||
connect(header(), &QHeaderView::sectionResized, this, &PeerListWidget::saveSettings);
|
connect(header(), &QHeaderView::sectionResized, this, &PeerListWidget::saveSettings);
|
||||||
connect(header(), &QHeaderView::sortIndicatorChanged, this, &PeerListWidget::saveSettings);
|
connect(header(), &QHeaderView::sortIndicatorChanged, this, &PeerListWidget::saveSettings);
|
||||||
handleSortColumnChanged(header()->sortIndicatorSection());
|
handleSortColumnChanged(header()->sortIndicatorSection());
|
||||||
m_copyHotkey = new QShortcut(QKeySequence::Copy, this, nullptr, nullptr, Qt::WidgetShortcut);
|
const auto *copyHotkey = new QShortcut(QKeySequence::Copy, this, nullptr, nullptr, Qt::WidgetShortcut);
|
||||||
connect(m_copyHotkey, &QShortcut::activated, this, &PeerListWidget::copySelectedPeers);
|
connect(copyHotkey, &QShortcut::activated, this, &PeerListWidget::copySelectedPeers);
|
||||||
|
|
||||||
// This hack fixes reordering of first column with Qt5.
|
// This hack fixes reordering of first column with Qt5.
|
||||||
// https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777
|
// https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QShortcut>
|
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
|
|
||||||
class QSortFilterProxyModel;
|
class QSortFilterProxyModel;
|
||||||
@ -43,11 +42,6 @@ class PeerListDelegate;
|
|||||||
class PeerListSortModel;
|
class PeerListSortModel;
|
||||||
class PropertiesWidget;
|
class PropertiesWidget;
|
||||||
|
|
||||||
namespace Net
|
|
||||||
{
|
|
||||||
class ReverseResolution;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace BitTorrent
|
namespace BitTorrent
|
||||||
{
|
{
|
||||||
class TorrentHandle;
|
class TorrentHandle;
|
||||||
@ -55,6 +49,11 @@ namespace BitTorrent
|
|||||||
struct PeerAddress;
|
struct PeerAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Net
|
||||||
|
{
|
||||||
|
class ReverseResolution;
|
||||||
|
}
|
||||||
|
|
||||||
class PeerListWidget : public QTreeView
|
class PeerListWidget : public QTreeView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -92,7 +91,6 @@ private:
|
|||||||
QPointer<Net::ReverseResolution> m_resolver;
|
QPointer<Net::ReverseResolution> m_resolver;
|
||||||
PropertiesWidget *m_properties;
|
PropertiesWidget *m_properties;
|
||||||
bool m_resolveCountries;
|
bool m_resolveCountries;
|
||||||
QShortcut *m_copyHotkey;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PEERLISTWIDGET_H
|
#endif // PEERLISTWIDGET_H
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
|
|
||||||
#include "base/bittorrent/downloadpriority.h"
|
#include "base/bittorrent/downloadpriority.h"
|
||||||
#include "base/bittorrent/session.h"
|
#include "base/bittorrent/session.h"
|
||||||
|
#include "base/bittorrent/torrenthandle.h"
|
||||||
#include "base/preferences.h"
|
#include "base/preferences.h"
|
||||||
#include "base/unicodestrings.h"
|
#include "base/unicodestrings.h"
|
||||||
#include "base/utils/fs.h"
|
#include "base/utils/fs.h"
|
||||||
@ -149,16 +150,17 @@ PropertiesWidget::PropertiesWidget(QWidget *parent)
|
|||||||
connect(m_tabBar, &PropTabBar::visibilityToggled, this, &PropertiesWidget::setVisibility);
|
connect(m_tabBar, &PropTabBar::visibilityToggled, this, &PropertiesWidget::setVisibility);
|
||||||
connect(m_tabBar, &PropTabBar::visibilityToggled, this, &PropertiesWidget::saveSettings);
|
connect(m_tabBar, &PropTabBar::visibilityToggled, this, &PropertiesWidget::saveSettings);
|
||||||
|
|
||||||
m_editHotkeyFile = new QShortcut(Qt::Key_F2, m_ui->filesList, nullptr, nullptr, Qt::WidgetShortcut);
|
const auto *editHotkeyFile = new QShortcut(Qt::Key_F2, m_ui->filesList, nullptr, nullptr, Qt::WidgetShortcut);
|
||||||
connect(m_editHotkeyFile, &QShortcut::activated
|
connect(editHotkeyFile, &QShortcut::activated
|
||||||
, this, [this]() { m_ui->filesList->renameSelectedFile(m_torrent); });
|
, this, [this]() { m_ui->filesList->renameSelectedFile(m_torrent); });
|
||||||
m_editHotkeyWeb = new QShortcut(Qt::Key_F2, m_ui->listWebSeeds, nullptr, nullptr, Qt::WidgetShortcut);
|
const auto *editHotkeyWeb = new QShortcut(Qt::Key_F2, m_ui->listWebSeeds, nullptr, nullptr, Qt::WidgetShortcut);
|
||||||
connect(m_editHotkeyWeb, &QShortcut::activated, this, &PropertiesWidget::editWebSeed);
|
connect(editHotkeyWeb, &QShortcut::activated, this, &PropertiesWidget::editWebSeed);
|
||||||
|
const auto *deleteHotkeyWeb = new QShortcut(QKeySequence::Delete, m_ui->listWebSeeds, nullptr, nullptr, Qt::WidgetShortcut);
|
||||||
|
connect(deleteHotkeyWeb, &QShortcut::activated, this, &PropertiesWidget::deleteSelectedUrlSeeds);
|
||||||
|
const auto *openHotkeyFile = new QShortcut(Qt::Key_Return, m_ui->filesList, nullptr, nullptr, Qt::WidgetShortcut);
|
||||||
|
connect(openHotkeyFile, &QShortcut::activated, this, &PropertiesWidget::openSelectedFile);
|
||||||
|
|
||||||
connect(m_ui->listWebSeeds, &QListWidget::doubleClicked, this, &PropertiesWidget::editWebSeed);
|
connect(m_ui->listWebSeeds, &QListWidget::doubleClicked, this, &PropertiesWidget::editWebSeed);
|
||||||
m_deleteHotkeyWeb = new QShortcut(QKeySequence::Delete, m_ui->listWebSeeds, nullptr, nullptr, Qt::WidgetShortcut);
|
|
||||||
connect(m_deleteHotkeyWeb, &QShortcut::activated, this, &PropertiesWidget::deleteSelectedUrlSeeds);
|
|
||||||
m_openHotkeyFile = new QShortcut(Qt::Key_Return, m_ui->filesList, nullptr, nullptr, Qt::WidgetShortcut);
|
|
||||||
connect(m_openHotkeyFile, &QShortcut::activated, this, &PropertiesWidget::openSelectedFile);
|
|
||||||
|
|
||||||
configure();
|
configure();
|
||||||
connect(Preferences::instance(), &Preferences::changed, this, &PropertiesWidget::configure);
|
connect(Preferences::instance(), &Preferences::changed, this, &PropertiesWidget::configure);
|
||||||
@ -175,10 +177,6 @@ PropertiesWidget::~PropertiesWidget()
|
|||||||
delete m_propListModel;
|
delete m_propListModel;
|
||||||
delete m_propListDelegate;
|
delete m_propListDelegate;
|
||||||
delete m_tabBar;
|
delete m_tabBar;
|
||||||
delete m_editHotkeyFile;
|
|
||||||
delete m_editHotkeyWeb;
|
|
||||||
delete m_deleteHotkeyWeb;
|
|
||||||
delete m_openHotkeyFile;
|
|
||||||
delete m_ui;
|
delete m_ui;
|
||||||
qDebug() << Q_FUNC_INFO << "EXIT";
|
qDebug() << Q_FUNC_INFO << "EXIT";
|
||||||
}
|
}
|
||||||
|
@ -32,10 +32,7 @@
|
|||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "base/bittorrent/torrenthandle.h"
|
|
||||||
|
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
class QShortcut;
|
|
||||||
class QTreeView;
|
class QTreeView;
|
||||||
|
|
||||||
class DownloadedPiecesBar;
|
class DownloadedPiecesBar;
|
||||||
@ -47,6 +44,11 @@ class PropTabBar;
|
|||||||
class TorrentContentFilterModel;
|
class TorrentContentFilterModel;
|
||||||
class TrackerListWidget;
|
class TrackerListWidget;
|
||||||
|
|
||||||
|
namespace BitTorrent
|
||||||
|
{
|
||||||
|
class TorrentHandle;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class PropertiesWidget;
|
class PropertiesWidget;
|
||||||
@ -121,10 +123,6 @@ private:
|
|||||||
PieceAvailabilityBar *m_piecesAvailability;
|
PieceAvailabilityBar *m_piecesAvailability;
|
||||||
PropTabBar *m_tabBar;
|
PropTabBar *m_tabBar;
|
||||||
LineEdit *m_contentFilterLine;
|
LineEdit *m_contentFilterLine;
|
||||||
QShortcut *m_editHotkeyFile;
|
|
||||||
QShortcut *m_editHotkeyWeb;
|
|
||||||
QShortcut *m_deleteHotkeyWeb;
|
|
||||||
QShortcut *m_openHotkeyFile;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PROPERTIESWIDGET_H
|
#endif // PROPERTIESWIDGET_H
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "base/bittorrent/downloadpriority.h"
|
#include "base/bittorrent/downloadpriority.h"
|
||||||
|
#include "base/bittorrent/torrenthandle.h"
|
||||||
#include "base/unicodestrings.h"
|
#include "base/unicodestrings.h"
|
||||||
#include "base/utils/misc.h"
|
#include "base/utils/misc.h"
|
||||||
#include "base/utils/string.h"
|
#include "base/utils/string.h"
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "base/bittorrent/sessionstatus.h"
|
#include "base/bittorrent/sessionstatus.h"
|
||||||
#include "base/preferences.h"
|
#include "base/preferences.h"
|
||||||
#include "propertieswidget.h"
|
#include "propertieswidget.h"
|
||||||
|
#include "speedplotview.h"
|
||||||
|
|
||||||
ComboBoxMenuButton::ComboBoxMenuButton(QWidget *parent, QMenu *menu)
|
ComboBoxMenuButton::ComboBoxMenuButton(QWidget *parent, QMenu *menu)
|
||||||
: QComboBox(parent)
|
: QComboBox(parent)
|
||||||
|
@ -32,14 +32,13 @@
|
|||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "speedplotview.h"
|
|
||||||
|
|
||||||
class QHBoxLayout;
|
class QHBoxLayout;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QMenu;
|
class QMenu;
|
||||||
class QVBoxLayout;
|
class QVBoxLayout;
|
||||||
|
|
||||||
class PropertiesWidget;
|
class PropertiesWidget;
|
||||||
|
class SpeedPlotView;
|
||||||
|
|
||||||
class ComboBoxMenuButton : public QComboBox
|
class ComboBoxMenuButton : public QComboBox
|
||||||
{
|
{
|
||||||
|
@ -54,6 +54,8 @@
|
|||||||
#include "propertieswidget.h"
|
#include "propertieswidget.h"
|
||||||
#include "trackersadditiondialog.h"
|
#include "trackersadditiondialog.h"
|
||||||
|
|
||||||
|
#define NB_STICKY_ITEM 3
|
||||||
|
|
||||||
TrackerListWidget::TrackerListWidget(PropertiesWidget *properties)
|
TrackerListWidget::TrackerListWidget(PropertiesWidget *properties)
|
||||||
: QTreeWidget()
|
: QTreeWidget()
|
||||||
, m_properties(properties)
|
, m_properties(properties)
|
||||||
@ -87,6 +89,7 @@ TrackerListWidget::TrackerListWidget(PropertiesWidget *properties)
|
|||||||
connect(header(), &QHeaderView::sectionMoved, this, &TrackerListWidget::saveSettings);
|
connect(header(), &QHeaderView::sectionMoved, this, &TrackerListWidget::saveSettings);
|
||||||
connect(header(), &QHeaderView::sectionResized, this, &TrackerListWidget::saveSettings);
|
connect(header(), &QHeaderView::sectionResized, this, &TrackerListWidget::saveSettings);
|
||||||
connect(header(), &QHeaderView::sortIndicatorChanged, this, &TrackerListWidget::saveSettings);
|
connect(header(), &QHeaderView::sortIndicatorChanged, this, &TrackerListWidget::saveSettings);
|
||||||
|
|
||||||
// Set DHT, PeX, LSD items
|
// Set DHT, PeX, LSD items
|
||||||
m_DHTItem = new QTreeWidgetItem({ "", "** [DHT] **", "", "0", "", "", "0" });
|
m_DHTItem = new QTreeWidgetItem({ "", "** [DHT] **", "", "0", "", "", "0" });
|
||||||
insertTopLevelItem(0, m_DHTItem);
|
insertTopLevelItem(0, m_DHTItem);
|
||||||
@ -97,33 +100,38 @@ TrackerListWidget::TrackerListWidget(PropertiesWidget *properties)
|
|||||||
m_LSDItem = new QTreeWidgetItem({ "", "** [LSD] **", "", "0", "", "", "0" });
|
m_LSDItem = new QTreeWidgetItem({ "", "** [LSD] **", "", "0", "", "", "0" });
|
||||||
insertTopLevelItem(2, m_LSDItem);
|
insertTopLevelItem(2, m_LSDItem);
|
||||||
setRowColor(2, QColor("grey"));
|
setRowColor(2, QColor("grey"));
|
||||||
|
|
||||||
// Set static items alignment
|
// Set static items alignment
|
||||||
m_DHTItem->setTextAlignment(COL_PEERS, (Qt::AlignRight | Qt::AlignVCenter));
|
const Qt::Alignment alignment = (Qt::AlignRight | Qt::AlignVCenter);
|
||||||
m_PEXItem->setTextAlignment(COL_PEERS, (Qt::AlignRight | Qt::AlignVCenter));
|
m_DHTItem->setTextAlignment(COL_PEERS, alignment);
|
||||||
m_LSDItem->setTextAlignment(COL_PEERS, (Qt::AlignRight | Qt::AlignVCenter));
|
m_PEXItem->setTextAlignment(COL_PEERS, alignment);
|
||||||
m_DHTItem->setTextAlignment(COL_SEEDS, (Qt::AlignRight | Qt::AlignVCenter));
|
m_LSDItem->setTextAlignment(COL_PEERS, alignment);
|
||||||
m_PEXItem->setTextAlignment(COL_SEEDS, (Qt::AlignRight | Qt::AlignVCenter));
|
m_DHTItem->setTextAlignment(COL_SEEDS, alignment);
|
||||||
m_LSDItem->setTextAlignment(COL_SEEDS, (Qt::AlignRight | Qt::AlignVCenter));
|
m_PEXItem->setTextAlignment(COL_SEEDS, alignment);
|
||||||
m_DHTItem->setTextAlignment(COL_LEECHES, (Qt::AlignRight | Qt::AlignVCenter));
|
m_LSDItem->setTextAlignment(COL_SEEDS, alignment);
|
||||||
m_PEXItem->setTextAlignment(COL_LEECHES, (Qt::AlignRight | Qt::AlignVCenter));
|
m_DHTItem->setTextAlignment(COL_LEECHES, alignment);
|
||||||
m_LSDItem->setTextAlignment(COL_LEECHES, (Qt::AlignRight | Qt::AlignVCenter));
|
m_PEXItem->setTextAlignment(COL_LEECHES, alignment);
|
||||||
m_DHTItem->setTextAlignment(COL_DOWNLOADED, (Qt::AlignRight | Qt::AlignVCenter));
|
m_LSDItem->setTextAlignment(COL_LEECHES, alignment);
|
||||||
m_PEXItem->setTextAlignment(COL_DOWNLOADED, (Qt::AlignRight | Qt::AlignVCenter));
|
m_DHTItem->setTextAlignment(COL_DOWNLOADED, alignment);
|
||||||
m_LSDItem->setTextAlignment(COL_DOWNLOADED, (Qt::AlignRight | Qt::AlignVCenter));
|
m_PEXItem->setTextAlignment(COL_DOWNLOADED, alignment);
|
||||||
|
m_LSDItem->setTextAlignment(COL_DOWNLOADED, alignment);
|
||||||
|
|
||||||
// Set header alignment
|
// Set header alignment
|
||||||
headerItem()->setTextAlignment(COL_TIER, (Qt::AlignRight | Qt::AlignVCenter));
|
headerItem()->setTextAlignment(COL_TIER, alignment);
|
||||||
headerItem()->setTextAlignment(COL_PEERS, (Qt::AlignRight | Qt::AlignVCenter));
|
headerItem()->setTextAlignment(COL_PEERS, alignment);
|
||||||
headerItem()->setTextAlignment(COL_SEEDS, (Qt::AlignRight | Qt::AlignVCenter));
|
headerItem()->setTextAlignment(COL_SEEDS, alignment);
|
||||||
headerItem()->setTextAlignment(COL_LEECHES, (Qt::AlignRight | Qt::AlignVCenter));
|
headerItem()->setTextAlignment(COL_LEECHES, alignment);
|
||||||
headerItem()->setTextAlignment(COL_DOWNLOADED, (Qt::AlignRight | Qt::AlignVCenter));
|
headerItem()->setTextAlignment(COL_DOWNLOADED, alignment);
|
||||||
|
|
||||||
// Set hotkeys
|
// Set hotkeys
|
||||||
m_editHotkey = new QShortcut(Qt::Key_F2, this, nullptr, nullptr, Qt::WidgetShortcut);
|
const auto *editHotkey = new QShortcut(Qt::Key_F2, this, nullptr, nullptr, Qt::WidgetShortcut);
|
||||||
connect(m_editHotkey, &QShortcut::activated, this, &TrackerListWidget::editSelectedTracker);
|
connect(editHotkey, &QShortcut::activated, this, &TrackerListWidget::editSelectedTracker);
|
||||||
|
const auto *deleteHotkey = new QShortcut(QKeySequence::Delete, this, nullptr, nullptr, Qt::WidgetShortcut);
|
||||||
|
connect(deleteHotkey, &QShortcut::activated, this, &TrackerListWidget::deleteSelectedTrackers);
|
||||||
|
const auto *copyHotkey = new QShortcut(QKeySequence::Copy, this, nullptr, nullptr, Qt::WidgetShortcut);
|
||||||
|
connect(copyHotkey, &QShortcut::activated, this, &TrackerListWidget::copyTrackerUrl);
|
||||||
|
|
||||||
connect(this, &QAbstractItemView::doubleClicked, this, &TrackerListWidget::editSelectedTracker);
|
connect(this, &QAbstractItemView::doubleClicked, this, &TrackerListWidget::editSelectedTracker);
|
||||||
m_deleteHotkey = new QShortcut(QKeySequence::Delete, this, nullptr, nullptr, Qt::WidgetShortcut);
|
|
||||||
connect(m_deleteHotkey, &QShortcut::activated, this, &TrackerListWidget::deleteSelectedTrackers);
|
|
||||||
m_copyHotkey = new QShortcut(QKeySequence::Copy, this, nullptr, nullptr, Qt::WidgetShortcut);
|
|
||||||
connect(m_copyHotkey, &QShortcut::activated, this, &TrackerListWidget::copyTrackerUrl);
|
|
||||||
|
|
||||||
// This hack fixes reordering of first column with Qt5.
|
// This hack fixes reordering of first column with Qt5.
|
||||||
// https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777
|
// https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777
|
||||||
@ -138,10 +146,12 @@ TrackerListWidget::~TrackerListWidget()
|
|||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QTreeWidgetItem*> TrackerListWidget::getSelectedTrackerItems() const
|
QVector<QTreeWidgetItem *> TrackerListWidget::getSelectedTrackerItems() const
|
||||||
{
|
{
|
||||||
const QList<QTreeWidgetItem *> selectedTrackerItems = selectedItems();
|
const QList<QTreeWidgetItem *> selectedTrackerItems = selectedItems();
|
||||||
QList<QTreeWidgetItem *> selectedTrackers;
|
QVector<QTreeWidgetItem *> selectedTrackers;
|
||||||
|
selectedTrackers.reserve(selectedTrackerItems.size());
|
||||||
|
|
||||||
for (QTreeWidgetItem *item : selectedTrackerItems) {
|
for (QTreeWidgetItem *item : selectedTrackerItems) {
|
||||||
if (indexOfTopLevelItem(item) >= NB_STICKY_ITEM) // Ignore STICKY ITEMS
|
if (indexOfTopLevelItem(item) >= NB_STICKY_ITEM) // Ignore STICKY ITEMS
|
||||||
selectedTrackers << item;
|
selectedTrackers << item;
|
||||||
@ -165,7 +175,7 @@ void TrackerListWidget::moveSelectionUp()
|
|||||||
clear();
|
clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const QList<QTreeWidgetItem *> selectedTrackerItems = getSelectedTrackerItems();
|
const QVector<QTreeWidgetItem *> selectedTrackerItems = getSelectedTrackerItems();
|
||||||
if (selectedTrackerItems.isEmpty()) return;
|
if (selectedTrackerItems.isEmpty()) return;
|
||||||
|
|
||||||
bool change = false;
|
bool change = false;
|
||||||
@ -207,7 +217,7 @@ void TrackerListWidget::moveSelectionDown()
|
|||||||
clear();
|
clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const QList<QTreeWidgetItem *> selectedTrackerItems = getSelectedTrackerItems();
|
const QVector<QTreeWidgetItem *> selectedTrackerItems = getSelectedTrackerItems();
|
||||||
if (selectedTrackerItems.isEmpty()) return;
|
if (selectedTrackerItems.isEmpty()) return;
|
||||||
|
|
||||||
bool change = false;
|
bool change = false;
|
||||||
@ -246,6 +256,7 @@ void TrackerListWidget::clear()
|
|||||||
{
|
{
|
||||||
qDeleteAll(m_trackerItems);
|
qDeleteAll(m_trackerItems);
|
||||||
m_trackerItems.clear();
|
m_trackerItems.clear();
|
||||||
|
|
||||||
m_DHTItem->setText(COL_STATUS, "");
|
m_DHTItem->setText(COL_STATUS, "");
|
||||||
m_DHTItem->setText(COL_SEEDS, "");
|
m_DHTItem->setText(COL_SEEDS, "");
|
||||||
m_DHTItem->setText(COL_LEECHES, "");
|
m_DHTItem->setText(COL_LEECHES, "");
|
||||||
@ -260,7 +271,7 @@ void TrackerListWidget::clear()
|
|||||||
m_LSDItem->setText(COL_MSG, "");
|
m_LSDItem->setText(COL_MSG, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackerListWidget::loadStickyItems(BitTorrent::TorrentHandle *const torrent)
|
void TrackerListWidget::loadStickyItems(const BitTorrent::TorrentHandle *torrent)
|
||||||
{
|
{
|
||||||
QString working = tr("Working");
|
QString working = tr("Working");
|
||||||
QString disabled = tr("Disabled");
|
QString disabled = tr("Disabled");
|
||||||
@ -327,16 +338,18 @@ void TrackerListWidget::loadStickyItems(BitTorrent::TorrentHandle *const torrent
|
|||||||
void TrackerListWidget::loadTrackers()
|
void TrackerListWidget::loadTrackers()
|
||||||
{
|
{
|
||||||
// Load trackers from torrent handle
|
// Load trackers from torrent handle
|
||||||
BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent();
|
const BitTorrent::TorrentHandle *torrent = m_properties->getCurrentTorrent();
|
||||||
if (!torrent) return;
|
if (!torrent) return;
|
||||||
|
|
||||||
loadStickyItems(torrent);
|
loadStickyItems(torrent);
|
||||||
|
|
||||||
// Load actual trackers information
|
// Load actual trackers information
|
||||||
QHash<QString, BitTorrent::TrackerInfo> trackerData = torrent->trackerInfos();
|
const QHash<QString, BitTorrent::TrackerInfo> trackerData = torrent->trackerInfos();
|
||||||
QStringList oldTrackerURLs = m_trackerItems.keys();
|
QStringList oldTrackerURLs = m_trackerItems.keys();
|
||||||
|
|
||||||
for (const BitTorrent::TrackerEntry &entry : asConst(torrent->trackers())) {
|
for (const BitTorrent::TrackerEntry &entry : asConst(torrent->trackers())) {
|
||||||
QString trackerURL = entry.url();
|
const QString trackerURL = entry.url();
|
||||||
|
|
||||||
QTreeWidgetItem *item = m_trackerItems.value(trackerURL, nullptr);
|
QTreeWidgetItem *item = m_trackerItems.value(trackerURL, nullptr);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
item = new QTreeWidgetItem();
|
item = new QTreeWidgetItem();
|
||||||
@ -347,9 +360,11 @@ void TrackerListWidget::loadTrackers()
|
|||||||
else {
|
else {
|
||||||
oldTrackerURLs.removeOne(trackerURL);
|
oldTrackerURLs.removeOne(trackerURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
item->setText(COL_TIER, QString::number(entry.tier()));
|
item->setText(COL_TIER, QString::number(entry.tier()));
|
||||||
BitTorrent::TrackerInfo data = trackerData.value(trackerURL);
|
|
||||||
QString errorMessage = data.lastMessage.trimmed();
|
const BitTorrent::TrackerInfo data = trackerData.value(trackerURL);
|
||||||
|
|
||||||
switch (entry.status()) {
|
switch (entry.status()) {
|
||||||
case BitTorrent::TrackerEntry::Working:
|
case BitTorrent::TrackerEntry::Working:
|
||||||
item->setText(COL_STATUS, tr("Working"));
|
item->setText(COL_STATUS, tr("Working"));
|
||||||
@ -361,7 +376,7 @@ void TrackerListWidget::loadTrackers()
|
|||||||
break;
|
break;
|
||||||
case BitTorrent::TrackerEntry::NotWorking:
|
case BitTorrent::TrackerEntry::NotWorking:
|
||||||
item->setText(COL_STATUS, tr("Not working"));
|
item->setText(COL_STATUS, tr("Not working"));
|
||||||
item->setText(COL_MSG, errorMessage);
|
item->setText(COL_MSG, data.lastMessage.trimmed());
|
||||||
break;
|
break;
|
||||||
case BitTorrent::TrackerEntry::NotContacted:
|
case BitTorrent::TrackerEntry::NotContacted:
|
||||||
item->setText(COL_STATUS, tr("Not contacted yet"));
|
item->setText(COL_STATUS, tr("Not contacted yet"));
|
||||||
@ -370,16 +385,24 @@ void TrackerListWidget::loadTrackers()
|
|||||||
}
|
}
|
||||||
|
|
||||||
item->setText(COL_PEERS, QString::number(data.numPeers));
|
item->setText(COL_PEERS, QString::number(data.numPeers));
|
||||||
item->setText(COL_SEEDS, (entry.numSeeds() > -1) ? QString::number(entry.numSeeds()) : tr("N/A"));
|
item->setText(COL_SEEDS, ((entry.numSeeds() > -1)
|
||||||
item->setText(COL_LEECHES, (entry.numLeeches() > -1) ? QString::number(entry.numLeeches()) : tr("N/A"));
|
? QString::number(entry.numSeeds())
|
||||||
item->setText(COL_DOWNLOADED, (entry.numDownloaded() > -1) ? QString::number(entry.numDownloaded()) : tr("N/A"));
|
: tr("N/A")));
|
||||||
|
item->setText(COL_LEECHES, ((entry.numLeeches() > -1)
|
||||||
|
? QString::number(entry.numLeeches())
|
||||||
|
: tr("N/A")));
|
||||||
|
item->setText(COL_DOWNLOADED, ((entry.numDownloaded() > -1)
|
||||||
|
? QString::number(entry.numDownloaded())
|
||||||
|
: tr("N/A")));
|
||||||
|
|
||||||
item->setTextAlignment(COL_TIER, (Qt::AlignRight | Qt::AlignVCenter));
|
const Qt::Alignment alignment = (Qt::AlignRight | Qt::AlignVCenter);
|
||||||
item->setTextAlignment(COL_PEERS, (Qt::AlignRight | Qt::AlignVCenter));
|
item->setTextAlignment(COL_TIER, alignment);
|
||||||
item->setTextAlignment(COL_SEEDS, (Qt::AlignRight | Qt::AlignVCenter));
|
item->setTextAlignment(COL_PEERS, alignment);
|
||||||
item->setTextAlignment(COL_LEECHES, (Qt::AlignRight | Qt::AlignVCenter));
|
item->setTextAlignment(COL_SEEDS, alignment);
|
||||||
item->setTextAlignment(COL_DOWNLOADED, (Qt::AlignRight | Qt::AlignVCenter));
|
item->setTextAlignment(COL_LEECHES, alignment);
|
||||||
|
item->setTextAlignment(COL_DOWNLOADED, alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove old trackers
|
// Remove old trackers
|
||||||
for (const QString &tracker : asConst(oldTrackerURLs))
|
for (const QString &tracker : asConst(oldTrackerURLs))
|
||||||
delete m_trackerItems.take(tracker);
|
delete m_trackerItems.take(tracker);
|
||||||
@ -400,7 +423,7 @@ void TrackerListWidget::askForTrackers()
|
|||||||
|
|
||||||
void TrackerListWidget::copyTrackerUrl()
|
void TrackerListWidget::copyTrackerUrl()
|
||||||
{
|
{
|
||||||
const QList<QTreeWidgetItem *> selectedTrackerItems = getSelectedTrackerItems();
|
const QVector<QTreeWidgetItem *> selectedTrackerItems = getSelectedTrackerItems();
|
||||||
if (selectedTrackerItems.isEmpty()) return;
|
if (selectedTrackerItems.isEmpty()) return;
|
||||||
|
|
||||||
QStringList urlsToCopy;
|
QStringList urlsToCopy;
|
||||||
@ -421,7 +444,7 @@ void TrackerListWidget::deleteSelectedTrackers()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QList<QTreeWidgetItem *> selectedTrackerItems = getSelectedTrackerItems();
|
const QVector<QTreeWidgetItem *> selectedTrackerItems = getSelectedTrackerItems();
|
||||||
if (selectedTrackerItems.isEmpty()) return;
|
if (selectedTrackerItems.isEmpty()) return;
|
||||||
|
|
||||||
QStringList urlsToRemove;
|
QStringList urlsToRemove;
|
||||||
@ -453,7 +476,7 @@ void TrackerListWidget::editSelectedTracker()
|
|||||||
BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent();
|
BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent();
|
||||||
if (!torrent) return;
|
if (!torrent) return;
|
||||||
|
|
||||||
QList<QTreeWidgetItem *> selectedTrackerItems = getSelectedTrackerItems();
|
const QVector<QTreeWidgetItem *> selectedTrackerItems = getSelectedTrackerItems();
|
||||||
if (selectedTrackerItems.isEmpty()) return;
|
if (selectedTrackerItems.isEmpty()) return;
|
||||||
|
|
||||||
// During multi-select only process item selected last
|
// During multi-select only process item selected last
|
||||||
@ -574,8 +597,8 @@ void TrackerListWidget::saveSettings() const
|
|||||||
|
|
||||||
QStringList TrackerListWidget::headerLabels()
|
QStringList TrackerListWidget::headerLabels()
|
||||||
{
|
{
|
||||||
static const QStringList header {
|
return {
|
||||||
tr("Tier")
|
tr("Tier")
|
||||||
, tr("URL")
|
, tr("URL")
|
||||||
, tr("Status")
|
, tr("Status")
|
||||||
, tr("Peers")
|
, tr("Peers")
|
||||||
@ -584,8 +607,6 @@ QStringList TrackerListWidget::headerLabels()
|
|||||||
, tr("Downloaded")
|
, tr("Downloaded")
|
||||||
, tr("Message")
|
, tr("Message")
|
||||||
};
|
};
|
||||||
|
|
||||||
return header;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int TrackerListWidget::visibleColumnsCount() const
|
int TrackerListWidget::visibleColumnsCount() const
|
||||||
|
@ -29,14 +29,10 @@
|
|||||||
#ifndef TRACKERLIST_H
|
#ifndef TRACKERLIST_H
|
||||||
#define TRACKERLIST_H
|
#define TRACKERLIST_H
|
||||||
|
|
||||||
#include <QList>
|
|
||||||
#include <QTreeWidget>
|
#include <QTreeWidget>
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
#include "propertieswidget.h"
|
class PropertiesWidget;
|
||||||
|
|
||||||
class QShortcut;
|
|
||||||
|
|
||||||
#define NB_STICKY_ITEM 3
|
|
||||||
|
|
||||||
namespace BitTorrent
|
namespace BitTorrent
|
||||||
{
|
{
|
||||||
@ -75,7 +71,7 @@ public slots:
|
|||||||
void moveSelectionDown();
|
void moveSelectionDown();
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
void loadStickyItems(BitTorrent::TorrentHandle *const torrent);
|
void loadStickyItems(const BitTorrent::TorrentHandle *torrent);
|
||||||
void loadTrackers();
|
void loadTrackers();
|
||||||
void askForTrackers();
|
void askForTrackers();
|
||||||
void copyTrackerUrl();
|
void copyTrackerUrl();
|
||||||
@ -88,19 +84,16 @@ public slots:
|
|||||||
void saveSettings() const;
|
void saveSettings() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QList<QTreeWidgetItem *> getSelectedTrackerItems() const;
|
QVector<QTreeWidgetItem *> getSelectedTrackerItems() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static QStringList headerLabels();
|
||||||
|
|
||||||
PropertiesWidget *m_properties;
|
PropertiesWidget *m_properties;
|
||||||
QHash<QString, QTreeWidgetItem *> m_trackerItems;
|
QHash<QString, QTreeWidgetItem *> m_trackerItems;
|
||||||
QTreeWidgetItem *m_DHTItem;
|
QTreeWidgetItem *m_DHTItem;
|
||||||
QTreeWidgetItem *m_PEXItem;
|
QTreeWidgetItem *m_PEXItem;
|
||||||
QTreeWidgetItem *m_LSDItem;
|
QTreeWidgetItem *m_LSDItem;
|
||||||
QShortcut *m_editHotkey;
|
|
||||||
QShortcut *m_deleteHotkey;
|
|
||||||
QShortcut *m_copyHotkey;
|
|
||||||
|
|
||||||
static QStringList headerLabels();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TRACKERLIST_H
|
#endif // TRACKERLIST_H
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
add_library(qbt_qtnotify STATIC
|
add_library(qbt_qtnotify STATIC
|
||||||
notifications.cpp
|
# headers
|
||||||
notifications.h
|
notifications.h
|
||||||
|
|
||||||
|
# sources
|
||||||
|
notifications.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(qbt_qtnotify PROPERTIES AUTOUIC False AUTORCC False)
|
set_target_properties(qbt_qtnotify PROPERTIES AUTOUIC False AUTORCC False)
|
||||||
|
@ -121,12 +121,12 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent)
|
|||||||
connect(m_ui->listRules, &QListWidget::itemSelectionChanged, this, &AutomatedRssDownloader::updateRuleDefinitionBox);
|
connect(m_ui->listRules, &QListWidget::itemSelectionChanged, this, &AutomatedRssDownloader::updateRuleDefinitionBox);
|
||||||
connect(m_ui->listRules, &QListWidget::itemChanged, this, &AutomatedRssDownloader::handleRuleCheckStateChange);
|
connect(m_ui->listRules, &QListWidget::itemChanged, this, &AutomatedRssDownloader::handleRuleCheckStateChange);
|
||||||
|
|
||||||
m_editHotkey = new QShortcut(Qt::Key_F2, m_ui->listRules, nullptr, nullptr, Qt::WidgetShortcut);
|
const auto *editHotkey = new QShortcut(Qt::Key_F2, m_ui->listRules, nullptr, nullptr, Qt::WidgetShortcut);
|
||||||
connect(m_editHotkey, &QShortcut::activated, this, &AutomatedRssDownloader::renameSelectedRule);
|
connect(editHotkey, &QShortcut::activated, this, &AutomatedRssDownloader::renameSelectedRule);
|
||||||
connect(m_ui->listRules, &QAbstractItemView::doubleClicked, this, &AutomatedRssDownloader::renameSelectedRule);
|
const auto *deleteHotkey = new QShortcut(QKeySequence::Delete, m_ui->listRules, nullptr, nullptr, Qt::WidgetShortcut);
|
||||||
|
connect(deleteHotkey, &QShortcut::activated, this, &AutomatedRssDownloader::on_removeRuleBtn_clicked);
|
||||||
|
|
||||||
m_deleteHotkey = new QShortcut(QKeySequence::Delete, m_ui->listRules, nullptr, nullptr, Qt::WidgetShortcut);
|
connect(m_ui->listRules, &QAbstractItemView::doubleClicked, this, &AutomatedRssDownloader::renameSelectedRule);
|
||||||
connect(m_deleteHotkey, &QShortcut::activated, this, &AutomatedRssDownloader::on_removeRuleBtn_clicked);
|
|
||||||
|
|
||||||
loadFeedList();
|
loadFeedList();
|
||||||
|
|
||||||
@ -149,8 +149,6 @@ AutomatedRssDownloader::~AutomatedRssDownloader()
|
|||||||
saveEditedRule();
|
saveEditedRule();
|
||||||
saveSettings();
|
saveSettings();
|
||||||
|
|
||||||
delete m_editHotkey;
|
|
||||||
delete m_deleteHotkey;
|
|
||||||
delete m_ui;
|
delete m_ui;
|
||||||
delete m_episodeRegex;
|
delete m_episodeRegex;
|
||||||
}
|
}
|
||||||
|
@ -37,20 +37,19 @@
|
|||||||
|
|
||||||
#include "base/rss/rss_autodownloadrule.h"
|
#include "base/rss/rss_autodownloadrule.h"
|
||||||
|
|
||||||
namespace Ui
|
|
||||||
{
|
|
||||||
class AutomatedRssDownloader;
|
|
||||||
}
|
|
||||||
|
|
||||||
class QListWidgetItem;
|
class QListWidgetItem;
|
||||||
class QRegularExpression;
|
class QRegularExpression;
|
||||||
class QShortcut;
|
|
||||||
|
|
||||||
namespace RSS
|
namespace RSS
|
||||||
{
|
{
|
||||||
class Feed;
|
class Feed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Ui
|
||||||
|
{
|
||||||
|
class AutomatedRssDownloader;
|
||||||
|
}
|
||||||
|
|
||||||
class AutomatedRssDownloader : public QDialog
|
class AutomatedRssDownloader : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -102,8 +101,6 @@ private:
|
|||||||
|
|
||||||
Ui::AutomatedRssDownloader *m_ui;
|
Ui::AutomatedRssDownloader *m_ui;
|
||||||
QListWidgetItem *m_currentRuleItem;
|
QListWidgetItem *m_currentRuleItem;
|
||||||
QShortcut *m_editHotkey;
|
|
||||||
QShortcut *m_deleteHotkey;
|
|
||||||
QSet<QPair<QString, QString>> m_treeListEntries;
|
QSet<QPair<QString, QString>> m_treeListEntries;
|
||||||
RSS::AutoDownloadRule m_currentRule;
|
RSS::AutoDownloadRule m_currentRule;
|
||||||
QHash<QString, QListWidgetItem *> m_itemsByRuleName;
|
QHash<QString, QListWidgetItem *> m_itemsByRuleName;
|
||||||
|
@ -93,10 +93,10 @@ RSSWidget::RSSWidget(QWidget *parent)
|
|||||||
loadFoldersOpenState();
|
loadFoldersOpenState();
|
||||||
m_feedListWidget->setCurrentItem(m_feedListWidget->stickyUnreadItem());
|
m_feedListWidget->setCurrentItem(m_feedListWidget->stickyUnreadItem());
|
||||||
|
|
||||||
m_editHotkey = new QShortcut(Qt::Key_F2, m_feedListWidget, nullptr, nullptr, Qt::WidgetShortcut);
|
const auto *editHotkey = new QShortcut(Qt::Key_F2, m_feedListWidget, nullptr, nullptr, Qt::WidgetShortcut);
|
||||||
connect(m_editHotkey, &QShortcut::activated, this, &RSSWidget::renameSelectedRSSItem);
|
connect(editHotkey, &QShortcut::activated, this, &RSSWidget::renameSelectedRSSItem);
|
||||||
m_deleteHotkey = new QShortcut(QKeySequence::Delete, m_feedListWidget, nullptr, nullptr, Qt::WidgetShortcut);
|
const auto *deleteHotkey = new QShortcut(QKeySequence::Delete, m_feedListWidget, nullptr, nullptr, Qt::WidgetShortcut);
|
||||||
connect(m_deleteHotkey, &QShortcut::activated, this, &RSSWidget::deleteSelectedItems);
|
connect(deleteHotkey, &QShortcut::activated, this, &RSSWidget::deleteSelectedItems);
|
||||||
|
|
||||||
// Feeds list actions
|
// Feeds list actions
|
||||||
connect(m_ui->actionDelete, &QAction::triggered, this, &RSSWidget::deleteSelectedItems);
|
connect(m_ui->actionDelete, &QAction::triggered, this, &RSSWidget::deleteSelectedItems);
|
||||||
@ -135,8 +135,6 @@ RSSWidget::~RSSWidget()
|
|||||||
|
|
||||||
saveFoldersOpenState();
|
saveFoldersOpenState();
|
||||||
|
|
||||||
delete m_editHotkey;
|
|
||||||
delete m_deleteHotkey;
|
|
||||||
delete m_feedListWidget;
|
delete m_feedListWidget;
|
||||||
delete m_ui;
|
delete m_ui;
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class QListWidgetItem;
|
class QListWidgetItem;
|
||||||
class QShortcut;
|
|
||||||
class QTreeWidgetItem;
|
class QTreeWidgetItem;
|
||||||
|
|
||||||
class ArticleListWidget;
|
class ArticleListWidget;
|
||||||
@ -86,8 +85,6 @@ private:
|
|||||||
Ui::RSSWidget *m_ui;
|
Ui::RSSWidget *m_ui;
|
||||||
ArticleListWidget *m_articleListWidget;
|
ArticleListWidget *m_articleListWidget;
|
||||||
FeedListWidget *m_feedListWidget;
|
FeedListWidget *m_feedListWidget;
|
||||||
QShortcut *m_editHotkey;
|
|
||||||
QShortcut *m_deleteHotkey;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RSSWIDGET_H
|
#endif // RSSWIDGET_H
|
||||||
|
@ -29,5 +29,5 @@ target_link_libraries(qbt_searchengine
|
|||||||
PUBLIC
|
PUBLIC
|
||||||
qbt_base
|
qbt_base
|
||||||
PRIVATE
|
PRIVATE
|
||||||
qbt_lineedit qbt_gui_headers
|
qbt_gui_headers
|
||||||
)
|
)
|
||||||
|
@ -38,14 +38,14 @@ class QHeaderView;
|
|||||||
class QModelIndex;
|
class QModelIndex;
|
||||||
class QStandardItemModel;
|
class QStandardItemModel;
|
||||||
|
|
||||||
template <typename T> class CachedSettingValue;
|
|
||||||
|
|
||||||
class LineEdit;
|
class LineEdit;
|
||||||
class SearchHandler;
|
class SearchHandler;
|
||||||
class SearchListDelegate;
|
class SearchListDelegate;
|
||||||
class SearchSortModel;
|
class SearchSortModel;
|
||||||
struct SearchResult;
|
struct SearchResult;
|
||||||
|
|
||||||
|
template <typename T> class CachedSettingValue;
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class SearchJobWidget;
|
class SearchJobWidget;
|
||||||
|
@ -137,8 +137,8 @@ SearchWidget::SearchWidget(MainWindow *mainWindow)
|
|||||||
connect(m_ui->selectPlugin, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged)
|
connect(m_ui->selectPlugin, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged)
|
||||||
, this, &SearchWidget::fillCatCombobox);
|
, this, &SearchWidget::fillCatCombobox);
|
||||||
|
|
||||||
m_focusSearchHotkey = new QShortcut(QKeySequence::Find, this);
|
const auto focusSearchHotkey = new QShortcut(QKeySequence::Find, this);
|
||||||
connect(m_focusSearchHotkey, &QShortcut::activated, this, &SearchWidget::toggleFocusBetweenLineEdits);
|
connect(focusSearchHotkey, &QShortcut::activated, this, &SearchWidget::toggleFocusBetweenLineEdits);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchWidget::fillCatCombobox()
|
void SearchWidget::fillCatCombobox()
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class QShortcut;
|
|
||||||
class QTabWidget;
|
class QTabWidget;
|
||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
@ -80,5 +79,4 @@ private:
|
|||||||
QList<SearchJobWidget *> m_allTabs; // To store all tabs
|
QList<SearchJobWidget *> m_allTabs; // To store all tabs
|
||||||
MainWindow *m_mainWindow;
|
MainWindow *m_mainWindow;
|
||||||
bool m_isNewQueryString;
|
bool m_isNewQueryString;
|
||||||
QShortcut *m_focusSearchHotkey;
|
|
||||||
};
|
};
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
#include "torrentcontentmodelfolder.h"
|
#include "torrentcontentmodelfolder.h"
|
||||||
|
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
#include "base/bittorrent/torrenthandle.h"
|
#include "base/bittorrent/torrenthandle.h"
|
||||||
#include "base/global.h"
|
#include "base/global.h"
|
||||||
|
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
#include "torrentcontentmodelitem.h"
|
#include "torrentcontentmodelitem.h"
|
||||||
|
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
#include "torrentcontentmodelfolder.h"
|
#include "torrentcontentmodelfolder.h"
|
||||||
|
|
||||||
TorrentContentModelItem::TorrentContentModelItem(TorrentContentModelFolder *parent)
|
TorrentContentModelItem::TorrentContentModelItem(TorrentContentModelFolder *parent)
|
||||||
|
@ -34,16 +34,16 @@
|
|||||||
|
|
||||||
#include "base/settingvalue.h"
|
#include "base/settingvalue.h"
|
||||||
|
|
||||||
namespace Ui
|
|
||||||
{
|
|
||||||
class TorrentCreatorDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace BitTorrent
|
namespace BitTorrent
|
||||||
{
|
{
|
||||||
class TorrentCreatorThread;
|
class TorrentCreatorThread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Ui
|
||||||
|
{
|
||||||
|
class TorrentCreatorDialog;
|
||||||
|
}
|
||||||
|
|
||||||
class TorrentCreatorDialog : public QDialog
|
class TorrentCreatorDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -39,7 +39,6 @@ namespace BitTorrent
|
|||||||
{
|
{
|
||||||
enum class TorrentState;
|
enum class TorrentState;
|
||||||
}
|
}
|
||||||
// Defines for download list list columns
|
|
||||||
|
|
||||||
class TransferListDelegate : public QItemDelegate
|
class TransferListDelegate : public QItemDelegate
|
||||||
{
|
{
|
||||||
|
@ -186,16 +186,16 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *mainWindow)
|
|||||||
connect(header(), &QHeaderView::sectionResized, this, &TransferListWidget::saveSettings);
|
connect(header(), &QHeaderView::sectionResized, this, &TransferListWidget::saveSettings);
|
||||||
connect(header(), &QHeaderView::sortIndicatorChanged, this, &TransferListWidget::saveSettings);
|
connect(header(), &QHeaderView::sortIndicatorChanged, this, &TransferListWidget::saveSettings);
|
||||||
|
|
||||||
m_editHotkey = new QShortcut(Qt::Key_F2, this, nullptr, nullptr, Qt::WidgetShortcut);
|
const auto *editHotkey = new QShortcut(Qt::Key_F2, this, nullptr, nullptr, Qt::WidgetShortcut);
|
||||||
connect(m_editHotkey, &QShortcut::activated, this, &TransferListWidget::renameSelectedTorrent);
|
connect(editHotkey, &QShortcut::activated, this, &TransferListWidget::renameSelectedTorrent);
|
||||||
m_deleteHotkey = new QShortcut(QKeySequence::Delete, this, nullptr, nullptr, Qt::WidgetShortcut);
|
const auto *deleteHotkey = new QShortcut(QKeySequence::Delete, this, nullptr, nullptr, Qt::WidgetShortcut);
|
||||||
connect(m_deleteHotkey, &QShortcut::activated, this, &TransferListWidget::softDeleteSelectedTorrents);
|
connect(deleteHotkey, &QShortcut::activated, this, &TransferListWidget::softDeleteSelectedTorrents);
|
||||||
m_permDeleteHotkey = new QShortcut(Qt::SHIFT + Qt::Key_Delete, this, nullptr, nullptr, Qt::WidgetShortcut);
|
const auto *permDeleteHotkey = new QShortcut(Qt::SHIFT + Qt::Key_Delete, this, nullptr, nullptr, Qt::WidgetShortcut);
|
||||||
connect(m_permDeleteHotkey, &QShortcut::activated, this, &TransferListWidget::permDeleteSelectedTorrents);
|
connect(permDeleteHotkey, &QShortcut::activated, this, &TransferListWidget::permDeleteSelectedTorrents);
|
||||||
m_doubleClickHotkey = new QShortcut(Qt::Key_Return, this, nullptr, nullptr, Qt::WidgetShortcut);
|
const auto *doubleClickHotkey = new QShortcut(Qt::Key_Return, this, nullptr, nullptr, Qt::WidgetShortcut);
|
||||||
connect(m_doubleClickHotkey, &QShortcut::activated, this, &TransferListWidget::torrentDoubleClicked);
|
connect(doubleClickHotkey, &QShortcut::activated, this, &TransferListWidget::torrentDoubleClicked);
|
||||||
m_recheckHotkey = new QShortcut(Qt::CTRL + Qt::Key_R, this, nullptr, nullptr, Qt::WidgetShortcut);
|
const auto *recheckHotkey = new QShortcut(Qt::CTRL + Qt::Key_R, this, nullptr, nullptr, Qt::WidgetShortcut);
|
||||||
connect(m_recheckHotkey, &QShortcut::activated, this, &TransferListWidget::recheckSelectedTorrents);
|
connect(recheckHotkey, &QShortcut::activated, this, &TransferListWidget::recheckSelectedTorrents);
|
||||||
|
|
||||||
// This hack fixes reordering of first column with Qt5.
|
// This hack fixes reordering of first column with Qt5.
|
||||||
// https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777
|
// https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777
|
||||||
|
@ -33,18 +33,16 @@
|
|||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
namespace BitTorrent
|
|
||||||
{
|
|
||||||
class TorrentHandle;
|
|
||||||
}
|
|
||||||
|
|
||||||
class QShortcut;
|
|
||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
class TransferListDelegate;
|
class TransferListDelegate;
|
||||||
class TransferListModel;
|
class TransferListModel;
|
||||||
class TransferListSortModel;
|
class TransferListSortModel;
|
||||||
|
|
||||||
|
namespace BitTorrent
|
||||||
|
{
|
||||||
|
class TorrentHandle;
|
||||||
|
}
|
||||||
|
|
||||||
class TransferListWidget : public QTreeView
|
class TransferListWidget : public QTreeView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -128,11 +126,6 @@ private:
|
|||||||
TransferListModel *m_listModel;
|
TransferListModel *m_listModel;
|
||||||
TransferListSortModel *m_sortFilterModel;
|
TransferListSortModel *m_sortFilterModel;
|
||||||
MainWindow *m_mainWindow;
|
MainWindow *m_mainWindow;
|
||||||
QShortcut *m_editHotkey;
|
|
||||||
QShortcut *m_deleteHotkey;
|
|
||||||
QShortcut *m_permDeleteHotkey;
|
|
||||||
QShortcut *m_doubleClickHotkey;
|
|
||||||
QShortcut *m_recheckHotkey;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TRANSFERLISTWIDGET_H
|
#endif // TRANSFERLISTWIDGET_H
|
||||||
|
@ -3,9 +3,9 @@ add_library(qbt_webui STATIC
|
|||||||
api/apicontroller.h
|
api/apicontroller.h
|
||||||
api/apierror.h
|
api/apierror.h
|
||||||
api/appcontroller.h
|
api/appcontroller.h
|
||||||
api/isessionmanager.h
|
|
||||||
api/authcontroller.h
|
api/authcontroller.h
|
||||||
api/freediskspacechecker.h
|
api/freediskspacechecker.h
|
||||||
|
api/isessionmanager.h
|
||||||
api/logcontroller.h
|
api/logcontroller.h
|
||||||
api/rsscontroller.h
|
api/rsscontroller.h
|
||||||
api/searchcontroller.h
|
api/searchcontroller.h
|
||||||
|
Loading…
Reference in New Issue
Block a user