Browse Source

Change file names and classes names to match them

adaptive-webui-19844
thalieht 7 years ago
parent
commit
d34ddb2e3c
  1. 2
      src/app/CMakeLists.txt
  2. 4
      src/app/app.pri
  3. 4
      src/app/application.cpp
  4. 4
      src/app/main.cpp
  5. 13
      src/app/stacktracedialog.h
  6. 4
      src/app/stacktracedialog.ui
  7. 3
      src/base/CMakeLists.txt
  8. 74
      src/gui/CMakeLists.txt
  9. 10
      src/gui/aboutdialog.h
  10. 4
      src/gui/aboutdialog.ui
  11. 32
      src/gui/addnewtorrentdialog.cpp
  12. 18
      src/gui/banlistoptionsdialog.cpp
  13. 16
      src/gui/banlistoptionsdialog.h
  14. 6
      src/gui/banlistoptionsdialog.ui
  15. 16
      src/gui/deletionconfirmationdialog.h
  16. 8
      src/gui/deletionconfirmationdialog.ui
  17. 20
      src/gui/executionlogwidget.cpp
  18. 17
      src/gui/executionlogwidget.h
  19. 4
      src/gui/executionlogwidget.ui
  20. 82
      src/gui/gui.pri
  21. 22
      src/gui/mainwindow.cpp
  22. 8
      src/gui/mainwindow.h
  23. 9
      src/gui/optionsdialog.cpp
  24. 6
      src/gui/optionsdialog.h
  25. 0
      src/gui/optionsdialog.ui
  26. 43
      src/gui/properties/CMakeLists.txt
  27. 6
      src/gui/properties/peerlistwidget.cpp
  28. 20
      src/gui/properties/peersadditiondialog.cpp
  29. 10
      src/gui/properties/peersadditiondialog.h
  30. 6
      src/gui/properties/peersadditiondialog.ui
  31. 16
      src/gui/properties/properties.pri
  32. 16
      src/gui/properties/propertieswidget.cpp
  33. 6
      src/gui/properties/propertieswidget.h
  34. 64
      src/gui/properties/trackerlistwidget.cpp
  35. 8
      src/gui/properties/trackerlistwidget.h
  36. 26
      src/gui/properties/trackersadditiondialog.cpp
  37. 10
      src/gui/properties/trackersadditiondialog.h
  38. 8
      src/gui/properties/trackersadditiondialog.ui
  39. 18
      src/gui/raisedmessagebox.cpp
  40. 16
      src/gui/raisedmessagebox.h
  41. 5
      src/gui/rss/CMakeLists.txt
  42. 23
      src/gui/search/CMakeLists.txt
  43. 94
      src/gui/search/pluginselectdialog.cpp
  44. 16
      src/gui/search/pluginselectdialog.h
  45. 4
      src/gui/search/pluginselectdialog.ui
  46. 14
      src/gui/search/pluginsourcedialog.cpp
  47. 16
      src/gui/search/pluginsourcedialog.h
  48. 4
      src/gui/search/pluginsourcedialog.ui
  49. 98
      src/gui/search/searchjobwidget.cpp
  50. 14
      src/gui/search/searchjobwidget.h
  51. 4
      src/gui/search/searchjobwidget.ui
  52. 34
      src/gui/search/searchwidget.cpp
  53. 8
      src/gui/search/searchwidget.h
  54. 26
      src/gui/shutdownconfirmdialog.cpp
  55. 16
      src/gui/shutdownconfirmdialog.h
  56. 8
      src/gui/shutdownconfirmdialog.ui
  57. 6
      src/gui/speedlimitdialog.cpp
  58. 10
      src/gui/speedlimitdialog.h
  59. 8
      src/gui/speedlimitdialog.ui
  60. 2
      src/gui/statusbar.cpp
  61. 52
      src/gui/torrentcreatordialog.cpp
  62. 16
      src/gui/torrentcreatordialog.h
  63. 6
      src/gui/torrentcreatordialog.ui
  64. 16
      src/gui/trackerlogindialog.cpp
  65. 15
      src/gui/trackerlogindialog.h
  66. 4
      src/gui/trackerlogindialog.ui
  67. 54
      src/gui/transferlistdelegate.cpp
  68. 42
      src/gui/transferlistfilterswidget.cpp
  69. 12
      src/gui/transferlistfilterswidget.h
  70. 46
      src/gui/transferlistmodel.cpp
  71. 12
      src/gui/transferlistmodel.h
  72. 48
      src/gui/transferlistsortmodel.cpp
  73. 80
      src/gui/transferlistwidget.cpp
  74. 6
      src/gui/transferlistwidget.h
  75. 30
      src/gui/updownratiodialog.cpp
  76. 16
      src/gui/updownratiodialog.h
  77. 8
      src/gui/updownratiodialog.ui
  78. 3
      src/webui/CMakeLists.txt
  79. 4
      src/webui/www/private/addtrackers.html
  80. 18
      src/webui/www/private/filters.html
  81. 10
      src/webui/www/private/properties_content.html
  82. 18
      src/webui/www/private/scripts/client.js
  83. 58
      src/webui/www/private/scripts/dynamicTable.js
  84. 2
      src/webui/www/private/scripts/mocha-init.js
  85. 2
      src/webui/www/private/scripts/prop-trackers.js
  86. 12
      src/webui/www/private/shareratio.html

2
src/app/CMakeLists.txt

@ -67,7 +67,7 @@ if (STACKTRACE) @@ -67,7 +67,7 @@ if (STACKTRACE)
else (UNIX)
target_sources(qBittorrent PRIVATE stacktrace_win.h)
if (Qt5Widgets_FOUND)
target_sources(qBittorrent PRIVATE stacktrace_win_dlg.h)
target_sources(qBittorrent PRIVATE stacktracedialog.h)
endif (Qt5Widgets_FOUND)
endif (UNIX)
endif (STACKTRACE)

4
src/app/app.pri

@ -32,8 +32,8 @@ stacktrace { @@ -32,8 +32,8 @@ stacktrace {
else {
HEADERS += $$PWD/stacktrace_win.h
!nogui {
HEADERS += $$PWD/stacktrace_win_dlg.h
FORMS += $$PWD/stacktrace_win_dlg.ui
HEADERS += $$PWD/stacktracedialog.h
FORMS += $$PWD/stacktracedialog.ui
}
}
}

4
src/app/application.cpp

@ -57,7 +57,7 @@ @@ -57,7 +57,7 @@
#include "addnewtorrentdialog.h"
#include "gui/guiiconprovider.h"
#include "mainwindow.h"
#include "shutdownconfirmdlg.h"
#include "shutdownconfirmdialog.h"
#else // DISABLE_GUI
#include <cstdio>
#endif // DISABLE_GUI
@ -391,7 +391,7 @@ void Application::allTorrentsFinished() @@ -391,7 +391,7 @@ void Application::allTorrentsFinished()
// do nothing & skip confirm
}
else {
if (!ShutdownConfirmDlg::askForConfirmation(m_window, action)) return;
if (!ShutdownConfirmDialog::askForConfirmation(m_window, action)) return;
}
#endif // DISABLE_GUI

4
src/app/main.cpp

@ -61,7 +61,7 @@ Q_IMPORT_PLUGIN(QICOPlugin) @@ -61,7 +61,7 @@ Q_IMPORT_PLUGIN(QICOPlugin)
#include "stacktrace.h"
#else
#include "stacktrace_win.h"
#include "stacktrace_win_dlg.h"
#include "stacktracedialog.h"
#endif // Q_OS_UNIX
#endif //STACKTRACE
@ -306,7 +306,7 @@ void sigAbnormalHandler(int signum) @@ -306,7 +306,7 @@ void sigAbnormalHandler(int signum)
#endif
#if defined Q_OS_WIN
StraceDlg dlg; // unsafe
StacktraceDialog dlg; // unsafe
dlg.setStacktraceString(QLatin1String(sigName), straceWin::getBacktrace());
dlg.exec();
#endif

13
src/app/stacktrace_win_dlg.h → src/app/stacktracedialog.h

@ -27,20 +27,21 @@ @@ -27,20 +27,21 @@
*
*/
#ifndef STACKTRACE_WIN_DLG_H
#define STACKTRACE_WIN_DLG_H
#ifndef STACKTRACEDIALOG_H
#define STACKTRACEDIALOG_H
#include <QString>
#include <QDialog>
#include "base/utils/misc.h"
#include "ui_stacktrace_win_dlg.h"
#include "ui_stacktracedialog.h"
class StraceDlg : public QDialog, private Ui::errorDialog
class StacktraceDialog : public QDialog, private Ui::StacktraceDialog
{
Q_OBJECT
public:
StraceDlg(QWidget *parent = nullptr)
StacktraceDialog(QWidget *parent = nullptr)
: QDialog(parent)
{
setupUi(this);
@ -83,4 +84,4 @@ public: @@ -83,4 +84,4 @@ public:
}
};
#endif
#endif // STACKTRACEDIALOG_H

4
src/app/stacktrace_win_dlg.ui → src/app/stacktracedialog.ui

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>errorDialog</class>
<widget class="QDialog" name="errorDialog">
<class>StacktraceDialog</class>
<widget class="QDialog" name="StacktraceDialog">
<property name="geometry">
<rect>
<x>0</x>

