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. 44
      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)
else (UNIX) else (UNIX)
target_sources(qBittorrent PRIVATE stacktrace_win.h) target_sources(qBittorrent PRIVATE stacktrace_win.h)
if (Qt5Widgets_FOUND) if (Qt5Widgets_FOUND)
target_sources(qBittorrent PRIVATE stacktrace_win_dlg.h) target_sources(qBittorrent PRIVATE stacktracedialog.h)
endif (Qt5Widgets_FOUND) endif (Qt5Widgets_FOUND)
endif (UNIX) endif (UNIX)
endif (STACKTRACE) endif (STACKTRACE)

4
src/app/app.pri

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

4
src/app/application.cpp

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

4
src/app/main.cpp

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

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

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

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

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

3
src/base/CMakeLists.txt

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

74
src/gui/CMakeLists.txt

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

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

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

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

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

32
src/gui/addnewtorrentdialog.cpp

@ -53,8 +53,8 @@
#include "base/utils/string.h" #include "base/utils/string.h"
#include "autoexpandabledialog.h" #include "autoexpandabledialog.h"
#include "guiiconprovider.h" #include "guiiconprovider.h"
#include "messageboxraised.h"
#include "proplistdelegate.h" #include "proplistdelegate.h"
#include "raisedmessagebox.h"
#include "torrentcontentfiltermodel.h" #include "torrentcontentfiltermodel.h"
#include "torrentcontentmodel.h" #include "torrentcontentmodel.h"
#include "ui_addnewtorrentdialog.h" #include "ui_addnewtorrentdialog.h"
@ -268,13 +268,13 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath)
m_filePath = torrentPath; m_filePath = torrentPath;
if (!QFile::exists(m_filePath)) { 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; return false;
} }
QFileInfo fileinfo(m_filePath); QFileInfo fileinfo(m_filePath);
if (!fileinfo.isReadable()) { 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; return false;
} }
@ -282,7 +282,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath)
QString error; QString error;
m_torrentInfo = BitTorrent::TorrentInfo::loadFromFile(m_filePath, &error); m_torrentInfo = BitTorrent::TorrentInfo::loadFromFile(m_filePath, &error);
if (!m_torrentInfo.isValid()) { 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)); .arg(Utils::Fs::toNativePath(m_filePath), error));
return false; return false;
} }
@ -295,16 +295,16 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath)
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(m_hash); BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(m_hash);
if (torrent) { if (torrent) {
if (torrent->isPrivate() || m_torrentInfo.isPrivate()) { 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 { else {
torrent->addTrackers(m_torrentInfo.trackers()); torrent->addTrackers(m_torrentInfo.trackers());
torrent->addUrlSeeds(m_torrentInfo.urlSeeds()); 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 { 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; return false;
} }
@ -318,7 +318,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath)
bool AddNewTorrentDialog::loadMagnet(const BitTorrent::MagnetUri &magnetUri) bool AddNewTorrentDialog::loadMagnet(const BitTorrent::MagnetUri &magnetUri)
{ {
if (!magnetUri.isValid()) { 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; return false;
} }
@ -329,16 +329,16 @@ bool AddNewTorrentDialog::loadMagnet(const BitTorrent::MagnetUri &magnetUri)
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(m_hash); BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(m_hash);
if (torrent) { if (torrent) {
if (torrent->isPrivate()) { 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 { else {
torrent->addTrackers(magnetUri.trackers()); torrent->addTrackers(magnetUri.trackers());
torrent->addUrlSeeds(magnetUri.urlSeeds()); 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 { 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; return false;
} }
@ -490,7 +490,7 @@ void AddNewTorrentDialog::renameSelectedFile()
if (!ok) return; if (!ok) return;
if (newName.isEmpty() || !Utils::Fs::isValidFileSystemName(newName)) { 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."), tr("The name is empty or contains forbidden characters, please choose a different one."),
QMessageBox::Ok); QMessageBox::Ok);
return; return;
@ -515,7 +515,7 @@ void AddNewTorrentDialog::renameSelectedFile()
for (int i = 0; i < m_torrentInfo.filesCount(); ++i) { for (int i = 0; i < m_torrentInfo.filesCount(); ++i) {
if (i == fileIndex) continue; if (i == fileIndex) continue;
if (Utils::Fs::sameFileNames(m_torrentInfo.filePath(i), newFilePath)) { 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."), tr("This name is already in use in this folder. Please use a different name."),
QMessageBox::Ok); QMessageBox::Ok);
return; return;
@ -553,7 +553,7 @@ void AddNewTorrentDialog::renameSelectedFile()
#else #else
if (currentName.startsWith(newPath, Qt::CaseInsensitive)) { if (currentName.startsWith(newPath, Qt::CaseInsensitive)) {
#endif #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."), tr("This name is already in use in this folder. Please use a different name."),
QMessageBox::Ok); QMessageBox::Ok);
return; return;
@ -696,7 +696,7 @@ void AddNewTorrentDialog::updateMetadata(const BitTorrent::TorrentInfo &info)
disconnect(this, SLOT(updateMetadata(BitTorrent::TorrentInfo))); disconnect(this, SLOT(updateMetadata(BitTorrent::TorrentInfo)));
if (!info.isValid()) { 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")); setMetadataProgressIndicator(false, tr("Invalid metadata"));
return; return;
} }
@ -763,7 +763,7 @@ void AddNewTorrentDialog::setupTreeview()
void AddNewTorrentDialog::handleDownloadFailed(const QString &url, const QString &reason) 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)); QString("Cannot download '%1': %2").arg(url, reason));
this->deleteLater(); this->deleteLater();
} }

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

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

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

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

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

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

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

@ -26,8 +26,8 @@
* exception statement from your version. * exception statement from your version.
*/ */
#ifndef DELETIONCONFIRMATIONDLG_H #ifndef DELETIONCONFIRMATIONDIALOG_H
#define DELETIONCONFIRMATIONDLG_H #define DELETIONCONFIRMATIONDIALOG_H
#include <QDialog> #include <QDialog>
#include <QPushButton> #include <QPushButton>
@ -36,15 +36,15 @@
#include "base/utils/misc.h" #include "base/utils/misc.h"
#include "base/utils/string.h" #include "base/utils/string.h"
#include "guiiconprovider.h" #include "guiiconprovider.h"
#include "ui_confirmdeletiondlg.h" #include "ui_deletionconfirmationdialog.h"
#include "utils.h" #include "utils.h"
class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg class DeletionConfirmationDialog : public QDialog, private Ui::DeletionConfirmationDialog
{ {
Q_OBJECT Q_OBJECT
public: 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) : QDialog(parent)
{ {
setupUi(this); setupUi(this);
@ -60,7 +60,7 @@ public:
rememberBtn->setIconSize(Utils::Gui::mediumIconSize()); rememberBtn->setIconSize(Utils::Gui::mediumIconSize());
checkPermDelete->setChecked(defaultDeleteFiles || Preferences::instance()->deleteTorrentFilesAsDefault()); 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(); buttonBox->button(QDialogButtonBox::Cancel)->setFocus();
Utils::Gui::resize(this); Utils::Gui::resize(this);
@ -73,7 +73,7 @@ public:
static bool askForDeletionConfirmation(QWidget *parent, bool &deleteLocalFiles, const int &size, const QString &name) 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) { if (dlg.exec() == QDialog::Accepted) {
deleteLocalFiles = dlg.shouldDeleteLocalFiles(); deleteLocalFiles = dlg.shouldDeleteLocalFiles();
return true; return true;
@ -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 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>confirmDeletionDlg</class> <class>DeletionConfirmationDialog</class>
<widget class="QDialog" name="confirmDeletionDlg"> <widget class="QDialog" name="DeletionConfirmationDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -120,7 +120,7 @@
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>accepted()</signal> <signal>accepted()</signal>
<receiver>confirmDeletionDlg</receiver> <receiver>DeletionConfirmationDialog</receiver>
<slot>accept()</slot> <slot>accept()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
@ -136,7 +136,7 @@
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>rejected()</signal> <signal>rejected()</signal>
<receiver>confirmDeletionDlg</receiver> <receiver>DeletionConfirmationDialog</receiver>
<slot>reject()</slot> <slot>reject()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">

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

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

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

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

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

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

82
src/gui/gui.pri

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

22
src/gui/mainwindow.cpp

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

8
src/gui/mainwindow.h

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

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

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

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

@ -26,8 +26,8 @@
* exception statement from your version. * exception statement from your version.
*/ */
#ifndef OPTIONSDLG_H #ifndef OPTIONSDIALOG_H
#define OPTIONSDLG_H #define OPTIONSDIALOG_H
#include <QButtonGroup> #include <QButtonGroup>
#include <QDialog> #include <QDialog>
@ -186,4 +186,4 @@ private:
QList<QString> removedScanDirs; 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 @@
add_library(qbt_properties STATIC add_library(qbt_properties STATIC
propertieswidget.ui # headers
trackersadditiondlg.ui
peersadditiondlg.ui
propertieswidget.h
peerlistwidget.h
proplistdelegate.h
trackerlist.h
downloadedpiecesbar.h downloadedpiecesbar.h
piecesbar.h
peerlistdelegate.h peerlistdelegate.h
peerlistsortmodel.h peerlistsortmodel.h
peersadditiondlg.h peerlistwidget.h
trackersadditiondlg.h peersadditiondialog.h
pieceavailabilitybar.h pieceavailabilitybar.h
piecesbar.h
propertieswidget.h
proplistdelegate.h
proptabbar.h proptabbar.h
speedwidget.h
speedplotview.h speedplotview.h
propertieswidget.cpp speedwidget.h
proplistdelegate.cpp trackerlistwidget.h
peerlistwidget.cpp trackersadditiondialog.h
trackerlist.cpp
peersadditiondlg.cpp # sources
downloadedpiecesbar.cpp downloadedpiecesbar.cpp
piecesbar.cpp peerlistwidget.cpp
trackersadditiondlg.cpp peersadditiondialog.cpp
pieceavailabilitybar.cpp pieceavailabilitybar.cpp
piecesbar.cpp
propertieswidget.cpp
proplistdelegate.cpp
proptabbar.cpp proptabbar.cpp
speedwidget.cpp
speedplotview.cpp speedplotview.cpp
speedwidget.cpp
trackerlistwidget.cpp
trackersadditiondialog.cpp
# forms
peersadditiondialog.ui
propertieswidget.ui
trackersadditiondialog.ui
) )
target_link_libraries(qbt_properties target_link_libraries(qbt_properties

6
src/gui/properties/peerlistwidget.cpp

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

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

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

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

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

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

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

16
src/gui/properties/properties.pri

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

16
src/gui/properties/propertieswidget.cpp

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

6
src/gui/properties/propertieswidget.h

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

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

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

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

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

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

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

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

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

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

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

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

@ -26,42 +26,42 @@
* exception statement from your version. * 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::StandardButtons buttons, QWidget *parent, Qt::WindowFlags f)
: QMessageBox(icon, title, text, buttons, parent, 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); dlg.setDefaultButton(defaultButton);
return static_cast<QMessageBox::StandardButton>(dlg.exec()); 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); 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); 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); 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); return impl(Warning, parent, title, text, buttons, defaultButton);
} }
void MessageBoxRaised::showEvent(QShowEvent *event) void RaisedMessageBox::showEvent(QShowEvent *event)
{ {
QMessageBox::showEvent(event); QMessageBox::showEvent(event);
activateWindow(); activateWindow();

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

@ -26,12 +26,12 @@
* exception statement from your version. * exception statement from your version.
*/ */
#ifndef MESSAGEBOXRAISED_H #ifndef RAISEDMESSAGEBOX_H
#define MESSAGEBOXRAISED_H #define RAISEDMESSAGEBOX_H
#include <QMessageBox> #include <QMessageBox>
class MessageBoxRaised : public QMessageBox class RaisedMessageBox : public QMessageBox
{ {
Q_OBJECT Q_OBJECT
@ -45,12 +45,12 @@ protected:
void showEvent(QShowEvent *event) override; void showEvent(QShowEvent *event) override;
private: 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); RaisedMessageBox(QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = NoButton, QWidget *parent = nullptr, Qt::WindowFlags f = Qt::Dialog|Qt::MSWindowsFixedSizeDialogHint);
MessageBoxRaised(); RaisedMessageBox();
MessageBoxRaised(MessageBoxRaised const&); RaisedMessageBox(RaisedMessageBox const&);
void operator=(MessageBoxRaised 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); 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 @@
add_library(qbt_rss STATIC add_library(qbt_rss STATIC
# headers
articlelistwidget.h articlelistwidget.h
automatedrssdownloader.h automatedrssdownloader.h
feedlistwidget.h feedlistwidget.h
htmlbrowser.h htmlbrowser.h
rsswidget.h rsswidget.h
#sources
articlelistwidget.cpp articlelistwidget.cpp
automatedrssdownloader.cpp automatedrssdownloader.cpp
feedlistwidget.cpp feedlistwidget.cpp
htmlbrowser.cpp htmlbrowser.cpp
rsswidget.cpp rsswidget.cpp
# forms
automatedrssdownloader.ui automatedrssdownloader.ui
rsswidget.ui rsswidget.ui
) )

23
src/gui/search/CMakeLists.txt

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

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

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

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

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

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

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

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

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

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

@ -26,23 +26,23 @@
* exception statement from your version. * exception statement from your version.
*/ */
#ifndef PLUGINSOURCEDLG_H #ifndef PLUGINSOURCEDIALOG_H
#define PLUGINSOURCEDLG_H #define PLUGINSOURCEDIALOG_H
#include <QDialog> #include <QDialog>
namespace Ui namespace Ui
{ {
class PluginSourceDlg; class PluginSourceDialog;
} }
class PluginSourceDlg : public QDialog class PluginSourceDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit PluginSourceDlg(QWidget *parent = nullptr); explicit PluginSourceDialog(QWidget *parent = nullptr);
~PluginSourceDlg(); ~PluginSourceDialog();
signals: signals:
void askForUrl(); void askForUrl();
@ -53,7 +53,7 @@ private slots:
void on_urlButton_clicked(); void on_urlButton_clicked();
private: 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 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>PluginSourceDlg</class> <class>PluginSourceDialog</class>
<widget class="QDialog" name="PluginSourceDlg"> <widget class="QDialog" name="PluginSourceDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>

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

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

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

@ -50,13 +50,13 @@ struct SearchResult;
namespace Ui namespace Ui
{ {
class SearchTab; class SearchJobWidget;
} }
class SearchTab : public QWidget class SearchJobWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY(SearchTab) Q_DISABLE_COPY(SearchJobWidget)
public: public:
enum class NameFilteringMode enum class NameFilteringMode
@ -75,8 +75,8 @@ public:
NoResults NoResults
}; };
explicit SearchTab(SearchHandler *searchHandler, QWidget *parent = nullptr); explicit SearchJobWidget(SearchHandler *searchHandler, QWidget *parent = nullptr);
~SearchTab() override; ~SearchJobWidget() override;
Status status() const; Status status() const;
int visibleResultsCount() const; int visibleResultsCount() const;
@ -112,7 +112,7 @@ private:
static QString statusText(Status st); static QString statusText(Status st);
static CachedSettingValue<NameFilteringMode> &nameFilteringModeSetting(); static CachedSettingValue<NameFilteringMode> &nameFilteringModeSetting();
Ui::SearchTab *m_ui; Ui::SearchJobWidget *m_ui;
SearchHandler *m_searchHandler; SearchHandler *m_searchHandler;
QStandardItemModel *m_searchListModel; QStandardItemModel *m_searchListModel;
SearchSortModel *m_proxyModel; SearchSortModel *m_proxyModel;
@ -121,4 +121,4 @@ private:
bool m_noSearchResults = true; 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 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>SearchTab</class> <class>SearchJobWidget</class>
<widget class="QWidget" name="SearchTab"> <widget class="QWidget" name="SearchJobWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>

34
src/gui/search/searchwidget.cpp

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

8
src/gui/search/searchwidget.h

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

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

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

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

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

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

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

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

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

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

@ -26,8 +26,8 @@
* exception statement from your version. * exception statement from your version.
*/ */
#ifndef BANDWIDTH_ALLOCATION_H #ifndef SPEEDLIMITDIALOG_H
#define BANDWIDTH_ALLOCATION_H #define SPEEDLIMITDIALOG_H
#include <QDialog> #include <QDialog>
#include <QList> #include <QList>
@ -37,7 +37,7 @@
namespace Ui namespace Ui
{ {
class bandwidth_dlg; class SpeedLimitDialog;
} }
class SpeedLimitDialog : public QDialog class SpeedLimitDialog : public QDialog
@ -57,7 +57,7 @@ protected slots:
private: private:
long getSpeedLimit() const; 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 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>bandwidth_dlg</class> <class>SpeedLimitDialog</class>
<widget class="QDialog" name="bandwidth_dlg"> <widget class="QDialog" name="SpeedLimitDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -46,7 +46,7 @@
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>rejected()</signal> <signal>rejected()</signal>
<receiver>bandwidth_dlg</receiver> <receiver>SpeedLimitDialog</receiver>
<slot>reject()</slot> <slot>reject()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
@ -62,7 +62,7 @@
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>accepted()</signal> <signal>accepted()</signal>
<receiver>bandwidth_dlg</receiver> <receiver>SpeedLimitDialog</receiver>
<slot>accept()</slot> <slot>accept()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">

2
src/gui/statusbar.cpp

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

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

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

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

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

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

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

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

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

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

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

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

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

54
src/gui/transferlistdelegate.cpp

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

42
src/gui/transferlistfilterswidget.cpp

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

12
src/gui/transferlistfilterswidget.h

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

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

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

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

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

48
src/gui/transferlistsortmodel.cpp

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

80
src/gui/transferlistwidget.cpp

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

6
src/gui/transferlistwidget.h

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

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

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

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

@ -26,25 +26,25 @@
* exception statement from your version. * exception statement from your version.
*/ */
#ifndef UPDOWNRATIODLG_H #ifndef UPDOWNRATIODIALOG_H
#define UPDOWNRATIODLG_H #define UPDOWNRATIODIALOG_H
#include <QDialog> #include <QDialog>
namespace Ui namespace Ui
{ {
class UpDownRatioDlg; class UpDownRatioDialog;
} }
class UpDownRatioDlg : public QDialog class UpDownRatioDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
UpDownRatioDlg(bool useDefault, qreal initialValue, qreal maxValue, UpDownRatioDialog(bool useDefault, qreal initialValue, qreal maxValue,
int initialTimeValue, int maxTimeValue, int initialTimeValue, int maxTimeValue,
QWidget *parent = nullptr); QWidget *parent = nullptr);
~UpDownRatioDlg(); ~UpDownRatioDialog();
bool useDefault() const; bool useDefault() const;
qreal ratio() const; qreal ratio() const;
@ -59,7 +59,7 @@ private slots:
void enableTimeSpin(); void enableTimeSpin();
private: 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 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>UpDownRatioDlg</class> <class>UpDownRatioDialog</class>
<widget class="QDialog" name="UpDownRatioDlg"> <widget class="QDialog" name="UpDownRatioDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -140,7 +140,7 @@
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>accepted()</signal> <signal>accepted()</signal>
<receiver>UpDownRatioDlg</receiver> <receiver>UpDownRatioDialog</receiver>
<slot>accept()</slot> <slot>accept()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
@ -156,7 +156,7 @@
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>rejected()</signal> <signal>rejected()</signal>
<receiver>UpDownRatioDlg</receiver> <receiver>UpDownRatioDialog</receiver>
<slot>reject()</slot> <slot>reject()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">

3
src/webui/CMakeLists.txt

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

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

@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8" /> <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" /> <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-core-yc.js"></script>
<script src="scripts/lib/mootools-1.2-more.js"></script> <script src="scripts/lib/mootools-1.2-more.js"></script>
@ -32,7 +32,7 @@
<body> <body>
<div style="text-align: center;"> <div style="text-align: center;">
<br/> <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> <textarea name="list" id="trackersUrls" rows="10" cols="1"></textarea>
<br/> <br/>
<input type="button" value="QBT_TR(Add)QBT_TR[CONTEXT=HttpServer]" id="addTrackersButton" /> <input type="button" value="QBT_TR(Add)QBT_TR[CONTEXT=HttpServer]" id="addTrackersButton" />

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

@ -1,14 +1,14 @@
<span class="filterTitle">QBT_TR(Status)QBT_TR[CONTEXT=TransferListFiltersWidget]</span> <span class="filterTitle">QBT_TR(Status)QBT_TR[CONTEXT=TransferListFiltersWidget]</span>
<ul class="filterList"> <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="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=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=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=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=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=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=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=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=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=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=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=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=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=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=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=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=StatusFilterWidget]</a></li>
</ul> </ul>
<br/> <br/>
<span class="filterTitle">QBT_TR(Categories)QBT_TR[CONTEXT=TransferListFiltersWidget]</span> <span class="filterTitle">QBT_TR(Categories)QBT_TR[CONTEXT=TransferListFiltersWidget]</span>

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

@ -84,10 +84,10 @@
<table class="dynamicTable" style="width: 100%"> <table class="dynamicTable" style="width: 100%">
<thead> <thead>
<tr> <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: 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=TrackerList]</th> <th style="width: 10%;">QBT_TR(Status)QBT_TR[CONTEXT=TrackerListWidget]</th>
<th style="width: 10%;">QBT_TR(Peers)QBT_TR[CONTEXT=TrackerList]</th> <th style="width: 10%;">QBT_TR(Peers)QBT_TR[CONTEXT=TrackerListWidget]</th>
<th style="width: 50%;">QBT_TR(Message)QBT_TR[CONTEXT=TrackerList]</th> <th style="width: 50%;">QBT_TR(Message)QBT_TR[CONTEXT=TrackerListWidget]</th>
</tr> </tr>
</thead> </thead>
<tbody id="trackersTable"></tbody> <tbody id="trackersTable"></tbody>
@ -120,7 +120,7 @@
<table class="dynamicTable" style="width: 100%"> <table class="dynamicTable" style="width: 100%">
<thead> <thead>
<tr> <tr>
<th>QBT_TR(URL)QBT_TR[CONTEXT=TrackerList]</th> <th>QBT_TR(URL)QBT_TR[CONTEXT=TrackerListWidget]</th>
</tr> </tr>
</thead> </thead>
<tbody id="webseedsTable"></tbody> <tbody id="webseedsTable"></tbody>

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

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

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

@ -743,35 +743,35 @@ var TorrentsTable = new Class({
initColumns: function() { initColumns: function() {
this.newColumn('priority', '', '#', 30, true); this.newColumn('priority', '', '#', 30, true);
this.newColumn('state_icon', 'cursor: default', '', 22, true); this.newColumn('state_icon', 'cursor: default', '', 22, true);
this.newColumn('name', '', 'QBT_TR(Name)QBT_TR[CONTEXT=TorrentModel]', 200, true); this.newColumn('name', '', 'QBT_TR(Name)QBT_TR[CONTEXT=TransferListModel]', 200, true);
this.newColumn('size', '', 'QBT_TR(Size)QBT_TR[CONTEXT=TorrentModel]', 100, true); this.newColumn('size', '', 'QBT_TR(Size)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('total_size', '', 'QBT_TR(Total Size)QBT_TR[CONTEXT=TorrentModel]', 100, false); this.newColumn('total_size', '', 'QBT_TR(Total Size)QBT_TR[CONTEXT=TransferListModel]', 100, false);
this.newColumn('progress', '', 'QBT_TR(Done)QBT_TR[CONTEXT=TorrentModel]', 85, true); this.newColumn('progress', '', 'QBT_TR(Done)QBT_TR[CONTEXT=TransferListModel]', 85, true);
this.newColumn('status', '', 'QBT_TR(Status)QBT_TR[CONTEXT=TorrentModel]', 100, true); this.newColumn('status', '', 'QBT_TR(Status)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('num_seeds', '', 'QBT_TR(Seeds)QBT_TR[CONTEXT=TorrentModel]', 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=TorrentModel]', 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=TorrentModel]', 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=TorrentModel]', 100, true); this.newColumn('upspeed', '', 'QBT_TR(Up Speed)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('eta', '', 'QBT_TR(ETA)QBT_TR[CONTEXT=TorrentModel]', 100, true); this.newColumn('eta', '', 'QBT_TR(ETA)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('ratio', '', 'QBT_TR(Ratio)QBT_TR[CONTEXT=TorrentModel]', 100, true); this.newColumn('ratio', '', 'QBT_TR(Ratio)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('category', '', 'QBT_TR(Category)QBT_TR[CONTEXT=TorrentModel]', 100, true); this.newColumn('category', '', 'QBT_TR(Category)QBT_TR[CONTEXT=TransferListModel]', 100, true);
this.newColumn('tags', '', 'QBT_TR(Tags)QBT_TR[CONTEXT=TorrentModel]', 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=TorrentModel]', 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=TorrentModel]', 100, false); this.newColumn('completion_on', '', 'QBT_TR(Completed On)QBT_TR[CONTEXT=TransferListModel]', 100, false);
this.newColumn('tracker', '', 'QBT_TR(Tracker)QBT_TR[CONTEXT=TorrentModel]', 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=TorrentModel]', 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=TorrentModel]', 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=TorrentModel]', 100, false); this.newColumn('downloaded', '', 'QBT_TR(Downloaded)QBT_TR[CONTEXT=TransferListModel]', 100, false);
this.newColumn('uploaded', '', 'QBT_TR(Uploaded)QBT_TR[CONTEXT=TorrentModel]', 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=TorrentModel]', 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=TorrentModel]', 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=TorrentModel]', 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=TorrentModel]', 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=TorrentModel]', 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=TorrentModel]', 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=TorrentModel]', 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=TorrentModel]', 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=TorrentModel]', 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'].onclick = '';
this.columns['state_icon'].dataProperties[0] = 'state'; this.columns['state_icon'].dataProperties[0] = 'state';

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

