From d34ddb2e3c7335567220e1df4c380a6eaa7b0cb4 Mon Sep 17 00:00:00 2001 From: thalieht Date: Thu, 14 Jun 2018 12:54:23 +0300 Subject: [PATCH] Change file names and classes names to match them --- src/app/CMakeLists.txt | 2 +- src/app/app.pri | 4 +- src/app/application.cpp | 4 +- src/app/main.cpp | 4 +- ...tacktrace_win_dlg.h => stacktracedialog.h} | 13 +-- ...cktrace_win_dlg.ui => stacktracedialog.ui} | 4 +- src/base/CMakeLists.txt | 3 + src/gui/CMakeLists.txt | 74 +++++++------- src/gui/{about_imp.h => aboutdialog.h} | 10 +- src/gui/{about.ui => aboutdialog.ui} | 4 +- src/gui/addnewtorrentdialog.cpp | 32 +++--- ...stoptions.cpp => banlistoptionsdialog.cpp} | 18 ++-- ...anlistoptions.h => banlistoptionsdialog.h} | 16 +-- ...listoptions.ui => banlistoptionsdialog.ui} | 6 +- ...tiondlg.h => deletionconfirmationdialog.h} | 16 +-- ...ondlg.ui => deletionconfirmationdialog.ui} | 8 +- ...xecutionlog.cpp => executionlogwidget.cpp} | 20 ++-- .../{executionlog.h => executionlogwidget.h} | 17 ++-- ...{executionlog.ui => executionlogwidget.ui} | 4 +- src/gui/gui.pri | 82 ++++++++-------- src/gui/mainwindow.cpp | 22 ++--- src/gui/mainwindow.h | 8 +- src/gui/{optionsdlg.cpp => optionsdialog.cpp} | 9 +- src/gui/{optionsdlg.h => optionsdialog.h} | 6 +- src/gui/{optionsdlg.ui => optionsdialog.ui} | 0 src/gui/properties/CMakeLists.txt | 43 ++++---- src/gui/properties/peerlistwidget.cpp | 6 +- ...dditiondlg.cpp => peersadditiondialog.cpp} | 20 ++-- ...ersadditiondlg.h => peersadditiondialog.h} | 10 +- ...sadditiondlg.ui => peersadditiondialog.ui} | 6 +- src/gui/properties/properties.pri | 16 +-- src/gui/properties/propertieswidget.cpp | 16 +-- src/gui/properties/propertieswidget.h | 6 +- ...{trackerlist.cpp => trackerlistwidget.cpp} | 64 ++++++------ .../{trackerlist.h => trackerlistwidget.h} | 8 +- ...tiondlg.cpp => trackersadditiondialog.cpp} | 26 ++--- ...additiondlg.h => trackersadditiondialog.h} | 10 +- ...ditiondlg.ui => trackersadditiondialog.ui} | 8 +- ...sageboxraised.cpp => raisedmessagebox.cpp} | 18 ++-- ...{messageboxraised.h => raisedmessagebox.h} | 16 +-- src/gui/rss/CMakeLists.txt | 5 + src/gui/search/CMakeLists.txt | 23 +++-- ...inselectdlg.cpp => pluginselectdialog.cpp} | 94 +++++++++--------- ...pluginselectdlg.h => pluginselectdialog.h} | 16 +-- ...uginselectdlg.ui => pluginselectdialog.ui} | 4 +- ...insourcedlg.cpp => pluginsourcedialog.cpp} | 14 +-- ...pluginsourcedlg.h => pluginsourcedialog.h} | 16 +-- ...uginsourcedlg.ui => pluginsourcedialog.ui} | 4 +- .../{searchtab.cpp => searchjobwidget.cpp} | 98 +++++++++---------- .../search/{searchtab.h => searchjobwidget.h} | 14 +-- .../{searchtab.ui => searchjobwidget.ui} | 4 +- src/gui/search/searchwidget.cpp | 34 +++---- src/gui/search/searchwidget.h | 8 +- ...nfirmdlg.cpp => shutdownconfirmdialog.cpp} | 26 ++--- ...wnconfirmdlg.h => shutdownconfirmdialog.h} | 16 +-- ...confirmdlg.ui => shutdownconfirmdialog.ui} | 8 +- ...speedlimitdlg.cpp => speedlimitdialog.cpp} | 6 +- .../{speedlimitdlg.h => speedlimitdialog.h} | 10 +- ...bandwidth_limit.ui => speedlimitdialog.ui} | 8 +- src/gui/statusbar.cpp | 2 +- ...reatordlg.cpp => torrentcreatordialog.cpp} | 52 +++++----- ...entcreatordlg.h => torrentcreatordialog.h} | 16 +-- ...tcreatordlg.ui => torrentcreatordialog.ui} | 6 +- ...rackerlogin.cpp => trackerlogindialog.cpp} | 16 +-- .../{trackerlogin.h => trackerlogindialog.h} | 15 +-- src/gui/{login.ui => trackerlogindialog.ui} | 4 +- src/gui/transferlistdelegate.cpp | 54 +++++----- src/gui/transferlistfilterswidget.cpp | 42 ++++---- src/gui/transferlistfilterswidget.h | 12 +-- ...torrentmodel.cpp => transferlistmodel.cpp} | 46 ++++----- .../{torrentmodel.h => transferlistmodel.h} | 12 +-- src/gui/transferlistsortmodel.cpp | 48 ++++----- src/gui/transferlistwidget.cpp | 80 +++++++-------- src/gui/transferlistwidget.h | 6 +- ...downratiodlg.cpp => updownratiodialog.cpp} | 30 +++--- .../{updownratiodlg.h => updownratiodialog.h} | 16 +-- ...updownratiodlg.ui => updownratiodialog.ui} | 8 +- src/webui/CMakeLists.txt | 3 + src/webui/www/private/addtrackers.html | 4 +- src/webui/www/private/filters.html | 18 ++-- src/webui/www/private/properties_content.html | 10 +- src/webui/www/private/scripts/client.js | 18 ++-- src/webui/www/private/scripts/dynamicTable.js | 58 +++++------ src/webui/www/private/scripts/mocha-init.js | 2 +- .../www/private/scripts/prop-trackers.js | 2 +- src/webui/www/private/shareratio.html | 12 +-- 86 files changed, 841 insertions(+), 818 deletions(-) rename src/app/{stacktrace_win_dlg.h => stacktracedialog.h} (92%) rename src/app/{stacktrace_win_dlg.ui => stacktracedialog.ui} (93%) rename src/gui/{about_imp.h => aboutdialog.h} (96%) rename src/gui/{about.ui => aboutdialog.ui} (99%) rename src/gui/{banlistoptions.cpp => banlistoptionsdialog.cpp} (89%) rename src/gui/{banlistoptions.h => banlistoptionsdialog.h} (86%) rename src/gui/{banlistoptions.ui => banlistoptionsdialog.ui} (95%) rename src/gui/{deletionconfirmationdlg.h => deletionconfirmationdialog.h} (88%) rename src/gui/{confirmdeletiondlg.ui => deletionconfirmationdialog.ui} (94%) rename src/gui/{executionlog.cpp => executionlogwidget.cpp} (85%) rename src/gui/{executionlog.h => executionlogwidget.h} (86%) rename src/gui/{executionlog.ui => executionlogwidget.ui} (93%) rename src/gui/{optionsdlg.cpp => optionsdialog.cpp} (99%) rename src/gui/{optionsdlg.h => optionsdialog.h} (98%) rename src/gui/{optionsdlg.ui => optionsdialog.ui} (100%) rename src/gui/properties/{peersadditiondlg.cpp => peersadditiondialog.cpp} (86%) rename src/gui/properties/{peersadditiondlg.h => peersadditiondialog.h} (91%) rename src/gui/properties/{peersadditiondlg.ui => peersadditiondialog.ui} (92%) rename src/gui/properties/{trackerlist.cpp => trackerlistwidget.cpp} (93%) rename src/gui/properties/{trackerlist.h => trackerlistwidget.h} (94%) rename src/gui/properties/{trackersadditiondlg.cpp => trackersadditiondialog.cpp} (85%) rename src/gui/properties/{trackersadditiondlg.h => trackersadditiondialog.h} (89%) rename src/gui/properties/{trackersadditiondlg.ui => trackersadditiondialog.ui} (91%) rename src/gui/{messageboxraised.cpp => raisedmessagebox.cpp} (84%) rename src/gui/{messageboxraised.h => raisedmessagebox.h} (90%) rename src/gui/search/{pluginselectdlg.cpp => pluginselectdialog.cpp} (83%) rename src/gui/search/{pluginselectdlg.h => pluginselectdialog.h} (90%) rename src/gui/search/{pluginselectdlg.ui => pluginselectdialog.ui} (97%) rename src/gui/search/{pluginsourcedlg.cpp => pluginsourcedialog.cpp} (84%) rename src/gui/search/{pluginsourcedlg.h => pluginsourcedialog.h} (85%) rename src/gui/search/{pluginsourcedlg.ui => pluginsourcedialog.ui} (93%) rename src/gui/search/{searchtab.cpp => searchjobwidget.cpp} (86%) rename src/gui/search/{searchtab.h => searchjobwidget.h} (91%) rename src/gui/search/{searchtab.ui => searchjobwidget.ui} (98%) rename src/gui/{shutdownconfirmdlg.cpp => shutdownconfirmdialog.cpp} (84%) rename src/gui/{shutdownconfirmdlg.h => shutdownconfirmdialog.h} (85%) rename src/gui/{shutdownconfirmdlg.ui => shutdownconfirmdialog.ui} (94%) rename src/gui/{speedlimitdlg.cpp => speedlimitdialog.cpp} (97%) rename src/gui/{speedlimitdlg.h => speedlimitdialog.h} (93%) rename src/gui/{bandwidth_limit.ui => speedlimitdialog.ui} (90%) rename src/gui/{torrentcreatordlg.cpp => torrentcreatordialog.cpp} (86%) rename src/gui/{torrentcreatordlg.h => torrentcreatordialog.h} (89%) rename src/gui/{torrentcreatordlg.ui => torrentcreatordialog.ui} (98%) rename src/gui/{trackerlogin.cpp => trackerlogindialog.cpp} (81%) rename src/gui/{trackerlogin.h => trackerlogindialog.h} (85%) rename src/gui/{login.ui => trackerlogindialog.ui} (97%) rename src/gui/{torrentmodel.cpp => transferlistmodel.cpp} (92%) rename src/gui/{torrentmodel.h => transferlistmodel.h} (93%) rename src/gui/{updownratiodlg.cpp => updownratiodialog.cpp} (86%) rename src/gui/{updownratiodlg.h => updownratiodialog.h} (86%) rename src/gui/{updownratiodlg.ui => updownratiodialog.ui} (96%) diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index f6d0989c7..804e243ab 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -67,7 +67,7 @@ if (STACKTRACE) else (UNIX) target_sources(qBittorrent PRIVATE stacktrace_win.h) if (Qt5Widgets_FOUND) - target_sources(qBittorrent PRIVATE stacktrace_win_dlg.h) + target_sources(qBittorrent PRIVATE stacktracedialog.h) endif (Qt5Widgets_FOUND) endif (UNIX) endif (STACKTRACE) diff --git a/src/app/app.pri b/src/app/app.pri index fc792c715..bd9b03d45 100644 --- a/src/app/app.pri +++ b/src/app/app.pri @@ -32,8 +32,8 @@ stacktrace { else { HEADERS += $$PWD/stacktrace_win.h !nogui { - HEADERS += $$PWD/stacktrace_win_dlg.h - FORMS += $$PWD/stacktrace_win_dlg.ui + HEADERS += $$PWD/stacktracedialog.h + FORMS += $$PWD/stacktracedialog.ui } } } diff --git a/src/app/application.cpp b/src/app/application.cpp index d91ed50db..8a647ec2e 100644 --- a/src/app/application.cpp +++ b/src/app/application.cpp @@ -57,7 +57,7 @@ #include "addnewtorrentdialog.h" #include "gui/guiiconprovider.h" #include "mainwindow.h" -#include "shutdownconfirmdlg.h" +#include "shutdownconfirmdialog.h" #else // DISABLE_GUI #include #endif // DISABLE_GUI @@ -391,7 +391,7 @@ void Application::allTorrentsFinished() // do nothing & skip confirm } else { - if (!ShutdownConfirmDlg::askForConfirmation(m_window, action)) return; + if (!ShutdownConfirmDialog::askForConfirmation(m_window, action)) return; } #endif // DISABLE_GUI diff --git a/src/app/main.cpp b/src/app/main.cpp index 050bf2a96..66a1a7bcc 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -61,7 +61,7 @@ Q_IMPORT_PLUGIN(QICOPlugin) #include "stacktrace.h" #else #include "stacktrace_win.h" -#include "stacktrace_win_dlg.h" +#include "stacktracedialog.h" #endif // Q_OS_UNIX #endif //STACKTRACE @@ -306,7 +306,7 @@ void sigAbnormalHandler(int signum) #endif #if defined Q_OS_WIN - StraceDlg dlg; // unsafe + StacktraceDialog dlg; // unsafe dlg.setStacktraceString(QLatin1String(sigName), straceWin::getBacktrace()); dlg.exec(); #endif diff --git a/src/app/stacktrace_win_dlg.h b/src/app/stacktracedialog.h similarity index 92% rename from src/app/stacktrace_win_dlg.h rename to src/app/stacktracedialog.h index 9ba2ca0fc..18d9486c6 100644 --- a/src/app/stacktrace_win_dlg.h +++ b/src/app/stacktracedialog.h @@ -27,20 +27,21 @@ * */ -#ifndef STACKTRACE_WIN_DLG_H -#define STACKTRACE_WIN_DLG_H +#ifndef STACKTRACEDIALOG_H +#define STACKTRACEDIALOG_H #include #include + #include "base/utils/misc.h" -#include "ui_stacktrace_win_dlg.h" +#include "ui_stacktracedialog.h" -class StraceDlg : public QDialog, private Ui::errorDialog +class StacktraceDialog : public QDialog, private Ui::StacktraceDialog { Q_OBJECT public: - StraceDlg(QWidget *parent = nullptr) + StacktraceDialog(QWidget *parent = nullptr) : QDialog(parent) { setupUi(this); @@ -83,4 +84,4 @@ public: } }; -#endif +#endif // STACKTRACEDIALOG_H diff --git a/src/app/stacktrace_win_dlg.ui b/src/app/stacktracedialog.ui similarity index 93% rename from src/app/stacktrace_win_dlg.ui rename to src/app/stacktracedialog.ui index 41f1fc7f9..ca22096db 100644 --- a/src/app/stacktrace_win_dlg.ui +++ b/src/app/stacktracedialog.ui @@ -1,7 +1,7 @@ - errorDialog - + StacktraceDialog + 0 diff --git a/src/base/CMakeLists.txt b/src/base/CMakeLists.txt index d8dce6052..90e724793 100644 --- a/src/base/CMakeLists.txt +++ b/src/base/CMakeLists.txt @@ -1,6 +1,7 @@ find_package(ZLIB 1.2.5.2 REQUIRED) add_library(qbt_base STATIC +# headers bittorrent/addtorrentparams.h bittorrent/cachestatus.h bittorrent/infohash.h @@ -72,6 +73,8 @@ torrentfilter.h tristatebool.h types.h unicodestrings.h + +# sources bittorrent/infohash.cpp bittorrent/magneturi.cpp bittorrent/peerinfo.cpp diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 60b225d98..b410d33c5 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -12,19 +12,19 @@ add_subdirectory(search) add_library(qbt_gui STATIC # headers -about_imp.h +aboutdialog.h addnewtorrentdialog.h advancedsettings.h autoexpandabledialog.h -banlistoptions.h +banlistoptionsdialog.h categoryfiltermodel.h categoryfilterproxymodel.h categoryfilterwidget.h cookiesdialog.h cookiesmodel.h -deletionconfirmationdlg.h +deletionconfirmationdialog.h downloadfromurldialog.h -executionlog.h +executionlogwidget.h fspathedit.h fspathedit_p.h guiiconprovider.h @@ -32,13 +32,13 @@ hidabletabwidget.h ipsubnetwhitelistoptionsdialog.h loglistwidget.h mainwindow.h -messageboxraised.h -optionsdlg.h +optionsdialog.h previewlistdelegate.h previewselectdialog.h +raisedmessagebox.h scanfoldersdelegate.h -shutdownconfirmdlg.h -speedlimitdlg.h +shutdownconfirmdialog.h +speedlimitdialog.h statsdialog.h statusbar.h tagfiltermodel.h @@ -51,39 +51,40 @@ torrentcontentmodelfile.h torrentcontentmodelfolder.h torrentcontentmodelitem.h torrentcontenttreeview.h -torrentcreatordlg.h -torrentmodel.h -trackerlogin.h +torrentcreatordialog.h +trackerlogindialog.h transferlistdelegate.h transferlistfilterswidget.h +transferlistmodel.h transferlistsortmodel.h transferlistwidget.h -updownratiodlg.h +updownratiodialog.h utils.h + # sources addnewtorrentdialog.cpp advancedsettings.cpp autoexpandabledialog.cpp -banlistoptions.cpp +banlistoptionsdialog.cpp categoryfiltermodel.cpp categoryfilterproxymodel.cpp categoryfilterwidget.cpp cookiesdialog.cpp cookiesmodel.cpp downloadfromurldialog.cpp -executionlog.cpp +executionlogwidget.cpp fspathedit.cpp fspathedit_p.cpp guiiconprovider.cpp ipsubnetwhitelistoptionsdialog.cpp loglistwidget.cpp mainwindow.cpp -messageboxraised.cpp -optionsdlg.cpp +optionsdialog.cpp previewselectdialog.cpp +raisedmessagebox.cpp scanfoldersdelegate.cpp -shutdownconfirmdlg.cpp -speedlimitdlg.cpp +shutdownconfirmdialog.cpp +speedlimitdialog.cpp statsdialog.cpp statusbar.cpp tagfiltermodel.cpp @@ -96,35 +97,36 @@ torrentcontentmodelfile.cpp torrentcontentmodelfolder.cpp torrentcontentmodelitem.cpp torrentcontenttreeview.cpp -torrentcreatordlg.cpp -torrentmodel.cpp -trackerlogin.cpp +torrentcreatordialog.cpp +trackerlogindialog.cpp transferlistdelegate.cpp transferlistfilterswidget.cpp +transferlistmodel.cpp transferlistsortmodel.cpp transferlistwidget.cpp -updownratiodlg.cpp +updownratiodialog.cpp utils.cpp + # forms -mainwindow.ui -about.ui -banlistoptions.ui +aboutdialog.ui +addnewtorrentdialog.ui +autoexpandabledialog.ui +banlistoptionsdialog.ui cookiesdialog.ui +deletionconfirmationdialog.ui +downloadfromurldialog.ui +executionlogwidget.ui ipsubnetwhitelistoptionsdialog.ui +mainwindow.ui +optionsdialog.ui previewselectdialog.ui -login.ui -downloadfromurldialog.ui -bandwidth_limit.ui -updownratiodlg.ui -confirmdeletiondlg.ui -executionlog.ui -addnewtorrentdialog.ui -autoexpandabledialog.ui +shutdownconfirmdialog.ui +speedlimitdialog.ui statsdialog.ui -optionsdlg.ui torrentcategorydialog.ui -torrentcreatordlg.ui -shutdownconfirmdlg.ui +torrentcreatordialog.ui +trackerlogindialog.ui +updownratiodialog.ui ) target_link_libraries(qbt_gui diff --git a/src/gui/about_imp.h b/src/gui/aboutdialog.h similarity index 96% rename from src/gui/about_imp.h rename to src/gui/aboutdialog.h index b0ac6a548..0e99366e7 100644 --- a/src/gui/about_imp.h +++ b/src/gui/aboutdialog.h @@ -26,17 +26,17 @@ * exception statement from your version. */ -#ifndef ABOUT_H -#define ABOUT_H +#ifndef ABOUTDIALOG_H +#define ABOUTDIALOG_H #include #include "base/unicodestrings.h" #include "base/utils/misc.h" -#include "ui_about.h" +#include "ui_aboutdialog.h" #include "utils.h" -class AboutDialog : public QDialog, private Ui::AboutDlg +class AboutDialog : public QDialog, private Ui::AboutDialog { Q_OBJECT @@ -107,4 +107,4 @@ public: } }; -#endif // ABOUT_H +#endif // ABOUTDIALOG_H diff --git a/src/gui/about.ui b/src/gui/aboutdialog.ui similarity index 99% rename from src/gui/about.ui rename to src/gui/aboutdialog.ui index 27581c0ca..3bf942053 100644 --- a/src/gui/about.ui +++ b/src/gui/aboutdialog.ui @@ -1,8 +1,8 @@ Christophe Dumez - AboutDlg - + AboutDialog + 0 diff --git a/src/gui/addnewtorrentdialog.cpp b/src/gui/addnewtorrentdialog.cpp index 5d525c1d6..031a9ca44 100644 --- a/src/gui/addnewtorrentdialog.cpp +++ b/src/gui/addnewtorrentdialog.cpp @@ -53,8 +53,8 @@ #include "base/utils/string.h" #include "autoexpandabledialog.h" #include "guiiconprovider.h" -#include "messageboxraised.h" #include "proplistdelegate.h" +#include "raisedmessagebox.h" #include "torrentcontentfiltermodel.h" #include "torrentcontentmodel.h" #include "ui_addnewtorrentdialog.h" @@ -268,13 +268,13 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath) m_filePath = torrentPath; if (!QFile::exists(m_filePath)) { - MessageBoxRaised::critical(this, tr("I/O Error"), tr("The torrent file '%1' does not exist.").arg(Utils::Fs::toNativePath(m_filePath))); + RaisedMessageBox::critical(this, tr("I/O Error"), tr("The torrent file '%1' does not exist.").arg(Utils::Fs::toNativePath(m_filePath))); return false; } QFileInfo fileinfo(m_filePath); if (!fileinfo.isReadable()) { - MessageBoxRaised::critical(this, tr("I/O Error"), tr("The torrent file '%1' cannot be read from the disk. Probably you don't have enough permissions.").arg(Utils::Fs::toNativePath(m_filePath))); + RaisedMessageBox::critical(this, tr("I/O Error"), tr("The torrent file '%1' cannot be read from the disk. Probably you don't have enough permissions.").arg(Utils::Fs::toNativePath(m_filePath))); return false; } @@ -282,7 +282,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath) QString error; m_torrentInfo = BitTorrent::TorrentInfo::loadFromFile(m_filePath, &error); if (!m_torrentInfo.isValid()) { - MessageBoxRaised::critical(this, tr("Invalid torrent"), tr("Failed to load the torrent: %1.\nError: %2", "Don't remove the '\n' characters. They insert a newline.") + RaisedMessageBox::critical(this, tr("Invalid torrent"), tr("Failed to load the torrent: %1.\nError: %2", "Don't remove the '\n' characters. They insert a newline.") .arg(Utils::Fs::toNativePath(m_filePath), error)); return false; } @@ -295,16 +295,16 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath) BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(m_hash); if (torrent) { if (torrent->isPrivate() || m_torrentInfo.isPrivate()) { - MessageBoxRaised::critical(this, tr("Already in the download list"), tr("Torrent '%1' is already in the download list. Trackers weren't merged because it is a private torrent.").arg(torrent->name()), QMessageBox::Ok); + RaisedMessageBox::critical(this, tr("Already in the download list"), tr("Torrent '%1' is already in the download list. Trackers weren't merged because it is a private torrent.").arg(torrent->name()), QMessageBox::Ok); } else { torrent->addTrackers(m_torrentInfo.trackers()); torrent->addUrlSeeds(m_torrentInfo.urlSeeds()); - MessageBoxRaised::information(this, tr("Already in the download list"), tr("Torrent '%1' is already in the download list. Trackers were merged.").arg(torrent->name()), QMessageBox::Ok); + RaisedMessageBox::information(this, tr("Already in the download list"), tr("Torrent '%1' is already in the download list. Trackers were merged.").arg(torrent->name()), QMessageBox::Ok); } } else { - MessageBoxRaised::critical(this, tr("Cannot add torrent"), tr("Cannot add this torrent. Perhaps it is already in adding state."), QMessageBox::Ok); + RaisedMessageBox::critical(this, tr("Cannot add torrent"), tr("Cannot add this torrent. Perhaps it is already in adding state."), QMessageBox::Ok); } return false; } @@ -318,7 +318,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath) bool AddNewTorrentDialog::loadMagnet(const BitTorrent::MagnetUri &magnetUri) { if (!magnetUri.isValid()) { - MessageBoxRaised::critical(this, tr("Invalid magnet link"), tr("This magnet link was not recognized")); + RaisedMessageBox::critical(this, tr("Invalid magnet link"), tr("This magnet link was not recognized")); return false; } @@ -329,16 +329,16 @@ bool AddNewTorrentDialog::loadMagnet(const BitTorrent::MagnetUri &magnetUri) BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(m_hash); if (torrent) { if (torrent->isPrivate()) { - MessageBoxRaised::critical(this, tr("Already in the download list"), tr("Torrent '%1' is already in the download list. Trackers weren't merged because it is a private torrent.").arg(torrent->name()), QMessageBox::Ok); + RaisedMessageBox::critical(this, tr("Already in the download list"), tr("Torrent '%1' is already in the download list. Trackers weren't merged because it is a private torrent.").arg(torrent->name()), QMessageBox::Ok); } else { torrent->addTrackers(magnetUri.trackers()); torrent->addUrlSeeds(magnetUri.urlSeeds()); - MessageBoxRaised::information(this, tr("Already in the download list"), tr("Magnet link '%1' is already in the download list. Trackers were merged.").arg(torrent->name()), QMessageBox::Ok); + RaisedMessageBox::information(this, tr("Already in the download list"), tr("Magnet link '%1' is already in the download list. Trackers were merged.").arg(torrent->name()), QMessageBox::Ok); } } else { - MessageBoxRaised::critical(this, tr("Cannot add torrent"), tr("Cannot add this torrent. Perhaps it is already in adding."), QMessageBox::Ok); + RaisedMessageBox::critical(this, tr("Cannot add torrent"), tr("Cannot add this torrent. Perhaps it is already in adding."), QMessageBox::Ok); } return false; } @@ -490,7 +490,7 @@ void AddNewTorrentDialog::renameSelectedFile() if (!ok) return; if (newName.isEmpty() || !Utils::Fs::isValidFileSystemName(newName)) { - MessageBoxRaised::warning(this, tr("Rename error"), + RaisedMessageBox::warning(this, tr("Rename error"), tr("The name is empty or contains forbidden characters, please choose a different one."), QMessageBox::Ok); return; @@ -515,7 +515,7 @@ void AddNewTorrentDialog::renameSelectedFile() for (int i = 0; i < m_torrentInfo.filesCount(); ++i) { if (i == fileIndex) continue; if (Utils::Fs::sameFileNames(m_torrentInfo.filePath(i), newFilePath)) { - MessageBoxRaised::warning(this, tr("Rename error"), + RaisedMessageBox::warning(this, tr("Rename error"), tr("This name is already in use in this folder. Please use a different name."), QMessageBox::Ok); return; @@ -553,7 +553,7 @@ void AddNewTorrentDialog::renameSelectedFile() #else if (currentName.startsWith(newPath, Qt::CaseInsensitive)) { #endif - MessageBoxRaised::warning(this, tr("The folder could not be renamed"), + RaisedMessageBox::warning(this, tr("The folder could not be renamed"), tr("This name is already in use in this folder. Please use a different name."), QMessageBox::Ok); return; @@ -696,7 +696,7 @@ void AddNewTorrentDialog::updateMetadata(const BitTorrent::TorrentInfo &info) disconnect(this, SLOT(updateMetadata(BitTorrent::TorrentInfo))); if (!info.isValid()) { - MessageBoxRaised::critical(this, tr("I/O Error"), ("Invalid metadata.")); + RaisedMessageBox::critical(this, tr("I/O Error"), ("Invalid metadata.")); setMetadataProgressIndicator(false, tr("Invalid metadata")); return; } @@ -763,7 +763,7 @@ void AddNewTorrentDialog::setupTreeview() void AddNewTorrentDialog::handleDownloadFailed(const QString &url, const QString &reason) { - MessageBoxRaised::critical(this, tr("Download Error"), + RaisedMessageBox::critical(this, tr("Download Error"), QString("Cannot download '%1': %2").arg(url, reason)); this->deleteLater(); } diff --git a/src/gui/banlistoptions.cpp b/src/gui/banlistoptionsdialog.cpp similarity index 89% rename from src/gui/banlistoptions.cpp rename to src/gui/banlistoptionsdialog.cpp index 71a1be2dd..9b54a16f4 100644 --- a/src/gui/banlistoptions.cpp +++ b/src/gui/banlistoptionsdialog.cpp @@ -26,7 +26,7 @@ * exception statement from your version. */ -#include "banlistoptions.h" +#include "banlistoptionsdialog.h" #include #include @@ -35,12 +35,12 @@ #include "base/bittorrent/session.h" #include "base/utils/net.h" -#include "ui_banlistoptions.h" +#include "ui_banlistoptionsdialog.h" #include "utils.h" -BanListOptions::BanListOptions(QWidget *parent) +BanListOptionsDialog::BanListOptionsDialog(QWidget *parent) : QDialog(parent) - , m_ui(new Ui::BanListOptions) + , m_ui(new Ui::BanListOptionsDialog) , m_modified(false) { m_ui->setupUi(this); @@ -57,12 +57,12 @@ BanListOptions::BanListOptions(QWidget *parent) Utils::Gui::resize(this); } -BanListOptions::~BanListOptions() +BanListOptionsDialog::~BanListOptionsDialog() { delete m_ui; } -void BanListOptions::on_buttonBox_accepted() +void BanListOptionsDialog::on_buttonBox_accepted() { if (m_modified) { // save to session @@ -80,7 +80,7 @@ void BanListOptions::on_buttonBox_accepted() } } -void BanListOptions::on_buttonBanIP_clicked() +void BanListOptionsDialog::on_buttonBanIP_clicked() { QString ip = m_ui->txtIP->text(); if (!Utils::Net::isValidIP(ip)) { @@ -105,7 +105,7 @@ void BanListOptions::on_buttonBanIP_clicked() m_modified = true; } -void BanListOptions::on_buttonDeleteIP_clicked() +void BanListOptionsDialog::on_buttonDeleteIP_clicked() { QModelIndexList selection = m_ui->bannedIPList->selectionModel()->selectedIndexes(); for (auto &i : selection) @@ -114,7 +114,7 @@ void BanListOptions::on_buttonDeleteIP_clicked() 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)); } diff --git a/src/gui/banlistoptions.h b/src/gui/banlistoptionsdialog.h similarity index 86% rename from src/gui/banlistoptions.h rename to src/gui/banlistoptionsdialog.h index 50b695030..585f37e84 100644 --- a/src/gui/banlistoptions.h +++ b/src/gui/banlistoptionsdialog.h @@ -26,8 +26,8 @@ * exception statement from your version. */ -#ifndef OPTIONS_BANLIST_H -#define OPTIONS_BANLIST_H +#ifndef BANLISTOPTIONSDIALOG_H +#define BANLISTOPTIONSDIALOG_H #include @@ -36,16 +36,16 @@ class QStringListModel; namespace Ui { - class BanListOptions; + class BanListOptionsDialog; } -class BanListOptions : public QDialog +class BanListOptionsDialog : public QDialog { Q_OBJECT public: - explicit BanListOptions(QWidget *parent = nullptr); - ~BanListOptions(); + explicit BanListOptionsDialog(QWidget *parent = nullptr); + ~BanListOptionsDialog(); private slots: void on_buttonBox_accepted(); @@ -54,10 +54,10 @@ private slots: void on_txtIP_textChanged(const QString &ip); private: - Ui::BanListOptions *m_ui; + Ui::BanListOptionsDialog *m_ui; QStringListModel *m_model; QSortFilterProxyModel *m_sortFilter; bool m_modified; }; -#endif // OPTIONS_BANLIST_H +#endif // BANLISTOPTIONSDIALOG_H diff --git a/src/gui/banlistoptions.ui b/src/gui/banlistoptionsdialog.ui similarity index 95% rename from src/gui/banlistoptions.ui rename to src/gui/banlistoptionsdialog.ui index 24a2ef7ae..04293f3fb 100644 --- a/src/gui/banlistoptions.ui +++ b/src/gui/banlistoptionsdialog.ui @@ -1,7 +1,7 @@ - BanListOptions - + BanListOptionsDialog + 0 @@ -110,7 +110,7 @@ buttonBox rejected() - BanListOptions + BanListOptionsDialog reject() diff --git a/src/gui/deletionconfirmationdlg.h b/src/gui/deletionconfirmationdialog.h similarity index 88% rename from src/gui/deletionconfirmationdlg.h rename to src/gui/deletionconfirmationdialog.h index df985a96a..65533a4b5 100644 --- a/src/gui/deletionconfirmationdlg.h +++ b/src/gui/deletionconfirmationdialog.h @@ -26,8 +26,8 @@ * exception statement from your version. */ -#ifndef DELETIONCONFIRMATIONDLG_H -#define DELETIONCONFIRMATIONDLG_H +#ifndef DELETIONCONFIRMATIONDIALOG_H +#define DELETIONCONFIRMATIONDIALOG_H #include #include @@ -36,15 +36,15 @@ #include "base/utils/misc.h" #include "base/utils/string.h" #include "guiiconprovider.h" -#include "ui_confirmdeletiondlg.h" +#include "ui_deletionconfirmationdialog.h" #include "utils.h" -class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg +class DeletionConfirmationDialog : public QDialog, private Ui::DeletionConfirmationDialog { Q_OBJECT public: - DeletionConfirmationDlg(QWidget *parent, const int &size, const QString &name, bool defaultDeleteFiles) + DeletionConfirmationDialog(QWidget *parent, const int &size, const QString &name, bool defaultDeleteFiles) : QDialog(parent) { setupUi(this); @@ -60,7 +60,7 @@ public: rememberBtn->setIconSize(Utils::Gui::mediumIconSize()); checkPermDelete->setChecked(defaultDeleteFiles || Preferences::instance()->deleteTorrentFilesAsDefault()); - connect(checkPermDelete, &QCheckBox::clicked, this, &DeletionConfirmationDlg::updateRememberButtonState); + connect(checkPermDelete, &QCheckBox::clicked, this, &DeletionConfirmationDialog::updateRememberButtonState); buttonBox->button(QDialogButtonBox::Cancel)->setFocus(); Utils::Gui::resize(this); @@ -73,7 +73,7 @@ public: static bool askForDeletionConfirmation(QWidget *parent, bool &deleteLocalFiles, const int &size, const QString &name) { - DeletionConfirmationDlg dlg(parent, size, name, deleteLocalFiles); + DeletionConfirmationDialog dlg(parent, size, name, deleteLocalFiles); if (dlg.exec() == QDialog::Accepted) { deleteLocalFiles = dlg.shouldDeleteLocalFiles(); return true; @@ -94,4 +94,4 @@ private slots: } }; -#endif // DELETIONCONFIRMATIONDLG_H +#endif // DELETIONCONFIRMATIONDIALOG_H diff --git a/src/gui/confirmdeletiondlg.ui b/src/gui/deletionconfirmationdialog.ui similarity index 94% rename from src/gui/confirmdeletiondlg.ui rename to src/gui/deletionconfirmationdialog.ui index acb55a35a..2629e6491 100644 --- a/src/gui/confirmdeletiondlg.ui +++ b/src/gui/deletionconfirmationdialog.ui @@ -1,7 +1,7 @@ - confirmDeletionDlg - + DeletionConfirmationDialog + 0 @@ -120,7 +120,7 @@ buttonBox accepted() - confirmDeletionDlg + DeletionConfirmationDialog accept() @@ -136,7 +136,7 @@ buttonBox rejected() - confirmDeletionDlg + DeletionConfirmationDialog reject() diff --git a/src/gui/executionlog.cpp b/src/gui/executionlogwidget.cpp similarity index 85% rename from src/gui/executionlog.cpp rename to src/gui/executionlogwidget.cpp index 5909f0f47..a26a75146 100644 --- a/src/gui/executionlog.cpp +++ b/src/gui/executionlogwidget.cpp @@ -26,7 +26,7 @@ * exception statement from your version. */ -#include "executionlog.h" +#include "executionlogwidget.h" #include #include @@ -36,11 +36,11 @@ #include "guiiconprovider.h" #include "loglistwidget.h" -#include "ui_executionlog.h" +#include "ui_executionlogwidget.h" -ExecutionLog::ExecutionLog(QWidget *parent, const Log::MsgTypes &types) +ExecutionLogWidget::ExecutionLogWidget(QWidget *parent, const Log::MsgTypes &types) : QWidget(parent) - , m_ui(new Ui::ExecutionLog) + , m_ui(new Ui::ExecutionLogWidget) , m_peerList(new LogListWidget(MAX_LOG_MESSAGES)) { m_ui->setupUi(this); @@ -59,23 +59,23 @@ ExecutionLog::ExecutionLog(QWidget *parent, const Log::MsgTypes &types) addLogMessage(msg); foreach (const Log::Peer &peer, logger->getPeers()) addPeerMessage(peer); - connect(logger, &Logger::newLogMessage, this, &ExecutionLog::addLogMessage); - connect(logger, &Logger::newLogPeer, this, &ExecutionLog::addPeerMessage); + connect(logger, &Logger::newLogMessage, this, &ExecutionLogWidget::addLogMessage); + connect(logger, &Logger::newLogPeer, this, &ExecutionLogWidget::addPeerMessage); } -ExecutionLog::~ExecutionLog() +ExecutionLogWidget::~ExecutionLogWidget() { delete m_msgList; delete m_peerList; delete m_ui; } -void ExecutionLog::showMsgTypes(const Log::MsgTypes &types) +void ExecutionLogWidget::showMsgTypes(const Log::MsgTypes &types) { m_msgList->showMsgTypes(types); } -void ExecutionLog::addLogMessage(const Log::Msg &msg) +void ExecutionLogWidget::addLogMessage(const Log::Msg &msg) { QString text; QDateTime time = QDateTime::fromMSecsSinceEpoch(msg.timestamp); @@ -99,7 +99,7 @@ void ExecutionLog::addLogMessage(const Log::Msg &msg) m_msgList->appendLine(text, msg.type); } -void ExecutionLog::addPeerMessage(const Log::Peer &peer) +void ExecutionLogWidget::addPeerMessage(const Log::Peer &peer) { QString text; QDateTime time = QDateTime::fromMSecsSinceEpoch(peer.timestamp); diff --git a/src/gui/executionlog.h b/src/gui/executionlogwidget.h similarity index 86% rename from src/gui/executionlog.h rename to src/gui/executionlogwidget.h index 4715e0a7b..45c7adc7a 100644 --- a/src/gui/executionlog.h +++ b/src/gui/executionlogwidget.h @@ -26,37 +26,36 @@ * exception statement from your version. */ -#ifndef EXECUTIONLOG_H -#define EXECUTIONLOG_H +#ifndef EXECUTIONLOGWIDGET_H +#define EXECUTIONLOGWIDGET_H #include #include "base/logger.h" - namespace Ui { - class ExecutionLog; + class ExecutionLogWidget; } class LogListWidget; -class ExecutionLog : public QWidget +class ExecutionLogWidget : public QWidget { Q_OBJECT public: - ExecutionLog(QWidget *parent, const Log::MsgTypes &types); + ExecutionLogWidget(QWidget *parent, const Log::MsgTypes &types); void showMsgTypes(const Log::MsgTypes &types); - ~ExecutionLog(); + ~ExecutionLogWidget(); private slots: void addLogMessage(const Log::Msg &msg); void addPeerMessage(const Log::Peer &peer); private: - Ui::ExecutionLog *m_ui; + Ui::ExecutionLogWidget *m_ui; LogListWidget *m_msgList; LogListWidget *m_peerList; }; -#endif // EXECUTIONLOG_H +#endif // EXECUTIONLOGWIDGET_H diff --git a/src/gui/executionlog.ui b/src/gui/executionlogwidget.ui similarity index 93% rename from src/gui/executionlog.ui rename to src/gui/executionlogwidget.ui index 1f12063fd..1814e19ac 100644 --- a/src/gui/executionlog.ui +++ b/src/gui/executionlogwidget.ui @@ -1,7 +1,7 @@ - ExecutionLog - + ExecutionLogWidget + 0 diff --git a/src/gui/gui.pri b/src/gui/gui.pri index 965266a70..603bbf105 100644 --- a/src/gui/gui.pri +++ b/src/gui/gui.pri @@ -6,19 +6,19 @@ include(properties/properties.pri) unix:!macx:dbus: include(qtnotify/qtnotify.pri) HEADERS += \ - $$PWD/about_imp.h \ + $$PWD/aboutdialog.h \ $$PWD/addnewtorrentdialog.h \ $$PWD/advancedsettings.h \ $$PWD/autoexpandabledialog.h \ - $$PWD/banlistoptions.h \ + $$PWD/banlistoptionsdialog.h \ $$PWD/categoryfiltermodel.h \ $$PWD/categoryfilterproxymodel.h \ $$PWD/categoryfilterwidget.h \ $$PWD/cookiesdialog.h \ $$PWD/cookiesmodel.h \ - $$PWD/deletionconfirmationdlg.h \ + $$PWD/deletionconfirmationdialog.h \ $$PWD/downloadfromurldialog.h \ - $$PWD/executionlog.h \ + $$PWD/executionlogwidget.h \ $$PWD/fspathedit.h \ $$PWD/fspathedit_p.h \ $$PWD/guiiconprovider.h \ @@ -26,24 +26,24 @@ HEADERS += \ $$PWD/ipsubnetwhitelistoptionsdialog.h \ $$PWD/loglistwidget.h \ $$PWD/mainwindow.h \ - $$PWD/messageboxraised.h \ - $$PWD/optionsdlg.h \ + $$PWD/optionsdialog.h \ $$PWD/previewlistdelegate.h \ $$PWD/previewselectdialog.h \ + $$PWD/raisedmessagebox.h \ $$PWD/rss/articlelistwidget.h \ $$PWD/rss/automatedrssdownloader.h \ $$PWD/rss/feedlistwidget.h \ $$PWD/rss/htmlbrowser.h \ $$PWD/rss/rsswidget.h \ $$PWD/scanfoldersdelegate.h \ - $$PWD/search/pluginselectdlg.h \ - $$PWD/search/pluginsourcedlg.h \ + $$PWD/search/pluginselectdialog.h \ + $$PWD/search/pluginsourcedialog.h \ + $$PWD/search/searchjobwidget.h \ $$PWD/search/searchlistdelegate.h \ $$PWD/search/searchsortmodel.h \ - $$PWD/search/searchtab.h \ $$PWD/search/searchwidget.h \ - $$PWD/shutdownconfirmdlg.h \ - $$PWD/speedlimitdlg.h \ + $$PWD/shutdownconfirmdialog.h \ + $$PWD/speedlimitdialog.h \ $$PWD/statsdialog.h \ $$PWD/statusbar.h \ $$PWD/tagfiltermodel.h \ @@ -56,51 +56,51 @@ HEADERS += \ $$PWD/torrentcontentmodelfolder.h \ $$PWD/torrentcontentmodelitem.h \ $$PWD/torrentcontenttreeview.h \ - $$PWD/torrentcreatordlg.h \ - $$PWD/torrentmodel.h \ - $$PWD/trackerlogin.h \ + $$PWD/torrentcreatordialog.h \ + $$PWD/trackerlogindialog.h \ $$PWD/transferlistdelegate.h \ $$PWD/transferlistfilterswidget.h \ + $$PWD/transferlistmodel.h \ $$PWD/transferlistsortmodel.h \ $$PWD/transferlistwidget.h \ - $$PWD/updownratiodlg.h \ + $$PWD/updownratiodialog.h \ $$PWD/utils.h SOURCES += \ $$PWD/addnewtorrentdialog.cpp \ $$PWD/advancedsettings.cpp \ $$PWD/autoexpandabledialog.cpp \ - $$PWD/banlistoptions.cpp \ + $$PWD/banlistoptionsdialog.cpp \ $$PWD/categoryfiltermodel.cpp \ $$PWD/categoryfilterproxymodel.cpp \ $$PWD/categoryfilterwidget.cpp \ $$PWD/cookiesdialog.cpp \ $$PWD/cookiesmodel.cpp \ $$PWD/downloadfromurldialog.cpp \ - $$PWD/executionlog.cpp \ + $$PWD/executionlogwidget.cpp \ $$PWD/fspathedit.cpp \ $$PWD/fspathedit_p.cpp \ $$PWD/guiiconprovider.cpp \ $$PWD/ipsubnetwhitelistoptionsdialog.cpp \ $$PWD/loglistwidget.cpp \ $$PWD/mainwindow.cpp \ - $$PWD/messageboxraised.cpp \ - $$PWD/optionsdlg.cpp \ + $$PWD/optionsdialog.cpp \ $$PWD/previewselectdialog.cpp \ + $$PWD/raisedmessagebox.cpp \ $$PWD/rss/articlelistwidget.cpp \ $$PWD/rss/automatedrssdownloader.cpp \ $$PWD/rss/feedlistwidget.cpp \ $$PWD/rss/htmlbrowser.cpp \ $$PWD/rss/rsswidget.cpp \ $$PWD/scanfoldersdelegate.cpp \ - $$PWD/search/pluginselectdlg.cpp \ - $$PWD/search/pluginsourcedlg.cpp \ + $$PWD/search/pluginselectdialog.cpp \ + $$PWD/search/pluginsourcedialog.cpp \ + $$PWD/search/searchjobwidget.cpp \ $$PWD/search/searchlistdelegate.cpp \ $$PWD/search/searchsortmodel.cpp \ - $$PWD/search/searchtab.cpp \ $$PWD/search/searchwidget.cpp \ - $$PWD/shutdownconfirmdlg.cpp \ - $$PWD/speedlimitdlg.cpp \ + $$PWD/shutdownconfirmdialog.cpp \ + $$PWD/speedlimitdialog.cpp \ $$PWD/statsdialog.cpp \ $$PWD/statusbar.cpp \ $$PWD/tagfiltermodel.cpp \ @@ -113,14 +113,14 @@ SOURCES += \ $$PWD/torrentcontentmodelfolder.cpp \ $$PWD/torrentcontentmodelitem.cpp \ $$PWD/torrentcontenttreeview.cpp \ - $$PWD/torrentcreatordlg.cpp \ - $$PWD/torrentmodel.cpp \ - $$PWD/trackerlogin.cpp \ + $$PWD/torrentcreatordialog.cpp \ + $$PWD/trackerlogindialog.cpp \ $$PWD/transferlistdelegate.cpp \ $$PWD/transferlistfilterswidget.cpp \ + $$PWD/transferlistmodel.cpp \ $$PWD/transferlistsortmodel.cpp \ $$PWD/transferlistwidget.cpp \ - $$PWD/updownratiodlg.cpp \ + $$PWD/updownratiodialog.cpp \ $$PWD/utils.cpp win32|macx { @@ -134,30 +134,30 @@ macx { } FORMS += \ - $$PWD/about.ui \ + $$PWD/aboutdialog.ui \ $$PWD/addnewtorrentdialog.ui \ $$PWD/autoexpandabledialog.ui \ - $$PWD/bandwidth_limit.ui \ - $$PWD/banlistoptions.ui \ - $$PWD/confirmdeletiondlg.ui \ + $$PWD/banlistoptionsdialog.ui \ $$PWD/cookiesdialog.ui \ + $$PWD/deletionconfirmationdialog.ui \ $$PWD/downloadfromurldialog.ui \ - $$PWD/executionlog.ui \ + $$PWD/executionlogwidget.ui \ $$PWD/ipsubnetwhitelistoptionsdialog.ui \ - $$PWD/login.ui \ $$PWD/mainwindow.ui \ - $$PWD/optionsdlg.ui \ + $$PWD/optionsdialog.ui \ $$PWD/previewselectdialog.ui \ $$PWD/rss/automatedrssdownloader.ui \ $$PWD/rss/rsswidget.ui \ - $$PWD/search/pluginselectdlg.ui \ - $$PWD/search/pluginsourcedlg.ui \ - $$PWD/search/searchtab.ui \ + $$PWD/search/pluginselectdialog.ui \ + $$PWD/search/pluginsourcedialog.ui \ + $$PWD/search/searchjobwidget.ui \ $$PWD/search/searchwidget.ui \ - $$PWD/shutdownconfirmdlg.ui \ + $$PWD/shutdownconfirmdialog.ui \ + $$PWD/speedlimitdialog.ui \ $$PWD/statsdialog.ui \ $$PWD/torrentcategorydialog.ui \ - $$PWD/torrentcreatordlg.ui \ - $$PWD/updownratiodlg.ui + $$PWD/torrentcreatordialog.ui \ + $$PWD/trackerlogindialog.ui \ + $$PWD/updownratiodialog.ui RESOURCES += $$PWD/about.qrc diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 91c0fb2d2..a4263b9fe 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -68,28 +68,28 @@ #include "base/settingsstorage.h" #include "base/utils/fs.h" #include "base/utils/misc.h" -#include "about_imp.h" +#include "aboutdialog.h" #include "addnewtorrentdialog.h" #include "application.h" #include "autoexpandabledialog.h" #include "cookiesdialog.h" #include "downloadfromurldialog.h" -#include "executionlog.h" +#include "executionlogwidget.h" #include "guiiconprovider.h" #include "hidabletabwidget.h" #include "lineedit.h" -#include "optionsdlg.h" +#include "optionsdialog.h" #include "peerlistwidget.h" #include "powermanagement.h" #include "propertieswidget.h" #include "rss/rsswidget.h" #include "search/searchwidget.h" -#include "speedlimitdlg.h" +#include "speedlimitdialog.h" #include "statsdialog.h" #include "statusbar.h" -#include "torrentcreatordlg.h" -#include "torrentmodel.h" -#include "trackerlist.h" +#include "torrentcreatordialog.h" +#include "transferlistmodel.h" +#include "trackerlistwidget.h" #include "transferlistfilterswidget.h" #include "transferlistwidget.h" #include "ui_mainwindow.h" @@ -106,7 +106,7 @@ #include "programupdater.h" #endif #if LIBTORRENT_VERSION_NUM < 10100 -#include "trackerlogin.h" +#include "trackerlogindialog.h" #endif #ifdef Q_OS_MAC @@ -1187,7 +1187,7 @@ void MainWindow::createTorrentTriggered(const QString &path) m_createTorrentDlg->activateWindow(); } else - m_createTorrentDlg = new TorrentCreatorDlg(this, path); + m_createTorrentDlg = new TorrentCreatorDialog(this, path); } bool MainWindow::event(QEvent *e) @@ -1507,7 +1507,7 @@ void MainWindow::trackerAuthenticationRequired(BitTorrent::TorrentHandle *const #if LIBTORRENT_VERSION_NUM < 10100 if (m_unauthenticatedTrackers.indexOf(qMakePair(torrent, torrent->currentTracker())) < 0) // Tracker login - new trackerLogin(this, torrent); + new TrackerLoginDialog(this, torrent); #else Q_UNUSED(torrent); #endif @@ -1882,7 +1882,7 @@ void MainWindow::on_actionExecutionLogs_triggered(bool checked) { if (checked) { Q_ASSERT(!m_executionLog); - m_executionLog = new ExecutionLog(m_tabs, static_cast(executionLogMsgTypes())); + m_executionLog = new ExecutionLogWidget(m_tabs, static_cast(executionLogMsgTypes())); #ifdef Q_OS_MAC m_tabs->addTab(m_executionLog, tr("Execution Log")); #else diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 08940d2a0..4fa69889e 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -52,9 +52,9 @@ class TransferListWidget; class TransferListFiltersWidget; class PropertiesWidget; class StatusBar; -class TorrentCreatorDlg; +class TorrentCreatorDialog; class LineEdit; -class ExecutionLog; +class ExecutionLogWidget; class PowerManagement; class StatsDialog; @@ -227,7 +227,7 @@ private: QPointer m_options; QPointer m_aboutDlg; QPointer m_statsDlg; - QPointer m_createTorrentDlg; + QPointer m_createTorrentDlg; QPointer m_downloadFromURLDialog; #ifndef Q_OS_MAC QPointer m_systrayIcon; @@ -249,7 +249,7 @@ private: QSplitter *m_splitter; QPointer m_searchWidget; QPointer m_rssWidget; - QPointer m_executionLog; + QPointer m_executionLog; // Power Management PowerManagement *m_pwr; QTimer *m_preventTimer; diff --git a/src/gui/optionsdlg.cpp b/src/gui/optionsdialog.cpp similarity index 99% rename from src/gui/optionsdlg.cpp rename to src/gui/optionsdialog.cpp index b2bf4c3f9..7880796b2 100644 --- a/src/gui/optionsdlg.cpp +++ b/src/gui/optionsdialog.cpp @@ -26,7 +26,7 @@ * exception statement from your version. */ -#include "optionsdlg.h" +#include "optionsdialog.h" #include @@ -63,15 +63,14 @@ #include "addnewtorrentdialog.h" #include "advancedsettings.h" #include "app/application.h" -#include "banlistoptions.h" +#include "banlistoptionsdialog.h" #include "ipsubnetwhitelistoptionsdialog.h" #include "guiiconprovider.h" #include "rss/automatedrssdownloader.h" #include "scanfoldersdelegate.h" +#include "ui_optionsdialog.h" #include "utils.h" -#include "ui_optionsdlg.h" - class WheelEventEater : public QObject { public: @@ -1807,7 +1806,7 @@ bool OptionsDialog::webUIAuthenticationOk() void OptionsDialog::on_banListButton_clicked() { // call dialog window - if (BanListOptions(this).exec() == QDialog::Accepted) + if (BanListOptionsDialog(this).exec() == QDialog::Accepted) enableApplyButton(); } diff --git a/src/gui/optionsdlg.h b/src/gui/optionsdialog.h similarity index 98% rename from src/gui/optionsdlg.h rename to src/gui/optionsdialog.h index 9cab3b5d1..36d34513b 100644 --- a/src/gui/optionsdlg.h +++ b/src/gui/optionsdialog.h @@ -26,8 +26,8 @@ * exception statement from your version. */ -#ifndef OPTIONSDLG_H -#define OPTIONSDLG_H +#ifndef OPTIONSDIALOG_H +#define OPTIONSDIALOG_H #include #include @@ -186,4 +186,4 @@ private: QList removedScanDirs; }; -#endif // OPTIONSDLG_H +#endif // OPTIONSDIALOG_H diff --git a/src/gui/optionsdlg.ui b/src/gui/optionsdialog.ui similarity index 100% rename from src/gui/optionsdlg.ui rename to src/gui/optionsdialog.ui diff --git a/src/gui/properties/CMakeLists.txt b/src/gui/properties/CMakeLists.txt index 6c901de5b..0adc4a1fa 100644 --- a/src/gui/properties/CMakeLists.txt +++ b/src/gui/properties/CMakeLists.txt @@ -1,33 +1,38 @@ add_library(qbt_properties STATIC -propertieswidget.ui -trackersadditiondlg.ui -peersadditiondlg.ui -propertieswidget.h -peerlistwidget.h -proplistdelegate.h -trackerlist.h +# headers downloadedpiecesbar.h -piecesbar.h peerlistdelegate.h peerlistsortmodel.h -peersadditiondlg.h -trackersadditiondlg.h +peerlistwidget.h +peersadditiondialog.h pieceavailabilitybar.h +piecesbar.h +propertieswidget.h +proplistdelegate.h proptabbar.h -speedwidget.h speedplotview.h -propertieswidget.cpp -proplistdelegate.cpp -peerlistwidget.cpp -trackerlist.cpp -peersadditiondlg.cpp +speedwidget.h +trackerlistwidget.h +trackersadditiondialog.h + +# sources downloadedpiecesbar.cpp -piecesbar.cpp -trackersadditiondlg.cpp +peerlistwidget.cpp +peersadditiondialog.cpp pieceavailabilitybar.cpp +piecesbar.cpp +propertieswidget.cpp +proplistdelegate.cpp proptabbar.cpp -speedwidget.cpp speedplotview.cpp +speedwidget.cpp +trackerlistwidget.cpp +trackersadditiondialog.cpp + +# forms +peersadditiondialog.ui +propertieswidget.ui +trackersadditiondialog.ui ) target_link_libraries(qbt_properties diff --git a/src/gui/properties/peerlistwidget.cpp b/src/gui/properties/peerlistwidget.cpp index 58c95bd1a..000c0d6ba 100644 --- a/src/gui/properties/peerlistwidget.cpp +++ b/src/gui/properties/peerlistwidget.cpp @@ -49,9 +49,9 @@ #include "guiiconprovider.h" #include "peerlistdelegate.h" #include "peerlistsortmodel.h" -#include "peersadditiondlg.h" +#include "peersadditiondialog.h" #include "propertieswidget.h" -#include "speedlimitdlg.h" +#include "speedlimitdialog.h" PeerListWidget::PeerListWidget(PropertiesWidget *parent) : QTreeView(parent) @@ -247,7 +247,7 @@ void PeerListWidget::showPeerListMenu(const QPoint &) if (!act) return; if (act == addPeerAct) { - QList peersList = PeersAdditionDlg::askForPeers(this); + QList peersList = PeersAdditionDialog::askForPeers(this); int peerCount = 0; foreach (const BitTorrent::PeerAddress &addr, peersList) { if (torrent->connectPeer(addr)) { diff --git a/src/gui/properties/peersadditiondlg.cpp b/src/gui/properties/peersadditiondialog.cpp similarity index 86% rename from src/gui/properties/peersadditiondlg.cpp rename to src/gui/properties/peersadditiondialog.cpp index f735b26f9..4c83f2cc7 100644 --- a/src/gui/properties/peersadditiondlg.cpp +++ b/src/gui/properties/peersadditiondialog.cpp @@ -26,34 +26,34 @@ * exception statement from your version. */ -#include "peersadditiondlg.h" +#include "peersadditiondialog.h" #include #include -#include "ui_peersadditiondlg.h" +#include "ui_peersadditiondialog.h" -PeersAdditionDlg::PeersAdditionDlg(QWidget *parent) +PeersAdditionDialog::PeersAdditionDialog(QWidget *parent) : QDialog(parent) - , m_ui(new Ui::addPeersDialog()) + , m_ui(new Ui::PeersAdditionDialog()) { m_ui->setupUi(this); - connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &PeersAdditionDlg::validateInput); + connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &PeersAdditionDialog::validateInput); } -PeersAdditionDlg::~PeersAdditionDlg() +PeersAdditionDialog::~PeersAdditionDialog() { delete m_ui; } -QList PeersAdditionDlg::askForPeers(QWidget *parent) +QList PeersAdditionDialog::askForPeers(QWidget *parent) { - PeersAdditionDlg dlg(parent); + PeersAdditionDialog dlg(parent); dlg.exec(); return dlg.m_peersList; } -void PeersAdditionDlg::validateInput() +void PeersAdditionDialog::validateInput() { if (m_ui->peers_txt->toPlainText().trimmed().isEmpty()) { QMessageBox::warning(this, tr("No peer entered"), @@ -77,7 +77,7 @@ void PeersAdditionDlg::validateInput() accept(); } -BitTorrent::PeerAddress PeersAdditionDlg::parsePeer(QString peer) +BitTorrent::PeerAddress PeersAdditionDialog::parsePeer(QString peer) { BitTorrent::PeerAddress addr; QStringList ipPort; diff --git a/src/gui/properties/peersadditiondlg.h b/src/gui/properties/peersadditiondialog.h similarity index 91% rename from src/gui/properties/peersadditiondlg.h rename to src/gui/properties/peersadditiondialog.h index 9ae19488f..f583c34bb 100644 --- a/src/gui/properties/peersadditiondlg.h +++ b/src/gui/properties/peersadditiondialog.h @@ -36,16 +36,16 @@ namespace Ui { - class addPeersDialog; + class PeersAdditionDialog; } -class PeersAdditionDlg : public QDialog +class PeersAdditionDialog : public QDialog { Q_OBJECT public: - PeersAdditionDlg(QWidget *parent); - ~PeersAdditionDlg(); + PeersAdditionDialog(QWidget *parent); + ~PeersAdditionDialog(); static QList askForPeers(QWidget *parent); @@ -55,7 +55,7 @@ protected slots: private: BitTorrent::PeerAddress parsePeer(QString peer); - Ui::addPeersDialog *m_ui; + Ui::PeersAdditionDialog *m_ui; QList m_peersList; }; diff --git a/src/gui/properties/peersadditiondlg.ui b/src/gui/properties/peersadditiondialog.ui similarity index 92% rename from src/gui/properties/peersadditiondlg.ui rename to src/gui/properties/peersadditiondialog.ui index 0264b72f9..751ef1c4b 100644 --- a/src/gui/properties/peersadditiondlg.ui +++ b/src/gui/properties/peersadditiondialog.ui @@ -1,7 +1,7 @@ - addPeersDialog - + PeersAdditionDialog + 0 @@ -51,7 +51,7 @@ buttonBox rejected() - addPeersDialog + PeersAdditionDialog reject() diff --git a/src/gui/properties/properties.pri b/src/gui/properties/properties.pri index e4eb7cc02..d2c7dbec9 100644 --- a/src/gui/properties/properties.pri +++ b/src/gui/properties/properties.pri @@ -1,16 +1,16 @@ INCLUDEPATH += $$PWD FORMS += \ - $$PWD/peersadditiondlg.ui \ + $$PWD/peersadditiondialog.ui \ $$PWD/propertieswidget.ui \ - $$PWD/trackersadditiondlg.ui + $$PWD/trackersadditiondialog.ui HEADERS += \ $$PWD/downloadedpiecesbar.h \ $$PWD/peerlistdelegate.h \ $$PWD/peerlistsortmodel.h \ $$PWD/peerlistwidget.h \ - $$PWD/peersadditiondlg.h \ + $$PWD/peersadditiondialog.h \ $$PWD/pieceavailabilitybar.h \ $$PWD/piecesbar.h \ $$PWD/propertieswidget.h \ @@ -18,13 +18,13 @@ HEADERS += \ $$PWD/proptabbar.h \ $$PWD/speedplotview.h \ $$PWD/speedwidget.h \ - $$PWD/trackerlist.h \ - $$PWD/trackersadditiondlg.h + $$PWD/trackerlistwidget.h \ + $$PWD/trackersadditiondialog.h SOURCES += \ $$PWD/downloadedpiecesbar.cpp \ $$PWD/peerlistwidget.cpp \ - $$PWD/peersadditiondlg.cpp \ + $$PWD/peersadditiondialog.cpp \ $$PWD/pieceavailabilitybar.cpp \ $$PWD/piecesbar.cpp \ $$PWD/propertieswidget.cpp \ @@ -32,5 +32,5 @@ SOURCES += \ $$PWD/proptabbar.cpp \ $$PWD/speedplotview.cpp \ $$PWD/speedwidget.cpp \ - $$PWD/trackerlist.cpp \ - $$PWD/trackersadditiondlg.cpp + $$PWD/trackerlistwidget.cpp \ + $$PWD/trackersadditiondialog.cpp diff --git a/src/gui/properties/propertieswidget.cpp b/src/gui/properties/propertieswidget.cpp index 500c3e403..ee200fee9 100644 --- a/src/gui/properties/propertieswidget.cpp +++ b/src/gui/properties/propertieswidget.cpp @@ -52,15 +52,15 @@ #include "guiiconprovider.h" #include "lineedit.h" #include "mainwindow.h" -#include "messageboxraised.h" #include "peerlistwidget.h" #include "pieceavailabilitybar.h" #include "proplistdelegate.h" #include "proptabbar.h" +#include "raisedmessagebox.h" #include "speedwidget.h" #include "torrentcontentfiltermodel.h" #include "torrentcontentmodel.h" -#include "trackerlist.h" +#include "trackerlistwidget.h" #include "transferlistwidget.h" #include "utils.h" @@ -132,13 +132,13 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow *mainWindow, Tran m_piecesAvailability->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); // Tracker list - m_trackerList = new TrackerList(this); + m_trackerList = new TrackerListWidget(this); m_ui->trackerUpButton->setIcon(GuiIconProvider::instance()->getIcon("go-up")); m_ui->trackerUpButton->setIconSize(Utils::Gui::smallIconSize()); m_ui->trackerDownButton->setIcon(GuiIconProvider::instance()->getIcon("go-down")); m_ui->trackerDownButton->setIconSize(Utils::Gui::smallIconSize()); - connect(m_ui->trackerUpButton, &QPushButton::clicked, m_trackerList, &TrackerList::moveSelectionUp); - connect(m_ui->trackerDownButton, &QPushButton::clicked, m_trackerList, &TrackerList::moveSelectionDown); + connect(m_ui->trackerUpButton, &QPushButton::clicked, m_trackerList, &TrackerListWidget::moveSelectionUp); + connect(m_ui->trackerDownButton, &QPushButton::clicked, m_trackerList, &TrackerListWidget::moveSelectionDown); m_ui->horizontalLayout_trackers->insertWidget(0, m_trackerList); // Peers list m_peerList = new PeerListWidget(this); @@ -276,7 +276,7 @@ BitTorrent::TorrentHandle *PropertiesWidget::getCurrentTorrent() const return m_torrent; } -TrackerList *PropertiesWidget::getTrackerList() const +TrackerListWidget *PropertiesWidget::getTrackerList() const { return m_trackerList; } @@ -693,7 +693,7 @@ void PropertiesWidget::renameSelectedFile() if (!ok) return; if (newName.isEmpty() || !Utils::Fs::isValidFileSystemName(newName)) { - MessageBoxRaised::warning(this, tr("Rename error"), + RaisedMessageBox::warning(this, tr("Rename error"), tr("The name is empty or contains forbidden characters, please choose a different one."), QMessageBox::Ok); return; @@ -722,7 +722,7 @@ void PropertiesWidget::renameSelectedFile() for (int i = 0; i < m_torrent->filesCount(); ++i) { if (i == fileIndex) continue; if (Utils::Fs::sameFileNames(m_torrent->filePath(i), newFilePath)) { - MessageBoxRaised::warning(this, tr("Rename error"), + RaisedMessageBox::warning(this, tr("Rename error"), tr("This name is already in use in this folder. Please use a different name."), QMessageBox::Ok); return; diff --git a/src/gui/properties/propertieswidget.h b/src/gui/properties/propertieswidget.h index 0685d90d6..d0ce56141 100644 --- a/src/gui/properties/propertieswidget.h +++ b/src/gui/properties/propertieswidget.h @@ -49,7 +49,7 @@ class PropTabBar; class SpeedWidget; class torrent_file; class TorrentContentFilterModel; -class TrackerList; +class TrackerListWidget; class TransferListWidget; namespace Ui @@ -72,7 +72,7 @@ public: PropertiesWidget(QWidget *parent, MainWindow *mainWindow, TransferListWidget *transferList); ~PropertiesWidget(); BitTorrent::TorrentHandle *getCurrentTorrent() const; - TrackerList *getTrackerList() const; + TrackerListWidget *getTrackerList() const; PeerListWidget *getPeerList() const; QTreeView *getFilesList() const; SpeedWidget *getSpeedWidget() const; @@ -120,7 +120,7 @@ private: TorrentContentFilterModel *m_propListModel; PropListDelegate *m_propListDelegate; PeerListWidget *m_peerList; - TrackerList *m_trackerList; + TrackerListWidget *m_trackerList; SpeedWidget *m_speedWidget; QList m_slideSizes; DownloadedPiecesBar *m_downloadedPieces; diff --git a/src/gui/properties/trackerlist.cpp b/src/gui/properties/trackerlistwidget.cpp similarity index 93% rename from src/gui/properties/trackerlist.cpp rename to src/gui/properties/trackerlistwidget.cpp index 92378837e..998c727d3 100644 --- a/src/gui/properties/trackerlist.cpp +++ b/src/gui/properties/trackerlistwidget.cpp @@ -26,7 +26,7 @@ * exception statement from your version. */ -#include "trackerlist.h" +#include "trackerlistwidget.h" #include #include @@ -50,9 +50,9 @@ #include "autoexpandabledialog.h" #include "guiiconprovider.h" #include "propertieswidget.h" -#include "trackersadditiondlg.h" +#include "trackersadditiondialog.h" -TrackerList::TrackerList(PropertiesWidget *properties) +TrackerListWidget::TrackerListWidget(PropertiesWidget *properties) : QTreeWidget() , m_properties(properties) { @@ -78,13 +78,13 @@ TrackerList::TrackerList(PropertiesWidget *properties) resizeColumnToContents(i); // Context menu setContextMenuPolicy(Qt::CustomContextMenu); - connect(this, &QWidget::customContextMenuRequested, this, &TrackerList::showTrackerListMenu); + connect(this, &QWidget::customContextMenuRequested, this, &TrackerListWidget::showTrackerListMenu); // Header header()->setContextMenuPolicy(Qt::CustomContextMenu); - connect(header(), &QWidget::customContextMenuRequested, this, &TrackerList::displayToggleColumnsMenu); - connect(header(), &QHeaderView::sectionMoved, this, &TrackerList::saveSettings); - connect(header(), &QHeaderView::sectionResized, this, &TrackerList::saveSettings); - connect(header(), &QHeaderView::sortIndicatorChanged, this, &TrackerList::saveSettings); + connect(header(), &QWidget::customContextMenuRequested, this, &TrackerListWidget::displayToggleColumnsMenu); + connect(header(), &QHeaderView::sectionMoved, this, &TrackerListWidget::saveSettings); + connect(header(), &QHeaderView::sectionResized, this, &TrackerListWidget::saveSettings); + connect(header(), &QHeaderView::sortIndicatorChanged, this, &TrackerListWidget::saveSettings); // Set DHT, PeX, LSD items m_DHTItem = new QTreeWidgetItem({ "", "** [DHT] **", "", "0", "", "", "0" }); insertTopLevelItem(0, m_DHTItem); @@ -116,12 +116,12 @@ TrackerList::TrackerList(PropertiesWidget *properties) headerItem()->setTextAlignment(COL_DOWNLOADED, (Qt::AlignRight | Qt::AlignVCenter)); // Set hotkeys m_editHotkey = new QShortcut(Qt::Key_F2, this, nullptr, nullptr, Qt::WidgetShortcut); - connect(m_editHotkey, &QShortcut::activated, this, &TrackerList::editSelectedTracker); - connect(this, &QAbstractItemView::doubleClicked, this, &TrackerList::editSelectedTracker); + connect(m_editHotkey, &QShortcut::activated, this, &TrackerListWidget::editSelectedTracker); + connect(this, &QAbstractItemView::doubleClicked, this, &TrackerListWidget::editSelectedTracker); m_deleteHotkey = new QShortcut(QKeySequence::Delete, this, nullptr, nullptr, Qt::WidgetShortcut); - connect(m_deleteHotkey, &QShortcut::activated, this, &TrackerList::deleteSelectedTrackers); + connect(m_deleteHotkey, &QShortcut::activated, this, &TrackerListWidget::deleteSelectedTrackers); m_copyHotkey = new QShortcut(QKeySequence::Copy, this, nullptr, nullptr, Qt::WidgetShortcut); - connect(m_copyHotkey, &QShortcut::activated, this, &TrackerList::copyTrackerUrl); + connect(m_copyHotkey, &QShortcut::activated, this, &TrackerListWidget::copyTrackerUrl); // This hack fixes reordering of first column with Qt5. // https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777 @@ -131,12 +131,12 @@ TrackerList::TrackerList(PropertiesWidget *properties) unused.setVerticalHeader(new QHeaderView(Qt::Horizontal)); } -TrackerList::~TrackerList() +TrackerListWidget::~TrackerListWidget() { saveSettings(); } -QList TrackerList::getSelectedTrackerItems() const +QList TrackerListWidget::getSelectedTrackerItems() const { const QList selectedTrackerItems = selectedItems(); QList selectedTrackers; @@ -148,7 +148,7 @@ QList TrackerList::getSelectedTrackerItems() const return selectedTrackers; } -void TrackerList::setRowColor(int row, QColor color) +void TrackerListWidget::setRowColor(int row, QColor color) { unsigned int nbColumns = columnCount(); QTreeWidgetItem *item = topLevelItem(row); @@ -156,7 +156,7 @@ void TrackerList::setRowColor(int row, QColor color) item->setData(i, Qt::ForegroundRole, color); } -void TrackerList::moveSelectionUp() +void TrackerListWidget::moveSelectionUp() { BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent(); if (!torrent) { @@ -197,7 +197,7 @@ void TrackerList::moveSelectionUp() torrent->forceReannounce(); } -void TrackerList::moveSelectionDown() +void TrackerListWidget::moveSelectionDown() { BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent(); if (!torrent) { @@ -238,7 +238,7 @@ void TrackerList::moveSelectionDown() torrent->forceReannounce(); } -void TrackerList::clear() +void TrackerListWidget::clear() { qDeleteAll(m_trackerItems); m_trackerItems.clear(); @@ -256,7 +256,7 @@ void TrackerList::clear() m_LSDItem->setText(COL_MSG, ""); } -void TrackerList::loadStickyItems(BitTorrent::TorrentHandle *const torrent) +void TrackerListWidget::loadStickyItems(BitTorrent::TorrentHandle *const torrent) { QString working = tr("Working"); QString disabled = tr("Disabled"); @@ -320,7 +320,7 @@ void TrackerList::loadStickyItems(BitTorrent::TorrentHandle *const torrent) m_LSDItem->setText(COL_PEERS, QString::number(peersLSD)); } -void TrackerList::loadTrackers() +void TrackerListWidget::loadTrackers() { // Load trackers from torrent handle BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent(); @@ -388,19 +388,19 @@ void TrackerList::loadTrackers() } // Ask the user for new trackers and add them to the torrent -void TrackerList::askForTrackers() +void TrackerListWidget::askForTrackers() { BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent(); if (!torrent) return; QList trackers; - foreach (const QString &tracker, TrackersAdditionDlg::askForTrackers(this, torrent)) + foreach (const QString &tracker, TrackersAdditionDialog::askForTrackers(this, torrent)) trackers << tracker; torrent->addTrackers(trackers); } -void TrackerList::copyTrackerUrl() +void TrackerListWidget::copyTrackerUrl() { QList selectedTrackerItems = getSelectedTrackerItems(); if (selectedTrackerItems.isEmpty()) return; @@ -415,7 +415,7 @@ void TrackerList::copyTrackerUrl() } -void TrackerList::deleteSelectedTrackers() +void TrackerListWidget::deleteSelectedTrackers() { BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent(); if (!torrent) { @@ -447,7 +447,7 @@ void TrackerList::deleteSelectedTrackers() torrent->forceReannounce(); } -void TrackerList::editSelectedTracker() +void TrackerListWidget::editSelectedTracker() { BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent(); if (!torrent) return; @@ -491,7 +491,7 @@ void TrackerList::editSelectedTracker() torrent->forceReannounce(); } -void TrackerList::reannounceSelected() +void TrackerListWidget::reannounceSelected() { QList selItems = selectedItems(); if (selItems.isEmpty()) return; @@ -520,7 +520,7 @@ void TrackerList::reannounceSelected() loadTrackers(); } -void TrackerList::showTrackerListMenu(QPoint) +void TrackerListWidget::showTrackerListMenu(QPoint) { BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent(); if (!torrent) return; @@ -575,17 +575,17 @@ void TrackerList::showTrackerListMenu(QPoint) } } -void TrackerList::loadSettings() +void TrackerListWidget::loadSettings() { header()->restoreState(Preferences::instance()->getPropTrackerListState()); } -void TrackerList::saveSettings() const +void TrackerListWidget::saveSettings() const { Preferences::instance()->setPropTrackerListState(header()->saveState()); } -QStringList TrackerList::headerLabels() +QStringList TrackerListWidget::headerLabels() { static const QStringList header { "#" @@ -601,7 +601,7 @@ QStringList TrackerList::headerLabels() return header; } -int TrackerList::visibleColumnsCount() const +int TrackerListWidget::visibleColumnsCount() const { int visibleCols = 0; for (unsigned int i = 0; i < COL_COUNT; ++i) { @@ -612,7 +612,7 @@ int TrackerList::visibleColumnsCount() const return visibleCols; } -void TrackerList::displayToggleColumnsMenu(const QPoint &) +void TrackerListWidget::displayToggleColumnsMenu(const QPoint &) { QMenu hideshowColumn(this); hideshowColumn.setTitle(tr("Column visibility")); diff --git a/src/gui/properties/trackerlist.h b/src/gui/properties/trackerlistwidget.h similarity index 94% rename from src/gui/properties/trackerlist.h rename to src/gui/properties/trackerlistwidget.h index 6596864a9..9d0ae9da1 100644 --- a/src/gui/properties/trackerlist.h +++ b/src/gui/properties/trackerlistwidget.h @@ -43,10 +43,10 @@ namespace BitTorrent class TorrentHandle; } -class TrackerList : public QTreeWidget +class TrackerListWidget : public QTreeWidget { Q_OBJECT - Q_DISABLE_COPY(TrackerList) + Q_DISABLE_COPY(TrackerListWidget) public: enum TrackerListColumn @@ -63,8 +63,8 @@ public: COL_COUNT }; - TrackerList(PropertiesWidget *properties); - ~TrackerList(); + TrackerListWidget(PropertiesWidget *properties); + ~TrackerListWidget(); int visibleColumnsCount() const; diff --git a/src/gui/properties/trackersadditiondlg.cpp b/src/gui/properties/trackersadditiondialog.cpp similarity index 85% rename from src/gui/properties/trackersadditiondlg.cpp rename to src/gui/properties/trackersadditiondialog.cpp index 546254baf..be1fef2a7 100644 --- a/src/gui/properties/trackersadditiondlg.cpp +++ b/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 * exception statement from your version. */ -#include "trackersadditiondlg.h" +#include "trackersadditiondialog.h" #include #include @@ -39,11 +39,11 @@ #include "base/utils/fs.h" #include "base/utils/misc.h" #include "guiiconprovider.h" -#include "ui_trackersadditiondlg.h" +#include "ui_trackersadditiondialog.h" -TrackersAdditionDlg::TrackersAdditionDlg(QWidget *parent, BitTorrent::TorrentHandle *const torrent) +TrackersAdditionDialog::TrackersAdditionDialog(QWidget *parent, BitTorrent::TorrentHandle *const torrent) : QDialog(parent) - , m_ui(new Ui::TrackersAdditionDlg()) + , m_ui(new Ui::TrackersAdditionDialog()) , m_torrent(torrent) { m_ui->setupUi(this); @@ -51,12 +51,12 @@ TrackersAdditionDlg::TrackersAdditionDlg(QWidget *parent, BitTorrent::TorrentHan m_ui->uTorrentListButton->setIcon(GuiIconProvider::instance()->getIcon("download")); } -TrackersAdditionDlg::~TrackersAdditionDlg() +TrackersAdditionDialog::~TrackersAdditionDialog() { delete m_ui; } -QStringList TrackersAdditionDlg::newTrackers() const +QStringList TrackersAdditionDialog::newTrackers() const { QStringList cleanTrackers; foreach (QString url, m_ui->trackers_list->toPlainText().split('\n')) { @@ -67,18 +67,18 @@ QStringList TrackersAdditionDlg::newTrackers() const return cleanTrackers; } -void TrackersAdditionDlg::on_uTorrentListButton_clicked() +void TrackersAdditionDialog::on_uTorrentListButton_clicked() { m_ui->uTorrentListButton->setEnabled(false); Net::DownloadHandler *handler = Net::DownloadManager::instance()->downloadUrl(m_ui->list_url->text(), true); connect(handler, static_cast(&Net::DownloadHandler::downloadFinished) - , this, &TrackersAdditionDlg::parseUTorrentList); - connect(handler, &Net::DownloadHandler::downloadFailed, this, &TrackersAdditionDlg::getTrackerError); + , this, &TrackersAdditionDialog::parseUTorrentList); + connect(handler, &Net::DownloadHandler::downloadFailed, this, &TrackersAdditionDialog::getTrackerError); // Just to show that it takes times setCursor(Qt::WaitCursor); } -void TrackersAdditionDlg::parseUTorrentList(const QString &, const QString &path) +void TrackersAdditionDialog::parseUTorrentList(const QString &, const QString &path) { QFile listFile(path); if (!listFile.open(QFile::ReadOnly)) { @@ -123,7 +123,7 @@ void TrackersAdditionDlg::parseUTorrentList(const QString &, const QString &path QMessageBox::information(this, tr("No change"), tr("No additional trackers were found."), QMessageBox::Ok); } -void TrackersAdditionDlg::getTrackerError(const QString &, const QString &error) +void TrackersAdditionDialog::getTrackerError(const QString &, const QString &error) { // To restore the cursor ... setCursor(Qt::ArrowCursor); @@ -131,10 +131,10 @@ void TrackersAdditionDlg::getTrackerError(const QString &, const QString &error) QMessageBox::warning(this, tr("Download error"), tr("The trackers list could not be downloaded, reason: %1").arg(error), QMessageBox::Ok); } -QStringList TrackersAdditionDlg::askForTrackers(QWidget *parent, BitTorrent::TorrentHandle *const torrent) +QStringList TrackersAdditionDialog::askForTrackers(QWidget *parent, BitTorrent::TorrentHandle *const torrent) { QStringList trackers; - TrackersAdditionDlg dlg(parent, torrent); + TrackersAdditionDialog dlg(parent, torrent); if (dlg.exec() == QDialog::Accepted) return dlg.newTrackers(); diff --git a/src/gui/properties/trackersadditiondlg.h b/src/gui/properties/trackersadditiondialog.h similarity index 89% rename from src/gui/properties/trackersadditiondlg.h rename to src/gui/properties/trackersadditiondialog.h index 0d3ac6bfd..276b4c47d 100644 --- a/src/gui/properties/trackersadditiondlg.h +++ b/src/gui/properties/trackersadditiondialog.h @@ -41,16 +41,16 @@ namespace BitTorrent namespace Ui { - class TrackersAdditionDlg; + class TrackersAdditionDialog; } -class TrackersAdditionDlg : public QDialog +class TrackersAdditionDialog : public QDialog { Q_OBJECT public: - TrackersAdditionDlg(QWidget *parent, BitTorrent::TorrentHandle *const torrent); - ~TrackersAdditionDlg(); + TrackersAdditionDialog(QWidget *parent, BitTorrent::TorrentHandle *const torrent); + ~TrackersAdditionDialog(); QStringList newTrackers() const; static QStringList askForTrackers(QWidget *parent, BitTorrent::TorrentHandle *const torrent); @@ -61,7 +61,7 @@ public slots: void getTrackerError(const QString &, const QString &error); private: - Ui::TrackersAdditionDlg *m_ui; + Ui::TrackersAdditionDialog *m_ui; BitTorrent::TorrentHandle *const m_torrent; }; diff --git a/src/gui/properties/trackersadditiondlg.ui b/src/gui/properties/trackersadditiondialog.ui similarity index 91% rename from src/gui/properties/trackersadditiondlg.ui rename to src/gui/properties/trackersadditiondialog.ui index bee0e607a..07e62caf9 100644 --- a/src/gui/properties/trackersadditiondlg.ui +++ b/src/gui/properties/trackersadditiondialog.ui @@ -1,7 +1,7 @@ - TrackersAdditionDlg - + TrackersAdditionDialog + 0 @@ -65,7 +65,7 @@ buttonBox accepted() - TrackersAdditionDlg + TrackersAdditionDialog accept() @@ -81,7 +81,7 @@ buttonBox rejected() - TrackersAdditionDlg + TrackersAdditionDialog reject() diff --git a/src/gui/messageboxraised.cpp b/src/gui/raisedmessagebox.cpp similarity index 84% rename from src/gui/messageboxraised.cpp rename to src/gui/raisedmessagebox.cpp index a4a7a3779..205930a5a 100644 --- a/src/gui/messageboxraised.cpp +++ b/src/gui/raisedmessagebox.cpp @@ -26,42 +26,42 @@ * exception statement from your version. */ -#include "messageboxraised.h" +#include "raisedmessagebox.h" -MessageBoxRaised::MessageBoxRaised(QMessageBox::Icon icon, const QString &title, const QString &text, +RaisedMessageBox::RaisedMessageBox(QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QWidget *parent, Qt::WindowFlags f) : QMessageBox(icon, title, text, buttons, parent, f) { } -QMessageBox::StandardButton MessageBoxRaised::impl(const QMessageBox::Icon &icon, QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) +QMessageBox::StandardButton RaisedMessageBox::impl(const QMessageBox::Icon &icon, QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { - MessageBoxRaised dlg(icon, title, text, buttons, parent); + RaisedMessageBox dlg(icon, title, text, buttons, parent); dlg.setDefaultButton(defaultButton); return static_cast(dlg.exec()); } -QMessageBox::StandardButton MessageBoxRaised::critical(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) +QMessageBox::StandardButton RaisedMessageBox::critical(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { return impl(Critical, parent, title, text, buttons, defaultButton); } -QMessageBox::StandardButton MessageBoxRaised::information(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) +QMessageBox::StandardButton RaisedMessageBox::information(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { return impl(Information, parent, title, text, buttons, defaultButton); } -QMessageBox::StandardButton MessageBoxRaised::question(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) +QMessageBox::StandardButton RaisedMessageBox::question(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { return impl(Question, parent, title, text, buttons, defaultButton); } -QMessageBox::StandardButton MessageBoxRaised::warning(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) +QMessageBox::StandardButton RaisedMessageBox::warning(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { return impl(Warning, parent, title, text, buttons, defaultButton); } -void MessageBoxRaised::showEvent(QShowEvent *event) +void RaisedMessageBox::showEvent(QShowEvent *event) { QMessageBox::showEvent(event); activateWindow(); diff --git a/src/gui/messageboxraised.h b/src/gui/raisedmessagebox.h similarity index 90% rename from src/gui/messageboxraised.h rename to src/gui/raisedmessagebox.h index b7bf3f7f2..77f98a6cb 100644 --- a/src/gui/messageboxraised.h +++ b/src/gui/raisedmessagebox.h @@ -26,12 +26,12 @@ * exception statement from your version. */ -#ifndef MESSAGEBOXRAISED_H -#define MESSAGEBOXRAISED_H +#ifndef RAISEDMESSAGEBOX_H +#define RAISEDMESSAGEBOX_H #include -class MessageBoxRaised : public QMessageBox +class RaisedMessageBox : public QMessageBox { Q_OBJECT @@ -45,12 +45,12 @@ protected: void showEvent(QShowEvent *event) override; private: - MessageBoxRaised(QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = NoButton, QWidget *parent = nullptr, Qt::WindowFlags f = Qt::Dialog|Qt::MSWindowsFixedSizeDialogHint); - MessageBoxRaised(); - MessageBoxRaised(MessageBoxRaised const&); - void operator=(MessageBoxRaised const&); + RaisedMessageBox(QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = NoButton, QWidget *parent = nullptr, Qt::WindowFlags f = Qt::Dialog|Qt::MSWindowsFixedSizeDialogHint); + RaisedMessageBox(); + RaisedMessageBox(RaisedMessageBox const&); + void operator=(RaisedMessageBox const&); static QMessageBox::StandardButton impl(const QMessageBox::Icon &icon, QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton); }; -#endif // MESSAGEBOXRAISED_H +#endif // RAISEDMESSAGEBOX_H diff --git a/src/gui/rss/CMakeLists.txt b/src/gui/rss/CMakeLists.txt index 1ae43bb7c..c09a6e553 100644 --- a/src/gui/rss/CMakeLists.txt +++ b/src/gui/rss/CMakeLists.txt @@ -1,14 +1,19 @@ add_library(qbt_rss STATIC +# headers articlelistwidget.h automatedrssdownloader.h feedlistwidget.h htmlbrowser.h rsswidget.h + +#sources articlelistwidget.cpp automatedrssdownloader.cpp feedlistwidget.cpp htmlbrowser.cpp rsswidget.cpp + +# forms automatedrssdownloader.ui rsswidget.ui ) diff --git a/src/gui/search/CMakeLists.txt b/src/gui/search/CMakeLists.txt index 8530bf1c8..a80aee3cc 100644 --- a/src/gui/search/CMakeLists.txt +++ b/src/gui/search/CMakeLists.txt @@ -1,19 +1,24 @@ add_library(qbt_searchengine STATIC -pluginselectdlg.ui -pluginsourcedlg.ui -searchwidget.ui -pluginselectdlg.h -pluginsourcedlg.h +# headers +pluginselectdialog.h +pluginsourcedialog.h +searchjobwidget.h searchlistdelegate.h searchsortmodel.h -searchtab.h searchwidget.h -pluginselectdlg.cpp -pluginsourcedlg.cpp + +# sources +pluginselectdialog.cpp +pluginsourcedialog.cpp +searchjobwidget.cpp searchlistdelegate.cpp searchsortmodel.cpp -searchtab.cpp searchwidget.cpp + +# forms +pluginselectdialog.ui +pluginsourcedialog.ui +searchwidget.ui ) set(QBT_SEARCHENGINE_RESOURCES diff --git a/src/gui/search/pluginselectdlg.cpp b/src/gui/search/pluginselectdialog.cpp similarity index 83% rename from src/gui/search/pluginselectdlg.cpp rename to src/gui/search/pluginselectdialog.cpp index f8e8a90e5..11135fe40 100644 --- a/src/gui/search/pluginselectdlg.cpp +++ b/src/gui/search/pluginselectdialog.cpp @@ -27,7 +27,7 @@ * exception statement from your version. */ -#include "pluginselectdlg.h" +#include "pluginselectdialog.h" #include #include @@ -45,9 +45,9 @@ #include "base/utils/misc.h" #include "autoexpandabledialog.h" #include "guiiconprovider.h" -#include "pluginsourcedlg.h" +#include "pluginsourcedialog.h" #include "searchwidget.h" -#include "ui_pluginselectdlg.h" +#include "ui_pluginselectdialog.h" #include "utils.h" enum PluginColumns @@ -59,9 +59,9 @@ enum PluginColumns PLUGIN_ID }; -PluginSelectDlg::PluginSelectDlg(SearchPluginManager *pluginManager, QWidget *parent) +PluginSelectDialog::PluginSelectDialog(SearchPluginManager *pluginManager, QWidget *parent) : QDialog(parent) - , m_ui(new Ui::PluginSelectDlg()) + , m_ui(new Ui::PluginSelectDialog()) , m_pluginManager(pluginManager) , m_asyncOps(0) , m_pendingUpdates(0) @@ -82,29 +82,29 @@ PluginSelectDlg::PluginSelectDlg(SearchPluginManager *pluginManager, QWidget *pa m_ui->actionUninstall->setIcon(GuiIconProvider::instance()->getIcon("list-remove")); - connect(m_ui->actionEnable, &QAction::toggled, this, &PluginSelectDlg::enableSelection); - connect(m_ui->pluginsTree, &QTreeWidget::customContextMenuRequested, this, &PluginSelectDlg::displayContextMenu); - connect(m_ui->pluginsTree, &QTreeWidget::itemDoubleClicked, this, &PluginSelectDlg::togglePluginState); + connect(m_ui->actionEnable, &QAction::toggled, this, &PluginSelectDialog::enableSelection); + connect(m_ui->pluginsTree, &QTreeWidget::customContextMenuRequested, this, &PluginSelectDialog::displayContextMenu); + connect(m_ui->pluginsTree, &QTreeWidget::itemDoubleClicked, this, &PluginSelectDialog::togglePluginState); loadSupportedSearchPlugins(); - connect(m_pluginManager, &SearchPluginManager::pluginInstalled, this, &PluginSelectDlg::pluginInstalled); - connect(m_pluginManager, &SearchPluginManager::pluginInstallationFailed, this, &PluginSelectDlg::pluginInstallationFailed); - connect(m_pluginManager, &SearchPluginManager::pluginUpdated, this, &PluginSelectDlg::pluginUpdated); - connect(m_pluginManager, &SearchPluginManager::pluginUpdateFailed, this, &PluginSelectDlg::pluginUpdateFailed); - connect(m_pluginManager, &SearchPluginManager::checkForUpdatesFinished, this, &PluginSelectDlg::checkForUpdatesFinished); - connect(m_pluginManager, &SearchPluginManager::checkForUpdatesFailed, this, &PluginSelectDlg::checkForUpdatesFailed); + connect(m_pluginManager, &SearchPluginManager::pluginInstalled, this, &PluginSelectDialog::pluginInstalled); + connect(m_pluginManager, &SearchPluginManager::pluginInstallationFailed, this, &PluginSelectDialog::pluginInstallationFailed); + connect(m_pluginManager, &SearchPluginManager::pluginUpdated, this, &PluginSelectDialog::pluginUpdated); + connect(m_pluginManager, &SearchPluginManager::pluginUpdateFailed, this, &PluginSelectDialog::pluginUpdateFailed); + connect(m_pluginManager, &SearchPluginManager::checkForUpdatesFinished, this, &PluginSelectDialog::checkForUpdatesFinished); + connect(m_pluginManager, &SearchPluginManager::checkForUpdatesFailed, this, &PluginSelectDialog::checkForUpdatesFailed); Utils::Gui::resize(this); show(); } -PluginSelectDlg::~PluginSelectDlg() +PluginSelectDialog::~PluginSelectDialog() { delete m_ui; } -void PluginSelectDlg::dropEvent(QDropEvent *event) +void PluginSelectDialog::dropEvent(QDropEvent *event) { event->acceptProposedAction(); @@ -133,7 +133,7 @@ void PluginSelectDlg::dropEvent(QDropEvent *event) } // Decode if we accept drag 'n drop or not -void PluginSelectDlg::dragEnterEvent(QDragEnterEvent *event) +void PluginSelectDialog::dragEnterEvent(QDragEnterEvent *event) { QString mime; foreach (mime, event->mimeData()->formats()) { @@ -145,13 +145,13 @@ void PluginSelectDlg::dragEnterEvent(QDragEnterEvent *event) } } -void PluginSelectDlg::on_updateButton_clicked() +void PluginSelectDialog::on_updateButton_clicked() { startAsyncOp(); m_pluginManager->checkForUpdates(); } -void PluginSelectDlg::togglePluginState(QTreeWidgetItem *item, int) +void PluginSelectDialog::togglePluginState(QTreeWidgetItem *item, int) { PluginInfo *plugin = m_pluginManager->pluginInfo(item->text(PLUGIN_ID)); m_pluginManager->enablePlugin(plugin->name, !plugin->enabled); @@ -165,7 +165,7 @@ void PluginSelectDlg::togglePluginState(QTreeWidgetItem *item, int) } } -void PluginSelectDlg::displayContextMenu(const QPoint&) +void PluginSelectDialog::displayContextMenu(const QPoint&) { QMenu myContextMenu(this); // Enable/disable pause/start action given the DL state @@ -180,12 +180,12 @@ void PluginSelectDlg::displayContextMenu(const QPoint&) myContextMenu.exec(QCursor::pos()); } -void PluginSelectDlg::on_closeButton_clicked() +void PluginSelectDialog::on_closeButton_clicked() { close(); } -void PluginSelectDlg::on_actionUninstall_triggered() +void PluginSelectDialog::on_actionUninstall_triggered() { bool error = false; foreach (QTreeWidgetItem *item, m_ui->pluginsTree->selectedItems()) { @@ -210,7 +210,7 @@ void PluginSelectDlg::on_actionUninstall_triggered() QMessageBox::information(this, tr("Uninstall success"), tr("All selected plugins were uninstalled successfully")); } -void PluginSelectDlg::enableSelection(bool enable) +void PluginSelectDialog::enableSelection(bool enable) { foreach (QTreeWidgetItem *item, m_ui->pluginsTree->selectedItems()) { int index = m_ui->pluginsTree->indexOfTopLevelItem(item); @@ -229,7 +229,7 @@ void PluginSelectDlg::enableSelection(bool enable) } // Set the color of a row in data model -void PluginSelectDlg::setRowColor(int row, QString color) +void PluginSelectDialog::setRowColor(int row, QString color) { QTreeWidgetItem *item = m_ui->pluginsTree->topLevelItem(row); for (int i = 0; i < m_ui->pluginsTree->columnCount(); ++i) { @@ -237,7 +237,7 @@ void PluginSelectDlg::setRowColor(int row, QString color) } } -QList PluginSelectDlg::findItemsWithUrl(QString url) +QList PluginSelectDialog::findItemsWithUrl(QString url) { QList res; @@ -250,7 +250,7 @@ QList PluginSelectDlg::findItemsWithUrl(QString url) return res; } -QTreeWidgetItem *PluginSelectDlg::findItemWithID(QString id) +QTreeWidgetItem *PluginSelectDialog::findItemWithID(QString id) { for (int i = 0; i < m_ui->pluginsTree->topLevelItemCount(); ++i) { QTreeWidgetItem *item = m_ui->pluginsTree->topLevelItem(i); @@ -261,7 +261,7 @@ QTreeWidgetItem *PluginSelectDlg::findItemWithID(QString id) return 0; } -void PluginSelectDlg::loadSupportedSearchPlugins() +void PluginSelectDialog::loadSupportedSearchPlugins() { // Some clean up first m_ui->pluginsTree->clear(); @@ -269,7 +269,7 @@ void PluginSelectDlg::loadSupportedSearchPlugins() addNewPlugin(name); } -void PluginSelectDlg::addNewPlugin(QString pluginName) +void PluginSelectDialog::addNewPlugin(QString pluginName) { QTreeWidgetItem *item = new QTreeWidgetItem(m_ui->pluginsTree); PluginInfo *plugin = m_pluginManager->pluginInfo(pluginName); @@ -294,27 +294,27 @@ void PluginSelectDlg::addNewPlugin(QString pluginName) using namespace Net; DownloadHandler *handler = DownloadManager::instance()->downloadUrl(plugin->url + "/favicon.ico", true); connect(handler, static_cast(&DownloadHandler::downloadFinished) - , this, &PluginSelectDlg::iconDownloaded); - connect(handler, &DownloadHandler::downloadFailed, this, &PluginSelectDlg::iconDownloadFailed); + , this, &PluginSelectDialog::iconDownloaded); + connect(handler, &DownloadHandler::downloadFailed, this, &PluginSelectDialog::iconDownloadFailed); } item->setText(PLUGIN_VERSION, plugin->version); } -void PluginSelectDlg::startAsyncOp() +void PluginSelectDialog::startAsyncOp() { ++m_asyncOps; if (m_asyncOps == 1) setCursor(QCursor(Qt::WaitCursor)); } -void PluginSelectDlg::finishAsyncOp() +void PluginSelectDialog::finishAsyncOp() { --m_asyncOps; if (m_asyncOps == 0) setCursor(QCursor(Qt::ArrowCursor)); } -void PluginSelectDlg::finishPluginUpdate() +void PluginSelectDialog::finishPluginUpdate() { --m_pendingUpdates; if (m_pendingUpdates == 0 && !m_updatedPlugins.isEmpty()) { @@ -324,14 +324,14 @@ void PluginSelectDlg::finishPluginUpdate() } } -void PluginSelectDlg::on_installButton_clicked() +void PluginSelectDialog::on_installButton_clicked() { - PluginSourceDlg *dlg = new PluginSourceDlg(this); - connect(dlg, &PluginSourceDlg::askForLocalFile, this, &PluginSelectDlg::askForLocalPlugin); - connect(dlg, &PluginSourceDlg::askForUrl, this, &PluginSelectDlg::askForPluginUrl); + PluginSourceDialog *dlg = new PluginSourceDialog(this); + connect(dlg, &PluginSourceDialog::askForLocalFile, this, &PluginSelectDialog::askForLocalPlugin); + connect(dlg, &PluginSourceDialog::askForUrl, this, &PluginSelectDialog::askForPluginUrl); } -void PluginSelectDlg::askForPluginUrl() +void PluginSelectDialog::askForPluginUrl() { bool ok = false; QString clipTxt = qApp->clipboard()->text(); @@ -357,7 +357,7 @@ void PluginSelectDlg::askForPluginUrl() } } -void PluginSelectDlg::askForLocalPlugin() +void PluginSelectDialog::askForLocalPlugin() { QStringList pathsList = QFileDialog::getOpenFileNames( 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); @@ -409,12 +409,12 @@ void PluginSelectDlg::iconDownloaded(const QString &url, QString filePath) Utils::Fs::forceRemove(filePath); } -void PluginSelectDlg::iconDownloadFailed(const QString &url, const QString &reason) +void PluginSelectDialog::iconDownloadFailed(const QString &url, const QString &reason) { qDebug("Could not download favicon: %s, reason: %s", qUtf8Printable(url), qUtf8Printable(reason)); } -void PluginSelectDlg::checkForUpdatesFinished(const QHash &updateInfo) +void PluginSelectDialog::checkForUpdatesFinished(const QHash &updateInfo) { finishAsyncOp(); if (updateInfo.isEmpty()) { @@ -429,13 +429,13 @@ void PluginSelectDlg::checkForUpdatesFinished(const QHashpluginInfo(name)->version; @@ -461,7 +461,7 @@ void PluginSelectDlg::pluginUpdated(const QString &name) finishPluginUpdate(); } -void PluginSelectDlg::pluginUpdateFailed(const QString &name, const QString &reason) +void PluginSelectDialog::pluginUpdateFailed(const QString &name, const QString &reason) { finishAsyncOp(); QMessageBox::information(this, tr("Search plugin update") diff --git a/src/gui/search/pluginselectdlg.h b/src/gui/search/pluginselectdialog.h similarity index 90% rename from src/gui/search/pluginselectdlg.h rename to src/gui/search/pluginselectdialog.h index fa657df5e..b32de49c1 100644 --- a/src/gui/search/pluginselectdlg.h +++ b/src/gui/search/pluginselectdialog.h @@ -27,8 +27,8 @@ * exception statement from your version. */ -#ifndef PLUGINSELECTDLG_H -#define PLUGINSELECTDLG_H +#ifndef PLUGINSELECTDIALOG_H +#define PLUGINSELECTDIALOG_H #include @@ -40,16 +40,16 @@ class QTreeWidgetItem; namespace Ui { - class PluginSelectDlg; + class PluginSelectDialog; } -class PluginSelectDlg : public QDialog +class PluginSelectDialog : public QDialog { Q_OBJECT public: - explicit PluginSelectDlg(SearchPluginManager *pluginManager, QWidget *parent = nullptr); - ~PluginSelectDlg(); + explicit PluginSelectDialog(SearchPluginManager *pluginManager, QWidget *parent = nullptr); + ~PluginSelectDialog(); QList findItemsWithUrl(QString url); QTreeWidgetItem *findItemWithID(QString id); @@ -86,11 +86,11 @@ private: void finishAsyncOp(); void finishPluginUpdate(); - Ui::PluginSelectDlg *m_ui; + Ui::PluginSelectDialog *m_ui; SearchPluginManager *m_pluginManager; QStringList m_updatedPlugins; int m_asyncOps; int m_pendingUpdates; }; -#endif // PLUGINSELECTDLG_H +#endif // PLUGINSELECTDIALOG_H diff --git a/src/gui/search/pluginselectdlg.ui b/src/gui/search/pluginselectdialog.ui similarity index 97% rename from src/gui/search/pluginselectdlg.ui rename to src/gui/search/pluginselectdialog.ui index c5d5ae730..a2275dbc3 100644 --- a/src/gui/search/pluginselectdlg.ui +++ b/src/gui/search/pluginselectdialog.ui @@ -1,7 +1,7 @@ - PluginSelectDlg - + PluginSelectDialog + 0 diff --git a/src/gui/search/pluginsourcedlg.cpp b/src/gui/search/pluginsourcedialog.cpp similarity index 84% rename from src/gui/search/pluginsourcedlg.cpp rename to src/gui/search/pluginsourcedialog.cpp index 3f3558147..0921bd8ee 100644 --- a/src/gui/search/pluginsourcedlg.cpp +++ b/src/gui/search/pluginsourcedialog.cpp @@ -26,14 +26,14 @@ * exception statement from your version. */ -#include "pluginsourcedlg.h" +#include "pluginsourcedialog.h" -#include "ui_pluginsourcedlg.h" +#include "ui_pluginsourcedialog.h" #include "utils.h" -PluginSourceDlg::PluginSourceDlg(QWidget *parent) +PluginSourceDialog::PluginSourceDialog(QWidget *parent) : QDialog(parent) - , m_ui(new Ui::PluginSourceDlg()) + , m_ui(new Ui::PluginSourceDialog()) { m_ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose); @@ -42,18 +42,18 @@ PluginSourceDlg::PluginSourceDlg(QWidget *parent) show(); } -PluginSourceDlg::~PluginSourceDlg() +PluginSourceDialog::~PluginSourceDialog() { delete m_ui; } -void PluginSourceDlg::on_localButton_clicked() +void PluginSourceDialog::on_localButton_clicked() { emit askForLocalFile(); close(); } -void PluginSourceDlg::on_urlButton_clicked() +void PluginSourceDialog::on_urlButton_clicked() { emit askForUrl(); close(); diff --git a/src/gui/search/pluginsourcedlg.h b/src/gui/search/pluginsourcedialog.h similarity index 85% rename from src/gui/search/pluginsourcedlg.h rename to src/gui/search/pluginsourcedialog.h index ef3ef2b5f..6d116afd0 100644 --- a/src/gui/search/pluginsourcedlg.h +++ b/src/gui/search/pluginsourcedialog.h @@ -26,23 +26,23 @@ * exception statement from your version. */ -#ifndef PLUGINSOURCEDLG_H -#define PLUGINSOURCEDLG_H +#ifndef PLUGINSOURCEDIALOG_H +#define PLUGINSOURCEDIALOG_H #include namespace Ui { - class PluginSourceDlg; + class PluginSourceDialog; } -class PluginSourceDlg : public QDialog +class PluginSourceDialog : public QDialog { Q_OBJECT public: - explicit PluginSourceDlg(QWidget *parent = nullptr); - ~PluginSourceDlg(); + explicit PluginSourceDialog(QWidget *parent = nullptr); + ~PluginSourceDialog(); signals: void askForUrl(); @@ -53,7 +53,7 @@ private slots: void on_urlButton_clicked(); private: - Ui::PluginSourceDlg *m_ui; + Ui::PluginSourceDialog *m_ui; }; -#endif // PLUGINSOURCEDLG_H +#endif // PLUGINSOURCEDIALOG_H diff --git a/src/gui/search/pluginsourcedlg.ui b/src/gui/search/pluginsourcedialog.ui similarity index 93% rename from src/gui/search/pluginsourcedlg.ui rename to src/gui/search/pluginsourcedialog.ui index 9b0411e1d..5e3e39001 100644 --- a/src/gui/search/pluginsourcedlg.ui +++ b/src/gui/search/pluginsourcedialog.ui @@ -1,7 +1,7 @@ - PluginSourceDlg - + PluginSourceDialog + 0 diff --git a/src/gui/search/searchtab.cpp b/src/gui/search/searchjobwidget.cpp similarity index 86% rename from src/gui/search/searchtab.cpp rename to src/gui/search/searchjobwidget.cpp index bd3102c01..d5371c1f7 100644 --- a/src/gui/search/searchtab.cpp +++ b/src/gui/search/searchjobwidget.cpp @@ -27,7 +27,7 @@ * exception statement from your version. */ -#include "searchtab.h" +#include "searchjobwidget.h" #include #include @@ -54,11 +54,11 @@ #include "guiiconprovider.h" #include "searchlistdelegate.h" #include "searchsortmodel.h" -#include "ui_searchtab.h" +#include "ui_searchjobwidget.h" -SearchTab::SearchTab(SearchHandler *searchHandler, QWidget *parent) +SearchJobWidget::SearchJobWidget(SearchHandler *searchHandler, QWidget *parent) : QWidget(parent) - , m_ui(new Ui::SearchTab) + , m_ui(new Ui::SearchJobWidget) , m_searchHandler(searchHandler) { m_ui->setupUi(this); @@ -120,61 +120,61 @@ SearchTab::SearchTab(SearchHandler *searchHandler, QWidget *parent) m_ui->resultsBrowser->resizeColumnToContents(i); header()->setContextMenuPolicy(Qt::CustomContextMenu); - connect(header(), &QWidget::customContextMenuRequested, this, &SearchTab::displayToggleColumnsMenu); - connect(header(), &QHeaderView::sectionResized, this, &SearchTab::saveSettings); - connect(header(), &QHeaderView::sectionMoved, this, &SearchTab::saveSettings); - connect(header(), &QHeaderView::sortIndicatorChanged, this, &SearchTab::saveSettings); + connect(header(), &QWidget::customContextMenuRequested, this, &SearchJobWidget::displayToggleColumnsMenu); + connect(header(), &QHeaderView::sectionResized, this, &SearchJobWidget::saveSettings); + connect(header(), &QHeaderView::sectionMoved, this, &SearchJobWidget::saveSettings); + connect(header(), &QHeaderView::sortIndicatorChanged, this, &SearchJobWidget::saveSettings); fillFilterComboBoxes(); updateFilter(); connect(m_ui->filterMode, static_cast(&QComboBox::currentIndexChanged) - , this, &SearchTab::updateFilter); - connect(m_ui->minSeeds, &QAbstractSpinBox::editingFinished, this, &SearchTab::updateFilter); + , this, &SearchJobWidget::updateFilter); + connect(m_ui->minSeeds, &QAbstractSpinBox::editingFinished, this, &SearchJobWidget::updateFilter); connect(m_ui->minSeeds, static_cast(&QSpinBox::valueChanged) - , this, &SearchTab::updateFilter); - connect(m_ui->maxSeeds, &QAbstractSpinBox::editingFinished, this, &SearchTab::updateFilter); + , this, &SearchJobWidget::updateFilter); + connect(m_ui->maxSeeds, &QAbstractSpinBox::editingFinished, this, &SearchJobWidget::updateFilter); connect(m_ui->maxSeeds, static_cast(&QSpinBox::valueChanged) - , this, &SearchTab::updateFilter); - connect(m_ui->minSize, &QAbstractSpinBox::editingFinished, this, &SearchTab::updateFilter); + , this, &SearchJobWidget::updateFilter); + connect(m_ui->minSize, &QAbstractSpinBox::editingFinished, this, &SearchJobWidget::updateFilter); connect(m_ui->minSize, static_cast(&QDoubleSpinBox::valueChanged) - , this, &SearchTab::updateFilter); - connect(m_ui->maxSize, &QAbstractSpinBox::editingFinished, this, &SearchTab::updateFilter); + , this, &SearchJobWidget::updateFilter); + connect(m_ui->maxSize, &QAbstractSpinBox::editingFinished, this, &SearchJobWidget::updateFilter); connect(m_ui->maxSize, static_cast(&QDoubleSpinBox::valueChanged) - , this, &SearchTab::updateFilter); + , this, &SearchJobWidget::updateFilter); connect(m_ui->minSizeUnit, static_cast(&QComboBox::currentIndexChanged) - , this, &SearchTab::updateFilter); + , this, &SearchJobWidget::updateFilter); connect(m_ui->maxSizeUnit, static_cast(&QComboBox::currentIndexChanged) - , this, &SearchTab::updateFilter); + , this, &SearchJobWidget::updateFilter); - connect(m_ui->resultsBrowser, &QAbstractItemView::doubleClicked, this, &SearchTab::onItemDoubleClicked); + connect(m_ui->resultsBrowser, &QAbstractItemView::doubleClicked, this, &SearchJobWidget::onItemDoubleClicked); - connect(searchHandler, &SearchHandler::newSearchResults, this, &SearchTab::appendSearchResults); - connect(searchHandler, &SearchHandler::searchFinished, this, &SearchTab::searchFinished); - connect(searchHandler, &SearchHandler::searchFailed, this, &SearchTab::searchFailed); + connect(searchHandler, &SearchHandler::newSearchResults, this, &SearchJobWidget::appendSearchResults); + connect(searchHandler, &SearchHandler::searchFinished, this, &SearchJobWidget::searchFinished); + connect(searchHandler, &SearchHandler::searchFailed, this, &SearchJobWidget::searchFailed); connect(this, &QObject::destroyed, searchHandler, &QObject::deleteLater); } -SearchTab::~SearchTab() +SearchJobWidget::~SearchJobWidget() { saveSettings(); delete m_ui; } -void SearchTab::onItemDoubleClicked(const QModelIndex &index) +void SearchJobWidget::onItemDoubleClicked(const QModelIndex &index) { setRowColor(index.row(), QApplication::palette().color(QPalette::LinkVisited)); downloadTorrent(index); } -QHeaderView *SearchTab::header() const +QHeaderView *SearchJobWidget::header() const { return m_ui->resultsBrowser->header(); } // Set the color of a row in data model -void SearchTab::setRowColor(int row, const QColor &color) +void SearchJobWidget::setRowColor(int row, const QColor &color) { m_proxyModel->setDynamicSortFilter(false); for (int i = 0; i < m_proxyModel->columnCount(); ++i) @@ -183,29 +183,29 @@ void SearchTab::setRowColor(int row, const QColor &color) m_proxyModel->setDynamicSortFilter(true); } -SearchTab::Status SearchTab::status() const +SearchJobWidget::Status SearchJobWidget::status() const { return m_status; } -int SearchTab::visibleResultsCount() const +int SearchJobWidget::visibleResultsCount() const { return m_proxyModel->rowCount(); } -void SearchTab::cancelSearch() +void SearchJobWidget::cancelSearch() { m_searchHandler->cancelSearch(); } -void SearchTab::downloadTorrents() +void SearchJobWidget::downloadTorrents() { const QModelIndexList rows {m_ui->resultsBrowser->selectionModel()->selectedRows()}; for (const QModelIndex &rowIndex : rows) downloadTorrent(rowIndex); } -void SearchTab::openTorrentPages() +void SearchJobWidget::openTorrentPages() { const QModelIndexList rows {m_ui->resultsBrowser->selectionModel()->selectedRows()}; for (const QModelIndex &rowIndex : rows) { @@ -216,7 +216,7 @@ void SearchTab::openTorrentPages() } } -void SearchTab::copyTorrentURLs() +void SearchJobWidget::copyTorrentURLs() { const QModelIndexList rows {m_ui->resultsBrowser->selectionModel()->selectedRows()}; QStringList urls; @@ -233,7 +233,7 @@ void SearchTab::copyTorrentURLs() } } -void SearchTab::setStatus(Status value) +void SearchJobWidget::setStatus(Status value) { if (m_status == value) return; @@ -242,7 +242,7 @@ void SearchTab::setStatus(Status value) emit statusChanged(); } -void SearchTab::downloadTorrent(const QModelIndex &rowIndex) +void SearchJobWidget::downloadTorrent(const QModelIndex &rowIndex) { const QString torrentUrl = m_proxyModel->data( m_proxyModel->index(rowIndex.row(), SearchSortModel::DL_LINK)).toString(); @@ -254,12 +254,12 @@ void SearchTab::downloadTorrent(const QModelIndex &rowIndex) } else { SearchDownloadHandler *downloadHandler = m_searchHandler->manager()->downloadTorrent(siteUrl, torrentUrl); - connect(downloadHandler, &SearchDownloadHandler::downloadFinished, this, &SearchTab::addTorrentToSession); + connect(downloadHandler, &SearchDownloadHandler::downloadFinished, this, &SearchJobWidget::addTorrentToSession); connect(downloadHandler, &SearchDownloadHandler::downloadFinished, downloadHandler, &SearchDownloadHandler::deleteLater); } } -void SearchTab::addTorrentToSession(const QString &source) +void SearchJobWidget::addTorrentToSession(const QString &source) { if (source.isEmpty()) return; @@ -269,7 +269,7 @@ void SearchTab::addTorrentToSession(const QString &source) BitTorrent::Session::instance()->addTorrent(source); } -void SearchTab::updateResultsCount() +void SearchJobWidget::updateResultsCount() { const int totalResults = m_searchListModel->rowCount(); const int filteredResults = m_proxyModel->rowCount(); @@ -280,7 +280,7 @@ void SearchTab::updateResultsCount() emit resultsCountUpdated(); } -void SearchTab::updateFilter() +void SearchJobWidget::updateFilter() { using Utils::Misc::SizeUnit; @@ -297,7 +297,7 @@ void SearchTab::updateFilter() updateResultsCount(); } -void SearchTab::fillFilterComboBoxes() +void SearchJobWidget::fillFilterComboBoxes() { using Utils::Misc::SizeUnit; QStringList unitStrings; @@ -330,7 +330,7 @@ void SearchTab::fillFilterComboBoxes() m_ui->filterMode->setCurrentIndex((index == -1) ? 0 : index); } -QString SearchTab::statusText(SearchTab::Status st) +QString SearchJobWidget::statusText(SearchJobWidget::Status st) { switch (st) { case Status::Ongoing: @@ -348,22 +348,22 @@ QString SearchTab::statusText(SearchTab::Status st) } } -SearchTab::NameFilteringMode SearchTab::filteringMode() const +SearchJobWidget::NameFilteringMode SearchJobWidget::filteringMode() const { return static_cast(m_ui->filterMode->itemData(m_ui->filterMode->currentIndex()).toInt()); } -void SearchTab::loadSettings() +void SearchJobWidget::loadSettings() { header()->restoreState(Preferences::instance()->getSearchTabHeaderState()); } -void SearchTab::saveSettings() const +void SearchJobWidget::saveSettings() const { Preferences::instance()->setSearchTabHeaderState(header()->saveState()); } -void SearchTab::displayToggleColumnsMenu(const QPoint&) +void SearchJobWidget::displayToggleColumnsMenu(const QPoint&) { QMenu hideshowColumn(this); hideshowColumn.setTitle(tr("Column visibility")); @@ -398,7 +398,7 @@ void SearchTab::displayToggleColumnsMenu(const QPoint&) } } -void SearchTab::searchFinished(bool cancelled) +void SearchJobWidget::searchFinished(bool cancelled) { if (cancelled) setStatus(Status::Aborted); @@ -408,12 +408,12 @@ void SearchTab::searchFinished(bool cancelled) setStatus(Status::Finished); } -void SearchTab::searchFailed() +void SearchJobWidget::searchFailed() { setStatus(Status::Error); } -void SearchTab::appendSearchResults(const QList &results) +void SearchJobWidget::appendSearchResults(const QList &results) { for (const SearchResult &result : results) { // Add item to search result list @@ -432,7 +432,7 @@ void SearchTab::appendSearchResults(const QList &results) updateResultsCount(); } -CachedSettingValue &SearchTab::nameFilteringModeSetting() +CachedSettingValue &SearchJobWidget::nameFilteringModeSetting() { static CachedSettingValue setting("Search/FilteringMode", NameFilteringMode::OnlyNames); return setting; diff --git a/src/gui/search/searchtab.h b/src/gui/search/searchjobwidget.h similarity index 91% rename from src/gui/search/searchtab.h rename to src/gui/search/searchjobwidget.h index 4c3357638..4719445b1 100644 --- a/src/gui/search/searchtab.h +++ b/src/gui/search/searchjobwidget.h @@ -50,13 +50,13 @@ struct SearchResult; namespace Ui { - class SearchTab; + class SearchJobWidget; } -class SearchTab : public QWidget +class SearchJobWidget : public QWidget { Q_OBJECT - Q_DISABLE_COPY(SearchTab) + Q_DISABLE_COPY(SearchJobWidget) public: enum class NameFilteringMode @@ -75,8 +75,8 @@ public: NoResults }; - explicit SearchTab(SearchHandler *searchHandler, QWidget *parent = nullptr); - ~SearchTab() override; + explicit SearchJobWidget(SearchHandler *searchHandler, QWidget *parent = nullptr); + ~SearchJobWidget() override; Status status() const; int visibleResultsCount() const; @@ -112,7 +112,7 @@ private: static QString statusText(Status st); static CachedSettingValue &nameFilteringModeSetting(); - Ui::SearchTab *m_ui; + Ui::SearchJobWidget *m_ui; SearchHandler *m_searchHandler; QStandardItemModel *m_searchListModel; SearchSortModel *m_proxyModel; @@ -121,4 +121,4 @@ private: bool m_noSearchResults = true; }; -Q_DECLARE_METATYPE(SearchTab::NameFilteringMode) +Q_DECLARE_METATYPE(SearchJobWidget::NameFilteringMode) diff --git a/src/gui/search/searchtab.ui b/src/gui/search/searchjobwidget.ui similarity index 98% rename from src/gui/search/searchtab.ui rename to src/gui/search/searchjobwidget.ui index 2c0e75a34..5cd2cf5f0 100644 --- a/src/gui/search/searchtab.ui +++ b/src/gui/search/searchjobwidget.ui @@ -1,7 +1,7 @@ - SearchTab - + SearchJobWidget + 0 diff --git a/src/gui/search/searchwidget.cpp b/src/gui/search/searchwidget.cpp index 391910988..efac66a5f 100644 --- a/src/gui/search/searchwidget.cpp +++ b/src/gui/search/searchwidget.cpp @@ -61,10 +61,10 @@ #include "addnewtorrentdialog.h" #include "guiiconprovider.h" #include "mainwindow.h" -#include "pluginselectdlg.h" +#include "pluginselectdialog.h" #include "searchlistdelegate.h" #include "searchsortmodel.h" -#include "searchtab.h" +#include "searchjobwidget.h" #include "ui_searchwidget.h" #define SEARCHHISTORY_MAXSIZE 50 @@ -72,18 +72,18 @@ namespace { - QString statusIconName(SearchTab::Status st) + QString statusIconName(SearchJobWidget::Status st) { switch (st) { - case SearchTab::Status::Ongoing: + case SearchJobWidget::Status::Ongoing: return QLatin1String("task-ongoing"); - case SearchTab::Status::Finished: + case SearchJobWidget::Status::Finished: return QLatin1String("task-complete"); - case SearchTab::Status::Aborted: + case SearchJobWidget::Status::Aborted: return QLatin1String("task-reject"); - case SearchTab::Status::Error: + case SearchJobWidget::Status::Error: return QLatin1String("task-attention"); - case SearchTab::Status::NoResults: + case SearchJobWidget::Status::NoResults: return QLatin1String("task-attention"); default: return QString(); @@ -267,7 +267,7 @@ void SearchWidget::selectMultipleBox(int index) void SearchWidget::on_pluginsButton_clicked() { - new PluginSelectDlg(SearchPluginManager::instance(), this); + new PluginSelectDialog(SearchPluginManager::instance(), this); } void SearchWidget::searchTextEdited(QString) @@ -323,7 +323,7 @@ void SearchWidget::on_searchButton_clicked() auto *searchHandler = SearchPluginManager::instance()->startSearch(pattern, selectedCategory(), plugins); // Tab Addition - auto *newTab = new SearchTab(searchHandler, this); + auto *newTab = new SearchJobWidget(searchHandler, this); m_allTabs.append(newTab); QString tabName = pattern; @@ -331,8 +331,8 @@ void SearchWidget::on_searchButton_clicked() m_ui->tabWidget->addTab(newTab, tabName); m_ui->tabWidget->setCurrentWidget(newTab); - connect(newTab, &SearchTab::resultsCountUpdated, this, &SearchWidget::resultsCountUpdated); - connect(newTab, &SearchTab::statusChanged + connect(newTab, &SearchJobWidget::resultsCountUpdated, this, &SearchWidget::resultsCountUpdated); + connect(newTab, &SearchJobWidget::statusChanged , m_tabStatusChangedMapper, static_cast(&QSignalMapper::map)); m_tabStatusChangedMapper->setMapping(newTab, newTab); @@ -351,13 +351,13 @@ void SearchWidget::tabStatusChanged(QWidget *tab) const int tabIndex = m_ui->tabWidget->indexOf(tab); m_ui->tabWidget->setTabToolTip(tabIndex, tab->statusTip()); m_ui->tabWidget->setTabIcon(tabIndex, GuiIconProvider::instance()->getIcon( - statusIconName(static_cast(tab)->status()))); + statusIconName(static_cast(tab)->status()))); - if ((tab == m_activeSearchTab) && (m_activeSearchTab->status() != SearchTab::Status::Ongoing)) { - Q_ASSERT(m_activeSearchTab->status() != SearchTab::Status::Ongoing); + if ((tab == m_activeSearchTab) && (m_activeSearchTab->status() != SearchJobWidget::Status::Ongoing)) { + Q_ASSERT(m_activeSearchTab->status() != SearchJobWidget::Status::Ongoing); if (m_mainWindow->isNotificationsEnabled() && (m_mainWindow->currentTabWidget() != this)) { - if (m_activeSearchTab->status() == SearchTab::Status::Error) + if (m_activeSearchTab->status() == SearchJobWidget::Status::Error) m_mainWindow->showNotificationBaloon(tr("Search Engine"), tr("Search has failed")); else m_mainWindow->showNotificationBaloon(tr("Search Engine"), tr("Search has finished")); @@ -370,7 +370,7 @@ void SearchWidget::tabStatusChanged(QWidget *tab) void SearchWidget::closeTab(int index) { - SearchTab *tab = m_allTabs.takeAt(index); + SearchJobWidget *tab = m_allTabs.takeAt(index); if (tab == m_activeSearchTab) m_ui->searchButton->setText(tr("Search")); diff --git a/src/gui/search/searchwidget.h b/src/gui/search/searchwidget.h index 319d9093d..4ecb46f4a 100644 --- a/src/gui/search/searchwidget.h +++ b/src/gui/search/searchwidget.h @@ -37,7 +37,7 @@ class QSignalMapper; class QTabWidget; class MainWindow; -class SearchTab; +class SearchJobWidget; namespace Ui { @@ -80,9 +80,9 @@ private: Ui::SearchWidget *m_ui; QSignalMapper *m_tabStatusChangedMapper; - QPointer m_currentSearchTab; // Selected tab - QPointer m_activeSearchTab; // Tab with running search - QList m_allTabs; // To store all tabs + QPointer m_currentSearchTab; // Selected tab + QPointer m_activeSearchTab; // Tab with running search + QList m_allTabs; // To store all tabs MainWindow *m_mainWindow; bool m_isNewQueryString; }; diff --git a/src/gui/shutdownconfirmdlg.cpp b/src/gui/shutdownconfirmdialog.cpp similarity index 84% rename from src/gui/shutdownconfirmdlg.cpp rename to src/gui/shutdownconfirmdialog.cpp index ac129b115..002ad691c 100644 --- a/src/gui/shutdownconfirmdlg.cpp +++ b/src/gui/shutdownconfirmdialog.cpp @@ -27,7 +27,7 @@ * exception statement from your version. */ -#include "shutdownconfirmdlg.h" +#include "shutdownconfirmdialog.h" #include #include @@ -36,12 +36,12 @@ #include "base/preferences.h" #include "base/utils/misc.h" -#include "ui_shutdownconfirmdlg.h" +#include "ui_shutdownconfirmdialog.h" #include "utils.h" -ShutdownConfirmDlg::ShutdownConfirmDlg(QWidget *parent, const ShutdownDialogAction &action) +ShutdownConfirmDialog::ShutdownConfirmDialog(QWidget *parent, const ShutdownDialogAction &action) : QDialog(parent) - , m_ui(new Ui::confirmShutdownDlg) + , m_ui(new Ui::ShutdownConfirmDialog) , m_timeout(15) , m_action(action) { @@ -66,29 +66,29 @@ ShutdownConfirmDlg::ShutdownConfirmDlg(QWidget *parent, const ShutdownDialogActi move(Utils::Misc::screenCenter(this)); m_timer.setInterval(1000); // 1sec - connect(&m_timer, &QTimer::timeout, this, &ShutdownConfirmDlg::updateSeconds); + connect(&m_timer, &QTimer::timeout, this, &ShutdownConfirmDialog::updateSeconds); Utils::Gui::resize(this); } -ShutdownConfirmDlg::~ShutdownConfirmDlg() +ShutdownConfirmDialog::~ShutdownConfirmDialog() { delete m_ui; } -void ShutdownConfirmDlg::showEvent(QShowEvent *event) +void ShutdownConfirmDialog::showEvent(QShowEvent *event) { QDialog::showEvent(event); m_timer.start(); } -bool ShutdownConfirmDlg::askForConfirmation(QWidget *parent, const ShutdownDialogAction &action) +bool ShutdownConfirmDialog::askForConfirmation(QWidget *parent, const ShutdownDialogAction &action) { - ShutdownConfirmDlg dlg(parent, action); + ShutdownConfirmDialog dlg(parent, action); return (dlg.exec() == QDialog::Accepted); } -void ShutdownConfirmDlg::updateSeconds() +void ShutdownConfirmDialog::updateSeconds() { --m_timeout; updateText(); @@ -98,13 +98,13 @@ void ShutdownConfirmDlg::updateSeconds() } } -void ShutdownConfirmDlg::accept() +void ShutdownConfirmDialog::accept() { Preferences::instance()->setDontConfirmAutoExit(m_ui->neverShowAgainCheckbox->isChecked()); QDialog::accept(); } -void ShutdownConfirmDlg::initText() +void ShutdownConfirmDialog::initText() { QPushButton *okButton = m_ui->buttonBox->button(QDialogButtonBox::Ok); @@ -135,7 +135,7 @@ void ShutdownConfirmDlg::initText() updateText(); } -void ShutdownConfirmDlg::updateText() +void ShutdownConfirmDialog::updateText() { QString t = tr("You can cancel the action within %1 seconds.").arg(QString::number(m_timeout)) + '\n'; m_ui->shutdownText->setText(m_msg + t); diff --git a/src/gui/shutdownconfirmdlg.h b/src/gui/shutdownconfirmdialog.h similarity index 85% rename from src/gui/shutdownconfirmdlg.h rename to src/gui/shutdownconfirmdialog.h index 9cce3fc14..dfa3c7ffc 100644 --- a/src/gui/shutdownconfirmdlg.h +++ b/src/gui/shutdownconfirmdialog.h @@ -26,8 +26,8 @@ * exception statement from your version. */ -#ifndef SHUTDOWNCONFIRMDLG_H -#define SHUTDOWNCONFIRMDLG_H +#ifndef SHUTDOWNCONFIRMDIALOG_H +#define SHUTDOWNCONFIRMDIALOG_H #include #include @@ -36,16 +36,16 @@ namespace Ui { - class confirmShutdownDlg; + class ShutdownConfirmDialog; } -class ShutdownConfirmDlg : public QDialog +class ShutdownConfirmDialog : public QDialog { Q_OBJECT public: - ShutdownConfirmDlg(QWidget *parent, const ShutdownDialogAction &action); - ~ShutdownConfirmDlg(); + ShutdownConfirmDialog(QWidget *parent, const ShutdownDialogAction &action); + ~ShutdownConfirmDialog(); static bool askForConfirmation(QWidget *parent, const ShutdownDialogAction &action); @@ -62,11 +62,11 @@ private: void updateText(); // Vars - Ui::confirmShutdownDlg *m_ui; + Ui::ShutdownConfirmDialog *m_ui; QTimer m_timer; int m_timeout; ShutdownDialogAction m_action; QString m_msg; }; -#endif // SHUTDOWNCONFIRM_H +#endif // SHUTDOWNCONFIRMDIALOG_H diff --git a/src/gui/shutdownconfirmdlg.ui b/src/gui/shutdownconfirmdialog.ui similarity index 94% rename from src/gui/shutdownconfirmdlg.ui rename to src/gui/shutdownconfirmdialog.ui index 5c46f40a4..4f79a3a10 100644 --- a/src/gui/shutdownconfirmdlg.ui +++ b/src/gui/shutdownconfirmdialog.ui @@ -1,7 +1,7 @@ - confirmShutdownDlg - + ShutdownConfirmDialog + 0 @@ -94,7 +94,7 @@ buttonBox accepted() - confirmShutdownDlg + ShutdownConfirmDialog accept() @@ -110,7 +110,7 @@ buttonBox rejected() - confirmShutdownDlg + ShutdownConfirmDialog reject() diff --git a/src/gui/speedlimitdlg.cpp b/src/gui/speedlimitdialog.cpp similarity index 97% rename from src/gui/speedlimitdlg.cpp rename to src/gui/speedlimitdialog.cpp index 02cc0ff7b..b33f11631 100644 --- a/src/gui/speedlimitdlg.cpp +++ b/src/gui/speedlimitdialog.cpp @@ -26,15 +26,15 @@ * exception statement from your version. */ -#include "speedlimitdlg.h" +#include "speedlimitdialog.h" #include "base/unicodestrings.h" -#include "ui_bandwidth_limit.h" +#include "ui_speedlimitdialog.h" #include "utils.h" SpeedLimitDialog::SpeedLimitDialog(QWidget *parent) : QDialog(parent) - , m_ui(new Ui::bandwidth_dlg()) + , m_ui(new Ui::SpeedLimitDialog()) { m_ui->setupUi(this); qDebug("Bandwidth allocation dialog creation"); diff --git a/src/gui/speedlimitdlg.h b/src/gui/speedlimitdialog.h similarity index 93% rename from src/gui/speedlimitdlg.h rename to src/gui/speedlimitdialog.h index 285285593..7fee9adbd 100644 --- a/src/gui/speedlimitdlg.h +++ b/src/gui/speedlimitdialog.h @@ -26,8 +26,8 @@ * exception statement from your version. */ -#ifndef BANDWIDTH_ALLOCATION_H -#define BANDWIDTH_ALLOCATION_H +#ifndef SPEEDLIMITDIALOG_H +#define SPEEDLIMITDIALOG_H #include #include @@ -37,7 +37,7 @@ namespace Ui { - class bandwidth_dlg; + class SpeedLimitDialog; } class SpeedLimitDialog : public QDialog @@ -57,7 +57,7 @@ protected slots: private: long getSpeedLimit() const; - Ui::bandwidth_dlg *m_ui; + Ui::SpeedLimitDialog *m_ui; }; -#endif // BANDWIDTH_ALLOCATION_H +#endif // SPEEDLIMITDIALOG_H diff --git a/src/gui/bandwidth_limit.ui b/src/gui/speedlimitdialog.ui similarity index 90% rename from src/gui/bandwidth_limit.ui rename to src/gui/speedlimitdialog.ui index b10bee62d..389aa554b 100644 --- a/src/gui/bandwidth_limit.ui +++ b/src/gui/speedlimitdialog.ui @@ -1,7 +1,7 @@ - bandwidth_dlg - + SpeedLimitDialog + 0 @@ -46,7 +46,7 @@ buttonBox rejected() - bandwidth_dlg + SpeedLimitDialog reject() @@ -62,7 +62,7 @@ buttonBox accepted() - bandwidth_dlg + SpeedLimitDialog accept() diff --git a/src/gui/statusbar.cpp b/src/gui/statusbar.cpp index 15fffd8a0..93a8d71de 100644 --- a/src/gui/statusbar.cpp +++ b/src/gui/statusbar.cpp @@ -40,7 +40,7 @@ #include "base/bittorrent/sessionstatus.h" #include "base/utils/misc.h" #include "guiiconprovider.h" -#include "speedlimitdlg.h" +#include "speedlimitdialog.h" #include "utils.h" StatusBar::StatusBar(QWidget *parent) diff --git a/src/gui/torrentcreatordlg.cpp b/src/gui/torrentcreatordialog.cpp similarity index 86% rename from src/gui/torrentcreatordlg.cpp rename to src/gui/torrentcreatordialog.cpp index fa1e8b2e2..00f59c783 100644 --- a/src/gui/torrentcreatordlg.cpp +++ b/src/gui/torrentcreatordialog.cpp @@ -27,7 +27,7 @@ * exception statement from your version. */ -#include "torrentcreatordlg.h" +#include "torrentcreatordialog.h" #include #include @@ -41,14 +41,14 @@ #include "base/bittorrent/torrentinfo.h" #include "base/global.h" #include "base/utils/fs.h" -#include "ui_torrentcreatordlg.h" +#include "ui_torrentcreatordialog.h" #include "utils.h" #define SETTINGS_KEY(name) "TorrentCreator/" name -TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent, const QString &defaultPath) +TorrentCreatorDialog::TorrentCreatorDialog(QWidget *parent, const QString &defaultPath) : QDialog(parent) - , m_ui(new Ui::TorrentCreatorDlg) + , m_ui(new Ui::TorrentCreatorDialog) , m_creatorThread(new BitTorrent::TorrentCreatorThread(this)) , m_storeDialogSize(SETTINGS_KEY("Dimension")) , m_storePieceSize(SETTINGS_KEY("PieceSize")) @@ -69,14 +69,14 @@ TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent, const QString &defaultPath m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Create Torrent")); - connect(m_ui->addFileButton, &QPushButton::clicked, this, &TorrentCreatorDlg::onAddFileButtonClicked); - connect(m_ui->addFolderButton, &QPushButton::clicked, this, &TorrentCreatorDlg::onAddFolderButtonClicked); - connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &TorrentCreatorDlg::onCreateButtonClicked); - connect(m_ui->buttonCalcTotalPieces, &QPushButton::clicked, this, &TorrentCreatorDlg::updatePiecesCount); + connect(m_ui->addFileButton, &QPushButton::clicked, this, &TorrentCreatorDialog::onAddFileButtonClicked); + connect(m_ui->addFolderButton, &QPushButton::clicked, this, &TorrentCreatorDialog::onAddFolderButtonClicked); + connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &TorrentCreatorDialog::onCreateButtonClicked); + connect(m_ui->buttonCalcTotalPieces, &QPushButton::clicked, this, &TorrentCreatorDialog::updatePiecesCount); - connect(m_creatorThread, &BitTorrent::TorrentCreatorThread::creationSuccess, this, &TorrentCreatorDlg::handleCreationSuccess); - connect(m_creatorThread, &BitTorrent::TorrentCreatorThread::creationFailure, this, &TorrentCreatorDlg::handleCreationFailure); - connect(m_creatorThread, &BitTorrent::TorrentCreatorThread::updateProgress, this, &TorrentCreatorDlg::updateProgressBar); + connect(m_creatorThread, &BitTorrent::TorrentCreatorThread::creationSuccess, this, &TorrentCreatorDialog::handleCreationSuccess); + connect(m_creatorThread, &BitTorrent::TorrentCreatorThread::creationFailure, this, &TorrentCreatorDialog::handleCreationFailure); + connect(m_creatorThread, &BitTorrent::TorrentCreatorThread::updateProgress, this, &TorrentCreatorDialog::updateProgressBar); loadSettings(); updateInputPath(defaultPath); @@ -84,41 +84,41 @@ TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent, const QString &defaultPath show(); } -TorrentCreatorDlg::~TorrentCreatorDlg() +TorrentCreatorDialog::~TorrentCreatorDialog() { saveSettings(); delete m_ui; } -void TorrentCreatorDlg::updateInputPath(const QString &path) +void TorrentCreatorDialog::updateInputPath(const QString &path) { if (path.isEmpty()) return; m_ui->textInputPath->setText(Utils::Fs::toNativePath(path)); updateProgressBar(0); } -void TorrentCreatorDlg::onAddFolderButtonClicked() +void TorrentCreatorDialog::onAddFolderButtonClicked() { QString oldPath = m_ui->textInputPath->text(); QString path = QFileDialog::getExistingDirectory(this, tr("Select folder"), oldPath); updateInputPath(path); } -void TorrentCreatorDlg::onAddFileButtonClicked() +void TorrentCreatorDialog::onAddFileButtonClicked() { QString oldPath = m_ui->textInputPath->text(); QString path = QFileDialog::getOpenFileName(this, tr("Select file"), oldPath); updateInputPath(path); } -int TorrentCreatorDlg::getPieceSize() const +int TorrentCreatorDialog::getPieceSize() const { const int pieceSizes[] = {0, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768}; // base unit in KiB return pieceSizes[m_ui->comboPieceSize->currentIndex()] * 1024; } -void TorrentCreatorDlg::dropEvent(QDropEvent *event) +void TorrentCreatorDialog::dropEvent(QDropEvent *event) { event->acceptProposedAction(); @@ -131,14 +131,14 @@ void TorrentCreatorDlg::dropEvent(QDropEvent *event) } } -void TorrentCreatorDlg::dragEnterEvent(QDragEnterEvent *event) +void TorrentCreatorDialog::dragEnterEvent(QDragEnterEvent *event) { if (event->mimeData()->hasFormat("text/plain") || event->mimeData()->hasFormat("text/uri-list")) event->acceptProposedAction(); } // Main function that create a .torrent file -void TorrentCreatorDlg::onCreateButtonClicked() +void TorrentCreatorDialog::onCreateButtonClicked() { QString input = Utils::Fs::fromNativePath(m_ui->textInputPath->text()).trimmed(); @@ -175,7 +175,7 @@ void TorrentCreatorDlg::onCreateButtonClicked() , input, destination, comment, source, trackers, urlSeeds }); } -void TorrentCreatorDlg::handleCreationFailure(const QString &msg) +void TorrentCreatorDialog::handleCreationFailure(const QString &msg) { // Remove busy cursor setCursor(QCursor(Qt::ArrowCursor)); @@ -183,7 +183,7 @@ void TorrentCreatorDlg::handleCreationFailure(const QString &msg) setInteractionEnabled(true); } -void TorrentCreatorDlg::handleCreationSuccess(const QString &path, const QString &branchPath) +void TorrentCreatorDialog::handleCreationSuccess(const QString &path, const QString &branchPath) { // Remove busy cursor setCursor(QCursor(Qt::ArrowCursor)); @@ -207,12 +207,12 @@ void TorrentCreatorDlg::handleCreationSuccess(const QString &path, const QString setInteractionEnabled(true); } -void TorrentCreatorDlg::updateProgressBar(int progress) +void TorrentCreatorDialog::updateProgressBar(int progress) { m_ui->progressBar->setValue(progress); } -void TorrentCreatorDlg::updatePiecesCount() +void TorrentCreatorDialog::updatePiecesCount() { const QString path = m_ui->textInputPath->text().trimmed(); const bool isAlignmentOptimized = m_ui->checkOptimizeAlignment->isChecked(); @@ -221,7 +221,7 @@ void TorrentCreatorDlg::updatePiecesCount() m_ui->labelTotalPieces->setText(QString::number(count)); } -void TorrentCreatorDlg::setInteractionEnabled(bool enabled) +void TorrentCreatorDialog::setInteractionEnabled(bool enabled) { m_ui->textInputPath->setEnabled(enabled); m_ui->addFileButton->setEnabled(enabled); @@ -236,7 +236,7 @@ void TorrentCreatorDlg::setInteractionEnabled(bool enabled) m_ui->checkIgnoreShareLimits->setEnabled(enabled && m_ui->checkStartSeeding->isChecked()); } -void TorrentCreatorDlg::saveSettings() +void TorrentCreatorDialog::saveSettings() { m_storeLastAddPath = m_ui->textInputPath->text().trimmed(); @@ -254,7 +254,7 @@ void TorrentCreatorDlg::saveSettings() m_storeDialogSize = size(); } -void TorrentCreatorDlg::loadSettings() +void TorrentCreatorDialog::loadSettings() { m_ui->textInputPath->setText(m_storeLastAddPath); diff --git a/src/gui/torrentcreatordlg.h b/src/gui/torrentcreatordialog.h similarity index 89% rename from src/gui/torrentcreatordlg.h rename to src/gui/torrentcreatordialog.h index a9f678d97..62a340f35 100644 --- a/src/gui/torrentcreatordlg.h +++ b/src/gui/torrentcreatordialog.h @@ -27,8 +27,8 @@ * exception statement from your version. */ -#ifndef TORRENTCREATORDLG_H -#define TORRENTCREATORDLG_H +#ifndef TORRENTCREATORDIALOG_H +#define TORRENTCREATORDIALOG_H #include @@ -36,7 +36,7 @@ namespace Ui { - class TorrentCreatorDlg; + class TorrentCreatorDialog; } namespace BitTorrent @@ -44,13 +44,13 @@ namespace BitTorrent class TorrentCreatorThread; } -class TorrentCreatorDlg : public QDialog +class TorrentCreatorDialog : public QDialog { Q_OBJECT public: - TorrentCreatorDlg(QWidget *parent = nullptr, const QString &defaultPath = QString()); - ~TorrentCreatorDlg(); + TorrentCreatorDialog(QWidget *parent = nullptr, const QString &defaultPath = QString()); + ~TorrentCreatorDialog(); void updateInputPath(const QString &path); private slots: @@ -71,7 +71,7 @@ private: int getPieceSize() const; void setInteractionEnabled(bool enabled); - Ui::TorrentCreatorDlg *m_ui; + Ui::TorrentCreatorDialog *m_ui; BitTorrent::TorrentCreatorThread *m_creatorThread; // settings @@ -89,4 +89,4 @@ private: CachedSettingValue m_storeSource; }; -#endif // TORRENTCREATORDLG_H +#endif // TORRENTCREATORDIALOG_H diff --git a/src/gui/torrentcreatordlg.ui b/src/gui/torrentcreatordialog.ui similarity index 98% rename from src/gui/torrentcreatordlg.ui rename to src/gui/torrentcreatordialog.ui index b4238661d..02e416945 100644 --- a/src/gui/torrentcreatordlg.ui +++ b/src/gui/torrentcreatordialog.ui @@ -1,7 +1,7 @@ - TorrentCreatorDlg - + TorrentCreatorDialog + 0 @@ -365,7 +365,7 @@ buttonBox rejected() - TorrentCreatorDlg + TorrentCreatorDialog reject() diff --git a/src/gui/trackerlogin.cpp b/src/gui/trackerlogindialog.cpp similarity index 81% rename from src/gui/trackerlogin.cpp rename to src/gui/trackerlogindialog.cpp index e5973c8c7..5ea3f38b8 100644 --- a/src/gui/trackerlogin.cpp +++ b/src/gui/trackerlogindialog.cpp @@ -26,7 +26,7 @@ * exception statement from your version. */ -#include "trackerlogin.h" +#include "trackerlogindialog.h" #include @@ -35,7 +35,7 @@ #include "base/bittorrent/torrenthandle.h" #include "utils.h" -trackerLogin::trackerLogin(QWidget *parent, BitTorrent::TorrentHandle *const torrent) +TrackerLoginDialog::TrackerLoginDialog(QWidget *parent, BitTorrent::TorrentHandle *const torrent) : QDialog(parent) , m_torrent(torrent) { @@ -48,9 +48,9 @@ trackerLogin::trackerLogin(QWidget *parent, BitTorrent::TorrentHandle *const tor tracker_url->setText(torrent->currentTracker()); - connect(buttonBox, &QDialogButtonBox::accepted, this, &trackerLogin::loginButtonClicked); - connect(buttonBox, &QDialogButtonBox::rejected, this, &trackerLogin::cancelButtonClicked); - connect(linePasswd, &QLineEdit::returnPressed, this, &trackerLogin::loginButtonClicked); + connect(buttonBox, &QDialogButtonBox::accepted, this, &TrackerLoginDialog::loginButtonClicked); + connect(buttonBox, &QDialogButtonBox::rejected, this, &TrackerLoginDialog::cancelButtonClicked); + connect(linePasswd, &QLineEdit::returnPressed, this, &TrackerLoginDialog::loginButtonClicked); connect(this, SIGNAL(trackerLoginCancelled(QPair)), // TODO: use Qt5 connect syntax parent, SLOT(addUnauthenticatedTracker(QPair))); @@ -58,9 +58,9 @@ trackerLogin::trackerLogin(QWidget *parent, BitTorrent::TorrentHandle *const tor show(); } -trackerLogin::~trackerLogin() {} +TrackerLoginDialog::~TrackerLoginDialog() {} -void trackerLogin::loginButtonClicked() +void TrackerLoginDialog::loginButtonClicked() { // login #if LIBTORRENT_VERSION_NUM < 10100 @@ -69,7 +69,7 @@ void trackerLogin::loginButtonClicked() accept(); } -void trackerLogin::cancelButtonClicked() +void TrackerLoginDialog::cancelButtonClicked() { // Emit a signal to GUI to stop asking for authentication emit trackerLoginCancelled(qMakePair(m_torrent, m_torrent->currentTracker())); diff --git a/src/gui/trackerlogin.h b/src/gui/trackerlogindialog.h similarity index 85% rename from src/gui/trackerlogin.h rename to src/gui/trackerlogindialog.h index b4cedc58a..43189976a 100644 --- a/src/gui/trackerlogin.h +++ b/src/gui/trackerlogindialog.h @@ -26,27 +26,28 @@ * exception statement from your version. */ -#ifndef TRACKERLOGIN_H -#define TRACKERLOGIN_H +#ifndef TRACKERLOGINDIALOG_H +#define TRACKERLOGINDIALOG_H #include -#include "ui_login.h" +#include "ui_trackerlogindialog.h" namespace BitTorrent { class TorrentHandle; } -class trackerLogin : public QDialog, private Ui::authentication{ +class TrackerLoginDialog : public QDialog, private Ui::TrackerLoginDialog +{ Q_OBJECT private: BitTorrent::TorrentHandle *const m_torrent; public: - trackerLogin(QWidget *parent, BitTorrent::TorrentHandle *const torrent); - ~trackerLogin(); + TrackerLoginDialog(QWidget *parent, BitTorrent::TorrentHandle *const torrent); + ~TrackerLoginDialog(); signals: void trackerLoginCancelled(QPair tracker); @@ -56,4 +57,4 @@ class trackerLogin : public QDialog, private Ui::authentication{ void cancelButtonClicked(); }; -#endif // TRACKERLOGIN_H +#endif // TRACKERLOGINDIALOG_H diff --git a/src/gui/login.ui b/src/gui/trackerlogindialog.ui similarity index 97% rename from src/gui/login.ui rename to src/gui/trackerlogindialog.ui index a4c8c2c0e..ce16e9c6b 100644 --- a/src/gui/login.ui +++ b/src/gui/trackerlogindialog.ui @@ -1,7 +1,7 @@ - authentication - + TrackerLoginDialog + 0 diff --git a/src/gui/transferlistdelegate.cpp b/src/gui/transferlistdelegate.cpp index e21bf181b..584ead328 100644 --- a/src/gui/transferlistdelegate.cpp +++ b/src/gui/transferlistdelegate.cpp @@ -44,7 +44,7 @@ #include "base/unicodestrings.h" #include "base/utils/misc.h" #include "base/utils/string.h" -#include "torrentmodel.h" +#include "transferlistmodel.h" TransferListDelegate::TransferListDelegate(QObject *parent) : QItemDelegate(parent) @@ -56,7 +56,7 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & painter->save(); bool isHideState = true; if (Preferences::instance()->getHideZeroComboValues() == 1) { // paused torrents only - QModelIndex stateIndex = index.sibling(index.row(), TorrentModel::TR_STATUS); + QModelIndex stateIndex = index.sibling(index.row(), TransferListModel::TR_STATUS); if (stateIndex.data().value() != BitTorrent::TorrentState::PausedDownloading) isHideState = false; } @@ -65,14 +65,14 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & QStyleOptionViewItem opt = QItemDelegate::setOptions(index, option); QItemDelegate::drawBackground(painter, opt, index); switch (index.column()) { - case TorrentModel::TR_AMOUNT_DOWNLOADED: - case TorrentModel::TR_AMOUNT_UPLOADED: - case TorrentModel::TR_AMOUNT_DOWNLOADED_SESSION: - case TorrentModel::TR_AMOUNT_UPLOADED_SESSION: - case TorrentModel::TR_AMOUNT_LEFT: - case TorrentModel::TR_COMPLETED: - case TorrentModel::TR_SIZE: - case TorrentModel::TR_TOTAL_SIZE: { + case TransferListModel::TR_AMOUNT_DOWNLOADED: + case TransferListModel::TR_AMOUNT_UPLOADED: + case TransferListModel::TR_AMOUNT_DOWNLOADED_SESSION: + case TransferListModel::TR_AMOUNT_UPLOADED_SESSION: + case TransferListModel::TR_AMOUNT_LEFT: + case TransferListModel::TR_COMPLETED: + case TransferListModel::TR_SIZE: + case TransferListModel::TR_TOTAL_SIZE: { qlonglong size = index.data().toLongLong(); if (hideValues && !size) break; @@ -80,13 +80,13 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & QItemDelegate::drawDisplay(painter, opt, option.rect, Utils::Misc::friendlyUnit(size)); } break; - case TorrentModel::TR_ETA: { + case TransferListModel::TR_ETA: { opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter; QItemDelegate::drawDisplay(painter, opt, option.rect, Utils::Misc::userFriendlyDuration(index.data().toLongLong())); break; } - case TorrentModel::TR_SEEDS: - case TorrentModel::TR_PEERS: { + case TransferListModel::TR_SEEDS: + case TransferListModel::TR_PEERS: { qlonglong value = index.data().toLongLong(); qlonglong total = index.data(Qt::UserRole).toLongLong(); if (hideValues && (!value && !total)) @@ -96,14 +96,14 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & QItemDelegate::drawDisplay(painter, opt, opt.rect, display); } break; - case TorrentModel::TR_STATUS: { + case TransferListModel::TR_STATUS: { const auto state = index.data().value(); QString display = getStatusString(state); QItemDelegate::drawDisplay(painter, opt, opt.rect, display); } break; - case TorrentModel::TR_UPSPEED: - case TorrentModel::TR_DLSPEED: { + case TransferListModel::TR_UPSPEED: + case TransferListModel::TR_DLSPEED: { const qulonglong speed = index.data().toULongLong(); if (hideValues && !speed) break; @@ -111,8 +111,8 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & QItemDelegate::drawDisplay(painter, opt, opt.rect, Utils::Misc::friendlyUnit(speed, true)); } break; - case TorrentModel::TR_UPLIMIT: - case TorrentModel::TR_DLLIMIT: { + case TransferListModel::TR_UPLIMIT: + case TransferListModel::TR_DLLIMIT: { const qlonglong limit = index.data().toLongLong(); if (hideValues && !limit) break; @@ -120,7 +120,7 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & QItemDelegate::drawDisplay(painter, opt, opt.rect, limit > 0 ? Utils::Misc::friendlyUnit(limit, true) : QString::fromUtf8(C_INFINITY)); } break; - case TorrentModel::TR_TIME_ELAPSED: { + case TransferListModel::TR_TIME_ELAPSED: { const int elapsedTime = index.data().toInt(); const int seedingTime = index.data(Qt::UserRole).toInt(); const QString txt = (seedingTime > 0) @@ -131,12 +131,12 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & QItemDelegate::drawDisplay(painter, opt, opt.rect, txt); } break; - case TorrentModel::TR_ADD_DATE: - case TorrentModel::TR_SEED_DATE: + case TransferListModel::TR_ADD_DATE: + case TransferListModel::TR_SEED_DATE: QItemDelegate::drawDisplay(painter, opt, opt.rect, index.data().toDateTime().toLocalTime().toString(Qt::DefaultLocaleShortDate)); break; - case TorrentModel::TR_RATIO_LIMIT: - case TorrentModel::TR_RATIO: { + case TransferListModel::TR_RATIO_LIMIT: + case TransferListModel::TR_RATIO: { const qreal ratio = index.data().toDouble(); if (hideValues && (ratio <= 0)) break; @@ -145,7 +145,7 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & QItemDelegate::drawDisplay(painter, opt, opt.rect, str); } break; - case TorrentModel::TR_PRIORITY: { + case TransferListModel::TR_PRIORITY: { const int priority = index.data().toInt(); opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter; if (priority > 0) { @@ -156,7 +156,7 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & } } break; - case TorrentModel::TR_PROGRESS: { + case TransferListModel::TR_PROGRESS: { QStyleOptionProgressBar newopt; qreal progress = index.data().toDouble() * 100.; newopt.rect = opt.rect; @@ -175,7 +175,7 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & #endif } break; - case TorrentModel::TR_LAST_ACTIVITY: { + case TransferListModel::TR_LAST_ACTIVITY: { qlonglong elapsed = index.data().toLongLong(); if (hideValues && ((elapsed < 0) || (elapsed >= MAX_ETA))) break; @@ -213,7 +213,7 @@ QSize TransferListDelegate::sizeHint(const QStyleOptionViewItem &option, const Q static int nameColHeight = -1; if (nameColHeight == -1) { - QModelIndex nameColumn = index.sibling(index.row(), TorrentModel::TR_NAME); + QModelIndex nameColumn = index.sibling(index.row(), TransferListModel::TR_NAME); nameColHeight = QItemDelegate::sizeHint(option, nameColumn).height(); } diff --git a/src/gui/transferlistfilterswidget.cpp b/src/gui/transferlistfilterswidget.cpp index bbe91aabc..c8c71983f 100644 --- a/src/gui/transferlistfilterswidget.cpp +++ b/src/gui/transferlistfilterswidget.cpp @@ -52,8 +52,8 @@ #include "categoryfilterwidget.h" #include "guiiconprovider.h" #include "tagfilterwidget.h" -#include "torrentmodel.h" #include "transferlistdelegate.h" +#include "transferlistmodel.h" #include "transferlistwidget.h" #include "utils.h" @@ -71,7 +71,7 @@ namespace const QLatin1String GOOGLE_FAVICON_URL("https://www.google.com/s2/favicons?domain="); } -FiltersBase::FiltersBase(QWidget *parent, TransferListWidget *transferList) +BaseFilterWidget::BaseFilterWidget(QWidget *parent, TransferListWidget *transferList) : QListWidget(parent) , transferList(transferList) { @@ -89,16 +89,16 @@ FiltersBase::FiltersBase(QWidget *parent, TransferListWidget *transferList) #endif setContextMenuPolicy(Qt::CustomContextMenu); - connect(this, &FiltersBase::customContextMenuRequested, this, &FiltersBase::showMenu); - connect(this, &FiltersBase::currentRowChanged, this, &FiltersBase::applyFilter); + connect(this, &BaseFilterWidget::customContextMenuRequested, this, &BaseFilterWidget::showMenu); + connect(this, &BaseFilterWidget::currentRowChanged, this, &BaseFilterWidget::applyFilter); connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentAdded - , this, &FiltersBase::handleNewTorrent); + , this, &BaseFilterWidget::handleNewTorrent); connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentAboutToBeRemoved - , this, &FiltersBase::torrentAboutToBeDeleted); + , this, &BaseFilterWidget::torrentAboutToBeDeleted); } -QSize FiltersBase::sizeHint() const +QSize BaseFilterWidget::sizeHint() const { return { // Width should be exactly the width of the content @@ -108,14 +108,14 @@ QSize FiltersBase::sizeHint() const }; } -QSize FiltersBase::minimumSizeHint() const +QSize BaseFilterWidget::minimumSizeHint() const { QSize size = sizeHint(); size.setWidth(6); return size; } -void FiltersBase::toggleFilter(bool checked) +void BaseFilterWidget::toggleFilter(bool checked) { setVisible(checked); if (checked) @@ -124,11 +124,11 @@ void FiltersBase::toggleFilter(bool checked) applyFilter(0); } -StatusFiltersWidget::StatusFiltersWidget(QWidget *parent, TransferListWidget *transferList) - : FiltersBase(parent, transferList) +StatusFilterWidget::StatusFilterWidget(QWidget *parent, TransferListWidget *transferList) + : BaseFilterWidget(parent, transferList) { connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentsUpdated - , this, &StatusFiltersWidget::updateTorrentNumbers); + , this, &StatusFilterWidget::updateTorrentNumbers); // Add status filters QListWidgetItem *all = new QListWidgetItem(this); @@ -164,12 +164,12 @@ StatusFiltersWidget::StatusFiltersWidget(QWidget *parent, TransferListWidget *tr toggleFilter(pref->getStatusFilterState()); } -StatusFiltersWidget::~StatusFiltersWidget() +StatusFilterWidget::~StatusFilterWidget() { Preferences::instance()->setTransSelFilter(currentRow()); } -void StatusFiltersWidget::updateTorrentNumbers() +void StatusFilterWidget::updateTorrentNumbers() { auto report = BitTorrent::Session::instance()->torrentStatusReport(); @@ -184,19 +184,19 @@ void StatusFiltersWidget::updateTorrentNumbers() item(TorrentFilter::Errored)->setData(Qt::DisplayRole, QVariant(tr("Errored (%1)").arg(report.nbErrored))); } -void StatusFiltersWidget::showMenu(QPoint) {} +void StatusFilterWidget::showMenu(QPoint) {} -void StatusFiltersWidget::applyFilter(int row) +void StatusFilterWidget::applyFilter(int row) { transferList->applyStatusFilter(row); } -void StatusFiltersWidget::handleNewTorrent(BitTorrent::TorrentHandle *const) {} +void StatusFilterWidget::handleNewTorrent(BitTorrent::TorrentHandle *const) {} -void StatusFiltersWidget::torrentAboutToBeDeleted(BitTorrent::TorrentHandle *const) {} +void StatusFilterWidget::torrentAboutToBeDeleted(BitTorrent::TorrentHandle *const) {} TrackerFiltersList::TrackerFiltersList(QWidget *parent, TransferListWidget *transferList) - : FiltersBase(parent, transferList) + : BaseFilterWidget(parent, transferList) , m_totalTorrents(0) , m_downloadTrackerFavicon(true) { @@ -590,7 +590,7 @@ TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferLi statusLabel->setFont(font); frameLayout->addWidget(statusLabel); - StatusFiltersWidget *statusFilters = new StatusFiltersWidget(this, transferList); + StatusFilterWidget *statusFilters = new StatusFilterWidget(this, transferList); frameLayout->addWidget(statusFilters); QCheckBox *categoryLabel = new QCheckBox(tr("Categories"), this); @@ -638,7 +638,7 @@ TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferLi m_trackerFilters = new TrackerFiltersList(this, transferList); frameLayout->addWidget(m_trackerFilters); - connect(statusLabel, &QCheckBox::toggled, statusFilters, &StatusFiltersWidget::toggleFilter); + connect(statusLabel, &QCheckBox::toggled, statusFilters, &StatusFilterWidget::toggleFilter); connect(statusLabel, &QCheckBox::toggled, pref, &Preferences::setStatusFilterState); connect(trackerLabel, &QCheckBox::toggled, m_trackerFilters, &TrackerFiltersList::toggleFilter); connect(trackerLabel, &QCheckBox::toggled, pref, &Preferences::setTrackerFilterState); diff --git a/src/gui/transferlistfilterswidget.h b/src/gui/transferlistfilterswidget.h index 7b761bfb4..3cd7a69da 100644 --- a/src/gui/transferlistfilterswidget.h +++ b/src/gui/transferlistfilterswidget.h @@ -42,12 +42,12 @@ namespace BitTorrent class TrackerEntry; } -class FiltersBase : public QListWidget +class BaseFilterWidget : public QListWidget { Q_OBJECT public: - FiltersBase(QWidget *parent, TransferListWidget *transferList); + BaseFilterWidget(QWidget *parent, TransferListWidget *transferList); QSize sizeHint() const override; QSize minimumSizeHint() const override; @@ -65,13 +65,13 @@ private slots: virtual void torrentAboutToBeDeleted(BitTorrent::TorrentHandle *const) = 0; }; -class StatusFiltersWidget : public FiltersBase +class StatusFilterWidget : public BaseFilterWidget { Q_OBJECT public: - StatusFiltersWidget(QWidget *parent, TransferListWidget *transferList); - ~StatusFiltersWidget(); + StatusFilterWidget(QWidget *parent, TransferListWidget *transferList); + ~StatusFilterWidget(); private slots: void updateTorrentNumbers(); @@ -85,7 +85,7 @@ private: void torrentAboutToBeDeleted(BitTorrent::TorrentHandle *const) override; }; -class TrackerFiltersList : public FiltersBase +class TrackerFiltersList : public BaseFilterWidget { Q_OBJECT diff --git a/src/gui/torrentmodel.cpp b/src/gui/transferlistmodel.cpp similarity index 92% rename from src/gui/torrentmodel.cpp rename to src/gui/transferlistmodel.cpp index 4450183d2..f6b81a90e 100644 --- a/src/gui/torrentmodel.cpp +++ b/src/gui/transferlistmodel.cpp @@ -27,7 +27,7 @@ * exception statement from your version. */ -#include "torrentmodel.h" +#include "transferlistmodel.h" #include #include @@ -54,9 +54,9 @@ static QIcon getErrorIcon(); static bool isDarkTheme(); -// TorrentModel +// TransferListModel -TorrentModel::TorrentModel(QObject *parent) +TransferListModel::TransferListModel(QObject *parent) : QAbstractListModel(parent) { // Load the torrents @@ -65,30 +65,30 @@ TorrentModel::TorrentModel(QObject *parent) addTorrent(torrent); // Listen for torrent changes - connect(Session::instance(), &Session::torrentAdded, this, &TorrentModel::addTorrent); - connect(Session::instance(), &Session::torrentAboutToBeRemoved, this, &TorrentModel::handleTorrentAboutToBeRemoved); - connect(Session::instance(), &Session::torrentsUpdated, this, &TorrentModel::handleTorrentsUpdated); - - connect(Session::instance(), &Session::torrentFinished, this, &TorrentModel::handleTorrentStatusUpdated); - connect(Session::instance(), &Session::torrentMetadataLoaded, this, &TorrentModel::handleTorrentStatusUpdated); - connect(Session::instance(), &Session::torrentResumed, this, &TorrentModel::handleTorrentStatusUpdated); - connect(Session::instance(), &Session::torrentPaused, this, &TorrentModel::handleTorrentStatusUpdated); - connect(Session::instance(), &Session::torrentFinishedChecking, this, &TorrentModel::handleTorrentStatusUpdated); + connect(Session::instance(), &Session::torrentAdded, this, &TransferListModel::addTorrent); + connect(Session::instance(), &Session::torrentAboutToBeRemoved, this, &TransferListModel::handleTorrentAboutToBeRemoved); + connect(Session::instance(), &Session::torrentsUpdated, this, &TransferListModel::handleTorrentsUpdated); + + connect(Session::instance(), &Session::torrentFinished, this, &TransferListModel::handleTorrentStatusUpdated); + connect(Session::instance(), &Session::torrentMetadataLoaded, this, &TransferListModel::handleTorrentStatusUpdated); + connect(Session::instance(), &Session::torrentResumed, this, &TransferListModel::handleTorrentStatusUpdated); + connect(Session::instance(), &Session::torrentPaused, this, &TransferListModel::handleTorrentStatusUpdated); + connect(Session::instance(), &Session::torrentFinishedChecking, this, &TransferListModel::handleTorrentStatusUpdated); } -int TorrentModel::rowCount(const QModelIndex &index) const +int TransferListModel::rowCount(const QModelIndex &index) const { Q_UNUSED(index); return m_torrents.size(); } -int TorrentModel::columnCount(const QModelIndex &parent) const +int TransferListModel::columnCount(const QModelIndex &parent) const { Q_UNUSED(parent); return NB_COLUMNS; } -QVariant TorrentModel::headerData(int section, Qt::Orientation orientation, int role) const +QVariant TransferListModel::headerData(int section, Qt::Orientation orientation, int role) const { if (orientation == Qt::Horizontal) { if (role == Qt::DisplayRole) { @@ -158,7 +158,7 @@ QVariant TorrentModel::headerData(int section, Qt::Orientation orientation, int return QVariant(); } -QVariant TorrentModel::data(const QModelIndex &index, int role) const +QVariant TransferListModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) return QVariant(); @@ -247,7 +247,7 @@ QVariant TorrentModel::data(const QModelIndex &index, int role) const return QVariant(); } -bool TorrentModel::setData(const QModelIndex &index, const QVariant &value, int role) +bool TransferListModel::setData(const QModelIndex &index, const QVariant &value, int role) { qDebug() << Q_FUNC_INFO << value; if (!index.isValid() || (role != Qt::DisplayRole)) return false; @@ -271,7 +271,7 @@ bool TorrentModel::setData(const QModelIndex &index, const QVariant &value, int return true; } -void TorrentModel::addTorrent(BitTorrent::TorrentHandle *const torrent) +void TransferListModel::addTorrent(BitTorrent::TorrentHandle *const torrent) { if (m_torrents.indexOf(torrent) == -1) { const int row = m_torrents.size(); @@ -281,7 +281,7 @@ void TorrentModel::addTorrent(BitTorrent::TorrentHandle *const torrent) } } -Qt::ItemFlags TorrentModel::flags(const QModelIndex &index) const +Qt::ItemFlags TransferListModel::flags(const QModelIndex &index) const { if (!index.isValid()) return 0; @@ -289,14 +289,14 @@ Qt::ItemFlags TorrentModel::flags(const QModelIndex &index) const return QAbstractListModel::flags(index) | Qt::ItemIsEditable; } -BitTorrent::TorrentHandle *TorrentModel::torrentHandle(const QModelIndex &index) const +BitTorrent::TorrentHandle *TransferListModel::torrentHandle(const QModelIndex &index) const { if (!index.isValid()) return 0; return m_torrents.value(index.row()); } -void TorrentModel::handleTorrentAboutToBeRemoved(BitTorrent::TorrentHandle *const torrent) +void TransferListModel::handleTorrentAboutToBeRemoved(BitTorrent::TorrentHandle *const torrent) { const int row = m_torrents.indexOf(torrent); if (row >= 0) { @@ -306,14 +306,14 @@ void TorrentModel::handleTorrentAboutToBeRemoved(BitTorrent::TorrentHandle *cons } } -void TorrentModel::handleTorrentStatusUpdated(BitTorrent::TorrentHandle *const torrent) +void TransferListModel::handleTorrentStatusUpdated(BitTorrent::TorrentHandle *const torrent) { const int row = m_torrents.indexOf(torrent); if (row >= 0) emit dataChanged(index(row, 0), index(row, columnCount() - 1)); } -void TorrentModel::handleTorrentsUpdated() +void TransferListModel::handleTorrentsUpdated() { emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1)); } diff --git a/src/gui/torrentmodel.h b/src/gui/transferlistmodel.h similarity index 93% rename from src/gui/torrentmodel.h rename to src/gui/transferlistmodel.h index 2e8da998f..3766a6797 100644 --- a/src/gui/torrentmodel.h +++ b/src/gui/transferlistmodel.h @@ -27,8 +27,8 @@ * exception statement from your version. */ -#ifndef TORRENTMODEL_H -#define TORRENTMODEL_H +#ifndef TRANSFERLISTMODEL_H +#define TRANSFERLISTMODEL_H #include #include @@ -39,10 +39,10 @@ namespace BitTorrent class TorrentHandle; } -class TorrentModel : public QAbstractListModel +class TransferListModel : public QAbstractListModel { Q_OBJECT - Q_DISABLE_COPY(TorrentModel) + Q_DISABLE_COPY(TransferListModel) public: enum Column @@ -81,7 +81,7 @@ public: NB_COLUMNS }; - explicit TorrentModel(QObject *parent = nullptr); + explicit TransferListModel(QObject *parent = nullptr); int rowCount(const QModelIndex& index = QModelIndex()) const override; int columnCount(const QModelIndex &parent=QModelIndex()) const override; @@ -102,4 +102,4 @@ private: QList m_torrents; }; -#endif // TORRENTMODEL_H +#endif // TRANSFERLISTMODEL_H diff --git a/src/gui/transferlistsortmodel.cpp b/src/gui/transferlistsortmodel.cpp index 7eb5cf21a..69ecb3eaa 100644 --- a/src/gui/transferlistsortmodel.cpp +++ b/src/gui/transferlistsortmodel.cpp @@ -33,7 +33,7 @@ #include "base/bittorrent/torrenthandle.h" #include "base/types.h" #include "base/utils/string.h" -#include "torrentmodel.h" +#include "transferlistmodel.h" TransferListSortModel::TransferListSortModel(QObject *parent) @@ -86,9 +86,9 @@ void TransferListSortModel::disableTrackerFilter() bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex &right) const { switch (sortColumn()) { - case TorrentModel::TR_CATEGORY: - case TorrentModel::TR_TAGS: - case TorrentModel::TR_NAME: { + case TransferListModel::TR_CATEGORY: + case TransferListModel::TR_TAGS: + case TransferListModel::TR_NAME: { const QVariant vL = left.data(); const QVariant vR = right.data(); if (!vL.isValid() || !vR.isValid() || (vL == vR)) @@ -98,7 +98,7 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex return (result < 0); } - case TorrentModel::TR_STATUS: { + case TransferListModel::TR_STATUS: { // QSortFilterProxyModel::lessThan() uses the < operator only for specific QVariant types // so our custom type is outside that list. // In this case QSortFilterProxyModel::lessThan() converts other types to QString and @@ -112,18 +112,18 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex return lowerPositionThan(left, right); } - case TorrentModel::TR_ADD_DATE: - case TorrentModel::TR_SEED_DATE: - case TorrentModel::TR_SEEN_COMPLETE_DATE: { + case TransferListModel::TR_ADD_DATE: + case TransferListModel::TR_SEED_DATE: + case TransferListModel::TR_SEEN_COMPLETE_DATE: { return dateLessThan(sortColumn(), left, right, true); } - case TorrentModel::TR_PRIORITY: { + case TransferListModel::TR_PRIORITY: { return lowerPositionThan(left, right); } - case TorrentModel::TR_SEEDS: - case TorrentModel::TR_PEERS: { + case TransferListModel::TR_SEEDS: + case TransferListModel::TR_PEERS: { const int leftActive = left.data().toInt(); const int leftTotal = left.data(Qt::UserRole).toInt(); const int rightActive = right.data().toInt(); @@ -139,8 +139,8 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex return lowerPositionThan(left, right); } - case TorrentModel::TR_ETA: { - const TorrentModel *model = qobject_cast(sourceModel()); + case TransferListModel::TR_ETA: { + const TransferListModel *model = qobject_cast(sourceModel()); // Sorting rules prioritized. // 1. Active torrents at the top @@ -152,8 +152,8 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex if (isActiveL != isActiveR) return isActiveL; - const int prioL = model->data(model->index(left.row(), TorrentModel::TR_PRIORITY)).toInt(); - const int prioR = model->data(model->index(right.row(), TorrentModel::TR_PRIORITY)).toInt(); + const int prioL = model->data(model->index(left.row(), TransferListModel::TR_PRIORITY)).toInt(); + const int prioR = model->data(model->index(right.row(), TransferListModel::TR_PRIORITY)).toInt(); const bool isSeedingL = (prioL < 0); const bool isSeedingR = (prioR < 0); if (isSeedingL != isSeedingR) { @@ -170,7 +170,7 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex const bool isInvalidR = ((etaR < 0) || (etaR >= MAX_ETA)); if (isInvalidL && isInvalidR) { if (isSeedingL) // Both seeding - return dateLessThan(TorrentModel::TR_SEED_DATE, left, right, true); + return dateLessThan(TransferListModel::TR_SEED_DATE, left, right, true); else return (prioL < prioR); } @@ -182,7 +182,7 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex } } - case TorrentModel::TR_LAST_ACTIVITY: { + case TransferListModel::TR_LAST_ACTIVITY: { const qlonglong vL = left.data().toLongLong(); const qlonglong vR = right.data().toLongLong(); @@ -192,7 +192,7 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex return vL < vR; } - case TorrentModel::TR_RATIO_LIMIT: { + case TransferListModel::TR_RATIO_LIMIT: { const qreal vL = left.data().toDouble(); const qreal vR = right.data().toDouble(); @@ -213,11 +213,11 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex bool TransferListSortModel::lowerPositionThan(const QModelIndex &left, const QModelIndex &right) const { - const TorrentModel *model = qobject_cast(sourceModel()); + const TransferListModel *model = qobject_cast(sourceModel()); // Sort according to TR_PRIORITY - const int queueL = model->data(model->index(left.row(), TorrentModel::TR_PRIORITY)).toInt(); - const int queueR = model->data(model->index(right.row(), TorrentModel::TR_PRIORITY)).toInt(); + const int queueL = model->data(model->index(left.row(), TransferListModel::TR_PRIORITY)).toInt(); + const int queueR = model->data(model->index(right.row(), TransferListModel::TR_PRIORITY)).toInt(); if ((queueL > 0) || (queueR > 0)) { if ((queueL > 0) && (queueR > 0)) return queueL < queueR; @@ -226,7 +226,7 @@ bool TransferListSortModel::lowerPositionThan(const QModelIndex &left, const QMo } // Sort according to TR_SEED_DATE - return dateLessThan(TorrentModel::TR_SEED_DATE, left, right, false); + return dateLessThan(TransferListModel::TR_SEED_DATE, left, right, false); } // Every time we compare QDateTimes we need a fallback comparison in case both @@ -234,7 +234,7 @@ bool TransferListSortModel::lowerPositionThan(const QModelIndex &left, const QMo // (detailed discussion in #2526 and #2158). bool TransferListSortModel::dateLessThan(const int dateColumn, const QModelIndex &left, const QModelIndex &right, bool sortInvalidInBottom) const { - const TorrentModel *model = qobject_cast(sourceModel()); + const TransferListModel *model = qobject_cast(sourceModel()); const QDateTime dateL = model->data(model->index(left.row(), dateColumn)).toDateTime(); const QDateTime dateR = model->data(model->index(right.row(), dateColumn)).toDateTime(); if (dateL.isValid() && dateR.isValid()) { @@ -262,7 +262,7 @@ bool TransferListSortModel::filterAcceptsRow(int sourceRow, const QModelIndex &s bool TransferListSortModel::matchFilter(int sourceRow, const QModelIndex &sourceParent) const { - TorrentModel *model = qobject_cast(sourceModel()); + TransferListModel *model = qobject_cast(sourceModel()); if (!model) return false; BitTorrent::TorrentHandle *const torrent = model->torrentHandle(model->index(sourceRow, 0, sourceParent)); diff --git a/src/gui/transferlistwidget.cpp b/src/gui/transferlistwidget.cpp index b19332b32..cbe4a9c30 100644 --- a/src/gui/transferlistwidget.cpp +++ b/src/gui/transferlistwidget.cpp @@ -49,17 +49,17 @@ #include "base/utils/fs.h" #include "base/utils/string.h" #include "autoexpandabledialog.h" -#include "deletionconfirmationdlg.h" +#include "deletionconfirmationdialog.h" #include "guiiconprovider.h" #include "mainwindow.h" -#include "optionsdlg.h" +#include "optionsdialog.h" #include "previewselectdialog.h" -#include "speedlimitdlg.h" +#include "speedlimitdialog.h" #include "torrentcategorydialog.h" -#include "torrentmodel.h" #include "transferlistdelegate.h" +#include "transferlistmodel.h" #include "transferlistsortmodel.h" -#include "updownratiodlg.h" +#include "updownratiodialog.h" #ifdef Q_OS_MAC #include "macutilities.h" @@ -213,12 +213,12 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *mainWindow) setItemDelegate(m_listDelegate); // Create transfer list model - m_listModel = new TorrentModel(this); + m_listModel = new TransferListModel(this); m_sortFilterModel = new TransferListSortModel(); m_sortFilterModel->setDynamicSortFilter(true); m_sortFilterModel->setSourceModel(m_listModel); - m_sortFilterModel->setFilterKeyColumn(TorrentModel::TR_NAME); + m_sortFilterModel->setFilterKeyColumn(TransferListModel::TR_NAME); m_sortFilterModel->setFilterRole(Qt::DisplayRole); m_sortFilterModel->setSortCaseSensitivity(Qt::CaseInsensitive); @@ -239,40 +239,40 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *mainWindow) // Default hidden columns if (!columnLoaded) { - setColumnHidden(TorrentModel::TR_ADD_DATE, true); - setColumnHidden(TorrentModel::TR_SEED_DATE, true); - setColumnHidden(TorrentModel::TR_UPLIMIT, true); - setColumnHidden(TorrentModel::TR_DLLIMIT, true); - setColumnHidden(TorrentModel::TR_TRACKER, true); - setColumnHidden(TorrentModel::TR_AMOUNT_DOWNLOADED, true); - setColumnHidden(TorrentModel::TR_AMOUNT_UPLOADED, true); - setColumnHidden(TorrentModel::TR_AMOUNT_DOWNLOADED_SESSION, true); - setColumnHidden(TorrentModel::TR_AMOUNT_UPLOADED_SESSION, true); - setColumnHidden(TorrentModel::TR_AMOUNT_LEFT, true); - setColumnHidden(TorrentModel::TR_TIME_ELAPSED, true); - setColumnHidden(TorrentModel::TR_SAVE_PATH, true); - setColumnHidden(TorrentModel::TR_COMPLETED, true); - setColumnHidden(TorrentModel::TR_RATIO_LIMIT, true); - setColumnHidden(TorrentModel::TR_SEEN_COMPLETE_DATE, true); - setColumnHidden(TorrentModel::TR_LAST_ACTIVITY, true); - setColumnHidden(TorrentModel::TR_TOTAL_SIZE, true); + setColumnHidden(TransferListModel::TR_ADD_DATE, true); + setColumnHidden(TransferListModel::TR_SEED_DATE, true); + setColumnHidden(TransferListModel::TR_UPLIMIT, true); + setColumnHidden(TransferListModel::TR_DLLIMIT, true); + setColumnHidden(TransferListModel::TR_TRACKER, true); + setColumnHidden(TransferListModel::TR_AMOUNT_DOWNLOADED, true); + setColumnHidden(TransferListModel::TR_AMOUNT_UPLOADED, true); + setColumnHidden(TransferListModel::TR_AMOUNT_DOWNLOADED_SESSION, true); + setColumnHidden(TransferListModel::TR_AMOUNT_UPLOADED_SESSION, true); + setColumnHidden(TransferListModel::TR_AMOUNT_LEFT, true); + setColumnHidden(TransferListModel::TR_TIME_ELAPSED, true); + setColumnHidden(TransferListModel::TR_SAVE_PATH, true); + setColumnHidden(TransferListModel::TR_COMPLETED, true); + setColumnHidden(TransferListModel::TR_RATIO_LIMIT, true); + setColumnHidden(TransferListModel::TR_SEEN_COMPLETE_DATE, true); + setColumnHidden(TransferListModel::TR_LAST_ACTIVITY, true); + setColumnHidden(TransferListModel::TR_TOTAL_SIZE, true); } //Ensure that at least one column is visible at all times bool atLeastOne = false; - for (unsigned int i = 0; i < TorrentModel::NB_COLUMNS; ++i) { + for (unsigned int i = 0; i < TransferListModel::NB_COLUMNS; ++i) { if (!isColumnHidden(i)) { atLeastOne = true; break; } } if (!atLeastOne) - setColumnHidden(TorrentModel::TR_NAME, false); + setColumnHidden(TransferListModel::TR_NAME, false); //When adding/removing columns between versions some may //end up being size 0 when the new version is launched with //a conf file from the previous version. - for (unsigned int i = 0; i < TorrentModel::NB_COLUMNS; ++i) + for (unsigned int i = 0; i < TransferListModel::NB_COLUMNS; ++i) if ((columnWidth(i) <= 0) && (!isColumnHidden(i))) resizeColumnToContents(i); @@ -318,7 +318,7 @@ TransferListWidget::~TransferListWidget() qDebug() << Q_FUNC_INFO << "EXIT"; } -TorrentModel *TransferListWidget::getSourceModel() const +TransferListModel *TransferListWidget::getSourceModel() const { return m_listModel; } @@ -476,7 +476,7 @@ void TransferListWidget::deleteSelectedTorrents(bool deleteLocalFiles) if (torrents.empty()) return; if (Preferences::instance()->confirmTorrentDeletion() - && !DeletionConfirmationDlg::askForDeletionConfirmation(this, deleteLocalFiles, torrents.size(), torrents[0]->name())) + && !DeletionConfirmationDialog::askForDeletionConfirmation(this, deleteLocalFiles, torrents.size(), torrents[0]->name())) return; foreach (BitTorrent::TorrentHandle *const torrent, torrents) BitTorrent::Session::instance()->deleteTorrent(torrent->hash(), deleteLocalFiles); @@ -492,7 +492,7 @@ void TransferListWidget::deleteVisibleTorrents() bool deleteLocalFiles = false; if (Preferences::instance()->confirmTorrentDeletion() - && !DeletionConfirmationDlg::askForDeletionConfirmation(this, deleteLocalFiles, torrents.size(), torrents[0]->name())) + && !DeletionConfirmationDialog::askForDeletionConfirmation(this, deleteLocalFiles, torrents.size(), torrents[0]->name())) return; foreach (BitTorrent::TorrentHandle *const torrent, torrents) @@ -555,9 +555,9 @@ void TransferListWidget::copySelectedHashes() const void TransferListWidget::hidePriorityColumn(bool hide) { qDebug("hidePriorityColumn(%d)", hide); - setColumnHidden(TorrentModel::TR_PRIORITY, hide); - if (!hide && !columnWidth(TorrentModel::TR_PRIORITY)) - resizeColumnToContents(TorrentModel::TR_PRIORITY); + setColumnHidden(TransferListModel::TR_PRIORITY, hide); + if (!hide && !columnWidth(TransferListModel::TR_PRIORITY)) + resizeColumnToContents(TransferListModel::TR_PRIORITY); } void TransferListWidget::openSelectedTorrentsFolder() const @@ -666,7 +666,7 @@ void TransferListWidget::setMaxRatioSelectedTorrents() useGlobalValue = (torrents[0]->ratioLimit() == BitTorrent::TorrentHandle::USE_GLOBAL_RATIO) && (torrents[0]->seedingTimeLimit() == BitTorrent::TorrentHandle::USE_GLOBAL_SEEDING_TIME); - UpDownRatioDlg dlg(useGlobalValue, currentMaxRatio, BitTorrent::TorrentHandle::MAX_RATIO, + UpDownRatioDialog dlg(useGlobalValue, currentMaxRatio, BitTorrent::TorrentHandle::MAX_RATIO, currentMaxSeedingTime, BitTorrent::TorrentHandle::MAX_SEEDING_TIME, this); if (dlg.exec() != QDialog::Accepted) return; @@ -703,7 +703,7 @@ void TransferListWidget::displayDLHoSMenu(const QPoint&) hideshowColumn.setTitle(tr("Column visibility")); QList actions; for (int i = 0; i < m_listModel->columnCount(); ++i) { - if (!BitTorrent::Session::instance()->isQueueingSystemEnabled() && (i == TorrentModel::TR_PRIORITY)) { + if (!BitTorrent::Session::instance()->isQueueingSystemEnabled() && (i == TransferListModel::TR_PRIORITY)) { actions.append(nullptr); continue; } @@ -713,7 +713,7 @@ void TransferListWidget::displayDLHoSMenu(const QPoint&) actions.append(myAct); } int visibleCols = 0; - for (unsigned int i = 0; i < TorrentModel::NB_COLUMNS; ++i) { + for (unsigned int i = 0; i < TransferListModel::NB_COLUMNS; ++i) { if (!isColumnHidden(i)) ++visibleCols; @@ -823,7 +823,7 @@ void TransferListWidget::renameSelectedTorrent() const QModelIndexList selectedIndexes = selectionModel()->selectedRows(); if ((selectedIndexes.size() != 1) || !selectedIndexes.first().isValid()) return; - const QModelIndex mi = m_listModel->index(mapToSource(selectedIndexes.first()).row(), TorrentModel::TR_NAME); + const QModelIndex mi = m_listModel->index(mapToSource(selectedIndexes.first()).row(), TransferListModel::TR_NAME); BitTorrent::TorrentHandle *const torrent = m_listModel->torrentHandle(mi); if (!torrent) return; @@ -840,7 +840,7 @@ void TransferListWidget::renameSelectedTorrent() void TransferListWidget::setSelectionCategory(QString category) { foreach (const QModelIndex &index, selectionModel()->selectedRows()) - m_listModel->setData(m_listModel->index(mapToSource(index).row(), TorrentModel::TR_CATEGORY), category, Qt::DisplayRole); + m_listModel->setData(m_listModel->index(mapToSource(index).row(), TransferListModel::TR_CATEGORY), category, Qt::DisplayRole); } void TransferListWidget::addSelectionTag(const QString &tag) @@ -1196,8 +1196,8 @@ void TransferListWidget::applyStatusFilter(int f) m_sortFilterModel->setStatusFilter(static_cast(f)); // Select first item if nothing is selected if (selectionModel()->selectedRows(0).empty() && (m_sortFilterModel->rowCount() > 0)) { - qDebug("Nothing is selected, selecting first row: %s", qUtf8Printable(m_sortFilterModel->index(0, TorrentModel::TR_NAME).data().toString())); - selectionModel()->setCurrentIndex(m_sortFilterModel->index(0, TorrentModel::TR_NAME), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); + qDebug("Nothing is selected, selecting first row: %s", qUtf8Printable(m_sortFilterModel->index(0, TransferListModel::TR_NAME).data().toString())); + selectionModel()->setCurrentIndex(m_sortFilterModel->index(0, TransferListModel::TR_NAME), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); } } diff --git a/src/gui/transferlistwidget.h b/src/gui/transferlistwidget.h index a9b3c1963..987db2f8d 100644 --- a/src/gui/transferlistwidget.h +++ b/src/gui/transferlistwidget.h @@ -43,8 +43,8 @@ class QStandardItemModel; class MainWindow; class TransferListDelegate; +class TransferListModel; class TransferListSortModel; -class TorrentModel; class TransferListWidget : public QTreeView { @@ -53,7 +53,7 @@ class TransferListWidget : public QTreeView public: TransferListWidget(QWidget *parent, MainWindow *mainWindow); ~TransferListWidget(); - TorrentModel *getSourceModel() const; + TransferListModel *getSourceModel() const; public slots: void setSelectionCategory(QString category); @@ -125,7 +125,7 @@ private: void applyToSelectedTorrents(const std::function &fn); TransferListDelegate *m_listDelegate; - TorrentModel *m_listModel; + TransferListModel *m_listModel; TransferListSortModel *m_sortFilterModel; MainWindow *m_mainWindow; QShortcut *m_editHotkey; diff --git a/src/gui/updownratiodlg.cpp b/src/gui/updownratiodialog.cpp similarity index 86% rename from src/gui/updownratiodlg.cpp rename to src/gui/updownratiodialog.cpp index ca9d14825..4bd27bda4 100644 --- a/src/gui/updownratiodlg.cpp +++ b/src/gui/updownratiodialog.cpp @@ -27,19 +27,19 @@ * exception statement from your version. */ -#include "updownratiodlg.h" +#include "updownratiodialog.h" #include #include "base/bittorrent/session.h" -#include "ui_updownratiodlg.h" +#include "ui_updownratiodialog.h" #include "utils.h" -UpDownRatioDlg::UpDownRatioDlg(bool useDefault, qreal initialRatioValue, +UpDownRatioDialog::UpDownRatioDialog(bool useDefault, qreal initialRatioValue, qreal maxRatioValue, int initialTimeValue, int maxTimeValue, QWidget *parent) : QDialog(parent) - , m_ui(new Ui::UpDownRatioDlg) + , m_ui(new Ui::UpDownRatioDialog) { m_ui->setupUi(this); @@ -70,16 +70,16 @@ UpDownRatioDlg::UpDownRatioDlg(bool useDefault, qreal initialRatioValue, m_ui->timeSpinBox->setValue(initialTimeValue); connect(m_ui->buttonGroup, static_cast(&QButtonGroup::buttonClicked) - , this, &UpDownRatioDlg::handleRatioTypeChanged); - connect(m_ui->checkMaxRatio, &QCheckBox::toggled, this, &UpDownRatioDlg::enableRatioSpin); - connect(m_ui->checkMaxTime, &QCheckBox::toggled, this, &UpDownRatioDlg::enableTimeSpin); + , this, &UpDownRatioDialog::handleRatioTypeChanged); + connect(m_ui->checkMaxRatio, &QCheckBox::toggled, this, &UpDownRatioDialog::enableRatioSpin); + connect(m_ui->checkMaxTime, &QCheckBox::toggled, this, &UpDownRatioDialog::enableTimeSpin); handleRatioTypeChanged(); Utils::Gui::resize(this); } -void UpDownRatioDlg::accept() +void UpDownRatioDialog::accept() { if (m_ui->torrentLimitButton->isChecked() && !m_ui->checkMaxRatio->isChecked() && !m_ui->checkMaxTime->isChecked()) QMessageBox::critical(this, tr("No share limit method selected"), @@ -88,22 +88,22 @@ void UpDownRatioDlg::accept() QDialog::accept(); } -bool UpDownRatioDlg::useDefault() const +bool UpDownRatioDialog::useDefault() const { return m_ui->useDefaultButton->isChecked(); } -qreal UpDownRatioDlg::ratio() const +qreal UpDownRatioDialog::ratio() const { return (m_ui->noLimitButton->isChecked() || !m_ui->checkMaxRatio->isChecked()) ? -1. : m_ui->ratioSpinBox->value(); } -int UpDownRatioDlg::seedingTime() const +int UpDownRatioDialog::seedingTime() const { return (m_ui->noLimitButton->isChecked() || !m_ui->checkMaxTime->isChecked()) ? -1 : m_ui->timeSpinBox->value(); } -void UpDownRatioDlg::handleRatioTypeChanged() +void UpDownRatioDialog::handleRatioTypeChanged() { // ui->ratioSpinBox->setEnabled(ui->torrentLimitButton->isChecked()); m_ui->checkMaxRatio->setEnabled(m_ui->torrentLimitButton->isChecked()); @@ -113,17 +113,17 @@ void UpDownRatioDlg::handleRatioTypeChanged() m_ui->timeSpinBox->setEnabled(m_ui->torrentLimitButton->isChecked() && m_ui->checkMaxTime->isChecked()); } -void UpDownRatioDlg::enableRatioSpin() +void UpDownRatioDialog::enableRatioSpin() { m_ui->ratioSpinBox->setEnabled(m_ui->checkMaxRatio->isChecked()); } -void UpDownRatioDlg::enableTimeSpin() +void UpDownRatioDialog::enableTimeSpin() { m_ui->timeSpinBox->setEnabled(m_ui->checkMaxTime->isChecked()); } -UpDownRatioDlg::~UpDownRatioDlg() +UpDownRatioDialog::~UpDownRatioDialog() { delete m_ui; } diff --git a/src/gui/updownratiodlg.h b/src/gui/updownratiodialog.h similarity index 86% rename from src/gui/updownratiodlg.h rename to src/gui/updownratiodialog.h index eab601b13..725b5d99e 100644 --- a/src/gui/updownratiodlg.h +++ b/src/gui/updownratiodialog.h @@ -26,25 +26,25 @@ * exception statement from your version. */ -#ifndef UPDOWNRATIODLG_H -#define UPDOWNRATIODLG_H +#ifndef UPDOWNRATIODIALOG_H +#define UPDOWNRATIODIALOG_H #include namespace Ui { - class UpDownRatioDlg; + class UpDownRatioDialog; } -class UpDownRatioDlg : public QDialog +class UpDownRatioDialog : public QDialog { Q_OBJECT public: - UpDownRatioDlg(bool useDefault, qreal initialValue, qreal maxValue, + UpDownRatioDialog(bool useDefault, qreal initialValue, qreal maxValue, int initialTimeValue, int maxTimeValue, QWidget *parent = nullptr); - ~UpDownRatioDlg(); + ~UpDownRatioDialog(); bool useDefault() const; qreal ratio() const; @@ -59,7 +59,7 @@ private slots: void enableTimeSpin(); private: - Ui::UpDownRatioDlg *m_ui; + Ui::UpDownRatioDialog *m_ui; }; -#endif // UPDOWNRATIODLG_H +#endif // UPDOWNRATIODIALOG_H diff --git a/src/gui/updownratiodlg.ui b/src/gui/updownratiodialog.ui similarity index 96% rename from src/gui/updownratiodlg.ui rename to src/gui/updownratiodialog.ui index 6774d8a0d..edfef4312 100644 --- a/src/gui/updownratiodlg.ui +++ b/src/gui/updownratiodialog.ui @@ -1,7 +1,7 @@ - UpDownRatioDlg - + UpDownRatioDialog + 0 @@ -140,7 +140,7 @@ buttonBox accepted() - UpDownRatioDlg + UpDownRatioDialog accept() @@ -156,7 +156,7 @@ buttonBox rejected() - UpDownRatioDlg + UpDownRatioDialog reject() diff --git a/src/webui/CMakeLists.txt b/src/webui/CMakeLists.txt index 894d5254e..75ee24b87 100644 --- a/src/webui/CMakeLists.txt +++ b/src/webui/CMakeLists.txt @@ -1,4 +1,5 @@ add_library(qbt_webui STATIC +# headers api/apicontroller.h api/apierror.h api/appcontroller.h @@ -13,6 +14,8 @@ api/serialize/serialize_torrent.h extra_translations.h webapplication.h webui.h + +# sources api/apicontroller.cpp api/apierror.cpp api/appcontroller.cpp diff --git a/src/webui/www/private/addtrackers.html b/src/webui/www/private/addtrackers.html index 52787e22e..52f26e0b1 100644 --- a/src/webui/www/private/addtrackers.html +++ b/src/webui/www/private/addtrackers.html @@ -3,7 +3,7 @@ - QBT_TR(Trackers addition dialog)QBT_TR[CONTEXT=TrackersAdditionDlg] + QBT_TR(Trackers addition dialog)QBT_TR[CONTEXT=TrackersAdditionDialog] @@ -32,7 +32,7 @@