3
src/base/CMakeLists.txt

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
find_package(ZLIB 1.2.5.2 REQUIRED)
add_library(qbt_base STATIC
# headers
bittorrent/addtorrentparams.h
bittorrent/cachestatus.h
bittorrent/infohash.h
@ -72,6 +73,8 @@ torrentfilter.h @@ -72,6 +73,8 @@ torrentfilter.h
tristatebool.h
types.h
unicodestrings.h
# sources
bittorrent/infohash.cpp
bittorrent/magneturi.cpp
bittorrent/peerinfo.cpp

74
src/gui/CMakeLists.txt

@ -12,19 +12,19 @@ add_subdirectory(search) @@ -12,19 +12,19 @@ add_subdirectory(search)
add_library(qbt_gui STATIC
# headers
about_imp.h
aboutdialog.h
addnewtorrentdialog.h
advancedsettings.h
autoexpandabledialog.h
banlistoptions.h
banlistoptionsdialog.h
categoryfiltermodel.h
categoryfilterproxymodel.h
categoryfilterwidget.h
cookiesdialog.h
cookiesmodel.h
deletionconfirmationdlg.h
deletionconfirmationdialog.h
downloadfromurldialog.h
executionlog.h
executionlogwidget.h
fspathedit.h
fspathedit_p.h
guiiconprovider.h
@ -32,13 +32,13 @@ hidabletabwidget.h @@ -32,13 +32,13 @@ hidabletabwidget.h
ipsubnetwhitelistoptionsdialog.h
loglistwidget.h
mainwindow.h
messageboxraised.h
optionsdlg.h
optionsdialog.h
previewlistdelegate.h
previewselectdialog.h
raisedmessagebox.h
scanfoldersdelegate.h
shutdownconfirmdlg.h
speedlimitdlg.h
shutdownconfirmdialog.h
speedlimitdialog.h
statsdialog.h
statusbar.h
tagfiltermodel.h
@ -51,39 +51,40 @@ torrentcontentmodelfile.h @@ -51,39 +51,40 @@ torrentcontentmodelfile.h
torrentcontentmodelfolder.h
torrentcontentmodelitem.h
torrentcontenttreeview.h
torrentcreatordlg.h
torrentmodel.h
trackerlogin.h
torrentcreatordialog.h
trackerlogindialog.h
transferlistdelegate.h
transferlistfilterswidget.h
transferlistmodel.h
transferlistsortmodel.h
transferlistwidget.h
updownratiodlg.h
updownratiodialog.h
utils.h
# sources
addnewtorrentdialog.cpp
advancedsettings.cpp
autoexpandabledialog.cpp
banlistoptions.cpp
banlistoptionsdialog.cpp
categoryfiltermodel.cpp
categoryfilterproxymodel.cpp
categoryfilterwidget.cpp
cookiesdialog.cpp
cookiesmodel.cpp
downloadfromurldialog.cpp
executionlog.cpp
executionlogwidget.cpp
fspathedit.cpp
fspathedit_p.cpp
guiiconprovider.cpp
ipsubnetwhitelistoptionsdialog.cpp
loglistwidget.cpp
mainwindow.cpp
messageboxraised.cpp
optionsdlg.cpp
optionsdialog.cpp
previewselectdialog.cpp
raisedmessagebox.cpp
scanfoldersdelegate.cpp
shutdownconfirmdlg.cpp
speedlimitdlg.cpp
shutdownconfirmdialog.cpp
speedlimitdialog.cpp
statsdialog.cpp
statusbar.cpp
tagfiltermodel.cpp
@ -96,35 +97,36 @@ torrentcontentmodelfile.cpp @@ -96,35 +97,36 @@ torrentcontentmodelfile.cpp
torrentcontentmodelfolder.cpp
torrentcontentmodelitem.cpp
torrentcontenttreeview.cpp
torrentcreatordlg.cpp
torrentmodel.cpp
trackerlogin.cpp
torrentcreatordialog.cpp
trackerlogindialog.cpp
transferlistdelegate.cpp
transferlistfilterswidget.cpp
transferlistmodel.cpp
transferlistsortmodel.cpp
transferlistwidget.cpp
updownratiodlg.cpp
updownratiodialog.cpp
utils.cpp
# forms
mainwindow.ui
about.ui
banlistoptions.ui
aboutdialog.ui
addnewtorrentdialog.ui
autoexpandabledialog.ui
banlistoptionsdialog.ui
cookiesdialog.ui
deletionconfirmationdialog.ui
downloadfromurldialog.ui
executionlogwidget.ui
ipsubnetwhitelistoptionsdialog.ui
mainwindow.ui
optionsdialog.ui
previewselectdialog.ui
login.ui
downloadfromurldialog.ui
bandwidth_limit.ui
updownratiodlg.ui
confirmdeletiondlg.ui
executionlog.ui
addnewtorrentdialog.ui
autoexpandabledialog.ui
shutdownconfirmdialog.ui
speedlimitdialog.ui
statsdialog.ui
optionsdlg.ui
torrentcategorydialog.ui
torrentcreatordlg.ui
shutdownconfirmdlg.ui
torrentcreatordialog.ui
trackerlogindialog.ui
updownratiodialog.ui
)
target_link_libraries(qbt_gui

10
src/gui/about_imp.h → src/gui/aboutdialog.h

@ -26,17 +26,17 @@ @@ -26,17 +26,17 @@
* exception statement from your version.
*/
#ifndef ABOUT_H
#define ABOUT_H
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H
#include <QFile>
#include "base/unicodestrings.h"
#include "base/utils/misc.h"
#include "ui_about.h"
#include "ui_aboutdialog.h"
#include "utils.h"
class AboutDialog : public QDialog, private Ui::AboutDlg
class AboutDialog : public QDialog, private Ui::AboutDialog
{
Q_OBJECT
@ -107,4 +107,4 @@ public: @@ -107,4 +107,4 @@ public:
}
};
#endif // ABOUT_H
#endif // ABOUTDIALOG_H

4
src/gui/about.ui → src/gui/aboutdialog.ui

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author>Christophe Dumez</author>
<class>AboutDlg</class>
<widget class="QDialog" name="AboutDlg">
<class>AboutDialog</class>
<widget class="QDialog" name="AboutDialog">
<property name="geometry">
<rect>
<x>0</x>

32
src/gui/addnewtorrentdialog.cpp

@ -53,8 +53,8 @@ @@ -53,8 +53,8 @@
#include "base/utils/string.h"
#include "autoexpandabledialog.h"
#include "guiiconprovider.h"
#include "messageboxraised.h"
#include "proplistdelegate.h"
#include "raisedmessagebox.h"
#include "torrentcontentfiltermodel.h"
#include "torrentcontentmodel.h"
#include "ui_addnewtorrentdialog.h"
@ -268,13 +268,13 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath) @@ -268,13 +268,13 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath)
m_filePath = torrentPath;
if (!QFile::exists(m_filePath)) {
MessageBoxRaised::critical(this, tr("I/O Error"), tr("The torrent file '%1' does not exist.").arg(Utils::Fs::toNativePath(m_filePath)));
RaisedMessageBox::critical(this, tr("I/O Error"), tr("The torrent file '%1' does not exist.").arg(Utils::Fs::toNativePath(m_filePath)));
return false;
}
QFileInfo fileinfo(m_filePath);
if (!fileinfo.isReadable()) {
MessageBoxRaised::critical(this, tr("I/O Error"), tr("The torrent file '%1' cannot be read from the disk. Probably you don't have enough permissions.").arg(Utils::Fs::toNativePath(m_filePath)));
RaisedMessageBox::critical(this, tr("I/O Error"), tr("The torrent file '%1' cannot be read from the disk. Probably you don't have enough permissions.").arg(Utils::Fs::toNativePath(m_filePath)));
return false;
}
@ -282,7 +282,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath) @@ -282,7 +282,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath)
QString error;
m_torrentInfo = BitTorrent::TorrentInfo::loadFromFile(m_filePath, &error);
if (!m_torrentInfo.isValid()) {
MessageBoxRaised::critical(this, tr("Invalid torrent"), tr("Failed to load the torrent: %1.\nError: %2", "Don't remove the '\n' characters. They insert a newline.")
RaisedMessageBox::critical(this, tr("Invalid torrent"), tr("Failed to load the torrent: %1.\nError: %2", "Don't remove the '\n' characters. They insert a newline.")
.arg(Utils::Fs::toNativePath(m_filePath), error));
return false;
}
@ -295,16 +295,16 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath) @@ -295,16 +295,16 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath)
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(m_hash);
if (torrent) {
if (torrent->isPrivate() || m_torrentInfo.isPrivate()) {
MessageBoxRaised::critical(this, tr("Already in the download list"), tr("Torrent '%1' is already in the download list. Trackers weren't merged because it is a private torrent.").arg(torrent->name()), QMessageBox::Ok);
RaisedMessageBox::critical(this, tr("Already in the download list"), tr("Torrent '%1' is already in the download list. Trackers weren't merged because it is a private torrent.").arg(torrent->name()), QMessageBox::Ok);
}
else {
torrent->addTrackers(m_torrentInfo.trackers());
torrent->addUrlSeeds(m_torrentInfo.urlSeeds());
MessageBoxRaised::information(this, tr("Already in the download list"), tr("Torrent '%1' is already in the download list. Trackers were merged.").arg(torrent->name()), QMessageBox::Ok);
RaisedMessageBox::information(this, tr("Already in the download list"), tr("Torrent '%1' is already in the download list. Trackers were merged.").arg(torrent->name()), QMessageBox::Ok);
}
}
else {
MessageBoxRaised::critical(this, tr("Cannot add torrent"), tr("Cannot add this torrent. Perhaps it is already in adding state."), QMessageBox::Ok);
RaisedMessageBox::critical(this, tr("Cannot add torrent"), tr("Cannot add this torrent. Perhaps it is already in adding state."), QMessageBox::Ok);
}
return false;
}
@ -318,7 +318,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath) @@ -318,7 +318,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath)
bool AddNewTorrentDialog::loadMagnet(const BitTorrent::MagnetUri &magnetUri)
{
if (!magnetUri.isValid()) {
MessageBoxRaised::critical(this, tr("Invalid magnet link"), tr("This magnet link was not recognized"));
RaisedMessageBox::critical(this, tr("Invalid magnet link"), tr("This magnet link was not recognized"));
return false;
}
@ -329,16 +329,16 @@ bool AddNewTorrentDialog::loadMagnet(const BitTorrent::MagnetUri &magnetUri) @@ -329,16 +329,16 @@ bool AddNewTorrentDialog::loadMagnet(const BitTorrent::MagnetUri &magnetUri)
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(m_hash);
if (torrent) {
if (torrent->isPrivate()) {
MessageBoxRaised::critical(this, tr("Already in the download list"), tr("Torrent '%1' is already in the download list. Trackers weren't merged because it is a private torrent.").arg(torrent->name()), QMessageBox::Ok);
RaisedMessageBox::critical(this, tr("Already in the download list"), tr("Torrent '%1' is already in the download list. Trackers weren't merged because it is a private torrent.").arg(torrent->name()), QMessageBox::Ok);
}
else {
torrent->addTrackers(magnetUri.trackers());
torrent->addUrlSeeds(magnetUri.urlSeeds());
MessageBoxRaised::information(this, tr("Already in the download list"), tr("Magnet link '%1' is already in the download list. Trackers were merged.").arg(torrent->name()), QMessageBox::Ok);
RaisedMessageBox::information(this, tr("Already in the download list"), tr("Magnet link '%1' is already in the download list. Trackers were merged.").arg(torrent->name()), QMessageBox::Ok);
}
}
else {
MessageBoxRaised::critical(this, tr("Cannot add torrent"), tr("Cannot add this torrent. Perhaps it is already in adding."), QMessageBox::Ok);
RaisedMessageBox::critical(this, tr("Cannot add torrent"), tr("Cannot add this torrent. Perhaps it is already in adding."), QMessageBox::Ok);
}
return false;
}
@ -490,7 +490,7 @@ void AddNewTorrentDialog::renameSelectedFile() @@ -490,7 +490,7 @@ void AddNewTorrentDialog::renameSelectedFile()
if (!ok) return;
if (newName.isEmpty() || !Utils::Fs::isValidFileSystemName(newName)) {
MessageBoxRaised::warning(this, tr("Rename error"),
RaisedMessageBox::warning(this, tr("Rename error"),
tr("The name is empty or contains forbidden characters, please choose a different one."),
QMessageBox::Ok);
return;
@ -515,7 +515,7 @@ void AddNewTorrentDialog::renameSelectedFile() @@ -515,7 +515,7 @@ void AddNewTorrentDialog::renameSelectedFile()
for (int i = 0; i < m_torrentInfo.filesCount(); ++i) {
if (i == fileIndex) continue;
if (Utils::Fs::sameFileNames(m_torrentInfo.filePath(i), newFilePath)) {
MessageBoxRaised::warning(this, tr("Rename error"),
RaisedMessageBox::warning(this, tr("Rename error"),
tr("This name is already in use in this folder. Please use a different name."),
QMessageBox::Ok);
return;
@ -553,7 +553,7 @@ void AddNewTorrentDialog::renameSelectedFile() @@ -553,7 +553,7 @@ void AddNewTorrentDialog::renameSelectedFile()
#else
if (currentName.startsWith(newPath, Qt::CaseInsensitive)) {
#endif
MessageBoxRaised::warning(this, tr("The folder could not be renamed"),
RaisedMessageBox::warning(this, tr("The folder could not be renamed"),
tr("This name is already in use in this folder. Please use a different name."),
QMessageBox::Ok);
return;
@ -696,7 +696,7 @@ void AddNewTorrentDialog::updateMetadata(const BitTorrent::TorrentInfo &info) @@ -696,7 +696,7 @@ void AddNewTorrentDialog::updateMetadata(const BitTorrent::TorrentInfo &info)
disconnect(this, SLOT(updateMetadata(BitTorrent::TorrentInfo)));
if (!info.isValid()) {
MessageBoxRaised::critical(this, tr("I/O Error"), ("Invalid metadata."));
RaisedMessageBox::critical(this, tr("I/O Error"), ("Invalid metadata."));
setMetadataProgressIndicator(false, tr("Invalid metadata"));
return;
}
@ -763,7 +763,7 @@ void AddNewTorrentDialog::setupTreeview() @@ -763,7 +763,7 @@ void AddNewTorrentDialog::setupTreeview()
void AddNewTorrentDialog::handleDownloadFailed(const QString &url, const QString &reason)
{
MessageBoxRaised::critical(this, tr("Download Error"),
RaisedMessageBox::critical(this, tr("Download Error"),
QString("Cannot download '%1': %2").arg(url, reason));
this->deleteLater();
}

18
src/gui/banlistoptions.cpp → src/gui/banlistoptionsdialog.cpp

@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
* exception statement from your version.
*/
#include "banlistoptions.h"
#include "banlistoptionsdialog.h"
#include <QHostAddress>
#include <QMessageBox>
@ -35,12 +35,12 @@ @@ -35,12 +35,12 @@
#include "base/bittorrent/session.h"
#include "base/utils/net.h"
#include "ui_banlistoptions.h"
#include "ui_banlistoptionsdialog.h"
#include "utils.h"
BanListOptions::BanListOptions(QWidget *parent)
BanListOptionsDialog::BanListOptionsDialog(QWidget *parent)
: QDialog(parent)
, m_ui(new Ui::BanListOptions)
, m_ui(new Ui::BanListOptionsDialog)
, m_modified(false)
{
m_ui->setupUi(this);
@ -57,12 +57,12 @@ BanListOptions::BanListOptions(QWidget *parent) @@ -57,12 +57,12 @@ BanListOptions::BanListOptions(QWidget *parent)
Utils::Gui::resize(this);
}
BanListOptions::~BanListOptions()
BanListOptionsDialog::~BanListOptionsDialog()
{
delete m_ui;
}
void BanListOptions::on_buttonBox_accepted()
void BanListOptionsDialog::on_buttonBox_accepted()
{
if (m_modified) {
// save to session
@ -80,7 +80,7 @@ void BanListOptions::on_buttonBox_accepted() @@ -80,7 +80,7 @@ void BanListOptions::on_buttonBox_accepted()
}
}
void BanListOptions::on_buttonBanIP_clicked()
void BanListOptionsDialog::on_buttonBanIP_clicked()
{
QString ip = m_ui->txtIP->text();
if (!Utils::Net::isValidIP(ip)) {
@ -105,7 +105,7 @@ void BanListOptions::on_buttonBanIP_clicked() @@ -105,7 +105,7 @@ void BanListOptions::on_buttonBanIP_clicked()
m_modified = true;
}
void BanListOptions::on_buttonDeleteIP_clicked()
void BanListOptionsDialog::on_buttonDeleteIP_clicked()
{
QModelIndexList selection = m_ui->bannedIPList->selectionModel()->selectedIndexes();
for (auto &i : selection)
@ -114,7 +114,7 @@ void BanListOptions::on_buttonDeleteIP_clicked() @@ -114,7 +114,7 @@ void BanListOptions::on_buttonDeleteIP_clicked()
m_modified = true;
}
void BanListOptions::on_txtIP_textChanged(const QString &ip)
void BanListOptionsDialog::on_txtIP_textChanged(const QString &ip)
{
m_ui->buttonBanIP->setEnabled(Utils::Net::isValidIP(ip));
}

16
src/gui/banlistoptions.h → src/gui/banlistoptionsdialog.h

@ -26,8 +26,8 @@ @@ -26,8 +26,8 @@
* exception statement from your version.
*/
#ifndef OPTIONS_BANLIST_H
#define OPTIONS_BANLIST_H
#ifndef BANLISTOPTIONSDIALOG_H
#define BANLISTOPTIONSDIALOG_H
#include <QDialog>
@ -36,16 +36,16 @@ class QStringListModel; @@ -36,16 +36,16 @@ class QStringListModel;
namespace Ui
{
class BanListOptions;
class BanListOptionsDialog;
}
class BanListOptions : public QDialog
class BanListOptionsDialog : public QDialog
{
Q_OBJECT
public:
explicit BanListOptions(QWidget *parent = nullptr);
~BanListOptions();
explicit BanListOptionsDialog(QWidget *parent = nullptr);
~BanListOptionsDialog();
private slots:
void on_buttonBox_accepted();
@ -54,10 +54,10 @@ private slots: @@ -54,10 +54,10 @@ private slots:
void on_txtIP_textChanged(const QString &ip);
private:
Ui::BanListOptions *m_ui;
Ui::BanListOptionsDialog *m_ui;
QStringListModel *m_model;
QSortFilterProxyModel *m_sortFilter;
bool m_modified;
};
#endif // OPTIONS_BANLIST_H
#endif // BANLISTOPTIONSDIALOG_H

6
src/gui/banlistoptions.ui → src/gui/banlistoptionsdialog.ui

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BanListOptions</class>
<widget class="QDialog" name="BanListOptions">
<class>BanListOptionsDialog</class>
<widget class="QDialog" name="BanListOptionsDialog">
<property name="geometry">
<rect>
<x>0</x>
@ -110,7 +110,7 @@ @@ -110,7 +110,7 @@
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>BanListOptions</receiver>
<receiver>BanListOptionsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">

16
src/gui/deletionconfirmationdlg.h → src/gui/deletionconfirmationdialog.h

@ -26,8 +26,8 @@ @@ -26,8 +26,8 @@
* exception statement from your version.
*/
#ifndef DELETIONCONFIRMATIONDLG_H
#define DELETIONCONFIRMATIONDLG_H
#ifndef DELETIONCONFIRMATIONDIALOG_H
#define DELETIONCONFIRMATIONDIALOG_H
#include <QDialog>
#include <QPushButton>
@ -36,15 +36,15 @@ @@ -36,15 +36,15 @@
#include "base/utils/misc.h"
#include "base/utils/string.h"
#include "guiiconprovider.h"
#include "ui_confirmdeletiondlg.h"
#include "ui_deletionconfirmationdialog.h"
#include "utils.h"
class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg
class DeletionConfirmationDialog : public QDialog, private Ui::DeletionConfirmationDialog
{
Q_OBJECT
public:
DeletionConfirmationDlg(QWidget *parent, const int &size, const QString &name, bool defaultDeleteFiles)
DeletionConfirmationDialog(QWidget *parent, const int &size, const QString &name, bool defaultDeleteFiles)
: QDialog(parent)
{
setupUi(this);
@ -60,7 +60,7 @@ public: @@ -60,7 +60,7 @@ public:
rememberBtn->setIconSize(Utils::Gui::mediumIconSize());
checkPermDelete->setChecked(defaultDeleteFiles || Preferences::instance()->deleteTorrentFilesAsDefault());
connect(checkPermDelete, &QCheckBox::clicked, this, &DeletionConfirmationDlg::updateRememberButtonState);
connect(checkPermDelete, &QCheckBox::clicked, this, &DeletionConfirmationDialog::updateRememberButtonState);
buttonBox->button(QDialogButtonBox::Cancel)->setFocus();
Utils::Gui::resize(this);
@ -73,7 +73,7 @@ public: @@ -73,7 +73,7 @@ public:
static bool askForDeletionConfirmation(QWidget *parent, bool &deleteLocalFiles, const int &size, const QString &name)
{
DeletionConfirmationDlg dlg(parent, size, name, deleteLocalFiles);
DeletionConfirmationDialog dlg(parent, size, name, deleteLocalFiles);
if (dlg.exec() == QDialog::Accepted) {
deleteLocalFiles = dlg.shouldDeleteLocalFiles();
return true;
@ -94,4 +94,4 @@ private slots: @@ -94,4 +94,4 @@ private slots:
}
};
#endif // DELETIONCONFIRMATIONDLG_H
#endif // DELETIONCONFIRMATIONDIALOG_H

8
src/gui/confirmdeletiondlg.ui → src/gui/deletionconfirmationdialog.ui

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>confirmDeletionDlg</class>
<widget class="QDialog" name="confirmDeletionDlg">
<class>DeletionConfirmationDialog</class>
<widget class="QDialog" name="DeletionConfirmationDialog">
<property name="geometry">
<rect>
<x>0</x>
@ -120,7 +120,7 @@ @@ -120,7 +120,7 @@
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>confirmDeletionDlg</receiver>
<receiver>DeletionConfirmationDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
@ -136,7 +136,7 @@ @@ -136,7 +136,7 @@
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>confirmDeletionDlg</receiver>
<receiver>DeletionConfirmationDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">

20
src/gui/executionlog.cpp → src/gui/executionlogwidget.cpp

@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
* exception statement from your version.
*/
#include "executionlog.h"
#include "executionlogwidget.h"
#include <QColor>
#include <QDateTime>
@ -36,11 +36,11 @@ @@ -36,11 +36,11 @@
#include "guiiconprovider.h"
#include "loglistwidget.h"
#include "ui_executionlog.h"
#include "ui_executionlogwidget.h"
ExecutionLog::ExecutionLog(QWidget *parent, const Log::MsgTypes &types)
ExecutionLogWidget::ExecutionLogWidget(QWidget *parent, const Log::MsgTypes &types)
: QWidget(parent)
, m_ui(new Ui::ExecutionLog)
, m_ui(new Ui::ExecutionLogWidget)
, m_peerList(new LogListWidget(MAX_LOG_MESSAGES))
{
m_ui->setupUi(this);
@ -59,23 +59,23 @@ ExecutionLog::ExecutionLog(QWidget *parent, const Log::MsgTypes &types) @@ -59,23 +59,23 @@ ExecutionLog::ExecutionLog(QWidget *parent, const Log::MsgTypes &types)
addLogMessage(msg);
foreach (const Log::Peer &peer, logger->getPeers())
addPeerMessage(peer);
connect(logger, &Logger::newLogMessage, this, &ExecutionLog::addLogMessage);
connect(logger, &Logger::newLogPeer, this, &ExecutionLog::addPeerMessage);
connect(logger, &Logger::newLogMessage, this, &ExecutionLogWidget::addLogMessage);
connect(logger, &Logger::newLogPeer, this, &ExecutionLogWidget::addPeerMessage);
}
ExecutionLog::~ExecutionLog()
ExecutionLogWidget::~ExecutionLogWidget()
{
delete m_msgList;
delete m_peerList;
delete m_ui;
}
void ExecutionLog::showMsgTypes(const Log::MsgTypes &types)
void ExecutionLogWidget::showMsgTypes(const Log::MsgTypes &types)
{
m_msgList->showMsgTypes(types);
}
void ExecutionLog::addLogMessage(const Log::Msg &msg)
void ExecutionLogWidget::addLogMessage(const Log::Msg &msg)
{
QString text;
QDateTime time = QDateTime::fromMSecsSinceEpoch(msg.timestamp);
@ -99,7 +99,7 @@ void ExecutionLog::addLogMessage(const Log::Msg &msg) @@ -99,7 +99,7 @@ void ExecutionLog::addLogMessage(const Log::Msg &msg)
m_msgList->appendLine(text, msg.type);
}
void ExecutionLog::addPeerMessage(const Log::Peer &peer)
void ExecutionLogWidget::addPeerMessage(const Log::Peer &peer)
{
QString text;
QDateTime time = QDateTime::fromMSecsSinceEpoch(peer.timestamp);

17
src/gui/executionlog.h → src/gui/executionlogwidget.h

@ -26,37 +26,36 @@ @@ -26,37 +26,36 @@
* exception statement from your version.
*/
#ifndef EXECUTIONLOG_H
#define EXECUTIONLOG_H
#ifndef EXECUTIONLOGWIDGET_H
#define EXECUTIONLOGWIDGET_H
#include <QWidget>
#include "base/logger.h"
namespace Ui
{
class ExecutionLog;
class ExecutionLogWidget;
}
class LogListWidget;
class ExecutionLog : public QWidget
class ExecutionLogWidget : public QWidget
{
Q_OBJECT
public:
ExecutionLog(QWidget *parent, const Log::MsgTypes &types);
ExecutionLogWidget(QWidget *parent, const Log::MsgTypes &types);
void showMsgTypes(const Log::MsgTypes &types);
~ExecutionLog();
~ExecutionLogWidget();
private slots:
void addLogMessage(const Log::Msg &msg);
void addPeerMessage(const Log::Peer &peer);
private:
Ui::ExecutionLog *m_ui;
Ui::ExecutionLogWidget *m_ui;
LogListWidget *m_msgList;
LogListWidget *m_peerList;
};
#endif // EXECUTIONLOG_H
#endif // EXECUTIONLOGWIDGET_H

4
src/gui/executionlog.ui → src/gui/executionlogwidget.ui

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ExecutionLog</class>
<widget class="QWidget" name="ExecutionLog">
<class>ExecutionLogWidget</class>
<widget class="QWidget" name="ExecutionLogWidget">
<property name="geometry">
<rect>
<x>0</x>

82
src/gui/gui.pri

@ -6,19 +6,19 @@ include(properties/properties.pri) @@ -6,19 +6,19 @@ include(properties/properties.pri)
unix:!macx:dbus: include(qtnotify/qtnotify.pri)
HEADERS += \
$$PWD/about_imp.h \
$$PWD/aboutdialog.h \
$$PWD/addnewtorrentdialog.h \
$$PWD/advancedsettings.h \
$$PWD/autoexpandabledialog.h \
$$PWD/banlistoptions.h \
$$PWD/banlistoptionsdialog.h \
$$PWD/categoryfiltermodel.h \
$$PWD/categoryfilterproxymodel.h \
$$PWD/categoryfilterwidget.h \
$$PWD/cookiesdialog.h \
$$PWD/cookiesmodel.h \
$$PWD/deletionconfirmationdlg.h \
$$PWD/deletionconfirmationdialog.h \
$$PWD/downloadfromurldialog.h \
$$PWD/executionlog.h \
$$PWD/executionlogwidget.h \
$$PWD/fspathedit.h \
$$PWD/fspathedit_p.h \
$$PWD/guiiconprovider.h \
@ -26,24 +26,24 @@ HEADERS += \ @@ -26,24 +26,24 @@ HEADERS += \
$$PWD/ipsubnetwhitelistoptionsdialog.h \
$$PWD/loglistwidget.h \
$$PWD/mainwindow.h \
$$PWD/messageboxraised.h \
$$PWD/optionsdlg.h \
$$PWD/optionsdialog.h \
$$PWD/previewlistdelegate.h \
$$PWD/previewselectdialog.h \
$$PWD/raisedmessagebox.h \
$$PWD/rss/articlelistwidget.h \
$$PWD/rss/automatedrssdownloader.h \
$$PWD/rss/feedlistwidget.h \
$$PWD/rss/htmlbrowser.h \
$$PWD/rss/rsswidget.h \
$$PWD/scanfoldersdelegate.h \
$$PWD/search/pluginselectdlg.h \
$$PWD/search/pluginsourcedlg.h \
$$PWD/search/pluginselectdialog.h \
$$PWD/search/pluginsourcedialog.h \
$$PWD/search/searchjobwidget.h \
$$PWD/search/searchlistdelegate.h \
$$PWD/search/searchsortmodel.h \
$$PWD/search/searchtab.h \
$$PWD/search/searchwidget.h \
$$PWD/shutdownconfirmdlg.h \
$$PWD/speedlimitdlg.h \
$$PWD/shutdownconfirmdialog.h \
$$PWD/speedlimitdialog.h \
$$PWD/statsdialog.h \
$$PWD/statusbar.h \
$$PWD/tagfiltermodel.h \
@ -56,51 +56,51 @@ HEADERS += \ @@ -56,51 +56,51 @@ HEADERS += \
$$PWD/torrentcontentmodelfolder.h \
$$PWD/torrentcontentmodelitem.h \
$$PWD/torrentcontenttreeview.h \
$$PWD/torrentcreatordlg.h \
$$PWD/torrentmodel.h \
$$PWD/trackerlogin.h \
$$PWD/torrentcreatordialog.h \
$$PWD/trackerlogindialog.h \
$$PWD/transferlistdelegate.h \
$$PWD/transferlistfilterswidget.h \
$$PWD/transferlistmodel.h \
$$PWD/transferlistsortmodel.h \
$$PWD/transferlistwidget.h \
$$PWD/updownratiodlg.h \
$$PWD/updownratiodialog.h \
$$PWD/utils.h
SOURCES += \
$$PWD/addnewtorrentdialog.cpp \
$$PWD/advancedsettings.cpp \
$$PWD/autoexpandabledialog.cpp \
$$PWD/banlistoptions.cpp \
$$PWD/banlistoptionsdialog.cpp \
$$PWD/categoryfiltermodel.cpp \
$$PWD/categoryfilterproxymodel.cpp \
$$PWD/categoryfilterwidget.cpp \
$$PWD/cookiesdialog.cpp \
$$PWD/cookiesmodel.cpp \
$$PWD/downloadfromurldialog.cpp \
$$PWD/executionlog.cpp \
$$PWD/executionlogwidget.cpp \
$$PWD/fspathedit.cpp \
$$PWD/fspathedit_p.cpp \
$$PWD/guiiconprovider.cpp \
$$PWD/ipsubnetwhitelistoptionsdialog.cpp \
$$PWD/loglistwidget.cpp \
$$PWD/mainwindow.cpp \
$$PWD/messageboxraised.cpp \
$$PWD/optionsdlg.cpp \
$$PWD/optionsdialog.cpp \
$$PWD/previewselectdialog.cpp \
$$PWD/raisedmessagebox.cpp \
$$PWD/rss/articlelistwidget.cpp \
$$PWD/rss/automatedrssdownloader.cpp \
$$PWD/rss/feedlistwidget.cpp \
$$PWD/rss/htmlbrowser.cpp \
$$PWD/rss/rsswidget.cpp \
$$PWD/scanfoldersdelegate.cpp \
$$PWD/search/pluginselectdlg.cpp \
$$PWD/search/pluginsourcedlg.cpp \
$$PWD/search/pluginselectdialog.cpp \
$$PWD/search/pluginsourcedialog.cpp \
$$PWD/search/searchjobwidget.cpp \
$$PWD/search/searchlistdelegate.cpp \
$$PWD/search/searchsortmodel.cpp \
$$PWD/search/searchtab.cpp \
$$PWD/search/searchwidget.cpp \
$$PWD/shutdownconfirmdlg.cpp \
$$PWD/speedlimitdlg.cpp \
$$PWD/shutdownconfirmdialog.cpp \
$$PWD/speedlimitdialog.cpp \
$$PWD/statsdialog.cpp \
$$PWD/statusbar.cpp \
$$PWD/tagfiltermodel.cpp \
@ -113,14 +113,14 @@ SOURCES += \ @@ -113,14 +113,14 @@ SOURCES += \
$$PWD/torrentcontentmodelfolder.cpp \
$$PWD/torrentcontentmodelitem.cpp \
$$PWD/torrentcontenttreeview.cpp \
$$PWD/torrentcreatordlg.cpp \
$$PWD/torrentmodel.cpp \
$$PWD/trackerlogin.cpp \
$$PWD/torrentcreatordialog.cpp \
$$PWD/trackerlogindialog.cpp \
$$PWD/transferlistdelegate.cpp \
$$PWD/transferlistfilterswidget.cpp \
$$PWD/transferlistmodel.cpp \
$$PWD/transferlistsortmodel.cpp \
$$PWD/transferlistwidget.cpp \
$$PWD/updownratiodlg.cpp \
$$PWD/updownratiodialog.cpp \
$$PWD/utils.cpp
win32|macx {
@ -134,30 +134,30 @@ macx { @@ -134,30 +134,30 @@ macx {
}
FORMS += \
$$PWD/about.ui \
$$PWD/aboutdialog.ui \
$$PWD/addnewtorrentdialog.ui \
$$PWD/autoexpandabledialog.ui \
$$PWD/bandwidth_limit.ui \
$$PWD/banlistoptions.ui \
$$PWD/confirmdeletiondlg.ui \
$$PWD/banlistoptionsdialog.ui \
$$PWD/cookiesdialog.ui \
$$PWD/deletionconfirmationdialog.ui \
$$PWD/downloadfromurldialog.ui \
$$PWD/executionlog.ui \
$$PWD/executionlogwidget.ui \
$$PWD/ipsubnetwhitelistoptionsdialog.ui \
$$PWD/login.ui \
$$PWD/mainwindow.ui \
$$PWD/optionsdlg.ui \
$$PWD/optionsdialog.ui \
$$PWD/previewselectdialog.ui \
$$PWD/rss/automatedrssdownloader.ui \
$$PWD/rss/rsswidget.ui \
$$PWD/search/pluginselectdlg.ui \
$$PWD/search/pluginsourcedlg.ui \
$$PWD/search/searchtab.ui \
$$PWD/search/pluginselectdialog.ui \
$$PWD/search/pluginsourcedialog.ui \
$$PWD/search/searchjobwidget.ui \
$$PWD/search/searchwidget.ui \
$$PWD/shutdownconfirmdlg.ui \
$$PWD/shutdownconfirmdialog.ui \
$$PWD/speedlimitdialog.ui \
$$PWD/statsdialog.ui \
$$PWD/torrentcategorydialog.ui \
$$PWD/torrentcreatordlg.ui \
$$PWD/updownratiodlg.ui
$$PWD/torrentcreatordialog.ui \
$$PWD/trackerlogindialog.ui \
$$PWD/updownratiodialog.ui
RESOURCES += $$PWD/about.qrc

22
src/gui/mainwindow.cpp

@ -68,28 +68,28 @@ @@ -68,28 +68,28 @@
#include "base/settingsstorage.h"
#include "base/utils/fs.h"
#include "base/utils/misc.h"
#include "about_imp.h"
#include "aboutdialog.h"
#include "addnewtorrentdialog.h"
#include "application.h"
#include "autoexpandabledialog.h"
#include "cookiesdialog.h"
#include "downloadfromurldialog.h"
#include "executionlog.h"
#include "executionlogwidget.h"
#include "guiiconprovider.h"
#include "hidabletabwidget.h"
#include "lineedit.h"
#include "optionsdlg.h"
#include "optionsdialog.h"
#include "peerlistwidget.h"
#include "powermanagement.h"
#include "propertieswidget.h"
#include "rss/rsswidget.h"
#include "search/searchwidget.h"
#include "speedlimitdlg.h"
#include "speedlimitdialog.h"
#include "statsdialog.h"
#include "statusbar.h"
#include "torrentcreatordlg.h"
#include "torrentmodel.h"
#include "trackerlist.h"
#include "torrentcreatordialog.h"
#include "transferlistmodel.h"
#include "trackerlistwidget.h"
#include "transferlistfilterswidget.h"
#include "transferlistwidget.h"
#include "ui_mainwindow.h"
@ -106,7 +106,7 @@ @@ -106,7 +106,7 @@
#include "programupdater.h"
#endif
#if LIBTORRENT_VERSION_NUM < 10100
#include "trackerlogin.h"
#include "trackerlogindialog.h"
#endif
#ifdef Q_OS_MAC
@ -1187,7 +1187,7 @@ void MainWindow::createTorrentTriggered(const QString &path) @@ -1187,7 +1187,7 @@ void MainWindow::createTorrentTriggered(const QString &path)
m_createTorrentDlg->activateWindow();
}
else
m_createTorrentDlg = new TorrentCreatorDlg(this, path);
m_createTorrentDlg = new TorrentCreatorDialog(this, path);
}
bool MainWindow::event(QEvent *e)
@ -1507,7 +1507,7 @@ void MainWindow::trackerAuthenticationRequired(BitTorrent::TorrentHandle *const @@ -1507,7 +1507,7 @@ void MainWindow::trackerAuthenticationRequired(BitTorrent::TorrentHandle *const
#if LIBTORRENT_VERSION_NUM < 10100
if (m_unauthenticatedTrackers.indexOf(qMakePair(torrent, torrent->currentTracker())) < 0)
// Tracker login
new trackerLogin(this, torrent);
new TrackerLoginDialog(this, torrent);
#else
Q_UNUSED(torrent);
#endif
@ -1882,7 +1882,7 @@ void MainWindow::on_actionExecutionLogs_triggered(bool checked) @@ -1882,7 +1882,7 @@ void MainWindow::on_actionExecutionLogs_triggered(bool checked)
{
if (checked) {
Q_ASSERT(!m_executionLog);
m_executionLog = new ExecutionLog(m_tabs, static_cast<Log::MsgType>(executionLogMsgTypes()));
m_executionLog = new ExecutionLogWidget(m_tabs, static_cast<Log::MsgType>(executionLogMsgTypes()));
#ifdef Q_OS_MAC
m_tabs->addTab(m_executionLog, tr("Execution Log"));
#else

8
src/gui/mainwindow.h

@ -52,9 +52,9 @@ class TransferListWidget; @@ -52,9 +52,9 @@ class TransferListWidget;
class TransferListFiltersWidget;
class PropertiesWidget;
class StatusBar;
class TorrentCreatorDlg;
class TorrentCreatorDialog;
class LineEdit;
class ExecutionLog;
class ExecutionLogWidget;
class PowerManagement;
class StatsDialog;
@ -227,7 +227,7 @@ private: @@ -227,7 +227,7 @@ private:
QPointer<OptionsDialog> m_options;
QPointer<AboutDialog> m_aboutDlg;
QPointer<StatsDialog> m_statsDlg;
QPointer<TorrentCreatorDlg> m_createTorrentDlg;
QPointer<TorrentCreatorDialog> m_createTorrentDlg;
QPointer<DownloadFromURLDialog> m_downloadFromURLDialog;
#ifndef Q_OS_MAC
QPointer<QSystemTrayIcon> m_systrayIcon;
@ -249,7 +249,7 @@ private: @@ -249,7 +249,7 @@ private:
QSplitter *m_splitter;
QPointer<SearchWidget> m_searchWidget;
QPointer<RSSWidget> m_rssWidget;
QPointer<ExecutionLog> m_executionLog;
QPointer<ExecutionLogWidget> m_executionLog;
// Power Management
PowerManagement *m_pwr;
QTimer *m_preventTimer;

9
src/gui/optionsdlg.cpp → src/gui/optionsdialog.cpp

@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
* exception statement from your version.
*/
#include "optionsdlg.h"
#include "optionsdialog.h"
#include <cstdlib>
@ -63,15 +63,14 @@ @@ -63,15 +63,14 @@
#include "addnewtorrentdialog.h"
#include "advancedsettings.h"
#include "app/application.h"
#include "banlistoptions.h"
#include "banlistoptionsdialog.h"
#include "ipsubnetwhitelistoptionsdialog.h"
#include "guiiconprovider.h"
#include "rss/automatedrssdownloader.h"
#include "scanfoldersdelegate.h"
#include "ui_optionsdialog.h"
#include "utils.h"
#include "ui_optionsdlg.h"
class WheelEventEater : public QObject
{
public:
@ -1807,7 +1806,7 @@ bool OptionsDialog::webUIAuthenticationOk() @@ -1807,7 +1806,7 @@ bool OptionsDialog::webUIAuthenticationOk()
void OptionsDialog::on_banListButton_clicked()
{
// call dialog window
if (BanListOptions(this).exec() == QDialog::Accepted)
if (BanListOptionsDialog(this).exec() == QDialog::Accepted)
enableApplyButton();
}

6
src/gui/optionsdlg.h → src/gui/optionsdialog.h

@ -26,8 +26,8 @@ @@ -26,8 +26,8 @@
* exception statement from your version.
*/
#ifndef OPTIONSDLG_H
#define OPTIONSDLG_H
#ifndef OPTIONSDIALOG_H
#define OPTIONSDIALOG_H
#include <QButtonGroup>
#include <QDialog>
@ -186,4 +186,4 @@ private: @@ -186,4 +186,4 @@ private:
QList<QString> removedScanDirs;
};
#endif // OPTIONSDLG_H
#endif // OPTIONSDIALOG_H

0
src/gui/optionsdlg.ui → src/gui/optionsdialog.ui

43
src/gui/properties/CMakeLists.txt

@ -1,33 +1,38 @@ @@ -1,33 +1,38 @@
add_library(qbt_properties STATIC
propertieswidget.ui
trackersadditiondlg.ui
peersadditiondlg.ui
propertieswidget.h
peerlistwidget.h
proplistdelegate.h
trackerlist.h
# headers
downloadedpiecesbar.h
piecesbar.h
peerlistdelegate.h
peerlistsortmodel.h
peersadditiondlg.h
trackersadditiondlg.h
peerlistwidget.h
peersadditiondialog.h
pieceavailabilitybar.h
piecesbar.h
propertieswidget.h
proplistdelegate.h
proptabbar.h
speedwidget.h
speedplotview.h
propertieswidget.cpp
proplistdelegate.cpp
peerlistwidget.cpp
trackerlist.cpp
peersadditiondlg.cpp
speedwidget.h
trackerlistwidget.h
trackersadditiondialog.h
# sources
downloadedpiecesbar.cpp
piecesbar.cpp
trackersadditiondlg.cpp
peerlistwidget.cpp
peersadditiondialog.cpp
pieceavailabilitybar.cpp
piecesbar.cpp
propertieswidget.cpp
proplistdelegate.cpp
proptabbar.cpp
speedwidget.cpp
speedplotview.cpp
speedwidget.cpp
trackerlistwidget.cpp
trackersadditiondialog.cpp
# forms
peersadditiondialog.ui
propertieswidget.ui
trackersadditiondialog.ui
)
target_link_libraries(qbt_properties

6
src/gui/properties/peerlistwidget.cpp

@ -49,9 +49,9 @@ @@ -49,9 +49,9 @@
#include "guiiconprovider.h"
#include "peerlistdelegate.h"
#include "peerlistsortmodel.h"
#include "peersadditiondlg.h"
#include "peersadditiondialog.h"
#include "propertieswidget.h"
#include "speedlimitdlg.h"
#include "speedlimitdialog.h"
PeerListWidget::PeerListWidget(PropertiesWidget *parent)
: QTreeView(parent)
@ -247,7 +247,7 @@ void PeerListWidget::showPeerListMenu(const QPoint &) @@ -247,7 +247,7 @@ void PeerListWidget::showPeerListMenu(const QPoint &)
if (!act) return;
if (act == addPeerAct) {
QList<BitTorrent::PeerAddress> peersList = PeersAdditionDlg::askForPeers(this);
QList<BitTorrent::PeerAddress> peersList = PeersAdditionDialog::askForPeers(this);
int peerCount = 0;
foreach (const BitTorrent::PeerAddress &addr, peersList) {
if (torrent->connectPeer(addr)) {

20
src/gui/properties/peersadditiondlg.cpp → src/gui/properties/peersadditiondialog.cpp

@ -26,34 +26,34 @@ @@ -26,34 +26,34 @@
* exception statement from your version.
*/
#include "peersadditiondlg.h"
#include "peersadditiondialog.h"
#include <QHostAddress>
#include <QMessageBox>
#include "ui_peersadditiondlg.h"
#include "ui_peersadditiondialog.h"
PeersAdditionDlg::PeersAdditionDlg(QWidget *parent)
PeersAdditionDialog::PeersAdditionDialog(QWidget *parent)
: QDialog(parent)
, m_ui(new Ui::addPeersDialog())
, m_ui(new Ui::PeersAdditionDialog())
{
m_ui->setupUi(this);
connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &PeersAdditionDlg::validateInput);
connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &PeersAdditionDialog::validateInput);
}
PeersAdditionDlg::~PeersAdditionDlg()
PeersAdditionDialog::~PeersAdditionDialog()
{
delete m_ui;
}
QList<BitTorrent::PeerAddress> PeersAdditionDlg::askForPeers(QWidget *parent)
QList<BitTorrent::PeerAddress> PeersAdditionDialog::askForPeers(QWidget *parent)
{
PeersAdditionDlg dlg(parent);
PeersAdditionDialog dlg(parent);
dlg.exec();
return dlg.m_peersList;
}
void PeersAdditionDlg::validateInput()
void PeersAdditionDialog::validateInput()
{
if (m_ui->peers_txt->toPlainText().trimmed().isEmpty()) {
QMessageBox::warning(this, tr("No peer entered"),
@ -77,7 +77,7 @@ void PeersAdditionDlg::validateInput() @@ -77,7 +77,7 @@ void PeersAdditionDlg::validateInput()
accept();
}
BitTorrent::PeerAddress PeersAdditionDlg::parsePeer(QString peer)
BitTorrent::PeerAddress PeersAdditionDialog::parsePeer(QString peer)
{
BitTorrent::PeerAddress addr;
QStringList ipPort;

10
src/gui/properties/peersadditiondlg.h → src/gui/properties/peersadditiondialog.h

@ -36,16 +36,16 @@ @@ -36,16 +36,16 @@
namespace Ui
{
class addPeersDialog;
class PeersAdditionDialog;
}
class PeersAdditionDlg : public QDialog
class PeersAdditionDialog : public QDialog
{
Q_OBJECT
public:
PeersAdditionDlg(QWidget *parent);
~PeersAdditionDlg();
PeersAdditionDialog(QWidget *parent);
~PeersAdditionDialog();
static QList<BitTorrent::PeerAddress> askForPeers(QWidget *parent);
@ -55,7 +55,7 @@ protected slots: @@ -55,7 +55,7 @@ protected slots:
private:
BitTorrent::PeerAddress parsePeer(QString peer);
Ui::addPeersDialog *m_ui;
Ui::PeersAdditionDialog *m_ui;
QList<BitTorrent::PeerAddress> m_peersList;
};

6
src/gui/properties/peersadditiondlg.ui → src/gui/properties/peersadditiondialog.ui

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>addPeersDialog</class>
<widget class="QDialog" name="addPeersDialog">
<class>PeersAdditionDialog</class>
<widget class="QDialog" name="PeersAdditionDialog">
<property name="geometry">
<rect>
<x>0</x>
@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>addPeersDialog</receiver>
<receiver>PeersAdditionDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">

16
src/gui/properties/properties.pri

@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
INCLUDEPATH += $$PWD
FORMS += \
$$PWD/peersadditiondlg.ui \
$$PWD/peersadditiondialog.ui \
$$PWD/propertieswidget.ui \
$$PWD/trackersadditiondlg.ui
$$PWD/trackersadditiondialog.ui
HEADERS += \
$$PWD/downloadedpiecesbar.h \
$$PWD/peerlistdelegate.h \
$$PWD/peerlistsortmodel.h \
$$PWD/peerlistwidget.h \
$$PWD/peersadditiondlg.h \
$$PWD/peersadditiondialog.h \
$$PWD/pieceavailabilitybar.h \
$$PWD/piecesbar.h \
$$PWD/propertieswidget.h \
@ -18,13 +18,13 @@ HEADERS += \ @@ -18,13 +18,13 @@ HEADERS += \
$$PWD/proptabbar.h \
$$PWD/speedplotview.h \
$$PWD/speedwidget.h \
$$PWD/trackerlist.h \
$$PWD/trackersadditiondlg.h
$$PWD/trackerlistwidget.h \
$$PWD/trackersadditiondialog.h
SOURCES += \
$$PWD/downloadedpiecesbar.cpp \
$$PWD/peerlistwidget.cpp \
$$PWD/peersadditiondlg.cpp \
$$PWD/peersadditiondialog.cpp \
$$PWD/pieceavailabilitybar.cpp \
$$PWD/piecesbar.cpp \
$$PWD/propertieswidget.cpp \
@ -32,5 +32,5 @@ SOURCES += \ @@ -32,5 +32,5 @@ SOURCES += \
$$PWD/proptabbar.cpp \
$$PWD/speedplotview.cpp \
$$PWD/speedwidget.cpp \
$$PWD/trackerlist.cpp \
$$PWD/trackersadditiondlg.cpp
$$PWD/trackerlistwidget.cpp \
$$PWD/trackersadditiondialog.cpp

16
src/gui/properties/propertieswidget.cpp

@ -52,15 +52,15 @@ @@ -52,15 +52,15 @@
#include "guiiconprovider.h"
#include "lineedit.h"
#include "mainwindow.h"
#include "messageboxraised.h"
#include "peerlistwidget.h"
#include "pieceavailabilitybar.h"
#include "proplistdelegate.h"
#include "proptabbar.h"
#include "raisedmessagebox.h"
#include "speedwidget.h"
#include "torrentcontentfiltermodel.h"
#include "torrentcontentmodel.h"
#include "trackerlist.h"
#include "trackerlistwidget.h"
#include "transferlistwidget.h"
#include "utils.h"
@ -132,13 +132,13 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow *mainWindow, Tran @@ -132,13 +132,13 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow *mainWindow, Tran
m_piecesAvailability->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
// Tracker list
m_trackerList = new TrackerList(this);
m_trackerList = new TrackerListWidget(this);
m_ui->trackerUpButton->setIcon(GuiIconProvider::instance()->getIcon("go-up"));
m_ui->trackerUpButton->setIconSize(Utils::Gui::smallIconSize());
m_ui->trackerDownButton->setIcon(GuiIconProvider::instance()->getIcon("go-down"));
m_ui->trackerDownButton->setIconSize(Utils::Gui::smallIconSize());
connect(m_ui->trackerUpButton, &QPushButton::clicked, m_trackerList, &TrackerList::moveSelectionUp);
connect(m_ui->trackerDownButton, &QPushButton::clicked, m_trackerList, &TrackerList::moveSelectionDown);
connect(m_ui->trackerUpButton, &QPushButton::clicked, m_trackerList, &TrackerListWidget::moveSelectionUp);
connect(m_ui->trackerDownButton, &QPushButton::clicked, m_trackerList, &TrackerListWidget::moveSelectionDown);
m_ui->horizontalLayout_trackers->insertWidget(0, m_trackerList);
// Peers list
m_peerList = new PeerListWidget(this);
@ -276,7 +276,7 @@ BitTorrent::TorrentHandle *PropertiesWidget::getCurrentTorrent() const @@ -276,7 +276,7 @@ BitTorrent::TorrentHandle *PropertiesWidget::getCurrentTorrent() const
return m_torrent;
}
TrackerList *PropertiesWidget::getTrackerList() const
TrackerListWidget *PropertiesWidget::getTrackerList() const
{
return m_trackerList;
}
@ -693,7 +693,7 @@ void PropertiesWidget::renameSelectedFile() @@ -693,7 +693,7 @@ void PropertiesWidget::renameSelectedFile()
if (!ok) return;
if (newName.isEmpty() || !Utils::Fs::isValidFileSystemName(newName)) {
MessageBoxRaised::warning(this, tr("Rename error"),
RaisedMessageBox::warning(this, tr("Rename error"),
tr("The name is empty or contains forbidden characters, please choose a different one."),
QMessageBox::Ok);
return;
@ -722,7 +722,7 @@ void PropertiesWidget::renameSelectedFile() @@ -722,7 +722,7 @@ void PropertiesWidget::renameSelectedFile()
for (int i = 0; i < m_torrent->filesCount(); ++i) {
if (i == fileIndex) continue;
if (Utils::Fs::sameFileNames(m_torrent->filePath(i), newFilePath)) {
MessageBoxRaised::warning(this, tr("Rename error"),
RaisedMessageBox::warning(this, tr("Rename error"),
tr("This name is already in use in this folder. Please use a different name."),
QMessageBox::Ok);
return;

6
src/gui/properties/propertieswidget.h

@ -49,7 +49,7 @@ class PropTabBar; @@ -49,7 +49,7 @@ class PropTabBar;
class SpeedWidget;
class torrent_file;
class TorrentContentFilterModel;
class TrackerList;
class TrackerListWidget;
class TransferListWidget;
namespace Ui
@ -72,7 +72,7 @@ public: @@ -72,7 +72,7 @@ public:
PropertiesWidget(QWidget *parent, MainWindow *mainWindow, TransferListWidget *transferList);
~PropertiesWidget();
BitTorrent::TorrentHandle *getCurrentTorrent() const;
TrackerList *getTrackerList() const;
TrackerListWidget *getTrackerList() const;
PeerListWidget *getPeerList() const;
QTreeView *getFilesList() const;
SpeedWidget *getSpeedWidget() const;
@ -120,7 +120,7 @@ private: @@ -120,7 +120,7 @@ private:
TorrentContentFilterModel *m_propListModel;
PropListDelegate *m_propListDelegate;
PeerListWidget *m_peerList;
TrackerList *m_trackerList;
TrackerListWidget *m_trackerList;
SpeedWidget *m_speedWidget;
QList<int> m_slideSizes;
DownloadedPiecesBar *m_downloadedPieces;

64
src/gui/properties/trackerlist.cpp → src/gui/properties/trackerlistwidget.cpp

@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
* exception statement from your version.
*/
#include "trackerlist.h"
#include "trackerlistwidget.h"
#include <QAction>
#include <QApplication>
@ -50,9 +50,9 @@ @@ -50,9 +50,9 @@
#include "autoexpandabledialog.h"
#include "guiiconprovider.h"
#include "propertieswidget.h"
#include "trackersadditiondlg.h"
#include "trackersadditiondialog.h"
TrackerList::TrackerList(PropertiesWidget *properties)
TrackerListWidget::TrackerListWidget(PropertiesWidget *properties)
: QTreeWidget()
, m_properties(properties)
{
@ -78,13 +78,13 @@ TrackerList::TrackerList(PropertiesWidget *properties) @@ -78,13 +78,13 @@ TrackerList::TrackerList(PropertiesWidget *properties)
resizeColumnToContents(i);
// Context menu
setContextMenuPolicy(Qt::CustomContextMenu);
connect(this, &QWidget::customContextMenuRequested, this, &TrackerList::showTrackerListMenu);
connect(this, &QWidget::customContextMenuRequested, this, &TrackerListWidget::showTrackerListMenu);
// Header
header()->setContextMenuPolicy(Qt::CustomContextMenu);
connect(header(), &QWidget::customContextMenuRequested, this, &TrackerList::displayToggleColumnsMenu);
connect(header(), &QHeaderView::sectionMoved, this, &TrackerList::saveSettings);
connect(header(), &QHeaderView::sectionResized, this, &TrackerList::saveSettings);
connect(header(), &QHeaderView::sortIndicatorChanged, this, &TrackerList::saveSettings);
connect(header(), &QWidget::customContextMenuRequested, this, &TrackerListWidget::displayToggleColumnsMenu);
connect(header(), &QHeaderView::sectionMoved, this, &TrackerListWidget::saveSettings);
connect(header(), &QHeaderView::sectionResized, this, &TrackerListWidget::saveSettings);
connect(header(), &QHeaderView::sortIndicatorChanged, this, &TrackerListWidget::saveSettings);
// Set DHT, PeX, LSD items
m_DHTItem = new QTreeWidgetItem({ "", "** [DHT] **", "", "0", "", "", "0" });
insertTopLevelItem(0, m_DHTItem);
@ -116,12 +116,12 @@ TrackerList::TrackerList(PropertiesWidget *properties) @@ -116,12 +116,12 @@ TrackerList::TrackerList(PropertiesWidget *properties)
headerItem()->setTextAlignment(COL_DOWNLOADED, (Qt::AlignRight | Qt::AlignVCenter));
// Set hotkeys
m_editHotkey = new QShortcut(Qt::Key_F2, this, nullptr, nullptr, Qt::WidgetShortcut);
connect(m_editHotkey, &QShortcut::activated, this, &TrackerList::editSelectedTracker);
connect(this, &QAbstractItemView::doubleClicked, this, &TrackerList::editSelectedTracker);
connect(m_editHotkey, &QShortcut::activated, 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, &TrackerList::deleteSelectedTrackers);
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, &TrackerList::copyTrackerUrl);
connect(m_copyHotkey, &QShortcut::activated, this, &TrackerListWidget::copyTrackerUrl);
// This hack fixes reordering of first column with Qt5.
// https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777
@ -131,12 +131,12 @@ TrackerList::TrackerList(PropertiesWidget *properties) @@ -131,12 +131,12 @@ TrackerList::TrackerList(PropertiesWidget *properties)
unused.setVerticalHeader(new QHeaderView(Qt::Horizontal));
}
TrackerList::~TrackerList()
TrackerListWidget::~TrackerListWidget()
{
saveSettings();
}
QList<QTreeWidgetItem*> TrackerList::getSelectedTrackerItems() const
QList<QTreeWidgetItem*> TrackerListWidget::getSelectedTrackerItems() const
{
const QList<QTreeWidgetItem *> selectedTrackerItems = selectedItems();
QList<QTreeWidgetItem *> selectedTrackers;
@ -148,7 +148,7 @@ QList<QTreeWidgetItem*> TrackerList::getSelectedTrackerItems() const @@ -148,7 +148,7 @@ QList<QTreeWidgetItem*> TrackerList::getSelectedTrackerItems() const
return selectedTrackers;
}
void TrackerList::setRowColor(int row, QColor color)
void TrackerListWidget::setRowColor(int row, QColor color)
{
unsigned int nbColumns = columnCount();
QTreeWidgetItem *item = topLevelItem(row);
@ -156,7 +156,7 @@ void TrackerList::setRowColor(int row, QColor color) @@ -156,7 +156,7 @@ void TrackerList::setRowColor(int row, QColor color)
item->setData(i, Qt::ForegroundRole, color);
}
void TrackerList::moveSelectionUp()
void TrackerListWidget::moveSelectionUp()
{
BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent();
if (!torrent) {
@ -197,7 +197,7 @@ void TrackerList::moveSelectionUp() @@ -197,7 +197,7 @@ void TrackerList::moveSelectionUp()
torrent->forceReannounce();
}
void TrackerList::moveSelectionDown()
void TrackerListWidget::moveSelectionDown()
{
BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent();
if (!torrent) {
@ -238,7 +238,7 @@ void TrackerList::moveSelectionDown() @@ -238,7 +238,7 @@ void TrackerList::moveSelectionDown()
torrent->forceReannounce();
}
void TrackerList::clear()
void TrackerListWidget::clear()
{
qDeleteAll(m_trackerItems);
m_trackerItems.clear();
@ -256,7 +256,7 @@ void TrackerList::clear() @@ -256,7 +256,7 @@ void TrackerList::clear()
m_LSDItem->setText(COL_MSG, "");
}
void TrackerList::loadStickyItems(BitTorrent::TorrentHandle *const torrent)
void TrackerListWidget::loadStickyItems(BitTorrent::TorrentHandle *const torrent)
{
QString working = tr("Working");
QString disabled = tr("Disabled");
@ -320,7 +320,7 @@ void TrackerList::loadStickyItems(BitTorrent::TorrentHandle *const torrent) @@ -320,7 +320,7 @@ void TrackerList::loadStickyItems(BitTorrent::TorrentHandle *const torrent)
m_LSDItem->setText(COL_PEERS, QString::number(peersLSD));
}
void TrackerList::loadTrackers()
void TrackerListWidget::loadTrackers()
{
// Load trackers from torrent handle
BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent();
@ -388,19 +388,19 @@ void TrackerList::loadTrackers() @@ -388,19 +388,19 @@ void TrackerList::loadTrackers()
}
// Ask the user for new trackers and add them to the torrent
void TrackerList::askForTrackers()
void TrackerListWidget::askForTrackers()
{
BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent();
if (!torrent) return;
QList<BitTorrent::TrackerEntry> trackers;
foreach (const QString &tracker, TrackersAdditionDlg::askForTrackers(this, torrent))
foreach (const QString &tracker, TrackersAdditionDialog::askForTrackers(this, torrent))
trackers << tracker;
torrent->addTrackers(trackers);
}
void TrackerList::copyTrackerUrl()
void TrackerListWidget::copyTrackerUrl()
{
QList<QTreeWidgetItem *> selectedTrackerItems = getSelectedTrackerItems();
if (selectedTrackerItems.isEmpty()) return;
@ -415,7 +415,7 @@ void TrackerList::copyTrackerUrl() @@ -415,7 +415,7 @@ void TrackerList::copyTrackerUrl()
}
void TrackerList::deleteSelectedTrackers()
void TrackerListWidget::deleteSelectedTrackers()
{
BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent();
if (!torrent) {
@ -447,7 +447,7 @@ void TrackerList::deleteSelectedTrackers() @@ -447,7 +447,7 @@ void TrackerList::deleteSelectedTrackers()
torrent->forceReannounce();
}
void TrackerList::editSelectedTracker()
void TrackerListWidget::editSelectedTracker()
{
BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent();
if (!torrent) return;
@ -491,7 +491,7 @@ void TrackerList::editSelectedTracker() @@ -491,7 +491,7 @@ void TrackerList::editSelectedTracker()
torrent->forceReannounce();
}
void TrackerList::reannounceSelected()
void TrackerListWidget::reannounceSelected()
{
QList<QTreeWidgetItem *> selItems = selectedItems();
if (selItems.isEmpty()) return;
@ -520,7 +520,7 @@ void TrackerList::reannounceSelected() @@ -520,7 +520,7 @@ void TrackerList::reannounceSelected()
loadTrackers();
}
void TrackerList::showTrackerListMenu(QPoint)
void TrackerListWidget::showTrackerListMenu(QPoint)
{
BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent();
if (!torrent) return;
@ -575,17 +575,17 @@ void TrackerList::showTrackerListMenu(QPoint) @@ -575,17 +575,17 @@ void TrackerList::showTrackerListMenu(QPoint)
}
}
void TrackerList::loadSettings()
void TrackerListWidget::loadSettings()
{
header()->restoreState(Preferences::instance()->getPropTrackerListState());
}
void TrackerList::saveSettings() const
void TrackerListWidget::saveSettings() const
{
Preferences::instance()->setPropTrackerListState(header()->saveState());
}
QStringList TrackerList::headerLabels()
QStringList TrackerListWidget::headerLabels()
{
static const QStringList header {
"#"
@ -601,7 +601,7 @@ QStringList TrackerList::headerLabels() @@ -601,7 +601,7 @@ QStringList TrackerList::headerLabels()
return header;
}
int TrackerList::visibleColumnsCount() const
int TrackerListWidget::visibleColumnsCount() const
{
int visibleCols = 0;
for (unsigned int i = 0; i < COL_COUNT; ++i) {
@ -612,7 +612,7 @@ int TrackerList::visibleColumnsCount() const @@ -612,7 +612,7 @@ int TrackerList::visibleColumnsCount() const
return visibleCols;
}
void TrackerList::displayToggleColumnsMenu(const QPoint &)
void TrackerListWidget::displayToggleColumnsMenu(const QPoint &)
{
QMenu hideshowColumn(this);
hideshowColumn.setTitle(tr("Column visibility"));

8
src/gui/properties/trackerlist.h → src/gui/properties/trackerlistwidget.h

@ -43,10 +43,10 @@ namespace BitTorrent @@ -43,10 +43,10 @@ namespace BitTorrent
class TorrentHandle;
}
class TrackerList : public QTreeWidget
class TrackerListWidget : public QTreeWidget
{
Q_OBJECT
Q_DISABLE_COPY(TrackerList)
Q_DISABLE_COPY(TrackerListWidget)
public:
enum TrackerListColumn
@ -63,8 +63,8 @@ public: @@ -63,8 +63,8 @@ public:
COL_COUNT
};
TrackerList(PropertiesWidget *properties);
~TrackerList();
TrackerListWidget(PropertiesWidget *properties);
~TrackerListWidget();
int visibleColumnsCount() const;

26
src/gui/properties/trackersadditiondlg.cpp → src/gui/properties/trackersadditiondialog.cpp

@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*/
#include "trackersadditiondlg.h"
#include "trackersadditiondialog.h"
#include <QFile>
#include <QMessageBox>
@ -39,11 +39,11 @@ @@ -39,11 +39,11 @@
#include "base/utils/fs.h"
#include "base/utils/misc.h"
#include "guiiconprovider.h"
#include "ui_trackersadditiondlg.h"
#include "ui_trackersadditiondialog.h"
TrackersAdditionDlg::TrackersAdditionDlg(QWidget *parent, BitTorrent::TorrentHandle *const torrent)
TrackersAdditionDialog::TrackersAdditionDialog(QWidget *parent, BitTorrent::TorrentHandle *const torrent)
: QDialog(parent)
, m_ui(new Ui::TrackersAdditionDlg())
, m_ui(new Ui::TrackersAdditionDialog())
, m_torrent(torrent)
{
m_ui->setupUi(this);
@ -51,12 +51,12 @@ TrackersAdditionDlg::TrackersAdditionDlg(QWidget *parent, BitTorrent::TorrentHan @@ -51,12 +51,12 @@ TrackersAdditionDlg::TrackersAdditionDlg(QWidget *parent, BitTorrent::TorrentHan
m_ui->uTorrentListButton->setIcon(GuiIconProvider::instance()->getIcon("download"));
}
TrackersAdditionDlg::~TrackersAdditionDlg()
TrackersAdditionDialog::~TrackersAdditionDialog()
{
delete m_ui;
}
QStringList TrackersAdditionDlg::newTrackers() const
QStringList TrackersAdditionDialog::newTrackers() const
{
QStringList cleanTrackers;
foreach (QString url, m_ui->trackers_list->toPlainText().split('\n')) {
@ -67,18 +67,18 @@ QStringList TrackersAdditionDlg::newTrackers() const @@ -67,18 +67,18 @@ QStringList TrackersAdditionDlg::newTrackers() const
return cleanTrackers;
}
void TrackersAdditionDlg::on_uTorrentListButton_clicked()
void TrackersAdditionDialog::on_uTorrentListButton_clicked()
{
m_ui->uTorrentListButton->setEnabled(false);
Net::DownloadHandler *handler = Net::DownloadManager::instance()->downloadUrl(m_ui->list_url->text(), true);
connect(handler, static_cast<void (Net::DownloadHandler::*)(const QString &, const QString &)>(&Net::DownloadHandler::downloadFinished)
, this, &TrackersAdditionDlg::parseUTorrentList);
connect(handler, &Net::DownloadHandler::downloadFailed, this, &TrackersAdditionDlg::getTrackerError);
, this, &TrackersAdditionDialog::parseUTorrentList);
connect(handler, &Net::DownloadHandler::downloadFailed, this, &TrackersAdditionDialog::getTrackerError);
// Just to show that it takes times
setCursor(Qt::WaitCursor);
}
void TrackersAdditionDlg::parseUTorrentList(const QString &, const QString &path)
void TrackersAdditionDialog::parseUTorrentList(const QString &, const QString &path)
{
QFile listFile(path);
if (!listFile.open(QFile::ReadOnly)) {
@ -123,7 +123,7 @@ void TrackersAdditionDlg::parseUTorrentList(const QString &, const QString &path @@ -123,7 +123,7 @@ void TrackersAdditionDlg::parseUTorrentList(const QString &, const QString &path
QMessageBox::information(this, tr("No change"), tr("No additional trackers were found."), QMessageBox::Ok);
}
void TrackersAdditionDlg::getTrackerError(const QString &, const QString &error)
void TrackersAdditionDialog::getTrackerError(const QString &, const QString &error)
{
// To restore the cursor ...
setCursor(Qt::ArrowCursor);
@ -131,10 +131,10 @@ void TrackersAdditionDlg::getTrackerError(const QString &, const QString &error) @@ -131,10 +131,10 @@ void TrackersAdditionDlg::getTrackerError(const QString &, const QString &error)
QMessageBox::warning(this, tr("Download error"), tr("The trackers list could not be downloaded, reason: %1").arg(error), QMessageBox::Ok);
}
QStringList TrackersAdditionDlg::askForTrackers(QWidget *parent, BitTorrent::TorrentHandle *const torrent)
QStringList TrackersAdditionDialog::askForTrackers(QWidget *parent, BitTorrent::TorrentHandle *const torrent)
{
QStringList trackers;
TrackersAdditionDlg dlg(parent, torrent);
TrackersAdditionDialog dlg(parent, torrent);
if (dlg.exec() == QDialog::Accepted)
return dlg.newTrackers();

10
src/gui/properties/trackersadditiondlg.h → src/gui/properties/trackersadditiondialog.h

@ -41,16 +41,16 @@ namespace BitTorrent @@ -41,16 +41,16 @@ namespace BitTorrent
namespace Ui
{
class TrackersAdditionDlg;
class TrackersAdditionDialog;
}
class TrackersAdditionDlg : public QDialog
class TrackersAdditionDialog : public QDialog
{
Q_OBJECT
public:
TrackersAdditionDlg(QWidget *parent, BitTorrent::TorrentHandle *const torrent);
~TrackersAdditionDlg();
TrackersAdditionDialog(QWidget *parent, BitTorrent::TorrentHandle *const torrent);
~TrackersAdditionDialog();
QStringList newTrackers() const;
static QStringList askForTrackers(QWidget *parent, BitTorrent::TorrentHandle *const torrent);
@ -61,7 +61,7 @@ public slots: @@ -61,7 +61,7 @@ public slots:
void getTrackerError(const QString &, const QString &error);
private:
Ui::TrackersAdditionDlg *m_ui;
Ui::TrackersAdditionDialog *m_ui;
BitTorrent::TorrentHandle *const m_torrent;
};

8
src/gui/properties/trackersadditiondlg.ui → src/gui/properties/trackersadditiondialog.ui

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TrackersAdditionDlg</class>
<widget class="QDialog" name="TrackersAdditionDlg">
<class>TrackersAdditionDialog</class>
<widget class="QDialog" name="TrackersAdditionDialog">
<property name="geometry">
<rect>
<x>0</x>
@ -65,7 +65,7 @@ @@ -65,7 +65,7 @@
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>TrackersAdditionDlg</receiver>
<receiver>TrackersAdditionDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>TrackersAdditionDlg</receiver>
<receiver>TrackersAdditionDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">

18
src/gui/messageboxraised.cpp → src/gui/raisedmessagebox.cpp

@ -26,42 +26,42 @@ @@ -26,42 +26,42 @@
* exception statement from your version.
*/
#include "messageboxraised.h"
#include "raisedmessagebox.h"
MessageBoxRaised::MessageBoxRaised(QMessageBox::Icon icon, const QString &title, const QString &text,
RaisedMessageBox::RaisedMessageBox(QMessageBox::Icon icon, const QString &title, const QString &text,
QMessageBox::StandardButtons buttons, QWidget *parent, Qt::WindowFlags f)
: QMessageBox(icon, title, text, buttons, parent, f)
{
}
QMessageBox::StandardButton MessageBoxRaised::impl(const QMessageBox::Icon &icon, QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
QMessageBox::StandardButton RaisedMessageBox::impl(const QMessageBox::Icon &icon, QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
{
MessageBoxRaised dlg(icon, title, text, buttons, parent);
RaisedMessageBox dlg(icon, title, text, buttons, parent);
dlg.setDefaultButton(defaultButton);
return static_cast<QMessageBox::StandardButton>(dlg.exec());
}
QMessageBox::StandardButton MessageBoxRaised::critical(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
QMessageBox::StandardButton RaisedMessageBox::critical(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
{
return impl(Critical, parent, title, text, buttons, defaultButton);
}
QMessageBox::StandardButton MessageBoxRaised::information(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
QMessageBox::StandardButton RaisedMessageBox::information(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
{
return impl(Information, parent, title, text, buttons, defaultButton);
}
QMessageBox::StandardButton MessageBoxRaised::question(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
QMessageBox::StandardButton RaisedMessageBox::question(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
{
return impl(Question, parent, title, text, buttons, defaultButton);
}
QMessageBox::StandardButton MessageBoxRaised::warning(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
QMessageBox::StandardButton RaisedMessageBox::warning(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
{
return impl(Warning, parent, title, text, buttons, defaultButton);
}
void MessageBoxRaised::showEvent(QShowEvent *event)
void RaisedMessageBox::showEvent(QShowEvent *event)
{
QMessageBox::showEvent(event);
activateWindow();

16
src/gui/messageboxraised.h → src/gui/raisedmessagebox.h

@ -26,12 +26,12 @@ @@ -26,12 +26,12 @@
* exception statement from your version.
*/
#ifndef MESSAGEBOXRAISED_H
#define MESSAGEBOXRAISED_H
#ifndef RAISEDMESSAGEBOX_H
#define RAISEDMESSAGEBOX_H
#include <QMessageBox>
class MessageBoxRaised : public QMessageBox
class RaisedMessageBox : public QMessageBox
{
Q_OBJECT
@ -45,12 +45,12 @@ protected: @@ -45,12 +45,12 @@ protected:
void showEvent(QShowEvent *event) override;
private:
MessageBoxRaised(QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = NoButton, QWidget *parent = nullptr, Qt::WindowFlags f = Qt::Dialog|Qt::MSWindowsFixedSizeDialogHint);
MessageBoxRaised();
MessageBoxRaised(MessageBoxRaised const&);
void operator=(MessageBoxRaised const&);
RaisedMessageBox(QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = NoButton, QWidget *parent = nullptr, Qt::WindowFlags f = Qt::Dialog|Qt::MSWindowsFixedSizeDialogHint);
RaisedMessageBox();
RaisedMessageBox(RaisedMessageBox const&);
void operator=(RaisedMessageBox const&);
static QMessageBox::StandardButton impl(const QMessageBox::Icon &icon, QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
};
#endif // MESSAGEBOXRAISED_H
#endif // RAISEDMESSAGEBOX_H

5
src/gui/rss/CMakeLists.txt

@ -1,14 +1,19 @@ @@ -1,14 +1,19 @@
add_library(qbt_rss STATIC
# headers
articlelistwidget.h
automatedrssdownloader.h
feedlistwidget.h
htmlbrowser.h
rsswidget.h
#sources
articlelistwidget.cpp
automatedrssdownloader.cpp
feedlistwidget.cpp
htmlbrowser.cpp
rsswidget.cpp
# forms
automatedrssdownloader.ui
rsswidget.ui
)

23
src/gui/search/CMakeLists.txt

@ -1,19 +1,24 @@ @@ -1,19 +1,24 @@
add_library(qbt_searchengine STATIC
pluginselectdlg.ui
pluginsourcedlg.ui
searchwidget.ui
pluginselectdlg.h
pluginsourcedlg.h
# headers
pluginselectdialog.h
pluginsourcedialog.h
searchjobwidget.h
searchlistdelegate.h
searchsortmodel.h
searchtab.h
searchwidget.h
pluginselectdlg.cpp
pluginsourcedlg.cpp
# sources
pluginselectdialog.cpp
pluginsourcedialog.cpp
searchjobwidget.cpp
searchlistdelegate.cpp
searchsortmodel.cpp
searchtab.cpp
searchwidget.cpp
# forms
pluginselectdialog.ui
pluginsourcedialog.ui
searchwidget.ui
)
set(QBT_SEARCHENGINE_RESOURCES

94
src/gui/search/pluginselectdlg.cpp → src/gui/search/pluginselectdialog.cpp

@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
* exception statement from your version.
*/
#include "pluginselectdlg.h"
#include "pluginselectdialog.h"
#include <QClipboard>
#include <QDropEvent>
@ -45,9 +45,9 @@ @@ -45,9 +45,9 @@
#include "base/utils/misc.h"
#include "autoexpandabledialog.h"
#include "guiiconprovider.h"
#include "pluginsourcedlg.h"
#include "pluginsourcedialog.h"
#include "searchwidget.h"
#include "ui_pluginselectdlg.h"
#include "ui_pluginselectdialog.h"
#include "utils.h"
enum PluginColumns
@ -59,9 +59,9 @@ enum PluginColumns @@ -59,9 +59,9 @@ enum PluginColumns
PLUGIN_ID
};
PluginSelectDlg::PluginSelectDlg(SearchPluginManager *pluginManager, QWidget *parent)
PluginSelectDialog::PluginSelectDialog(SearchPluginManager *pluginManager, QWidget *parent)
: QDialog(parent)
, m_ui(new Ui::PluginSelectDlg())
, m_ui(new Ui::PluginSelectDialog())
, m_pluginManager(pluginManager)
, m_asyncOps(0)
, m_pendingUpdates(0)
@ -82,29 +82,29 @@ PluginSelectDlg::PluginSelectDlg(SearchPluginManager *pluginManager, QWidget *pa @@ -82,29 +82,29 @@ PluginSelectDlg::PluginSelectDlg(SearchPluginManager *pluginManager, QWidget *pa
m_ui->actionUninstall->setIcon(GuiIconProvider::instance()->getIcon("list-remove"));
connect(m_ui->actionEnable, &QAction::toggled, this, &PluginSelectDlg::enableSelection);
connect(m_ui->pluginsTree, &QTreeWidget::customContextMenuRequested, this, &PluginSelectDlg::displayContextMenu);
connect(m_ui->pluginsTree, &QTreeWidget::itemDoubleClicked, this, &PluginSelectDlg::togglePluginState);
connect(m_ui->actionEnable, &QAction::toggled, this, &PluginSelectDialog::enableSelection);
connect(m_ui->pluginsTree, &QTreeWidget::customContextMenuRequested, this, &PluginSelectDialog::displayContextMenu);
connect(m_ui->pluginsTree, &QTreeWidget::itemDoubleClicked, this, &PluginSelectDialog::togglePluginState);
loadSupportedSearchPlugins();
connect(m_pluginManager, &SearchPluginManager::pluginInstalled, this, &PluginSelectDlg::pluginInstalled);
connect(m_pluginManager, &SearchPluginManager::pluginInstallationFailed, this, &PluginSelectDlg::pluginInstallationFailed);
connect(m_pluginManager, &SearchPluginManager::pluginUpdated, this, &PluginSelectDlg::pluginUpdated);
connect(m_pluginManager, &SearchPluginManager::pluginUpdateFailed, this, &PluginSelectDlg::pluginUpdateFailed);
connect(m_pluginManager, &SearchPluginManager::checkForUpdatesFinished, this, &PluginSelectDlg::checkForUpdatesFinished);
connect(m_pluginManager, &SearchPluginManager::checkForUpdatesFailed, this, &PluginSelectDlg::checkForUpdatesFailed);
connect(m_pluginManager, &SearchPluginManager::pluginInstalled, this, &PluginSelectDialog::pluginInstalled);
connect(m_pluginManager, &SearchPluginManager::pluginInstallationFailed, this, &PluginSelectDialog::pluginInstallationFailed);
connect(m_pluginManager, &SearchPluginManager::pluginUpdated, this, &PluginSelectDialog::pluginUpdated);
connect(m_pluginManager, &SearchPluginManager::pluginUpdateFailed, this, &PluginSelectDialog::pluginUpdateFailed);
connect(m_pluginManager, &SearchPluginManager::checkForUpdatesFinished, this, &PluginSelectDialog::checkForUpdatesFinished);
connect(m_pluginManager, &SearchPluginManager::checkForUpdatesFailed, this, &PluginSelectDialog::checkForUpdatesFailed);
Utils::Gui::resize(this);
show();
}
PluginSelectDlg::~PluginSelectDlg()
PluginSelectDialog::~PluginSelectDialog()
{
delete m_ui;
}
void PluginSelectDlg::dropEvent(QDropEvent *event)
void PluginSelectDialog::dropEvent(QDropEvent *event)
{
event->acceptProposedAction();
@ -133,7 +133,7 @@ void PluginSelectDlg::dropEvent(QDropEvent *event) @@ -133,7 +133,7 @@ void PluginSelectDlg::dropEvent(QDropEvent *event)
}
// Decode if we accept drag 'n drop or not
void PluginSelectDlg::dragEnterEvent(QDragEnterEvent *event)
void PluginSelectDialog::dragEnterEvent(QDragEnterEvent *event)
{
QString mime;
foreach (mime, event->mimeData()->formats()) {
@ -145,13 +145,13 @@ void PluginSelectDlg::dragEnterEvent(QDragEnterEvent *event) @@ -145,13 +145,13 @@ void PluginSelectDlg::dragEnterEvent(QDragEnterEvent *event)
}
}
void PluginSelectDlg::on_updateButton_clicked()
void PluginSelectDialog::on_updateButton_clicked()
{
startAsyncOp();
m_pluginManager->checkForUpdates();
}
void PluginSelectDlg::togglePluginState(QTreeWidgetItem *item, int)
void PluginSelectDialog::togglePluginState(QTreeWidgetItem *item, int)
{
PluginInfo *plugin = m_pluginManager->pluginInfo(item->text(PLUGIN_ID));
m_pluginManager->enablePlugin(plugin->name, !plugin->enabled);
@ -165,7 +165,7 @@ void PluginSelectDlg::togglePluginState(QTreeWidgetItem *item, int) @@ -165,7 +165,7 @@ void PluginSelectDlg::togglePluginState(QTreeWidgetItem *item, int)
}
}
void PluginSelectDlg::displayContextMenu(const QPoint&)
void PluginSelectDialog::displayContextMenu(const QPoint&)
{
QMenu myContextMenu(this);
// Enable/disable pause/start action given the DL state
@ -180,12 +180,12 @@ void PluginSelectDlg::displayContextMenu(const QPoint&) @@ -180,12 +180,12 @@ void PluginSelectDlg::displayContextMenu(const QPoint&)
myContextMenu.exec(QCursor::pos());
}
void PluginSelectDlg::on_closeButton_clicked()
void PluginSelectDialog::on_closeButton_clicked()
{
close();
}
void PluginSelectDlg::on_actionUninstall_triggered()
void PluginSelectDialog::on_actionUninstall_triggered()
{
bool error = false;
foreach (QTreeWidgetItem *item, m_ui->pluginsTree->selectedItems()) {
@ -210,7 +210,7 @@ void PluginSelectDlg::on_actionUninstall_triggered() @@ -210,7 +210,7 @@ void PluginSelectDlg::on_actionUninstall_triggered()
QMessageBox::information(this, tr("Uninstall success"), tr("All selected plugins were uninstalled successfully"));
}
void PluginSelectDlg::enableSelection(bool enable)
void PluginSelectDialog::enableSelection(bool enable)
{
foreach (QTreeWidgetItem *item, m_ui->pluginsTree->selectedItems()) {
int index = m_ui->pluginsTree->indexOfTopLevelItem(item);
@ -229,7 +229,7 @@ void PluginSelectDlg::enableSelection(bool enable) @@ -229,7 +229,7 @@ void PluginSelectDlg::enableSelection(bool enable)
}
// Set the color of a row in data model
void PluginSelectDlg::setRowColor(int row, QString color)
void PluginSelectDialog::setRowColor(int row, QString color)
{
QTreeWidgetItem *item = m_ui->pluginsTree->topLevelItem(row);
for (int i = 0; i < m_ui->pluginsTree->columnCount(); ++i) {
@ -237,7 +237,7 @@ void PluginSelectDlg::setRowColor(int row, QString color) @@ -237,7 +237,7 @@ void PluginSelectDlg::setRowColor(int row, QString color)
}
}
QList<QTreeWidgetItem*> PluginSelectDlg::findItemsWithUrl(QString url)
QList<QTreeWidgetItem*> PluginSelectDialog::findItemsWithUrl(QString url)
{
QList<QTreeWidgetItem*> res;
@ -250,7 +250,7 @@ QList<QTreeWidgetItem*> PluginSelectDlg::findItemsWithUrl(QString url) @@ -250,7 +250,7 @@ QList<QTreeWidgetItem*> PluginSelectDlg::findItemsWithUrl(QString url)
return res;
}
QTreeWidgetItem *PluginSelectDlg::findItemWithID(QString id)
QTreeWidgetItem *PluginSelectDialog::findItemWithID(QString id)
{
for (int i = 0; i < m_ui->pluginsTree->topLevelItemCount(); ++i) {
QTreeWidgetItem *item = m_ui->pluginsTree->topLevelItem(i);
@ -261,7 +261,7 @@ QTreeWidgetItem *PluginSelectDlg::findItemWithID(QString id) @@ -261,7 +261,7 @@ QTreeWidgetItem *PluginSelectDlg::findItemWithID(QString id)
return 0;
}
void PluginSelectDlg::loadSupportedSearchPlugins()
void PluginSelectDialog::loadSupportedSearchPlugins()
{
// Some clean up first
m_ui->pluginsTree->clear();
@ -269,7 +269,7 @@ void PluginSelectDlg::loadSupportedSearchPlugins() @@ -269,7 +269,7 @@ void PluginSelectDlg::loadSupportedSearchPlugins()
addNewPlugin(name);
}
void PluginSelectDlg::addNewPlugin(QString pluginName)
void PluginSelectDialog::addNewPlugin(QString pluginName)
{
QTreeWidgetItem *item = new QTreeWidgetItem(m_ui->pluginsTree);
PluginInfo *plugin = m_pluginManager->pluginInfo(pluginName);
@ -294,27 +294,27 @@ void PluginSelectDlg::addNewPlugin(QString pluginName) @@ -294,27 +294,27 @@ void PluginSelectDlg::addNewPlugin(QString pluginName)
using namespace Net;
DownloadHandler *handler = DownloadManager::instance()->downloadUrl(plugin->url + "/favicon.ico", true);
connect(handler, static_cast<void (DownloadHandler::*)(const QString &, const QString &)>(&DownloadHandler::downloadFinished)
, this, &PluginSelectDlg::iconDownloaded);
connect(handler, &DownloadHandler::downloadFailed, this, &PluginSelectDlg::iconDownloadFailed);
, this, &PluginSelectDialog::iconDownloaded);
connect(handler, &DownloadHandler::downloadFailed, this, &PluginSelectDialog::iconDownloadFailed);
}
item->setText(PLUGIN_VERSION, plugin->version);
}
void PluginSelectDlg::startAsyncOp()
void PluginSelectDialog::startAsyncOp()
{
++m_asyncOps;
if (m_asyncOps == 1)
setCursor(QCursor(Qt::WaitCursor));
}
void PluginSelectDlg::finishAsyncOp()
void PluginSelectDialog::finishAsyncOp()
{
--m_asyncOps;
if (m_asyncOps == 0)
setCursor(QCursor(Qt::ArrowCursor));
}
void PluginSelectDlg::finishPluginUpdate()
void PluginSelectDialog::finishPluginUpdate()
{
--m_pendingUpdates;
if (m_pendingUpdates == 0 && !m_updatedPlugins.isEmpty()) {
@ -324,14 +324,14 @@ void PluginSelectDlg::finishPluginUpdate() @@ -324,14 +324,14 @@ void PluginSelectDlg::finishPluginUpdate()
}
}
void PluginSelectDlg::on_installButton_clicked()
void PluginSelectDialog::on_installButton_clicked()
{
PluginSourceDlg *dlg = new PluginSourceDlg(this);
connect(dlg, &PluginSourceDlg::askForLocalFile, this, &PluginSelectDlg::askForLocalPlugin);
connect(dlg, &PluginSourceDlg::askForUrl, this, &PluginSelectDlg::askForPluginUrl);
PluginSourceDialog *dlg = new PluginSourceDialog(this);
connect(dlg, &PluginSourceDialog::askForLocalFile, this, &PluginSelectDialog::askForLocalPlugin);
connect(dlg, &PluginSourceDialog::askForUrl, this, &PluginSelectDialog::askForPluginUrl);
}
void PluginSelectDlg::askForPluginUrl()
void PluginSelectDialog::askForPluginUrl()
{
bool ok = false;
QString clipTxt = qApp->clipboard()->text();
@ -357,7 +357,7 @@ void PluginSelectDlg::askForPluginUrl() @@ -357,7 +357,7 @@ void PluginSelectDlg::askForPluginUrl()
}
}
void PluginSelectDlg::askForLocalPlugin()
void PluginSelectDialog::askForLocalPlugin()
{
QStringList pathsList = QFileDialog::getOpenFileNames(
0, tr("Select search plugins"), QDir::homePath(),
@ -369,7 +369,7 @@ void PluginSelectDlg::askForLocalPlugin() @@ -369,7 +369,7 @@ void PluginSelectDlg::askForLocalPlugin()
}
}
void PluginSelectDlg::iconDownloaded(const QString &url, QString filePath)
void PluginSelectDialog::iconDownloaded(const QString &url, QString filePath)
{
filePath = Utils::Fs::fromNativePath(filePath);
@ -409,12 +409,12 @@ void PluginSelectDlg::iconDownloaded(const QString &url, QString filePath) @@ -409,12 +409,12 @@ void PluginSelectDlg::iconDownloaded(const QString &url, QString filePath)
Utils::Fs::forceRemove(filePath);
}
void PluginSelectDlg::iconDownloadFailed(const QString &url, const QString &reason)
void PluginSelectDialog::iconDownloadFailed(const QString &url, const QString &reason)
{
qDebug("Could not download favicon: %s, reason: %s", qUtf8Printable(url), qUtf8Printable(reason));
}
void PluginSelectDlg::checkForUpdatesFinished(const QHash<QString, PluginVersion> &updateInfo)
void PluginSelectDialog::checkForUpdatesFinished(const QHash<QString, PluginVersion> &updateInfo)
{
finishAsyncOp();
if (updateInfo.isEmpty()) {
@ -429,13 +429,13 @@ void PluginSelectDlg::checkForUpdatesFinished(const QHash<QString, PluginVersion @@ -429,13 +429,13 @@ void PluginSelectDlg::checkForUpdatesFinished(const QHash<QString, PluginVersion
}
}
void PluginSelectDlg::checkForUpdatesFailed(const QString &reason)
void PluginSelectDialog::checkForUpdatesFailed(const QString &reason)
{
finishAsyncOp();
QMessageBox::warning(this, tr("Search plugin update"), tr("Sorry, couldn't check for plugin updates. %1").arg(reason));
}
void PluginSelectDlg::pluginInstalled(const QString &name)
void PluginSelectDialog::pluginInstalled(const QString &name)
{
addNewPlugin(name);
finishAsyncOp();
@ -443,7 +443,7 @@ void PluginSelectDlg::pluginInstalled(const QString &name) @@ -443,7 +443,7 @@ void PluginSelectDlg::pluginInstalled(const QString &name)
finishPluginUpdate();
}
void PluginSelectDlg::pluginInstallationFailed(const QString &name, const QString &reason)
void PluginSelectDialog::pluginInstallationFailed(const QString &name, const QString &reason)
{
finishAsyncOp();
QMessageBox::information(this, tr("Search plugin install")
@ -451,7 +451,7 @@ void PluginSelectDlg::pluginInstallationFailed(const QString &name, const QStrin @@ -451,7 +451,7 @@ void PluginSelectDlg::pluginInstallationFailed(const QString &name, const QStrin
finishPluginUpdate();
}
void PluginSelectDlg::pluginUpdated(const QString &name)
void PluginSelectDialog::pluginUpdated(const QString &name)
{
finishAsyncOp();
PluginVersion version = m_pluginManager->pluginInfo(name)->version;
@ -461,7 +461,7 @@ void PluginSelectDlg::pluginUpdated(const QString &name) @@ -461,7 +461,7 @@ void PluginSelectDlg::pluginUpdated(const QString &name)
finishPluginUpdate();
}
void PluginSelectDlg::pluginUpdateFailed(const QString &name, const QString &reason)
void PluginSelectDialog::pluginUpdateFailed(const QString &name, const QString &reason)
{
finishAsyncOp();
QMessageBox::information(this, tr("Search plugin update")

16
src/gui/search/pluginselectdlg.h → src/gui/search/pluginselectdialog.h

@ -27,8 +27,8 @@ @@ -27,8 +27,8 @@
* exception statement from your version.
*/
#ifndef PLUGINSELECTDLG_H
#define PLUGINSELECTDLG_H
#ifndef PLUGINSELECTDIALOG_H
#define PLUGINSELECTDIALOG_H
#include <QDialog>
@ -40,16 +40,16 @@ class QTreeWidgetItem; @@ -40,16 +40,16 @@ class QTreeWidgetItem;
namespace Ui
{
class PluginSelectDlg;
class PluginSelectDialog;
}
class PluginSelectDlg : public QDialog
class PluginSelectDialog : public QDialog
{
Q_OBJECT
public:
explicit PluginSelectDlg(SearchPluginManager *pluginManager, QWidget *parent = nullptr);
~PluginSelectDlg();
explicit PluginSelectDialog(SearchPluginManager *pluginManager, QWidget *parent = nullptr);
~PluginSelectDialog();
QList<QTreeWidgetItem*> findItemsWithUrl(QString url);
QTreeWidgetItem *findItemWithID(QString id);
@ -86,11 +86,11 @@ private: @@ -86,11 +86,11 @@ private:
void finishAsyncOp();
void finishPluginUpdate();
Ui::PluginSelectDlg *m_ui;
Ui::PluginSelectDialog *m_ui;
SearchPluginManager *m_pluginManager;
QStringList m_updatedPlugins;
int m_asyncOps;
int m_pendingUpdates;
};
#endif // PLUGINSELECTDLG_H
#endif // PLUGINSELECTDIALOG_H

4
src/gui/search/pluginselectdlg.ui → src/gui/search/pluginselectdialog.ui

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PluginSelectDlg</class>
<widget class="QDialog" name="PluginSelectDlg">
<class>PluginSelectDialog</class>
<widget class="QDialog" name="PluginSelectDialog">
<property name="geometry">
<rect>
<x>0</x>

14
src/gui/search/pluginsourcedlg.cpp → src/gui/search/pluginsourcedialog.cpp

@ -26,14 +26,14 @@ @@ -26,14 +26,14 @@
* exception statement from your version.
*/
#include "pluginsourcedlg.h"
#include "pluginsourcedialog.h"
#include "ui_pluginsourcedlg.h"
#include "ui_pluginsourcedialog.h"
#include "utils.h"
PluginSourceDlg::PluginSourceDlg(QWidget *parent)
PluginSourceDialog::PluginSourceDialog(QWidget *parent)
: QDialog(parent)
, m_ui(new Ui::PluginSourceDlg())
, m_ui(new Ui::PluginSourceDialog())
{
m_ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
@ -42,18 +42,18 @@ PluginSourceDlg::PluginSourceDlg(QWidget *parent) @@ -42,18 +42,18 @@ PluginSourceDlg::PluginSourceDlg(QWidget *parent)
show();
}
PluginSourceDlg::~PluginSourceDlg()
PluginSourceDialog::~PluginSourceDialog()
{
delete m_ui;
}
void PluginSourceDlg::on_localButton_clicked()
void PluginSourceDialog::on_localButton_clicked()
{
emit askForLocalFile();
close();
}
void PluginSourceDlg::on_urlButton_clicked()
void PluginSourceDialog::on_urlButton_clicked()
{
emit askForUrl();
close();

16
src/gui/search/pluginsourcedlg.h → src/gui/search/pluginsourcedialog.h

@ -26,23 +26,23 @@ @@ -26,23 +26,23 @@
* exception statement from your version.
*/
#ifndef PLUGINSOURCEDLG_H
#define PLUGINSOURCEDLG_H
#ifndef PLUGINSOURCEDIALOG_H
#define PLUGINSOURCEDIALOG_H
#include <QDialog>
namespace Ui
{
class PluginSourceDlg;
class PluginSourceDialog;
}
class PluginSourceDlg : public QDialog
class PluginSourceDialog : public QDialog
{
Q_OBJECT
public:
explicit PluginSourceDlg(QWidget *parent = nullptr);
~PluginSourceDlg();
explicit PluginSourceDialog(QWidget *parent = nullptr);
~PluginSourceDialog();
signals:
void askForUrl();
@ -53,7 +53,7 @@ private slots: @@ -53,7 +53,7 @@ private slots:
void on_urlButton_clicked();
private:
Ui::PluginSourceDlg *m_ui;
Ui::PluginSourceDialog *m_ui;
};
#endif // PLUGINSOURCEDLG_H
#endif // PLUGINSOURCEDIALOG_H

4
src/gui/search/pluginsourcedlg.ui → src/gui/search/pluginsourcedialog.ui

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PluginSourceDlg</class>
<widget class="QDialog" name="PluginSourceDlg">
<class>PluginSourceDialog</class>
<widget class="QDialog" name="PluginSourceDialog">
<property name="geometry">
<rect>
<x>0</x>

98
src/gui/search/searchtab.cpp → src/gui/search/searchjobwidget.cpp

@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
* exception statement from your version.
*/
#include "searchtab.h"
#include "searchjobwidget.h"
#include <QApplication>
#include <QClipboard>
@ -54,11 +54,11 @@ @@ -54,11 +54,11 @@
#include "guiiconprovider.h"
#include "searchlistdelegate.h"
#include "searchsortmodel.h"
#include "ui_searchtab.h"
#include "ui_searchjobwidget.h"
SearchTab::SearchTab(SearchHandler *searchHandler, QWidget *parent)
SearchJobWidget::SearchJobWidget(SearchHandler *searchHandler, QWidget *parent)
: QWidget(parent)
, m_ui(new Ui::SearchTab)
, m_ui(new Ui::SearchJobWidget)
, m_searchHandler(searchHandler)
{
m_ui->setupUi(this);
@ -120,61 +120,61 @@ SearchTab::SearchTab(SearchHandler *searchHandler, QWidget *parent) @@ -120,61 +120,61 @@ SearchTab::SearchTab(SearchHandler *searchHandler, QWidget *parent)
m_ui->resultsBrowser->resizeColumnToContents(i);
header()->setContextMenuPolicy(Qt::CustomContextMenu);
connect(header(), &QWidget::customContextMenuRequested, this, &SearchTab::displayToggleColumnsMenu);
connect(header(), &QHeaderView::sectionResized, this, &SearchTab::saveSettings);
connect(header(), &QHeaderView::sectionMoved, this, &SearchTab::saveSettings);
connect(header(), &QHeaderView::sortIndicatorChanged, this, &SearchTab::saveSettings);
connect(header(), &QWidget::customContextMenuRequested, this, &SearchJobWidget::displayToggleColumnsMenu);
connect(header(), &QHeaderView::sectionResized, this, &SearchJobWidget::saveSettings);
connect(header(), &QHeaderView::sectionMoved, this, &SearchJobWidget::saveSettings);
connect(header(), &QHeaderView::sortIndicatorChanged, this, &SearchJobWidget::saveSettings);
fillFilterComboBoxes();
updateFilter();
connect(m_ui->filterMode, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged)
, this, &SearchTab::updateFilter);
connect(m_ui->minSeeds, &QAbstractSpinBox::editingFinished, this, &SearchTab::updateFilter);
, this, &SearchJobWidget::updateFilter);
connect(m_ui->minSeeds, &QAbstractSpinBox::editingFinished, this, &SearchJobWidget::updateFilter);
connect(m_ui->minSeeds, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged)
, this, &SearchTab::updateFilter);
connect(m_ui->maxSeeds, &QAbstractSpinBox::editingFinished, this, &SearchTab::updateFilter);
, this, &SearchJobWidget::updateFilter);
connect(m_ui->maxSeeds, &QAbstractSpinBox::editingFinished, this, &SearchJobWidget::updateFilter);
connect(m_ui->maxSeeds, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged)
, this, &SearchTab::updateFilter);
connect(m_ui->minSize, &QAbstractSpinBox::editingFinished, this, &SearchTab::updateFilter);
, this, &SearchJobWidget::updateFilter);
connect(m_ui->minSize, &QAbstractSpinBox::editingFinished, this, &SearchJobWidget::updateFilter);
connect(m_ui->minSize, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged)
, this, &SearchTab::updateFilter);
connect(m_ui->maxSize, &QAbstractSpinBox::editingFinished, this, &SearchTab::updateFilter);
, this, &SearchJobWidget::updateFilter);
connect(m_ui->maxSize, &QAbstractSpinBox::editingFinished, this, &SearchJobWidget::updateFilter);
connect(m_ui->maxSize, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged)
, this, &SearchTab::updateFilter);
, this, &SearchJobWidget::updateFilter);
connect(m_ui->minSizeUnit, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged)
, this, &SearchTab::updateFilter);
, this, &SearchJobWidget::updateFilter);
connect(m_ui->maxSizeUnit, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged)
, this, &SearchTab::updateFilter);
, this, &SearchJobWidget::updateFilter);
connect(m_ui->resultsBrowser, &QAbstractItemView::doubleClicked, this, &SearchTab::onItemDoubleClicked);
connect(m_ui->resultsBrowser, &QAbstractItemView::doubleClicked, this, &SearchJobWidget::onItemDoubleClicked);
connect(searchHandler, &SearchHandler::newSearchResults, this, &SearchTab::appendSearchResults);
connect(searchHandler, &SearchHandler::searchFinished, this, &SearchTab::searchFinished);
connect(searchHandler, &SearchHandler::searchFailed, this, &SearchTab::searchFailed);
connect(searchHandler, &SearchHandler::newSearchResults, this, &SearchJobWidget::appendSearchResults);
connect(searchHandler, &SearchHandler::searchFinished, this, &SearchJobWidget::searchFinished);
connect(searchHandler, &SearchHandler::searchFailed, this, &SearchJobWidget::searchFailed);
connect(this, &QObject::destroyed, searchHandler, &QObject::deleteLater);
}
SearchTab::~SearchTab()
SearchJobWidget::~SearchJobWidget()
{
saveSettings();
delete m_ui;
}
void SearchTab::onItemDoubleClicked(const QModelIndex &index)
void SearchJobWidget::onItemDoubleClicked(const QModelIndex &index)
{
setRowColor(index.row(), QApplication::palette().color(QPalette::LinkVisited));
downloadTorrent(index);
}
QHeaderView *SearchTab::header() const
QHeaderView *SearchJobWidget::header() const
{
return m_ui->resultsBrowser->header();
}
// Set the color of a row in data model
void SearchTab::setRowColor(int row, const QColor &color)
void SearchJobWidget::setRowColor(int row, const QColor &color)
{
m_proxyModel->setDynamicSortFilter(false);
for (int i = 0; i < m_proxyModel->columnCount(); ++i)
@ -183,29 +183,29 @@ void SearchTab::setRowColor(int row, const QColor &color) @@ -183,29 +183,29 @@ void SearchTab::setRowColor(int row, const QColor &color)
m_proxyModel->setDynamicSortFilter(true);
}
SearchTab::Status SearchTab::status() const
SearchJobWidget::Status SearchJobWidget::status() const
{
return m_status;
}
int SearchTab::visibleResultsCount() const
int SearchJobWidget::visibleResultsCount() const
{
return m_proxyModel->rowCount();
}
void SearchTab::cancelSearch()
void SearchJobWidget::cancelSearch()
{
m_searchHandler->cancelSearch();
}
void SearchTab::downloadTorrents()
void SearchJobWidget::downloadTorrents()
{
const QModelIndexList rows {m_ui->resultsBrowser->selectionModel()->selectedRows()};
for (const QModelIndex &rowIndex : rows)
downloadTorrent(rowIndex);
}
void SearchTab::openTorrentPages()
void SearchJobWidget::openTorrentPages()
{
const QModelIndexList rows {m_ui->resultsBrowser->selectionModel()->selectedRows()};
for (const QModelIndex &rowIndex : rows) {
@ -216,7 +216,7 @@ void SearchTab::openTorrentPages() @@ -216,7 +216,7 @@ void SearchTab::openTorrentPages()
}
}
void SearchTab::copyTorrentURLs()
void SearchJobWidget::copyTorrentURLs()
{
const QModelIndexList rows {m_ui->resultsBrowser->selectionModel()->selectedRows()};
QStringList urls;
@ -233,7 +233,7 @@ void SearchTab::copyTorrentURLs() @@ -233,7 +233,7 @@ void SearchTab::copyTorrentURLs()
}
}
void SearchTab::setStatus(Status value)
void SearchJobWidget::setStatus(Status value)
{
if (m_status == value) return;
@ -242,7 +242,7 @@ void SearchTab::setStatus(Status value) @@ -242,7 +242,7 @@ void SearchTab::setStatus(Status value)
emit statusChanged();
}
void SearchTab::downloadTorrent(const QModelIndex &rowIndex)
void SearchJobWidget::downloadTorrent(const QModelIndex &rowIndex)
{
const QString torrentUrl = m_proxyModel->data(
m_proxyModel->index(rowIndex.row(), SearchSortModel::DL_LINK)).toString();
@ -254,12 +254,12 @@ void SearchTab::downloadTorrent(const QModelIndex &rowIndex) @@ -254,12 +254,12 @@ void SearchTab::downloadTorrent(const QModelIndex &rowIndex)
}
else {
SearchDownloadHandler *downloadHandler = m_searchHandler->manager()->downloadTorrent(siteUrl, torrentUrl);
connect(downloadHandler, &SearchDownloadHandler::downloadFinished, this, &SearchTab::addTorrentToSession);
connect(downloadHandler, &SearchDownloadHandler::downloadFinished, this, &SearchJobWidget::addTorrentToSession);
connect(downloadHandler, &SearchDownloadHandler::downloadFinished, downloadHandler, &SearchDownloadHandler::deleteLater);
}
}
void SearchTab::addTorrentToSession(const QString &source)
void SearchJobWidget::addTorrentToSession(const QString &source)
{
if (source.isEmpty()) return;
@ -269,7 +269,7 @@ void SearchTab::addTorrentToSession(const QString &source) @@ -269,7 +269,7 @@ void SearchTab::addTorrentToSession(const QString &source)
BitTorrent::Session::instance()->addTorrent(source);
}
void SearchTab::updateResultsCount()
void SearchJobWidget::updateResultsCount()
{
const int totalResults = m_searchListModel->rowCount();
const int filteredResults = m_proxyModel->rowCount();
@ -280,7 +280,7 @@ void SearchTab::updateResultsCount() @@ -280,7 +280,7 @@ void SearchTab::updateResultsCount()
emit resultsCountUpdated();
}
void SearchTab::updateFilter()
void SearchJobWidget::updateFilter()
{
using Utils::Misc::SizeUnit;
@ -297,7 +297,7 @@ void SearchTab::updateFilter() @@ -297,7 +297,7 @@ void SearchTab::updateFilter()
updateResultsCount();
}
void SearchTab::fillFilterComboBoxes()
void SearchJobWidget::fillFilterComboBoxes()
{
using Utils::Misc::SizeUnit;
QStringList unitStrings;
@ -330,7 +330,7 @@ void SearchTab::fillFilterComboBoxes() @@ -330,7 +330,7 @@ void SearchTab::fillFilterComboBoxes()
m_ui->filterMode->setCurrentIndex((index == -1) ? 0 : index);
}
QString SearchTab::statusText(SearchTab::Status st)
QString SearchJobWidget::statusText(SearchJobWidget::Status st)
{
switch (st) {
case Status::Ongoing:
@ -348,22 +348,22 @@ QString SearchTab::statusText(SearchTab::Status st) @@ -348,22 +348,22 @@ QString SearchTab::statusText(SearchTab::Status st)
}
}
SearchTab::NameFilteringMode SearchTab::filteringMode() const
SearchJobWidget::NameFilteringMode SearchJobWidget::filteringMode() const
{
return static_cast<NameFilteringMode>(m_ui->filterMode->itemData(m_ui->filterMode->currentIndex()).toInt());
}
void SearchTab::loadSettings()
void SearchJobWidget::loadSettings()
{
header()->restoreState(Preferences::instance()->getSearchTabHeaderState());
}
void SearchTab::saveSettings() const
void SearchJobWidget::saveSettings() const
{
Preferences::instance()->setSearchTabHeaderState(header()->saveState());
}
void SearchTab::displayToggleColumnsMenu(const QPoint&)
void SearchJobWidget::displayToggleColumnsMenu(const QPoint&)
{
QMenu hideshowColumn(this);
hideshowColumn.setTitle(tr("Column visibility"));
@ -398,7 +398,7 @@ void SearchTab::displayToggleColumnsMenu(const QPoint&) @@ -398,7 +398,7 @@ void SearchTab::displayToggleColumnsMenu(const QPoint&)
}
}
void SearchTab::searchFinished(bool cancelled)
void SearchJobWidget::searchFinished(bool cancelled)
{
if (cancelled)
setStatus(Status::Aborted);
@ -408,12 +408,12 @@ void SearchTab::searchFinished(bool cancelled) @@ -408,12 +408,12 @@ void SearchTab::searchFinished(bool cancelled)
setStatus(Status::Finished);
}
void SearchTab::searchFailed()
void SearchJobWidget::searchFailed()
{
setStatus(Status::Error);
}
void SearchTab::appendSearchResults(const QList<SearchResult> &results)
void SearchJobWidget::appendSearchResults(const QList<SearchResult> &results)
{
for (const SearchResult &result : results) {
// Add item to search result list
@ -432,7 +432,7 @@ void SearchTab::appendSearchResults(const QList<SearchResult> &results) @@ -432,7 +432,7 @@ void SearchTab::appendSearchResults(const QList<SearchResult> &results)
updateResultsCount();
}
CachedSettingValue<SearchTab::NameFilteringMode> &SearchTab::nameFilteringModeSetting()
CachedSettingValue<SearchJobWidget::NameFilteringMode> &SearchJobWidget::nameFilteringModeSetting()
{
static CachedSettingValue<NameFilteringMode> setting("Search/FilteringMode", NameFilteringMode::OnlyNames);
return setting;

14
src/gui/search/searchtab.h → src/gui/search/searchjobwidget.h

@ -50,13 +50,13 @@ struct SearchResult; @@ -50,13 +50,13 @@ struct SearchResult;
namespace Ui
{
class SearchTab;
class SearchJobWidget;
}
class SearchTab : public QWidget
class SearchJobWidget : public QWidget
{
Q_OBJECT
Q_DISABLE_COPY(SearchTab)
Q_DISABLE_COPY(SearchJobWidget)
public:
enum class NameFilteringMode
@ -75,8 +75,8 @@ public: @@ -75,8 +75,8 @@ public:
NoResults
};
explicit SearchTab(SearchHandler *searchHandler, QWidget *parent = nullptr);
~SearchTab() override;
explicit SearchJobWidget(SearchHandler *searchHandler, QWidget *parent = nullptr);
~SearchJobWidget() override;
Status status() const;
int visibleResultsCount() const;
@ -112,7 +112,7 @@ private: @@ -112,7 +112,7 @@ private:
static QString statusText(Status st);
static CachedSettingValue<NameFilteringMode> &nameFilteringModeSetting();
Ui::SearchTab *m_ui;
Ui::SearchJobWidget *m_ui;
SearchHandler *m_searchHandler;
QStandardItemModel *m_searchListModel;
SearchSortModel *m_proxyModel;
@ -121,4 +121,4 @@ private: @@ -121,4 +121,4 @@ private:
bool m_noSearchResults = true;
};
Q_DECLARE_METATYPE(SearchTab::NameFilteringMode)
Q_DECLARE_METATYPE(SearchJobWidget::NameFilteringMode)

4
src/gui/search/searchtab.ui → src/gui/search/searchjobwidget.ui

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SearchTab</class>
<widget class="QWidget" name="SearchTab">
<class>SearchJobWidget</class>
<widget class="QWidget" name="SearchJobWidget">
<property name="geometry">
<rect>
<x>0</x>

34
src/gui/search/searchwidget.cpp

@ -61,10 +61,10 @@ @@ -61,10 +61,10 @@
#include "addnewtorrentdialog.h"
#include "guiiconprovider.h"
#include "mainwindow.h"
#include "pluginselectdlg.h"
#include "pluginselectdialog.h"
#include "searchlistdelegate.h"
#include "searchsortmodel.h"
#include "searchtab.h"
#include "searchjobwidget.h"
#include "ui_searchwidget.h"
#define SEARCHHISTORY_MAXSIZE 50
@ -72,18 +72,18 @@ @@ -72,18 +72,18 @@
namespace
{
QString statusIconName(SearchTab::Status st)
QString statusIconName(SearchJobWidget::Status st)
{
switch (st) {
case SearchTab::Status::Ongoing:
case SearchJobWidget::Status::Ongoing:
return QLatin1String("task-ongoing");
case SearchTab::Status::Finished:
case SearchJobWidget::Status::Finished:
return QLatin1String("task-complete");
case SearchTab::Status::Aborted:
case SearchJobWidget::Status::Aborted:
return QLatin1String("task-reject");
case SearchTab::Status::Error:
case SearchJobWidget::Status::Error:
return QLatin1String("task-attention");
case SearchTab::Status::NoResults:
case SearchJobWidget::Status::NoResults:
return QLatin1String("task-attention");
default:
return QString();
@ -267,7 +267,7 @@ void SearchWidget::selectMultipleBox(int index) @@ -267,7 +267,7 @@ void SearchWidget::selectMultipleBox(int index)
void SearchWidget::on_pluginsButton_clicked()
{
new PluginSelectDlg(SearchPluginManager::instance(), this);
new PluginSelectDialog(SearchPluginManager::instance(), this);
}
void SearchWidget::searchTextEdited(QString)
@ -323,7 +323,7 @@ void SearchWidget::on_searchButton_clicked() @@ -323,7 +323,7 @@ void SearchWidget::on_searchButton_clicked()
auto *searchHandler = SearchPluginManager::instance()->startSearch(pattern, selectedCategory(), plugins);
// Tab Addition
auto *newTab = new SearchTab(searchHandler, this);
auto *newTab = new SearchJobWidget(searchHandler, this);
m_allTabs.append(newTab);
QString tabName = pattern;
@ -331,8 +331,8 @@ void SearchWidget::on_searchButton_clicked() @@ -331,8 +331,8 @@ void SearchWidget::on_searchButton_clicked()
m_ui->tabWidget->addTab(newTab, tabName);
m_ui->tabWidget->setCurrentWidget(newTab);
connect(newTab, &SearchTab::resultsCountUpdated, this, &SearchWidget::resultsCountUpdated);
connect(newTab, &SearchTab::statusChanged
connect(newTab, &SearchJobWidget::resultsCountUpdated, this, &SearchWidget::resultsCountUpdated);
connect(newTab, &SearchJobWidget::statusChanged
, m_tabStatusChangedMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
m_tabStatusChangedMapper->setMapping(newTab, newTab);
@ -351,13 +351,13 @@ void SearchWidget::tabStatusChanged(QWidget *tab) @@ -351,13 +351,13 @@ void SearchWidget::tabStatusChanged(QWidget *tab)
const int tabIndex = m_ui->tabWidget->indexOf(tab);
m_ui->tabWidget->setTabToolTip(tabIndex, tab->statusTip());
m_ui->tabWidget->setTabIcon(tabIndex, GuiIconProvider::instance()->getIcon(
statusIconName(static_cast<SearchTab *>(tab)->status())));
statusIconName(static_cast<SearchJobWidget *>(tab)->status())));
if ((tab == m_activeSearchTab) && (m_activeSearchTab->status() != SearchTab::Status::Ongoing)) {
Q_ASSERT(m_activeSearchTab->status() != SearchTab::Status::Ongoing);
if ((tab == m_activeSearchTab) && (m_activeSearchTab->status() != SearchJobWidget::Status::Ongoing)) {
Q_ASSERT(m_activeSearchTab->status() != SearchJobWidget::Status::Ongoing);
if (m_mainWindow->isNotificationsEnabled() && (m_mainWindow->currentTabWidget() != this)) {
if (m_activeSearchTab->status() == SearchTab::Status::Error)
if (m_activeSearchTab->status() == SearchJobWidget::Status::Error)
m_mainWindow->showNotificationBaloon(tr("Search Engine"), tr("Search has failed"));
else
m_mainWindow->showNotificationBaloon(tr("Search Engine"), tr("Search has finished"));
@ -370,7 +370,7 @@ void SearchWidget::tabStatusChanged(QWidget *tab) @@ -370,7 +370,7 @@ void SearchWidget::tabStatusChanged(QWidget *tab)
void SearchWidget::closeTab(int index)
{
SearchTab *tab = m_allTabs.takeAt(index);
SearchJobWidget *tab = m_allTabs.takeAt(index);
if (tab == m_activeSearchTab)
m_ui->searchButton->setText(tr("Search"));

8
src/gui/search/searchwidget.h

@ -37,7 +37,7 @@ class QSignalMapper; @@ -37,7 +37,7 @@ class QSignalMapper;
class QTabWidget;
class MainWindow;
class SearchTab;
class SearchJobWidget;
namespace Ui
{
@ -80,9 +80,9 @@ private: @@ -80,9 +80,9 @@ private:
Ui::SearchWidget *m_ui;
QSignalMapper *m_tabStatusChangedMapper;
QPointer<SearchTab> m_currentSearchTab; // Selected tab
QPointer<SearchTab> m_activeSearchTab; // Tab with running search
QList<SearchTab *> m_allTabs; // To store all tabs
QPointer<SearchJobWidget> m_currentSearchTab; // Selected tab
QPointer<SearchJobWidget> m_activeSearchTab; // Tab with running search
QList<SearchJobWidget *> m_allTabs; // To store all tabs
MainWindow *m_mainWindow;
bool m_isNewQueryString;
};

26
src/gui/shutdownconfirmdlg.cpp → src/gui/shutdownconfirmdialog.cpp

@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
* exception statement from your version.
*/
#include "shutdownconfirmdlg.h"
#include "shutdownconfirmdialog.h"
#include <QDialogButtonBox>
#include <QIcon>
@ -36,12 +36,12 @@ @@ -36,12 +36,12 @@
#include "base/preferences.h"
#include "base/utils/misc.h"
#include "ui_shutdownconfirmdlg.h"
#include "ui_shutdownconfirmdialog.h"
#include "utils.h"
ShutdownConfirmDlg::ShutdownConfirmDlg(QWidget *parent, const ShutdownDialogAction &action)
ShutdownConfirmDialog::ShutdownConfirmDialog(QWidget *parent, const ShutdownDialogAction &action)
: QDialog(parent)
, m_ui(new Ui::confirmShutdownDlg)
, m_ui(new Ui::ShutdownConfirmDialog)
, m_timeout(15)
, m_action(action)
{
@ -66,29 +66,29 @@ ShutdownConfirmDlg::ShutdownConfirmDlg(QWidget *parent, const ShutdownDialogActi @@ -66,29 +66,29 @@ ShutdownConfirmDlg::ShutdownConfirmDlg(QWidget *parent, const ShutdownDialogActi
move(Utils::Misc::screenCenter(this));
m_timer.setInterval(1000); // 1sec
connect(&m_timer, &QTimer::timeout, this, &ShutdownConfirmDlg::updateSeconds);
connect(&m_timer, &QTimer::timeout, this, &ShutdownConfirmDialog::updateSeconds);
Utils::Gui::resize(this);
}
ShutdownConfirmDlg::~ShutdownConfirmDlg()
ShutdownConfirmDialog::~ShutdownConfirmDialog()
{
delete m_ui;
}
void ShutdownConfirmDlg::showEvent(QShowEvent *event)
void ShutdownConfirmDialog::showEvent(QShowEvent *event)
{
QDialog::showEvent(event);
m_timer.start();
}
bool ShutdownConfirmDlg::askForConfirmation(QWidget *parent, const ShutdownDialogAction &action)
bool ShutdownConfirmDialog::askForConfirmation(QWidget *parent, const ShutdownDialogAction &action)
{
ShutdownConfirmDlg dlg(parent, action);
ShutdownConfirmDialog dlg(parent, action);
return (dlg.exec() == QDialog::Accepted);
}
void ShutdownConfirmDlg::updateSeconds()
void ShutdownConfirmDialog::updateSeconds()
{
--m_timeout;
updateText();
@ -98,13 +98,13 @@ void ShutdownConfirmDlg::updateSeconds() @@ -98,13 +98,13 @@ void ShutdownConfirmDlg::updateSeconds()
}
}
void ShutdownConfirmDlg::accept()
void ShutdownConfirmDialog::accept()
{
Preferences::instance()->setDontConfirmAutoExit(m_ui->neverShowAgainCheckbox->isChecked());
QDialog::accept();
}
void ShutdownConfirmDlg::initText()
void ShutdownConfirmDialog::initText()
{
QPushButton *okButton = m_ui->buttonBox->button(QDialogButtonBox::Ok);
@ -135,7 +135,7 @@ void ShutdownConfirmDlg::initText() @@ -135,7 +135,7 @@ void ShutdownConfirmDlg::initText()
updateText();
}
void ShutdownConfirmDlg::updateText()
void ShutdownConfirmDialog::updateText()
{
QString t = tr("You can cancel the action within %1 seconds.").arg(QString::number(m_timeout)) + '\n';
m_ui->shutdownText->setText(m_msg + t);

16
src/gui/shutdownconfirmdlg.h → src/gui/shutdownconfirmdialog.h

@ -26,8 +26,8 @@ @@ -26,8 +26,8 @@
* exception statement from your version.
*/
#ifndef SHUTDOWNCONFIRMDLG_H
#define SHUTDOWNCONFIRMDLG_H
#ifndef SHUTDOWNCONFIRMDIALOG_H
#define SHUTDOWNCONFIRMDIALOG_H
#include <QDialog>
#include <QTimer>
@ -36,16 +36,16 @@ @@ -36,16 +36,16 @@
namespace Ui
{
class confirmShutdownDlg;
class ShutdownConfirmDialog;
}
class ShutdownConfirmDlg : public QDialog
class ShutdownConfirmDialog : public QDialog
{
Q_OBJECT
public:
ShutdownConfirmDlg(QWidget *parent, const ShutdownDialogAction &action);
~ShutdownConfirmDlg();
ShutdownConfirmDialog(QWidget *parent, const ShutdownDialogAction &action);
~ShutdownConfirmDialog();
static bool askForConfirmation(QWidget *parent, const ShutdownDialogAction &action);
@ -62,11 +62,11 @@ private: @@ -62,11 +62,11 @@ private:
void updateText();
// Vars
Ui::confirmShutdownDlg *m_ui;
Ui::ShutdownConfirmDialog *m_ui;
QTimer m_timer;
int m_timeout;
ShutdownDialogAction m_action;
QString m_msg;
};
#endif // SHUTDOWNCONFIRM_H
#endif // SHUTDOWNCONFIRMDIALOG_H

8
src/gui/shutdownconfirmdlg.ui → src/gui/shutdownconfirmdialog.ui

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>confirmShutdownDlg</class>
<widget class="QDialog" name="confirmShutdownDlg">
<class>ShutdownConfirmDialog</class>
<widget class="QDialog" name="ShutdownConfirmDialog">
<property name="geometry">
<rect>
<x>0</x>
@ -94,7 +94,7 @@ @@ -94,7 +94,7 @@
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>confirmShutdownDlg</receiver>
<receiver>ShutdownConfirmDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
@ -110,7 +110,7 @@ @@ -110,7 +110,7 @@
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>confirmShutdownDlg</receiver>
<receiver>ShutdownConfirmDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">

6
src/gui/speedlimitdlg.cpp → src/gui/speedlimitdialog.cpp

@ -26,15 +26,15 @@ @@ -26,15 +26,15 @@
* exception statement from your version.
*/
#include "speedlimitdlg.h"
#include "speedlimitdialog.h"
#include "base/unicodestrings.h"
#include "ui_bandwidth_limit.h"
#include "ui_speedlimitdialog.h"
#include "utils.h"
SpeedLimitDialog::SpeedLimitDialog(QWidget *parent)
: QDialog(parent)
, m_ui(new Ui::bandwidth_dlg())
, m_ui(new Ui::SpeedLimitDialog())
{
m_ui->setupUi(this);
qDebug("Bandwidth allocation dialog creation");

10
src/gui/speedlimitdlg.h → src/gui/speedlimitdialog.h

@ -26,8 +26,8 @@ @@ -26,8 +26,8 @@
* exception statement from your version.
*/
#ifndef BANDWIDTH_ALLOCATION_H
#define BANDWIDTH_ALLOCATION_H
#ifndef SPEEDLIMITDIALOG_H
#define SPEEDLIMITDIALOG_H
#include <QDialog>
#include <QList>
@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
namespace Ui
{
class bandwidth_dlg;
class SpeedLimitDialog;
}
class SpeedLimitDialog : public QDialog
@ -57,7 +57,7 @@ protected slots: @@ -57,7 +57,7 @@ protected slots:
private:
long getSpeedLimit() const;
Ui::bandwidth_dlg *m_ui;
Ui::SpeedLimitDialog *m_ui;
};
#endif // BANDWIDTH_ALLOCATION_H
#endif // SPEEDLIMITDIALOG_H

8
src/gui/bandwidth_limit.ui → src/gui/speedlimitdialog.ui

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>bandwidth_dlg</class>
<widget class="QDialog" name="bandwidth_dlg">
<class>SpeedLimitDialog</class>
<widget class="QDialog" name="SpeedLimitDialog">
<property name="geometry">
<rect>
<x>0</x>
@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>bandwidth_dlg</receiver>
<receiver>SpeedLimitDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
@ -62,7 +62,7 @@ @@ -62,7 +62,7 @@
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>bandwidth_dlg</receiver>
<receiver>SpeedLimitDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">

2
src/gui/statusbar.cpp

@ -40,7 +40,7 @@ @@ -40,7 +40,7 @@
#include "base/bittorrent/sessionstatus.h"
#include "base/utils/misc.h"
#include "guiiconprovider.h"
#include "speedlimitdlg.h"
#include "speedlimitdialog.h"
#include "utils.h"
StatusBar::StatusBar(QWidget *parent)

52
src/gui/torrentcreatordlg.cpp → src/gui/torrentcreatordialog.cpp

@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
* exception statement from your version.
*/
#include "torrentcreatordlg.h"
#include "torrentcreatordialog.h"
#include <QCloseEvent>
#include <QDebug>
@ -41,14 +41,14 @@ @@ -41,14 +41,14 @@
#include "base/bittorrent/torrentinfo.h"
#include "base/global.h"
#include "base/utils/fs.h"
#include "ui_torrentcreatordlg.h"
#include "ui_torrentcreatordialog.h"
#include "utils.h"
#define SETTINGS_KEY(name) "TorrentCreator/" name
TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent, const QString &defaultPath)
TorrentCreatorDialog::TorrentCreatorDialog(QWidget *parent, const QString &defaultPath)
: QDialog(parent)
, m_ui(new Ui::TorrentCreatorDlg)
, m_ui(new Ui::TorrentCreatorDialog)
, m_creatorThread(new BitTorrent::TorrentCreatorThread(this))
, m_storeDialogSize(SETTINGS_KEY("Dimension"))
, m_storePieceSize(SETTINGS_KEY("PieceSize"))
@ -69,14 +69,14 @@ TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent, const QString &defaultPath @@ -69,14 +69,14 @@ TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent, const QString &defaultPath
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Create Torrent"));
connect(m_ui->addFileButton, &QPushButton::clicked, this, &TorrentCreatorDlg::onAddFileButtonClicked);
connect(m_ui->addFolderButton, &QPushButton::clicked, this, &TorrentCreatorDlg::onAddFolderButtonClicked);
connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &TorrentCreatorDlg::onCreateButtonClicked);
connect(m_ui->buttonCalcTotalPieces, &QPushButton::clicked, this, &TorrentCreatorDlg::updatePiecesCount);
connect(m_ui->addFileButton, &QPushButton::clicked, this, &TorrentCreatorDialog::onAddFileButtonClicked);
connect(m_ui->addFolderButton, &QPushButton::clicked, this, &TorrentCreatorDialog::onAddFolderButtonClicked);
connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &TorrentCreatorDialog::onCreateButtonClicked);
connect(m_ui->buttonCalcTotalPieces, &QPushButton::clicked, this, &TorrentCreatorDialog::updatePiecesCount);
connect(m_creatorThread, &BitTorrent::TorrentCreatorThread::creationSuccess, this, &TorrentCreatorDlg::handleCreationSuccess);
connect(m_creatorThread, &BitTorrent::TorrentCreatorThread::creationFailure, this, &TorrentCreatorDlg::handleCreationFailure);
connect(m_creatorThread, &BitTorrent::TorrentCreatorThread::updateProgress, this, &TorrentCreatorDlg::updateProgressBar);
connect(m_creatorThread, &BitTorrent::TorrentCreatorThread::creationSuccess, this, &TorrentCreatorDialog::handleCreationSuccess);
connect(m_creatorThread, &BitTorrent::TorrentCreatorThread::creationFailure, this, &TorrentCreatorDialog::handleCreationFailure);
connect(m_creatorThread, &BitTorrent::TorrentCreatorThread::updateProgress, this, &TorrentCreatorDialog::updateProgressBar);
loadSettings();
updateInputPath(defaultPath);
@ -84,41 +84,41 @@ TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent, const QString &defaultPath @@ -84,41 +84,41 @@ TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent, const QString &defaultPath
show();
}
TorrentCreatorDlg::~TorrentCreatorDlg()
TorrentCreatorDialog::~TorrentCreatorDialog()
{
saveSettings();
delete m_ui;
}
void TorrentCreatorDlg::updateInputPath(const QString &path)
void TorrentCreatorDialog::updateInputPath(const QString &path)
{
if (path.isEmpty()) return;
m_ui->textInputPath->setText(Utils::Fs::toNativePath(path));
updateProgressBar(0);
}
void TorrentCreatorDlg::onAddFolderButtonClicked()
void TorrentCreatorDialog::onAddFolderButtonClicked()
{
QString oldPath = m_ui->textInputPath->text();
QString path = QFileDialog::getExistingDirectory(this, tr("Select folder"), oldPath);
updateInputPath(path);
}
void TorrentCreatorDlg::onAddFileButtonClicked()
void TorrentCreatorDialog::onAddFileButtonClicked()
{
QString oldPath = m_ui->textInputPath->text();
QString path = QFileDialog::getOpenFileName(this, tr("Select file"), oldPath);
updateInputPath(path);
}
int TorrentCreatorDlg::getPieceSize() const
int TorrentCreatorDialog::getPieceSize() const
{
const int pieceSizes[] = {0, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768}; // base unit in KiB
return pieceSizes[m_ui->comboPieceSize->currentIndex()] * 1024;
}
void TorrentCreatorDlg::dropEvent(QDropEvent *event)
void TorrentCreatorDialog::dropEvent(QDropEvent *event)
{
event->acceptProposedAction();
@ -131,14 +131,14 @@ void TorrentCreatorDlg::dropEvent(QDropEvent *event) @@ -131,14 +131,14 @@ void TorrentCreatorDlg::dropEvent(QDropEvent *event)
}
}
void TorrentCreatorDlg::dragEnterEvent(QDragEnterEvent *event)
void TorrentCreatorDialog::dragEnterEvent(QDragEnterEvent *event)
{
if (event->mimeData()->hasFormat("text/plain") || event->mimeData()->hasFormat("text/uri-list"))
event->acceptProposedAction();
}
// Main function that create a .torrent file
void TorrentCreatorDlg::onCreateButtonClicked()
void TorrentCreatorDialog::onCreateButtonClicked()
{
QString input = Utils::Fs::fromNativePath(m_ui->textInputPath->text()).trimmed();
@ -175,7 +175,7 @@ void TorrentCreatorDlg::onCreateButtonClicked() @@ -175,7 +175,7 @@ void TorrentCreatorDlg::onCreateButtonClicked()
, input, destination, comment, source, trackers, urlSeeds });
}
void TorrentCreatorDlg::handleCreationFailure(const QString &msg)
void TorrentCreatorDialog::handleCreationFailure(const QString &msg)
{
// Remove busy cursor
setCursor(QCursor(Qt::ArrowCursor));
@ -183,7 +183,7 @@ void TorrentCreatorDlg::handleCreationFailure(const QString &msg) @@ -183,7 +183,7 @@ void TorrentCreatorDlg::handleCreationFailure(const QString &msg)
setInteractionEnabled(true);
}
void TorrentCreatorDlg::handleCreationSuccess(const QString &path, const QString &branchPath)
void TorrentCreatorDialog::handleCreationSuccess(const QString &path, const QString &branchPath)
{
// Remove busy cursor
setCursor(QCursor(Qt::ArrowCursor));
@ -207,12 +207,12 @@ void TorrentCreatorDlg::handleCreationSuccess(const QString &path, const QString @@ -207,12 +207,12 @@ void TorrentCreatorDlg::handleCreationSuccess(const QString &path, const QString
setInteractionEnabled(true);
}
void TorrentCreatorDlg::updateProgressBar(int progress)
void TorrentCreatorDialog::updateProgressBar(int progress)
{
m_ui->progressBar->setValue(progress);
}
void TorrentCreatorDlg::updatePiecesCount()
void TorrentCreatorDialog::updatePiecesCount()
{
const QString path = m_ui->textInputPath->text().trimmed();
const bool isAlignmentOptimized = m_ui->checkOptimizeAlignment->isChecked();
@ -221,7 +221,7 @@ void TorrentCreatorDlg::updatePiecesCount() @@ -221,7 +221,7 @@ void TorrentCreatorDlg::updatePiecesCount()
m_ui->labelTotalPieces->setText(QString::number(count));
}
void TorrentCreatorDlg::setInteractionEnabled(bool enabled)
void TorrentCreatorDialog::setInteractionEnabled(bool enabled)
{
m_ui->textInputPath->setEnabled(enabled);
m_ui->addFileButton->setEnabled(enabled);
@ -236,7 +236,7 @@ void TorrentCreatorDlg::setInteractionEnabled(bool enabled) @@ -236,7 +236,7 @@ void TorrentCreatorDlg::setInteractionEnabled(bool enabled)
m_ui->checkIgnoreShareLimits->setEnabled(enabled && m_ui->checkStartSeeding->isChecked());
}
void TorrentCreatorDlg::saveSettings()
void TorrentCreatorDialog::saveSettings()
{
m_storeLastAddPath = m_ui->textInputPath->text().trimmed();
@ -254,7 +254,7 @@ void TorrentCreatorDlg::saveSettings() @@ -254,7 +254,7 @@ void TorrentCreatorDlg::saveSettings()
m_storeDialogSize = size();
}
void TorrentCreatorDlg::loadSettings()
void TorrentCreatorDialog::loadSettings()
{
m_ui->textInputPath->setText(m_storeLastAddPath);

16
src/gui/torrentcreatordlg.h → src/gui/torrentcreatordialog.h

@ -27,8 +27,8 @@ @@ -27,8 +27,8 @@
* exception statement from your version.
*/
#ifndef TORRENTCREATORDLG_H
#define TORRENTCREATORDLG_H
#ifndef TORRENTCREATORDIALOG_H
#define TORRENTCREATORDIALOG_H
#include <QDialog>
@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
namespace Ui
{
class TorrentCreatorDlg;
class TorrentCreatorDialog;
}
namespace BitTorrent
@ -44,13 +44,13 @@ namespace BitTorrent @@ -44,13 +44,13 @@ namespace BitTorrent
class TorrentCreatorThread;
}
class TorrentCreatorDlg : public QDialog
class TorrentCreatorDialog : public QDialog
{
Q_OBJECT
public:
TorrentCreatorDlg(QWidget *parent = nullptr, const QString &defaultPath = QString());
~TorrentCreatorDlg();
TorrentCreatorDialog(QWidget *parent = nullptr, const QString &defaultPath = QString());
~TorrentCreatorDialog();
void updateInputPath(const QString &path);
private slots:
@ -71,7 +71,7 @@ private: @@ -71,7 +71,7 @@ private:
int getPieceSize() const;
void setInteractionEnabled(bool enabled);
Ui::TorrentCreatorDlg *m_ui;
Ui::TorrentCreatorDialog *m_ui;
BitTorrent::TorrentCreatorThread *m_creatorThread;
// settings
@ -89,4 +89,4 @@ private: @@ -89,4 +89,4 @@ private:
CachedSettingValue<QString> m_storeSource;
};
#endif // TORRENTCREATORDLG_H
#endif // TORRENTCREATORDIALOG_H

6
src/gui/torrentcreatordlg.ui → src/gui/torrentcreatordialog.ui

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TorrentCreatorDlg</class>
<widget class="QDialog" name="TorrentCreatorDlg">
<class>TorrentCreatorDialog</class>
<widget class="QDialog" name="TorrentCreatorDialog">
<property name="geometry">
<rect>
<x>0</x>
@ -365,7 +365,7 @@ @@ -365,7 +365,7 @@
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>TorrentCreatorDlg</receiver>
<receiver>TorrentCreatorDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">

16
src/gui/trackerlogin.cpp → src/gui/trackerlogindialog.cpp

@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
* exception statement from your version.
*/
#include "trackerlogin.h"
#include "trackerlogindialog.h"
#include <libtorrent/version.hpp>
@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
#include "base/bittorrent/torrenthandle.h"
#include "utils.h"
trackerLogin::trackerLogin(QWidget *parent, BitTorrent::TorrentHandle *const torrent)
TrackerLoginDialog::TrackerLoginDialog(QWidget *parent, BitTorrent::TorrentHandle *const torrent)
: QDialog(parent)
, m_torrent(torrent)
{
@ -48,9 +48,9 @@ trackerLogin::trackerLogin(QWidget *parent, BitTorrent::TorrentHandle *const tor @@ -48,9 +48,9 @@ trackerLogin::trackerLogin(QWidget *parent, BitTorrent::TorrentHandle *const tor
tracker_url->setText(torrent->currentTracker());
connect(buttonBox, &QDialogButtonBox::accepted, this, &trackerLogin::loginButtonClicked);
connect(buttonBox, &QDialogButtonBox::rejected, this, &trackerLogin::cancelButtonClicked);
connect(linePasswd, &QLineEdit::returnPressed, this, &trackerLogin::loginButtonClicked);
connect(buttonBox, &QDialogButtonBox::accepted, this, &TrackerLoginDialog::loginButtonClicked);
connect(buttonBox, &QDialogButtonBox::rejected, this, &TrackerLoginDialog::cancelButtonClicked);
connect(linePasswd, &QLineEdit::returnPressed, this, &TrackerLoginDialog::loginButtonClicked);
connect(this, SIGNAL(trackerLoginCancelled(QPair<BitTorrent::TorrentHandle*, QString>)), // TODO: use Qt5 connect syntax
parent, SLOT(addUnauthenticatedTracker(QPair<BitTorrent::TorrentHandle*, QString>)));
@ -58,9 +58,9 @@ trackerLogin::trackerLogin(QWidget *parent, BitTorrent::TorrentHandle *const tor @@ -58,9 +58,9 @@ trackerLogin::trackerLogin(QWidget *parent, BitTorrent::TorrentHandle *const tor
show();
}
trackerLogin::~trackerLogin() {}
TrackerLoginDialog::~TrackerLoginDialog() {}
void trackerLogin::loginButtonClicked()
void TrackerLoginDialog::loginButtonClicked()
{
// login
#if LIBTORRENT_VERSION_NUM < 10100
@ -69,7 +69,7 @@ void trackerLogin::loginButtonClicked() @@ -69,7 +69,7 @@ void trackerLogin::loginButtonClicked()
accept();
}
void trackerLogin::cancelButtonClicked()
void TrackerLoginDialog::cancelButtonClicked()
{
// Emit a signal to GUI to stop asking for authentication
emit trackerLoginCancelled(qMakePair(m_torrent, m_torrent->currentTracker()));

15
src/gui/trackerlogin.h → src/gui/trackerlogindialog.h

@ -26,27 +26,28 @@ @@ -26,27 +26,28 @@
* exception statement from your version.
*/
#ifndef TRACKERLOGIN_H
#define TRACKERLOGIN_H
#ifndef TRACKERLOGINDIALOG_H
#define TRACKERLOGINDIALOG_H
#include <QDialog>
#include "ui_login.h"
#include "ui_trackerlogindialog.h"
namespace BitTorrent
{
class TorrentHandle;
}
class trackerLogin : public QDialog, private Ui::authentication{
class TrackerLoginDialog : public QDialog, private Ui::TrackerLoginDialog
{
Q_OBJECT
private:
BitTorrent::TorrentHandle *const m_torrent;
public:
trackerLogin(QWidget *parent, BitTorrent::TorrentHandle *const torrent);
~trackerLogin();
TrackerLoginDialog(QWidget *parent, BitTorrent::TorrentHandle *const torrent);
~TrackerLoginDialog();
signals:
void trackerLoginCancelled(QPair<BitTorrent::TorrentHandle*, QString> tracker);
@ -56,4 +57,4 @@ class trackerLogin : public QDialog, private Ui::authentication{ @@ -56,4 +57,4 @@ class trackerLogin : public QDialog, private Ui::authentication{
void cancelButtonClicked();
};
#endif // TRACKERLOGIN_H
#endif // TRACKERLOGINDIALOG_H

4
src/gui/login.ui → src/gui/trackerlogindialog.ui

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>authentication</class>
<widget class="QDialog" name="authentication">
<class>TrackerLoginDialog</class>
<widget class="QDialog" name="TrackerLoginDialog">
<property name="geometry">
<rect>
<x>0</x>

54
src/gui/transferlistdelegate.cpp

@ -44,7 +44,7 @@ @@ -44,7 +44,7 @@
#include "base/unicodestrings.h"
#include "base/utils/misc.h"
#include "base/utils/string.h"
#include "torrentmodel.h"
#include "transferlistmodel.h"
TransferListDelegate::TransferListDelegate(QObject *parent)
: QItemDelegate(parent)
@ -56,7 +56,7 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & @@ -56,7 +56,7 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
painter->save();
bool isHideState = true;
if (Preferences::instance()->getHideZeroComboValues() == 1) { // paused torrents only
QModelIndex stateIndex = index.sibling(index.row(), TorrentModel::TR_STATUS);
QModelIndex stateIndex = index.sibling(index.row(), TransferListModel::TR_STATUS);
if (stateIndex.data().value<BitTorrent::TorrentState>() != BitTorrent::TorrentState::PausedDownloading)
isHideState = false;
}
@ -65,14 +65,14 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & @@ -65,14 +65,14 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
QStyleOptionViewItem opt = QItemDelegate::setOptions(index, option);
QItemDelegate::drawBackground(painter, opt, index);
switch (index.column()) {
case TorrentModel::TR_AMOUNT_DOWNLOADED:
case TorrentModel::TR_AMOUNT_UPLOADED:
case TorrentModel::TR_AMOUNT_DOWNLOADED_SESSION:
case TorrentModel::TR_AMOUNT_UPLOADED_SESSION:
case TorrentModel::TR_AMOUNT_LEFT:
case TorrentModel::TR_COMPLETED:
case TorrentModel::TR_SIZE:
case TorrentModel::TR_TOTAL_SIZE: {
case TransferListModel::TR_AMOUNT_DOWNLOADED:
case TransferListModel::TR_AMOUNT_UPLOADED:
case TransferListModel::TR_AMOUNT_DOWNLOADED_SESSION:
case TransferListModel::TR_AMOUNT_UPLOADED_SESSION:
case TransferListModel::TR_AMOUNT_LEFT:
case TransferListModel::TR_COMPLETED:
case TransferListModel::TR_SIZE:
case TransferListModel::TR_TOTAL_SIZE: {
qlonglong size = index.data().toLongLong();
if (hideValues && !size)
break;
@ -80,13 +80,13 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & @@ -80,13 +80,13 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
QItemDelegate::drawDisplay(painter, opt, option.rect, Utils::Misc::friendlyUnit(size));
}
break;
case TorrentModel::TR_ETA: {
case TransferListModel::TR_ETA: {
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter;
QItemDelegate::drawDisplay(painter, opt, option.rect, Utils::Misc::userFriendlyDuration(index.data().toLongLong()));
break;
}
case TorrentModel::TR_SEEDS:
case TorrentModel::TR_PEERS: {
case TransferListModel::TR_SEEDS:
case TransferListModel::TR_PEERS: {
qlonglong value = index.data().toLongLong();
qlonglong total = index.data(Qt::UserRole).toLongLong();
if (hideValues && (!value && !total))
@ -96,14 +96,14 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & @@ -96,14 +96,14 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
QItemDelegate::drawDisplay(painter, opt, opt.rect, display);
}
break;
case TorrentModel::TR_STATUS: {
case TransferListModel::TR_STATUS: {
const auto state = index.data().value<BitTorrent::TorrentState>();
QString display = getStatusString(state);
QItemDelegate::drawDisplay(painter, opt, opt.rect, display);
}
break;
case TorrentModel::TR_UPSPEED:
case TorrentModel::TR_DLSPEED: {
case TransferListModel::TR_UPSPEED:
case TransferListModel::TR_DLSPEED: {
const qulonglong speed = index.data().toULongLong();
if (hideValues && !speed)
break;
@ -111,8 +111,8 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & @@ -111,8 +111,8 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
QItemDelegate::drawDisplay(painter, opt, opt.rect, Utils::Misc::friendlyUnit(speed, true));
}
break;
case TorrentModel::TR_UPLIMIT:
case TorrentModel::TR_DLLIMIT: {
case TransferListModel::TR_UPLIMIT:
case TransferListModel::TR_DLLIMIT: {
const qlonglong limit = index.data().toLongLong();
if (hideValues && !limit)
break;
@ -120,7 +120,7 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & @@ -120,7 +120,7 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
QItemDelegate::drawDisplay(painter, opt, opt.rect, limit > 0 ? Utils::Misc::friendlyUnit(limit, true) : QString::fromUtf8(C_INFINITY));
}
break;
case TorrentModel::TR_TIME_ELAPSED: {
case TransferListModel::TR_TIME_ELAPSED: {
const int elapsedTime = index.data().toInt();
const int seedingTime = index.data(Qt::UserRole).toInt();
const QString txt = (seedingTime > 0)
@ -131,12 +131,12 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & @@ -131,12 +131,12 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
QItemDelegate::drawDisplay(painter, opt, opt.rect, txt);
}
break;
case TorrentModel::TR_ADD_DATE:
case TorrentModel::TR_SEED_DATE:
case TransferListModel::TR_ADD_DATE:
case TransferListModel::TR_SEED_DATE:
QItemDelegate::drawDisplay(painter, opt, opt.rect, index.data().toDateTime().toLocalTime().toString(Qt::DefaultLocaleShortDate));
break;
case TorrentModel::TR_RATIO_LIMIT:
case TorrentModel::TR_RATIO: {
case TransferListModel::TR_RATIO_LIMIT:
case TransferListModel::TR_RATIO: {
const qreal ratio = index.data().toDouble();
if (hideValues && (ratio <= 0))
break;
@ -145,7 +145,7 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & @@ -145,7 +145,7 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
QItemDelegate::drawDisplay(painter, opt, opt.rect, str);
}
break;
case TorrentModel::TR_PRIORITY: {
case TransferListModel::TR_PRIORITY: {
const int priority = index.data().toInt();
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter;
if (priority > 0) {
@ -156,7 +156,7 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & @@ -156,7 +156,7 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
}
}
break;
case TorrentModel::TR_PROGRESS: {
case TransferListModel::TR_PROGRESS: {
QStyleOptionProgressBar newopt;
qreal progress = index.data().toDouble() * 100.;
newopt.rect = opt.rect;
@ -175,7 +175,7 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & @@ -175,7 +175,7 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
#endif
}
break;
case TorrentModel::TR_LAST_ACTIVITY: {
case TransferListModel::TR_LAST_ACTIVITY: {
qlonglong elapsed = index.data().toLongLong();
if (hideValues && ((elapsed < 0) || (elapsed >= MAX_ETA)))
break;
@ -213,7 +213,7 @@ QSize TransferListDelegate::sizeHint(const QStyleOptionViewItem &option, const Q @@ -213,7 +213,7 @@ QSize TransferListDelegate::sizeHint(const QStyleOptionViewItem &option, const Q
static int nameColHeight = -1;
if (nameColHeight == -1) {
QModelIndex nameColumn = index.sibling(index.row(), TorrentModel::TR_NAME);
QModelIndex nameColumn = index.sibling(index.row(), TransferListModel::TR_NAME);
nameColHeight = QItemDelegate::sizeHint(option, nameColumn).height();
}

42
src/gui/transferlistfilterswidget.cpp

@ -52,8 +52,8 @@ @@ -52,8 +52,8 @@
#include "categoryfilterwidget.h"
#include "guiiconprovider.h"
#include "tagfilterwidget.h"
#include "torrentmodel.h"
#include "transferlistdelegate.h"
#include "transferlistmodel.h"
#include "transferlistwidget.h"
#include "utils.h"
@ -71,7 +71,7 @@ namespace @@ -71,7 +71,7 @@ namespace
const QLatin1String GOOGLE_FAVICON_URL("https://www.google.com/s2/favicons?domain=");
}
FiltersBase::FiltersBase(QWidget *parent, TransferListWidget *transferList)
BaseFilterWidget::BaseFilterWidget(QWidget *parent, TransferListWidget *transferList)
: QListWidget(parent)
, transferList(transferList)
{
@ -89,16 +89,16 @@ FiltersBase::FiltersBase(QWidget *parent, TransferListWidget *transferList) @@ -89,16 +89,16 @@ FiltersBase::FiltersBase(QWidget *parent, TransferListWidget *transferList)
#endif
setContextMenuPolicy(Qt::CustomContextMenu);
connect(this, &FiltersBase::customContextMenuRequested, this, &FiltersBase::showMenu);
connect(this, &FiltersBase::currentRowChanged, this, &FiltersBase::applyFilter);
connect(this, &BaseFilterWidget::customContextMenuRequested, this, &BaseFilterWidget::showMenu);
connect(this, &BaseFilterWidget::currentRowChanged, this, &BaseFilterWidget::applyFilter);
connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentAdded
, this, &FiltersBase::handleNewTorrent);
, this, &BaseFilterWidget::handleNewTorrent);
connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentAboutToBeRemoved
, this, &FiltersBase::torrentAboutToBeDeleted);
, this, &BaseFilterWidget::torrentAboutToBeDeleted);
}
QSize FiltersBase::sizeHint() const
QSize BaseFilterWidget::sizeHint() const
{
return {
// Width should be exactly the width of the content
@ -108,14 +108,14 @@ QSize FiltersBase::sizeHint() const @@ -108,14 +108,14 @@ QSize FiltersBase::sizeHint() const
};
}
QSize FiltersBase::minimumSizeHint() const
QSize BaseFilterWidget::minimumSizeHint() const
{
QSize size = sizeHint();
size.setWidth(6);
return size;
}
void FiltersBase::toggleFilter(bool checked)
void BaseFilterWidget::toggleFilter(bool checked)
{
setVisible(checked);
if (checked)
@ -124,11 +124,11 @@ void FiltersBase::toggleFilter(bool checked) @@ -124,11 +124,11 @@ void FiltersBase::toggleFilter(bool checked)
applyFilter(0);
}
StatusFiltersWidget::StatusFiltersWidget(QWidget *parent, TransferListWidget *transferList)
: FiltersBase(parent, transferList)
StatusFilterWidget::StatusFilterWidget(QWidget *parent, TransferListWidget *transferList)
: BaseFilterWidget(parent, transferList)
{
connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentsUpdated
, this, &StatusFiltersWidget::updateTorrentNumbers);
, this, &StatusFilterWidget::updateTorrentNumbers);
// Add status filters
QListWidgetItem *all = new QListWidgetItem(this);
@ -164,12 +164,12 @@ StatusFiltersWidget::StatusFiltersWidget(QWidget *parent, TransferListWidget *tr @@ -164,12 +164,12 @@ StatusFiltersWidget::StatusFiltersWidget(QWidget *parent, TransferListWidget *tr
toggleFilter(pref->getStatusFilterState());
}
StatusFiltersWidget::~StatusFiltersWidget()
StatusFilterWidget::~StatusFilterWidget()
{
Preferences::instance()->setTransSelFilter(currentRow());
}
void StatusFiltersWidget::updateTorrentNumbers()
void StatusFilterWidget::updateTorrentNumbers()
{
auto report = BitTorrent::Session::instance()->torrentStatusReport();
@ -184,19 +184,19 @@ void StatusFiltersWidget::updateTorrentNumbers() @@ -184,19 +184,19 @@ void StatusFiltersWidget::updateTorrentNumbers()
item(TorrentFilter::Errored)->setData(Qt::DisplayRole, QVariant(tr("Errored (%1)").arg(report.nbErrored)));
}
void StatusFiltersWidget::showMenu(QPoint) {}
void StatusFilterWidget::showMenu(QPoint) {}
void StatusFiltersWidget::applyFilter(int row)
void StatusFilterWidget::applyFilter(int row)
{
transferList->applyStatusFilter(row);
}
void StatusFiltersWidget::handleNewTorrent(BitTorrent::TorrentHandle *const) {}
void StatusFilterWidget::handleNewTorrent(BitTorrent::TorrentHandle *const) {}
void StatusFiltersWidget::torrentAboutToBeDeleted(BitTorrent::TorrentHandle *const) {}
void StatusFilterWidget::torrentAboutToBeDeleted(BitTorrent::TorrentHandle *const) {}
TrackerFiltersList::TrackerFiltersList(QWidget *parent, TransferListWidget *transferList)
: FiltersBase(parent, transferList)
: BaseFilterWidget(parent, transferList)
, m_totalTorrents(0)
, m_downloadTrackerFavicon(true)
{
@ -590,7 +590,7 @@ TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferLi @@ -590,7 +590,7 @@ TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferLi
statusLabel->setFont(font);
frameLayout->addWidget(statusLabel);
StatusFiltersWidget *statusFilters = new StatusFiltersWidget(this, transferList);
StatusFilterWidget *statusFilters = new StatusFilterWidget(this, transferList);
frameLayout->addWidget(statusFilters);
QCheckBox *categoryLabel = new QCheckBox(tr("Categories"), this);
@ -638,7 +638,7 @@ TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferLi @@ -638,7 +638,7 @@ TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferLi
m_trackerFilters = new TrackerFiltersList(this, transferList);
frameLayout->addWidget(m_trackerFilters);
connect(statusLabel, &QCheckBox::toggled, statusFilters, &StatusFiltersWidget::toggleFilter);
connect(statusLabel, &QCheckBox::toggled, statusFilters, &StatusFilterWidget::toggleFilter);
connect(statusLabel, &QCheckBox::toggled, pref, &Preferences::setStatusFilterState);
connect(trackerLabel, &QCheckBox::toggled, m_trackerFilters, &TrackerFiltersList::toggleFilter);
connect(trackerLabel, &QCheckBox::toggled, pref, &Preferences::setTrackerFilterState);

12
src/gui/transferlistfilterswidget.h

@ -42,12 +42,12 @@ namespace BitTorrent @@ -42,12 +42,12 @@ namespace BitTorrent
class TrackerEntry;
}
class FiltersBase : public QListWidget
class BaseFilterWidget : public QListWidget
{
Q_OBJECT
public:
FiltersBase(QWidget *parent, TransferListWidget *transferList);
BaseFilterWidget(QWidget *parent, TransferListWidget *transferList);
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
@ -65,13 +65,13 @@ private slots: @@ -65,13 +65,13 @@ private slots:
virtual void torrentAboutToBeDeleted(BitTorrent::TorrentHandle *const) = 0;
};
class StatusFiltersWidget : public FiltersBase
class StatusFilterWidget : public BaseFilterWidget
{
Q_OBJECT
public:
StatusFiltersWidget(QWidget *parent, TransferListWidget *transferList);
~StatusFiltersWidget();
StatusFilterWidget(QWidget *parent, TransferListWidget *transferList);
~StatusFilterWidget();
private slots:
void updateTorrentNumbers();
@ -85,7 +85,7 @@ private: @@ -85,7 +85,7 @@ private:
void torrentAboutToBeDeleted(BitTorrent::TorrentHandle *const) override;
};
class TrackerFiltersList : public FiltersBase
class TrackerFiltersList : public BaseFilterWidget
{
Q_OBJECT

46
src/gui/torrentmodel.cpp → src/gui/transferlistmodel.cpp

@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
* exception statement from your version.
*/
#include "torrentmodel.h"
#include "transferlistmodel.h"
#include <QApplication>
#include <QDebug>
@ -54,9 +54,9 @@ static QIcon getErrorIcon(); @@ -54,9 +54,9 @@ static QIcon getErrorIcon();
static bool isDarkTheme();
// TorrentModel
// TransferListModel
TorrentModel::TorrentModel(QObject *parent)
TransferListModel::TransferListModel(QObject *parent)
: QAbstractListModel(parent)
{
// Load the torrents
@ -65,30 +65,30 @@ TorrentModel::TorrentModel(QObject *parent) @@ -65,30 +65,30 @@ TorrentModel::TorrentModel(QObject *parent)
addTorrent(torrent);
// Listen for torrent changes
connect(Session::instance(), &Session::torrentAdded, this, &TorrentModel::addTorrent);
connect(Session::instance(), &Session::torrentAboutToBeRemoved, this, &TorrentModel::handleTorrentAboutToBeRemoved);
connect(Session::instance(), &Session::torrentsUpdated, this, &TorrentModel::handleTorrentsUpdated);
connect(Session::instance(), &Session::torrentFinished, this, &TorrentModel::handleTorrentStatusUpdated);
connect(Session::instance(), &Session::torrentMetadataLoaded, this, &TorrentModel::handleTorrentStatusUpdated);
connect(Session::instance(), &Session::torrentResumed, this, &TorrentModel::handleTorrentStatusUpdated);
connect(Session::instance(), &Session::torrentPaused, this, &TorrentModel::handleTorrentStatusUpdated);
connect(Session::instance(), &Session::torrentFinishedChecking, this, &TorrentModel::handleTorrentStatusUpdated);
connect(Session::instance(), &Session::torrentAdded, this, &TransferListModel::addTorrent);
connect(Session::instance(), &Session::torrentAboutToBeRemoved, this, &TransferListModel::handleTorrentAboutToBeRemoved);
connect(Session::instance(), &Session::torrentsUpdated, this, &TransferListModel::handleTorrentsUpdated);
connect(Session::instance(), &Session::torrentFinished, this, &TransferListModel::handleTorrentStatusUpdated);
connect(Session::instance(), &Session::torrentMetadataLoaded, this, &TransferListModel::handleTorrentStatusUpdated);
connect(Session::instance(), &Session::torrentResumed, this, &TransferListModel::handleTorrentStatusUpdated);
connect(Session::instance(), &Session::torrentPaused, this, &TransferListModel::handleTorrentStatusUpdated);
connect(Session::instance(), &Session::torrentFinishedChecking, this, &TransferListModel::handleTorrentStatusUpdated);
}
int TorrentModel::rowCount(const QModelIndex &index) const
int TransferListModel::rowCount(const QModelIndex &index) const
{
Q_UNUSED(index);
return m_torrents.size();
}
int TorrentModel::columnCount(const QModelIndex &parent) const
int TransferListModel::columnCount(const QModelIndex &parent) const
{
Q_UNUSED(parent);
return NB_COLUMNS;
}
QVariant TorrentModel::headerData(int section, Qt::Orientation orientation, int role) const
QVariant TransferListModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (orientation == Qt::Horizontal) {
if (role == Qt::DisplayRole) {
@ -158,7 +158,7 @@ QVariant TorrentModel::headerData(int section, Qt::Orientation orientation, int @@ -158,7 +158,7 @@ QVariant TorrentModel::headerData(int section, Qt::Orientation orientation, int
return QVariant();
}
QVariant TorrentModel::data(const QModelIndex &index, int role) const
QVariant TransferListModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid()) return QVariant();
@ -247,7 +247,7 @@ QVariant TorrentModel::data(const QModelIndex &index, int role) const @@ -247,7 +247,7 @@ QVariant TorrentModel::data(const QModelIndex &index, int role) const
return QVariant();
}
bool TorrentModel::setData(const QModelIndex &index, const QVariant &value, int role)
bool TransferListModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
qDebug() << Q_FUNC_INFO << value;
if (!index.isValid() || (role != Qt::DisplayRole)) return false;
@ -271,7 +271,7 @@ bool TorrentModel::setData(const QModelIndex &index, const QVariant &value, int @@ -271,7 +271,7 @@ bool TorrentModel::setData(const QModelIndex &index, const QVariant &value, int
return true;
}
void TorrentModel::addTorrent(BitTorrent::TorrentHandle *const torrent)
void TransferListModel::addTorrent(BitTorrent::TorrentHandle *const torrent)
{
if (m_torrents.indexOf(torrent) == -1) {
const int row = m_torrents.size();
@ -281,7 +281,7 @@ void TorrentModel::addTorrent(BitTorrent::TorrentHandle *const torrent) @@ -281,7 +281,7 @@ void TorrentModel::addTorrent(BitTorrent::TorrentHandle *const torrent)
}
}
Qt::ItemFlags TorrentModel::flags(const QModelIndex &index) const
Qt::ItemFlags TransferListModel::flags(const QModelIndex &index) const
{
if (!index.isValid()) return 0;
@ -289,14 +289,14 @@ Qt::ItemFlags TorrentModel::flags(const QModelIndex &index) const @@ -289,14 +289,14 @@ Qt::ItemFlags TorrentModel::flags(const QModelIndex &index) const
return QAbstractListModel::flags(index) | Qt::ItemIsEditable;
}
BitTorrent::TorrentHandle *TorrentModel::torrentHandle(const QModelIndex &index) const
BitTorrent::TorrentHandle *TransferListModel::torrentHandle(const QModelIndex &index) const
{
if (!index.isValid()) return 0;
return m_torrents.value(index.row());
}
void TorrentModel::handleTorrentAboutToBeRemoved(BitTorrent::TorrentHandle *const torrent)
void TransferListModel::handleTorrentAboutToBeRemoved(BitTorrent::TorrentHandle *const torrent)
{
const int row = m_torrents.indexOf(torrent);
if (row >= 0) {
@ -306,14 +306,14 @@ void TorrentModel::handleTorrentAboutToBeRemoved(BitTorrent::TorrentHandle *cons @@ -306,14 +306,14 @@ void TorrentModel::handleTorrentAboutToBeRemoved(BitTorrent::TorrentHandle *cons
}
}
void TorrentModel::handleTorrentStatusUpdated(BitTorrent::TorrentHandle *const torrent)
void TransferListModel::handleTorrentStatusUpdated(BitTorrent::TorrentHandle *const torrent)
{
const int row = m_torrents.indexOf(torrent);
if (row >= 0)
emit dataChanged(index(row, 0), index(row, columnCount() - 1));
}
void TorrentModel::handleTorrentsUpdated()
void TransferListModel::handleTorrentsUpdated()
{
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
}

12
src/gui/torrentmodel.h → src/gui/transferlistmodel.h

@ -27,8 +27,8 @@ @@ -27,8 +27,8 @@
* exception statement from your version.
*/
#ifndef TORRENTMODEL_H
#define TORRENTMODEL_H
#ifndef TRANSFERLISTMODEL_H
#define TRANSFERLISTMODEL_H
#include <QAbstractListModel>
#include <QList>
@ -39,10 +39,10 @@ namespace BitTorrent @@ -39,10 +39,10 @@ namespace BitTorrent
class TorrentHandle;
}
class TorrentModel : public QAbstractListModel
class TransferListModel : public QAbstractListModel
{
Q_OBJECT
Q_DISABLE_COPY(TorrentModel)
Q_DISABLE_COPY(TransferListModel)
public:
enum Column
@ -81,7 +81,7 @@ public: @@ -81,7 +81,7 @@ public:
NB_COLUMNS
};
explicit TorrentModel(QObject *parent = nullptr);
explicit TransferListModel(QObject *parent = nullptr);
int rowCount(const QModelIndex& index = QModelIndex()) const override;
int columnCount(const QModelIndex &parent=QModelIndex()) const override;
@ -102,4 +102,4 @@ private: @@ -102,4 +102,4 @@ private:
QList<BitTorrent::TorrentHandle *> m_torrents;
};
#endif // TORRENTMODEL_H
#endif // TRANSFERLISTMODEL_H

48
src/gui/transferlistsortmodel.cpp

@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
#include "base/bittorrent/torrenthandle.h"
#include "base/types.h"
#include "base/utils/string.h"
#include "torrentmodel.h"
#include "transferlistmodel.h"
TransferListSortModel::TransferListSortModel(QObject *parent)
@ -86,9 +86,9 @@ void TransferListSortModel::disableTrackerFilter() @@ -86,9 +86,9 @@ void TransferListSortModel::disableTrackerFilter()
bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
{
switch (sortColumn()) {
case TorrentModel::TR_CATEGORY:
case TorrentModel::TR_TAGS:
case TorrentModel::TR_NAME: {
case TransferListModel::TR_CATEGORY:
case TransferListModel::TR_TAGS:
case TransferListModel::TR_NAME: {
const QVariant vL = left.data();
const QVariant vR = right.data();
if (!vL.isValid() || !vR.isValid() || (vL == vR))
@ -98,7 +98,7 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex @@ -98,7 +98,7 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex
return (result < 0);
}
case TorrentModel::TR_STATUS: {
case TransferListModel::TR_STATUS: {
// QSortFilterProxyModel::lessThan() uses the < operator only for specific QVariant types
// so our custom type is outside that list.
// In this case QSortFilterProxyModel::lessThan() converts other types to QString and
@ -112,18 +112,18 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex @@ -112,18 +112,18 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex
return lowerPositionThan(left, right);
}
case TorrentModel::TR_ADD_DATE:
case TorrentModel::TR_SEED_DATE:
case TorrentModel::TR_SEEN_COMPLETE_DATE: {
case TransferListModel::TR_ADD_DATE:
case TransferListModel::TR_SEED_DATE:
case TransferListModel::TR_SEEN_COMPLETE_DATE: {
return dateLessThan(sortColumn(), left, right, true);
}
case TorrentModel::TR_PRIORITY: {
case TransferListModel::TR_PRIORITY: {
return lowerPositionThan(left, right);
}
case TorrentModel::TR_SEEDS:
case TorrentModel::TR_PEERS: {
case TransferListModel::TR_SEEDS:
case TransferListModel::TR_PEERS: {
const int leftActive = left.data().toInt();
const int leftTotal = left.data(Qt::UserRole).toInt();
const int rightActive = right.data().toInt();
@ -139,8 +139,8 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex @@ -139,8 +139,8 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex
return lowerPositionThan(left, right);
}
case TorrentModel::TR_ETA: {
const TorrentModel *model = qobject_cast<TorrentModel *>(sourceModel());
case TransferListModel::TR_ETA: {
const TransferListModel *model = qobject_cast<TransferListModel *>(sourceModel());
// Sorting rules prioritized.
// 1. Active torrents at the top
@ -152,8 +152,8 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex @@ -152,8 +152,8 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex
if (isActiveL != isActiveR)
return isActiveL;
const int prioL = model->data(model->index(left.row(), TorrentModel::TR_PRIORITY)).toInt();
const int prioR = model->data(model->index(right.row(), TorrentModel::TR_PRIORITY)).toInt();
const int prioL = model->data(model->index(left.row(), TransferListModel::TR_PRIORITY)).toInt();
const int prioR = model->data(model->index(right.row(), TransferListModel::TR_PRIORITY)).toInt();
const bool isSeedingL = (prioL < 0);
const bool isSeedingR = (prioR < 0);
if (isSeedingL != isSeedingR) {
@ -170,7 +170,7 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex @@ -170,7 +170,7 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex
const bool isInvalidR = ((etaR < 0) || (etaR >= MAX_ETA));
if (isInvalidL && isInvalidR) {
if (isSeedingL) // Both seeding
return dateLessThan(TorrentModel::TR_SEED_DATE, left, right, true);
return dateLessThan(TransferListModel::TR_SEED_DATE, left, right, true);
else
return (prioL < prioR);
}
@ -182,7 +182,7 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex @@ -182,7 +182,7 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex
}
}
case TorrentModel::TR_LAST_ACTIVITY: {
case TransferListModel::TR_LAST_ACTIVITY: {
const qlonglong vL = left.data().toLongLong();
const qlonglong vR = right.data().toLongLong();
@ -192,7 +192,7 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex @@ -192,7 +192,7 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex
return vL < vR;
}
case TorrentModel::TR_RATIO_LIMIT: {
case TransferListModel::TR_RATIO_LIMIT: {
const qreal vL = left.data().toDouble();
const qreal vR = right.data().toDouble();
@ -213,11 +213,11 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex @@ -213,11 +213,11 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex
bool TransferListSortModel::lowerPositionThan(const QModelIndex &left, const QModelIndex &right) const
{
const TorrentModel *model = qobject_cast<TorrentModel *>(sourceModel());
const TransferListModel *model = qobject_cast<TransferListModel *>(sourceModel());
// Sort according to TR_PRIORITY
const int queueL = model->data(model->index(left.row(), TorrentModel::TR_PRIORITY)).toInt();
const int queueR = model->data(model->index(right.row(), TorrentModel::TR_PRIORITY)).toInt();
const int queueL = model->data(model->index(left.row(), TransferListModel::TR_PRIORITY)).toInt();
const int queueR = model->data(model->index(right.row(), TransferListModel::TR_PRIORITY)).toInt();
if ((queueL > 0) || (queueR > 0)) {
if ((queueL > 0) && (queueR > 0))
return queueL < queueR;
@ -226,7 +226,7 @@ bool TransferListSortModel::lowerPositionThan(const QModelIndex &left, const QMo @@ -226,7 +226,7 @@ bool TransferListSortModel::lowerPositionThan(const QModelIndex &left, const QMo
}
// Sort according to TR_SEED_DATE
return dateLessThan(TorrentModel::TR_SEED_DATE, left, right, false);
return dateLessThan(TransferListModel::TR_SEED_DATE, left, right, false);
}
// Every time we compare QDateTimes we need a fallback comparison in case both
@ -234,7 +234,7 @@ bool TransferListSortModel::lowerPositionThan(const QModelIndex &left, const QMo @@ -234,7 +234,7 @@ bool TransferListSortModel::lowerPositionThan(const QModelIndex &left, const QMo
// (detailed discussion in #2526 and #2158).
bool TransferListSortModel::dateLessThan(const int dateColumn, const QModelIndex &left, const QModelIndex &right, bool sortInvalidInBottom) const
{
const TorrentModel *model = qobject_cast<TorrentModel *>(sourceModel());
const TransferListModel *model = qobject_cast<TransferListModel *>(sourceModel());
const QDateTime dateL = model->data(model->index(left.row(), dateColumn)).toDateTime();
const QDateTime dateR = model->data(model->index(right.row(), dateColumn)).toDateTime();
if (dateL.isValid() && dateR.isValid()) {
@ -262,7 +262,7 @@ bool TransferListSortModel::filterAcceptsRow(int sourceRow, const QModelIndex &s @@ -262,7 +262,7 @@ bool TransferListSortModel::filterAcceptsRow(int sourceRow, const QModelIndex &s
bool TransferListSortModel::matchFilter(int sourceRow, const QModelIndex &sourceParent) const
{
TorrentModel *model = qobject_cast<TorrentModel *>(sourceModel());
TransferListModel *model = qobject_cast<TransferListModel *>(sourceModel());
if (!model) return false;
BitTorrent::TorrentHandle *const torrent = model->torrentHandle(model->index(sourceRow, 0, sourceParent));

80
src/gui/transferlistwidget.cpp

@ -49,17 +49,17 @@ @@ -49,17 +49,17 @@
#include "base/utils/fs.h"
#include "base/utils/string.h"
#include "autoexpandabledialog.h"
#include "deletionconfirmationdlg.h"
#include "deletionconfirmationdialog.h"
#include "guiiconprovider.h"
#include "mainwindow.h"
#include "optionsdlg.h"
#include "optionsdialog.h"
#include "previewselectdialog.h"
#include "speedlimitdlg.h"
#include "speedlimitdialog.h"
#include "torrentcategorydialog.h"
#include "torrentmodel.h"
#include "transferlistdelegate.h"
#include "transferlistmodel.h"
#include "transferlistsortmodel.h"
#include "updownratiodlg.h"
#include "updownratiodialog.h"
#ifdef Q_OS_MAC
#include "macutilities.h"
@ -213,12 +213,12 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *mainWindow) @@ -213,12 +213,12 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *mainWindow)
setItemDelegate(m_listDelegate);
// Create transfer list model
m_listModel = new TorrentModel(this);
m_listModel = new TransferListModel(this);
m_sortFilterModel = new TransferListSortModel();
m_sortFilterModel->setDynamicSortFilter(true);
m_sortFilterModel->setSourceModel(m_listModel);
m_sortFilterModel->setFilterKeyColumn(TorrentModel::TR_NAME);
m_sortFilterModel->setFilterKeyColumn(TransferListModel::TR_NAME);
m_sortFilterModel->setFilterRole(Qt::DisplayRole);
m_sortFilterModel->setSortCaseSensitivity(Qt::CaseInsensitive);
@ -239,40 +239,40 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *mainWindow) @@ -239,40 +239,40 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *mainWindow)
// Default hidden columns
if (!columnLoaded) {
setColumnHidden(TorrentModel::TR_ADD_DATE, true);
setColumnHidden(TorrentModel::TR_SEED_DATE, true);
setColumnHidden(TorrentModel::TR_UPLIMIT, true);
setColumnHidden(TorrentModel::TR_DLLIMIT, true);
setColumnHidden(TorrentModel::TR_TRACKER, true);
setColumnHidden(TorrentModel::TR_AMOUNT_DOWNLOADED, true);
setColumnHidden(TorrentModel::TR_AMOUNT_UPLOADED, true);
setColumnHidden(TorrentModel::TR_AMOUNT_DOWNLOADED_SESSION, true);
setColumnHidden(TorrentModel::TR_AMOUNT_UPLOADED_SESSION, true);
setColumnHidden(TorrentModel::TR_AMOUNT_LEFT, true);
setColumnHidden(TorrentModel::TR_TIME_ELAPSED, true);
setColumnHidden(TorrentModel::TR_SAVE_PATH, true);
setColumnHidden(TorrentModel::TR_COMPLETED, true);
setColumnHidden(TorrentModel::TR_RATIO_LIMIT, true);
setColumnHidden(TorrentModel::TR_SEEN_COMPLETE_DATE, true);
setColumnHidden(TorrentModel::TR_LAST_ACTIVITY, true);
setColumnHidden(TorrentModel::TR_TOTAL_SIZE, true);
setColumnHidden(TransferListModel::TR_ADD_DATE, true);
setColumnHidden(TransferListModel::TR_SEED_DATE, true);
setColumnHidden(TransferListModel::TR_UPLIMIT, true);
setColumnHidden(TransferListModel::TR_DLLIMIT, true);
setColumnHidden(TransferListModel::TR_TRACKER, true);
setColumnHidden(TransferListModel::TR_AMOUNT_DOWNLOADED, true);
setColumnHidden(TransferListModel::TR_AMOUNT_UPLOADED, true);
setColumnHidden(TransferListModel::TR_AMOUNT_DOWNLOADED_SESSION, true);
setColumnHidden(TransferListModel::TR_AMOUNT_UPLOADED_SESSION, true);
setColumnHidden(TransferListModel::TR_AMOUNT_LEFT, true);
setColumnHidden(TransferListModel::TR_TIME_ELAPSED, true);
setColumnHidden(TransferListModel::TR_SAVE_PATH, true);
setColumnHidden(TransferListModel::TR_COMPLETED, true);
setColumnHidden(TransferListModel::TR_RATIO_LIMIT, true);
setColumnHidden(TransferListModel::TR_SEEN_COMPLETE_DATE, true);
setColumnHidden(TransferListModel::TR_LAST_ACTIVITY, true);
setColumnHidden(TransferListModel::TR_TOTAL_SIZE, true);
}
//Ensure that at least one column is visible at all times
bool atLeastOne = false;
for (unsigned int i = 0; i < TorrentModel::NB_COLUMNS; ++i) {
for (unsigned int i = 0; i < TransferListModel::NB_COLUMNS; ++i) {
if (!isColumnHidden(i)) {
atLeastOne = true;
break;
}
}
if (!atLeastOne)
setColumnHidden(TorrentModel::TR_NAME, false);
setColumnHidden(TransferListModel::TR_NAME, false);
//When adding/removing columns between versions some may
//end up being size 0 when the new version is launched with
//a conf file from the previous version.
for (unsigned int i = 0; i < TorrentModel::NB_COLUMNS; ++i)
for (unsigned int i = 0; i < TransferListModel::NB_COLUMNS; ++i)
if ((columnWidth(i) <= 0) && (!isColumnHidden(i)))
resizeColumnToContents(i);
@ -318,7 +318,7 @@ TransferListWidget::~TransferListWidget() @@ -318,7 +318,7 @@ TransferListWidget::~TransferListWidget()
qDebug() << Q_FUNC_INFO << "EXIT";
}
TorrentModel *TransferListWidget::getSourceModel() const
TransferListModel *TransferListWidget::getSourceModel() const
{
return m_listModel;
}
@ -476,7 +476,7 @@ void TransferListWidget::deleteSelectedTorrents(bool deleteLocalFiles) @@ -476,7 +476,7 @@ void TransferListWidget::deleteSelectedTorrents(bool deleteLocalFiles)
if (torrents.empty()) return;
if (Preferences::instance()->confirmTorrentDeletion()
&& !DeletionConfirmationDlg::askForDeletionConfirmation(this, deleteLocalFiles, torrents.size(), torrents[0]->name()))
&& !DeletionConfirmationDialog::askForDeletionConfirmation(this, deleteLocalFiles, torrents.size(), torrents[0]->name()))
return;
foreach (BitTorrent::TorrentHandle *const torrent, torrents)
BitTorrent::Session::instance()->deleteTorrent(torrent->hash(), deleteLocalFiles);
@ -492,7 +492,7 @@ void TransferListWidget::deleteVisibleTorrents() @@ -492,7 +492,7 @@ void TransferListWidget::deleteVisibleTorrents()
bool deleteLocalFiles = false;
if (Preferences::instance()->confirmTorrentDeletion()
&& !DeletionConfirmationDlg::askForDeletionConfirmation(this, deleteLocalFiles, torrents.size(), torrents[0]->name()))
&& !DeletionConfirmationDialog::askForDeletionConfirmation(this, deleteLocalFiles, torrents.size(), torrents[0]->name()))
return;
foreach (BitTorrent::TorrentHandle *const torrent, torrents)
@ -555,9 +555,9 @@ void TransferListWidget::copySelectedHashes() const @@ -555,9 +555,9 @@ void TransferListWidget::copySelectedHashes() const
void TransferListWidget::hidePriorityColumn(bool hide)
{
qDebug("hidePriorityColumn(%d)", hide);
setColumnHidden(TorrentModel::TR_PRIORITY, hide);
if (!hide && !columnWidth(TorrentModel::TR_PRIORITY))
resizeColumnToContents(TorrentModel::TR_PRIORITY);
setColumnHidden(TransferListModel::TR_PRIORITY, hide);
if (!hide && !columnWidth(TransferListModel::TR_PRIORITY))
resizeColumnToContents(TransferListModel::TR_PRIORITY);
}
void TransferListWidget::openSelectedTorrentsFolder() const
@ -666,7 +666,7 @@ void TransferListWidget::setMaxRatioSelectedTorrents() @@ -666,7 +666,7 @@ void TransferListWidget::setMaxRatioSelectedTorrents()
useGlobalValue = (torrents[0]->ratioLimit() == BitTorrent::TorrentHandle::USE_GLOBAL_RATIO)
&& (torrents[0]->seedingTimeLimit() == BitTorrent::TorrentHandle::USE_GLOBAL_SEEDING_TIME);
UpDownRatioDlg dlg(useGlobalValue, currentMaxRatio, BitTorrent::TorrentHandle::MAX_RATIO,
UpDownRatioDialog dlg(useGlobalValue, currentMaxRatio, BitTorrent::TorrentHandle::MAX_RATIO,
currentMaxSeedingTime, BitTorrent::TorrentHandle::MAX_SEEDING_TIME, this);
if (dlg.exec() != QDialog::Accepted) return;
@ -703,7 +703,7 @@ void TransferListWidget::displayDLHoSMenu(const QPoint&) @@ -703,7 +703,7 @@ void TransferListWidget::displayDLHoSMenu(const QPoint&)
hideshowColumn.setTitle(tr("Column visibility"));
QList<QAction*> actions;
for (int i = 0; i < m_listModel->columnCount(); ++i) {
if (!BitTorrent::Session::instance()->isQueueingSystemEnabled() && (i == TorrentModel::TR_PRIORITY)) {
if (!BitTorrent::Session::instance()->isQueueingSystemEnabled() && (i == TransferListModel::TR_PRIORITY)) {
actions.append(nullptr);
continue;
}
@ -713,7 +713,7 @@ void TransferListWidget::displayDLHoSMenu(const QPoint&) @@ -713,7 +713,7 @@ void TransferListWidget::displayDLHoSMenu(const QPoint&)
actions.append(myAct);
}
int visibleCols = 0;
for (unsigned int i = 0; i < TorrentModel::NB_COLUMNS; ++i) {
for (unsigned int i = 0; i < TransferListModel::NB_COLUMNS; ++i) {
if (!isColumnHidden(i))
++visibleCols;
@ -823,7 +823,7 @@ void TransferListWidget::renameSelectedTorrent() @@ -823,7 +823,7 @@ void TransferListWidget::renameSelectedTorrent()
const QModelIndexList selectedIndexes = selectionModel()->selectedRows();
if ((selectedIndexes.size() != 1) || !selectedIndexes.first().isValid()) return;
const QModelIndex mi = m_listModel->index(mapToSource(selectedIndexes.first()).row(), TorrentModel::TR_NAME);
const QModelIndex mi = m_listModel->index(mapToSource(selectedIndexes.first()).row(), TransferListModel::TR_NAME);
BitTorrent::TorrentHandle *const torrent = m_listModel->torrentHandle(mi);
if (!torrent) return;
@ -840,7 +840,7 @@ void TransferListWidget::renameSelectedTorrent() @@ -840,7 +840,7 @@ void TransferListWidget::renameSelectedTorrent()
void TransferListWidget::setSelectionCategory(QString category)
{
foreach (const QModelIndex &index, selectionModel()->selectedRows())
m_listModel->setData(m_listModel->index(mapToSource(index).row(), TorrentModel::TR_CATEGORY), category, Qt::DisplayRole);
m_listModel->setData(m_listModel->index(mapToSource(index).row(), TransferListModel::TR_CATEGORY), category, Qt::DisplayRole);
}
void TransferListWidget::addSelectionTag(const QString &tag)
@ -1196,8 +1196,8 @@ void TransferListWidget::applyStatusFilter(int f) @@ -1196,8 +1196,8 @@ void TransferListWidget::applyStatusFilter(int f)
m_sortFilterModel->setStatusFilter(static_cast<TorrentFilter::Type>(f));
// Select first item if nothing is selected
if (selectionModel()->selectedRows(0).empty() && (m_sortFilterModel->rowCount() > 0)) {
qDebug("Nothing is selected, selecting first row: %s", qUtf8Printable(m_sortFilterModel->index(0, TorrentModel::TR_NAME).data().toString()));
selectionModel()->setCurrentIndex(m_sortFilterModel->index(0, TorrentModel::TR_NAME), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
qDebug("Nothing is selected, selecting first row: %s", qUtf8Printable(m_sortFilterModel->index(0, TransferListModel::TR_NAME).data().toString()));
selectionModel()->setCurrentIndex(m_sortFilterModel->index(0, TransferListModel::TR_NAME), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
}
}

6
src/gui/transferlistwidget.h

@ -43,8 +43,8 @@ class QStandardItemModel; @@ -43,8 +43,8 @@ class QStandardItemModel;
class MainWindow;
class TransferListDelegate;
class TransferListModel;
class TransferListSortModel;
class TorrentModel;
class TransferListWidget : public QTreeView
{
@ -53,7 +53,7 @@ class TransferListWidget : public QTreeView @@ -53,7 +53,7 @@ class TransferListWidget : public QTreeView
public:
TransferListWidget(QWidget *parent, MainWindow *mainWindow);
~TransferListWidget();
TorrentModel *getSourceModel() const;
TransferListModel *getSourceModel() const;
public slots:
void setSelectionCategory(QString category);
@ -125,7 +125,7 @@ private: @@ -125,7 +125,7 @@ private:
void applyToSelectedTorrents(const std::function<void (BitTorrent::TorrentHandle *const)> &fn);
TransferListDelegate *m_listDelegate;
TorrentModel *m_listModel;
TransferListModel *m_listModel;
TransferListSortModel *m_sortFilterModel;
MainWindow *m_mainWindow;
QShortcut *m_editHotkey;

30
src/gui/updownratiodlg.cpp → src/gui/updownratiodialog.cpp

@ -27,19 +27,19 @@ @@ -27,19 +27,19 @@
* exception statement from your version.
*/
#include "updownratiodlg.h"
#include "updownratiodialog.h"
#include <QMessageBox>
#include "base/bittorrent/session.h"
#include "ui_updownratiodlg.h"
#include "ui_updownratiodialog.h"
#include "utils.h"
UpDownRatioDlg::UpDownRatioDlg(bool useDefault, qreal initialRatioValue,
UpDownRatioDialog::UpDownRatioDialog(bool useDefault, qreal initialRatioValue,
qreal maxRatioValue, int initialTimeValue,
int maxTimeValue, QWidget *parent)
: QDialog(parent)
, m_ui(new Ui::UpDownRatioDlg)
, m_ui(new Ui::UpDownRatioDialog)
{
m_ui->setupUi(this);
@ -70,16 +70,16 @@ UpDownRatioDlg::UpDownRatioDlg(bool useDefault, qreal initialRatioValue, @@ -70,16 +70,16 @@ UpDownRatioDlg::UpDownRatioDlg(bool useDefault, qreal initialRatioValue,
m_ui->timeSpinBox->setValue(initialTimeValue);
connect(m_ui->buttonGroup, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked)
, this, &UpDownRatioDlg::handleRatioTypeChanged);
connect(m_ui->checkMaxRatio, &QCheckBox::toggled, this, &UpDownRatioDlg::enableRatioSpin);
connect(m_ui->checkMaxTime, &QCheckBox::toggled, this, &UpDownRatioDlg::enableTimeSpin);
, this, &UpDownRatioDialog::handleRatioTypeChanged);
connect(m_ui->checkMaxRatio, &QCheckBox::toggled, this, &UpDownRatioDialog::enableRatioSpin);
connect(m_ui->checkMaxTime, &QCheckBox::toggled, this, &UpDownRatioDialog::enableTimeSpin);
handleRatioTypeChanged();
Utils::Gui::resize(this);
}
void UpDownRatioDlg::accept()
void UpDownRatioDialog::accept()
{
if (m_ui->torrentLimitButton->isChecked() && !m_ui->checkMaxRatio->isChecked() && !m_ui->checkMaxTime->isChecked())
QMessageBox::critical(this, tr("No share limit method selected"),
@ -88,22 +88,22 @@ void UpDownRatioDlg::accept() @@ -88,22 +88,22 @@ void UpDownRatioDlg::accept()
QDialog::accept();
}
bool UpDownRatioDlg::useDefault() const
bool UpDownRatioDialog::useDefault() const
{
return m_ui->useDefaultButton->isChecked();
}
qreal UpDownRatioDlg::ratio() const
qreal UpDownRatioDialog::ratio() const
{
return (m_ui->noLimitButton->isChecked() || !m_ui->checkMaxRatio->isChecked()) ? -1. : m_ui->ratioSpinBox->value();
}
int UpDownRatioDlg::seedingTime() const
int UpDownRatioDialog::seedingTime() const
{
return (m_ui->noLimitButton->isChecked() || !m_ui->checkMaxTime->isChecked()) ? -1 : m_ui->timeSpinBox->value();
}
void UpDownRatioDlg::handleRatioTypeChanged()
void UpDownRatioDialog::handleRatioTypeChanged()
{
// ui->ratioSpinBox->setEnabled(ui->torrentLimitButton->isChecked());
m_ui->checkMaxRatio->setEnabled(m_ui->torrentLimitButton->isChecked());
@ -113,17 +113,17 @@ void UpDownRatioDlg::handleRatioTypeChanged() @@ -113,17 +113,17 @@ void UpDownRatioDlg::handleRatioTypeChanged()
m_ui->timeSpinBox->setEnabled(m_ui->torrentLimitButton->isChecked() && m_ui->checkMaxTime->isChecked());
}
void UpDownRatioDlg::enableRatioSpin()
void UpDownRatioDialog::enableRatioSpin()
{
m_ui->ratioSpinBox->setEnabled(m_ui->checkMaxRatio->isChecked());
}
void UpDownRatioDlg::enableTimeSpin()
void UpDownRatioDialog::enableTimeSpin()
{
m_ui->timeSpinBox->setEnabled(m_ui->checkMaxTime->isChecked());
}
UpDownRatioDlg::~UpDownRatioDlg()
UpDownRatioDialog::~UpDownRatioDialog()
{
delete m_ui;
}

16
src/gui/updownratiodlg.h → src/gui/updownratiodialog.h

@ -26,25 +26,25 @@ @@ -26,25 +26,25 @@
* exception statement from your version.
*/
#ifndef UPDOWNRATIODLG_H
#define UPDOWNRATIODLG_H
#ifndef UPDOWNRATIODIALOG_H
#define UPDOWNRATIODIALOG_H
#include <QDialog>
namespace Ui
{
class UpDownRatioDlg;
class UpDownRatioDialog;
}
class UpDownRatioDlg : public QDialog
class UpDownRatioDialog : public QDialog
{
Q_OBJECT
public:
UpDownRatioDlg(bool useDefault, qreal initialValue, qreal maxValue,
UpDownRatioDialog(bool useDefault, qreal initialValue, qreal maxValue,
int initialTimeValue, int maxTimeValue,
QWidget *parent = nullptr);
~UpDownRatioDlg();
~UpDownRatioDialog();
bool useDefault() const;
qreal ratio() const;
@ -59,7 +59,7 @@ private slots: @@ -59,7 +59,7 @@ private slots:
void enableTimeSpin();
private:
Ui::UpDownRatioDlg *m_ui;
Ui::UpDownRatioDialog *m_ui;
};
#endif // UPDOWNRATIODLG_H
#endif // UPDOWNRATIODIALOG_H

8
src/gui/updownratiodlg.ui → src/gui/updownratiodialog.ui

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>UpDownRatioDlg</class>
<widget class="QDialog" name="UpDownRatioDlg">
<class>UpDownRatioDialog</class>
<widget class="QDialog" name="UpDownRatioDialog">
<property name="geometry">
<rect>
<x>0</x>
@ -140,7 +140,7 @@ @@ -140,7 +140,7 @@
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>UpDownRatioDlg</receiver>
<receiver>UpDownRatioDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
@ -156,7 +156,7 @@ @@ -156,7 +156,7 @@
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>UpDownRatioDlg</receiver>
<receiver>UpDownRatioDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">

3
src/webui/CMakeLists.txt

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
add_library(qbt_webui STATIC
# headers
api/apicontroller.h
api/apierror.h
api/appcontroller.h
@ -13,6 +14,8 @@ api/serialize/serialize_torrent.h @@ -13,6 +14,8 @@ api/serialize/serialize_torrent.h
extra_translations.h
webapplication.h
webui.h
# sources
api/apicontroller.cpp
api/apierror.cpp
api/appcontroller.cpp

4
src/webui/www/private/addtrackers.html

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<title>QBT_TR(Trackers addition dialog)QBT_TR[CONTEXT=TrackersAdditionDlg]</title>
<title>QBT_TR(Trackers addition dialog)QBT_TR[CONTEXT=TrackersAdditionDialog]</title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
<script src="scripts/lib/mootools-1.2-more.js"></script>
@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
<body>
<div style="text-align: center;">
<br/>
<h2 class="vcenter">QBT_TR(List of trackers to add (one per line):)QBT_TR[CONTEXT=TrackersAdditionDlg]</h2>
<h2 class="vcenter">QBT_TR(List of trackers to add (one per line):)QBT_TR[CONTEXT=TrackersAdditionDialog]</h2>
<textarea name="list" id="trackersUrls" rows="10" cols="1"></textarea>
<br/>
<input type="button" value="QBT_TR(Add)QBT_TR[CONTEXT=HttpServer]" id="addTrackersButton" />

18
src/webui/www/private/filters.html

@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
<span class="filterTitle">QBT_TR(Status)QBT_TR[CONTEXT=TransferListFiltersWidget]</span>
<ul class="filterList">
<li id="all_filter"><a href="#" onclick="setFilter('all');return false;"><img src="images/skin/filterall.png" alt="All" />QBT_TR(All (0))QBT_TR[CONTEXT=StatusFiltersWidget]</a></li>
<li id="downloading_filter"><a href="#" onclick="setFilter('downloading');return false;"><img src="images/skin/downloading.png" alt="Downloading" />QBT_TR(Downloading (0))QBT_TR[CONTEXT=StatusFiltersWidget]</a></li>
<li id="seeding_filter"><a href="#" onclick="setFilter('seeding');return false;"><img src="images/skin/uploading.png" alt="Seeding" />QBT_TR(Seeding (0))QBT_TR[CONTEXT=StatusFiltersWidget]</a></li>
<li id="completed_filter"><a href="#" onclick="setFilter('completed');return false;"><img src="images/skin/completed.png" alt="Completed" />QBT_TR(Completed (0))QBT_TR[CONTEXT=StatusFiltersWidget]</a></li>
<li id="resumed_filter"><a href="#" onclick="setFilter('resumed');return false;"><img src="images/skin/resumed.png" alt="Resumed" />QBT_TR(Resumed (0))QBT_TR[CONTEXT=StatusFiltersWidget]</a></li>
<li id="paused_filter"><a href="#" onclick="setFilter('paused');return false;"><img src="images/skin/paused.png" alt="Paused" />QBT_TR(Paused (0))QBT_TR[CONTEXT=StatusFiltersWidget]</a></li>
<li id="active_filter"><a href="#" onclick="setFilter('active');return false;"><img src="images/skin/filteractive.png" alt="Active" />QBT_TR(Active (0))QBT_TR[CONTEXT=StatusFiltersWidget]</a></li>
<li id="inactive_filter"><a href="#" onclick="setFilter('inactive');return false;"><img src="images/skin/filterinactive.png" alt="Inactive" />QBT_TR(Inactive (0))QBT_TR[CONTEXT=StatusFiltersWidget]</a></li>
<li id="errored_filter"><a href="#" onclick="setFilter('errored');return false;"><img src="images/skin/error.png" alt="Errored" />QBT_TR(Errored (0))QBT_TR[CONTEXT=StatusFiltersWidget]</a></li>
<li id="all_filter"><a href="#" onclick="setFilter('all');return false;"><img src="images/skin/filterall.png" alt="All" />QBT_TR(All (0))QBT_TR[CONTEXT=StatusFilterWidget]</a></li>
<li id="downloading_filter"><a href="#" onclick="setFilter('downloading');return false;"><img src="images/skin/downloading.png" alt="Downloading" />QBT_TR(Downloading (0))QBT_TR[CONTEXT=StatusFilterWidget]</a></li>
<li id="seeding_filter"><a href="#" onclick="setFilter('seeding');return false;"><img src="images/skin/uploading.png" alt="Seeding" />QBT_TR(Seeding (0))QBT_TR[CONTEXT=StatusFilterWidget]</a></li>
<li id="completed_filter"><a href="#" onclick="setFilter('completed');return false;"><img src="images/skin/completed.png" alt="Completed" />QBT_TR(Completed (0))QBT_TR[CONTEXT=StatusFilterWidget]</a></li>
<li id="resumed_filter"><a href="#" onclick="setFilter('resumed');return false;"><img src="images/skin/resumed.png" alt="Resumed" />QBT_TR(Resumed (0))QBT_TR[CONTEXT=StatusFilterWidget]</a></li>
<li id="paused_filter"><a href="#" onclick="setFilter('paused');return false;"><img src="images/skin/paused.png" alt="Paused" />QBT_TR(Paused (0))QBT_TR[CONTEXT=StatusFilterWidget]</a></li>
<li id="active_filter"><a href="#" onclick="setFilter('active');return false;"><img src="images/skin/filteractive.png" alt="Active" />QBT_TR(Active (0))QBT_TR[CONTEXT=StatusFilterWidget]</a></li>
<li id="inactive_filter"><a href="#" onclick="setFilter('inactive');return false;"><img src="images/skin/filterinactive.png" alt="Inactive" />QBT_TR(Inactive (0))QBT_TR[CONTEXT=StatusFilterWidget]</a></li>
<li id="errored_filter"><a href="#" onclick="setFilter('errored');return false;"><img src="images/skin/error.png" alt="Errored" />QBT_TR(Errored (0))QBT_TR[CONTEXT=StatusFilterWidget]</a></li>
</ul>
<br/>
<span class="filterTitle">QBT_TR(Categories)QBT_TR[CONTEXT=TransferListFiltersWidget]</span>

10
src/webui/www/private/properties_content.html

@ -84,10 +84,10 @@ @@ -84,10 +84,10 @@
<table class="dynamicTable" style="width: 100%">
<thead>
<tr>
<th style="width: 30%;">QBT_TR(URL)QBT_TR[CONTEXT=TrackerList] <img src="theme/list-add" id="addTrackersPlus" alt="Add Trackers" /></th>
<th style="width: 10%;">QBT_TR(Status)QBT_TR[CONTEXT=TrackerList]</th>
<th style="width: 10%;">QBT_TR(Peers)QBT_TR[CONTEXT=TrackerList]</th>
<th style="width: 50%;">QBT_TR(Message)QBT_TR[CONTEXT=TrackerList]</th>
<th style="width: 30%;">QBT_TR(URL)QBT_TR[CONTEXT=TrackerListWidget] <img src="theme/list-add" id="addTrackersPlus" alt="Add Trackers" /></th>
<th style="width: 10%;">QBT_TR(Status)QBT_TR[CONTEXT=TrackerListWidget]</th>
<th style="width: 10%;">QBT_TR(Peers)QBT_TR[CONTEXT=TrackerListWidget]</th>
<th style="width: 50%;">QBT_TR(Message)QBT_TR[CONTEXT=TrackerListWidget]</th>
</tr>
</thead>
<tbody id="trackersTable"></tbody>
@ -120,7 +120,7 @@ @@ -120,7 +120,7 @@
<table class="dynamicTable" style="width: 100%">
<thead>
<tr>
<th>QBT_TR(URL)QBT_TR[CONTEXT=TrackerList]</th>
<th>QBT_TR(URL)QBT_TR[CONTEXT=TrackerListWidget]</th>
</tr>
</thead>
<tbody id="webseedsTable"></tbody>

18
src/webui/www/private/scripts/client.js

@ -220,15 +220,15 @@ window.addEvent('load', function() { @@ -220,15 +220,15 @@ window.addEvent('load', function() {
};
var updateFiltersList = function() {
updateFilter('all', 'QBT_TR(All (%1))QBT_TR[CONTEXT=StatusFiltersWidget]');
updateFilter('downloading', 'QBT_TR(Downloading (%1))QBT_TR[CONTEXT=StatusFiltersWidget]');
updateFilter('seeding', 'QBT_TR(Seeding (%1))QBT_TR[CONTEXT=StatusFiltersWidget]');
updateFilter('completed', 'QBT_TR(Completed (%1))QBT_TR[CONTEXT=StatusFiltersWidget]');
updateFilter('resumed', 'QBT_TR(Resumed (%1))QBT_TR[CONTEXT=StatusFiltersWidget]');
updateFilter('paused', 'QBT_TR(Paused (%1))QBT_TR[CONTEXT=StatusFiltersWidget]');
updateFilter('active', 'QBT_TR(Active (%1))QBT_TR[CONTEXT=StatusFiltersWidget]');
updateFilter('inactive', 'QBT_TR(Inactive (%1))QBT_TR[CONTEXT=StatusFiltersWidget]');
updateFilter('errored', 'QBT_TR(Errored (%1))QBT_TR[CONTEXT=StatusFiltersWidget]');
updateFilter('all', 'QBT_TR(All (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
updateFilter('downloading', 'QBT_TR(Downloading (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
updateFilter('seeding', 'QBT_TR(Seeding (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
updateFilter('completed', 'QBT_TR(Completed (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
updateFilter('resumed', 'QBT_TR(Resumed (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
updateFilter('paused', 'QBT_TR(Paused (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
updateFilter('active', 'QBT_TR(Active (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
updateFilter('inactive', 'QBT_TR(Inactive (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
updateFilter('errored', 'QBT_TR(Errored (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
};
var updateCategoryList = function() {

58
src/webui/www/private/scripts/dynamicTable.js

@ -743,35 +743,35 @@ var TorrentsTable = new Class({ @@ -743,35 +743,35 @@ var TorrentsTable = new Class({
initColumns: function() {
this.newColumn('priority', '', '#', 30, true);
this.newColumn('state_icon', 'cursor: default', '', 22, true);
this.newColumn('name', '', 'QBT_TR(Name)QBT_TR[CONTEXT=TorrentModel]', 200, true);
this.newColumn('size', '', 'QBT_TR(Size)QBT_TR[CONTEXT=TorrentModel]', 100, true);
this.newColumn('total_size', '', 'QBT_TR(Total Size)QBT_TR[CONTEXT=TorrentModel]', 100, false);
this.newColumn('progress', '', 'QBT_TR(Done)QBT_TR[CONTEXT=TorrentModel]', 85, true);
this.newColumn('status', '', 'QBT_TR(Status)QBT_TR[CONTEXT=TorrentModel]', 100, true);
this.newColumn('num_seeds', '', 'QBT_TR(Seeds)QBT_TR[CONTEXT=TorrentModel]', 100, true);
this.newColumn('num_leechs', '', 'QBT_TR(Peers)QBT_TR[CONTEXT=TorrentModel]', 100, true);
this.newColumn('dlspeed', '', 'QBT_TR(Down Speed)QBT_TR[CONTEXT=TorrentModel]', 100, true);
this.newColumn('upspeed', '', 'QBT_TR(Up Speed)QBT_TR[CONTEXT=TorrentModel]', 100, true);
this.newColumn('eta', '', 'QBT_TR(ETA)QBT_TR[CONTEXT=TorrentModel]', 100, true);
this.newColumn('ratio', '', 'QBT_TR(Ratio)QBT_TR[CONTEXT=TorrentModel]', 100, true);
this.newColumn('category', '', 'QBT_TR(Category)QBT_TR[CONTEXT=TorrentModel]', 100, true);
this.newColumn('tags', '', 'QBT_TR(Tags)QBT_TR[CONTEXT=TorrentModel]', 100, true);
this.newColumn('added_on', '', 'QBT_TR(Added On)QBT_TR[CONTEXT=TorrentModel]', 100, true);
this.newColumn('completion_on', '', 'QBT_TR(Completed On)QBT_TR[CONTEXT=TorrentModel]', 100, false);
this.newColumn('tracker', '', 'QBT_TR(Tracker)QBT_TR[CONTEXT=TorrentModel]', 100, false);
this.newColumn('dl_limit', '', 'QBT_TR(Down Limit)QBT_TR[CONTEXT=TorrentModel]', 100, false);
this.newColumn('up_limit', '', 'QBT_TR(Up Limit)QBT_TR[CONTEXT=TorrentModel]', 100, false);
this.newColumn('downloaded', '', 'QBT_TR(Downloaded)QBT_TR[CONTEXT=TorrentModel]', 100, false);
this.newColumn('uploaded', '', 'QBT_TR(Uploaded)QBT_TR[CONTEXT=TorrentModel]', 100, false);
this.newColumn('downloaded_session', '', 'QBT_TR(Session Download)QBT_TR[CONTEXT=TorrentModel]', 100, false);
this.newColumn('uploaded_session', '', 'QBT_TR(Session Upload)QBT_TR[CONTEXT=TorrentModel]', 100, false);
this.newColumn('amount_left', '', 'QBT_TR(Remaining)QBT_TR[CONTEXT=TorrentModel]', 100, false);
this.newColumn('time_active', '', 'QBT_TR(Time Active)QBT_TR[CONTEXT=TorrentModel]', 100, false);
this.newColumn('save_path', '', 'QBT_TR(Save path)QBT_TR[CONTEXT=TorrentModel]', 100, false);
this.newColumn('completed', '', 'QBT_TR(Completed)QBT_TR[CONTEXT=TorrentModel]', 100, false);
this.newColumn('max_ratio', '', 'QBT_TR(Ratio Limit)QBT_TR[CONTEXT=TorrentModel]', 100, false);
this.newColumn('seen_complete', '', 'QBT_TR(Last Seen Complete)QBT_TR[CONTEXT=TorrentModel]', 100, false);
this.newColumn('last_activity', '', 'QBT_TR(Last Activity)QBT_TR[CONTEXT=TorrentModel]', 100, false);
this.newColumn('name', '', 'QBT_TR(Name)QBT_TR[CONTEXT=TransferListModel]', 200, true);
this.newColumn('size', '', 'QBT_TR(Size)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('total_size', '', 'QBT_TR(Total Size)QBT_TR[CONTEXT=TransferListModel]', 100, false);
this.newColumn('progress', '', 'QBT_TR(Done)QBT_TR[CONTEXT=TransferListModel]', 85, true);
this.newColumn('status', '', 'QBT_TR(Status)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('num_seeds', '', 'QBT_TR(Seeds)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('num_leechs', '', 'QBT_TR(Peers)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('dlspeed', '', 'QBT_TR(Down Speed)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('upspeed', '', 'QBT_TR(Up Speed)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('eta', '', 'QBT_TR(ETA)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('ratio', '', 'QBT_TR(Ratio)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('category', '', 'QBT_TR(Category)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('tags', '', 'QBT_TR(Tags)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('added_on', '', 'QBT_TR(Added On)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('completion_on', '', 'QBT_TR(Completed On)QBT_TR[CONTEXT=TransferListModel]', 100, false);
this.newColumn('tracker', '', 'QBT_TR(Tracker)QBT_TR[CONTEXT=TransferListModel]', 100, false);
this.newColumn('dl_limit', '', 'QBT_TR(Down Limit)QBT_TR[CONTEXT=TransferListModel]', 100, false);
this.newColumn('up_limit', '', 'QBT_TR(Up Limit)QBT_TR[CONTEXT=TransferListModel]', 100, false);
this.newColumn('downloaded', '', 'QBT_TR(Downloaded)QBT_TR[CONTEXT=TransferListModel]', 100, false);
this.newColumn('uploaded', '', 'QBT_TR(Uploaded)QBT_TR[CONTEXT=TransferListModel]', 100, false);
this.newColumn('downloaded_session', '', 'QBT_TR(Session Download)QBT_TR[CONTEXT=TransferListModel]', 100, false);
this.newColumn('uploaded_session', '', 'QBT_TR(Session Upload)QBT_TR[CONTEXT=TransferListModel]', 100, false);
this.newColumn('amount_left', '', 'QBT_TR(Remaining)QBT_TR[CONTEXT=TransferListModel]', 100, false);
this.newColumn('time_active', '', 'QBT_TR(Time Active)QBT_TR[CONTEXT=TransferListModel]', 100, false);
this.newColumn('save_path', '', 'QBT_TR(Save path)QBT_TR[CONTEXT=TransferListModel]', 100, false);
this.newColumn('completed', '', 'QBT_TR(Completed)QBT_TR[CONTEXT=TransferListModel]', 100, false);
this.newColumn('max_ratio', '', 'QBT_TR(Ratio Limit)QBT_TR[CONTEXT=TransferListModel]', 100, false);
this.newColumn('seen_complete', '', 'QBT_TR(Last Seen Complete)QBT_TR[CONTEXT=TransferListModel]', 100, false);
this.newColumn('last_activity', '', 'QBT_TR(Last Activity)QBT_TR[CONTEXT=TransferListModel]', 100, false);
this.columns['state_icon'].onclick = '';
this.columns['state_icon'].dataProperties[0] = 'state';

2
src/webui/www/private/scripts/mocha-init.js

@ -188,7 +188,7 @@ initializeWindows = function() { @@ -188,7 +188,7 @@ initializeWindows = function() {
var orig = torrentsHaveSameShareRatio ? shareRatio : "";
new MochaUI.Window({
id: 'shareRatioPage',
title: "QBT_TR(Torrent Upload/Download Ratio Limiting)QBT_TR[CONTEXT=UpDownRatioDlg]",
title: "QBT_TR(Torrent Upload/Download Ratio Limiting)QBT_TR[CONTEXT=UpDownRatioDialog]",
loadMethod: 'iframe',
contentURL: 'shareratio.html?hashes=' + hashes.join("|") + '&orig=' + orig,
scrollbars: false,

2
src/webui/www/private/scripts/prop-trackers.js

@ -116,7 +116,7 @@ $('addTrackersPlus').addEvent('click', function addTrackerDlg() { @@ -116,7 +116,7 @@ $('addTrackersPlus').addEvent('click', function addTrackerDlg() {
if (current_hash.length === 0) return;
new MochaUI.Window({
id: 'trackersPage',
title: "QBT_TR(Trackers addition dialog)QBT_TR[CONTEXT=TrackersAdditionDlg]",
title: "QBT_TR(Trackers addition dialog)QBT_TR[CONTEXT=TrackersAdditionDialog]",
loadMethod: 'iframe',
contentURL: 'addtrackers.html?hash=' + current_hash,
scrollbars: true,

12
src/webui/www/private/shareratio.html

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<title>QBT_TR(Torrent Upload/Download Ratio Limiting)QBT_TR[CONTEXT=UpDownRatioDlg]</title>
<title>QBT_TR(Torrent Upload/Download Ratio Limiting)QBT_TR[CONTEXT=UpDownRatioDialog]</title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
<script src="scripts/lib/mootools-1.2-more.js"></script>
@ -144,18 +144,18 @@ @@ -144,18 +144,18 @@
<body>
<div style="padding: 10px 10px 0px 10px;">
<input type="radio" name="shareLimit" id="default" value="default" onchange="shareLimitChanged()" checked style="margin-bottom: 5px;" />QBT_TR(Use global share limit)QBT_TR[CONTEXT=UpDownRatioDlg]</br>
<input type="radio" name="shareLimit" value="none" onchange="shareLimitChanged()" style="margin-bottom: 5px;" />QBT_TR(Set no share limit)QBT_TR[CONTEXT=UpDownRatioDlg]</br>
<input type="radio" name="shareLimit" value="custom" onchange="shareLimitChanged()" style="margin-bottom: 5px;" />QBT_TR(Set share limit to)QBT_TR[CONTEXT=UpDownRatioDlg]</br>
<input type="radio" name="shareLimit" id="default" value="default" onchange="shareLimitChanged()" checked style="margin-bottom: 5px;" />QBT_TR(Use global share limit)QBT_TR[CONTEXT=UpDownRatioDialog]</br>
<input type="radio" name="shareLimit" value="none" onchange="shareLimitChanged()" style="margin-bottom: 5px;" />QBT_TR(Set no share limit)QBT_TR[CONTEXT=UpDownRatioDialog]</br>
<input type="radio" name="shareLimit" value="custom" onchange="shareLimitChanged()" style="margin-bottom: 5px;" />QBT_TR(Set share limit to)QBT_TR[CONTEXT=UpDownRatioDialog]</br>
<div style="margin-left: 40px; margin-bottom: 5px;">
<input type="checkbox" id="setRatio" class="shareLimitInput" onclick="enableInputBoxes()" />
<label for="setRatio" class="leftLabelLarge">QBT_TR(ratio)QBT_TR[CONTEXT=UpDownRatioDlg]</label>
<label for="setRatio" class="leftLabelLarge">QBT_TR(ratio)QBT_TR[CONTEXT=UpDownRatioDialog]</label>
<input type="number" id="ratio" value="0.00" step=".01" min="0" max="9999" class="shareLimitInput" />
</div>
<div style="margin-left: 40px; margin-bottom: 5px;">
<input type="checkbox" id="setMinutes" class="shareLimitInput" onclick="enableInputBoxes()" />
<label for="setMinutes" class="leftLabelLarge">QBT_TR(minutes)QBT_TR[CONTEXT=UpDownRatioDlg]</label>
<label for="setMinutes" class="leftLabelLarge">QBT_TR(minutes)QBT_TR[CONTEXT=UpDownRatioDialog]</label>
<input type="number" id="minutes" value="0" step="1" min="0" max="525600" class="shareLimitInput" />
</div>
<div style="text-align: center; padding-top: 10px;">

Loading…
Cancel
Save