@ -188,7 +188,7 @@ initializeWindows = function() {
var orig = torrentsHaveSameShareRatio ? shareRatio : ""; var orig = torrentsHaveSameShareRatio ? shareRatio : "";
new MochaUI.Window({ new MochaUI.Window({
id: 'shareRatioPage', 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', loadMethod: 'iframe',
contentURL: 'shareratio.html?hashes=' + hashes.join("|") + '&orig=' + orig, contentURL: 'shareratio.html?hashes=' + hashes.join("|") + '&orig=' + orig,
scrollbars: false, scrollbars: false,

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

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

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

@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8" /> <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" /> <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-core-yc.js"></script>
<script src="scripts/lib/mootools-1.2-more.js"></script> <script src="scripts/lib/mootools-1.2-more.js"></script>
@ -144,18 +144,18 @@
<body> <body>
<div style="padding: 10px 10px 0px 10px;"> <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" 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=UpDownRatioDlg]</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=UpDownRatioDlg]</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;"> <div style="margin-left: 40px; margin-bottom: 5px;">
<input type="checkbox" id="setRatio" class="shareLimitInput" onclick="enableInputBoxes()" /> <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" /> <input type="number" id="ratio" value="0.00" step=".01" min="0" max="9999" class="shareLimitInput" />
</div> </div>
<div style="margin-left: 40px; margin-bottom: 5px;"> <div style="margin-left: 40px; margin-bottom: 5px;">
<input type="checkbox" id="setMinutes" class="shareLimitInput" onclick="enableInputBoxes()" /> <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" /> <input type="number" id="minutes" value="0" step="1" min="0" max="525600" class="shareLimitInput" />
</div> </div>
<div style="text-align: center; padding-top: 10px;"> <div style="text-align: center; padding-top: 10px;">

Loading…
Cancel
Save