-

QBT_TR(List of trackers to add (one per line):)QBT_TR[CONTEXT=TrackersAdditionDlg]

+

QBT_TR(List of trackers to add (one per line):)QBT_TR[CONTEXT=TrackersAdditionDialog]


diff --git a/src/webui/www/private/filters.html b/src/webui/www/private/filters.html index 150e89ece..3f8b35941 100644 --- a/src/webui/www/private/filters.html +++ b/src/webui/www/private/filters.html @@ -1,14 +1,14 @@ QBT_TR(Status)QBT_TR[CONTEXT=TransferListFiltersWidget]
QBT_TR(Categories)QBT_TR[CONTEXT=TransferListFiltersWidget] diff --git a/src/webui/www/private/properties_content.html b/src/webui/www/private/properties_content.html index ac17525d5..a4b4269cf 100644 --- a/src/webui/www/private/properties_content.html +++ b/src/webui/www/private/properties_content.html @@ -84,10 +84,10 @@ - - - - + + + + @@ -120,7 +120,7 @@
QBT_TR(URL)QBT_TR[CONTEXT=TrackerList] Add TrackersQBT_TR(Status)QBT_TR[CONTEXT=TrackerList]QBT_TR(Peers)QBT_TR[CONTEXT=TrackerList]QBT_TR(Message)QBT_TR[CONTEXT=TrackerList]QBT_TR(URL)QBT_TR[CONTEXT=TrackerListWidget] Add TrackersQBT_TR(Status)QBT_TR[CONTEXT=TrackerListWidget]QBT_TR(Peers)QBT_TR[CONTEXT=TrackerListWidget]QBT_TR(Message)QBT_TR[CONTEXT=TrackerListWidget]
- + diff --git a/src/webui/www/private/scripts/client.js b/src/webui/www/private/scripts/client.js index e0c5e9967..51f463abe 100644 --- a/src/webui/www/private/scripts/client.js +++ b/src/webui/www/private/scripts/client.js @@ -220,15 +220,15 @@ window.addEvent('load', function() { }; var updateFiltersList = function() { - updateFilter('all', 'QBT_TR(All (%1))QBT_TR[CONTEXT=StatusFiltersWidget]'); - updateFilter('downloading', 'QBT_TR(Downloading (%1))QBT_TR[CONTEXT=StatusFiltersWidget]'); - updateFilter('seeding', 'QBT_TR(Seeding (%1))QBT_TR[CONTEXT=StatusFiltersWidget]'); - updateFilter('completed', 'QBT_TR(Completed (%1))QBT_TR[CONTEXT=StatusFiltersWidget]'); - updateFilter('resumed', 'QBT_TR(Resumed (%1))QBT_TR[CONTEXT=StatusFiltersWidget]'); - updateFilter('paused', 'QBT_TR(Paused (%1))QBT_TR[CONTEXT=StatusFiltersWidget]'); - updateFilter('active', 'QBT_TR(Active (%1))QBT_TR[CONTEXT=StatusFiltersWidget]'); - updateFilter('inactive', 'QBT_TR(Inactive (%1))QBT_TR[CONTEXT=StatusFiltersWidget]'); - updateFilter('errored', 'QBT_TR(Errored (%1))QBT_TR[CONTEXT=StatusFiltersWidget]'); + updateFilter('all', 'QBT_TR(All (%1))QBT_TR[CONTEXT=StatusFilterWidget]'); + updateFilter('downloading', 'QBT_TR(Downloading (%1))QBT_TR[CONTEXT=StatusFilterWidget]'); + updateFilter('seeding', 'QBT_TR(Seeding (%1))QBT_TR[CONTEXT=StatusFilterWidget]'); + updateFilter('completed', 'QBT_TR(Completed (%1))QBT_TR[CONTEXT=StatusFilterWidget]'); + updateFilter('resumed', 'QBT_TR(Resumed (%1))QBT_TR[CONTEXT=StatusFilterWidget]'); + updateFilter('paused', 'QBT_TR(Paused (%1))QBT_TR[CONTEXT=StatusFilterWidget]'); + updateFilter('active', 'QBT_TR(Active (%1))QBT_TR[CONTEXT=StatusFilterWidget]'); + updateFilter('inactive', 'QBT_TR(Inactive (%1))QBT_TR[CONTEXT=StatusFilterWidget]'); + updateFilter('errored', 'QBT_TR(Errored (%1))QBT_TR[CONTEXT=StatusFilterWidget]'); }; var updateCategoryList = function() { diff --git a/src/webui/www/private/scripts/dynamicTable.js b/src/webui/www/private/scripts/dynamicTable.js index b49f9d830..8f5122f66 100644 --- a/src/webui/www/private/scripts/dynamicTable.js +++ b/src/webui/www/private/scripts/dynamicTable.js @@ -743,35 +743,35 @@ var TorrentsTable = new Class({ initColumns: function() { this.newColumn('priority', '', '#', 30, true); this.newColumn('state_icon', 'cursor: default', '', 22, true); - this.newColumn('name', '', 'QBT_TR(Name)QBT_TR[CONTEXT=TorrentModel]', 200, true); - this.newColumn('size', '', 'QBT_TR(Size)QBT_TR[CONTEXT=TorrentModel]', 100, true); - this.newColumn('total_size', '', 'QBT_TR(Total Size)QBT_TR[CONTEXT=TorrentModel]', 100, false); - this.newColumn('progress', '', 'QBT_TR(Done)QBT_TR[CONTEXT=TorrentModel]', 85, true); - this.newColumn('status', '', 'QBT_TR(Status)QBT_TR[CONTEXT=TorrentModel]', 100, true); - this.newColumn('num_seeds', '', 'QBT_TR(Seeds)QBT_TR[CONTEXT=TorrentModel]', 100, true); - this.newColumn('num_leechs', '', 'QBT_TR(Peers)QBT_TR[CONTEXT=TorrentModel]', 100, true); - this.newColumn('dlspeed', '', 'QBT_TR(Down Speed)QBT_TR[CONTEXT=TorrentModel]', 100, true); - this.newColumn('upspeed', '', 'QBT_TR(Up Speed)QBT_TR[CONTEXT=TorrentModel]', 100, true); - this.newColumn('eta', '', 'QBT_TR(ETA)QBT_TR[CONTEXT=TorrentModel]', 100, true); - this.newColumn('ratio', '', 'QBT_TR(Ratio)QBT_TR[CONTEXT=TorrentModel]', 100, true); - this.newColumn('category', '', 'QBT_TR(Category)QBT_TR[CONTEXT=TorrentModel]', 100, true); - this.newColumn('tags', '', 'QBT_TR(Tags)QBT_TR[CONTEXT=TorrentModel]', 100, true); - this.newColumn('added_on', '', 'QBT_TR(Added On)QBT_TR[CONTEXT=TorrentModel]', 100, true); - this.newColumn('completion_on', '', 'QBT_TR(Completed On)QBT_TR[CONTEXT=TorrentModel]', 100, false); - this.newColumn('tracker', '', 'QBT_TR(Tracker)QBT_TR[CONTEXT=TorrentModel]', 100, false); - this.newColumn('dl_limit', '', 'QBT_TR(Down Limit)QBT_TR[CONTEXT=TorrentModel]', 100, false); - this.newColumn('up_limit', '', 'QBT_TR(Up Limit)QBT_TR[CONTEXT=TorrentModel]', 100, false); - this.newColumn('downloaded', '', 'QBT_TR(Downloaded)QBT_TR[CONTEXT=TorrentModel]', 100, false); - this.newColumn('uploaded', '', 'QBT_TR(Uploaded)QBT_TR[CONTEXT=TorrentModel]', 100, false); - this.newColumn('downloaded_session', '', 'QBT_TR(Session Download)QBT_TR[CONTEXT=TorrentModel]', 100, false); - this.newColumn('uploaded_session', '', 'QBT_TR(Session Upload)QBT_TR[CONTEXT=TorrentModel]', 100, false); - this.newColumn('amount_left', '', 'QBT_TR(Remaining)QBT_TR[CONTEXT=TorrentModel]', 100, false); - this.newColumn('time_active', '', 'QBT_TR(Time Active)QBT_TR[CONTEXT=TorrentModel]', 100, false); - this.newColumn('save_path', '', 'QBT_TR(Save path)QBT_TR[CONTEXT=TorrentModel]', 100, false); - this.newColumn('completed', '', 'QBT_TR(Completed)QBT_TR[CONTEXT=TorrentModel]', 100, false); - this.newColumn('max_ratio', '', 'QBT_TR(Ratio Limit)QBT_TR[CONTEXT=TorrentModel]', 100, false); - this.newColumn('seen_complete', '', 'QBT_TR(Last Seen Complete)QBT_TR[CONTEXT=TorrentModel]', 100, false); - this.newColumn('last_activity', '', 'QBT_TR(Last Activity)QBT_TR[CONTEXT=TorrentModel]', 100, false); + this.newColumn('name', '', 'QBT_TR(Name)QBT_TR[CONTEXT=TransferListModel]', 200, true); + this.newColumn('size', '', 'QBT_TR(Size)QBT_TR[CONTEXT=TransferListModel]', 100, true); + this.newColumn('total_size', '', 'QBT_TR(Total Size)QBT_TR[CONTEXT=TransferListModel]', 100, false); + this.newColumn('progress', '', 'QBT_TR(Done)QBT_TR[CONTEXT=TransferListModel]', 85, true); + this.newColumn('status', '', 'QBT_TR(Status)QBT_TR[CONTEXT=TransferListModel]', 100, true); + this.newColumn('num_seeds', '', 'QBT_TR(Seeds)QBT_TR[CONTEXT=TransferListModel]', 100, true); + this.newColumn('num_leechs', '', 'QBT_TR(Peers)QBT_TR[CONTEXT=TransferListModel]', 100, true); + this.newColumn('dlspeed', '', 'QBT_TR(Down Speed)QBT_TR[CONTEXT=TransferListModel]', 100, true); + this.newColumn('upspeed', '', 'QBT_TR(Up Speed)QBT_TR[CONTEXT=TransferListModel]', 100, true); + this.newColumn('eta', '', 'QBT_TR(ETA)QBT_TR[CONTEXT=TransferListModel]', 100, true); + this.newColumn('ratio', '', 'QBT_TR(Ratio)QBT_TR[CONTEXT=TransferListModel]', 100, true); + this.newColumn('category', '', 'QBT_TR(Category)QBT_TR[CONTEXT=TransferListModel]', 100, true); + this.newColumn('tags', '', 'QBT_TR(Tags)QBT_TR[CONTEXT=TransferListModel]', 100, true); + this.newColumn('added_on', '', 'QBT_TR(Added On)QBT_TR[CONTEXT=TransferListModel]', 100, true); + this.newColumn('completion_on', '', 'QBT_TR(Completed On)QBT_TR[CONTEXT=TransferListModel]', 100, false); + this.newColumn('tracker', '', 'QBT_TR(Tracker)QBT_TR[CONTEXT=TransferListModel]', 100, false); + this.newColumn('dl_limit', '', 'QBT_TR(Down Limit)QBT_TR[CONTEXT=TransferListModel]', 100, false); + this.newColumn('up_limit', '', 'QBT_TR(Up Limit)QBT_TR[CONTEXT=TransferListModel]', 100, false); + this.newColumn('downloaded', '', 'QBT_TR(Downloaded)QBT_TR[CONTEXT=TransferListModel]', 100, false); + this.newColumn('uploaded', '', 'QBT_TR(Uploaded)QBT_TR[CONTEXT=TransferListModel]', 100, false); + this.newColumn('downloaded_session', '', 'QBT_TR(Session Download)QBT_TR[CONTEXT=TransferListModel]', 100, false); + this.newColumn('uploaded_session', '', 'QBT_TR(Session Upload)QBT_TR[CONTEXT=TransferListModel]', 100, false); + this.newColumn('amount_left', '', 'QBT_TR(Remaining)QBT_TR[CONTEXT=TransferListModel]', 100, false); + this.newColumn('time_active', '', 'QBT_TR(Time Active)QBT_TR[CONTEXT=TransferListModel]', 100, false); + this.newColumn('save_path', '', 'QBT_TR(Save path)QBT_TR[CONTEXT=TransferListModel]', 100, false); + this.newColumn('completed', '', 'QBT_TR(Completed)QBT_TR[CONTEXT=TransferListModel]', 100, false); + this.newColumn('max_ratio', '', 'QBT_TR(Ratio Limit)QBT_TR[CONTEXT=TransferListModel]', 100, false); + this.newColumn('seen_complete', '', 'QBT_TR(Last Seen Complete)QBT_TR[CONTEXT=TransferListModel]', 100, false); + this.newColumn('last_activity', '', 'QBT_TR(Last Activity)QBT_TR[CONTEXT=TransferListModel]', 100, false); this.columns['state_icon'].onclick = ''; this.columns['state_icon'].dataProperties[0] = 'state'; diff --git a/src/webui/www/private/scripts/mocha-init.js b/src/webui/www/private/scripts/mocha-init.js index a1102f564..0d464d67c 100644 --- a/src/webui/www/private/scripts/mocha-init.js +++ b/src/webui/www/private/scripts/mocha-init.js @@ -188,7 +188,7 @@ initializeWindows = function() { var orig = torrentsHaveSameShareRatio ? shareRatio : ""; new MochaUI.Window({ id: 'shareRatioPage', - title: "QBT_TR(Torrent Upload/Download Ratio Limiting)QBT_TR[CONTEXT=UpDownRatioDlg]", + title: "QBT_TR(Torrent Upload/Download Ratio Limiting)QBT_TR[CONTEXT=UpDownRatioDialog]", loadMethod: 'iframe', contentURL: 'shareratio.html?hashes=' + hashes.join("|") + '&orig=' + orig, scrollbars: false, diff --git a/src/webui/www/private/scripts/prop-trackers.js b/src/webui/www/private/scripts/prop-trackers.js index b6bf04617..c1fef47ba 100644 --- a/src/webui/www/private/scripts/prop-trackers.js +++ b/src/webui/www/private/scripts/prop-trackers.js @@ -116,7 +116,7 @@ $('addTrackersPlus').addEvent('click', function addTrackerDlg() { if (current_hash.length === 0) return; new MochaUI.Window({ id: 'trackersPage', - title: "QBT_TR(Trackers addition dialog)QBT_TR[CONTEXT=TrackersAdditionDlg]", + title: "QBT_TR(Trackers addition dialog)QBT_TR[CONTEXT=TrackersAdditionDialog]", loadMethod: 'iframe', contentURL: 'addtrackers.html?hash=' + current_hash, scrollbars: true, diff --git a/src/webui/www/private/shareratio.html b/src/webui/www/private/shareratio.html index 1913c65f3..4662972dc 100644 --- a/src/webui/www/private/shareratio.html +++ b/src/webui/www/private/shareratio.html @@ -3,7 +3,7 @@ - QBT_TR(Torrent Upload/Download Ratio Limiting)QBT_TR[CONTEXT=UpDownRatioDlg] + QBT_TR(Torrent Upload/Download Ratio Limiting)QBT_TR[CONTEXT=UpDownRatioDialog] @@ -144,18 +144,18 @@
- QBT_TR(Use global share limit)QBT_TR[CONTEXT=UpDownRatioDlg]
- QBT_TR(Set no share limit)QBT_TR[CONTEXT=UpDownRatioDlg]
- QBT_TR(Set share limit to)QBT_TR[CONTEXT=UpDownRatioDlg]
+ QBT_TR(Use global share limit)QBT_TR[CONTEXT=UpDownRatioDialog]
+ QBT_TR(Set no share limit)QBT_TR[CONTEXT=UpDownRatioDialog]
+ QBT_TR(Set share limit to)QBT_TR[CONTEXT=UpDownRatioDialog]
- +
- +
QBT_TR(URL)QBT_TR[CONTEXT=TrackerList]QBT_TR(URL)QBT_TR[CONTEXT=TrackerListWidget]