diff --git a/ktmagnetdownloader/magnettest.h b/ktmagnetdownloader/magnettest.h index 92e0b554..d9d984da 100644 --- a/ktmagnetdownloader/magnettest.h +++ b/ktmagnetdownloader/magnettest.h @@ -1,54 +1,54 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef MAGNETTEST_H #define MAGNETTEST_H #include #include #include namespace bt { class UPnPRouter; class UPnPMCastSocket; } class MagnetTest : public QObject { public: MagnetTest(const bt::MagnetLink& mlink, QObject* parent = 0); - ~MagnetTest(); + ~MagnetTest() override; void routerDiscovered(bt::UPnPRouter* router); void start(); void update(); void foundMetaData(bt::MagnetDownloader* md, const QByteArray& data); private: bt::MagnetLink mlink; bt::UPnPMCastSocket* upnp; bt::MagnetDownloader* mdownloader; QTimer timer; }; #endif // MAGNETTEST_H diff --git a/ktorrent/core.h b/ktorrent/core.h index 6ce6778f..3dbfc57b 100644 --- a/ktorrent/core.h +++ b/ktorrent/core.h @@ -1,283 +1,283 @@ /*************************************************************************** * Copyright (C) 2005 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTCORE_HH #define KTCORE_HH #include #include #include #include class QDBusInterface; class QProgressBar; class KJob; namespace bt { class TorrentControl; class TorrentInterface; } namespace kt { class MagnetManager; class GUI; class PluginManager; class GroupManager; /** * Core of ktorrent, manages every non GUI aspect of the application * */ class Core : public CoreInterface { Q_OBJECT public: Core(GUI* gui); - ~Core(); + ~Core() override; // implemented from CoreInterface void setKeepSeeding(bool ks) override; bool changeDataDir(const QString& new_dir) override; void startAll() override; void stopAll() override; CurrentStats getStats() override; bool changePort(bt::Uint16 port) override; bt::Uint32 getNumTorrentsRunning() const override; bt::Uint32 getNumTorrentsNotRunning() const override; void load(const QUrl &url, const QString& group) override; bt::TorrentInterface* load(const QByteArray& data, const QUrl &url, const QString& group, const QString& savedir) override; void loadSilently(const QUrl &url, const QString& group) override; bt::TorrentInterface* loadSilently(const QByteArray& data, const QUrl &url, const QString& group, const QString& savedir) override; void load(const bt::MagnetLink& mlink, const MagnetLinkLoadOptions& options) override; QString findNewTorrentDir() const override; void loadExistingTorrent(const QString& tor_dir) override; void setSuspendedState(bool suspend) override; bool getSuspendedState() override; float getGlobalMaxShareRatio() const; DBus* getExternalInterface() override; /// Get the queue manager kt::QueueManager* getQueueManager() override; /// Get the group manager kt::GroupManager* getGroupManager() override {return gman;} /// Get the magnet manager kt::MagnetManager* getMagnetManager() override {return mman;} bt::TorrentInterface* createTorrent(bt::TorrentCreator* mktor, bool seed) override; /** * Set the maximum number of simultaneous downloads. * @param max The max num (0 == no limit) */ void setMaxDownloads(int max); /** * Set the maximum number of simultaneous seeds. * @param max The max num (0 == no limit) */ void setMaxSeeds(int max); /** * Load plugins. */ void loadPlugins(); public slots: /** * Start the update timer */ void startUpdateTimer(); /** * Update all torrents. */ void update(); void start(bt::TorrentInterface* tc) override; void start(QList & todo) override; void stop(bt::TorrentInterface* tc) override; void stop(QList & todo) override; void remove(bt::TorrentInterface* tc, bool data_to) override; void remove(QList & todo, bool data_to) override; void pause(bt::TorrentInterface* tc) override; void pause(QList & todo) override; /** * A torrent is about to be started. We will do some file checks upon this signal. * @param tc The TorrentInterface */ void aboutToBeStarted(bt::TorrentInterface* tc, bool& ret); /** * Checks for missing files and shows the MissingFilesDlg if necessary. * @param tc The torrent * @return True if everything is OK, false otherwise */ bool checkMissingFiles(bt::TorrentInterface* tc); /** * User tried to enqueue a torrent that has reached max share ratio. * Emits appropriate signal. */ void enqueueTorrentOverMaxRatio(bt::TorrentInterface* tc); /** * Do a data check on a torrent * @param tc The torrent * @param auto_import Is this an automatic import */ void doDataCheck(bt::TorrentInterface* tc, bool auto_import = false); ///Fires when disk space is running low void onLowDiskSpace(bt::TorrentInterface* tc, bool stopped); /// Apply all the settings void applySettings() override; /// Update the GUI plugins void updateGuiPlugins(); /// Handle status changes void onStatusChanged(bt::TorrentInterface* tc); /// Handle the download of meta data void onMetadataDownloaded(const bt::MagnetLink& mlink, const QByteArray& data, const kt::MagnetLinkLoadOptions& options); signals: /** * TorrentCore torrents have beed updated. Stats are changed. **/ void statsUpdated(); /** * Emitted when a torrent has reached it's max share ratio. * @param tc The torrent */ void maxShareRatioReached(bt::TorrentInterface* tc); /** * Emitted when a torrent has reached it's max seed time * @param tc The torrent */ void maxSeedTimeReached(bt::TorrentInterface* tc); /** * Corrupted data has been detected. * @param tc The torrent with the corrupted data */ void corruptedData(bt::TorrentInterface* tc); /** * User tried to enqueue a torrent that has reached max share ratio. It's not possible. * Signal should be connected to SysTray slot which shows appropriate KPassivePopup info. * @param tc The torrent in question. */ void queuingNotPossible(bt::TorrentInterface* tc); /** * Emitted when a torrent cannot be started * @param tc The torrent * @param reason The reason */ void canNotStart(bt::TorrentInterface* tc, bt::TorrentStartResponse reason); /** * Diskspace is running low. * Signal should be connected to SysTray slot which shows appropriate KPassivePopup info. * @param tc The torrent in question. */ void lowDiskSpace(bt::TorrentInterface* tc, bool stopped); /** * Loading silently failed. * @param msg Error message */ void canNotLoadSilently(const QString& msg); /** * Emitted when DHT is not enabled and a MagnetLink is being downloaded */ void dhtNotEnabled(const QString& msg); void openedSilently(bt::TorrentInterface* tc); /** * Emitted just before Core object is destroyed */ void aboutToQuit(); private: void rollback(const QList & success); void connectSignals(bt::TorrentInterface* tc); bool init(bt::TorrentControl* tc, const QString& group, const QString& location, bool silently); QString locationHint(const QString& group) const; void startServers(); void startTCPServer(bt::Uint16 port); void startUTPServer(bt::Uint16 port); bt::TorrentInterface* loadFromFile(const QString& file, const QString& dir, const QString& group, bool silently); bt::TorrentInterface* loadFromData(const QByteArray& data, const QString& dir, const QString& group, bool silently, const QUrl& url); public: void loadTorrents(); private slots: void torrentFinished(bt::TorrentInterface* tc); void slotStoppedByError(bt::TorrentInterface* tc, QString msg); void torrentSeedAutoStopped(bt::TorrentInterface* tc, bt::AutoStopReason reason); void downloadFinished(KJob* job); void downloadFinishedSilently(KJob* job); void emitCorruptedData(bt::TorrentInterface* tc); void autoCheckData(bt::TorrentInterface* tc); void delayedRemove(bt::TorrentInterface* tc); void delayedStart(); void beforeQueueReorder(); void afterQueueReorder(); void customGroupChanged(); /** * KT is exiting, shutdown the core */ void onExit(); private: GUI* gui; bool keep_seeding; QString data_dir; QTimer update_timer; bt::Uint64 removed_bytes_up, removed_bytes_down; kt::PluginManager* pman; kt::QueueManager* qman; kt::GroupManager* gman; kt::MagnetManager* mman; QMap custom_save_locations; // map to store save locations QMap add_to_groups; // Map to keep track of which group to add a torrent to quint32 sleep_suppression_cookie; QMap delayed_removal; bool exiting; bool reordering_queue; }; } #endif diff --git a/ktorrent/dialogs/addpeersdlg.cpp b/ktorrent/dialogs/addpeersdlg.cpp index 69fac549..e6c7bae3 100644 --- a/ktorrent/dialogs/addpeersdlg.cpp +++ b/ktorrent/dialogs/addpeersdlg.cpp @@ -1,73 +1,73 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include #include #include #include "addpeersdlg.h" namespace kt { class ManualPeerSource : public bt::PeerSource { public: ManualPeerSource() {} - ~ManualPeerSource() {} + ~ManualPeerSource() override {} void start() override {} void stop (bt::WaitJob*) override {} void add(const QString& ip, bt::Uint16 port) { addPeer(net::Address(ip, port), false); peersReady(this); } }; AddPeersDlg::AddPeersDlg(bt::TorrentInterface* tc, QWidget* parent) : QDialog(parent), tc(tc), mps(nullptr) { setupUi(this); connect(m_close, &QPushButton::clicked, this, &AddPeersDlg::reject); connect(m_add, &QPushButton::clicked, this, &AddPeersDlg::addPressed); KGuiItem::assign(m_close, KStandardGuiItem::close()); KGuiItem::assign(m_add, KStandardGuiItem::add()); mps = new ManualPeerSource(); tc->addPeerSource(mps); } AddPeersDlg::~AddPeersDlg() { tc->removePeerSource(mps); delete mps; } void AddPeersDlg::addPressed() { mps->add(m_ip->text(), m_port->value()); } } diff --git a/ktorrent/dialogs/addpeersdlg.h b/ktorrent/dialogs/addpeersdlg.h index f460ae3c..0a0e1ffe 100644 --- a/ktorrent/dialogs/addpeersdlg.h +++ b/ktorrent/dialogs/addpeersdlg.h @@ -1,58 +1,58 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTADDPEERSDLG_H #define KTADDPEERSDLG_H #include #include #include "ui_addpeersdlg.h" namespace bt { class TorrentInterface; } namespace kt { class ManualPeerSource; /** Dialog to manually add peers to a torrent */ class AddPeersDlg : public QDialog, public Ui_AddPeersDlg { Q_OBJECT public: AddPeersDlg(bt::TorrentInterface* tc, QWidget* parent); - ~AddPeersDlg(); + ~AddPeersDlg() override; private slots: void addPressed(); private: bt::TorrentInterface* tc; ManualPeerSource* mps; }; } #endif diff --git a/ktorrent/dialogs/fileselectdlg.h b/ktorrent/dialogs/fileselectdlg.h index dde6be37..1a1c63b6 100644 --- a/ktorrent/dialogs/fileselectdlg.h +++ b/ktorrent/dialogs/fileselectdlg.h @@ -1,117 +1,117 @@ /*************************************************************************** * Copyright (C) 2005-2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef FILESELECTDLG_H #define FILESELECTDLG_H #include #include #include #include #include "ui_fileselectdlg.h" namespace bt { class TorrentInterface; } namespace kt { class GroupManager; class QueueManager; class TorrentFileModel; class Group; /** * @author Joris Guisson * * Dialog to select which files to download from a multifile torrent. */ class FileSelectDlg : public QDialog, public Ui_FileSelectDlg { Q_OBJECT public: FileSelectDlg(kt::QueueManager* qman, kt::GroupManager* gman, const QString& group_hint, QWidget* parent); - ~FileSelectDlg(); + ~FileSelectDlg() override; int execute(bt::TorrentInterface* tc, bool* start, bool* skip_check, const QString& location_hint); /// Which group did the user select QString selectedGroup() const; /** * Load the state of the dialog */ void loadState(KSharedConfigPtr cfg); /** * Save the state of the dialog */ void saveState(KSharedConfigPtr cfg); protected slots: void reject() override; void accept() override; void selectAll(); void selectNone(); void invertSelection(); void updateSizeLabels(); void onCodecChanged(const QString& text); void groupActivated(int idx); void fileTree(bool on); void fileList(bool on); void setShowFileTree(bool on); void setFilter(const QString& filter); void updateExistingFiles(); void moveCompletedToggled(bool on); QMenu* createHistoryMenu(const QStringList& urls, const char* slot); void clearDownloadLocationHistory(); void clearMoveOnCompletionLocationHistory(); void downloadLocationHistoryTriggered(QAction* act); void moveOnCompletionLocationHistoryTriggered(QAction* act); void downloadLocationChanged(const QString& path); private: void populateFields(const QString& location_hint); void loadGroups(); private: bt::TorrentInterface* tc; TorrentFileModel* model; kt::QueueManager* qman; kt::GroupManager* gman; bool* start; bool* skip_check; QList encodings; kt::Group* initial_group; bool show_file_tree; QSortFilterProxyModel* filter_model; QStringList download_location_history; QStringList move_on_completion_location_history; bt::Uint64 already_downloaded; }; } #endif diff --git a/ktorrent/dialogs/importdialog.h b/ktorrent/dialogs/importdialog.h index d9b4be84..bc229238 100644 --- a/ktorrent/dialogs/importdialog.h +++ b/ktorrent/dialogs/importdialog.h @@ -1,81 +1,81 @@ /*************************************************************************** * Copyright (C) 2005-2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef IMPORTDIALOG_H #define IMPORTDIALOG_H #include #include #include #include "ui_importdialog.h" class KJob; namespace bt { class BitSet; class Torrent; class DataChecker; class DataCheckerThread; } namespace kt { class CoreInterface; class ImportDialog : public QDialog, public Ui_ImportDialog { Q_OBJECT public: ImportDialog(CoreInterface* core, QWidget* parent = 0); - ~ImportDialog(); + ~ImportDialog() override; public slots: void onImport(); void onTorrentGetReult(KJob* j); private slots: void progress(quint32 num, quint32 total); void finished(); void cancelImport(); private: void writeIndex(const QString& file, const bt::BitSet& chunks); void makeDirs(const QString& dnd_dir, const QString &data_url, const QString& fpath); void saveStats(const QString& stats_file, const QString &data_url, bt::Uint64 imported, bool custom_output_name); bt::Uint64 calcImportedBytes(const bt::BitSet& chunks, const bt::Torrent& tor); void saveFileInfo(const QString& file_info_file, QList & dnd); void saveFileMap(const bt::Torrent& tor, const QString& tor_dir); void saveFileMap(const QString& tor_dir, const QString& ddir); void import(); private: CoreInterface* core; bt::DataChecker* dc; bt::DataCheckerThread* dc_thread; bt::Torrent tor; bool canceled; }; } #endif diff --git a/ktorrent/dialogs/missingfilesdlg.h b/ktorrent/dialogs/missingfilesdlg.h index 4bb87375..676d2445 100644 --- a/ktorrent/dialogs/missingfilesdlg.h +++ b/ktorrent/dialogs/missingfilesdlg.h @@ -1,78 +1,78 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTMISSINGFILESDLG_H #define KTMISSINGFILESDLG_H #include #include "ui_missingfilesdlg.h" namespace bt { class TorrentInterface; } namespace kt { /** Dialog to show when files are missing. */ class MissingFilesDlg : public QDialog, public Ui_MissingFilesDlg { Q_OBJECT public: /** * Constructor * @param text Text to show above file list * @param missing The list of missing files * @param tc The torrent * @param parent The parent widget */ MissingFilesDlg(const QString& text, const QStringList& missing, bt::TorrentInterface* tc, QWidget* parent); - ~MissingFilesDlg(); + ~MissingFilesDlg() override; enum ReturnCode { RECREATE, DO_NOT_DOWNLOAD, CANCEL, NEW_LOCATION_SELECTED }; /** * Execute the dialog * @return What to do */ ReturnCode execute(); private slots: void dndPressed(); void recreatePressed(); void cancelPressed(); void selectNewPressed(); private: ReturnCode ret; bt::TorrentInterface* tc; }; } #endif diff --git a/ktorrent/dialogs/pastedialog.h b/ktorrent/dialogs/pastedialog.h index a6ab01ff..3effd491 100644 --- a/ktorrent/dialogs/pastedialog.h +++ b/ktorrent/dialogs/pastedialog.h @@ -1,65 +1,65 @@ /*************************************************************************** * Copyright (C) 2005 by Joris Guisson * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef PASTEDIALOG_H #define PASTEDIALOG_H #include #include #include "ui_pastedlgbase.h" namespace kt { class Core; /** * @author Ivan Vasic * @brief Torrent URL paste dialog **/ class PasteDialog: public QDialog, public Ui_PasteDlgBase { Q_OBJECT public: PasteDialog(Core* core, QWidget* parent = 0, Qt::WindowFlags fl = 0); - ~PasteDialog(); + ~PasteDialog() override; /** * Load the state of the dialog */ void loadState(KSharedConfig::Ptr cfg); /** * Save the state of the dialog */ void saveState(KSharedConfig::Ptr cfg); public slots: void accept() override; private: void loadGroups(); private: Core* m_core; }; } #endif diff --git a/ktorrent/dialogs/speedlimitsdlg.h b/ktorrent/dialogs/speedlimitsdlg.h index 8a3c2340..f9771de7 100644 --- a/ktorrent/dialogs/speedlimitsdlg.h +++ b/ktorrent/dialogs/speedlimitsdlg.h @@ -1,63 +1,63 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef SPEEDLIMITSDLG_H #define SPEEDLIMITSDLG_H #include #include "ui_speedlimitsdlg.h" namespace bt { class TorrentInterface; } namespace kt { class Core; class SpeedLimitsModel; /// Dialog to modify the speed limits of a torrent class SpeedLimitsDlg : public QDialog, public Ui_SpeedLimitsDlg { Q_OBJECT public: SpeedLimitsDlg(bt::TorrentInterface* current, Core* core, QWidget* parent); - ~SpeedLimitsDlg(); + ~SpeedLimitsDlg() override; protected slots: void accept() override; void reject() override; void apply(); void spinBoxValueChanged(int); void saveState(); void loadState(); private: Core* core; SpeedLimitsModel* model; bt::TorrentInterface* current; }; } #endif diff --git a/ktorrent/dialogs/speedlimitsmodel.h b/ktorrent/dialogs/speedlimitsmodel.h index b4928c00..b29bd0a4 100644 --- a/ktorrent/dialogs/speedlimitsmodel.h +++ b/ktorrent/dialogs/speedlimitsmodel.h @@ -1,84 +1,84 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTSPEEDLIMITSMODEL_H #define KTSPEEDLIMITSMODEL_H #include namespace bt { class TorrentInterface; } namespace kt { class Core; /** * Model for the SpeedLimitsDlg main list view */ class SpeedLimitsModel : public QAbstractTableModel { Q_OBJECT public: SpeedLimitsModel(Core* core, QObject* parent); - ~SpeedLimitsModel(); + ~SpeedLimitsModel() override; int rowCount(const QModelIndex& parent) const override; int columnCount(const QModelIndex& parent) const override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; QVariant data(const QModelIndex& index, int role) const override; bool setData(const QModelIndex& index, const QVariant& value, int role) override; Qt::ItemFlags flags(const QModelIndex& index) const override; void apply(); signals: void enableApply(bool on); private: bt::TorrentInterface* torrentForIndex(const QModelIndex& index) const; private slots: void onTorrentAdded(bt::TorrentInterface* tc); void onTorrentRemoved(bt::TorrentInterface* tc); private: struct Limits { bt::Uint32 up; bt::Uint32 up_original; bt::Uint32 down; bt::Uint32 down_original; bt::Uint32 assured_up; bt::Uint32 assured_up_original; bt::Uint32 assured_down; bt::Uint32 assured_down_original; }; Core* core; QMap limits; }; } #endif diff --git a/ktorrent/dialogs/spinboxdelegate.h b/ktorrent/dialogs/spinboxdelegate.h index c17645f3..055c9f4a 100644 --- a/ktorrent/dialogs/spinboxdelegate.h +++ b/ktorrent/dialogs/spinboxdelegate.h @@ -1,49 +1,49 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTSPINBOXDELEGATE_H #define KTSPINBOXDELEGATE_H #include namespace kt { /** @author */ class SpinBoxDelegate : public QItemDelegate { Q_OBJECT public: SpinBoxDelegate(QObject* parent = 0); - ~SpinBoxDelegate(); + ~SpinBoxDelegate() override; QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override; void setEditorData(QWidget* editor, const QModelIndex& index) const override; void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override; void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const override; QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override; }; } #endif diff --git a/ktorrent/dialogs/torrentcreatordlg.h b/ktorrent/dialogs/torrentcreatordlg.h index 12a1a433..7c46fd85 100644 --- a/ktorrent/dialogs/torrentcreatordlg.h +++ b/ktorrent/dialogs/torrentcreatordlg.h @@ -1,93 +1,93 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_TORRENTCREATORDLG_HH #define KT_TORRENTCREATORDLG_HH #include #include #include "ui_torrentcreatordlg.h" #include namespace kt { class StringCompletionModel; class Core; class GUI; /** * Dialog to create torrents with */ class TorrentCreatorDlg : public QDialog, public Ui_TorrentCreatorDlg { Q_OBJECT public: TorrentCreatorDlg(Core* core, GUI* gui, QWidget* parent); - ~TorrentCreatorDlg(); + ~TorrentCreatorDlg() override; private slots: void addTrackerPressed(); void removeTrackerPressed(); void moveUpPressed(); void moveDownPressed(); void addWebSeedPressed(); void removeWebSeedPressed(); void addNodePressed(); void removeNodePressed(); void dhtToggled(bool on); void nodeTextChanged(const QString& str); void nodeSelectionChanged(); void trackerTextChanged(const QString& str); void trackerSelectionChanged(); void webSeedTextChanged(const QString& str); void webSeedSelectionChanged(); void hashCalculationDone(); void updateProgressBar(); void accept() override; void reject() override; private: void loadGroups(); void loadCompleterData(); void setProgressBarEnabled(bool on); private: Core* core; GUI* gui; StringCompletionModel* tracker_completion; StringCompletionModel* webseeds_completion; StringCompletionModel* nodes_completion; bt::TorrentCreator* mktor; QTimer update_timer; }; } #endif diff --git a/ktorrent/groups/groupfiltermodel.h b/ktorrent/groups/groupfiltermodel.h index f5c0af65..1c970f40 100644 --- a/ktorrent/groups/groupfiltermodel.h +++ b/ktorrent/groups/groupfiltermodel.h @@ -1,63 +1,63 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTGROUPFILTERMODEL_H #define KTGROUPFILTERMODEL_H #include namespace kt { class Group; class ViewModel; /** Model to filter out torrents based upon group membership */ class GroupFilterModel : public QSortFilterProxyModel { Q_OBJECT public: GroupFilterModel(ViewModel* view_model, QObject* parent); - ~GroupFilterModel(); + ~GroupFilterModel() override; bool filterAcceptsColumn(int source_column, const QModelIndex& source_parent) const override; bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override; /** * Set the group to filter * @param g The Group * */ void setGroup(Group* g); /** * Filter again. */ void refilter(); private: Group* group; ViewModel* view_model; }; } #endif diff --git a/ktorrent/groups/grouppolicydlg.h b/ktorrent/groups/grouppolicydlg.h index ca8b3199..28e5cc4d 100644 --- a/ktorrent/groups/grouppolicydlg.h +++ b/ktorrent/groups/grouppolicydlg.h @@ -1,48 +1,48 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTGROUPPOLICYDLG_H #define KTGROUPPOLICYDLG_H #include #include "ui_grouppolicydlg.h" namespace kt { class Group; /** @author */ class GroupPolicyDlg : public QDialog, public Ui_GroupPolicyDlg { public: GroupPolicyDlg(Group* group, QWidget* parent); - ~GroupPolicyDlg(); + ~GroupPolicyDlg() override; void accept() override; private: Group* group; }; } #endif diff --git a/ktorrent/groups/groupswitcher.h b/ktorrent/groups/groupswitcher.h index 0cdb945d..f5097cfa 100644 --- a/ktorrent/groups/groupswitcher.h +++ b/ktorrent/groups/groupswitcher.h @@ -1,134 +1,134 @@ /*************************************************************************** * Copyright (C) 2012 by * * Joris Guisson * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_GROUPSWITCHER_H #define KT_GROUPSWITCHER_H #include #include #include #include class QToolButton; namespace kt { class View; class QueueManager; /** * toolbar to switch between groups */ class GroupSwitcher : public QWidget { Q_OBJECT public: GroupSwitcher(View* view, GroupManager* gman, QWidget* parent); - ~GroupSwitcher(); + ~GroupSwitcher() override; /** * Load state of widget from config * @param cfg The config **/ void loadState(KSharedConfig::Ptr cfg); /** * Save state of widget to config * @param cfg The config **/ void saveState(KSharedConfig::Ptr cfg); public slots: /** * Add a tab * @param group The group of the tab **/ void addTab(Group* group); /** * Add a new tab showing the all group. **/ void newTab(); /** * Close the current tab **/ void closeTab(); /** * An action was activated * @param action The action **/ void onActivated(QAction* action); /** * The current group has changed * @param group The new group **/ void currentGroupChanged(kt::Group* group); /** * Update the group count */ void updateGroupCount(); /** * A group has been removed * @param group The group **/ void groupRemoved(Group* group); /** * Edit the group policy **/ void editGroupPolicy(); private: struct Tab { Group* group; QAction* action; QByteArray view_settings; Tab(Group* group, QAction* action) : group(group), action(action) {} }; typedef QList TabList; TabList::iterator closeTab(TabList::iterator i); private: QToolButton* new_tab; QToolButton* close_tab; QToolButton* edit_group_policy; KToolBar* tool_bar; QActionGroup* action_group; GroupManager* gman; View* view; TabList tabs; int current_tab; }; } #endif // KT_GROUPSWITCHER_H diff --git a/ktorrent/groups/groupview.h b/ktorrent/groups/groupview.h index 913382de..027602cd 100644 --- a/ktorrent/groups/groupview.h +++ b/ktorrent/groups/groupview.h @@ -1,103 +1,103 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTGROUPVIEW_H #define KTGROUPVIEW_H #include #include #include "groupviewmodel.h" class QAction; class KActionCollection; namespace kt { class GUI; class Core; class View; class Group; class GroupView; class GroupManager; class View; /** @author Joris Guisson */ class GroupView : public QTreeView { Q_OBJECT public: GroupView(GroupManager* gman, View* view, Core* core, GUI* gui, QWidget* parent); - ~GroupView(); + ~GroupView() override; /// Save the status of the group view void saveState(KSharedConfigPtr cfg); /// Load status from config void loadState(KSharedConfigPtr cfg); /// Create a new group Group* addNewGroup(); /// Setup all the actions of the GroupView void setupActions(KActionCollection* col); public slots: /// Update the group count void updateGroupCount(); private slots: void onItemClicked(const QModelIndex& index); void showContextMenu(const QPoint& p); void addGroup(); void removeGroup(); void editGroupName(); void editGroupPolicy(); void openInNewTab(); signals: void currentGroupChanged(kt::Group* g); void openTab(Group* g); private: void keyPressEvent(QKeyEvent* event) override; private: GUI* gui; Core* core; View* view; GroupManager* gman; GroupViewModel* model; QAction * open_in_new_tab; QAction * new_group; QAction * edit_group; QAction * remove_group; QAction * edit_group_policy; friend class GroupViewItem; }; } #endif diff --git a/ktorrent/groups/groupviewmodel.h b/ktorrent/groups/groupviewmodel.h index 04324752..3ada41b2 100644 --- a/ktorrent/groups/groupviewmodel.h +++ b/ktorrent/groups/groupviewmodel.h @@ -1,111 +1,111 @@ /*************************************************************************** * Copyright (C) 2012 by * * Joris Guisson * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_GROUPVIEWMODEL_H #define KT_GROUPVIEWMODEL_H #include #include namespace kt { class GroupView; class View; class Group; class GroupManager; /** * Model for the GroupView **/ class GroupViewModel : public QAbstractItemModel { Q_OBJECT public: GroupViewModel(GroupManager* gman, View* view, QObject* parent); - ~GroupViewModel(); + ~GroupViewModel() override; bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; int columnCount(const QModelIndex& parent = QModelIndex()) const override; int rowCount(const QModelIndex& parent = QModelIndex()) const override; QModelIndex parent(const QModelIndex& child) const override; QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override; bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override; Qt::DropActions supportedDropActions() const override; Qt::ItemFlags flags(const QModelIndex& index) const override; QStringList mimeTypes() const override; bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override; /// Get the group given an index Group* groupForIndex(const QModelIndex& index) const; /// Get all the expanded groups QStringList expandedGroups(GroupView* gview); /// Expand all items in the tree which are in the groups list void expandGroups(GroupView* gview, const QStringList& groups); /// Update the group count void updateGroupCount(const QModelIndex& idx); private slots: void groupAdded(Group* g); void groupRemoved(Group* g); private: struct Item { Item(const QString& name, Item* parent, int row, GroupViewModel* model); void insert(const QString& name, const QString& p, const QModelIndex& idx); void insert(Group* g, const QModelIndex& idx); void remove(Group* g, const QModelIndex& idx); bool operator == (const QString& n) const; QVariant displayData(); QVariant decoration(); void expandedGroups(GroupView* gview, QStringList& groups, const QModelIndex& idx) const; void expandGroups(GroupView* gview, const QStringList& groups, const QModelIndex& idx); QString path() const; void dump(); QModelIndex findGroup(Group* g, const QModelIndex& idx); QString name; QString display_name; Item* parent; int row; Group* group; QList children; GroupViewModel* model; }; QModelIndex findGroup(Group* g); private: Item root; GroupManager* gman; View* view; }; } #endif // KT_GROUPVIEWMODEL_H diff --git a/ktorrent/gui.h b/ktorrent/gui.h index 6ef62fdb..ebeef2c1 100644 --- a/ktorrent/gui.h +++ b/ktorrent/gui.h @@ -1,148 +1,148 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_GUI_HH #define KT_GUI_HH #include #include #include #include #include class QAction; class KToggleAction; namespace kt { class Core; class PrefDialog; class StatusBar; class TrayIcon; class DBus; class TorrentActivity; class CentralWidget; class GUI : public KParts::MainWindow, public GUIInterface { Q_OBJECT public: GUI(); - ~GUI(); + ~GUI() override; DBus* getDBusInterface() {return dbus_iface;} // Stuff implemented from GUIInterface - KMainWindow* getMainWindow() {return this;} - void addPrefPage(PrefPageInterface* page); - void removePrefPage(PrefPageInterface* page); - void mergePluginGui(Plugin* p); - void removePluginGui(Plugin* p); - void errorMsg(const QString& err); - void errorMsg(KIO::Job* j); - void infoMsg(const QString& info); - StatusBarInterface* getStatusBar(); - void addActivity(Activity* act); - void removeActivity(Activity* act); - TorrentActivityInterface* getTorrentActivity(); - QSize sizeHint() const; - - bool event(QEvent *e); + KMainWindow* getMainWindow() override {return this;} + void addPrefPage(PrefPageInterface* page) override; + void removePrefPage(PrefPageInterface* page) override; + void mergePluginGui(Plugin* p) override; + void removePluginGui(Plugin* p) override; + void errorMsg(const QString& err) override; + void errorMsg(KIO::Job* j) override; + void infoMsg(const QString& info) override; + StatusBarInterface* getStatusBar() override; + void addActivity(Activity* act) override; + void removeActivity(Activity* act) override; + TorrentActivityInterface* getTorrentActivity() override; + QSize sizeHint() const override; + + bool event(QEvent *e) override; /** * Create a XML GUI container (menu or toolbar) * @param name The name of the item * @return The widget */ QWidget* container(const QString& name); /// load a torrent void load(const QUrl& url); /// load a torrent silently void loadSilently(const QUrl& url); public slots: /// Update all actions void updateActions(); /** * Enable or disable the paste action * @param on Set on */ void setPasteDisabled(bool on); /// Set the current activity - void setCurrentActivity(Activity* act); + void setCurrentActivity(Activity* act) override; private slots: void createTorrent(); void openTorrent(bool silently = false); void openTorrentSilently(){openTorrent(true);} void pasteURL(); void paste(); void showPrefDialog(); void showIPFilter(); void configureKeys(); - void configureToolbars(); + void configureToolbars() override; void newToolBarConfig(); void import(); void update(); /// apply gui specific settings void applySettings(); void showOrHide(); void configureNotifications(); void activePartChanged(KParts::Part* p); void quit(); private: void setupActions(); void loadState(KSharedConfigPtr cfg); void saveState(KSharedConfigPtr cfg); - bool queryClose(); + bool queryClose() override; private: Core* core; QTimer timer; kt::StatusBar* status_bar; TrayIcon* tray_icon; DBus* dbus_iface; TorrentActivity* torrent_activity; CentralWidget* central; PrefDialog* pref_dlg; KParts::PartManager* part_manager; KToggleAction* show_status_bar_action; KToggleAction* show_menu_bar_action; QAction * open_silently_action; QAction * paste_url_action; QAction * ipfilter_action; QAction * import_action; QAction * show_kt_action; QAction * paste_action; }; } #endif diff --git a/ktorrent/ipfilterlist.h b/ktorrent/ipfilterlist.h index cb91da21..1d7272d3 100644 --- a/ktorrent/ipfilterlist.h +++ b/ktorrent/ipfilterlist.h @@ -1,79 +1,79 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTIPFILTERLIST_H #define KTIPFILTERLIST_H #include #include #include #include namespace kt { /** Blocklist for the IPFilterWidget */ class IPFilterList : public QAbstractListModel, public bt::BlockListInterface { public: IPFilterList(); - ~IPFilterList(); + ~IPFilterList() override; bool blocked(const net::Address& addr) const override; /// Add an IP address with a mask. bool add(const QString& ip); /// Remove the IP address at a given row and count items following that void remove(int row, int count); /// Clear the list void clear(); int rowCount(const QModelIndex& parent = QModelIndex()) const override; QVariant data(const QModelIndex& index, int role) const override; bool setData(const QModelIndex& index, const QVariant& value, int role) override; bool insertRows(int row, int count, const QModelIndex& parent) override; bool removeRows(int row, int count, const QModelIndex& parent) override; Qt::ItemFlags flags(const QModelIndex& index) const override; private: bool addIP(const QString& str); bool addIPRange(const QString& str); bool parseIPWithWildcards(const QString& str, bt::Uint32& start, bt::Uint32& end); private: struct Entry { QString string_rep; bt::Uint32 start; bt::Uint32 end; }; QList ip_list; }; } #endif diff --git a/ktorrent/ipfilterwidget.h b/ktorrent/ipfilterwidget.h index 0b0069d8..2967f49c 100644 --- a/ktorrent/ipfilterwidget.h +++ b/ktorrent/ipfilterwidget.h @@ -1,65 +1,65 @@ /*************************************************************************** * Copyright (C) 2007 by Ivan Vasić * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef IPFILTERWIDGET_H #define IPFILTERWIDGET_H #include "ui_ipfilterwidget.h" #include namespace kt { class IPFilterList; /** * @author Ivan Vasic * @brief Integrated IPFilter GUI class. * Used to show, add and remove banned peers from blacklist. */ class IPFilterWidget: public QDialog, public Ui_IPFilterWidget { Q_OBJECT public: IPFilterWidget(QWidget* parent); - ~IPFilterWidget(); + ~IPFilterWidget() override; /// Register the filter list static void registerFilterList(); void saveFilter(const QString& fn); static void loadFilter(const QString& fn); public slots: void save(); - void open(); + void open() override; void clear(); void remove(); void add(); - void accept(); + void accept() override; private: void setupConnections(); static IPFilterList* filter_list; }; } #endif diff --git a/ktorrent/pref/advancedpref.h b/ktorrent/pref/advancedpref.h index 8dd3bc8f..f809387b 100644 --- a/ktorrent/pref/advancedpref.h +++ b/ktorrent/pref/advancedpref.h @@ -1,48 +1,48 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_ADVNACEDPREF_HH #define KT_ADVNACEDPREF_HH #include #include "ui_advancedpref.h" namespace kt { class AdvancedPref : public PrefPageInterface, public Ui_AdvancedPref { Q_OBJECT public: AdvancedPref(QWidget* parent); - ~AdvancedPref(); + ~AdvancedPref() override; void loadSettings() override; void loadDefaults() override; public slots: void onDiskPreallocToggled(bool on); }; } #endif // kate: indent-mode cstyle; indent-width 4; replace-tabs on; mixed-indent off; diff --git a/ktorrent/pref/btpref.h b/ktorrent/pref/btpref.h index 3114b30a..d2d954b5 100644 --- a/ktorrent/pref/btpref.h +++ b/ktorrent/pref/btpref.h @@ -1,41 +1,41 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_BTPREF_H #define KT_BTPREF_H #include #include "ui_btpref.h" namespace kt { class BTPref : public PrefPageInterface, public Ui_BTPref { Q_OBJECT public: BTPref(QWidget* parent); - ~BTPref(); + ~BTPref() override; void loadSettings() override; }; } #endif // KT_BTPREF_H diff --git a/ktorrent/pref/generalpref.h b/ktorrent/pref/generalpref.h index 6f4015ec..6ac6d77d 100644 --- a/ktorrent/pref/generalpref.h +++ b/ktorrent/pref/generalpref.h @@ -1,42 +1,42 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTGENERALPREF_H #define KTGENERALPREF_H #include #include "ui_generalpref.h" namespace kt { class GeneralPref : public PrefPageInterface, public Ui_GeneralPref { Q_OBJECT public: GeneralPref(QWidget* parent); - ~GeneralPref(); + ~GeneralPref() override; void loadSettings() override; void loadDefaults() override; }; } #endif diff --git a/ktorrent/pref/networkpref.h b/ktorrent/pref/networkpref.h index 38f64e1d..b0f7ae9c 100644 --- a/ktorrent/pref/networkpref.h +++ b/ktorrent/pref/networkpref.h @@ -1,54 +1,54 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTNETWORKPREF_H #define KTNETWORKPREF_H #include #include "ui_networkpref.h" namespace kt { /** Preference page for network settings. */ class NetworkPref : public PrefPageInterface, public Ui_NetworkPref { Q_OBJECT public: NetworkPref(QWidget* parent); - ~NetworkPref(); + ~NetworkPref() override; void loadSettings() override; void loadDefaults() override; void updateSettings() override; signals: void calculateRecommendedSettings(); private slots: void utpEnabled(bool on); void onlyUseUtpEnabled(bool on); }; } #endif diff --git a/ktorrent/pref/prefdialog.h b/ktorrent/pref/prefdialog.h index 16cbf198..dece1b9d 100644 --- a/ktorrent/pref/prefdialog.h +++ b/ktorrent/pref/prefdialog.h @@ -1,105 +1,105 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_PREFDIALOG_HH #define KT_PREFDIALOG_HH #include #include #include namespace kt { class Core; class PrefPageInterface; class NetworkPref; class QMPref; class PrefPageScrollArea; /** * KTorrent's preferences dialog, this uses the new KConfigDialog class which should make our live much easier. * In order for this to work properly the widgets have to be named kcfg_FOO where FOO is a somehting out of our settings class. * * The use of KConfigDialog should deprecate PrefPageInterface. * */ class PrefDialog : public KConfigDialog { Q_OBJECT public: PrefDialog(QWidget* parent, Core* core); - ~PrefDialog(); + ~PrefDialog() override; /** * Add a pref page to the dialog. * @param page The page * */ void addPrefPage(PrefPageInterface* page); /** * Remove a pref page. * @param page The page * */ void removePrefPage(PrefPageInterface* page); /** * Update the widgets and show */ void updateWidgetsAndShow(); /** * Load the state of the dialog */ void loadState(KSharedConfigPtr cfg); /** * Save the state of the dialog */ void saveState(KSharedConfigPtr cfg); protected: void updateWidgets() override; void updateWidgetsDefault() override; void updateSettings() override; bool hasChanged() override; private slots: void calculateRecommendedSettings(); private: QList pages; NetworkPref* net_pref; QMPref* qm_pref; }; class PrefPageScrollArea : public QScrollArea { public: PrefPageScrollArea(PrefPageInterface* page, QWidget* parent = 0); - ~PrefPageScrollArea(); + ~PrefPageScrollArea() override; PrefPageInterface* page; KPageWidgetItem* page_widget_item; }; } #endif diff --git a/ktorrent/pref/proxypref.h b/ktorrent/pref/proxypref.h index 52db832f..ef96a922 100644 --- a/ktorrent/pref/proxypref.h +++ b/ktorrent/pref/proxypref.h @@ -1,51 +1,51 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTPROXYPREF_H #define KTPROXYPREF_H #include #include "ui_proxypref.h" namespace kt { /** @author */ class ProxyPref : public PrefPageInterface, public Ui_ProxyPref { Q_OBJECT public: ProxyPref(QWidget* parent); - ~ProxyPref(); + ~ProxyPref() override; void loadDefaults() override; void loadSettings() override; void updateSettings() override; private slots: void socksEnabledToggled(bool on); void usernamePasswordToggled(bool on); }; } #endif diff --git a/ktorrent/pref/qmpref.h b/ktorrent/pref/qmpref.h index deabb7d7..14ad25a8 100644 --- a/ktorrent/pref/qmpref.h +++ b/ktorrent/pref/qmpref.h @@ -1,48 +1,48 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTQMPREF_H #define KTQMPREF_H #include #include "ui_qmpref.h" namespace kt { /** Preference page for the queue manager */ class QMPref : public PrefPageInterface, public Ui_QMPref { Q_OBJECT public: QMPref(QWidget* parent); - ~QMPref(); + ~QMPref() override; void loadSettings() override; void loadDefaults() override; private slots: void onControlTorrentsManuallyToggled(bool on); }; } #endif diff --git a/ktorrent/pref/recommendedsettingsdlg.h b/ktorrent/pref/recommendedsettingsdlg.h index 82c3d094..d30f7829 100644 --- a/ktorrent/pref/recommendedsettingsdlg.h +++ b/ktorrent/pref/recommendedsettingsdlg.h @@ -1,67 +1,67 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTRECOMMENDEDSETTINGSDLG_H #define KTRECOMMENDEDSETTINGSDLG_H #include #include #include "ui_recommendedsettingsdlg.h" namespace kt { /** Dialog to compute the best settings */ class RecommendedSettingsDlg : public QDialog, public Ui_RecommendedSettingsDlg { Q_OBJECT public: RecommendedSettingsDlg(QWidget* parent); - ~RecommendedSettingsDlg(); + ~RecommendedSettingsDlg() override; private slots: void calculate(); void apply(); void avgSpeedSlotToggled(bool on); void simTorrentsToggled(bool on); void slotsToggled(bool on); void uploadBWChanged(int val); void downloadBWChanged(int val); private: void saveState(KSharedConfigPtr cfg); void loadState(KSharedConfigPtr cfg); public: bt::Uint32 max_upload_speed; bt::Uint32 max_download_speed; bt::Uint32 max_conn_tor; bt::Uint32 max_conn_glob; bt::Uint32 max_downloads; bt::Uint32 max_seeds; bt::Uint32 max_slots; }; } #endif diff --git a/ktorrent/statusbar.h b/ktorrent/statusbar.h index 33c7988d..f0e2d002 100644 --- a/ktorrent/statusbar.h +++ b/ktorrent/statusbar.h @@ -1,82 +1,82 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_STATUSBAR_HH #define KT_STATUSBAR_HH #include #include #include class QLabel; namespace dht { struct Stats; } namespace kt { /** * Class which handles the statusbar * */ class StatusBar : public QStatusBar, public StatusBarInterface { Q_OBJECT public: StatusBar(QWidget* parent); - ~StatusBar(); + ~StatusBar() override; /// Update the speed info of the status bar (speeds are in bytes per sec) void updateSpeed(bt::Uint32 up, bt::Uint32 down); /// Update the number of bytes tranfered void updateTransfer(bt::Uint64 up, bt::Uint64 down); /// Update the DHT stats void updateDHTStatus(bool on, const dht::Stats& s); /// Create a progress bar and put it on the right side of the statusbar QProgressBar* createProgressBar() override; /// Remove a progress bar created with createProgressBar void removeProgressBar(QProgressBar* pb) override; public slots: /// Show an information message void message(const QString& msg) override; private: QLabel* speed; bt::Uint32 up_speed; bt::Uint32 down_speed; QLabel* transfer; bt::Uint64 up_transfer; bt::Uint64 down_transfer; QLabel* dht_status; bt::Uint32 dht_peers; bt::Uint32 dht_tasks; bool dht_on; }; } #endif diff --git a/ktorrent/tools/magnetmodel.h b/ktorrent/tools/magnetmodel.h index 67f89f46..34a9e65f 100644 --- a/ktorrent/tools/magnetmodel.h +++ b/ktorrent/tools/magnetmodel.h @@ -1,77 +1,77 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_MAGNETMODEL_H #define KT_MAGNETMODEL_H #include #include #include namespace bt { class MagnetDownloader; } namespace kt { class MagnetManager; class MagnetModel : public QAbstractTableModel { Q_OBJECT public: MagnetModel(MagnetManager *magnetManager, QObject* parent = 0); - ~MagnetModel(); + ~MagnetModel() override; /// Remove a magnet downloader void removeMagnets(int row, int count); /// Start a magnet downloader void start(int row, int count); /// Stop a magnet downloader void stop(int row, int count); /// Check if the magnet downloader that correspond to row is stopped bool isStopped(int row) const; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; int columnCount(const QModelIndex& parent = QModelIndex()) const override; int rowCount(const QModelIndex& parent = QModelIndex()) const override; bool removeRows(int row, int count, const QModelIndex& parent) override; bool insertRows(int row, int count, const QModelIndex& parent) override; public slots: void onUpdateQueue(bt::Uint32 idx, bt::Uint32 count); private: QString displayName(const bt::MagnetDownloader* md) const; QString status(int row) const; private: int currentRows; QPointer mman; }; } #endif // KT_MAGNETMODEL_H diff --git a/ktorrent/tools/magnetview.h b/ktorrent/tools/magnetview.h index 25514209..d85ee8e9 100644 --- a/ktorrent/tools/magnetview.h +++ b/ktorrent/tools/magnetview.h @@ -1,71 +1,71 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_MAGNETVIEW_H #define KT_MAGNETVIEW_H #include #include class QItemSelection; class QToolBar; class QTreeView; class QMenu; namespace kt { class MagnetManager; class MagnetModel; /** View which displays a list of magnet links being downloaded */ class MagnetView : public QWidget { Q_OBJECT public: MagnetView(MagnetManager* magnetManager, QWidget* parent = 0); - ~MagnetView(); + ~MagnetView() override; void saveState(KSharedConfigPtr cfg); void loadState(KSharedConfigPtr cfg); void keyPressEvent(QKeyEvent* event) override; private slots: void showContextMenu(QPoint p); void removeMagnetDownload(); void startMagnetDownload(); void stopMagnetDownload(); private: MagnetManager* mman; MagnetModel* model; QTreeView* view; QMenu* menu; QAction* start; QAction* stop; QAction* remove; }; } #endif // KT_MAGNETVIEW_H diff --git a/ktorrent/tools/queuemanagermodel.h b/ktorrent/tools/queuemanagermodel.h index c6d8009e..ec580076 100644 --- a/ktorrent/tools/queuemanagermodel.h +++ b/ktorrent/tools/queuemanagermodel.h @@ -1,145 +1,145 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTQUEUEMANAGERMODEL_H #define KTQUEUEMANAGERMODEL_H #include #include #include class QMimeData; namespace bt { class TorrentInterface; } namespace kt { class QueueManager; /** * @author Joris Guisson * * Model for the QM */ class QueueManagerModel : public QAbstractTableModel { Q_OBJECT public: QueueManagerModel(QueueManager* qman, QObject* parent); - ~QueueManagerModel(); + ~QueueManagerModel() override; void setShowUploads(bool on); void setShowDownloads(bool on); void setShowNotQueued(bool on); int rowCount(const QModelIndex& parent) const override; int columnCount(const QModelIndex& parent) const override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; QVariant data(const QModelIndex& index, int role) const override; bool removeRows(int row, int count, const QModelIndex& parent) override; bool insertRows(int row, int count, const QModelIndex& parent) override; Qt::ItemFlags flags(const QModelIndex& index) const override; Qt::DropActions supportedDropActions() const override; QStringList mimeTypes() const override; QMimeData* mimeData(const QModelIndexList& indexes) const override; bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override; /** * Move items one row up * @param row The row of the item * @param count The number of items to move */ void moveUp(int row, int count); /** * Move items one row down * @param row The row of the item * @param count The number of items to move */ void moveDown(int row, int count); /** * Move items to the top * @param row The row of the item * @param count The number of items to move */ void moveTop(int row, int count); /** * Move items to the bottom * @param row The row of the item * @param count The number of items to move */ void moveBottom(int row, int count); /** * Update the model */ void update(); /** Given a search text find a matching torrent */ QModelIndex find(const QString& text); public slots: void onTorrentAdded(bt::TorrentInterface* tc); void onTorrentRemoved(bt::TorrentInterface* tc); void onQueueOrdered(); void onTorrentStatusChanged(bt::TorrentInterface* tc); private: struct Item { bt::TorrentInterface* tc; bt::Int64 stalled_time; bool operator < (const Item& item) const { return tc->getPriority() < item.tc->getPriority(); } }; bool visible(const bt::TorrentInterface* tc); void updateQueue(); void swapItems(int a, int b); void dumpQueue(); void updatePriorities(); void softReset(); private: QueueManager* qman; QList queue; mutable QList dragged_items; QString search_text; bool show_uploads; bool show_downloads; bool show_not_queud; }; } #endif diff --git a/ktorrent/tools/queuemanagerwidget.h b/ktorrent/tools/queuemanagerwidget.h index 93326028..ce2c2d68 100644 --- a/ktorrent/tools/queuemanagerwidget.h +++ b/ktorrent/tools/queuemanagerwidget.h @@ -1,102 +1,102 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTQUEUEMANAGERWIDGET_H #define KTQUEUEMANAGERWIDGET_H #include #include class QItemSelection; class QModelIndex; class QToolBar; class QTreeView; class QLineEdit; namespace bt { class TorrentInterface; } namespace kt { class QueueManager; class QueueManagerModel; /** * @author Joris Guisson * * Widget for the QueueManager */ class QueueManagerWidget : public QWidget { Q_OBJECT public: QueueManagerWidget(QueueManager* qman, QWidget* parent); - ~QueueManagerWidget(); + ~QueueManagerWidget() override; /// Save the widget state void saveState(KSharedConfigPtr cfg); /// Load the widget state void loadState(KSharedConfigPtr cfg); /// Update the widget void update(); public slots: void onTorrentAdded(bt::TorrentInterface* tc); void onTorrentRemoved(bt::TorrentInterface* tc); private slots: void moveUpClicked(); void moveDownClicked(); void moveTopClicked(); void moveBottomClicked(); void searchTextChanged(const QString& t); void showSearch(bool on); void showDownloads(bool on); void showUploads(bool on); void showNotQueued(bool on); void selectionChanged(const QItemSelection& selected, const QItemSelection& deselected); private: bool indexVisible(const QModelIndex& idx); void updateButtons(); private: QueueManagerModel* model; QueueManager* qman; QTreeView* view; QToolBar* toolbar; QLineEdit* search; QAction* show_search; QAction* move_top; QAction* move_up; QAction* move_down; QAction* move_bottom; QAction* show_uploads; QAction* show_downloads; QAction* show_not_queued; }; } #endif diff --git a/ktorrent/torrentactivity.h b/ktorrent/torrentactivity.h index 01d3f78f..3d61da97 100644 --- a/ktorrent/torrentactivity.h +++ b/ktorrent/torrentactivity.h @@ -1,118 +1,118 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef TORRENTACTIVITY_H #define TORRENTACTIVITY_H #include #include class QAction; class KToggleAction; class KComboBox; namespace kt { class MagnetView; class GUI; class Core; class View; class GroupView; class QueueManagerWidget; class TabBarWidget; class Group; class TorrentSearchBar; class GroupSwitcher; /** * Activity which manages torrents. */ class TorrentActivity : public TorrentActivityInterface { Q_OBJECT public: TorrentActivity(Core* core, GUI* gui, QWidget* parent); - ~TorrentActivity(); + ~TorrentActivity() override; /// Get the group view GroupView* getGroupView() {return group_view;} void loadState(KSharedConfigPtr cfg); void saveState(KSharedConfigPtr cfg); const bt::TorrentInterface* getCurrentTorrent() const override; bt::TorrentInterface* getCurrentTorrent() override; void updateActions() override; void addToolWidget(QWidget* widget, const QString& text, const QString& icon, const QString& tooltip) override; void removeToolWidget(QWidget* widget) override; Group* addNewGroup() override; /// Update the activity void update(); /// Setup all actions void setupActions(); public slots: /** * Called by the ViewManager when the current torrent has changed * @param tc The torrent * */ void currentTorrentChanged(bt::TorrentInterface* tc); /** Hide or show the group view */ void setGroupViewVisible(bool visible); /** * The suspended state has changed * @param suspended */ void onSuspendedStateChanged(bool suspended); private slots: void startAllTorrents(); void stopAllTorrents(); void suspendQueue(bool suspend); void queueOrdered(); private: Core* core; GUI* gui; View* view; GroupView* group_view; GroupSwitcher* group_switcher; QueueManagerWidget* qm; QSplitter* hsplit; QSplitter* vsplit; TabBarWidget* tool_views; MagnetView* magnet_view; TorrentSearchBar* search_bar; QAction * start_all_action; QAction * stop_all_action; KToggleAction* queue_suspend_action; QAction * show_group_view_action; QAction * filter_torrent_action; }; } #endif // TORRENTACTIVITY_H diff --git a/ktorrent/trayicon.h b/ktorrent/trayicon.h index 1fbd5daf..41cd3491 100644 --- a/ktorrent/trayicon.h +++ b/ktorrent/trayicon.h @@ -1,196 +1,196 @@ /*************************************************************************** * Copyright (C) 2005-2007 by * * Joris Guisson * * Ivan Vasic * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef TRAYICON_H #define TRAYICON_H #include #include #include #include using namespace bt; class QString; namespace kt { struct CurrentStats; class Core; class SetMaxRate; class GUI; struct TrayStats { bt::Uint32 download_speed; bt::Uint32 upload_speed; bt::Uint64 bytes_downloaded; bt::Uint64 bytes_uploaded; }; /** * @author Joris Guisson * @author Ivan Vasic */ class TrayIcon : public QObject { Q_OBJECT public: TrayIcon(Core* tc, GUI* parent); - ~TrayIcon(); + ~TrayIcon() override; /// Update stats for system tray icon void updateStats(const CurrentStats& stats); /// Update the max rate menus void updateMaxRateMenus(); /// Show the icon void show(); /// Hide the icon void hide(); /// Get the co QMenu* contextMenu(); private: void showPassivePopup(const QString& msg, const QString& titile); private slots: /** * Show a passive popup, that a torrent has been silently added. * @param tc The torrent */ void torrentSilentlyOpened(bt::TorrentInterface* tc); /** * Show a passive popup, that the torrent has stopped downloading. * @param tc The torrent */ void finished(bt::TorrentInterface* tc); /** * Show a passive popup that a torrent has reached it's max share ratio. * @param tc The torrent */ void maxShareRatioReached(bt::TorrentInterface* tc); /** * Show a passive popup that a torrent has reached it's max seed time * @param tc The torrent */ void maxSeedTimeReached(bt::TorrentInterface* tc); /** * Show a passive popup when a torrent has been stopped by an error. * @param tc The torrent * @param msg Error message */ void torrentStoppedByError(bt::TorrentInterface* tc, QString msg); /** * Corrupted data has been found. * @param tc The torrent */ void corruptedData(bt::TorrentInterface* tc); /** * User tried to enqueue a torrent that has reached max share ratio or max seed time * Show passive popup message. */ void queuingNotPossible(bt::TorrentInterface* tc); /** * We failed to start a torrent * @param tc The torrent * @param reason The reason it failed */ void canNotStart(bt::TorrentInterface* tc, bt::TorrentStartResponse reason); ///Shows passive popup message void lowDiskSpace(bt::TorrentInterface* tc, bool stopped); /** * A torrent could not be loaded silently. * @param msg Message to show */ void cannotLoadTorrentSilently(const QString& msg); /** The QM changes suspended state. */ void suspendStateChanged(bool suspended); /** Show a warning message */ void dhtNotEnabled(const QString& msg); private slots: void secondaryActivate(const QPoint& pos); private: Core* core; GUI* mwnd; int previousDownloadHeight; int previousUploadHeight; SetMaxRate* max_upload_rate; SetMaxRate* max_download_rate; KStatusNotifierItem* status_notifier_item; bool queue_suspended; QMenu* menu; }; class SetMaxRate : public QMenu { Q_OBJECT public: enum Type { UPLOAD, DOWNLOAD }; SetMaxRate(Core* tc, Type t, QWidget* parent); - ~SetMaxRate(); + ~SetMaxRate() override; public slots: void update(); private: void makeMenu(); private slots: void onTriggered(QAction* act); private: Core* m_core; Type type; QAction* unlimited; }; } #endif diff --git a/ktorrent/view/propertiesdlg.h b/ktorrent/view/propertiesdlg.h index fba7dc04..6f2a91df 100644 --- a/ktorrent/view/propertiesdlg.h +++ b/ktorrent/view/propertiesdlg.h @@ -1,56 +1,56 @@ /*************************************************************************** * Copyright (C) 2010 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_PROPERTIESDLG_H #define KT_PROPERTIESDLG_H #include #include "ui_propertiesdlg.h" namespace bt { class TorrentInterface; } namespace kt { /** Extender which shows properties about a torrent. */ class PropertiesDlg : public QDialog, public Ui_PropertiesDlg { Q_OBJECT public: PropertiesDlg(bt::TorrentInterface* tc, QWidget* parent); - ~PropertiesDlg(); + ~PropertiesDlg() override; public slots: void moveOnCompletionEnabled(bool on); private: void accept() override; private: bt::TorrentInterface* tc; }; } #endif // KT_PROPERTIESEXTENDER_H diff --git a/ktorrent/view/scanextender.h b/ktorrent/view/scanextender.h index a3d163ff..ed8a29e1 100644 --- a/ktorrent/view/scanextender.h +++ b/ktorrent/view/scanextender.h @@ -1,65 +1,65 @@ /*************************************************************************** * Copyright (C) 2009 by * * Joris Guisson * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_SCANEXTENDER_H #define KT_SCANEXTENDER_H #include #include #include #include "ui_scanextender.h" namespace bt { class TorrentInterface; } namespace kt { /** Extender widget which displays the results of a data scan */ class ScanExtender : public JobProgressWidget, public Ui_ScanExtender { Q_OBJECT public: ScanExtender(bt::Job* job, QWidget* parent); - ~ScanExtender(); + ~ScanExtender() override; void description(const QString& title, const QPair< QString, QString >& field1, const QPair< QString, QString >& field2) override; void infoMessage(const QString& plain, const QString& rich) override; void warning(const QString& plain, const QString& rich) override; void percent(long unsigned int percent) override; void speed(long unsigned int value) override; void processedAmount(KJob::Unit unit, qulonglong amount) override; void totalAmount(KJob::Unit unit, qulonglong amount) override; bool similar(Extender* ext) const override; private slots: void cancelPressed(); void finished(KJob* j); void closeRequested(); }; } #endif // KT_SCANEXTENDER_H diff --git a/ktorrent/view/torrentsearchbar.h b/ktorrent/view/torrentsearchbar.h index 7232cb47..f9ca9e2f 100644 --- a/ktorrent/view/torrentsearchbar.h +++ b/ktorrent/view/torrentsearchbar.h @@ -1,64 +1,64 @@ /*************************************************************************** * Copyright (C) 2011 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_TORRENTSEARCHBAR_H #define KT_TORRENTSEARCHBAR_H #include #include #include #include namespace kt { class View; /** * Search bar widget for torrents. */ class TorrentSearchBar : public QWidget { Q_OBJECT public: TorrentSearchBar(View* view, QWidget* parent); - ~TorrentSearchBar(); + ~TorrentSearchBar() override; void loadState(KSharedConfigPtr cfg); void saveState(KSharedConfigPtr cfg); public slots: void showBar(); void hideBar(); signals: void filterBarHidden(QString str); void filterBarShown(QString str); protected: bool eventFilter(QObject* obj, QEvent* ev) override; private: QToolButton* hide_search_bar; QLineEdit* search_bar; }; } #endif // KT_TORRENTSEARCHBAR_H diff --git a/ktorrent/view/view.h b/ktorrent/view/view.h index 0c7828c9..66582fa2 100644 --- a/ktorrent/view/view.h +++ b/ktorrent/view/view.h @@ -1,215 +1,215 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTVIEW_HH #define KTVIEW_HH #include #include #include #include #include class QMenu; class QAction; class KActionCollection; namespace kt { class GUI; class Extender; class Core; class ViewModel; class ViewSelectionModel; class ViewDelegate; class Group; class View : public QTreeView { Q_OBJECT public: View(Core* core, GUI* gui, QWidget* parent); - ~View(); + ~View() override; /// Setup the actions of the view manager void setupActions(KActionCollection* ac); /// Update all actions void updateActions(); /** * Get the view model * @return The ViewModel of this View */ ViewModel* viewModel() {return model;} /** * Set the group to show in this view * @param g The Group * */ void setGroup(Group* g); /// Get the current group Group* getCurrentGroup() const {return group;} /** * Put the current selection in a list. * @param sel The list to put it in */ void getSelection(QList & sel); /// Get the current group const Group* getGroup() const {return group;} /// Restore the view state void restoreState(const QByteArray& state); /// Get the current torrent bt::TorrentInterface* getCurrentTorrent(); /// Get the number of torrents bt::Uint32 numTorrents() const {return num_torrents;}; /// Get the number of running torrents bt::Uint32 numRunningTorrents() const {return num_running;} void closeEditor(QWidget* editor, QAbstractItemDelegate::EndEditHint hint) override; bool edit(const QModelIndex& index, EditTrigger trigger, QEvent* event) override; /// Get the ViewDelegate ViewDelegate* viewDelegate() {return delegate;} /// Extend a widget void extend(bt::TorrentInterface* tc, Extender* widget, bool close_similar); /// Get the default state const QByteArray& defaultState() const {return default_state;} void keyPressEvent(QKeyEvent* event) override; public slots: /// Set the filter string void setFilterString(const QString& filter); /// Update all items in the view void update(); void startTorrents(); void forceStartTorrents(); void stopTorrents(); void pauseTorrents(); void removeTorrents(); void removeTorrentsAndData(); void startAllTorrents(); void stopAllTorrents(); void checkData(); void addPeers(); void manualAnnounce(); void previewTorrents(); void openDataDir(); void openTorDir(); void removeFromGroup(); void scrape(); void moveData(); void showProperties(); void renameTorrent(); void showMenu(const QPoint& pos); void showHeaderMenu(const QPoint& pos); void onHeaderMenuItemTriggered(QAction* act); void onCurrentItemChanged(const QModelIndex& current, const QModelIndex& previous); void onSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected); void onDoubleClicked(const QModelIndex& index); void onCurrentGroupChanged(kt::Group* g); void onGroupRenamed(Group* g); void onGroupRemoved(Group* g); void onGroupAdded(Group* g); /// An item in the groups menu was triggered void addToGroupItemTriggered(); /// Copy the torrent URL to the clipboard void copyTorrentURL(); /// Show the speed limits dialog void speedLimits(); /// Export a torrent void exportTorrent(); /// Add a new group and add the current selection to it void addToNewGroup(); signals: void currentTorrentChanged(bt::TorrentInterface* tc); void torrentSelectionChanged(); void editingItem(bool on); private: Core* core; GUI* gui; Group* group; QMenu* header_menu; QMap column_idx_map; QList column_action_list; bt::Uint32 num_torrents; bt::Uint32 num_running; ViewModel* model; ViewSelectionModel* selection_model; ViewDelegate* delegate; QMap data_scan_extenders; QByteArray default_state; // actions for the view menu QAction * start_torrent; QAction * force_start_torrent; QAction * start_all; QAction * stop_torrent; QAction * stop_all; QAction * pause_torrent; QAction * unpause_torrent; QAction * remove_torrent; QAction * remove_torrent_and_data; QAction * add_peers; QAction * manual_announce; QAction * do_scrape; QAction * preview; QAction * data_dir; QAction * tor_dir; QAction * move_data; QAction * torrent_properties; QAction * rename_torrent; QAction * remove_from_group; QMap group_actions; QAction * add_to_new_group; QAction * check_data; QAction * open_dir_menu; QAction * groups_menu; QAction * copy_url; QAction * export_torrent; QList configure_columns_list; QAction * speed_limits; }; } #endif diff --git a/ktorrent/view/viewdelegate.h b/ktorrent/view/viewdelegate.h index b5c22d0e..b92edb67 100644 --- a/ktorrent/view/viewdelegate.h +++ b/ktorrent/view/viewdelegate.h @@ -1,129 +1,129 @@ /*************************************************************************** * Copyright (C) 2009 by * * Joris Guisson * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_VIEWDELEGATE_H #define KT_VIEWDELEGATE_H #include #include class QVBoxLayout; namespace bt { class TorrentInterface; } namespace kt { class ViewModel; class View; class Core; class Extender; /** Box which contains all the extenders of a widget */ class ExtenderBox : public QWidget { public: ExtenderBox(QWidget* widget); - ~ExtenderBox(); + ~ExtenderBox() override; /// Add an Extender void add(Extender* ext); /// Remove an Extender void remove(Extender* ext); /// Remove extenders similar to ext void removeSimilar(Extender* ext); /// Clear all extenders void clear(); /// Get the number of extenders int count() const {return extenders.count();} private: QVBoxLayout* layout; QList extenders; }; /** Item delegate which keeps track of of ScanExtenders */ class ViewDelegate : public QStyledItemDelegate { Q_OBJECT public: ViewDelegate(Core* core, ViewModel* model, View* parent); - ~ViewDelegate(); + ~ViewDelegate() override; /** Extend a torrent with a widget */ void extend(bt::TorrentInterface* tc, Extender* widget, bool close_similar); QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override; void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override; void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const override; /** * Close all extenders and delete all extender widgets. */ void contractAll(); /// Is an extender being shown for a torrent bool extended(bt::TorrentInterface* tc) const; /// Hide the extender for a torrent void hideExtender(bt::TorrentInterface* tc); /// Does the delegate have extenders bool hasExtenders() const {return !extenders.isEmpty();} public slots: /// Close all the extenders of a torrent void closeExtenders(bt::TorrentInterface* tc); void closeExtender(bt::TorrentInterface* tc, Extender* ext); private slots: void torrentRemoved(bt::TorrentInterface* tc); void closeRequested(Extender* ext); void resized(Extender* ext); private: QSize maybeExtendedSize(const QStyleOptionViewItem& option, const QModelIndex& index) const; QRect extenderRect(QWidget* extender, const QStyleOptionViewItem& option, const QModelIndex& index) const; void scheduleUpdateViewLayout(); void paintProgressBar(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const; void normalPaint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const; private: ViewModel* model; QMap extenders; typedef QMap::iterator ExtItr; typedef QMap::const_iterator ExtCItr; }; } #endif // KT_VIEWDELEGATE_H diff --git a/ktorrent/view/viewjobtracker.h b/ktorrent/view/viewjobtracker.h index acab3b8a..ff9c2129 100644 --- a/ktorrent/view/viewjobtracker.h +++ b/ktorrent/view/viewjobtracker.h @@ -1,53 +1,53 @@ /*************************************************************************** * Copyright (C) 2011 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_VIEWJOBTRACKER_H #define KT_VIEWJOBTRACKER_H #include namespace kt { class ScanExtender; class View; /** JobTracker for the View */ class ViewJobTracker : public kt::JobTracker { Q_OBJECT public: ViewJobTracker(View* parent); - ~ViewJobTracker(); + ~ViewJobTracker() override; void jobUnregistered(bt::Job* j) override; void jobRegistered(bt::Job* j) override; kt::JobProgressWidget* createJobWidget(bt::Job* job) override; private: View* view; }; } #endif // KT_VIEWJOBTRACKER_H diff --git a/ktorrent/view/viewmodel.h b/ktorrent/view/viewmodel.h index 11217508..d4e0a648 100644 --- a/ktorrent/view/viewmodel.h +++ b/ktorrent/view/viewmodel.h @@ -1,219 +1,219 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTVIEWMODEL_H #define KTVIEWMODEL_H #include #include #include namespace kt { class View; class ViewDelegate; class Core; class Group; /** * @author Joris Guisson * * Model for the main torrent view */ class ViewModel : public QAbstractTableModel { Q_OBJECT public: ViewModel(Core* core, View* parent); - ~ViewModel(); + ~ViewModel() override; /** * Set the Group to filter * @param g The group */ void setGroup(Group* g); /** * Update the model, checks if data has changed. $ @param delegate The ViewDelegate, so we don't hide extended items * @param force_resort Force a resort * @return true if the model got resorted */ bool update(ViewDelegate* delegate, bool force_resort = false); /** * Set the current filter string * @param filter The filter string */ void setFilterString(const QString& filter); int rowCount(const QModelIndex& parent = QModelIndex()) const override; int columnCount(const QModelIndex& parent = QModelIndex()) const override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; QVariant data(const QModelIndex& index, int role) const override; bool removeRows(int row, int count, const QModelIndex& parent) override; bool insertRows(int row, int count, const QModelIndex& parent) override; Qt::ItemFlags flags(const QModelIndex& index) const override; QStringList mimeTypes() const override; QMimeData* mimeData(const QModelIndexList& indexes) const override; bool setData(const QModelIndex& index, const QVariant& value, int role) override; QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override; bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override; Qt::DropActions supportedDropActions() const override; /** * Emit the data changed signal * @param row The row * @param col The column */ void emitDataChanged(int row, int col); /** * Get a list of torrents from an index list. * @param idx The index list * @param tlist The torrent list to fill */ void torrentsFromIndexList(const QModelIndexList& idx, QList & tlist); /** * Get a torrent from a model index. * @param index The model index * @return The torrent if the index is valid and in the proper range, 0 otherwise */ const bt::TorrentInterface* torrentFromIndex(const QModelIndex& index) const; /** * Get a torrent from a model index. * @param index The model index * @return The torrent if the index is valid and in the proper range, 0 otherwise */ bt::TorrentInterface* torrentFromIndex(const QModelIndex& index); /** * Get a torrent from a row. * @param index The row index * @return The torrent if the index is valid and in the proper range, 0 otherwise */ bt::TorrentInterface* torrentFromRow(int index); /** * Get all torrents * @param tlist The list of torrents to fill */ void allTorrents(QList & tlist) const; /** * Visit all visible torrents in the model, and apply an action to them */ template void visit(Action& a) { for (Item* item : qAsConst(torrents)) { if (item->visible(group, filter_string)) if (!a(item->tc)) break; } } /// Get the list of indexes which need to be updated const QModelIndexList& updateList() const {return update_list;} public slots: void addTorrent(bt::TorrentInterface* ti); void removeTorrent(bt::TorrentInterface* ti); void sort(int col, Qt::SortOrder order) override; void onExit(); signals: void sorted(); public: enum Column { NAME = 0, BYTES_DOWNLOADED, TOTAL_BYTES_TO_DOWNLOAD, BYTES_LEFT, BYTES_UPLOADED, DOWNLOAD_RATE, UPLOAD_RATE, ETA, SEEDERS, LEECHERS, PERCENTAGE, SHARE_RATIO, DOWNLOAD_TIME, SEED_TIME, DOWNLOAD_LOCATION, TIME_ADDED, _NUMBER_OF_COLUMNS }; struct Item { bt::TorrentInterface* tc; // cached values to avoid unneeded updates bt::TorrentStatus status; bt::Uint64 bytes_downloaded; bt::Uint64 bytes_uploaded; bt::Uint64 total_bytes_to_download; bt::Uint64 bytes_left; bt::Uint32 download_rate; bt::Uint32 upload_rate; bt::Uint32 seeders_total; bt::Uint32 seeders_connected_to; bt::Uint32 leechers_total; bt::Uint32 leechers_connected_to; double percentage; float share_ratio; bt::Uint32 runtime_dl; bt::Uint32 runtime_ul; int eta; bool hidden; QDateTime time_added; bool highlight; Item(bt::TorrentInterface* tc); bool update(int row, int sort_column, QModelIndexList& to_update, ViewModel* model); QVariant data(int col) const; QVariant color(int col) const; QVariant statusIcon() const; bool lessThan(int col, const Item* other) const; bool visible(Group* group, const QString& filter_string) const; }; private: Core* core; View* view; QVector torrents; int sort_column; Qt::SortOrder sort_order; Group* group; int num_visible; QModelIndexList update_list; QString filter_string; }; } #endif diff --git a/ktorrent/view/viewselectionmodel.h b/ktorrent/view/viewselectionmodel.h index 474181c6..4c5e91ac 100644 --- a/ktorrent/view/viewselectionmodel.h +++ b/ktorrent/view/viewselectionmodel.h @@ -1,47 +1,47 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTVIEWSELECTIONMODEL_H #define KTVIEWSELECTIONMODEL_H #include namespace bt { } namespace kt { class ViewModel; /** Custom selection model for View */ class ViewSelectionModel : public ItemSelectionModel { Q_OBJECT public: ViewSelectionModel(ViewModel* vm, QObject* parent); - ~ViewSelectionModel(); + ~ViewSelectionModel() override; }; } #endif diff --git a/ktupnptest/upnptestwidget.h b/ktupnptest/upnptestwidget.h index e20bde4e..fdab255a 100644 --- a/ktupnptest/upnptestwidget.h +++ b/ktupnptest/upnptestwidget.h @@ -1,53 +1,53 @@ /*************************************************************************** * Copyright (C) 2005-2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef UPNPTESTWIDGET_HH #define UPNPTESTWIDGET_HH #include #include #include "ui_upnptestwidget.h" namespace bt { class UPnPMCastSocket; class UPnPRouter; } class UPnPTestWidget : public QWidget, public Ui_UPnPTestWidget, public bt::LogMonitorInterface { public: UPnPTestWidget(QWidget* parent = 0); - ~UPnPTestWidget(); + ~UPnPTestWidget() override; void doForward(); void undoForward(); void findRouters(); void discovered(bt::UPnPRouter* r); void verboseModeChecked(bool on); private: void message(const QString& line, unsigned int arg) override; bt::UPnPMCastSocket* mcast_socket; bt::UPnPRouter* router; }; #endif diff --git a/libktcore/dbus/dbus.h b/libktcore/dbus/dbus.h index 3595aa3f..d8bbd227 100644 --- a/libktcore/dbus/dbus.h +++ b/libktcore/dbus/dbus.h @@ -1,172 +1,172 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_DBUS_HH #define KT_DBUS_HH #include #include #include #include #include #include #include namespace bt { class TorrentInterface; } namespace kt { class GUIInterface; class CoreInterface; class Group; class DBusSettings; /** * Class which handles DBus calls * */ class KTCORE_EXPORT DBus : public QObject { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "org.ktorrent.core") public: DBus(GUIInterface* gui, CoreInterface* core, QObject* parent); - ~DBus(); + ~DBus() override; public Q_SLOTS: /// Get the names of all torrents Q_SCRIPTABLE QStringList torrents(); /// Start a torrent Q_SCRIPTABLE void start(const QString& info_hash); /// Stop a torrent Q_SCRIPTABLE void stop(const QString& info_hash); /// Start all torrents Q_SCRIPTABLE void startAll(); /// Stop all torrents Q_SCRIPTABLE void stopAll(); /// Load a torrent Q_SCRIPTABLE void load(const QString& url, const QString& group); /// Load a torrent silently Q_SCRIPTABLE void loadSilently(const QString& url, const QString& group); /// Remove a torrent Q_SCRIPTABLE void remove(const QString& info_hash, bool data_to); /// Remove a torrent delayed (should be used from signal handlers) Q_SCRIPTABLE void removeDelayed(const QString& info_hash, bool data_to); /// Set the suspended state Q_SCRIPTABLE void setSuspended(bool suspend); /// Gets the globla suspended state Q_SCRIPTABLE bool suspended(); /// Order the Queue Q_SCRIPTABLE void orderQueue(); /// Reindex the queue Q_SCRIPTABLE void reindexQueue(); /// Get all the custom groups Q_SCRIPTABLE QStringList groups() const; /// Add a group Q_SCRIPTABLE bool addGroup(const QString& group); /// Remove a group Q_SCRIPTABLE bool removeGroup(const QString& group); /// Get a torrent (this is for scripting) Q_SCRIPTABLE QObject* torrent(const QString& info_hash); /// Get a group (this is for scripting) Q_SCRIPTABLE QObject* group(const QString& name); /// Get the settings (this is for scripting) Q_SCRIPTABLE QObject* settings(); /// Write something to the log Q_SCRIPTABLE void log(const QString& line); /// Get the number of torrents running. Q_SCRIPTABLE uint numTorrentsRunning() const; /// Get the number of torrents not running. Q_SCRIPTABLE uint numTorrentsNotRunning() const; /// Get the number of torrents not running. Q_SCRIPTABLE QString dataDir() const; private Q_SLOTS: void torrentAdded(bt::TorrentInterface* tc); void torrentRemoved(bt::TorrentInterface* tc); void finished(bt::TorrentInterface* tc); void torrentStoppedByError(bt::TorrentInterface* tc, QString msg); void groupAdded(Group* g); void groupRemoved(Group* g); void delayedTorrentRemoval(); Q_SIGNALS: /// DBus signal emitted when a torrent has been added Q_SCRIPTABLE void torrentAdded(const QString& tor); /// DBus signal emitted when a torrent has been removed Q_SCRIPTABLE void torrentRemoved(const QString& tor); /// Emitted when torrent is finished Q_SCRIPTABLE void finished(const QString& tor); /// Emitted when a torrent is stopped by an error Q_SCRIPTABLE void torrentStoppedByError(const QString& tor, const QString& msg); /// Emitted when settings are changed in settings dialog Q_SCRIPTABLE void settingsChanged(); /// Emitted when suspended state changes Q_SCRIPTABLE void suspendStateChanged(bool suspended); private: GUIInterface* gui; CoreInterface* core; bt::PtrMap torrent_map; bt::PtrMap group_map; QMap delayed_removal_map; DBusSettings* dbus_settings; typedef bt::PtrMap::iterator DBusTorrentItr; typedef bt::PtrMap::iterator DBusGroupItr; }; } #endif diff --git a/libktcore/dbus/dbusgroup.h b/libktcore/dbus/dbusgroup.h index 970baaf3..456038a5 100644 --- a/libktcore/dbus/dbusgroup.h +++ b/libktcore/dbus/dbusgroup.h @@ -1,68 +1,68 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTDBUSGROUP_H #define KTDBUSGROUP_H #include namespace kt { class Group; class GroupManager; /** @author */ class DBusGroup : public QObject { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "org.ktorrent.group") public: DBusGroup(Group* g, GroupManager* gman, QObject* parent); - ~DBusGroup(); + ~DBusGroup() override; public Q_SLOTS: Q_SCRIPTABLE QString name() const; Q_SCRIPTABLE QString icon() const; Q_SCRIPTABLE QString defaultSaveLocation() const; Q_SCRIPTABLE void setDefaultSaveLocation(const QString& dir); Q_SCRIPTABLE QString defaultMoveOnCompletionLocation() const; Q_SCRIPTABLE void setDefaultMoveOnCompletionLocation(const QString& dir); Q_SCRIPTABLE double maxShareRatio() const; Q_SCRIPTABLE void setMaxShareRatio(double ratio); Q_SCRIPTABLE double maxSeedTime() const; Q_SCRIPTABLE void setMaxSeedTime(double hours); Q_SCRIPTABLE uint maxUploadSpeed() const; Q_SCRIPTABLE void setMaxUploadSpeed(uint speed); Q_SCRIPTABLE uint maxDownloadSpeed() const; Q_SCRIPTABLE void setMaxDownloadSpeed(uint speed); Q_SCRIPTABLE bool onlyApplyOnNewTorrents() const; Q_SCRIPTABLE void setOnlyApplyOnNewTorrents(bool on); private: Group* group; GroupManager* gman; }; } #endif diff --git a/libktcore/dbus/dbussettings.h b/libktcore/dbus/dbussettings.h index b162530b..75f54c1c 100644 --- a/libktcore/dbus/dbussettings.h +++ b/libktcore/dbus/dbussettings.h @@ -1,198 +1,198 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef __DBusSettings__ #define __DBusSettings__ #include #include #include namespace kt { class CoreInterface; class KTCORE_EXPORT DBusSettings : public QObject { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "org.ktorrent.settings") public: DBusSettings(CoreInterface* core, QObject* parent); - ~DBusSettings(); + ~DBusSettings() override; public slots: Q_SCRIPTABLE int maxDownloads(); Q_SCRIPTABLE void setMaxDownloads(int val); Q_SCRIPTABLE int maxSeeds(); Q_SCRIPTABLE void setMaxSeeds(int val); Q_SCRIPTABLE int startDownloadsOnLowDiskSpace(); Q_SCRIPTABLE void setStartDownloadsOnLowDiskSpace(int val); Q_SCRIPTABLE int maxConnections(); Q_SCRIPTABLE void setMaxConnections(int val); Q_SCRIPTABLE int maxTotalConnections(); Q_SCRIPTABLE void setMaxTotalConnections(int val); Q_SCRIPTABLE int maxUploadRate(); Q_SCRIPTABLE void setMaxUploadRate(int val); Q_SCRIPTABLE int maxDownloadRate(); Q_SCRIPTABLE void setMaxDownloadRate(int val); Q_SCRIPTABLE double maxRatio(); Q_SCRIPTABLE void setMaxRatio(double val); Q_SCRIPTABLE double greenRatio(); Q_SCRIPTABLE void setGreenRatio(double val); Q_SCRIPTABLE int port(); Q_SCRIPTABLE void setPort(int val); Q_SCRIPTABLE int udpTrackerPort(); Q_SCRIPTABLE void setUdpTrackerPort(int val); Q_SCRIPTABLE bool showSystemTrayIcon(); Q_SCRIPTABLE void setShowSystemTrayIcon(bool val); Q_SCRIPTABLE bool showSpeedBarInTrayIcon(); Q_SCRIPTABLE void setShowSpeedBarInTrayIcon(bool val); Q_SCRIPTABLE int downloadBandwidth(); Q_SCRIPTABLE void setDownloadBandwidth(int val); Q_SCRIPTABLE int uploadBandwidth(); Q_SCRIPTABLE void setUploadBandwidth(int val); Q_SCRIPTABLE bool showPopups(); Q_SCRIPTABLE void setShowPopups(bool val); Q_SCRIPTABLE bool keepSeeding(); Q_SCRIPTABLE void setKeepSeeding(bool val); Q_SCRIPTABLE QString tempDir(); Q_SCRIPTABLE void setTempDir(QString val); Q_SCRIPTABLE bool useSaveDir(); Q_SCRIPTABLE void setUseSaveDir(bool val); Q_SCRIPTABLE QString saveDir(); Q_SCRIPTABLE void setSaveDir(QString val); Q_SCRIPTABLE bool useTorrentCopyDir(); Q_SCRIPTABLE void setUseTorrentCopyDir(bool val); Q_SCRIPTABLE QString torrentCopyDir(); Q_SCRIPTABLE void setTorrentCopyDir(QString val); Q_SCRIPTABLE bool useCustomIP(); Q_SCRIPTABLE void setUseCustomIP(bool val); Q_SCRIPTABLE QString lastSaveDir(); Q_SCRIPTABLE void setLastSaveDir(QString val); Q_SCRIPTABLE QString customIP(); Q_SCRIPTABLE void setCustomIP(QString val); Q_SCRIPTABLE int guiUpdateInterval(); Q_SCRIPTABLE void setGuiUpdateInterval(int val); Q_SCRIPTABLE bool dhtSupport(); Q_SCRIPTABLE void setDhtSupport(bool val); Q_SCRIPTABLE int dhtPort(); Q_SCRIPTABLE void setDhtPort(int val); Q_SCRIPTABLE bool pexEnabled(); Q_SCRIPTABLE void setPexEnabled(bool val); Q_SCRIPTABLE int numUploadSlots(); Q_SCRIPTABLE void setNumUploadSlots(int val); Q_SCRIPTABLE bool useEncryption(); Q_SCRIPTABLE void setUseEncryption(bool val); Q_SCRIPTABLE bool allowUnencryptedConnections(); Q_SCRIPTABLE void setAllowUnencryptedConnections(bool val); Q_SCRIPTABLE int typeOfService(); Q_SCRIPTABLE void setTypeOfService(int val); Q_SCRIPTABLE int dscp(); Q_SCRIPTABLE void setDscp(int val); Q_SCRIPTABLE int maxConnectingSockets(); Q_SCRIPTABLE void setMaxConnectingSockets(int val); Q_SCRIPTABLE bool checkWhenFinished(); Q_SCRIPTABLE void setCheckWhenFinished(bool val); Q_SCRIPTABLE QList shownColumns(); Q_SCRIPTABLE void setShownColumns(QList val); Q_SCRIPTABLE bool useKDEProxySettings(); Q_SCRIPTABLE void setUseKDEProxySettings(bool val); Q_SCRIPTABLE QString httpProxy(); Q_SCRIPTABLE void setHttpProxy(QString val); Q_SCRIPTABLE int httpProxyPort(); Q_SCRIPTABLE void setHttpProxyPort(int val); Q_SCRIPTABLE bool useProxyForWebSeeds(); Q_SCRIPTABLE void setUseProxyForWebSeeds(bool val); Q_SCRIPTABLE bool useProxyForTracker(); Q_SCRIPTABLE void setUseProxyForTracker(bool val); Q_SCRIPTABLE bool socksEnabled(); Q_SCRIPTABLE void setSocksEnabled(bool val); Q_SCRIPTABLE QString socksProxy(); Q_SCRIPTABLE void setSocksProxy(QString val); Q_SCRIPTABLE int socksPort(); Q_SCRIPTABLE void setSocksPort(int val); Q_SCRIPTABLE int socksVersion(); Q_SCRIPTABLE void setSocksVersion(int val); Q_SCRIPTABLE bool socksUsePassword(); Q_SCRIPTABLE void setSocksUsePassword(bool val); Q_SCRIPTABLE QString socksUsername(); Q_SCRIPTABLE void setSocksUsername(QString val); Q_SCRIPTABLE QString socksPassword(); Q_SCRIPTABLE void setSocksPassword(QString val); Q_SCRIPTABLE bool diskPrealloc(); Q_SCRIPTABLE void setDiskPrealloc(bool val); Q_SCRIPTABLE bool fullDiskPrealloc(); Q_SCRIPTABLE void setFullDiskPrealloc(bool val); Q_SCRIPTABLE int minDiskSpace(); Q_SCRIPTABLE void setMinDiskSpace(int val); Q_SCRIPTABLE int cpuUsage(); Q_SCRIPTABLE void setCpuUsage(int val); Q_SCRIPTABLE bool useCompletedDir(); Q_SCRIPTABLE void setUseCompletedDir(bool val); Q_SCRIPTABLE QString completedDir(); Q_SCRIPTABLE void setCompletedDir(QString val); Q_SCRIPTABLE double maxSeedTime(); Q_SCRIPTABLE void setMaxSeedTime(double val); Q_SCRIPTABLE QString networkInterface(); Q_SCRIPTABLE void setNetworkInterface(const QString &val); Q_SCRIPTABLE bool openMultipleTorrentsSilently(); Q_SCRIPTABLE void setOpenMultipleTorrentsSilently(bool val); Q_SCRIPTABLE bool openAllTorrentsSilently(); Q_SCRIPTABLE void setOpenAllTorrentsSilently(bool val); Q_SCRIPTABLE bool decreasePriorityOfStalledTorrents(); Q_SCRIPTABLE void setDecreasePriorityOfStalledTorrents(bool val); Q_SCRIPTABLE int stallTimer(); Q_SCRIPTABLE void setStallTimer(int val); Q_SCRIPTABLE int previewSizeAudio(); Q_SCRIPTABLE void setPreviewSizeAudio(int val); Q_SCRIPTABLE int previewSizeVideo(); Q_SCRIPTABLE void setPreviewSizeVideo(int val); Q_SCRIPTABLE bool suppressSleep(); Q_SCRIPTABLE void setSuppressSleep(bool val); Q_SCRIPTABLE bool manuallyControlTorrents(); Q_SCRIPTABLE void setManuallyControlTorrents(bool val); Q_SCRIPTABLE bool webseedsEnabled(); Q_SCRIPTABLE void setWebseedsEnabled(bool val); Q_SCRIPTABLE bool useQHttpAnnounce(); Q_SCRIPTABLE void setUseQHttpAnnounce(bool val); Q_SCRIPTABLE bool lookUpHostnameOfPeers(); Q_SCRIPTABLE void setLookUpHostnameOfPeers(bool val); Q_SCRIPTABLE bool utpEnabled(); Q_SCRIPTABLE void setUtpEnabled(bool val); Q_SCRIPTABLE bool onlyUseUtp(); Q_SCRIPTABLE void setOnlyUseUtp(bool val); Q_SCRIPTABLE int primaryTransportProtocol(); Q_SCRIPTABLE void setPrimaryTransportProtocol(int val); Q_SCRIPTABLE bool autoRenameSingleFileTorrents(); Q_SCRIPTABLE void setAutoRenameSingleFileTorrents(bool val); Q_SCRIPTABLE int numMagnetDownloadingSlots(); Q_SCRIPTABLE void setNumMagnetDownloadingSlots(int val); Q_SCRIPTABLE bool requeueMagnets(); Q_SCRIPTABLE void setRequeueMagnets(bool val); Q_SCRIPTABLE int requeueMagnetsTime(); Q_SCRIPTABLE void setRequeueMagnetsTime(int val); Q_SCRIPTABLE void apply(); private: CoreInterface* core; }; } #endif diff --git a/libktcore/dbus/dbustorrent.h b/libktcore/dbus/dbustorrent.h index d44e3750..df63412e 100644 --- a/libktcore/dbus/dbustorrent.h +++ b/libktcore/dbus/dbustorrent.h @@ -1,152 +1,152 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTDBUSTORRENT_H #define KTDBUSTORRENT_H #include #include #include #include namespace kt { class DBusTorrentFileStream; /** DBus object to access a torrent */ class DBusTorrent : public QObject { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "org.ktorrent.torrent") public: DBusTorrent(bt::TorrentInterface* ti, QObject* parent); - ~DBusTorrent(); + ~DBusTorrent() override; /// Get a pointer to the actual torrent bt::TorrentInterface* torrent() {return ti;} public Q_SLOTS: Q_SCRIPTABLE QString infoHash() const; Q_SCRIPTABLE QString name() const; Q_SCRIPTABLE bool isPrivate() const; // Speed Q_SCRIPTABLE uint downloadSpeed() const; Q_SCRIPTABLE uint uploadSpeed() const; // Data stuff Q_SCRIPTABLE qulonglong bytesDownloaded() const; Q_SCRIPTABLE qulonglong bytesUploaded() const; Q_SCRIPTABLE qulonglong totalSize() const; Q_SCRIPTABLE qulonglong bytesLeftToDownload() const; Q_SCRIPTABLE qulonglong bytesLeft() const; Q_SCRIPTABLE qulonglong bytesToDownload() const; // Priority and QM Q_SCRIPTABLE int priority() const; Q_SCRIPTABLE void setPriority(int p); Q_SCRIPTABLE void setAllowedToStart(bool on); Q_SCRIPTABLE bool isAllowedToStart() const; // Chunks Q_SCRIPTABLE uint chunks() const; Q_SCRIPTABLE uint chunkSize() const; Q_SCRIPTABLE bool chunkDownloaded(uint idx) const; // Seeders and leechers Q_SCRIPTABLE uint seedersConnected() const; Q_SCRIPTABLE uint seedersTotal() const; Q_SCRIPTABLE uint leechersConnected() const; Q_SCRIPTABLE uint leechersTotal() const; // Tracker stuff Q_SCRIPTABLE QString currentTracker() const; Q_SCRIPTABLE QStringList trackers() const; Q_SCRIPTABLE void setTrackerEnabled(const QString& tracker_url, bool enabled); Q_SCRIPTABLE void changeTracker(const QString& tracker_url); Q_SCRIPTABLE void announce(); Q_SCRIPTABLE void scrape(); Q_SCRIPTABLE bool addTracker(const QString& tracker_url); Q_SCRIPTABLE bool removeTracker(const QString& tracker_url); Q_SCRIPTABLE void restoreDefaultTrackers(); // WebSeed stuff Q_SCRIPTABLE QStringList webSeeds() const; Q_SCRIPTABLE bool addWebSeed(const QString& webseed_url); Q_SCRIPTABLE bool removeWebSeed(const QString& webseed_url); // Files Q_SCRIPTABLE uint numFiles() const; Q_SCRIPTABLE QString dataDir() const; Q_SCRIPTABLE QString torDir() const; Q_SCRIPTABLE QString pathOnDisk() const; Q_SCRIPTABLE QString filePath(uint file_index) const; Q_SCRIPTABLE QString filePathOnDisk(uint file_index) const; Q_SCRIPTABLE qulonglong fileSize(uint file_index) const; Q_SCRIPTABLE int filePriority(uint file_index) const; Q_SCRIPTABLE void setFilePriority(uint file_index, int prio); Q_SCRIPTABLE int firstChunkOfFile(uint file_index) const; Q_SCRIPTABLE int lastChunkOfFile(uint file_index) const; Q_SCRIPTABLE double filePercentage(uint file_index) const; Q_SCRIPTABLE bool isMultiMediaFile(uint file_index) const; Q_SCRIPTABLE void setDoNotDownload(uint file_index, bool dnd); // Stats Q_SCRIPTABLE QByteArray stats() const; // Max share ratio and seed time Q_SCRIPTABLE void setMaxShareRatio(double ratio); Q_SCRIPTABLE double maxShareRatio() const; Q_SCRIPTABLE double shareRatio() const; Q_SCRIPTABLE void setMaxSeedTime(double hours); Q_SCRIPTABLE double maxSeedTime() const; Q_SCRIPTABLE double seedTime() const; Q_SCRIPTABLE bool createStream(uint file_index); Q_SCRIPTABLE bool removeStream(uint file_index); Q_SIGNALS: void finished(QObject* tor); void stoppedByError(QObject* tor, const QString& msg); void seedingAutoStopped(QObject* tor, const QString& reason); void corruptedDataFound(QObject* tor); void torrentStopped(QObject* tor); private slots: void onFinished(bt::TorrentInterface* tor); void onStoppedByError(bt::TorrentInterface* tor, const QString& err); void onSeedingAutoStopped(bt::TorrentInterface* tor, bt::AutoStopReason reason); void onCorruptedDataFound(bt::TorrentInterface* tor); void onTorrentStopped(bt::TorrentInterface* tor); private: bt::TorrentInterface* ti; DBusTorrentFileStream* stream; }; } #endif diff --git a/libktcore/dbus/dbustorrentfilestream.h b/libktcore/dbus/dbustorrentfilestream.h index 8762d8ee..6ffb6333 100644 --- a/libktcore/dbus/dbustorrentfilestream.h +++ b/libktcore/dbus/dbustorrentfilestream.h @@ -1,75 +1,75 @@ /*************************************************************************** * Copyright (C) 2010 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_DBUSTORRENTFILESTREAM_H #define KT_DBUSTORRENTFILESTREAM_H #include #include namespace kt { class DBusTorrent; /** * DBus interface to a TorrentFileStream */ class DBusTorrentFileStream : public QObject { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "org.ktorrent.torrentfilestream") public: DBusTorrentFileStream(bt::Uint32 file_index, DBusTorrent* tor); - ~DBusTorrentFileStream(); + ~DBusTorrentFileStream() override; /// Was the stream created properly ? bool ok() const {return !stream.isNull();} public Q_SLOTS: /// Get the current stream position Q_SCRIPTABLE qint64 pos() const; /// Get the total size Q_SCRIPTABLE qint64 size() const; /// Seek, will fail if attempting to seek to a point which is not downloaded yet Q_SCRIPTABLE bool seek(qint64 pos); /// How many bytes are there available Q_SCRIPTABLE qint64 bytesAvailable() const; /// Get the path of the file Q_SCRIPTABLE QString path() const; /// Get the current chunk relative to the first chunk of the file Q_SCRIPTABLE bt::Uint32 currentChunk() const; /// Read maxlen bytes from the stream Q_SCRIPTABLE QByteArray read(qint64 maxlen); private: DBusTorrent* tor; bt::TorrentFileStream::Ptr stream; }; } #endif // KT_DBUSTORRENTFILESTREAM_H diff --git a/libktcore/groups/allgroup.h b/libktcore/groups/allgroup.h index 5ea3b778..4234c924 100644 --- a/libktcore/groups/allgroup.h +++ b/libktcore/groups/allgroup.h @@ -1,44 +1,44 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTALLGROUP_H #define KTALLGROUP_H #include namespace kt { /** @author Joris Guisson */ class AllGroup : public Group { public: AllGroup(); - ~AllGroup(); + ~AllGroup() override; bool isMember(TorrentInterface* tor) override; }; } #endif diff --git a/libktcore/groups/functiongroup.h b/libktcore/groups/functiongroup.h index e53a8114..3983ad4e 100644 --- a/libktcore/groups/functiongroup.h +++ b/libktcore/groups/functiongroup.h @@ -1,59 +1,59 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTFUNCTIONGROUP_H #define KTFUNCTIONGROUP_H #include "group.h" namespace kt { typedef bool (*IsMemberFunction)(TorrentInterface* tor); /** Group which calls a function pointer to test for membership */ template class FunctionGroup : public Group { public: FunctionGroup(const QString& name, const QString& icon, int flags, const QString& path) : Group(name, flags, path) { setIconByName(icon); } - ~FunctionGroup() {} + ~FunctionGroup() override {} bool isMember(TorrentInterface* tor) override { if (!tor) return false; else return fn(tor); } }; } #endif diff --git a/libktcore/groups/group.h b/libktcore/groups/group.h index 7a3e3106..d2d88cce 100644 --- a/libktcore/groups/group.h +++ b/libktcore/groups/group.h @@ -1,191 +1,191 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTGROUP_H #define KTGROUP_H #include #include #include #include namespace bt { class BEncoder; class BDictNode; class TorrentInterface; } namespace kt { class QueueManager; using bt::TorrentInterface; /** * @author Joris Guisson * * Base class for all groups. Subclasses should only implement the * isMember function, but can also provide save and load * functionality. */ class KTCORE_EXPORT Group : public QObject { Q_OBJECT public: enum Properties { UPLOADS_ONLY_GROUP = 1, DOWNLOADS_ONLY_GROUP = 2, MIXED_GROUP = 3, CUSTOM_GROUP = 4 }; struct KTCORE_EXPORT Policy { QString default_save_location; QString default_move_on_completion_location; float max_share_ratio; float max_seed_time; bt::Uint32 max_upload_rate; bt::Uint32 max_download_rate; bool only_apply_on_new_torrents; Policy(); }; /** * Create a new group. * @param name The name of the group * @param flags Properties of the group * @param path Path in the group tree (e.g /all/downloads/foo, last item in path should be the groups internal name) */ Group(const QString& name, int flags, const QString& path); - virtual ~Group(); + ~Group() override; /// See if this is a standard group. bool isStandardGroup() const {return !(flags & CUSTOM_GROUP);} /// Get the group flags int groupFlags() const {return flags;} /** * Rename the group. * @param nn The new name */ void rename(const QString& nn); /** * Set the group icon by name. * @param in The icon name */ void setIconByName(const QString& in); /// Get the name of the group const QString& groupName() const {return name;} /// Get the icon of the group const QIcon& groupIcon() const {return icon;} /// Name of the group icon const QString& groupIconName() const {return icon_name;} /// Get the group policy const Policy& groupPolicy() const {return policy;} /// Path in the group tree const QString& groupPath() const {return path;} /// Get the number of running torrents int runningTorrents() const {return running;} /// Total torrents int totalTorrents() const {return total;} /// Set the group policy void setGroupPolicy(const Policy& p); /** * Save the torrents.The torrents should be save in a bencoded file. * @param enc The BEncoder */ virtual void save(bt::BEncoder* enc); /** * Load the torrents of the group from a BDictNode. * @param n The BDictNode */ virtual void load(bt::BDictNode* n); /** * Test if a torrent is a member of this group. * @param tor The torrent */ virtual bool isMember(TorrentInterface* tor) = 0; /** * The torrent has been removed and is about to be deleted. * Subclasses should make sure that they don't have dangling * pointers to this torrent. * @param tor The torrent */ virtual void torrentRemoved(TorrentInterface* tor); /** * Subclasses should implement this, if they want to have torrents added to them. * @param tor The torrent * @param new_torrent Indicates whether this is a newly created or opened torrent */ virtual void addTorrent(TorrentInterface* tor, bool new_torrent); /** * Subclasses should implement this, if they want to have torrents removed from them. * @param tor The torrent */ virtual void removeTorrent(TorrentInterface* tor); /** * Called when the policy has been changed. */ virtual void policyChanged(); /** * Update the running and total count * @param qman The QueueManager **/ void updateCount(QueueManager* qman); protected: QString name; QIcon icon; QString icon_name; int flags; Policy policy; QString path; int running; int total; }; } #endif diff --git a/libktcore/groups/groupmanager.h b/libktcore/groups/groupmanager.h index af847524..a9147c7d 100644 --- a/libktcore/groups/groupmanager.h +++ b/libktcore/groups/groupmanager.h @@ -1,155 +1,155 @@ /*************************************************************************** * Copyright (C) 2005 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTGROUPMANAGER_H #define KTGROUPMANAGER_H #include #include #include #include namespace bt { class TorrentInterface; } namespace kt { class QueueManager; /** * @author Joris Guisson * * Manages all user created groups and the standard groups. */ class KTCORE_EXPORT GroupManager : public QObject { Q_OBJECT public: GroupManager(); - ~GroupManager(); + ~GroupManager() override; /** * Update the count of all groups * @param qman The QueueManager **/ void updateCount(QueueManager* qman); /** * Find a group given it's path * @param path Path of the group * @return :Group* The Group or 0 **/ Group* findByPath(const QString& path); /** * Create a new user created group. * @param name Name of the group * @return Pointer to the group or nullptr, if another group already exists with the same name. */ Group* newGroup(const QString& name); /** * Remove a user crated group * @param g The group */ void removeGroup(Group* g); /** * Add a new default group. * @param g The group */ void addDefaultGroup(Group* g); /** * Remove a default group. * @param g The group */ void removeDefaultGroup(Group* g); /// Get the group off all torrents Group* allGroup() {return all;} typedef bt::PtrMap::iterator Itr; Itr begin() {return groups.begin();} Itr end() {return groups.end();} /// Find Group given a name Group* find(const QString& name); /// Return the custom group names QStringList customGroupNames(); /** * Save the groups to a file. */ void saveGroups(); /** * Load the groups from a file */ void loadGroups(); /** * See if we can remove a group. * @param g The group * @return true on any user created group, false on the standard ones */ bool canRemove(const Group* g) const; /** * A torrent has been removed. This function checks all groups and * removes the torrent from it. * @param ti The torrent */ void torrentRemoved(bt::TorrentInterface* ti); /** * Rename a group. * @param old_name The old name * @param new_name The new name */ void renameGroup(const QString& old_name, const QString& new_name); /** Torrents have been loaded update all custom groups. @param qman The QueueManager */ void torrentsLoaded(QueueManager* qman); Q_SIGNALS: void groupRenamed(Group* g); void groupAdded(Group* g); void groupRemoved(Group* g); void customGroupChanged(); private: bt::PtrMap groups; Group* all; }; } #endif diff --git a/libktcore/groups/torrentgroup.h b/libktcore/groups/torrentgroup.h index 76f1c753..e429564a 100644 --- a/libktcore/groups/torrentgroup.h +++ b/libktcore/groups/torrentgroup.h @@ -1,70 +1,70 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTTORRENTGROUP_H #define KTTORRENTGROUP_H #include #include #include namespace kt { class QueueManager; /** @author Joris Guisson */ class KTCORE_EXPORT TorrentGroup : public Group { Q_OBJECT public: TorrentGroup(const QString& name); - ~TorrentGroup(); + ~TorrentGroup() override; bool isMember(TorrentInterface* tor) override; void save(bt::BEncoder* enc) override; void load(bt::BDictNode* n) override; void torrentRemoved(TorrentInterface* tor) override; void removeTorrent(TorrentInterface* tor) override; void addTorrent(TorrentInterface* tor, bool new_torrent) override; void policyChanged() override; void add(TorrentInterface* tor); void remove(TorrentInterface* tor); void loadTorrents(QueueManager* qman); Q_SIGNALS: /// Emitted when a torrent has been added void torrentAdded(Group* g); /// Emitted when a torrent has been removed void torrentRemoved(Group* g); private: std::set torrents; std::set hashes; }; } #endif diff --git a/libktcore/groups/ungroupedgroup.h b/libktcore/groups/ungroupedgroup.h index 12cada33..bfb129b2 100644 --- a/libktcore/groups/ungroupedgroup.h +++ b/libktcore/groups/ungroupedgroup.h @@ -1,48 +1,48 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTUNGROUPEDGROUP_H #define KTUNGROUPEDGROUP_H #include namespace kt { class GroupManager; /** @author */ class UngroupedGroup : public Group { public: UngroupedGroup(GroupManager* gman); - ~UngroupedGroup(); + ~UngroupedGroup() override; bool isMember(TorrentInterface* tor) override; private: GroupManager* gman; }; } #endif diff --git a/libktcore/gui/centralwidget.h b/libktcore/gui/centralwidget.h index e3911a9a..820d85be 100644 --- a/libktcore/gui/centralwidget.h +++ b/libktcore/gui/centralwidget.h @@ -1,80 +1,80 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_CENTRALWIDGET_H #define KT_CENTRALWIDGET_H #include #include #include #include #include namespace kt { class Activity; /** * The CentralWidget holds the widget stack. */ class KTCORE_EXPORT CentralWidget : public QStackedWidget { Q_OBJECT public: CentralWidget(QWidget* parent); - ~CentralWidget(); + ~CentralWidget() override; /// Add an Activity QAction * addActivity(Activity* act); /// Remove an Activity (doesn't delete it) void removeActivity(Activity* act); /// Set the current activity void setCurrentActivity(Activity* act); /// Get the current activity Activity* currentActivity(); /// Load the state of the widget void loadState(KSharedConfigPtr cfg); /// Save the state of the widget void saveState(KSharedConfigPtr cfg); /// Get the list of actions to switch between activities QList activitySwitchingActions(); private slots: void switchActivity(QAction* action); signals: /// Emitted when the current Activity needs to be changed void changeActivity(Activity* act); private: QActionGroup* activity_switching_group; }; } #endif // KT_CENTRALWIDGET_H diff --git a/libktcore/gui/extender.h b/libktcore/gui/extender.h index d98118ca..77580783 100644 --- a/libktcore/gui/extender.h +++ b/libktcore/gui/extender.h @@ -1,64 +1,64 @@ /*************************************************************************** * Copyright (C) 2010 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_EXTENDER_H #define KT_EXTENDER_H #include #include namespace bt { class TorrentInterface; } namespace kt { /** * Base class for all extender widgets */ class KTCORE_EXPORT Extender : public QWidget { Q_OBJECT public: Extender(bt::TorrentInterface* tc, QWidget* parent); - ~Extender(); + ~Extender() override; /// Get the torrent of this extender bt::TorrentInterface* torrent() {return tc;} /// Is this similar to another extender virtual bool similar(Extender* ext) const = 0; signals: /// Should be emitted by an extender when it wants to close itself void closeRequest(Extender* ext); /// Should be emitted when an extender is resized void resized(Extender* ext); protected: bt::TorrentInterface* tc; }; } #endif // KT_EXTENDER_H diff --git a/libktcore/gui/tabbarwidget.h b/libktcore/gui/tabbarwidget.h index 8b859c60..64641e87 100644 --- a/libktcore/gui/tabbarwidget.h +++ b/libktcore/gui/tabbarwidget.h @@ -1,101 +1,101 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef TABBARWIDGET_H #define TABBARWIDGET_H #include #include #include #include #include #include #include "ktcore_export.h" namespace kt { class ActionGroup; class KTCORE_EXPORT TabBarWidget : public QWidget { Q_OBJECT public: TabBarWidget(QSplitter* splitter, QWidget* parent); - ~TabBarWidget(); + ~TabBarWidget() override; /// Add a tab to the TabBarWidget void addTab(QWidget* w, const QString& text, const QString& icon, const QString& tooltip); /// Remove a tab from the TabBarWidget void removeTab(QWidget* w); /// Save current status of sidebar, called at exit void saveState(KSharedConfigPtr cfg, const QString& group); /// Restore status from config, called at startup void loadState(KSharedConfigPtr cfg, const QString& group); /// Change the text of a tab void changeTabText(QWidget* w, const QString& text); /// Change the icon of a tab void changeTabIcon(QWidget* w, const QString& icon); private slots: void onActionTriggered(QAction* act); void toolButtonStyleChanged(Qt::ToolButtonStyle style); void setToolButtonStyle(); private: void shrink(); void unshrink(); private: QToolBar* tab_bar; ActionGroup* action_group; QStackedWidget* widget_stack; bool shrunken; QMap widget_to_action; }; class ActionGroup : public QObject { Q_OBJECT public: ActionGroup(QObject* parent = 0); - ~ActionGroup(); + ~ActionGroup() override; void addAction(QAction* act); void removeAction(QAction* act); private slots: void toggled(bool on); signals: void actionTriggered(QAction* a); private: QList actions; }; } #endif // TABBARWIDGET_H diff --git a/libktcore/interfaces/activity.h b/libktcore/interfaces/activity.h index f7f5e2a3..1f57a7f2 100644 --- a/libktcore/interfaces/activity.h +++ b/libktcore/interfaces/activity.h @@ -1,103 +1,103 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef ACTIVITY_H #define ACTIVITY_H #include #include #include #include class QMenu; namespace kt { class Activity; /** Part of an Activity */ class KTCORE_EXPORT ActivityPart : public KParts::Part { Q_OBJECT public: ActivityPart(Activity* parent); - ~ActivityPart(); + ~ActivityPart() override; /// Set the XML GUI file of the part void setXMLGUIFile(const QString& xml_gui); /// Get a menu described in the XML of the part QMenu* menu(const QString& name); }; /** * Base class for all activities. */ class KTCORE_EXPORT Activity : public QWidget { Q_OBJECT public: Activity(const QString& name, const QString& icon, int weight, QWidget* parent); - ~Activity(); + ~Activity() override; /// Get the name of the activity const QString& name() const {return activity_name;} /// Get the icon name const QString& icon() const {return activity_icon;} /// Get the part ActivityPart* part() const {return activity_part;} /// Set the name void setName(const QString& name); /// Set the icon void setIcon(const QString& icon); /// Get the weight int weight() const {return activity_weight;} static bool lessThan(Activity* l, Activity* r); protected: /** Activities wishing to provide toolbar and menu entries, should call this function to set the XML GUI description. @param xml_file The XMLGUI file */ void setXMLGUIFile(const QString& xml_file); signals: void nameChanged(Activity* a, const QString& name); void iconChanged(Activity* a, const QString& icon); private: QString activity_name; QString activity_icon; int activity_weight; ActivityPart* activity_part; }; } #endif // ACTIVITY_H diff --git a/libktcore/interfaces/coreinterface.h b/libktcore/interfaces/coreinterface.h index 90dc8fde..a8380bed 100644 --- a/libktcore/interfaces/coreinterface.h +++ b/libktcore/interfaces/coreinterface.h @@ -1,291 +1,291 @@ /*************************************************************************** * Copyright (C) 2005 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTCOREINTERFACE_H #define KTCOREINTERFACE_H #include #include #include #include namespace bt { class TorrentInterface; class MagnetLink; class TorrentCreator; } namespace kt { ///Stats struct struct CurrentStats { bt::Uint32 download_speed; bt::Uint32 upload_speed; bt::Uint64 bytes_downloaded; bt::Uint64 bytes_uploaded; }; struct MagnetLinkLoadOptions { bool silently; QString group; QString location; QString move_on_completion; }; class MagnetManager; class QueueManager; class GroupManager; class DBus; /** * @author Joris Guisson * @brief Interface for plugins to communicate with the application's core * * This interface provides the plugin with the functionality to modify * the applications core, the core is responsible for managing all * TorrentControl objects. */ class KTCORE_EXPORT CoreInterface : public QObject { Q_OBJECT public: CoreInterface(); - ~CoreInterface(); + ~CoreInterface() override; /** * Set whether or not we should keep seeding after * a download has finished. * @param ks Keep seeding yes or no */ virtual void setKeepSeeding(bool ks) = 0; /** * Change the data dir. This involves copying * all data from the old dir to the new. * This can offcourse go horribly wrong, therefore * if it doesn't succeed it returns false * and leaves everything where it supposed to be. * @param new_dir The new directory */ virtual bool changeDataDir(const QString& new_dir) = 0; /** * Start all, takes into account the maximum number of downloads. */ virtual void startAll() = 0; /** * Stop all torrents. */ virtual void stopAll() = 0; /** * Start a torrent, takes into account the maximum number of downloads. * @param tc The TorrentControl */ virtual void start(bt::TorrentInterface* tc) = 0; /** * Start a list of torrents. * @param todo The list of torrents */ virtual void start(QList & todo) = 0; /** * Stop a torrent, may start another download if it hasn't been started. * @param tc The TorrentControl * @param user true if user stopped the torrent, false otherwise */ virtual void stop(bt::TorrentInterface* tc) = 0; /** * Stop a list of torrents. * @param todo The list of torrents */ virtual void stop(QList & todo) = 0; /** * Pause a torrent * @param tc The torrent */ virtual void pause(bt::TorrentInterface* tc) = 0; /** * Pause a list of torrents. * @param todo The list of torrents */ virtual void pause(QList & todo) = 0; /// Get CurrentStats structure virtual CurrentStats getStats() = 0; /** * Switch the port * @param port The new port * @return true if we can, false otherwise */ virtual bool changePort(bt::Uint16 port) = 0; /// Get the number of torrents running (including seeding torrents). virtual bt::Uint32 getNumTorrentsRunning() const = 0; /// Get the number of torrents not running. virtual bt::Uint32 getNumTorrentsNotRunning() const = 0; /** * Load a torrent file. Pops up an error dialog * if something goes wrong. Will ask the user for a save location, or use * the default. * @param url The torrent file * @param group Group to add torrent to */ virtual void load(const QUrl &url, const QString& group) = 0; /** * Load a torrent file. Pops up an error dialog * if something goes wrong. Will ask the user for a save location, or use * the default. This will not popup a file selection dialog for multi file torrents. * @param url The torrent file * @param group Group to add torrent to */ virtual void loadSilently(const QUrl &url, const QString& group) = 0; /** * Load a torrent using a byte array * @param data Data of the torrent * @param url URL of the torrent * @param group Group to use * @param savedir Directory to save to * @return The loaded TorrentInterface or 0 on failure */ virtual bt::TorrentInterface* load(const QByteArray& data, const QUrl &url, const QString& group, const QString& savedir) = 0; /** * Load a torrent using a byte array silently * @param data Data of the torrent * @param url URL of the torrent * @param group Group to use * @param savedir Directory to save to * @return The loaded TorrentInterface or 0 on failure */ virtual bt::TorrentInterface* loadSilently(const QByteArray& data, const QUrl &url, const QString& group, const QString& savedir) = 0; /** * Remove a download.This will delete all temp * data from this TorrentControl And delete the * TorrentControl itself. It can also potentially * start a new download (when one is waiting to be downloaded). * @param tc The torrent * @param data_to Whether or not to delete the file data to */ virtual void remove(bt::TorrentInterface* tc, bool data_to) = 0; /** * Remove a list of downloads. * @param todo The torrent list * @param data_to Whether or not to delete the file data to */ virtual void remove(QList & todo, bool data_to) = 0; /** * Find the next free torX dir. * @return Path to the dir (including the torX part) */ virtual QString findNewTorrentDir() const = 0; /** * Load an existing torrent, which has already a properly set up torX dir. * @param tor_dir The torX dir */ virtual void loadExistingTorrent(const QString& tor_dir) = 0; /** * Sets global suspended state for all torrents (QueueManager) and stopps all torrents. * No torrents will be automatically started/stopped. */ virtual void setSuspendedState(bool suspend) = 0; /// Gets the globla suspended state virtual bool getSuspendedState() = 0; /// Get the QueueManager virtual kt::QueueManager* getQueueManager() = 0; /// Get the GroupManager virtual kt::GroupManager* getGroupManager() = 0; /// Get the MagnetManager virtual kt::MagnetManager* getMagnetManager() = 0; /// Get a pointer to the external interface object (for dbus and scripting) virtual DBus* getExternalInterface() = 0; /// Apply all settings virtual void applySettings() = 0; /// Load a magnet link virtual void load(const bt::MagnetLink& mlink, const MagnetLinkLoadOptions& options) = 0; /// Create a torrent (Note: hash calculation should be finished, and torrent should have been saved) virtual bt::TorrentInterface* createTorrent(bt::TorrentCreator* tc, bool seed) = 0; Q_SIGNALS: /** * A bt::TorrentInterface was added * @param tc */ void torrentAdded(bt::TorrentInterface* tc); /** * A TorrentInterface was removed * @param tc */ void torrentRemoved(bt::TorrentInterface* tc); /** * A TorrentInterface has finished downloading. * @param tc */ void finished(bt::TorrentInterface* tc); /** * Torrent download is stopped by error * @param tc TorrentInterface * @param msg Error message */ void torrentStoppedByError(bt::TorrentInterface* tc, QString msg); /** * Signal emmitted when the settings have been changed in the settings dialog. * Plugins interested in this should update their internal states. * */ void settingsChanged(); }; } #endif diff --git a/libktcore/interfaces/plugin.h b/libktcore/interfaces/plugin.h index cefa245e..acc42d7a 100644 --- a/libktcore/interfaces/plugin.h +++ b/libktcore/interfaces/plugin.h @@ -1,131 +1,131 @@ /*************************************************************************** * Copyright (C) 2005 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTPLUGIN_H #define KTPLUGIN_H #include #include #include namespace bt { class WaitJob; } namespace kt { class CoreInterface; class GUIInterface; /** * @author Joris Guisson * @brief Base class for all plugins * * This is the base class for all plugins. Plugins should implement * the load and unload methods, any changes made in load must be undone in * unload. * * It's also absolutely forbidden to do any complex initialization in the constructor * (setting an int to 0 is ok, creating widgets isn't). * Only the name, author and description may be set in the constructor. */ class KTCORE_EXPORT Plugin : public KParts::Plugin { Q_OBJECT public: Plugin(QObject* parent); - virtual ~Plugin(); + ~Plugin() override; /** * This gets called, when the plugin gets loaded by KTorrent. * Any changes made here must be later made undone, when unload is * called. * Upon error a bt::Error should be thrown. And the plugin should remain * in an uninitialized state. The Error contains an error message, which will * get show to the user. */ virtual void load() = 0; /** * Gets called when the plugin gets unloaded. * Should undo anything load did. */ virtual void unload() = 0; /** * For plugins who need to update something, the same time as the * GUI updates. */ virtual void guiUpdate(); /** * This should be implemented by plugins who need finish of some stuff which might take some time. * These operations must be finished or killed by a timeout before we can proceed with unloading the plugin. * @param job The WaitJob which monitors the plugin */ virtual void shutdown(bt::WaitJob* job); /// Get a pointer to the CoreInterface CoreInterface* getCore() {return core;} /// Get a const pointer to the CoreInterface const CoreInterface* getCore() const {return core;} /** * Set the core, used by PluginManager to set the pointer * to the core. * @param c Pointer to the core */ void setCore(CoreInterface* c) {core = c;} /// Get a pointer to the CoreInterface GUIInterface* getGUI() {return gui;} /// Get a const pointer to the CoreInterface const GUIInterface* getGUI() const {return gui;} /** * Set the core, used by PluginManager to set the pointer * to the core. * @param c Pointer to the core */ void setGUI(GUIInterface* c) {gui = c;} /// See if the plugin is loaded bool isLoaded() const {return loaded;} /// Check whether the plugin matches the version of KT virtual bool versionCheck(const QString& version) const = 0; /// Returns the name of the parent part the GUI of the plugin should be created in virtual QString parentPart() const {return QStringLiteral("ktorrent");} private: CoreInterface* core; GUIInterface* gui; bool loaded; friend class PluginManager; }; } #endif diff --git a/libktcore/interfaces/prefpageinterface.h b/libktcore/interfaces/prefpageinterface.h index 6966fccc..74080a9b 100644 --- a/libktcore/interfaces/prefpageinterface.h +++ b/libktcore/interfaces/prefpageinterface.h @@ -1,79 +1,79 @@ /*************************************************************************** * Copyright (C) 2005 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef PREFPAGEINTERFACE_H #define PREFPAGEINTERFACE_H #include #include class KConfigSkeleton; namespace kt { /** * @author Ivan Vasic * @brief Interface to add configuration dialog page. * * This interface allows plugins and others to add their own pages in Configuration dialog. */ class KTCORE_EXPORT PrefPageInterface : public QWidget { Q_OBJECT public: PrefPageInterface(KConfigSkeleton* cfg, const QString& name, const QString& icon, QWidget* parent); - virtual ~PrefPageInterface(); + ~PrefPageInterface() override; /** * Initialize the settings. * Called by the settings dialog when it is created. */ virtual void loadSettings(); /** * Load default settings. * Called when the defaults button is pressed in the settings dialog. */ virtual void loadDefaults(); /** * Called when user presses OK or apply. */ virtual void updateSettings(); KConfigSkeleton* config() {return cfg;} const QString& pageName() {return name;} const QString& pageIcon() {return icon;} /// Override if there are custom widgets outside which have changed virtual bool customWidgetsChanged() {return false;} signals: /// Emitted when buttons need to be updated void updateButtons(); private: KConfigSkeleton* cfg; QString name; QString icon; }; } #endif diff --git a/libktcore/interfaces/torrentactivityinterface.h b/libktcore/interfaces/torrentactivityinterface.h index 6b6a0c15..26625446 100644 --- a/libktcore/interfaces/torrentactivityinterface.h +++ b/libktcore/interfaces/torrentactivityinterface.h @@ -1,96 +1,96 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef TORRENTACTIVITYINTERFACE_H #define TORRENTACTIVITYINTERFACE_H #include #include namespace bt { class TorrentInterface; } namespace kt { class View; class Group; /** * Small interface for classes who want to know when * current torrent in the gui changes. */ class KTCORE_EXPORT ViewListener { public: ViewListener() {} virtual ~ViewListener() {} virtual void currentTorrentChanged(bt::TorrentInterface* tc) = 0; }; /** Interface for the TorrentActivity class */ class KTCORE_EXPORT TorrentActivityInterface : public Activity { public: TorrentActivityInterface(const QString& name, const QString& icon, QWidget* parent); - ~TorrentActivityInterface(); + ~TorrentActivityInterface() override; /// Add a view listener. void addViewListener(ViewListener* vl); /// Remove a view listener void removeViewListener(ViewListener* vl); /// Get the current torrent. virtual const bt::TorrentInterface* getCurrentTorrent() const = 0; /// Get the current torrent virtual bt::TorrentInterface* getCurrentTorrent() = 0; /// Update all actions virtual void updateActions() = 0; /// Add a tool widget to the activity virtual void addToolWidget(QWidget* widget, const QString& text, const QString& icon, const QString& tooltip) = 0; /// Remove a tool widget virtual void removeToolWidget(QWidget* widget) = 0; /// Add a new custom group virtual Group* addNewGroup() = 0; protected: /** * Notifies all view listeners of the change in the current downloading TorrentInterface * @param tc Pointer to current TorrentInterface */ void notifyViewListeners(bt::TorrentInterface* tc); private: QList listeners; }; } #endif // TORRENTACTIVITYINTERFACE_H diff --git a/libktcore/plugin/pluginactivity.h b/libktcore/plugin/pluginactivity.h index fd065d2c..dcff1b85 100644 --- a/libktcore/plugin/pluginactivity.h +++ b/libktcore/plugin/pluginactivity.h @@ -1,57 +1,57 @@ /*************************************************************************** * Copyright (C) 2005 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTPLUGINACTIVITY_H #define KTPLUGINACTIVITY_H #include #include class KPluginSelector; namespace kt { class PluginManager; /** * @author Joris Guisson * * Pref page which allows to load and unload plugins. */ class PluginActivity : public Activity { Q_OBJECT public: PluginActivity(PluginManager* pman); - ~PluginActivity(); + ~PluginActivity() override; void updatePluginList(); void update(); private slots: void changed(); private: PluginManager* pman; KPluginSelector* pmw; }; } #endif diff --git a/libktcore/torrent/basicjobprogresswidget.h b/libktcore/torrent/basicjobprogresswidget.h index 0f01e4be..a631968d 100644 --- a/libktcore/torrent/basicjobprogresswidget.h +++ b/libktcore/torrent/basicjobprogresswidget.h @@ -1,57 +1,57 @@ /*************************************************************************** * Copyright (C) 2010 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_BASICJOBPROGRESSWIDGET_H #define KT_BASICJOBPROGRESSWIDGET_H #include #include "ui_basicjobprogresswidget.h" namespace kt { /** Basic JobProgressWidget, showing a progress bar and the description */ class BasicJobProgressWidget : public kt::JobProgressWidget, public Ui_BasicJobProgressWidget { Q_OBJECT public: BasicJobProgressWidget(bt::Job* job, QWidget* parent); - ~BasicJobProgressWidget(); + ~BasicJobProgressWidget() override; void description(const QString& title, const QPair< QString, QString >& field1, const QPair< QString, QString >& field2) override; void infoMessage(const QString& plain, const QString& rich) override; void warning(const QString& plain, const QString& rich) override; void totalAmount(KJob::Unit unit, qulonglong amount) override; void processedAmount(KJob::Unit unit, qulonglong amount) override; void percent(long unsigned int percent) override; void speed(long unsigned int value) override; bool similar(Extender* ext) const override { Q_UNUSED(ext); return false; } }; } #endif // KT_BASICJOBPROGRESSWIDGET_H diff --git a/libktcore/torrent/chunkbar.h b/libktcore/torrent/chunkbar.h index 0cc7ae05..c793bab9 100644 --- a/libktcore/torrent/chunkbar.h +++ b/libktcore/torrent/chunkbar.h @@ -1,73 +1,73 @@ /*************************************************************************** * Copyright (C) 2005-2007 by * * Joris Guisson * * Vincent Wagelaar * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef CHUNKBAR_H #define CHUNKBAR_H #include #include #include #include #include "chunkbarrenderer.h" class QPainter; namespace bt { class BitSet; } namespace kt { /** * @author Joris Guisson, Vincent Wagelaar * * Bar which displays BitSets, subclasses need to fill the BitSet. * BitSets can represent which chunks are downloaded, which chunks are available * and which chunks are excluded. */ class KTCORE_EXPORT ChunkBar : public QFrame, public ChunkBarRenderer { Q_OBJECT public: ChunkBar(QWidget* parent); - virtual ~ChunkBar(); + ~ChunkBar() override; virtual const bt::BitSet& getBitSet() const = 0; void drawContents(QPainter* p); virtual void updateBar(bool force = false); protected: virtual void drawBarContents(QPainter* p); - virtual void paintEvent(QPaintEvent* ev); + void paintEvent(QPaintEvent* ev) override; protected: bt::BitSet curr; QPixmap pixmap; }; } #endif diff --git a/libktcore/torrent/jobprogresswidget.h b/libktcore/torrent/jobprogresswidget.h index 793dc84b..54e821e8 100644 --- a/libktcore/torrent/jobprogresswidget.h +++ b/libktcore/torrent/jobprogresswidget.h @@ -1,88 +1,88 @@ /*************************************************************************** * Copyright (C) 2010 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_JOBPROGRESSWIDGET_H #define KT_JOBPROGRESSWIDGET_H #include #include #include #include #include class QProgressBar; class QLabel; namespace bt { class TorrentInterface; } namespace kt { /** * Base class for widgets displaying the progress of a job */ class KTCORE_EXPORT JobProgressWidget : public Extender { Q_OBJECT public: JobProgressWidget(bt::Job* job, QWidget* parent); - ~JobProgressWidget(); + ~JobProgressWidget() override; /// Update the description virtual void description(const QString& title, const QPair< QString, QString >& field1, const QPair< QString, QString >& field2) = 0; /// Show an informational message virtual void infoMessage(const QString& plain, const QString& rich) = 0; /// Show a warning message virtual void warning(const QString& plain, const QString& rich) = 0; /// The total amount of unit has changed virtual void totalAmount(KJob::Unit unit, qulonglong amount) = 0; /// The processed amount has changed virtual void processedAmount(KJob::Unit unit, qulonglong amount) = 0; /// The percentage has changed virtual void percent(long unsigned int percent) = 0; /// The speed has changed virtual void speed(long unsigned int value) = 0; /// Emit the close request so the ViewDelegate will clean things up void emitCloseRequest(); /// Whether or not to automatically remove the widget bool automaticRemove() const {return automatic_remove;} protected: void setAutomaticRemove(bool ar) {automatic_remove = ar;} protected: bt::Job* job; bool automatic_remove; }; } #endif // KT_JOBPROGRESSWIDGET_H diff --git a/libktcore/torrent/jobtracker.h b/libktcore/torrent/jobtracker.h index 3db41652..7e4b333e 100644 --- a/libktcore/torrent/jobtracker.h +++ b/libktcore/torrent/jobtracker.h @@ -1,75 +1,75 @@ /*************************************************************************** * Copyright (C) 2010 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_JOBTRACKER_H #define KT_JOBTRACKER_H #include #include #include namespace kt { class JobProgressWidget; /** JobTracker for bt::Job's */ class KTCORE_EXPORT JobTracker : public KJobTrackerInterface { Q_OBJECT public: JobTracker(QObject* parent); - ~JobTracker(); + ~JobTracker() override; void registerJob(KJob* job) override; void unregisterJob(KJob* job) override; /// A job has been registered virtual void jobRegistered(bt::Job* j) = 0; /// A job has been unregistered virtual void jobUnregistered(bt::Job* j) = 0; /// Create a widget for a job virtual JobProgressWidget* createJobWidget(bt::Job* job); protected: void finished(KJob* job) override; void suspended(KJob* job) override; void resumed(KJob* job) override; void description(KJob* job, const QString& title, const QPair< QString, QString >& field1, const QPair< QString, QString >& field2) override; void infoMessage(KJob* job, const QString& plain, const QString& rich) override; void warning(KJob* job, const QString& plain, const QString& rich) override; void totalAmount(KJob* job, KJob::Unit unit, qulonglong amount) override; void processedAmount(KJob* job, KJob::Unit unit, qulonglong amount) override; void percent(KJob* job, long unsigned int percent) override; void speed(KJob* job, long unsigned int value) override; protected: typedef QMap ActiveJobs; ActiveJobs widgets; }; } #endif // KT_JOBTRACKER_H diff --git a/libktcore/torrent/magnetmanager.h b/libktcore/torrent/magnetmanager.h index adaa0174..39035adb 100644 --- a/libktcore/torrent/magnetmanager.h +++ b/libktcore/torrent/magnetmanager.h @@ -1,186 +1,186 @@ /*************************************************************************** * Copyright (C) 2014 by Juan Palacios * * jpalaciosdev@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef MAGNETMANAGER_H #define MAGNETMANAGER_H #include #include #include namespace kt { /// Adds options struct to bt::MagnetDownloader class MagnetDownloader : public bt::MagnetDownloader { Q_OBJECT public: MagnetDownloader(const bt::MagnetLink& mlink, const MagnetLinkLoadOptions& options, QObject* parent) : bt::MagnetDownloader(mlink, parent) , options(options) {} - ~MagnetDownloader() {} + ~MagnetDownloader() override {} MagnetLinkLoadOptions options; }; /// This class represent a downloading slot. /// A downloading slot has the index of the magnet that occupy it and a timer that /// controls the maximum time that one magnet can occupy the downloading slot. class DownloadSlot : public QObject { Q_OBJECT public: DownloadSlot(QObject *parent = nullptr); - ~DownloadSlot(); + ~DownloadSlot() override; void setTimerDuration(unsigned int duration); void startTimer(); void stopTimer(); void reset(); void setMagnetIndex(int index); int getMagnetIndex() const; bool isTimerActived() const; bool isOccupied() const; signals: void timeout(int magnetIdx); private slots: void onTimeout(); private: int magnetIdx; unsigned int timerDuration; QTimer* timer; }; /// This class manage the downloading of magnets. /// For this task uses a queue with a determined number of concurrent downloadings. /// All downloading magnets uses a timer that determines the maximum time /// that each magnet can be in the downloading state. If the magnet is not downloaded /// within this time, that magnet will be pushed back at the end of the queued list, /// just above the stopped magnets list. /// The stopped magnet links always will occupy the latests positions of the queue. class KTCORE_EXPORT MagnetManager : public QObject { Q_OBJECT public: MagnetManager(QObject* parent = nullptr); - ~MagnetManager(); + ~MagnetManager() override; /// Adds a magnet link to the queue /// @param mlink magnet link to be added /// @param options magnet link options /// @param stopped whether this magnet should be added to the queue stopped void addMagnet(const bt::MagnetLink& mlink, const MagnetLinkLoadOptions& options, bool stopped); /// Removes count successive magnets, starting on idx void removeMagnets(bt::Uint32 idx, bt::Uint32 count); /// Starts count successive magnets, starting on idx void start(bt::Uint32 idx, bt::Uint32 count); /// Stops count successive magnets, starting on idx void stop(bt::Uint32 idx, bt::Uint32 count); /// Returns whether the magnet corresponding with idx is stopped bool isStopped(bt::Uint32 idx) const; /// Set the number of concurrent downloading magnets void setDownloadingSlots(bt::Uint32 count); /// Sets if the slot timer must be used void setUseSlotTimer(bool value); /// Set the maximum time that a magnet link is in downloading state /// @param duration time in minutes void setTimerDuration(bt::Uint32 duration); /// Updates the downloading magnets void update(); /// Load all magnets from a file void loadMagnets(const QString& file); /// Save all magnets to a file void saveMagnets(const QString& file); /// Defines the magnet state on the MagnetManager enum MagnetState { DOWNLOADING, ///< Started and downloading QUEUED, ///< Started and waiting for download STOPPED ///< Stopped }; /// Return the state of the magnet corresponding to idx MagnetState status(bt::Uint32 idx) const; /// Return the number of managed magnets int count() const; /// Get the magnet downloader at index idx in the list /// @param idx index of the magnet /// @return the magnet downloader or nullptr if idx is out of bounds const kt::MagnetDownloader* getMagnetDownloader(bt::Uint32 idx) const; signals: /// Emitted when metadata has been downloaded for a MagnetLink. void metadataDownloaded(const bt::MagnetLink& mlink, const QByteArray& data, const kt::MagnetLinkLoadOptions& options); /// Emitted when the queue has been altered in some form, so the /// magnets order and/or number could be altered. /// The range of the altered magnets is determined by idx and count. /// @param idx determines the index of the first altered magnet /// @param count determines the number of magnets that must be updated void updateQueue(bt::Uint32 idx, bt::Uint32 count); private slots: void onDownloadFinished(bt::MagnetDownloader* md, const QByteArray& data); void onSlotTimeout(int magnetIdx); private: /// Start the next queued magnets and return the index of the first started magnet int startNextQueuedMagnets(); /// Free the download slot that is occuping the magnet with magnetIdx, updating /// the indices of the magnets in all magnets slots to keep it in sync with the magnet /// queue indices. void freeDownloadSlot(bt::Uint32 magnetIdx); /// Return the magnet index in the queue + the stopped list int getMagnetIndex(kt::MagnetDownloader* md); /// Writes the encoder info of one magnet void writeEncoderInfo(bt::BEncoder &enc, kt::MagnetDownloader* md); bool useSlotTimer; int timerDuration; QList usedDownloadingSlots; QList freeDownloadingSlots; QList magnetQueue; QList stoppedList; QSet magnetHashes; QSet stoppedHashes; }; } #endif // MAGNETMANAGER_H diff --git a/libktcore/torrent/queuemanager.h b/libktcore/torrent/queuemanager.h index ab39e6a5..cf8c47a2 100644 --- a/libktcore/torrent/queuemanager.h +++ b/libktcore/torrent/queuemanager.h @@ -1,305 +1,305 @@ /*************************************************************************** * Copyright (C) 2005 by Joris Guisson * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTQUEUEMANAGER_H #define KTQUEUEMANAGER_H #include #include #include #include #include #include namespace bt { class SHA1Hash; struct TrackerTier; class WaitJob; } namespace kt { class KTCORE_EXPORT QueuePtrList : public QList { public: QueuePtrList(); ~QueuePtrList(); /** * Sort based upon priority */ void sort(); protected: static bool biggerThan(bt::TorrentInterface* tc1, bt::TorrentInterface* tc2); }; /** * @author Ivan Vasic * @brief This class contains list of all TorrentControls and is responsible for starting/stopping them */ class KTCORE_EXPORT QueueManager : public QObject, public bt::QueueManagerInterface { Q_OBJECT public: QueueManager(); - ~QueueManager(); + ~QueueManager() override; void append(bt::TorrentInterface* tc); void remove(bt::TorrentInterface* tc); void clear(); /** Save the state of the QueueManager @param cfg The config */ void saveState(KSharedConfigPtr cfg); /** Load the state of the QueueManager @param cfg The config */ void loadState(KSharedConfigPtr cfg); /** * Check if we need to decrease the priority of stalled torrents * @param min_stall_time Stall time in minutes * @param now The current time */ void checkStalledTorrents(bt::TimeStamp now, bt::Uint32 min_stall_time); /** * Start a torrent * @param tc The torrent * @return What happened */ bt::TorrentStartResponse start(bt::TorrentInterface* tc); /** * Stop a torrent * @param tc The torrent */ void stop(bt::TorrentInterface* tc); /** * Start a list of torrents. * @param todo The list of torrents */ void start(QList & todo); /** * Stop a list of torrents * @param todo The list of torrents */ void stop(QList & todo); /// Stop all torrents void stopAll(); /// Start all torrents void startAll(); /** * Stop all running torrents * @param wjob WaitJob which waits for stopped events to reach the tracker */ void onExit(bt::WaitJob* wjob); /// Get the number of torrents int count() { return downloads.count(); } /// Get the number of downloads int countDownloads(); /// Get the number of seeds int countSeeds(); enum Flags { SEEDS = 1, DOWNLOADS = 2, ALL = 3 }; /** * Get the number of running torrents * @param flags Which torrents to choose */ int getNumRunning(Flags flags = ALL); /** * Start the next torrent. */ void startNext(); /** If the QM is disabled this function needs to be called to start all the torrents which were running at the time of the previous exit. */ void startAutoStartTorrents(); typedef QList::iterator iterator; iterator begin(); iterator end(); /** * Get the torrent at index idx in the list. * @param idx Index of the torrent * @return The torrent or 0 if the index is out of bounds */ const bt::TorrentInterface* getTorrent(bt::Uint32 idx) const; /** * Get the torrent at index idx in the list. * @param idx Index of the torrent * @return The torrent or 0 if the index is out of bounds */ bt::TorrentInterface* getTorrent(bt::Uint32 idx); /** * See if we already loaded a torrent. * @param ih The info hash of a torrent * @return true if we do, false if we don't */ - bool alreadyLoaded(const bt::SHA1Hash& ih) const; + bool alreadyLoaded(const bt::SHA1Hash& ih) const override; /** * Merge announce lists to a torrent * @param ih The info_hash of the torrent to merge to * @param trk First tier of trackers */ - void mergeAnnounceList(const bt::SHA1Hash& ih, const bt::TrackerTier* trk); + void mergeAnnounceList(const bt::SHA1Hash& ih, const bt::TrackerTier* trk) override; /** * Set the maximum number of downloads * @param m Max downloads */ void setMaxDownloads(int m); /** * Set the maximum number of seeds * @param m Max seeds */ void setMaxSeeds(int m); /** * Enable or disable keep seeding (after a torrent has finished) * @param ks Keep seeding */ void setKeepSeeding(bool ks); /** * Sets global suspended state for QueueManager and stopps all running torrents. * No torrents will be automatically started/stopped with QM. */ void setSuspendedState(bool suspend); /// Get the suspended state bool getSuspendedState() const {return suspended_state;} /** * Reindex the queue priorities. */ void reindexQueue(); /** * Check if a torrent has file conflicts with other torrents. * If conflicting are found, a list of names of the conflicting torrents is filled in. * @param tc The torrent * @param conflicting List of conflicting torrents */ bool checkFileConflicts(bt::TorrentInterface* tc, QStringList& conflicting) const; /** * Places all torrents from downloads in the right order in queue. * Use this when torrent priorities get changed */ void orderQueue(); Q_SIGNALS: /** * User tried to enqueue a torrent that has reached max share ratio. It's not possible. * Signal should be connected to SysTray slot which shows appropriate KPassivePopup info. * @param tc The torrent in question. */ void queuingNotPossible(bt::TorrentInterface* tc); /** * Diskspace is running low. * Signal should be connected to SysTray slot which shows appropriate KPassivePopup info. * @param tc The torrent in question. */ void lowDiskSpace(bt::TorrentInterface* tc, bool stopped); /// Emitted before the queue is reordered void orderingQueue(); /** * Emitted when the QM has reordered it's queue */ void queueOrdered(); /** * Emitted when the suspended state changes. * @param suspended The suspended state */ void suspendStateChanged(bool suspended); public Q_SLOTS: void torrentFinished(bt::TorrentInterface* tc); void torrentAdded(bt::TorrentInterface* tc, bool start_torrent); void torrentRemoved(bt::TorrentInterface* tc); void torrentsRemoved(QList & tors); void torrentStopped(bt::TorrentInterface* tc); void onLowDiskSpace(bt::TorrentInterface* tc, bool toStop); void onOnlineStateChanged(bool); private: void startSafely(bt::TorrentInterface* tc); void stopSafely(bt::TorrentInterface* tc, bt::WaitJob* wjob = 0); void checkDiskSpace(QList & todo); void checkMaxSeedTime(QList & todo); void checkMaxRatio(QList & todo); void rearrangeQueue(); bt::TorrentStartResponse startInternal(bt::TorrentInterface* tc); bool checkLimits(bt::TorrentInterface* tc, bool interactive); bool checkDiskSpace(bt::TorrentInterface* tc, bool interactive); private: QueuePtrList downloads; std::set suspended_torrents; int max_downloads; int max_seeds; bool suspended_state; bool keep_seeding; bool exiting; bool ordering; QDateTime network_down_time; }; } #endif diff --git a/libktcore/torrent/torrentfilelistmodel.h b/libktcore/torrent/torrentfilelistmodel.h index 1575e904..8d2ad2a4 100644 --- a/libktcore/torrent/torrentfilelistmodel.h +++ b/libktcore/torrent/torrentfilelistmodel.h @@ -1,63 +1,63 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTTORRENTFILELISTMODEL_H #define KTTORRENTFILELISTMODEL_H #include "torrentfilemodel.h" namespace kt { /** * Model for displaying file trees of a torrent * @author Joris Guisson */ class KTCORE_EXPORT TorrentFileListModel : public TorrentFileModel { Q_OBJECT public: TorrentFileListModel(bt::TorrentInterface* tc, DeselectMode mode, QObject* parent); - ~TorrentFileListModel(); + ~TorrentFileListModel() override; void changeTorrent(bt::TorrentInterface* tc) override; int rowCount(const QModelIndex& parent) const override; int columnCount(const QModelIndex& parent) const override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; QVariant data(const QModelIndex& index, int role) const override; QModelIndex parent(const QModelIndex& index) const override; QModelIndex index(int row, int column, const QModelIndex& parent) const override; bool setData(const QModelIndex& index, const QVariant& value, int role) override; void checkAll() override; void uncheckAll() override; void invertCheck() override; bt::Uint64 bytesToDownload() override; bt::TorrentFileInterface* indexToFile(const QModelIndex& idx) override; QString dirPath(const QModelIndex& idx) override; void changePriority(const QModelIndexList& indexes, bt::Priority newpriority) override; private: void invertCheck(const QModelIndex& idx); }; } #endif diff --git a/libktcore/torrent/torrentfilemodel.h b/libktcore/torrent/torrentfilemodel.h index 3f673e39..1e377233 100644 --- a/libktcore/torrent/torrentfilemodel.h +++ b/libktcore/torrent/torrentfilemodel.h @@ -1,154 +1,154 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTTORRENTFILEMODEL_HH #define KTTORRENTFILEMODEL_HH #include #include #include #include class QTreeView; class QSortFilterProxyModel; namespace bt { class TorrentInterface; class TorrentFileInterface; } namespace kt { class KTCORE_EXPORT TorrentFileModel : public QAbstractItemModel { Q_OBJECT public: enum DeselectMode { KEEP_FILES, DELETE_FILES }; TorrentFileModel(bt::TorrentInterface* tc, DeselectMode mode, QObject* parent); - virtual ~TorrentFileModel(); + ~TorrentFileModel() override; /** * Change the current torrent */ virtual void changeTorrent(bt::TorrentInterface* tc) = 0; /** * Check all the files in the torrent. */ virtual void checkAll() = 0; /** * Uncheck all files in the torrent. */ virtual void uncheckAll() = 0; /** * Invert the check of each file of the torrent */ virtual void invertCheck() = 0; /** * Calculate the number of bytes to download * @return Bytes to download */ virtual bt::Uint64 bytesToDownload() = 0; /** * Save which items are expanded. * @param pm Proxy model of the view * @param tv The QTreeView * @return The expanded state encoded in a byte array */ virtual QByteArray saveExpandedState(QSortFilterProxyModel* pm, QTreeView* tv); /** * Retore the expanded state of the tree.in a QTreeView * @param pm Proxy model of the view * @param tv The QTreeView * @param state The encoded expanded state */ virtual void loadExpandedState(QSortFilterProxyModel* pm, QTreeView* tv, const QByteArray& state); /** * Convert a model index to a file. * @param idx The model index * @return The file index or 0 for a directory **/ virtual bt::TorrentFileInterface* indexToFile(const QModelIndex& idx) = 0; /** * Get the path of a directory (root directory not included) * @param idx The model index * @return The path */ virtual QString dirPath(const QModelIndex& idx) = 0; /** * Change the priority of a bunch of items. * @param indexes The list of items * @param newpriority The new priority */ virtual void changePriority(const QModelIndexList& indexes, bt::Priority newpriority) = 0; /** * Missing files have been marked DND, update the preview and selection information. */ virtual void missingFilesMarkedDND(); /** * Update gui if necessary */ virtual void update(); /** * Codec has changed, so update the model. */ virtual void onCodecChange(); /// Set the file names editable void setFileNamesEditable(bool on) {file_names_editable = on;} /// Are the file names editable bool fileNamesEditable() const {return file_names_editable;} Qt::ItemFlags flags(const QModelIndex& index) const override; virtual void filePercentageChanged(bt::TorrentFileInterface* file, float percentage); virtual void filePreviewChanged(bt::TorrentFileInterface* file, bool preview); signals: /** * Emitted whenever one or more items changes check state */ void checkStateChanged(); protected: bt::TorrentInterface* tc; DeselectMode mode; bool file_names_editable; }; } #endif diff --git a/libktcore/torrent/torrentfiletreemodel.h b/libktcore/torrent/torrentfiletreemodel.h index ec2a8bf3..abb5a4a5 100644 --- a/libktcore/torrent/torrentfiletreemodel.h +++ b/libktcore/torrent/torrentfiletreemodel.h @@ -1,114 +1,114 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTTORRENTFILETREEMODEL_H #define KTTORRENTFILETREEMODEL_H #include "torrentfilemodel.h" #include class QSortFilterProxyModel; namespace bt { class BEncoder; class BNode; } namespace kt { /** * Model for displaying file trees of a torrent * @author Joris Guisson */ class KTCORE_EXPORT TorrentFileTreeModel : public TorrentFileModel { Q_OBJECT protected: struct KTCORE_EXPORT Node { Node* parent; bt::TorrentFileInterface* file; // file (0 if this is a directory) QString name; // name or directory QList children; // child dirs bt::Uint64 size; bt::BitSet chunks; bool chunks_set; float percentage; Node(Node* parent, bt::TorrentFileInterface* file, const QString& name, bt::Uint32 total_chunks); Node(Node* parent, const QString& name, bt::Uint32 total_chunks); ~Node(); void insert(const QString& path, bt::TorrentFileInterface* file, bt::Uint32 num_chunks); int row(); bt::Uint64 fileSize(const bt::TorrentInterface* tc); bt::Uint64 bytesToDownload(const bt::TorrentInterface* tc); Qt::CheckState checkState(const bt::TorrentInterface* tc) const; QString path(); void fillChunks(); void updatePercentage(const bt::BitSet& havechunks); void initPercentage(const bt::TorrentInterface* tc, const bt::BitSet& havechunks); void saveExpandedState(const QModelIndex& index, QSortFilterProxyModel* pm, QTreeView* tv, bt::BEncoder* enc); void loadExpandedState(const QModelIndex& index, QSortFilterProxyModel* pm, QTreeView* tv, bt::BNode* node); }; public: TorrentFileTreeModel(bt::TorrentInterface* tc, DeselectMode mode, QObject* parent); - ~TorrentFileTreeModel(); + ~TorrentFileTreeModel() override; void changeTorrent(bt::TorrentInterface* tc) override; int rowCount(const QModelIndex& parent) const override; int columnCount(const QModelIndex& parent) const override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; QVariant data(const QModelIndex& index, int role) const override; QModelIndex parent(const QModelIndex& index) const override; QModelIndex index(int row, int column, const QModelIndex& parent) const override; bool setData(const QModelIndex& index, const QVariant& value, int role) override; void checkAll() override; void uncheckAll() override; void invertCheck() override; bt::Uint64 bytesToDownload() override; QByteArray saveExpandedState(QSortFilterProxyModel* pm, QTreeView* tv) override; void loadExpandedState(QSortFilterProxyModel* pm, QTreeView* tv, const QByteArray& state) override; bt::TorrentFileInterface* indexToFile(const QModelIndex& idx) override; QString dirPath(const QModelIndex& idx) override; void changePriority(const QModelIndexList& indexes, bt::Priority newpriority) override; void onCodecChange() override; private: void constructTree(); void invertCheck(const QModelIndex& idx); bool setCheckState(const QModelIndex& index, Qt::CheckState state); bool setName(const QModelIndex& index, const QString& name); void modifyPathOfFiles(Node* n, const QString& path); protected: Node* root; bool emit_check_state_change; }; } #endif diff --git a/libktcore/util/itemselectionmodel.h b/libktcore/util/itemselectionmodel.h index 59d31476..a2be16d7 100644 --- a/libktcore/util/itemselectionmodel.h +++ b/libktcore/util/itemselectionmodel.h @@ -1,60 +1,60 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef ITEMSELECTIONMODEL_H #define ITEMSELECTIONMODEL_H #include #include #include namespace kt { /** * Selection model which works on internal pointers instead of indexes. */ class KTCORE_EXPORT ItemSelectionModel : public QItemSelectionModel { Q_OBJECT public: ItemSelectionModel(QAbstractItemModel* model, QObject* parent); - ~ItemSelectionModel(); + ~ItemSelectionModel() override; void select(const QModelIndex& index, QItemSelectionModel::SelectionFlags command) override; void select(const QItemSelection& sel, QItemSelectionModel::SelectionFlags command) override; void clear() override; void reset() override; public slots: /** * Updates the selection after a sort. */ void sorted(); private: void doRange(const QItemSelectionRange r, QItemSelectionModel::SelectionFlags command); private: QSet selection; }; } #endif // ITEMSELECTIONMODEL_H diff --git a/libktcore/util/stringcompletionmodel.h b/libktcore/util/stringcompletionmodel.h index be35c8ad..5f30840c 100644 --- a/libktcore/util/stringcompletionmodel.h +++ b/libktcore/util/stringcompletionmodel.h @@ -1,60 +1,60 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_STRINGCOMPLETIONMODEL_H #define KT_STRINGCOMPLETIONMODEL_H #include #include namespace kt { /** Model for a QCompleter which works with a list of unique strings loaded from a file. */ class KTCORE_EXPORT StringCompletionModel : public QStringListModel { Q_OBJECT public: StringCompletionModel(const QString& file, QObject* parent); - ~StringCompletionModel(); + ~StringCompletionModel() override; /** Load the list of strings. */ void load(); /** Save the list of strings to the file */ void save(); /** Add a string to the list, automatically saves it. */ void addString(const QString& s); private: QString file; }; } #endif // KT_STRINGCOMPLETIONMODEL_H diff --git a/libktcore/util/treefiltermodel.h b/libktcore/util/treefiltermodel.h index 15ec7f21..89d19a60 100644 --- a/libktcore/util/treefiltermodel.h +++ b/libktcore/util/treefiltermodel.h @@ -1,44 +1,44 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_TREEFILTERMODEL_H #define KT_TREEFILTERMODEL_H #include #include namespace kt { /** SortFilterProxyModel for trees, which doesn't */ class KTCORE_EXPORT TreeFilterModel : public QSortFilterProxyModel { public: TreeFilterModel(QObject* parent = 0); - ~TreeFilterModel(); + ~TreeFilterModel() override; protected: bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override; }; } #endif // KT_TREEFILTERMODEL_H diff --git a/plugins/bwscheduler/bwprefpage.h b/plugins/bwscheduler/bwprefpage.h index 4f855d2a..215bb633 100644 --- a/plugins/bwscheduler/bwprefpage.h +++ b/plugins/bwscheduler/bwprefpage.h @@ -1,51 +1,51 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTBWPREFPAGE_H #define KTBWPREFPAGE_H #include #include "ui_bwprefpage.h" namespace kt { /** @author */ class BWPrefPage : public PrefPageInterface, public Ui_BWPrefPage { Q_OBJECT public: BWPrefPage(QWidget* parent); - ~BWPrefPage(); + ~BWPrefPage() override; - void loadDefaults(); - void loadSettings(); - void updateSettings(); + void loadDefaults() override; + void loadSettings() override; + void updateSettings() override; signals: void colorsChanged(); }; } #endif diff --git a/plugins/bwscheduler/bwschedulerplugin.h b/plugins/bwscheduler/bwschedulerplugin.h index 48b63248..018858c0 100644 --- a/plugins/bwscheduler/bwschedulerplugin.h +++ b/plugins/bwscheduler/bwschedulerplugin.h @@ -1,78 +1,78 @@ /*************************************************************************** * Copyright (C) 2006 by Ivan Vasić * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTschedulerPLUGIN_H #define KTschedulerPLUGIN_H #include #include #include #include #include "screensaver_interface.h" class QString; namespace kt { class ScheduleEditor; class Schedule; class BWPrefPage; /** * @author Ivan Vasic * @brief KTorrent scheduler plugin. * */ class BWSchedulerPlugin : public Plugin { Q_OBJECT public: BWSchedulerPlugin(QObject* parent, const QVariantList& args); - ~BWSchedulerPlugin(); + ~BWSchedulerPlugin() override; void load() override; void unload() override; bool versionCheck(const QString& version) const override; public slots: void timerTriggered(); void onLoaded(Schedule* ns); void colorsChanged(); void screensaverActivated(bool on); void networkStatusChanged(bool online); private: void setNormalLimits(); void restartTimer(); private: QTimer m_timer; ScheduleEditor* m_editor; Schedule* m_schedule; BWPrefPage* m_pref; org::freedesktop::ScreenSaver* screensaver; bool screensaver_on; }; } #endif diff --git a/plugins/bwscheduler/edititemdlg.h b/plugins/bwscheduler/edititemdlg.h index 369f8320..a916a16e 100644 --- a/plugins/bwscheduler/edititemdlg.h +++ b/plugins/bwscheduler/edititemdlg.h @@ -1,66 +1,66 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTEDITITEMDLG_H #define KTEDITITEMDLG_H #include #include "ui_edititemdlg.h" namespace kt { struct ScheduleItem; class Schedule; /** @author */ class EditItemDlg : public QDialog, public Ui_EditItemDlg { Q_OBJECT public: EditItemDlg(Schedule* schedule, ScheduleItem* item, bool new_item, QWidget* parent); - ~EditItemDlg(); + ~EditItemDlg() override; /** * accept will only work if the item does not conflict **/ void accept() override; private slots: void fromChanged(const QTime& time); void toChanged(const QTime& time); void startDayChanged(int idx); void endDayChanged(int idx); void suspendedChanged(bool on); void screensaverLimitsToggled(bool on); private: void fillItem(); private: Schedule* schedule; ScheduleItem* item; }; } #endif diff --git a/plugins/bwscheduler/guidanceline.h b/plugins/bwscheduler/guidanceline.h index d0c12bbc..27014475 100644 --- a/plugins/bwscheduler/guidanceline.h +++ b/plugins/bwscheduler/guidanceline.h @@ -1,57 +1,57 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTGUIDANCELINE_H #define KTGUIDANCELINE_H #include #include namespace kt { /** Line displayed when the user is resizing or moving items The line has a text item below it to the side */ class GuidanceLine : public QGraphicsLineItem { public: GuidanceLine(qreal x, qreal y, qreal text_offset); - ~GuidanceLine(); + ~GuidanceLine() override; /** * Update the guidance line * @param nx The nex x start * @param ny The new y start * @param text The text to display */ void update(qreal nx, qreal ny, const QString& text); private: qreal x; qreal y; qreal text_offset; QGraphicsTextItem* text; }; } #endif diff --git a/plugins/bwscheduler/scheduleeditor.h b/plugins/bwscheduler/scheduleeditor.h index bf73868e..5268a2d4 100644 --- a/plugins/bwscheduler/scheduleeditor.h +++ b/plugins/bwscheduler/scheduleeditor.h @@ -1,108 +1,108 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTSCHEDULEEDITOR_H #define KTSCHEDULEEDITOR_H #include class QCheckBox; namespace kt { class WeekView; class Schedule; struct ScheduleItem; /** @author */ class ScheduleEditor : public Activity { Q_OBJECT public: ScheduleEditor(QWidget* parent); - ~ScheduleEditor(); + ~ScheduleEditor() override; /** * Set the current Schedule * @param s The current schedule */ void setSchedule(Schedule* s); /** * Update the text of the status line * @param up Up speed * @param down Down speed * @param suspended Suspended or not * @param enabled Enabled or not */ void updateStatusText(int up, int down, bool suspended, bool enabled); /** * The color settings have changed */ void colorsChanged(); private slots: void clear(); void save(); void load(); void addItem(); void removeItem(); void editItem(); void onSelectionChanged(); void editItem(ScheduleItem* item); void itemMoved(ScheduleItem* item, const QTime& start, const QTime& end, int start_day, int end_day); void enableChecked(bool on); signals: /** * Emitted when the user loads a new schedule. * @param ns The new schedule */ void loaded(Schedule* ns); /** * Emitted when something changes in the schedule. */ void scheduleChanged(); private: void setupActions(); QAction* addAction(const QString& icon, const QString& text, const QString& name, QObject* obj, const char* slot); private: WeekView* view; Schedule* schedule; QAction* load_action; QAction* save_action; QAction* new_item_action; QAction* remove_item_action; QAction* edit_item_action; QAction* clear_action; QCheckBox* enable_schedule; }; } #endif diff --git a/plugins/bwscheduler/schedulegraphicsitem.h b/plugins/bwscheduler/schedulegraphicsitem.h index 829064eb..749b0949 100644 --- a/plugins/bwscheduler/schedulegraphicsitem.h +++ b/plugins/bwscheduler/schedulegraphicsitem.h @@ -1,73 +1,73 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTSCHEDULEGRAPHICSITEM_H #define KTSCHEDULEGRAPHICSITEM_H #include #include "schedule.h" namespace kt { class WeekScene; /** QGraphicsItem to display a ScheduleItem */ class ScheduleGraphicsItem : public QGraphicsRectItem { public: ScheduleGraphicsItem(ScheduleItem* item, const QRectF& r, const QRectF& constraints, WeekScene* ws); - ~ScheduleGraphicsItem(); + ~ScheduleGraphicsItem() override; QVariant itemChange(GraphicsItemChange change, const QVariant& value) override; /** * Update the item. * @param r The new rect */ void update(const QRectF& r); private: void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override; void mousePressEvent(QGraphicsSceneMouseEvent* event) override; void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override; void hoverEnterEvent(QGraphicsSceneHoverEvent* event) override; void hoverLeaveEvent(QGraphicsSceneHoverEvent* event) override; void hoverMoveEvent(QGraphicsSceneHoverEvent* event) override; bt::Uint32 nearEdge(QPointF p); QRectF resize(QPointF scene_pos); void updateCursor(); private: ScheduleItem* item; QRectF constraints; WeekScene* ws; QGraphicsTextItem* text_item; QPointF original_pos; bt::Uint32 resize_edge; bool ready_to_resize; bool resizing; }; } #endif diff --git a/plugins/bwscheduler/weekdaymodel.h b/plugins/bwscheduler/weekdaymodel.h index 081d1276..2595acfb 100644 --- a/plugins/bwscheduler/weekdaymodel.h +++ b/plugins/bwscheduler/weekdaymodel.h @@ -1,54 +1,54 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTWEEKDAYMODEL_H #define KTWEEKDAYMODEL_H #include namespace kt { /** Model to display the days of a week in a list view. The weekdays are checkable. @author */ class WeekDayModel : public QAbstractListModel { Q_OBJECT public: WeekDayModel(QObject* parent); - ~WeekDayModel(); + ~WeekDayModel() override; int rowCount(const QModelIndex& parent) const override; QVariant data(const QModelIndex& index, int role) const override; bool setData(const QModelIndex& index, const QVariant& value, int role) override; Qt::ItemFlags flags(const QModelIndex& index) const override; /// Get all the days which have been checked QList checkedDays() const; private: bool checked[7]; }; } #endif diff --git a/plugins/bwscheduler/weekscene.h b/plugins/bwscheduler/weekscene.h index 6eb078c5..9e390f18 100644 --- a/plugins/bwscheduler/weekscene.h +++ b/plugins/bwscheduler/weekscene.h @@ -1,154 +1,154 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTWEEKSCENE_H #define KTWEEKSCENE_H #include namespace kt { class Schedule; struct ScheduleItem; class GuidanceLine; /** @author */ class WeekScene : public QGraphicsScene { Q_OBJECT public: WeekScene(QObject* parent); - ~WeekScene(); + ~WeekScene() override; /** * Set the current Schedule * @param s The current schedule */ void setSchedule(Schedule* s) {schedule = s;} /** * Add an item to the schedule. * @param item The item to add */ QGraphicsItem* addScheduleItem(ScheduleItem* item); /** * Update the text of the status line * @param up Up speed * @param down Down speed * @param suspended Suspended or not * @param enabled Enabled or not */ void updateStatusText(int up, int down, bool suspended, bool enabled); /** * A schedule item has been moved by the user. * @param item The item * @param np New position */ void itemMoved(ScheduleItem* item, const QPointF& np); /** * Is a move valid, does it conflict or not ? * @param item The item * @param np New position */ bool validMove(ScheduleItem* item, const QPointF& np); /** * An item has been resized by the user. * @param item The item * @param r It's new rectangle */ void itemResized(ScheduleItem* item, const QRectF& r); /** * Is a resize valid, does it conflict or not ? * @param item The item * @param np New position */ bool validResize(ScheduleItem* item, const QRectF& r); /** * An item has changed, update it. * @param item The item * @param gi The GraphicsItem */ void itemChanged(ScheduleItem* item, QGraphicsItem* gi); /** * The color settings have changed. */ void colorsChanged(); /** * Show or the guidance lines * @param on */ void setShowGuidanceLines(bool on); /** * Show the guidance lines * @param y1 Height of line 1 * @param y2 Height of line 2 */ void updateGuidanceLines(qreal y1, qreal y2); signals: /** * Emitted when an item has been double clicked. * @param gi Item double clicked */ void itemDoubleClicked(QGraphicsItem* gi); /** * An item has been moved * @param item The item * @param start The new start time * @param end The new end time * @param day The new day */ void itemMoved(ScheduleItem* item, const QTime& start, const QTime& end, int start_day, int end_day); private: void addCalendar(); void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* ev) override; void mousePressEvent(QGraphicsSceneMouseEvent* ev) override; qreal timeToY(const QTime& time); QTime yToTime(qreal y); private: qreal xoff; qreal yoff; qreal day_width; qreal hour_height; QGraphicsTextItem* status; QList lines; QList rects; GuidanceLine* gline[2]; // guidance lines Schedule* schedule; }; } #endif diff --git a/plugins/bwscheduler/weekview.h b/plugins/bwscheduler/weekview.h index 633d3adb..31c778c7 100644 --- a/plugins/bwscheduler/weekview.h +++ b/plugins/bwscheduler/weekview.h @@ -1,118 +1,118 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTWEEKVIEW_H #define KTWEEKVIEW_H #include #include #include #include namespace kt { struct ScheduleItem; class Schedule; class WeekScene; /** Displays the schedule of one week. */ class WeekView : public QGraphicsView { Q_OBJECT public: WeekView(QWidget* parent); - ~WeekView(); + ~WeekView() override; /** * Set the current Schedule * @param s The current schedule */ void setSchedule(Schedule* s); /** * Clear the current Schedule. */ void clear(); /// Get the selected items QList selectedItems() {return selection;} /** * Add an item to the schedule. * @param item The item to add */ void addScheduleItem(ScheduleItem* item); /** * Remove all selected items from the schedule. */ void removeSelectedItems(); /// Get the right click menu QMenu* rightClickMenu() {return menu;} /** * Update the text of the status line * @param up Up speed * @param down Down speed * @param suspended Suspended or not * @param enabled Enabled or not */ void updateStatusText(int up, int down, bool suspended, bool enabled); /** * Something has changed about an item * @param item */ void itemChanged(ScheduleItem* item); /** * The color settings have changed. */ void colorsChanged(); Q_SIGNALS: void selectionChanged(); void editItem(ScheduleItem* item); void itemMoved(ScheduleItem* item, const QTime& start, const QTime& end, int start_day, int end_day); private Q_SLOTS: void onSelectionChanged(); void showContextMenu(const QPoint& pos); void onDoubleClicked(QGraphicsItem* i); private: WeekScene* scene; Schedule* schedule; QMap item_map; QList selection; QMenu* menu; }; } #endif diff --git a/plugins/downloadorder/downloadorderdialog.h b/plugins/downloadorder/downloadorderdialog.h index c22ca3ee..3f05c74b 100644 --- a/plugins/downloadorder/downloadorderdialog.h +++ b/plugins/downloadorder/downloadorderdialog.h @@ -1,66 +1,66 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTDOWNLOADORDERDIALOG_H #define KTDOWNLOADORDERDIALOG_H #include #include "ui_downloadorderwidget.h" namespace bt { class TorrentInterface; } namespace kt { class DownloadOrderPlugin; class DownloadOrderModel; /** Dialog to manipulate the download order. */ class DownloadOrderDialog : public QDialog, public Ui_DownloadOrderWidget { Q_OBJECT public: DownloadOrderDialog(DownloadOrderPlugin* plugin, bt::TorrentInterface* tor, QWidget* parent); - ~DownloadOrderDialog(); + ~DownloadOrderDialog() override; private slots: void commitDownloadOrder(); void moveUp(); void moveDown(); void moveTop(); void moveBottom(); void itemSelectionChanged(const QItemSelection& new_sel, const QItemSelection& old_sel); void customOrderEnableToggled(bool on); void search(const QString& text); private: bt::TorrentInterface* tor; DownloadOrderPlugin* plugin; DownloadOrderModel* model; }; } #endif diff --git a/plugins/downloadorder/downloadordermanager.h b/plugins/downloadorder/downloadordermanager.h index 3bcac88c..106939ed 100644 --- a/plugins/downloadorder/downloadordermanager.h +++ b/plugins/downloadorder/downloadordermanager.h @@ -1,93 +1,93 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTDOWNLOADORDERMANAGER_H #define KTDOWNLOADORDERMANAGER_H #include #include #include namespace bt { class TorrentInterface; } namespace kt { /** Class which manages the file download order for a single torrent */ class DownloadOrderManager : public QObject { Q_OBJECT public: DownloadOrderManager(bt::TorrentInterface* tor); - ~DownloadOrderManager(); + ~DownloadOrderManager() override; /// See if the file download order is enabled bool enabled() const {return order.count() > 0;} /// Save the order from torX/download_order void save(); /// Load the order to torX/download_order void load(); /// Enable the download order void enable(); /// Disable the download order void disable(); typedef QList Order; /// Get the download order const Order& downloadOrder() const {return order;} /// Set the order void setDownloadOrder(const Order& norder) {order = norder;} public slots: /** * Change file priorities if needed */ void update(); /** * Change file priorities if needed */ void chunkDownloaded(bt::TorrentInterface* me, bt::Uint32 chunk); private: bt::Uint32 nextIncompleteFile(); private: bt::TorrentInterface* tor; QList order; bt::Uint32 current_high_priority_file; bt::Uint32 current_normal_priority_file; }; } #endif diff --git a/plugins/downloadorder/downloadordermodel.h b/plugins/downloadorder/downloadordermodel.h index 8736cea4..e127c49b 100644 --- a/plugins/downloadorder/downloadordermodel.h +++ b/plugins/downloadorder/downloadordermodel.h @@ -1,84 +1,84 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTDOWNLOADORDERMODEL_H #define KTDOWNLOADORDERMODEL_H #include #include namespace bt { class TorrentInterface; } namespace kt { /** Model for the download order in the dialog */ class DownloadOrderModel : public QAbstractListModel { Q_OBJECT public: DownloadOrderModel(bt::TorrentInterface* tor, QObject* parent); - ~DownloadOrderModel(); + ~DownloadOrderModel() override; /// Initialize the order void initOrder(const QList & sl) {order = sl;} /// Get the order const QList & downloadOrder() const {return order;} /// Find a text in the file list QModelIndex find(const QString& text); /// Clear high lights void clearHighLights(); int rowCount(const QModelIndex& parent) const override; QVariant data(const QModelIndex& index, int role) const override; Qt::ItemFlags flags(const QModelIndex& index) const override; Qt::DropActions supportedDropActions() const override; QStringList mimeTypes() const override; QMimeData* mimeData(const QModelIndexList& indexes) const override; bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override; void moveUp(int row, int count); void moveDown(int row, int count); void moveTop(int row, int count); void moveBottom(int row, int count); public slots: void sortByName(); void sortBySeasonsAndEpisodes(); void sortByAlbumTrackOrder(); private: bt::TorrentInterface* tor; QList order; QString current_search_text; }; } #endif diff --git a/plugins/downloadorder/downloadorderplugin.h b/plugins/downloadorder/downloadorderplugin.h index 4bd79bac..4a5381b2 100644 --- a/plugins/downloadorder/downloadorderplugin.h +++ b/plugins/downloadorder/downloadorderplugin.h @@ -1,69 +1,69 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTDOWNLOADORDERPLUGIN_H #define KTDOWNLOADORDERPLUGIN_H #include #include #include namespace kt { class DownloadOrderManager; /** @author */ class DownloadOrderPlugin : public Plugin, public ViewListener { Q_OBJECT public: DownloadOrderPlugin(QObject* parent, const QVariantList& args); - ~DownloadOrderPlugin(); + ~DownloadOrderPlugin() override; bool versionCheck(const QString& version) const override; void load() override; void unload() override; void currentTorrentChanged(bt::TorrentInterface* tc) override; QString parentPart() const override {return QStringLiteral("torrentactivity");} /// Get the download order manager for a torrent (returns 0 if none exists) DownloadOrderManager* manager(bt::TorrentInterface* tc); /// Create a manager for a torrent DownloadOrderManager* createManager(bt::TorrentInterface* tc); /// Destroy a manager void destroyManager(bt::TorrentInterface* tc); private slots: void showDownloadOrderDialog(); void torrentAdded(bt::TorrentInterface* tc); void torrentRemoved(bt::TorrentInterface* tc); private: QAction * download_order_action; bt::PtrMap managers; }; } #endif diff --git a/plugins/infowidget/addtrackersdialog.h b/plugins/infowidget/addtrackersdialog.h index 86e923bf..7665861a 100644 --- a/plugins/infowidget/addtrackersdialog.h +++ b/plugins/infowidget/addtrackersdialog.h @@ -1,51 +1,51 @@ /*************************************************************************** * Copyright (C) 2012 by * * Joris Guisson * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_ADDTRACKERSDIALOG_H #define KT_ADDTRACKERSDIALOG_H #include #include namespace kt { /** * Dialog to add trackers */ class AddTrackersDialog : public QDialog { Q_OBJECT public: AddTrackersDialog(QWidget* parent, const QStringList& tracker_hints); - ~AddTrackersDialog(); + ~AddTrackersDialog() override; /// Get the tracker list QStringList trackerList() const; private: KEditListWidget* trackers; }; } #endif // KT_ADDTRACKERSDIALOG_H diff --git a/plugins/infowidget/availabilitychunkbar.h b/plugins/infowidget/availabilitychunkbar.h index 0bfb3d0e..69e56245 100644 --- a/plugins/infowidget/availabilitychunkbar.h +++ b/plugins/infowidget/availabilitychunkbar.h @@ -1,48 +1,48 @@ /*************************************************************************** * Copyright (C) 2005-2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef AVAILABILITYCHUNKBAR_H #define AVAILABILITYCHUNKBAR_H #include #include namespace kt { /** @author Joris Guisson */ class AvailabilityChunkBar : public ChunkBar { Q_OBJECT public: AvailabilityChunkBar(QWidget* parent); - ~AvailabilityChunkBar(); + ~AvailabilityChunkBar() override; const bt::BitSet& getBitSet() const override; void setTC(bt::TorrentInterface* tc); private: bt::TorrentInterface* curr_tc; }; } #endif diff --git a/plugins/infowidget/chunkdownloadmodel.h b/plugins/infowidget/chunkdownloadmodel.h index f540f280..4e761dba 100644 --- a/plugins/infowidget/chunkdownloadmodel.h +++ b/plugins/infowidget/chunkdownloadmodel.h @@ -1,91 +1,91 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTCHUNKDOWNLOADMODEL_H #define KTCHUNKDOWNLOADMODEL_H #include #include #include #include namespace kt { /** @author */ class ChunkDownloadModel : public QAbstractTableModel { Q_OBJECT public: ChunkDownloadModel(QObject* parent); - ~ChunkDownloadModel(); + ~ChunkDownloadModel() override; /// A peer has been added void downloadAdded(bt::ChunkDownloadInterface* cd); /// A download has been removed void downloadRemoved(bt::ChunkDownloadInterface* cd); /// change the current torrent void changeTC(bt::TorrentInterface* tc); /** * Update the model */ void update(); /** Clear the model */ void clear(); int rowCount(const QModelIndex& parent) const override; int columnCount(const QModelIndex& parent) const override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; QVariant data(const QModelIndex& index, int role) const override; bool removeRows(int row, int count, const QModelIndex& parent) override; bool insertRows(int row, int count, const QModelIndex& parent) override; QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override; public: struct Item { mutable bt::ChunkDownloadInterface::Stats stats; bt::ChunkDownloadInterface* cd; QString files; Item(bt::ChunkDownloadInterface* cd, const QString& files); bool changed() const; QVariant data(int col) const; QVariant sortData(int col) const; }; private: QVector items; bt::TorrentInterface::WPtr tc; }; } #endif diff --git a/plugins/infowidget/chunkdownloadview.h b/plugins/infowidget/chunkdownloadview.h index 35d13f58..23e3750d 100644 --- a/plugins/infowidget/chunkdownloadview.h +++ b/plugins/infowidget/chunkdownloadview.h @@ -1,75 +1,75 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_CHUNKDOWNLOADVIEW_HH #define KT_CHUNKDOWNLOADVIEW_HH #include #include #include #include #include #include "ui_chunkdownloadview.h" namespace kt { class ChunkDownloadModel; /** * View which shows a list of downloading chunks, of a torrent. * */ class ChunkDownloadView : public QWidget, public Ui_ChunkDownloadView { Q_OBJECT public: ChunkDownloadView(QWidget* parent); - ~ChunkDownloadView(); + ~ChunkDownloadView() override; /// A peer has been added void downloadAdded(bt::ChunkDownloadInterface* cd); /// A download has been removed void downloadRemoved(bt::ChunkDownloadInterface* cd); /// Check to see if the GUI needs to be updated void update(); /// Change the torrent to display void changeTC(bt::TorrentInterface* tc); /// Remove all items void removeAll(); void saveState(KSharedConfigPtr cfg); void loadState(KSharedConfigPtr cfg); private: bt::TorrentInterface::WPtr curr_tc; ChunkDownloadModel* model; QSortFilterProxyModel* pm; }; } #endif diff --git a/plugins/infowidget/downloadedchunkbar.h b/plugins/infowidget/downloadedchunkbar.h index ce448069..c79c167d 100644 --- a/plugins/infowidget/downloadedchunkbar.h +++ b/plugins/infowidget/downloadedchunkbar.h @@ -1,53 +1,53 @@ /*************************************************************************** * Copyright (C) 2005-2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef DOWNLOADEDCHUNKBAR_H #define DOWNLOADEDCHUNKBAR_H #include namespace bt { class TorrentInterface; } namespace kt { /** @author Joris Guisson */ class DownloadedChunkBar : public ChunkBar { Q_OBJECT public: DownloadedChunkBar(QWidget* parent); - ~DownloadedChunkBar(); + ~DownloadedChunkBar() override; const bt::BitSet& getBitSet() const override; void updateBar(bool force = false) override; void drawBarContents(QPainter* p) override; void setTC(bt::TorrentInterface* tc); private: bt::TorrentInterface* curr_tc; bt::BitSet curr_ebs; }; } #endif diff --git a/plugins/infowidget/fileview.h b/plugins/infowidget/fileview.h index b9d6644b..40cc75b1 100644 --- a/plugins/infowidget/fileview.h +++ b/plugins/infowidget/fileview.h @@ -1,125 +1,125 @@ /*************************************************************************** * Copyright (C) 2005-2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTFILEVIEW_H #define KTFILEVIEW_H #include #include #include #include class QLineEdit; class QMenu; class QSortFilterProxyModel; class QToolBar; namespace bt { class TorrentFileInterface; } namespace kt { class TorrentFileModel; /** @author Joris Guisson */ class FileView : public QWidget { Q_OBJECT public: FileView(QWidget* parent); - ~FileView(); + ~FileView() override; void changeTC(bt::TorrentInterface* tc); void setShowListOfFiles(bool on); void saveState(KSharedConfigPtr cfg); void loadState(KSharedConfigPtr cfg); void update(); void filePercentageChanged(bt::TorrentFileInterface* file, float percentage); void filePreviewChanged(bt::TorrentFileInterface* file, bool preview); public slots: void onTorrentRemoved(bt::TorrentInterface* tc); private slots: void showContextMenu(const QPoint& p); void onDoubleClicked(const QModelIndex& index); void onMissingFileMarkedDND(bt::TorrentInterface* tc); private: void changePriority(bt::Priority newpriority); void expandCollapseTree(const QModelIndex& idx, bool expand); void expandCollapseSelected(bool expand); void setupActions(); private slots: void open(); void openWith(); void downloadFirst(); void downloadLast(); void downloadNormal(); void doNotDownload(); void deleteFiles(); void moveFiles(); void collapseTree(); void expandTree(); void showTree(); void showList(); void setFilter(const QString& f); void checkFile(); private: bt::TorrentInterface::WPtr curr_tc; TorrentFileModel* model; QMenu* context_menu; QAction* open_action; QAction* open_with_action; QAction* download_first_action; QAction* download_normal_action; QAction* download_last_action; QAction* dnd_action; QAction* delete_action; QAction* move_files_action; QAction* collapse_action; QAction* expand_action; QAction* show_tree_action; QAction* show_list_action; QAction* show_filter_action; QAction* check_data; QString preview_path; bool show_list_of_files; QMap expanded_state_map; QSortFilterProxyModel* proxy_model; bool header_state_loaded; QTreeView* view; QToolBar* toolbar; QLineEdit* filter; }; } #endif diff --git a/plugins/infowidget/geoipmanager.h b/plugins/infowidget/geoipmanager.h index 0bdd72d6..83eb3e06 100644 --- a/plugins/infowidget/geoipmanager.h +++ b/plugins/infowidget/geoipmanager.h @@ -1,100 +1,100 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_GEOIPMANAGER_H #define KT_GEOIPMANAGER_H #include #include #include #ifdef USE_SYSTEM_GEOIP #include #else #include "GeoIP.h" #endif class KJob; namespace bt { class DecompressThread; } namespace kt { /** * Manages GeoIP database. Downloads it from the internet and handles all queries to it. */ class GeoIPManager : public QObject { Q_OBJECT public: GeoIPManager(QObject* parent = 0); - ~GeoIPManager(); + ~GeoIPManager() override; /** * Find the country given an IP address * @param addr The IP address * @return The country ID */ int findCountry(const QString& addr); /** * Get the name of the country * @param country_id The country ID * @return The name */ QString countryName(int country_id); /** * Get the code of the country * @param country_id The country ID * @return The name */ QString countryCode(int country_id); /// Get the database URL static QUrl geoIPUrl() {return geoip_url;} /// Set the database URL static void setGeoIPUrl(const QUrl &url); /// Download the database void downloadDataBase(); private slots: void databaseDownloadFinished(KJob* job); void decompressFinished(); private: GeoIP* geo_ip; QString geoip_data_file; QString download_destination; bt::DecompressThread* decompress_thread; static QUrl geoip_url; }; } #endif // KT_GEOIPMANAGER_H diff --git a/plugins/infowidget/infowidgetplugin.h b/plugins/infowidget/infowidgetplugin.h index bde2f2c9..1d7aa674 100644 --- a/plugins/infowidget/infowidgetplugin.h +++ b/plugins/infowidget/infowidgetplugin.h @@ -1,91 +1,91 @@ /*************************************************************************** * Copyright (C) 2005 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTINFOWIDGETPLUGIN_H #define KTINFOWIDGETPLUGIN_H #include #include #include namespace bt { class TorrentInterface; } namespace kt { class PeerView; class TrackerView; class StatusTab; class FileView; class ChunkDownloadView; class IWPrefPage; class Monitor; class WebSeedsTab; /** @author Joris Guisson */ class InfoWidgetPlugin : public Plugin, public ViewListener { Q_OBJECT public: InfoWidgetPlugin(QObject* parent, const QVariantList& args); - ~InfoWidgetPlugin(); + ~InfoWidgetPlugin() override; void load() override; void unload() override; void guiUpdate() override; void currentTorrentChanged(bt::TorrentInterface* tc) override; bool versionCheck(const QString& version) const override; ///Show PeerView in main window void showPeerView(bool show); ///Show ChunkDownloadView in main window void showChunkView(bool show); ///Show TrackerView in main window void showTrackerView(bool show); ///Show WebSeedsTab in main window void showWebSeedsTab(bool show); private: void createMonitor(bt::TorrentInterface* tc); private slots: void applySettings(); void torrentRemoved(bt::TorrentInterface* tc); private: PeerView* peer_view; ChunkDownloadView* cd_view; TrackerView* tracker_view; FileView* file_view; StatusTab* status_tab; WebSeedsTab* webseeds_tab; Monitor* monitor; IWPrefPage* pref; }; } #endif diff --git a/plugins/infowidget/iwfilelistmodel.h b/plugins/infowidget/iwfilelistmodel.h index f713f9d0..1d040d38 100644 --- a/plugins/infowidget/iwfilelistmodel.h +++ b/plugins/infowidget/iwfilelistmodel.h @@ -1,64 +1,64 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTIWFILELISTMODEL_H #define KTIWFILELISTMODEL_H #include namespace kt { /** * * @author Joris Guisson * * Expands the standard TorrentFileListModel to show more information. */ class IWFileListModel : public TorrentFileListModel { Q_OBJECT public: IWFileListModel(bt::TorrentInterface* tc, QObject* parent); - ~IWFileListModel(); + ~IWFileListModel() override; void changeTorrent(bt::TorrentInterface* tc) override; int columnCount(const QModelIndex& parent) const override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; QVariant data(const QModelIndex& index, int role) const override; bool setData(const QModelIndex& index, const QVariant& value, int role) override; void update() override; void filePercentageChanged(bt::TorrentFileInterface* file, float percentage) override; void filePreviewChanged(bt::TorrentFileInterface* file, bool preview) override; private: QVariant displayData(const QModelIndex& index) const; QVariant sortData(const QModelIndex& index) const; private: bool preview; bool mmfile; double percentage; }; } #endif diff --git a/plugins/infowidget/iwfiletreemodel.h b/plugins/infowidget/iwfiletreemodel.h index ba755b0b..fd1ce59c 100644 --- a/plugins/infowidget/iwfiletreemodel.h +++ b/plugins/infowidget/iwfiletreemodel.h @@ -1,67 +1,67 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTIWFILETREEMODEL_H #define KTIWFILETREEMODEL_H #include namespace kt { /** * * @author Joris Guisson * * Expands the standard TorrentFileTreeModel to show more information. */ class IWFileTreeModel : public TorrentFileTreeModel { Q_OBJECT public: IWFileTreeModel(bt::TorrentInterface* tc, QObject* parent); - ~IWFileTreeModel(); + ~IWFileTreeModel() override; void changeTorrent(bt::TorrentInterface* tc) override; int columnCount(const QModelIndex& parent) const override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; QVariant data(const QModelIndex& index, int role) const override; void update() override; void changePriority(const QModelIndexList& indexes, bt::Priority newpriority) override; - void filePercentageChanged(bt::TorrentFileInterface* file, float percentage); - void filePreviewChanged(bt::TorrentFileInterface* file, bool preview); + void filePercentageChanged(bt::TorrentFileInterface* file, float percentage) override; + void filePreviewChanged(bt::TorrentFileInterface* file, bool preview) override; private: void update(const QModelIndex& index, bt::TorrentFileInterface* file, int col); QVariant displayData(Node* n, const QModelIndex& index) const; QVariant sortData(Node* n, const QModelIndex& index) const; void setPriority(Node* n, bt::Priority newpriority, bool selected_node); private: bool preview; bool mmfile; double percentage; }; } #endif diff --git a/plugins/infowidget/iwprefpage.h b/plugins/infowidget/iwprefpage.h index 9d859a42..2eb200e7 100644 --- a/plugins/infowidget/iwprefpage.h +++ b/plugins/infowidget/iwprefpage.h @@ -1,40 +1,40 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTIWPREFPAGE_HH #define KTIWPREFPAGE_HH #include #include "ui_iwprefpage.h" namespace kt { class IWPrefPage : public PrefPageInterface, public Ui_IWPrefPage { Q_OBJECT public: IWPrefPage(QWidget* parent); - ~IWPrefPage(); + ~IWPrefPage() override; }; } #endif diff --git a/plugins/infowidget/monitor.h b/plugins/infowidget/monitor.h index 5df06781..d9084f5c 100644 --- a/plugins/infowidget/monitor.h +++ b/plugins/infowidget/monitor.h @@ -1,61 +1,61 @@ /*************************************************************************** * Copyright (C) 2005-2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTMONITOR_H #define KTMONITOR_H #include namespace bt { class TorrentInterface; } namespace kt { class PeerView; class ChunkDownloadView; class FileView; /** @author Joris Guisson */ class Monitor : public bt::MonitorInterface { bt::TorrentInterface* tc; PeerView* pv; ChunkDownloadView* cdv; FileView* fv; public: Monitor(bt::TorrentInterface* tc, PeerView* pv , ChunkDownloadView* cdv, FileView* fv); - ~Monitor(); + ~Monitor() override; void downloadRemoved(bt::ChunkDownloadInterface* cd) override; void downloadStarted(bt::ChunkDownloadInterface* cd) override; void peerAdded(bt::PeerInterface* peer) override; void peerRemoved(bt::PeerInterface* peer) override; void stopped() override; void destroyed() override; void filePercentageChanged(bt::TorrentFileInterface* file, float percentage) override; void filePreviewChanged(bt::TorrentFileInterface* file, bool preview) override; }; } #endif diff --git a/plugins/infowidget/peerview.h b/plugins/infowidget/peerview.h index 02142e6c..f1b14011 100644 --- a/plugins/infowidget/peerview.h +++ b/plugins/infowidget/peerview.h @@ -1,74 +1,74 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_PEERVIEW_HH #define KT_PEERVIEW_HH #include #include #include #include class QSortFilterProxyModel; class QMenu; namespace kt { class PeerViewModel; /** * View which shows a list of peers, of a torrent. * */ class PeerView : public QTreeView { Q_OBJECT public: PeerView(QWidget* parent); - ~PeerView(); + ~PeerView() override; /// A peer has been added void peerAdded(bt::PeerInterface* peer); /// A peer has been removed void peerRemoved(bt::PeerInterface* peer); /// Check to see if the GUI needs to be updated void update(); /// Remove all items void removeAll(); void saveState(KSharedConfigPtr cfg); void loadState(KSharedConfigPtr cfg); private slots: void showContextMenu(const QPoint& pos); void banPeer(); void kickPeer(); private: QMenu* context_menu; QSortFilterProxyModel* pm; PeerViewModel* model; }; } #endif diff --git a/plugins/infowidget/peerviewmodel.h b/plugins/infowidget/peerviewmodel.h index d132c4ad..891a8c5a 100644 --- a/plugins/infowidget/peerviewmodel.h +++ b/plugins/infowidget/peerviewmodel.h @@ -1,94 +1,94 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTPEERVIEWMODEL_H #define KTPEERVIEWMODEL_H #include #include #include #include namespace kt { class GeoIPManager; /** @author Joris Guisson Model for the PeerView */ class PeerViewModel : public QAbstractTableModel { Q_OBJECT public: PeerViewModel(QObject* parent); - ~PeerViewModel(); + ~PeerViewModel() override; /// A peer has been added void peerAdded(bt::PeerInterface* peer); /// A peer has been removed void peerRemoved(bt::PeerInterface* peer); /** * Update the model */ void update(); /** Clear the model */ void clear(); int rowCount(const QModelIndex& parent) const override; int columnCount(const QModelIndex& parent) const override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; QVariant data(const QModelIndex& index, int role) const override; bool removeRows(int row, int count, const QModelIndex& parent) override; bool insertRows(int row, int count, const QModelIndex& parent) override; QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override; bt::PeerInterface* indexToPeer(const QModelIndex& idx); public: struct Item { bt::PeerInterface* peer; mutable bt::PeerInterface::Stats stats; QString country; QIcon flag; Item(bt::PeerInterface* peer, GeoIPManager* geo_ip); bool changed() const; QVariant data(int col) const; QVariant decoration(int col) const; QVariant sortData(int col) const; }; private: QVector items; GeoIPManager* geo_ip; }; } #endif diff --git a/plugins/infowidget/statustab.h b/plugins/infowidget/statustab.h index 194a0100..765a2f96 100644 --- a/plugins/infowidget/statustab.h +++ b/plugins/infowidget/statustab.h @@ -1,60 +1,60 @@ /*************************************************************************** * Copyright (C) 2005-2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef STATUSTAB_H #define STATUSTAB_H #include #include #include #include "ui_statustab.h" namespace kt { class StatusTab : public QWidget, public Ui_StatusTab { Q_OBJECT public: StatusTab(QWidget* parent); - ~StatusTab(); + ~StatusTab() override; public slots: void changeTC(bt::TorrentInterface* tc); void update(); void maxRatioChanged(double v); void useRatioLimitToggled(bool on); void useTimeLimitToggled(bool on); void maxTimeChanged(double v); void linkActivated(const QString& link); private: void maxRatioUpdate(); void maxSeedTimeUpdate(); private: QPointer curr_tc; }; } #endif diff --git a/plugins/infowidget/trackermodel.h b/plugins/infowidget/trackermodel.h index 610729cd..0a7f4de3 100644 --- a/plugins/infowidget/trackermodel.h +++ b/plugins/infowidget/trackermodel.h @@ -1,93 +1,93 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTTRACKERMODEL_H #define KTTRACKERMODEL_H #include #include #include #include namespace bt { class TorrentInterface; } namespace kt { /** @author */ class TrackerModel : public QAbstractTableModel { Q_OBJECT public: TrackerModel(QObject* parent); - ~TrackerModel(); + ~TrackerModel() override; void changeTC(bt::TorrentInterface* tc); void update(); int rowCount(const QModelIndex& parent) const override; int columnCount(const QModelIndex& parent) const override; QVariant data(const QModelIndex& index, int role) const override; bool setData(const QModelIndex& index, const QVariant& value, int role) override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; bool insertRows(int row, int count, const QModelIndex& parent) override; bool removeRows(int row, int count, const QModelIndex& parent) override; Qt::ItemFlags flags(const QModelIndex& index) const override; QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override; /// Get a tracker url given a model index QUrl trackerUrl(const QModelIndex& idx); /// Get a tracker given a model index bt::TrackerInterface* tracker(const QModelIndex& idx); /// Add trackers to the model void addTrackers(QList & tracker_list); private: struct Item { bt::TrackerInterface* trk; bt::TrackerStatus status; int seeders; int leechers; int times_downloaded; unsigned int time_to_next_update; Item(bt::TrackerInterface* tracker); bool update(); QVariant displayData(int column) const; QVariant sortData(int column) const; }; bt::TorrentInterface* tc; QList trackers; bool running; }; } #endif diff --git a/plugins/infowidget/trackerview.h b/plugins/infowidget/trackerview.h index 594563a6..f8b0b3e8 100644 --- a/plugins/infowidget/trackerview.h +++ b/plugins/infowidget/trackerview.h @@ -1,71 +1,71 @@ /*************************************************************************** * Copyright (C) 2006-2007 by Joris Guisson, Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef TRACKERVIEW_H #define TRACKERVIEW_H #include "ui_trackerview.h" #include #include #include namespace kt { class TrackerModel; /** * @author Ivan Vasic */ class TrackerView: public QWidget, public Ui_TrackerView { Q_OBJECT public: TrackerView(QWidget* parent); - ~TrackerView(); + ~TrackerView() override; void update(); void changeTC(bt::TorrentInterface* ti); void saveState(KSharedConfigPtr cfg); void loadState(KSharedConfigPtr cfg); public slots: void updateClicked(); void restoreClicked(); void changeClicked(); void removeClicked(); void addClicked(); void scrapeClicked(); void currentChanged(const QModelIndex& current, const QModelIndex& previous); private: void torrentChanged(bt::TorrentInterface* ti); private: bt::TorrentInterface::WPtr tc; TrackerModel* model; QSortFilterProxyModel* proxy_model; QStringList tracker_hints; bool header_state_loaded; }; } #endif diff --git a/plugins/infowidget/webseedsmodel.h b/plugins/infowidget/webseedsmodel.h index c4c528ed..3a7fe7f7 100644 --- a/plugins/infowidget/webseedsmodel.h +++ b/plugins/infowidget/webseedsmodel.h @@ -1,77 +1,77 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTWEBSEEDSMODEL_H #define KTWEBSEEDSMODEL_H #include #include #include #include namespace kt { /** @author */ class WebSeedsModel : public QAbstractTableModel { Q_OBJECT public: WebSeedsModel(QObject* parent); - ~WebSeedsModel(); + ~WebSeedsModel() override; /** * Change the current torrent. * @param tc */ void changeTC(bt::TorrentInterface* tc); /** * See if we need to update the model */ bool update(); int rowCount(const QModelIndex& parent = QModelIndex()) const override; int columnCount(const QModelIndex& parent = QModelIndex()) const override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; QVariant data(const QModelIndex& index, int role) const override; Qt::ItemFlags flags(const QModelIndex& index) const override; bool setData(const QModelIndex& index, const QVariant& value, int role) override; private: struct Item { QString status; bt::Uint64 downloaded; bt::Uint32 speed; }; bt::TorrentInterface::WPtr curr_tc; QVector items; }; } #endif diff --git a/plugins/infowidget/webseedstab.h b/plugins/infowidget/webseedstab.h index 050c2d4d..bacdd18b 100644 --- a/plugins/infowidget/webseedstab.h +++ b/plugins/infowidget/webseedstab.h @@ -1,79 +1,79 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTWEBSEEDSTAB_H #define KTWEBSEEDSTAB_H #include #include #include #include #include #include "ui_webseedstab.h" namespace kt { class WebSeedsModel; /** Tab which displays the list of webseeds of a torrent, and allows you to add or remove them. */ class WebSeedsTab : public QWidget, public Ui_WebSeedsTab { Q_OBJECT public: WebSeedsTab(QWidget* parent); - ~WebSeedsTab(); + ~WebSeedsTab() override; /** * Switch to a different torrent. * @param tc The torrent */ void changeTC(bt::TorrentInterface* tc); /// Check to see if the GUI needs to be updated void update(); void saveState(KSharedConfigPtr cfg); void loadState(KSharedConfigPtr cfg); private slots: void addWebSeed(); void removeWebSeed(); void disableAll(); void enableAll(); void onWebSeedTextChanged(const QString& ws); void selectionChanged(const QItemSelection& selected, const QItemSelection& deselected); private: void selectionChanged(const QModelIndexList& indexes); private: bt::TorrentInterface::WPtr curr_tc; WebSeedsModel* model; QSortFilterProxyModel* proxy_model; }; } #endif diff --git a/plugins/ipfilter/convertdialog.h b/plugins/ipfilter/convertdialog.h index 51a69626..01980203 100644 --- a/plugins/ipfilter/convertdialog.h +++ b/plugins/ipfilter/convertdialog.h @@ -1,75 +1,75 @@ /*************************************************************************** * Copyright (C) 2005 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef CONVERTDIALOG_H #define CONVERTDIALOG_H #include #include #include #include #include #include "ui_convertdialog.h" namespace kt { class ConvertThread; class ConvertDialog : public QDialog, public Ui_ConvertDialog { Q_OBJECT public: ConvertDialog(QWidget* parent); - ~ConvertDialog(); + ~ConvertDialog() override; /** * Set the message. * @param msg The new message */ void message(const QString& msg); /** * Update progress bar * @param val The value * @param total The max number of steps */ void progress(int val, int total); private slots: void convert(); void threadFinished(); void btnCancelClicked(); void update(); private: void closeEvent(QCloseEvent* e) override; private: ConvertThread* convert_thread; QString msg; int prog, max; QMutex mutex; QTimer timer; bool canceled; }; } #endif diff --git a/plugins/ipfilter/convertthread.h b/plugins/ipfilter/convertthread.h index 94c48300..bf22e108 100644 --- a/plugins/ipfilter/convertthread.h +++ b/plugins/ipfilter/convertthread.h @@ -1,68 +1,68 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTCONVERTTHREAD_H #define KTCONVERTTHREAD_H #include #include "ipblocklist.h" namespace kt { class ConvertDialog; /** * Thread which does the converting of the text filter file to our own format. * @author Joris Guisson */ class ConvertThread : public QThread { public: ConvertThread(ConvertDialog* dlg); - ~ConvertThread(); + ~ConvertThread() override; void run() override; QString getFailureReason() const {return failure_reason;} void stop() {abort = true;} private: void readInput(); void writeOutput(); void cleanUp(bool failed); void sort(); void merge(); private: ConvertDialog* dlg; bool abort; QString txt_file; QString dat_file; QString tmp_file; QList input; QString failure_reason; }; } #endif diff --git a/plugins/ipfilter/downloadandconvertjob.h b/plugins/ipfilter/downloadandconvertjob.h index 9c40b10e..b71f126a 100644 --- a/plugins/ipfilter/downloadandconvertjob.h +++ b/plugins/ipfilter/downloadandconvertjob.h @@ -1,83 +1,83 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTDOWNLOADANDCONVERTJOB_H #define KTDOWNLOADANDCONVERTJOB_H #include namespace kt { class ConvertDialog; /** Job to download and convert a filter file */ class DownloadAndConvertJob : public KIO::Job { Q_OBJECT public: enum Mode { Verbose, Quietly }; DownloadAndConvertJob(const QUrl& url, Mode mode); - ~DownloadAndConvertJob(); + ~DownloadAndConvertJob() override; enum ErrorCode { CANCELED = 100, DOWNLOAD_FAILED, UNZIP_FAILED, MOVE_FAILED, BACKUP_FAILED }; void kill(KJob::KillVerbosity v); - void start(); + void start() override; bool isAutoUpdate() const {return mode == Quietly;} Q_SIGNALS: /// Emitted when the job needs to show a notification void notification(const QString& msg); private Q_SLOTS: void downloadFileFinished(KJob*); void convert(KJob*); void extract(KJob*); void makeBackupFinished(KJob*); void revertBackupFinished(KJob*); void convertAccepted(); void convertRejected(); private: void convert(); void cleanUp(const QString& path); void cleanUpFiles(); private: QUrl url; KJob* active_job; bool unzip; ConvertDialog* convert_dlg; Mode mode; }; } #endif diff --git a/plugins/ipfilter/ipblockingprefpage.h b/plugins/ipfilter/ipblockingprefpage.h index 6e483fb8..c59d78df 100644 --- a/plugins/ipfilter/ipblockingprefpage.h +++ b/plugins/ipfilter/ipblockingprefpage.h @@ -1,78 +1,78 @@ /*************************************************************************** * Copyright (C) 2005 by Joris Guisson * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef IPBLOCKINGPREFPAGE_H #define IPBLOCKINGPREFPAGE_H #include #include #include #include "ui_ipblockingprefpage.h" #include "ipfilterplugin.h" class KJob; namespace kt { class IPFilterPlugin; class DownloadAndConvertJob; /** * @author Ivan Vasic * @brief IPBlocking plugin interface page **/ class IPBlockingPrefPage : public PrefPageInterface, public Ui_IPBlockingPrefPage { Q_OBJECT public: IPBlockingPrefPage(IPFilterPlugin* p); - ~IPBlockingPrefPage(); + ~IPBlockingPrefPage() override; - void loadSettings(); - void loadDefaults(); - void updateSettings(); + void loadSettings() override; + void loadDefaults() override; + void updateSettings() override; /// Do an auto update, return false if this is not possible bool doAutoUpdate(); private slots: void downloadClicked(); void checkUseLevel1Toggled(bool); void restoreGUI(); void downloadAndConvertFinished(KJob* j); void autoUpdateToggled(bool on); void autoUpdateIntervalChanged(int val); private: void updateAutoUpdate(); Q_SIGNALS: void updateFinished(); private: CoreInterface* m_core; IPFilterPlugin* m_plugin; DownloadAndConvertJob* m_job; bool m_verbose; }; } #endif diff --git a/plugins/ipfilter/ipblocklist.h b/plugins/ipfilter/ipblocklist.h index 83f191f4..0b6fa087 100644 --- a/plugins/ipfilter/ipblocklist.h +++ b/plugins/ipfilter/ipblocklist.h @@ -1,82 +1,82 @@ /*************************************************************************** * Copyright (C) 2005 by Joris Guisson * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef ANTIP2P_H #define ANTIP2P_H #include #include #include namespace kt { struct IPBlock { bt::Uint32 ip1; bt::Uint32 ip2; IPBlock(); IPBlock(const IPBlock& block); IPBlock(const QString& start, const QString& end); bool contains(bt::Uint32 ip) const { return ip1 <= ip && ip <= ip2; } }; /** * @author Ivan Vasic * @brief This class is used to manage anti-p2p filter list, so called level1. */ class IPBlockList : public bt::BlockListInterface { public: IPBlockList(); - ~IPBlockList(); + ~IPBlockList() override; bool blocked(const net::Address& addr) const override; /** * Overloaded function. Uses Uint32 IP to be checked **/ bool isBlockedIP(bt::Uint32 ip); /** * Loads filter file * @param path The file to load * @return true upon success, false otherwise */ bool load(const QString& path); /** * Add a single block * @param block */ void addBlock(const IPBlock& block); private: QVector blocks; }; } #endif diff --git a/plugins/ipfilter/ipfilterplugin.h b/plugins/ipfilter/ipfilterplugin.h index 1ede4ebe..bb755eed 100644 --- a/plugins/ipfilter/ipfilterplugin.h +++ b/plugins/ipfilter/ipfilterplugin.h @@ -1,79 +1,79 @@ /*************************************************************************** * Copyright (C) 2005 by Joris Guisson * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTIPFILTERPLUGIN_H #define KTIPFILTERPLUGIN_H #include #include #include "ipblockingprefpage.h" #include "ipblocklist.h" class QString; namespace kt { class IPBlockingPrefPage; const int AUTO_UPDATE_RETRY_INTERVAL = 15 * 60; // seconds /** * @author Ivan Vasic * @brief IP filter plugin * * This plugin will load IP ranges from specific files into KT IPBlocklist. */ class IPFilterPlugin : public Plugin { Q_OBJECT public: IPFilterPlugin(QObject* parent, const QVariantList& args); - ~IPFilterPlugin(); + ~IPFilterPlugin() override; void load() override; void unload() override; bool versionCheck(const QString& version) const override; ///Loads the KT format list filter void loadFilters(); ///Loads the anti-p2p filter list bool loadAntiP2P(); ///Unloads the anti-p2p filter list bool unloadAntiP2P(); /// Whether or not the IP filter is loaded and running bool loadedAndRunning(); public slots: void checkAutoUpdate(); void notification(const QString& msg); private: IPBlockingPrefPage* pref; QScopedPointer ip_filter; QTimer auto_update_timer; }; } #endif diff --git a/plugins/logviewer/logflags.h b/plugins/logviewer/logflags.h index 04961f8c..aad3333f 100644 --- a/plugins/logviewer/logflags.h +++ b/plugins/logviewer/logflags.h @@ -1,85 +1,85 @@ /*************************************************************************** * Copyright (C) 2006 by Ivan Vasić * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTLOGFLAGS_H #define KTLOGFLAGS_H #include #include #include class QString; namespace kt { /** * Class to read/save logging messages flags. * @author Ivan Vasic */ class LogFlags : public QAbstractTableModel { Q_OBJECT public: LogFlags(); - ~LogFlags(); + ~LogFlags() override; static LogFlags& instance(); ///Checks current flags with arg. Return true if message should be shown bool checkFlags(unsigned int arg); ///Updates flags from Settings:: void updateFlags(); ///Makes line rich text according to arg level. QString getFormattedMessage(unsigned int arg, const QString& line); int rowCount(const QModelIndex& parent) const override; int columnCount(const QModelIndex& parent) const override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; QVariant data(const QModelIndex& index, int role) const override; bool setData(const QModelIndex& index, const QVariant& value, int role) override; Qt::ItemFlags flags(const QModelIndex& index) const override; bool removeRows(int row, int count, const QModelIndex& parent) override; bool insertRows(int row, int count, const QModelIndex& parent) override; private slots: void registered(const QString& sys); void unregistered(const QString& sys); private: QString flagToString(bt::Uint32 flag) const; private: struct LogFlag { QString name; bt::Uint32 id; bt::Uint32 flag; }; QList log_flags; }; } #endif diff --git a/plugins/logviewer/logflagsdelegate.h b/plugins/logviewer/logflagsdelegate.h index 0762f433..0bb97c75 100644 --- a/plugins/logviewer/logflagsdelegate.h +++ b/plugins/logviewer/logflagsdelegate.h @@ -1,48 +1,48 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTLOGFLAGSDELEGATE_H #define KTLOGFLAGSDELEGATE_H #include namespace kt { /** @author */ class LogFlagsDelegate : public QItemDelegate { Q_OBJECT public: LogFlagsDelegate(QObject* parent); - ~LogFlagsDelegate(); + ~LogFlagsDelegate() override; QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override; void setEditorData(QWidget* editor, const QModelIndex& index) const override; void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override; QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override; }; } #endif diff --git a/plugins/logviewer/logprefpage.h b/plugins/logviewer/logprefpage.h index c872e335..289a09d9 100644 --- a/plugins/logviewer/logprefpage.h +++ b/plugins/logviewer/logprefpage.h @@ -1,49 +1,49 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTLOGPREFPAGE_H #define KTLOGPREFPAGE_H #include #include "ui_logprefwidget.h" namespace kt { class LogFlags; class LogPrefPage : public PrefPageInterface, public Ui_LogPrefWidget { Q_OBJECT public: LogPrefPage(LogFlags* flags, QWidget* parent); - ~LogPrefPage(); + ~LogPrefPage() override; void loadDefaults() override; void loadSettings() override; void updateSettings() override; void saveState(); void loadState(); private: bool state_loaded; }; } #endif diff --git a/plugins/logviewer/logviewer.h b/plugins/logviewer/logviewer.h index 99a85276..ee81b997 100644 --- a/plugins/logviewer/logviewer.h +++ b/plugins/logviewer/logviewer.h @@ -1,68 +1,68 @@ /*************************************************************************** * Copyright (C) 2005 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTLOGVIEWER_H #define KTLOGVIEWER_H #include #include #include #include #include "logflags.h" namespace kt { /** * @author Joris Guisson */ class LogViewer : public Activity, public bt::LogMonitorInterface { Q_OBJECT public: LogViewer(LogFlags* flags, QWidget* parent = 0); - ~LogViewer(); + ~LogViewer() override; void message(const QString& line, unsigned int arg) override; void setRichText(bool val); void setMaxBlockCount(int max); void processPending(); public slots: void showMenu(const QPoint& pos); void suspend(bool on); private: bool use_rich_text; LogFlags* flags; QTextBrowser* output; bool suspended; QMenu* menu; QAction* suspend_action; int max_block_count; QMutex mutex; QStringList pending; }; } #endif diff --git a/plugins/logviewer/logviewerplugin.h b/plugins/logviewer/logviewerplugin.h index fd47d31f..0ecd8166 100644 --- a/plugins/logviewer/logviewerplugin.h +++ b/plugins/logviewer/logviewerplugin.h @@ -1,74 +1,74 @@ /*************************************************************************** * Copyright (C) 2005 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTLOGVIEWERPLUGIN_H #define KTLOGVIEWERPLUGIN_H #include #include class QDockWidget; namespace kt { class LogViewer; class LogPrefPage; class LogFlags; enum LogViewerPosition { SEPARATE_ACTIVITY = 0, DOCKABLE_WIDGET = 1, TORRENT_ACTIVITY = 2 }; /** * @author Joris Guisson */ class LogViewerPlugin : public Plugin { Q_OBJECT public: LogViewerPlugin(QObject* parent, const QVariantList& args); - ~LogViewerPlugin(); + ~LogViewerPlugin() override; void load() override; void unload() override; bool versionCheck(const QString& version) const override; void guiUpdate() override; private slots: void applySettings(); private: void addLogViewerToGUI(); void removeLogViewerFromGUI(); private: LogViewer* lv; LogPrefPage* pref; LogFlags* flags; QDockWidget* dock; LogViewerPosition pos; }; } #endif diff --git a/plugins/magnetgenerator/magnetgeneratorplugin.h b/plugins/magnetgenerator/magnetgeneratorplugin.h index 40af78a5..dcb803e0 100644 --- a/plugins/magnetgenerator/magnetgeneratorplugin.h +++ b/plugins/magnetgenerator/magnetgeneratorplugin.h @@ -1,56 +1,56 @@ /*************************************************************************** * Copyright (C) 2010 by Jonas Lundqvist * * jonas@gannon.se * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_MAGNETGENERATORPLUGIN_H #define KT_MAGNETGENERATORPLUGIN_H #include #include namespace kt { class MagnetGeneratorPrefWidget; class MagnetGeneratorPlugin : public Plugin, public ViewListener { Q_OBJECT public: MagnetGeneratorPlugin(QObject* parent, const QVariantList& args); - ~MagnetGeneratorPlugin(); + ~MagnetGeneratorPlugin() override; void load() override; void unload() override; bool versionCheck(const QString& version) const override; QString parentPart() const override {return QStringLiteral("torrentactivity");} void currentTorrentChanged(bt::TorrentInterface* tc) override; private slots: void generateMagnet(); private: MagnetGeneratorPrefWidget* pref; QAction * generate_magnet_action; void addToClipboard(QString uri); void showPopup(); }; } #endif // KT_MAGNETGENERATORPLUGIN_H diff --git a/plugins/magnetgenerator/magnetgeneratorprefwidget.h b/plugins/magnetgenerator/magnetgeneratorprefwidget.h index b0781979..e155fc27 100644 --- a/plugins/magnetgenerator/magnetgeneratorprefwidget.h +++ b/plugins/magnetgenerator/magnetgeneratorprefwidget.h @@ -1,46 +1,46 @@ /*************************************************************************** * Copyright (C) 2010 by Jonas Lundqvist * * jonas@gannon.se * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef MAGNETGENERATORPREFWIDGET_H #define MAGNETGENERATORPREFWIDGET_H #include #include "ui_magnetgeneratorprefwidget.h" namespace kt { class MagnetGeneratorPrefWidget : public PrefPageInterface, public Ui_MagnetGeneratorPrefWidget { Q_OBJECT public: MagnetGeneratorPrefWidget(QWidget* parent = 0); - ~MagnetGeneratorPrefWidget(); + ~MagnetGeneratorPrefWidget() override; private slots: void customTrackerToggled(bool on); void torrentTrackerToggled(bool on); }; } #endif diff --git a/plugins/mediaplayer/mediacontroller.h b/plugins/mediaplayer/mediacontroller.h index 2470e48f..4c50afa9 100644 --- a/plugins/mediaplayer/mediacontroller.h +++ b/plugins/mediaplayer/mediacontroller.h @@ -1,60 +1,60 @@ /*************************************************************************** * Copyright (C) 2010 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_MEDIACONTROLLER_H #define KT_MEDIACONTROLLER_H #include #include #include #include #include "mediafile.h" #include "ui_mediacontroller.h" namespace kt { class MediaPlayer; /** * Widget containing all the things necessary to control the media playback. */ class MediaController : public QWidget, public Ui_MediaController { Q_OBJECT public: MediaController(MediaPlayer* player, KActionCollection* ac, QWidget* parent = 0); - ~MediaController(); + ~MediaController() override; private slots: void playing(const MediaFileRef& file); void stopped(); void metaDataChanged(); private: MediaFileRef current_file; }; } #endif // KT_MEDIACONTROLLER_H diff --git a/plugins/mediaplayer/mediafilestream.h b/plugins/mediaplayer/mediafilestream.h index 32ce2f1f..acb3a3f1 100644 --- a/plugins/mediaplayer/mediafilestream.h +++ b/plugins/mediaplayer/mediafilestream.h @@ -1,72 +1,72 @@ /*************************************************************************** * Copyright (C) 2010 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_MEDIAFILESTREAM_H #define KT_MEDIAFILESTREAM_H #include #include namespace bt { class TorrentFileStream; } namespace kt { /** Class to stream a TorrentFileStream to phonon. */ class MediaFileStream : public Phonon::AbstractMediaStream { Q_OBJECT public: MediaFileStream(bt::TorrentFileStream::WPtr stream, QObject* parent = 0); - ~MediaFileStream(); + ~MediaFileStream() override; enum StreamState { PLAYING, BUFFERING }; StreamState state() const {return waiting_for_data ? BUFFERING : PLAYING;} protected: void needData() override; void reset() override; void enoughData() override; void seekStream(qint64 offset) override; signals: /// Emitted when the stream state changes void stateChanged(int state); private slots: void dataReady(); private: bt::TorrentFileStream::WPtr stream; bool waiting_for_data; }; } #endif // KT_MEDIAFILESTREAM_H diff --git a/plugins/mediaplayer/mediamodel.h b/plugins/mediaplayer/mediamodel.h index 3a987df8..72694d47 100644 --- a/plugins/mediaplayer/mediamodel.h +++ b/plugins/mediaplayer/mediamodel.h @@ -1,91 +1,91 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTMEDIAMODEL_H #define KTMEDIAMODEL_H #include #include #include #include "mediafile.h" namespace kt { class CoreInterface; /** Interface class to find MediaFileRef objects in the collection */ class MediaFileCollection { public: virtual ~MediaFileCollection() {} /** Find a MediaFileRef given a path, if the path is not in the collection a simple file MediaFileRef will be constructed */ virtual MediaFileRef find(const QString& path) = 0; }; /** @author */ class MediaModel : public QAbstractListModel, public MediaFileCollection { Q_OBJECT public: MediaModel(CoreInterface* core, QObject* parent); - ~MediaModel(); + ~MediaModel() override; int rowCount(const QModelIndex& parent) const override; int columnCount(const QModelIndex& parent) const override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; QVariant data(const QModelIndex& index, int role) const override; bool removeRows(int row, int count, const QModelIndex& parent) override; bool insertRows(int row, int count, const QModelIndex& parent) override; Qt::ItemFlags flags(const QModelIndex& index) const override; QStringList mimeTypes() const override; QMimeData* mimeData(const QModelIndexList& indexes) const override; QModelIndex index(int row, int column = 0, const QModelIndex& parent = QModelIndex()) const override; /// Get the file given a model index MediaFileRef fileForIndex(const QModelIndex& idx) const; /// Get the index of a full path QModelIndex indexForPath(const QString& path) const; MediaFileRef find(const QString& path) override; public slots: void onTorrentAdded(bt::TorrentInterface* t); void onTorrentRemoved(bt::TorrentInterface* t); private: CoreInterface* core; QList items; QMimeDatabase m_mimeDatabase; }; } #endif diff --git a/plugins/mediaplayer/mediaplayer.h b/plugins/mediaplayer/mediaplayer.h index 14ddf7e9..4b6f33bd 100644 --- a/plugins/mediaplayer/mediaplayer.h +++ b/plugins/mediaplayer/mediaplayer.h @@ -1,135 +1,135 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTAUDIOPLAYER_H #define KTAUDIOPLAYER_H #include #include #include #include "mediafile.h" #include "mediafilestream.h" namespace Phonon { class AudioOutput; } namespace kt { enum ActionFlags { MEDIA_PLAY = 1, MEDIA_PAUSE = 2, MEDIA_STOP = 4, MEDIA_PREV = 8, MEDIA_NEXT = 16 }; /** @author */ class MediaPlayer : public QObject { Q_OBJECT public: MediaPlayer(QObject* parent); - ~MediaPlayer(); + ~MediaPlayer() override; Phonon::AudioOutput* output() {return audio;} Phonon::MediaObject* media0bject() {return media;} /// Are we paused bool paused() const; /// Resume paused stuff void resume(); /// Play a file void play(MediaFileRef file); /// Queue a file void queue(MediaFileRef file); /// Pause playing void pause(); /// Stop playing void stop(); /// Get the current file we are playing MediaFileRef getCurrentSource() const; /// Play the previous song MediaFileRef prev(); private slots: void onStateChanged(Phonon::State cur, Phonon::State old); void hasVideoChanged(bool hasVideo); void streamStateChanged(int state); signals: /** * Emitted to enable or disable the play buttons. * @param flags Flags indicating which buttons to enable */ void enableActions(unsigned int flags); /** * A video has been detected, create the video player window. */ void openVideo(); /** * Emitted when the video widget needs to be closed. */ void closeVideo(); /** * Emitted when we have finished playing something */ void stopped(); /** * Emitted when the player is about to finish */ void aboutToFinish(); /** * Emitted when the player starts playing */ void playing(const MediaFileRef& file); /** * Emitted when the video is being loaded */ void loading(); private: Phonon::MediaObject* media; Phonon::AudioOutput* audio; QList history; MediaFileRef current; bool buffering; bool manually_paused; }; } #endif diff --git a/plugins/mediaplayer/mediaplayeractivity.h b/plugins/mediaplayer/mediaplayeractivity.h index 2bacf11f..46baa37c 100644 --- a/plugins/mediaplayer/mediaplayeractivity.h +++ b/plugins/mediaplayer/mediaplayeractivity.h @@ -1,105 +1,105 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_MEDIAPLAYERACTIVITY_H #define KT_MEDIAPLAYERACTIVITY_H #include #include #include "mediafile.h" class QToolButton; class QSplitter; class QTabWidget; class QAction; class KActionCollection; namespace kt { class MediaView; class MediaPlayer; class MediaModel; class CoreInterface; class VideoWidget; class PlayListWidget; class MediaController; /** * Activity for the media player plugin. */ class MediaPlayerActivity : public Activity { Q_OBJECT public: MediaPlayerActivity(CoreInterface* core, KActionCollection* ac, QWidget* parent); - ~MediaPlayerActivity(); + ~MediaPlayerActivity() override; void setupActions(); void saveState(KSharedConfigPtr cfg); void loadState(KSharedConfigPtr cfg); public slots: void play(); void play(const MediaFileRef& file); void pause(); void stop(); void prev(); void next(); void enableActions(unsigned int flags); void onSelectionChanged(const MediaFileRef& file); void openVideo(); void closeVideo(); void setVideoFullScreen(bool on); void onDoubleClicked(const MediaFileRef& file); void randomPlayActivated(bool on); void aboutToFinishPlaying(); void showVideo(bool on); void closeTab(); void currentTabChanged(int idx); private: QSplitter* splitter; MediaModel* media_model; MediaPlayer* media_player; MediaView* media_view; MediaController* controller; QTabWidget* tabs; int action_flags; VideoWidget* video; bool fullscreen_mode; QModelIndex curr_item; PlayListWidget* play_list; QToolButton* close_button; QAction * play_action; QAction * pause_action; QAction * stop_action; QAction * prev_action; QAction * next_action; QAction * show_video_action; QAction * clear_action; QAction * add_media_action; QAction * status_action; KActionCollection* ac; }; } #endif // KT_MEDIAPLAYERACTIVITY_H diff --git a/plugins/mediaplayer/mediaplayerplugin.h b/plugins/mediaplayer/mediaplayerplugin.h index a2d9ea01..7dd9535e 100644 --- a/plugins/mediaplayer/mediaplayerplugin.h +++ b/plugins/mediaplayer/mediaplayerplugin.h @@ -1,55 +1,55 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTMEDIAPLAYERPLUGIN_H #define KTMEDIAPLAYERPLUGIN_H #include #include #include namespace kt { class MediaPlayerActivity; /** @author */ class MediaPlayerPlugin : public Plugin { Q_OBJECT public: MediaPlayerPlugin(QObject* parent, const QVariantList& args); - ~MediaPlayerPlugin(); + ~MediaPlayerPlugin() override; void load() override; void unload() override; bool versionCheck(const QString& version) const override; private: MediaPlayerActivity* act; }; } #endif diff --git a/plugins/mediaplayer/mediaview.h b/plugins/mediaplayer/mediaview.h index 978ff2a8..749bfc17 100644 --- a/plugins/mediaplayer/mediaview.h +++ b/plugins/mediaplayer/mediaview.h @@ -1,94 +1,94 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTMEDIAVIEW_H #define KTMEDIAVIEW_H #include #include #include #include #include "mediafile.h" class QLineEdit; class KToolBar; namespace kt { class MediaModel; /** * QSortFilterProxyModel to filter out incomplete files */ class MediaViewFilter : public QSortFilterProxyModel { Q_OBJECT public: MediaViewFilter(QObject* parent = 0); - ~MediaViewFilter(); + ~MediaViewFilter() override; bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override; /// Enable or disable showing of incomplete files void setShowIncomplete(bool on); public slots: void refresh(); private: bool show_incomplete; }; /** @author */ class MediaView : public QWidget { Q_OBJECT public: MediaView(MediaModel* model, QWidget* parent); - ~MediaView(); + ~MediaView() override; void saveState(KSharedConfig::Ptr cfg); void loadState(KSharedConfig::Ptr cfg); signals: void doubleClicked(const MediaFileRef& mf); private slots: void onDoubleClicked(const QModelIndex& index); void showIncompleteChanged(bool on); private: MediaModel* model; QListView* media_tree; QLineEdit* search_box; MediaViewFilter* filter; KToolBar* tool_bar; QAction* show_incomplete; QAction* refresh; }; } #endif diff --git a/plugins/mediaplayer/playlist.h b/plugins/mediaplayer/playlist.h index 3f91f7d2..da8cd52a 100644 --- a/plugins/mediaplayer/playlist.h +++ b/plugins/mediaplayer/playlist.h @@ -1,81 +1,81 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef PLAYLIST_H #define PLAYLIST_H #include #include #include #include #include "mediafile.h" #include "mediamodel.h" namespace kt { /** * PlayList containing a list of files to play. */ class PlayList : public QAbstractItemModel { Q_OBJECT public: PlayList(MediaFileCollection* collection, MediaPlayer* player, QObject* parent); - ~PlayList(); + ~PlayList() override; void addFile(const MediaFileRef& file); void removeFile(const MediaFileRef& file); MediaFileRef fileForIndex(const QModelIndex& index) const; void save(const QString& file); void load(const QString& file); void clear(); QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; int columnCount(const QModelIndex& parent = QModelIndex()) const override; int rowCount(const QModelIndex& parent = QModelIndex()) const override; QModelIndex parent(const QModelIndex& child) const override; QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override; Qt::DropActions supportedDropActions() const override; Qt::ItemFlags flags(const QModelIndex& index) const override; QStringList mimeTypes() const override; QMimeData* mimeData(const QModelIndexList& indexes) const override; bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override; bool removeRows(int row, int count, const QModelIndex& parent) override; bool insertRows(int row, int count, const QModelIndex& parent) override; private slots: void onPlaying(const MediaFileRef& file); signals: void itemsDropped(); private: typedef QPair PlayListItem; mutable QList files; mutable QList dragged_rows; MediaFileCollection* collection; MediaPlayer* player; }; } #endif // PLAYLIST_H diff --git a/plugins/mediaplayer/playlistwidget.h b/plugins/mediaplayer/playlistwidget.h index 68ad1102..deaeeebd 100644 --- a/plugins/mediaplayer/playlistwidget.h +++ b/plugins/mediaplayer/playlistwidget.h @@ -1,107 +1,107 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef PLAYLISTWIDGET_H #define PLAYLISTWIDGET_H #include #include #include #include #include #include #include #include "mediafile.h" class QSortFilterProxyModel; namespace kt { class PlayList; class MediaPlayer; class MediaFileCollection; class PlayListWidget : public QWidget { Q_OBJECT public: PlayListWidget(MediaFileCollection* collection, MediaPlayer* player, QWidget* parent); - ~PlayListWidget(); + ~PlayListWidget() override; /// Get the play list PlayList* playList() {return play_list;} /// Get the current selected item QModelIndex selectedItem() const; void saveState(KSharedConfigPtr cfg); void loadState(KSharedConfigPtr cfg); /// Get the next item to play, if idx is invalid return the first playable item QModelIndex next(const QModelIndex& idx, bool random) const; /// Get the file of a given index QString fileForIndex(const QModelIndex& index) const; /// Get the index of a file QModelIndex indexForFile(const QString& file) const; /// Is random mode activated ? bool randomOrder() const {return random_mode->isChecked();} public Q_SLOTS: QModelIndex play(); void addMedia(); void clearPlayList(); private Q_SLOTS: void onSelectionChanged(const QItemSelection& s, const QItemSelection& d); void doubleClicked(const QModelIndex& index); void showContextMenu(QPoint pos); void removeFiles(); void onItemsDropped(); Q_SIGNALS: void fileSelected(const MediaFileRef& file); void doubleClicked(const MediaFileRef& file); void randomModeActivated(bool random); void enableNext(bool on); private: QModelIndex next(const QModelIndex& idx) const; QModelIndex randomNext(const QModelIndex& idx) const; private: MediaPlayer* player; PlayList* play_list; QToolBar* tool_bar; QTreeView* view; QCheckBox* random_mode; QMenu* menu; QSortFilterProxyModel* proxy_model; MediaFileCollection* collection; }; } #endif // PLAYLISTWIDGET_H diff --git a/plugins/mediaplayer/videochunkbar.h b/plugins/mediaplayer/videochunkbar.h index 80d74156..09f28209 100644 --- a/plugins/mediaplayer/videochunkbar.h +++ b/plugins/mediaplayer/videochunkbar.h @@ -1,64 +1,64 @@ /*************************************************************************** * Copyright (C) 2010 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_VIDEOCHUNKBAR_H #define KT_VIDEOCHUNKBAR_H #include #include "mediafile.h" namespace kt { /** ChunkBar for a video during streaming mode */ class VideoChunkBar : public ChunkBar { Q_OBJECT public: VideoChunkBar(const MediaFileRef& mfile, QWidget* parent); - ~VideoChunkBar(); + ~VideoChunkBar() override; /// Set the media file void setMediaFile(const MediaFileRef& mf); /// Get the bitset const bt::BitSet& getBitSet() const override; /// Time has elapsed during playing, update the bar if necessary void timeElapsed(qint64 time); private slots: void updateChunkBar(); void updateBitSet(); private: void drawBarContents(QPainter* p) override; private: MediaFileRef mfile; bt::BitSet bitset; bt::Uint32 current_chunk; }; } #endif // KT_VIDEOCHUNKBAR_H diff --git a/plugins/mediaplayer/videowidget.h b/plugins/mediaplayer/videowidget.h index a8ac2dca..8789d6ce 100644 --- a/plugins/mediaplayer/videowidget.h +++ b/plugins/mediaplayer/videowidget.h @@ -1,99 +1,99 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTVIDEOWIDGET_H #define KTVIDEOWIDGET_H #include #include #include #include #include #include class QAction; class QDBusInterface; class QLabel; class QStackedWidget; class KToolBar; class KActionCollection; namespace kt { class VideoChunkBar; class MediaPlayer; class MediaFileRef; /** * Widget to display a video * @author Joris Guisson */ class VideoWidget : public QWidget { Q_OBJECT public: VideoWidget(MediaPlayer* player, KActionCollection* ac, QWidget* parent); - ~VideoWidget(); + ~VideoWidget() override; /** * Make the widget full screen or not. * @param on */ void setFullScreen(bool on); protected: void mouseMoveEvent(QMouseEvent* event) override; bool eventFilter(QObject* dst, QEvent* event) override; private slots: void play(); void stop(); void setControlsVisible(bool on); void timerTick(qint64 time); void playing(const MediaFileRef& mfile); void enableActions(unsigned int flags); signals: void toggleFullScreen(bool on); private: void inhibitScreenSaver(bool on); QString formatTime(qint64 cur, qint64 total); private: Phonon::VideoWidget* video; MediaPlayer* player; Phonon::SeekSlider* slider; KToolBar* tb; QAction * play_action; QAction * stop_action; QLabel* time_label; Phonon::VolumeSlider* volume; VideoChunkBar* chunk_bar; bool fullscreen; quint32 screensaver_cookie; quint32 powermanagement_cookie; }; } #endif diff --git a/plugins/scanfolder/scanfolder.h b/plugins/scanfolder/scanfolder.h index 02222e94..7366f180 100644 --- a/plugins/scanfolder/scanfolder.h +++ b/plugins/scanfolder/scanfolder.h @@ -1,67 +1,67 @@ /*************************************************************************** * Copyright (C) 2006 by Ivan Vasić * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef SCANFOLDER_H #define SCANFOLDER_H #include #include #include namespace kt { class CoreInterface; class ScanThread; /** * Monitors a folder for changes, and passes torrents to load to the TorrentLoadQueue */ class ScanFolder : public QObject { Q_OBJECT public: /** * Default constructor. * @param scanner The ScanThread * @param dir The directory */ ScanFolder(ScanThread* scanner, const QUrl &dir, bool recursive); - ~ScanFolder(); + ~ScanFolder() override; /** * Set if the ScanFolder needs to scan subdirectories recursively * @param rec Recursive or not */ void setRecursive(bool rec); public slots: void scanDir(const QString& path); private: ScanThread* scanner; QUrl scan_directory; KDirWatch* watch; bool recursive; }; } #endif diff --git a/plugins/scanfolder/scanfolderplugin.h b/plugins/scanfolder/scanfolderplugin.h index cb6831ed..93de0cb0 100644 --- a/plugins/scanfolder/scanfolderplugin.h +++ b/plugins/scanfolder/scanfolderplugin.h @@ -1,63 +1,63 @@ /*************************************************************************** * Copyright (C) 2006 by Ivan Vasić * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTSCANFOLDERPLUGIN_H #define KTSCANFOLDERPLUGIN_H #include class QString; namespace kt { class ScanFolderPrefPage; class TorrentLoadQueue; class ScanThread; /** * @author Ivan Vasic * @brief KTorrent ScanFolder plugin * Automatically scans selected folder for torrent files and loads them. */ class ScanFolderPlugin : public Plugin { Q_OBJECT public: ScanFolderPlugin(QObject* parent, const QVariantList& args); - ~ScanFolderPlugin(); + ~ScanFolderPlugin() override; void load() override; void unload() override; bool versionCheck(const QString& version) const override; public slots: void updateScanFolders(); private: ScanFolderPrefPage* pref; TorrentLoadQueue* tlq; ScanThread* scanner; }; } #endif diff --git a/plugins/scanfolder/scanfolderprefpage.h b/plugins/scanfolder/scanfolderprefpage.h index 5e3e3c58..d7028594 100644 --- a/plugins/scanfolder/scanfolderprefpage.h +++ b/plugins/scanfolder/scanfolderprefpage.h @@ -1,61 +1,61 @@ /*************************************************************************** * Copyright (C) 2006 by Ivan Vasić * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTSCANFOLDERPREFPAGE_H #define KTSCANFOLDERPREFPAGE_H #include #include "scanfolderplugin.h" #include "ui_scanfolderprefpage.h" namespace kt { /** * ScanFolder plugin preferences page * @author Ivan Vasić */ class ScanFolderPrefPage : public PrefPageInterface, public Ui_ScanFolderPrefPage { Q_OBJECT public: ScanFolderPrefPage(ScanFolderPlugin* plugin, QWidget* parent); - ~ScanFolderPrefPage(); + ~ScanFolderPrefPage() override; void loadSettings() override; void loadDefaults() override; void updateSettings() override; bool customWidgetsChanged() override; private slots: void addPressed(); void removePressed(); void selectionChanged(); void currentGroupChanged(int idx); private: ScanFolderPlugin* m_plugin; QStringList folders; }; } #endif diff --git a/plugins/scanfolder/scanthread.cpp b/plugins/scanfolder/scanthread.cpp index d7b13e0a..9aed99cd 100644 --- a/plugins/scanfolder/scanthread.cpp +++ b/plugins/scanfolder/scanthread.cpp @@ -1,211 +1,211 @@ /*************************************************************************** * Copyright (C) 2011 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include "scanthread.h" #include #include #include #include #include #include namespace kt { const int UPDATE_FOLDER_EVENT = QEvent::User + 1; const int RECURSIVE_SCAN_EVENT = QEvent::User + 2; class UpdateFolderEvent : public QEvent { public: UpdateFolderEvent() : QEvent((QEvent::Type)UPDATE_FOLDER_EVENT) {} - ~UpdateFolderEvent() + ~UpdateFolderEvent() override {} }; class RecursiveScanEvent : public QEvent { public: RecursiveScanEvent(const QUrl& url) : QEvent((QEvent::Type)RECURSIVE_SCAN_EVENT), url(url) {} - ~RecursiveScanEvent() + ~RecursiveScanEvent() override {} QUrl url; }; ScanThread::ScanThread() : stop_requested(false), recursive(false) { scan_folders.setAutoDelete(true); moveToThread(this); } ScanThread::~ScanThread() { } void ScanThread::setRecursive(bool rec) { recursive = rec; } void ScanThread::addDirectory(const QUrl& url, bool recursive) { scan(url, recursive); } void ScanThread::setFolderList(const QStringList& folders) { QMutexLocker lock(&mutex); if (this->folders != folders) { this->folders = folders; // Use custom event to wake up scanner thread QCoreApplication::postEvent(this, new UpdateFolderEvent()); } } void ScanThread::customEvent(QEvent* ev) { if (ev->type() == UPDATE_FOLDER_EVENT) { updateFolders(); } else if (ev->type() == RECURSIVE_SCAN_EVENT) { RecursiveScanEvent* rev = (RecursiveScanEvent*)ev; scan(rev->url, true); } ev->accept(); } void ScanThread::updateFolders() { QStringList tmp; mutex.lock(); tmp = folders; // Use tmp list to not block the mutex for to long mutex.unlock(); // first erase folders we don't need anymore bt::PtrMap::iterator i = scan_folders.begin(); while (i != scan_folders.end()) { if (!tmp.contains(i->first)) { QString f = i->first; i++; scan_folders.erase(f); } else { i->second->setRecursive(recursive); i++; } } foreach (const QString& folder, tmp) { if (scan_folders.find(folder)) continue; if (QDir(folder).exists()) { // only add folder when it exists ScanFolder* sf = new ScanFolder(this, QUrl::fromLocalFile(folder), recursive); scan_folders.insert(folder, sf); } } } void ScanThread::run() { updateFolders(); exec(); } void ScanThread::stop() { stop_requested = true; // XXX seems like deleting KDirWatch object(s) created in scan_folders // in destructor of this QThread after it has been stopped // causes memory corruption, so we delete them early scan_folders.clear(); exit(); wait(); } bool ScanThread::alreadyLoaded(const QDir& d, const QString& torrent) { return d.exists(QLatin1Char('.') + torrent); } void ScanThread::scan(const QUrl& dir, bool recursive) { if (stop_requested) return; QStringList filters; filters << QStringLiteral("*.torrent"); QDir d(dir.toLocalFile()); QStringList files = d.entryList(filters, QDir::Readable | QDir::Files); QList torrents; foreach (const QString& tor, files) { if (!alreadyLoaded(d, tor)) torrents.append(QUrl::fromLocalFile(d.absoluteFilePath(tor))); } found(torrents); if (stop_requested) return; if (recursive) { const QString loaded_localized = i18nc("folder name part", "loaded"); QStringList dirs = d.entryList(QDir::Readable | QDir::Dirs); foreach (const QString& subdir, dirs) { if (subdir != QStringLiteral(".") && subdir != QStringLiteral("..") && subdir != loaded_localized) { QCoreApplication::postEvent(this, new RecursiveScanEvent(QUrl::fromLocalFile(d.absoluteFilePath(subdir)))); } } } } } diff --git a/plugins/scanfolder/scanthread.h b/plugins/scanfolder/scanthread.h index fb214a4e..22da8791 100644 --- a/plugins/scanfolder/scanthread.h +++ b/plugins/scanfolder/scanthread.h @@ -1,99 +1,99 @@ /*************************************************************************** * Copyright (C) 2011 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_SCANTHREAD_H #define KT_SCANTHREAD_H #include #include #include #include #include #include "scanfolder.h" #include class QDir; namespace kt { /** * Thread which scans directories in the background and looks for torrent files. */ class ScanThread : public QThread { Q_OBJECT public: ScanThread(); - ~ScanThread(); + ~ScanThread() override; /** * Set whether to scan recursively or not * @param rec Recursive or not */ void setRecursive(bool rec); /** * Add a directory to scan. * @param url Directory * @param recursive Whether or not to scan resursively */ void addDirectory(const QUrl& url, bool recursive); /** * Stop the scanning thread. */ void stop(); /** * Set the list of folders to scan. * @param folders List of folders */ void setFolderList(const QStringList& folders); protected: void run() override; private: void scan(const QUrl& dir, bool recursive); bool alreadyLoaded(const QDir& d, const QString& torrent); void updateFolders(); void customEvent(QEvent* ev) override; signals: /** * Emitted when one or more torrents are found. * @param torrents The list of torrents */ void found(const QList& torrents); private: QMutex mutex; QStringList folders; std::atomic stop_requested; std::atomic recursive; bt::PtrMap scan_folders; }; } #endif // KT_SCANTHREAD_H diff --git a/plugins/scanfolder/torrentloadqueue.h b/plugins/scanfolder/torrentloadqueue.h index 6b4fdd37..34f40c58 100644 --- a/plugins/scanfolder/torrentloadqueue.h +++ b/plugins/scanfolder/torrentloadqueue.h @@ -1,105 +1,105 @@ /*************************************************************************** * Copyright (C) 2011 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_TORRENTLOADQUEUE_H #define KT_TORRENTLOADQUEUE_H #include #include namespace kt { class CoreInterface; /// Action to perform after loading torrent. enum LoadedTorrentAction { DeleteAction, MoveAction, DefaultAction }; /** * Queue of potential torrents. It will try to load them one by one, * in a sane and none GUI blocking way. */ class TorrentLoadQueue : public QObject { Q_OBJECT public: TorrentLoadQueue(CoreInterface* core, QObject* parent = 0); - ~TorrentLoadQueue(); + ~TorrentLoadQueue() override; /// Set the loaded torrent action void setLoadedTorrentAction(LoadedTorrentAction act) {action = act;} /// Get the loaded torrent action LoadedTorrentAction loadedTorrentAction() const {return action;} public slots: /** * Add a torrent to load. */ void add(const QUrl& url); /** * Add a list of torrents */ void add(const QList& urls); private: /** * Validate if a file is a torrent. * @param url The file url * @param data The torrent data will be put into this array upon success * @return true upon success, false otherwise */ bool validateTorrent(const QUrl& url, QByteArray& data); /** * Load a torrent * @param url The file url * @param data The torrent data */ void load(const QUrl& url, const QByteArray& data); private slots: /** * Attempt to load one torrent */ void loadOne(); private: /** * Loading of a torrent has finished. * @param url The url */ void loadingFinished(const QUrl& url); private: CoreInterface* core; QList to_load; LoadedTorrentAction action; QTimer timer; }; } #endif diff --git a/plugins/scripting/api/scriptablegroup.h b/plugins/scripting/api/scriptablegroup.h index 190dc790..d4c08a55 100644 --- a/plugins/scripting/api/scriptablegroup.h +++ b/plugins/scripting/api/scriptablegroup.h @@ -1,48 +1,48 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTAPISCRIPTABLEGROUP_H #define KTAPISCRIPTABLEGROUP_H #include #include namespace kt { class DBus; /** Group which uses objects in a script to determine if a torrent is a member of the group. */ class ScriptableGroup : public kt::Group { Kross::Object::Ptr script; DBus* api; public: ScriptableGroup(const QString& name, const QString& icon, const QString& path, Kross::Object::Ptr script, DBus* api); - ~ScriptableGroup(); + ~ScriptableGroup() override; bool isMember(bt::TorrentInterface* tor) override; }; } #endif diff --git a/plugins/scripting/api/scriptingmodule.h b/plugins/scripting/api/scriptingmodule.h index 8b3381fd..1c10164e 100644 --- a/plugins/scripting/api/scriptingmodule.h +++ b/plugins/scripting/api/scriptingmodule.h @@ -1,82 +1,82 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTSCRIPTINGMODULE_H #define KTSCRIPTINGMODULE_H #include #include #include "scriptablegroup.h" namespace kt { class GUIInterface; class CoreInterface; /** Additional functions to be used in scripts */ class ScriptingModule : public QObject { Q_OBJECT public: ScriptingModule(GUIInterface* gui, CoreInterface* core, QObject* parent); - ~ScriptingModule(); + ~ScriptingModule() override; public slots: /// Get the scripts directory QString scriptsDir() const; /// Get the data directory of a script QString scriptDir(const QString& script) const; /// Read a config entry QString readConfigEntry(const QString& group, const QString& name, const QString& default_value); int readConfigEntryInt(const QString& group, const QString& name, int default_value); float readConfigEntryFloat(const QString& group, const QString& name, float default_value); bool readConfigEntryBool(const QString& group, const QString& name, bool default_value); /// Write a config entry void writeConfigEntry(const QString& group, const QString& name, const QString& value); void writeConfigEntryInt(const QString& group, const QString& name, int value); void writeConfigEntryFloat(const QString& group, const QString& name, float value); void writeConfigEntryBool(const QString& group, const QString& name, bool value); /// Sync a group void syncConfig(const QString& group); /// Create a timer QObject* createTimer(bool single_shot); /// Add a new scriptable group bool addGroup(const QString& name, const QString& icon, const QString& path, Kross::Object::Ptr obj); /// Remove a previously added group void removeGroup(const QString& name); private: GUIInterface* gui; CoreInterface* core; QMap sgroups; }; } #endif diff --git a/plugins/scripting/script.h b/plugins/scripting/script.h index 63a96375..d4db784c 100644 --- a/plugins/scripting/script.h +++ b/plugins/scripting/script.h @@ -1,132 +1,132 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTSCRIPT_H #define KTSCRIPT_H #include namespace Kross { class Action; } namespace kt { /** Keeps track of a script */ class Script : public QObject { Q_OBJECT public: Script(QObject* parent); Script(const QString& file, QObject* parent); - ~Script(); + ~Script() override; struct MetaInfo { QString name; QString comment; QString icon; QString author; QString email; QString website; QString license; bool valid() const { return !name.isEmpty() && !comment.isEmpty() && !icon.isEmpty() && !author.isEmpty() && !license.isEmpty(); } }; /** * Load the script from a desktop file * @param dir THe directory the desktop file is in * @param desktop_file The desktop file itself (relative to dir) * @return true upon success */ bool loadFromDesktopFile(const QString& dir, const QString& desktop_file); /** * Load and execute the script * @return true upon success */ bool execute(); /// Is the script executeable (i.e. is the interpreter not installed) bool executeable() const; /** * Stop the script */ void stop(); /// Is the script running bool running() const {return executing;} /// Get the name of the script QString name() const; /// Get the icon name of the script QString iconName() const; /// Get the file QString scriptFile() const {return file;} /// Get the package directory, this returns an empty string if the script is just a file QString packageDirectory() const {return package_directory;} /// Set the package directory void setPackageDirectory(const QString& dir) {package_directory = dir;} /// Get the meta info of the script const MetaInfo& metaInfo() const {return info;} /// Does the script has a configure function bool hasConfigure() const; /// Call the configure function of the script void configure(); /// Whether or not the script can be removed bool removeable() const {return can_be_removed;} /// Set the script to be removeable or not void setRemoveable(bool on) {can_be_removed = on;} private: QString file; Kross::Action* action; bool executing; MetaInfo info; bool can_be_removed; QString package_directory; }; } #endif diff --git a/plugins/scripting/scriptdelegate.h b/plugins/scripting/scriptdelegate.h index 40c34bfc..fc76bade 100644 --- a/plugins/scripting/scriptdelegate.h +++ b/plugins/scripting/scriptdelegate.h @@ -1,60 +1,60 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_SCRIPTDELEGATE_H #define KT_SCRIPTDELEGATE_H #include #include #include #include namespace kt { class ScriptDelegate : public KWidgetItemDelegate { Q_OBJECT public: ScriptDelegate(QAbstractItemView* parent); - ~ScriptDelegate(); + ~ScriptDelegate() override; void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override; QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override; QList createItemWidgets(const QModelIndex& index) const override; void updateItemWidgets(const QList widgets, const QStyleOptionViewItem& option, const QPersistentModelIndex& index) const override; private: QFont titleFont(const QFont& baseFont) const; private slots: void toggled(bool on); void aboutClicked(); void settingsClicked(); private: QCheckBox* check_box; QPushButton* push_button; }; } #endif // KT_SCRIPTDELEGATE_H diff --git a/plugins/scripting/scriptingplugin.h b/plugins/scripting/scriptingplugin.h index 392d64ad..2e4e679e 100644 --- a/plugins/scripting/scriptingplugin.h +++ b/plugins/scripting/scriptingplugin.h @@ -1,66 +1,66 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTSCRIPTINGPLUGIN_H #define KTSCRIPTINGPLUGIN_H #include class KJob; namespace kt { class Script; class ScriptManager; class ScriptModel; /** @author */ class ScriptingPlugin : public Plugin { Q_OBJECT public: ScriptingPlugin(QObject* parent, const QVariantList& args); - ~ScriptingPlugin(); + ~ScriptingPlugin() override; void load() override; void unload() override; bool versionCheck(const QString& version) const override; private: void scriptDownloadFinished(KJob* job); void loadScripts(); void saveScripts(); Script* loadScriptDir(const QString& dir); private slots: void addScript(); void removeScript(); private: ScriptManager* sman; ScriptModel* model; }; } #endif diff --git a/plugins/scripting/scriptmanager.h b/plugins/scripting/scriptmanager.h index 929b9335..748300ba 100644 --- a/plugins/scripting/scriptmanager.h +++ b/plugins/scripting/scriptmanager.h @@ -1,94 +1,94 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTSCRIPTMANAGER_H #define KTSCRIPTMANAGER_H #include #include class QAction; class KActionCollection; namespace Kross { class Action; } namespace kt { class Script; class ScriptModel; class ScriptDelegate; /** Widget to display all scripts. */ class ScriptManager : public Activity { Q_OBJECT public: ScriptManager(ScriptModel* model, QWidget* parent); - ~ScriptManager(); + ~ScriptManager() override; /// Get all selected scripts QModelIndexList selectedScripts(); /// Update all actions and make sure they are properly enabled or disabled void updateActions(const QModelIndexList& selected); private Q_SLOTS: void onSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected); void showContextMenu(const QPoint& p); void dataChanged(const QModelIndex& f, const QModelIndex& to); void runScript(); void stopScript(); void editScript(); void configureScript(); void showProperties(); public: void showProperties(Script* script); private: void setupActions(); Q_SIGNALS: void addScript(); void removeScript(); private: ScriptModel* model; ScriptDelegate* delegate; QListView* view; QAction * add_script; QAction * remove_script; QAction * run_script; QAction * stop_script; QAction * edit_script; QAction * properties; QAction * configure_script; }; } #endif diff --git a/plugins/scripting/scriptmodel.h b/plugins/scripting/scriptmodel.h index 87c3a37d..0e2b0bea 100644 --- a/plugins/scripting/scriptmodel.h +++ b/plugins/scripting/scriptmodel.h @@ -1,100 +1,100 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTSCRIPTMODEL_H #define KTSCRIPTMODEL_H #include class KArchive; class KArchiveDirectory; namespace kt { class Script; /** Model which keeps track of all scripts */ class ScriptModel : public QAbstractListModel { Q_OBJECT public: ScriptModel(QObject* parent); - ~ScriptModel(); + ~ScriptModel() override; enum Role { CommentRole = Qt::UserRole, ConfigurableRole, ConfigureRole, AboutRole }; /** * Add a script to the model * @param file */ void addScript(const QString& file); /** * Add script which is described by a desktop file. * @param dir The directory the script is in * @param desktop_file The desktop file (relative to dir, not an absolute path) * @return The Script or 0 if something goes wrong */ Script* addScriptFromDesktopFile(const QString& dir, const QString& desktop_file); /// Get a script given an index Script* scriptForIndex(const QModelIndex& index) const; /// Get a list of all scripts QStringList scriptFiles() const; /// Get a list of all running scripts QStringList runningScriptFiles() const; /// Remove a bunch of scripts void removeScripts(const QModelIndexList& indices); /// Run all the scripts in the string list void runScripts(const QStringList& r); int rowCount(const QModelIndex& parent) const override; QVariant data(const QModelIndex& index, int role) const override; bool setData(const QModelIndex& index, const QVariant& value, int role) override; Qt::ItemFlags flags(const QModelIndex& index) const override; bool removeRows(int row, int count, const QModelIndex& parent) override; bool insertRows(int row, int count, const QModelIndex& parent) override; private: void addScriptFromArchive(KArchive* archive); void addScriptFromArchiveDirectory(const KArchiveDirectory* dir); signals: void showPropertiesDialog(Script* s); private: QList scripts; }; } #endif diff --git a/plugins/search/buffernetworkreply.h b/plugins/search/buffernetworkreply.h index 8ab5feb7..90040cb2 100644 --- a/plugins/search/buffernetworkreply.h +++ b/plugins/search/buffernetworkreply.h @@ -1,57 +1,57 @@ /*************************************************************************** * Copyright (C) 2010 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_BUFFERNETWORKREPLY_H #define KT_BUFFERNETWORKREPLY_H #include #include namespace kt { /** * QNetworkReply which reads from a buffer */ class BufferNetworkReply : public QNetworkReply { public: /** * @param data The data to put into the buffer * @param content_type Content type of the data * @param parent Parent of the BufferNetworkReply */ BufferNetworkReply(const QByteArray& data, const QString& content_type, QObject* parent = 0); - ~BufferNetworkReply(); + ~BufferNetworkReply() override; void abort() override; bool isSequential() const override {return true;} qint64 bytesAvailable() const override; protected: qint64 readData(char* data, qint64 maxlen) override; private: QBuffer buf; }; } #endif // KT_BUFFERNETWORKREPLY_H diff --git a/plugins/search/localfilenetworkreply.h b/plugins/search/localfilenetworkreply.h index c3792faf..45435218 100644 --- a/plugins/search/localfilenetworkreply.h +++ b/plugins/search/localfilenetworkreply.h @@ -1,52 +1,52 @@ /*************************************************************************** * Copyright (C) 2010 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_LOCALFILENETWORKREPLY_H #define KT_LOCALFILENETWORKREPLY_H #include #include namespace kt { /** * QNetworkReply which reads a local file. */ class LocalFileNetworkReply : public QNetworkReply { public: LocalFileNetworkReply(const QString& file, QObject* parent = 0); - ~LocalFileNetworkReply(); + ~LocalFileNetworkReply() override; void abort() override; bool isSequential() const override {return true;} bool atEnd() const override; qint64 bytesAvailable() const override; protected: qint64 readData(char* data, qint64 maxlen) override; private: QFile* fptr; }; } #endif // KT_LOCALFILENETWORKREPLY_H diff --git a/plugins/search/opensearchdownloadjob.h b/plugins/search/opensearchdownloadjob.h index dcae42e4..c03063a3 100644 --- a/plugins/search/opensearchdownloadjob.h +++ b/plugins/search/opensearchdownloadjob.h @@ -1,73 +1,73 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTOPENSEARCHDOWNLOADJOB_H #define KTOPENSEARCHDOWNLOADJOB_H #include #include #include "proxy_helper.h" namespace kt { /** Job which tries to find an opensearch xml description on a website and download that to a directory. */ class OpenSearchDownloadJob : public KIO::Job { Q_OBJECT public: OpenSearchDownloadJob(const QUrl &url, const QString& dir, ProxyHelper *proxy); - ~OpenSearchDownloadJob(); + ~OpenSearchDownloadJob() override; /// Start the job - void start(); + void start() override; /// Start the job. Try to get file by default url void startDefault(); /// Get the directory QString directory() const {return dir;} /// Get the hostname QString hostname() const {return url.host();} private slots: void getFinished(KJob* j); void xmlFileDownloadFinished(KJob* j); private: bool checkLinkTagContent(const QString& content); QString htmlParam(const QString& param, const QString& content); bool startXMLDownload(const QUrl& url); private: QUrl url; QString dir; ProxyHelper* m_proxy; }; } #endif diff --git a/plugins/search/searchactivity.h b/plugins/search/searchactivity.h index b687dbfb..86bb1454 100644 --- a/plugins/search/searchactivity.h +++ b/plugins/search/searchactivity.h @@ -1,87 +1,87 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef SEARCHACTIVITY_H #define SEARCHACTIVITY_H #include #include #include #include #include namespace kt { class SearchToolBar; class SearchWidget; class SearchPlugin; class SearchActivity : public kt::Activity { Q_OBJECT public: SearchActivity(SearchPlugin* sp, QWidget* parent); - ~SearchActivity(); + ~SearchActivity() override; /// Add a SearchWidget void search(const QString& text, int engine); /// Save all current searches void saveCurrentSearches(); /// Load current searches void loadCurrentSearches(); void loadState(KSharedConfigPtr cfg); void saveState(KSharedConfigPtr cfg); /// Create a new empty search tab SearchWidget* newTab(); public Q_SLOTS: void home(); void openNewTab(const QUrl &url); void currentTabChanged(int idx); void closeTab(); void openTab(); void setTabTitle(SearchWidget* sw, const QString& title); void setTabIcon(SearchWidget* sw, const QIcon& icon); void clearSearchHistory(); void search(); void find(); private: SearchWidget* newSearchWidget(const QString& text); void setupActions(); private: QTabWidget* tabs; QList searches; SearchPlugin* sp; SearchToolBar* toolbar; QAction * find_action; QAction * search_action; QAction * home_action; }; } #endif // SEARCHACTIVITY_H diff --git a/plugins/search/searchengine.cpp b/plugins/search/searchengine.cpp index 79395f45..5a814969 100644 --- a/plugins/search/searchengine.cpp +++ b/plugins/search/searchengine.cpp @@ -1,169 +1,169 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include #include #include #include #include #include #include "searchengine.h" using namespace bt; namespace kt { class OpenSearchHandler : public QXmlDefaultHandler { public: OpenSearchHandler(SearchEngine* engine) : engine(engine) { } - ~OpenSearchHandler() + ~OpenSearchHandler() override { } bool characters(const QString& ch) override { tmp += ch; return true; } bool startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts) override { Q_UNUSED(namespaceURI); Q_UNUSED(qName); tmp = QString(); if (localName == QLatin1String("Url")) { if (atts.value(QLatin1String("type")) == QLatin1String("text/html")) engine->url = atts.value(QLatin1String("template")); } return true; } bool endElement(const QString& namespaceURI, const QString& localName, const QString& qName) override { Q_UNUSED(namespaceURI); Q_UNUSED(qName); if (localName == QLatin1String("ShortName")) engine->name = tmp; else if (localName == QLatin1String("Description")) engine->description = tmp; else if (localName == QLatin1String("Image")) engine->icon_url = tmp; return true; } SearchEngine* engine; QString tmp; }; SearchEngine::SearchEngine(const QString& data_dir) : data_dir(data_dir) { } SearchEngine::~SearchEngine() { } bool SearchEngine::load(const QString& xml_file) { QXmlSimpleReader xml_reader; QFile fptr(xml_file); QXmlInputSource source(&fptr); OpenSearchHandler hdlr(this); xml_reader.setErrorHandler(&hdlr); xml_reader.setContentHandler(&hdlr); if (!xml_reader.parse(&source)) { Out(SYS_SRC | LOG_NOTICE) << "Failed to parse opensearch description !" << endl; return false; } // check if icon file is present in data_dir // if not, download it if (!icon_url.isEmpty()) { QString icon_name = QUrl(icon_url).fileName(); QString icon_filename = data_dir + icon_name; bool found = false; found = bt::Exists(icon_filename); if (!found) { // if there is an icon in xml file folder - use it // xml file folder might not be equal to data_dir icon_filename = QFileInfo(fptr).absolutePath() + QLatin1Char('/') + icon_name; found = bt::Exists(icon_filename); } if (!found) { KJob* j = KIO::storedGet(QUrl(icon_url), KIO::Reload, KIO::HideProgressInfo); connect(j, &KJob::result, this, &SearchEngine::iconDownloadFinished); } else { // load the icon icon = QIcon(icon_filename); } } return true; } QUrl SearchEngine::search(const QString& terms) { QString r = url; r = r.replace(QLatin1String("{searchTerms}"), terms); return QUrl(r); } void SearchEngine::iconDownloadFinished(KJob* job) { if (!job->error()) { QString icon_name = QUrl(icon_url).fileName(); KIO::StoredTransferJob* j = (KIO::StoredTransferJob*)job; QFile fptr(data_dir + icon_name); if (!fptr.open(QIODevice::WriteOnly)) { Out(SYS_SRC | LOG_NOTICE) << "Failed to save icon: " << fptr.errorString() << endl; return; } fptr.write(j->data()); fptr.close(); // load the icon icon = QIcon(data_dir + icon_name); } } } diff --git a/plugins/search/searchengine.h b/plugins/search/searchengine.h index a8bfd5e7..85d529ff 100644 --- a/plugins/search/searchengine.h +++ b/plugins/search/searchengine.h @@ -1,93 +1,93 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTSEARCHENGINE_H #define KTSEARCHENGINE_H #include #include #include class KJob; namespace kt { /** Keeps track of a search engine */ class SearchEngine : public QObject { Q_OBJECT public: /** * Constructor, sets the data dir * @param data_dir Directory where all the information regarding the engine is stored */ SearchEngine(const QString& data_dir); - ~SearchEngine(); + ~SearchEngine() override; /** * Load the engine from an opensearch XML file * @param xml_file Local XML file * @return true upon success */ bool load(const QString& xml_file); /** * Fill in search terms into the search url and create the QUrl to use * @param terms Tersm to search for * @return The url */ QUrl search(const QString& terms); /// Get the name of the engine QString engineName() const {return name;} /// Get the icon QIcon engineIcon() const {return icon;} /// Get the engine directory QString engineDir() const {return data_dir;} /// Get the URL QString engineUrl() const {return url;} /// Get the description QString engineDescription() const {return description;} private slots: void iconDownloadFinished(KJob* job); private: QString data_dir; QString name; QString description; QString url; QString icon_url; QIcon icon; friend class OpenSearchHandler; }; } #endif diff --git a/plugins/search/searchenginelist.h b/plugins/search/searchenginelist.h index c0007113..6a2faed1 100644 --- a/plugins/search/searchenginelist.h +++ b/plugins/search/searchenginelist.h @@ -1,109 +1,109 @@ /*************************************************************************** * Copyright (C) 2005-2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTSEARCHENGINELIST_H #define KTSEARCHENGINELIST_H #include #include #include #include "searchengine.h" #include "proxy_helper.h" namespace kt { class OpenSearchDownloadJob; /** @author Joris Guisson */ class SearchEngineList : public QAbstractListModel { Q_OBJECT QList engines; QList default_opensearch_urls; QList default_urls; ProxyHelper* m_proxy; QString data_dir; public: SearchEngineList(ProxyHelper* proxy, const QString& data_dir); - ~SearchEngineList(); + ~SearchEngineList() override; /// Load all engines void loadEngines(); /// Search with an engine QUrl search(bt::Uint32 engine, const QString& terms); /// Get the name of an engine QString getEngineName(bt::Uint32 engine) const; /// Get the number of engines bt::Uint32 getNumEngines() const {return engines.count();} int rowCount(const QModelIndex& parent) const override; QVariant data(const QModelIndex& index, int role) const override; bool insertRows(int row, int count, const QModelIndex& parent) override; bool removeRows(int row, int count, const QModelIndex& parent) override; /** * Remove all engines in a list * @param sel The list */ void removeEngines(const QModelIndexList& sel); /** * Remove all engines */ void removeAllEngines(); /** * Add all defaults engines (if they are not added yet) */ void addDefaults(); /** * Add an engine from an OpenSearchDownloadJob * @param j The OpenSearchDownloadJob */ void addEngine(OpenSearchDownloadJob* j); /** * Add an engine from a search URL * @param dir The directory to use * @param url The url */ void addEngine(const QString& dir, const QString& url); private: void convertSearchEnginesFile(); void loadDefault(bool removed_to); bool alreadyLoaded(const QString& user_dir); void loadEngine(const QString& global_dir, const QString& user_dir, bool load_removed); private slots: void openSearchDownloadJobFinished(KJob* j); }; } #endif diff --git a/plugins/search/searchplugin.h b/plugins/search/searchplugin.h index 01a37af9..e29e6682 100644 --- a/plugins/search/searchplugin.h +++ b/plugins/search/searchplugin.h @@ -1,68 +1,68 @@ /*************************************************************************** * Copyright (C) 2005-2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTSEARCHPLUGIN_H #define KTSEARCHPLUGIN_H #include #include #include #include "searchenginelist.h" #include "proxy_helper.h" namespace kt { class SearchPrefPage; class SearchActivity; /** @author Joris Guisson */ class SearchPlugin : public Plugin { Q_OBJECT public: SearchPlugin(QObject* parent, const QVariantList& args); - ~SearchPlugin(); + ~SearchPlugin() override; void load() override; void unload() override; bool versionCheck(const QString& version) const override; SearchEngineList* getSearchEngineList() const {return engines;} SearchActivity* getSearchActivity() const {return activity;} ProxyHelper* getProxy() const {return proxy;} void search(const QString& text, int engine, bool external); private Q_SLOTS: void preferencesUpdated(); private: SearchActivity* activity; SearchPrefPage* pref; SearchEngineList* engines; ProxyHelper* proxy; }; } #endif diff --git a/plugins/search/searchprefpage.h b/plugins/search/searchprefpage.h index ba057ae3..ebd37717 100644 --- a/plugins/search/searchprefpage.h +++ b/plugins/search/searchprefpage.h @@ -1,74 +1,74 @@ /*************************************************************************** * Copyright (C) 2005-2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTSEARCHPREFPAGE_H #define KTSEARCHPREFPAGE_H #include #include #include "ui_searchpref.h" class KJob; namespace kt { class SearchPlugin; class SearchEngineList; /** * @author Joris Guisson * * Preference page for the search plugin. */ class SearchPrefPage : public PrefPageInterface, public Ui_SearchPref { Q_OBJECT public: SearchPrefPage(SearchPlugin* plugin, SearchEngineList* sl, QWidget* parent); - ~SearchPrefPage(); + ~SearchPrefPage() override; void loadSettings() override; void loadDefaults() override; public slots: void customToggled(bool toggled); private slots: void addClicked(); void removeClicked(); void addDefaultClicked(); void removeAllClicked(); void clearHistory(); void openInExternalToggled(bool on); void selectionChanged(const QItemSelection& selected, const QItemSelection& deselected); void downloadJobFinished(KJob* j); void resetDefaultAction(); signals: void clearSearchHistory(); private: SearchPlugin* plugin; SearchEngineList* engines; }; } #endif diff --git a/plugins/search/searchtoolbar.h b/plugins/search/searchtoolbar.h index 82beb5f2..b759121c 100644 --- a/plugins/search/searchtoolbar.h +++ b/plugins/search/searchtoolbar.h @@ -1,79 +1,79 @@ /*************************************************************************** * Copyright (C) 2005-2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef SEARCHTAB_H #define SEARCHTAB_H #include class QAction; class KComboBox; class KActionCollection; namespace kt { class SearchEngineList; /** Holds all widgets of the toolbar of the search plugin. */ class SearchToolBar : public QObject { Q_OBJECT public: SearchToolBar(KActionCollection* ac, SearchEngineList* sl, QObject* parent); - ~SearchToolBar(); + ~SearchToolBar() override; /// Save settings like current search engine void saveSettings(); /// Get the index of the current search engine int currentSearchEngine() const; public Q_SLOTS: /// Clear the search history void clearHistory(); protected Q_SLOTS: void searchNewTabPressed(); void searchBoxReturn(); void textChanged(const QString& str); void selectedEngineChanged(int idx); Q_SIGNALS: /// Emitted when the user presses enter or clicks search void search(const QString& text, int engine, bool external); private: void loadSearchHistory(); void saveSearchHistory(); private: KComboBox* m_search_text; KComboBox* m_search_engine; QAction* m_search_new_tab; int m_current_search_engine; }; } #endif diff --git a/plugins/search/searchwidget.h b/plugins/search/searchwidget.h index bad6aed0..f74d7374 100644 --- a/plugins/search/searchwidget.h +++ b/plugins/search/searchwidget.h @@ -1,98 +1,98 @@ /*************************************************************************** * Copyright (C) 2005-2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef BTSEARCHWIDGET_H #define BTSEARCHWIDGET_H #include #include #include "webview.h" class QProgressBar; class QNetworkReply; class QMenu; class KComboBox; namespace kt { class SearchWidget; class SearchPlugin; /** @author Joris Guisson Widget which shows a KHTML window with the users search in it */ class SearchWidget : public QWidget, public WebViewClient { Q_OBJECT public: SearchWidget(SearchPlugin* sp); - ~SearchWidget(); + ~SearchWidget() override; QString getSearchText() const {return search_text->text();} QUrl getCurrentUrl() const; QString getSearchBarText() const; int getSearchBarEngine() const; void setSearchBarEngine(int engine); bool backAvailable() const; void restore(const QUrl &url, const QString& text, const QString& sb_text, int engine); signals: void enableBack(bool on); void openNewTab(const QUrl &url); void changeTitle(SearchWidget* w, const QString& title); void changeIcon(SearchWidget* w, const QIcon& icon); public slots: void search(const QString& text, int engine = 0); void home(); void search(); private slots: void loadStarted(); void loadFinished(bool ok); void loadProgress(int p); void unsupportedContent(QNetworkReply* reply); void torrentDownloadFinished(); void iconChanged(); void titleChanged(const QString& text); private: QUrl searchUrl(const QString& search_text) override; QWebView* newTab() override; void magnetUrl(const QUrl& magnet_url) override; private: WebView* webview; KToolBar* sbar; SearchPlugin* sp; QProgressBar* prog; QNetworkReply* torrent_download; KComboBox* search_engine; QLineEdit* search_text; }; } #endif diff --git a/plugins/search/webview.cpp b/plugins/search/webview.cpp index 55d3528d..a5a8fdba 100644 --- a/plugins/search/webview.cpp +++ b/plugins/search/webview.cpp @@ -1,216 +1,216 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include "webview.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "buffernetworkreply.h" #include "localfilenetworkreply.h" using namespace bt; namespace kt { class NetworkAccessManager : public KIO::AccessManager { public: NetworkAccessManager(WebView* parent) : KIO::AccessManager(parent), webview(parent) { webview->getProxy()->ApplyProxy(sessionMetaData()); } - ~NetworkAccessManager() + ~NetworkAccessManager() override {} QNetworkReply* createRequest(Operation op, const QNetworkRequest& req, QIODevice* outgoingData) override { if (req.url().scheme() == QStringLiteral("magnet")) { webview->handleMagnetUrl(req.url()); return KIO::AccessManager::createRequest(op, req, outgoingData); } else if (req.url().host() == QStringLiteral("ktorrent.searchplugin")) { QString search_text = QUrlQuery(req.url()).queryItemValue(QStringLiteral("search_text")); if (!search_text.isEmpty()) { QUrl url(webview->searchUrl(search_text)); QNetworkRequest request(url); return KIO::AccessManager::createRequest(op, request, outgoingData); } else if (req.url().path() == QStringLiteral("/")) { return new BufferNetworkReply(webview->homePageData().toLocal8Bit(), QStringLiteral("text/html"), this); } else { return new LocalFileNetworkReply(webview->homePageBaseDir() + req.url().path(), this); } } return KIO::AccessManager::createRequest(op, req, outgoingData); } WebView* webview; }; ////////////////////////////////////////////////////// WebView::WebView(kt::WebViewClient* client, ProxyHelper* proxy, QWidget* parentWidget) : KWebView(parentWidget), client(client), m_proxy(proxy) { page()->setNetworkAccessManager(new NetworkAccessManager(this)); page()->setForwardUnsupportedContent(true); connect(page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest))); } WebView::~WebView() { } void WebView::handleMagnetUrl(const QUrl& magnet_url) { if (client) client->magnetUrl(magnet_url); } void WebView::openUrl(const QUrl &url) { if (url.host() == QStringLiteral("ktorrent.searchplugin")) home(); else load(url); } void WebView::home() { if (home_page_html.isEmpty()) loadHomePage(); load(QUrl(QStringLiteral("http://ktorrent.searchplugin/"))); } QString WebView::homePageData() { if (home_page_html.isEmpty()) loadHomePage(); return home_page_html; } void WebView::loadHomePage() { QString file = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("ktorrent/search/home/home.html")); QFile fptr(file); if (fptr.open(QIODevice::ReadOnly)) { Out(SYS_SRC | LOG_DEBUG) << "Loading home page from " << file << endl; home_page_base_url = file.left(file.lastIndexOf(QLatin1Char('/')) + 1); home_page_html = QTextStream(&fptr).readAll(); // %1 home_page_html = home_page_html.arg(QStringLiteral("ktorrent_infopage.css")); // %2 if (qApp->layoutDirection() == Qt::RightToLeft) { QString link = QStringLiteral(""); link = link.arg(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kdeui/about/kde_infopage_rtl.css"))); home_page_html = home_page_html.arg(link); } else home_page_html = home_page_html.arg(QString()); KIconLoader* iconloader = KIconLoader::global(); int icon_size = iconloader->currentSize(KIconLoader::Desktop); home_page_html = home_page_html .arg(i18n("Home")) // %3 Title .arg(i18n("KTorrent")) // %4 .arg(i18nc("KDE 4 tag line, see http://kde.org/img/kde40.png", "Be free.")) // %5 .arg(i18n("Search the web for torrents.")) // %6 .arg(i18n("Search")) // %7 .arg(QStringLiteral("search_text")) // %8 .arg(icon_size).arg(icon_size); // %9 and %10 } else { Out(SYS_SRC | LOG_IMPORTANT) << "Failed to load " << file << " : " << fptr.errorString() << endl; } } QUrl WebView::searchUrl(const QString& search_text) { if (client) return client->searchUrl(search_text); else // client is broken -> browse to home return QUrl(QStringLiteral("http://ktorrent.searchplugin/")); } QWebView* WebView::createWindow(QWebPage::WebWindowType type) { Q_UNUSED(type); return client->newTab(); } void WebView::downloadRequested(const QNetworkRequest& req) { QString filename = QFileInfo(req.url().path()).fileName(); QString path = QFileDialog::getExistingDirectory(this, i18n("Save %1 to"), QStandardPaths::writableLocation(QStandardPaths::DownloadLocation)); if (!path.isEmpty()) KIO::copy(req.url(), QUrl(path)); } void WebView::downloadResponse(QNetworkReply* reply) { KWebPage* p = (KWebPage*)page(); p->downloadResponse(reply); } } diff --git a/plugins/search/webview.h b/plugins/search/webview.h index 16dbe93e..894faeb1 100644 --- a/plugins/search/webview.h +++ b/plugins/search/webview.h @@ -1,115 +1,115 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_WEBVIEW_H #define KT_WEBVIEW_H #include #include #include #include "proxy_helper.h" namespace kt { class WebViewClient { public: virtual ~WebViewClient() {} /// Get a search url for a search text virtual QUrl searchUrl(const QString& search_text) = 0; /// Create a new tab virtual QWebView* newTab() = 0; /// Handle magnet urls virtual void magnetUrl(const QUrl& magnet_url) = 0; }; /** WebView provides a webkit view which supports for the ktorrent homepage. */ class WebView : public KWebView { Q_OBJECT public: WebView(WebViewClient* client, ProxyHelper* proxy, QWidget* parentWidget = 0); - virtual ~WebView(); + ~WebView() override; /** * Open a url * @param url The QUrl */ void openUrl(const QUrl &url); /** * Show the home page */ void home(); /** * Get a search url for a search text * @param search_text The text to search * @return A QUrl to load */ QUrl searchUrl(const QString& search_text); /** * Download a response using KIO * @param reply The QNetworkReply to download */ void downloadResponse(QNetworkReply* reply); /// Get the html code of the homepage QString homePageData(); /// Get the home page base directory QString homePageBaseDir() const {return home_page_base_url;} /// Handle magnet url void handleMagnetUrl(const QUrl& magnet_url); /// Get heloper object that applies proxy settings ProxyHelper* getProxy() const {return m_proxy;} protected: void loadHomePage(); QWebView* createWindow(QWebPage::WebWindowType type) override; public slots: /** * Download a netwerk request * @param req The request */ void downloadRequested(const QNetworkRequest& req); private: QString home_page_html; QString home_page_base_url; WebViewClient* client; QUrl clicked_url; QUrl image_url; ProxyHelper* m_proxy; }; } #endif // KT_HOMEPAGE_H diff --git a/plugins/shutdown/shutdowndlg.h b/plugins/shutdown/shutdowndlg.h index c6cf95bd..00798f37 100644 --- a/plugins/shutdown/shutdowndlg.h +++ b/plugins/shutdown/shutdowndlg.h @@ -1,58 +1,58 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_SHUTDOWNDLG_H #define KT_SHUTDOWNDLG_H #include #include "ui_shutdowndlg.h" #include "shutdownruleset.h" namespace kt { class CoreInterface; class ShutdownTorrentModel; class ShutdownDlg : public QDialog, public Ui_ShutdownDlg { Q_OBJECT public: ShutdownDlg(ShutdownRuleSet* rules, CoreInterface* core, QWidget* parent); - ~ShutdownDlg(); + ~ShutdownDlg() override; void accept() override; void reject() override; private slots: void timeToExecuteChanged(int idx); private: Action indexToAction(int idx); int actionToIndex(Action act); private: ShutdownRuleSet* rules; ShutdownTorrentModel* model; }; } #endif // KT_SHUTDOWNDLG_H diff --git a/plugins/shutdown/shutdownplugin.h b/plugins/shutdown/shutdownplugin.h index 71c3835e..547d7660 100644 --- a/plugins/shutdown/shutdownplugin.h +++ b/plugins/shutdown/shutdownplugin.h @@ -1,62 +1,62 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_SHUTDOWNPLUGIN_H #define KT_SHUTDOWNPLUGIN_H #include class KToggleAction; namespace kt { class ShutdownRuleSet; class ShutdownPlugin : public kt::Plugin { Q_OBJECT public: ShutdownPlugin(QObject* parent, const QVariantList& args); - ~ShutdownPlugin(); + ~ShutdownPlugin() override; bool versionCheck(const QString& version) const override; void unload() override; void load() override; public slots: void shutdownComputer(); void lock(); void suspendToDisk(); void suspendToRam(); private slots: void shutdownToggled(bool on); void configureShutdown(); void updateAction(); private: KToggleAction* shutdown_enabled; QAction * configure_shutdown; ShutdownRuleSet* rules; }; } #endif // KT_SHUTDOWNPLUGIN_H diff --git a/plugins/shutdown/shutdownruleset.h b/plugins/shutdown/shutdownruleset.h index c830be30..1370bdf2 100644 --- a/plugins/shutdown/shutdownruleset.h +++ b/plugins/shutdown/shutdownruleset.h @@ -1,145 +1,145 @@ /*************************************************************************** * Copyright (C) 2009 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_SHUTDOWNRULESET_H #define KT_SHUTDOWNRULESET_H #include #include #include namespace kt { class QueueManager; enum Trigger { DOWNLOADING_COMPLETED = 0, SEEDING_COMPLETED }; enum Target { ALL_TORRENTS, SPECIFIC_TORRENT }; enum Action { SHUTDOWN, LOCK, SUSPEND_TO_DISK, SUSPEND_TO_RAM }; struct ShutdownRule { Trigger trigger; Target target; Action action; bt::TorrentInterface* tc; bool hit; bool downloadingFinished(bt::TorrentInterface* tor, QueueManager* qman); bool seedingFinished(bt::TorrentInterface* tor, QueueManager* qman); QString toolTip() const; }; /** Keeps track of all shutdown rules and monitors for events (torrent finished with seeding or downloading). When an event is received, it will determine the course of action. */ class ShutdownRuleSet : public QObject { Q_OBJECT public: ShutdownRuleSet(CoreInterface* core, QObject* parent); - ~ShutdownRuleSet(); + ~ShutdownRuleSet() override; /// Set if all rules must be hit, before actions are undertaken void setAllRulesMustBeHit(bool on) {all_rules_must_be_hit = on;} /// See if all rules must be hit, before actions are undertaken bool allRulesMustBeHit() const {return all_rules_must_be_hit;} /// Get the current action Action currentAction() const; /// Do we have a valid ruleset bool valid() const {return !rules.isEmpty();} /// Enable or disable the rules void setEnabled(bool on); /// Whether or not the rules are enabled bool enabled() const {return on;} /** Add a rule to the ruleset */ void addRule(Action action, Target target, Trigger trigger, bt::TorrentInterface* tc = 0); /** Clear all rules */ void clear(); /// Get the number of rules int count() const {return rules.count();} /// Get a rule const ShutdownRule& rule(int idx) const {return rules.at(idx);} /// Save the ruleset to a file void save(const QString& file); /// Load the ruleset from a file void load(const QString& file); /// Generate a tool tip for the current ruleset QString toolTip() const; signals: void shutdown(); void standby(); void lock(); void suspendToDisk(); void suspendToRAM(); private slots: void torrentFinished(bt::TorrentInterface* tc); void seedingAutoStopped(bt::TorrentInterface* tc, bt::AutoStopReason reason); void torrentAdded(bt::TorrentInterface* tc); void torrentRemoved(bt::TorrentInterface* tc); private: bt::TorrentInterface* torrentForHash(const QByteArray& hash); void triggered(Trigger trigger, bt::TorrentInterface* tc); private: QList rules; CoreInterface* core; bool on; bool all_rules_must_be_hit; }; } #endif // KT_SHUTDOWNRULESET_H diff --git a/plugins/shutdown/shutdowntorrentmodel.h b/plugins/shutdown/shutdowntorrentmodel.h index 21a73033..fff02361 100644 --- a/plugins/shutdown/shutdowntorrentmodel.h +++ b/plugins/shutdown/shutdowntorrentmodel.h @@ -1,95 +1,95 @@ /* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KT_SHUTDOWNTORRENTMODEL_H #define KT_SHUTDOWNTORRENTMODEL_H #include #include #include "shutdownruleset.h" namespace bt { class TorrentInterface; } namespace kt { class QueueManager; class CoreInterface; class ShutdownRuleSet; class ShutdownTorrentDelegate : public QStyledItemDelegate { Q_OBJECT public: ShutdownTorrentDelegate(QObject* parent = 0); - ~ShutdownTorrentDelegate(); + ~ShutdownTorrentDelegate() override; QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override; void setEditorData(QWidget* editor, const QModelIndex& index) const override; void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override; void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const override; QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override; }; class ShutdownTorrentModel : public QAbstractTableModel { Q_OBJECT public: ShutdownTorrentModel(CoreInterface* core, QObject* parent); - ~ShutdownTorrentModel(); + ~ShutdownTorrentModel() override; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; int columnCount(const QModelIndex& parent = QModelIndex()) const override; int rowCount(const QModelIndex& parent = QModelIndex()) const override; bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; bool insertRows(int row, int count, const QModelIndex& parent) override; bool removeRows(int row, int count, const QModelIndex& parent) override; Qt::ItemFlags flags(const QModelIndex& index) const override; /** Apply the current model to the rules */ void applyRules(Action action, ShutdownRuleSet* rules); /** Add an existing rule to the model */ void addRule(const ShutdownRule& rule); private slots: void torrentAdded(bt::TorrentInterface* tc); void torrentRemoved(bt::TorrentInterface* tc); private: struct TriggerItem { bt::TorrentInterface* tc; bool checked; Trigger trigger; }; QueueManager* qman; QList conds; }; } #endif // KT_SHUTDOWNTORRENTMODEL_H diff --git a/plugins/stats/ConnsTabPage.h b/plugins/stats/ConnsTabPage.h index 00b01e1d..877257c1 100644 --- a/plugins/stats/ConnsTabPage.h +++ b/plugins/stats/ConnsTabPage.h @@ -1,102 +1,102 @@ /*************************************************************************** * Copyright © 2007 by Krzysztof Kundzicz * * athantor@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef ConnsTabPage_H_ #define ConnsTabPage_H_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace kt { /** \brief Connections tab \author Krzysztof Kundzicz */ class ConnsTabPage : public PluginPage { Q_OBJECT private: ///Tab's UI Ui::ConnsWgt* pmConnsUi; ///Connections chart widget ChartDrawer* pmConnsChtWgt; ///DHT chart widget ChartDrawer* pmDhtChtWgt; /** \brief Leechers in swarms dataset UUID Used for identification whether this dataset is already shown on the chart and if it needs to be removed or added on settings chage */ const QUuid pmLhrSwnUuid; /** \brief Seeds in swarms dataset UUID Used for identification whether this dataset is already shown on the chart and if it needs to be removed or added on settings chage */ const QUuid pmSesSwnUuid; /** \brief Gathers data about connections \param pPlug kt::Plugin interface */ void GatherConnStats(Plugin* pPlug); /** \brief Gathers data about DHT */ void GatherDhtStats(); void setupUi() override; public: /** \brief Constructor \param p Parent */ ConnsTabPage(QWidget* p); ///Destructor - ~ConnsTabPage(); + ~ConnsTabPage() override; public slots: void applySettings() override; void updateAllCharts() override; void gatherData(Plugin*) override; void resetAvg(ChartDrawer*) override; }; } // ns end #endif diff --git a/plugins/stats/DisplaySettingsPage.h b/plugins/stats/DisplaySettingsPage.h index 44c09942..8f13ebe0 100644 --- a/plugins/stats/DisplaySettingsPage.h +++ b/plugins/stats/DisplaySettingsPage.h @@ -1,44 +1,44 @@ /*************************************************************************** * Copyright (C) 2007 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTDISPLAYSETTINGSPAGE_H #define KTDISPLAYSETTINGSPAGE_H #include #include "ui_DisplaySettings.h" namespace kt { /** @author */ class DisplaySettingsPage : public PrefPageInterface, public Ui_DisplaySettingsWgt { public: DisplaySettingsPage(QWidget* parent); - ~DisplaySettingsPage(); + ~DisplaySettingsPage() override; }; } #endif diff --git a/plugins/stats/PluginPage.h b/plugins/stats/PluginPage.h index 8ba95e38..1176ce3e 100644 --- a/plugins/stats/PluginPage.h +++ b/plugins/stats/PluginPage.h @@ -1,75 +1,75 @@ /*************************************************************************** * Copyright © 2007 by Krzysztof Kundzicz * * athantor@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef PluginPage_H_ #define PluginPage_H_ #include #include #include #include namespace kt { /** \brief Base class for plugin's tabs in the main UI \author Krzysztof Kundzicz */ class PluginPage : public QWidget { Q_OBJECT public: //sum , msmnts /** \brief Type used for computing average * * Layout: * - First: Sum of measurements * - Second: Amount */ typedef std::pair avg_t; /** \brief Constructor \param p Parent */ PluginPage(QWidget* p); ///Destructor - ~PluginPage(); + ~PluginPage() override; public slots: ///Applies settings virtual void applySettings() = 0; ///Updates all charts virtual void updateAllCharts() = 0; /** \brief Gathers data \param pP Plugin interface */ virtual void gatherData(Plugin* pP) = 0; ///Resets average virtual void resetAvg(ChartDrawer*) = 0; protected: ///Setups UI virtual void setupUi() = 0; }; } // ns end #endif diff --git a/plugins/stats/SettingsPage.h b/plugins/stats/SettingsPage.h index fbccf46c..dc498814 100644 --- a/plugins/stats/SettingsPage.h +++ b/plugins/stats/SettingsPage.h @@ -1,70 +1,70 @@ /*************************************************************************** * Copyright © 2007 by Krzysztof Kundzicz * * athantor@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef SettingsPage_H_ #define SettingsPage_H_ #include #include #include #include #include #include #include namespace kt { /** \brief Settings page \author Krzysztof Kundzicz */ class SettingsPage : public PrefPageInterface, public Ui_StatsSettingsWgt { Q_OBJECT public: /** \brief Constructor \param p Parent */ SettingsPage(QWidget* p); ///Destructor - ~SettingsPage(); + ~SettingsPage() override; public slots: void updateSettings() override; private slots: void UpdGuiUpdatesToMs(int); signals: ///Settings has been applied void Applied(); }; } //ns end #endif diff --git a/plugins/stats/SpdTabPage.h b/plugins/stats/SpdTabPage.h index bdc41453..75237a25 100644 --- a/plugins/stats/SpdTabPage.h +++ b/plugins/stats/SpdTabPage.h @@ -1,110 +1,110 @@ /*************************************************************************** * Copyright © 2007 by Krzysztof Kundzicz * * athantor@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef SpdTabPage_H_ #define SpdTabPage_H_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace kt { /** \brief Speeds tab \author Krzysztof Kundzicz */ class SpdTabPage : public PluginPage { Q_OBJECT public: /** \brief Constructor \param p Parent */ SpdTabPage(QWidget* p); ///Destructor - ~SpdTabPage(); + ~SpdTabPage() override; public slots: void applySettings() override; void updateAllCharts() override; void gatherData(Plugin*) override; void resetAvg(ChartDrawer*) override; private: /** \brief Gathers dl speeds data \ param pP kt::Plugin interfac*e * */ void gatherDownloadSpeed(Plugin* pP); /** \brief Gathers peers speeds data \ param pP kt::Plugin interfac*e * */ void gatherPeersSpeed(Plugin* pP); /** \brief Gathers Ul speeds data \ param pP kt::Plugin interfac*e * */ void gatherUploadSpeed(Plugin* pP); void setupUi() override; private: ///Page's UI Ui::SpdWgt* pmUiSpd; ///Dl speeds chart widget ChartDrawer* pmDlChtWgt; ///Peers speeds chart widget ChartDrawer* pmPeersChtWgt; ///Ul speeds chart widget ChartDrawer* pmUlChtWgt; ///Dl average avg_t mDlAvg; ///Ul average avg_t mUlAvg; }; } //ns end #endif diff --git a/plugins/stats/StatsPlugin.h b/plugins/stats/StatsPlugin.h index 9719af26..f62129c7 100644 --- a/plugins/stats/StatsPlugin.h +++ b/plugins/stats/StatsPlugin.h @@ -1,88 +1,88 @@ /*************************************************************************** * Copyright © 2007 by Krzysztof Kundzicz * * athantor@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef StatsPlugin_H_ #define StatsPlugin_H_ #include #include #include #include #include #include #include #include #include #include #include #include namespace kt { /** \brief Statistics plugin \author Krzysztof Kundzicz \version 1.1 */ class StatsPlugin : public Plugin { Q_OBJECT public: /** \brief Constructor \param p Parent */ StatsPlugin(QObject* p, const QVariantList&); ///Destructor - ~StatsPlugin(); + ~StatsPlugin() override; void load() override; void unload() override; bool versionCheck(const QString& version) const override; void guiUpdate() override; public slots: ///Gather data void gatherData(); ///Settings has been changed void settingsChanged(); private: ///Speeds tab SpdTabPage* pmUiSpd; ///Connections tab ConnsTabPage* pmUiConns; ///Settings Page SettingsPage* pmUiSett; /// Display settings page DisplaySettingsPage* pmDispSett; ///Timer QTimer pmTmr; ///Updates counter uint32_t mUpdCtr; }; } //ns end #endif diff --git a/plugins/stats/drawer/PlainChartDrawer.h b/plugins/stats/drawer/PlainChartDrawer.h index d7eca8d2..cf899d09 100644 --- a/plugins/stats/drawer/PlainChartDrawer.h +++ b/plugins/stats/drawer/PlainChartDrawer.h @@ -1,156 +1,156 @@ /*************************************************************************** * Copyright © 2007 by Krzysztof Kundzicz * * athantor@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef PlainChartDrawer_H_ #define PlainChartDrawer_H_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace kt { /** \brief Basic chart drawer widget \author Krzysztof Kundzicz */ class PlainChartDrawer : public QFrame, public ChartDrawer { Q_OBJECT private: ///Pointer to context menu QMenu* pmCtxMenu; ///Height of the chart area ( \b not widget height!) inline wgtunit_t height() const; ///Width of the chart area ( \b not widget width!) inline wgtunit_t width() const; /// Translates coords inline wgtunit_t TY(const wgtunit_t) const; /** \brief Translates chart X coord to screen coord \param xcc X chart coord \return Screen X coord */ inline wgtunit_t FindXScreenCoords(const wgtunit_t xcc) const; /** \brief Translates chart Y coord to screen coord \param ycc Y chart coord \return Screen Y coord */ inline wgtunit_t FindYScreenCoords(const wgtunit_t ycc) const; ///Makes a context menu for widget void MakeCtxMenu(); /** \brief Draws chart's scale \param rPnt Painter object */ void DrawScale(QPainter& rPnt); /** \brief Draws chart's frame \param rPnt Painter object */ void DrawFrame(QPainter& rPnt); /** \brief Draws chart \param rPnt Painter object */ void DrawChart(QPainter& rPnt); /** \brief Draws chart's lines \param rPnt Painter object \param rCdd Dataset to draw */ void DrawChartLine(QPainter& rPnt, const ChartDrawerData& rCdd); /** \brief Draws current values of the sets \param rPnt Painter object \param rCdd Dataset to draw \param idx Set's index */ void DrawCurrentValue(QPainter& rPnt, const ChartDrawerData& rCdd, size_t idx); /** \brief Marks maximum values \param rPnt Painter object \param rCdd Dataset to draw \param idx Set's index */ void DrawMaximum(QPainter& rPnt, const ChartDrawerData& rCdd, size_t idx); public: /** \brief Constructor \param p Parent */ PlainChartDrawer(QWidget* p = 0); ///Destructor - ~PlainChartDrawer(); + ~PlainChartDrawer() override; /** \brief Widget's paint event \param pPevt Event */ void paintEvent(QPaintEvent* pPevt) override; public slots: void showContextMenu(const QPoint& rP) override; void renderToImage() override; void addValue(const size_t idx, const wgtunit_t val, const bool upd = false) override; void addDataSet(ChartDrawerData Cdd) override; void insertDataSet(const size_t idx, ChartDrawerData Cdd) override; void removeDataSet(const size_t idx) override; void zero(const size_t idx) override; void zeroAll() override; void setUnitName (const QString& rN) override {pmUnitName = rN;} void setPen(const size_t idx, const QPen& rP) override; void setXMax(const wgtunit_t x) override; void setYMax(const wgtunit_t y) override; void findSetMax() override; void setUuid(const size_t idx, const QUuid& rQ) override; int16_t findUuidInSet(const QUuid& rQ) const override; void setMaxMode(const MaxMode mm) override; QUuid getUuid(const size_t idx) const override; QString makeLegendString() override; void setLegend(const QString& rL) override; void update() override; void enableAntiAlias(bool aa) override; void enableBackgroundGrid(bool bg) override; signals: void Zeroed(ChartDrawer*); }; } //ns end #endif diff --git a/plugins/upnp/routermodel.cpp b/plugins/upnp/routermodel.cpp index 464e2f14..60c9ab25 100644 --- a/plugins/upnp/routermodel.cpp +++ b/plugins/upnp/routermodel.cpp @@ -1,207 +1,207 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include #include #include #include #include #include "routermodel.h" using namespace bt; namespace kt { RouterModel::RouterModel(QObject* parent) : QAbstractTableModel(parent) { } RouterModel::~RouterModel() { } void RouterModel::addRouter(bt::UPnPRouter* r) { routers.append(r); insertRow(routers.count() - 1); } int RouterModel::rowCount(const QModelIndex& parent) const { if (!parent.isValid()) return routers.count(); else return 0; } int RouterModel::columnCount(const QModelIndex& parent) const { if (!parent.isValid()) return 2; else return 0; } QVariant RouterModel::headerData(int section, Qt::Orientation orientation, int role) const { if (role != Qt::DisplayRole || orientation != Qt::Horizontal) return QVariant(); switch (section) { case 0: return i18n("Device"); case 1: return i18n("Ports Forwarded"); default: return QVariant(); } } bt::UPnPRouter* RouterModel::routerForIndex(const QModelIndex& index) { if (!index.isValid()) return 0; else return routers.at(index.row()); } QVariant RouterModel::data(const QModelIndex& index, int role) const { if (!index.isValid()) return QVariant(); const bt::UPnPRouter* r = routers.at(index.row()); if (role == Qt::DisplayRole) { switch (index.column()) { case 0: return r->getDescription().friendlyName; case 1: if (!r->getError().isEmpty()) return r->getError(); else return ports(r); } } else if (role == Qt::DecorationRole) { if (index.column() == 0) return QIcon::fromTheme(QStringLiteral("modem")); else if (index.column() == 1 && !r->getError().isEmpty()) return QIcon::fromTheme(QStringLiteral("dialog-error")); } else if (role == Qt::ToolTipRole) { if (index.column() == 0) { const bt::UPnPDeviceDescription& d = r->getDescription(); return i18n( "Model Name: %1
" "Manufacturer: %2
" "Model Description: %3
", d.modelName, d.manufacturer, d.modelDescription); } else if (index.column() == 1 && !r->getError().isEmpty()) return r->getError(); } return QVariant(); } bool RouterModel::removeRows(int row, int count, const QModelIndex& parent) { Q_UNUSED(parent); beginRemoveRows(QModelIndex(), row, row + count - 1); endRemoveRows(); return true; } bool RouterModel::insertRows(int row, int count, const QModelIndex& parent) { Q_UNUSED(parent); beginInsertRows(QModelIndex(), row, row + count - 1); endInsertRows(); return true; } class PortsVisitor : public bt::UPnPRouter::Visitor { public: - ~PortsVisitor() {} + ~PortsVisitor() override {} void forwarding(const net::Port& port, bool pending, const bt::UPnPService* service) override { Q_UNUSED(service); if (!pending) { QString ret = QString::number(port.number) + QStringLiteral(" ("); QString prot = (port.proto == net::UDP ? QStringLiteral("UDP") : QStringLiteral("TCP")); ret += prot + QStringLiteral(")"); ports.append(ret); } } QString result() { return ports.join(QStringLiteral(", ")); } QStringList ports; }; QString RouterModel::ports(const bt::UPnPRouter* r) const { PortsVisitor pv; r->visit(&pv); return pv.result(); } void RouterModel::update() { emit dataChanged(index(0, 0), index(rowCount(QModelIndex()) - 1, columnCount(QModelIndex()) - 1)); } void RouterModel::forward(const net::Port& port) { try { for (bt::UPnPRouter* r : qAsConst(routers)) r->forward(port); } catch (bt::Error& e) { Out(SYS_PNP | LOG_DEBUG) << "Error : " << e.toString() << endl; } } void RouterModel::undoForward(const net::Port& port, bt::WaitJob* wjob) { try { for (bt::UPnPRouter* r : qAsConst(routers)) r->undoForward(port, wjob); } catch (Error& e) { Out(SYS_PNP | LOG_DEBUG) << "Error : " << e.toString() << endl; } } } diff --git a/plugins/upnp/routermodel.h b/plugins/upnp/routermodel.h index b84d3b03..e82b6428 100644 --- a/plugins/upnp/routermodel.h +++ b/plugins/upnp/routermodel.h @@ -1,81 +1,81 @@ /*************************************************************************** * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * * joris.guisson@gmail.com * * ivasic@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTROUTERMODEL_H #define KTROUTERMODEL_H #include namespace bt { class UPnPRouter; class WaitJob; } namespace net { struct Port; } namespace kt { /** Model for all the detected UPnP routers. */ class RouterModel : public QAbstractTableModel { Q_OBJECT public: RouterModel(QObject* parent); - ~RouterModel(); + ~RouterModel() override; /// Add a router tot the model void addRouter(bt::UPnPRouter* r); /// Get a router given an index bt::UPnPRouter* routerForIndex(const QModelIndex& index); int rowCount(const QModelIndex& parent) const override; int columnCount(const QModelIndex& parent) const override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; QVariant data(const QModelIndex& index, int role) const override; bool removeRows(int row, int count, const QModelIndex& parent) override; bool insertRows(int row, int count, const QModelIndex& parent) override; void update(); /// Forward a ports on all routers void forward(const net::Port& port); /// Undo forward a ports on all routers void undoForward(const net::Port& port, bt::WaitJob* wjob); private: QString ports(const bt::UPnPRouter* r) const; private: QList routers; }; } #endif diff --git a/plugins/upnp/upnpplugin.h b/plugins/upnp/upnpplugin.h index eec8c81b..694d81e0 100644 --- a/plugins/upnp/upnpplugin.h +++ b/plugins/upnp/upnpplugin.h @@ -1,56 +1,56 @@ /*************************************************************************** * Copyright (C) 2005-2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTSEARCHPLUGIN_H #define KTSEARCHPLUGIN_H #include namespace bt { class UPnPMCastSocket; } namespace kt { class UPnPWidget; /** @author Joris Guisson */ class UPnPPlugin : public Plugin { Q_OBJECT public: UPnPPlugin(QObject* parent, const QVariantList& args); - ~UPnPPlugin(); + ~UPnPPlugin() override; void load() override; void unload() override; void shutdown(bt::WaitJob* job) override; bool versionCheck(const QString& version) const override; private: bt::UPnPMCastSocket* sock; UPnPWidget* upnp_tab; }; } #endif diff --git a/plugins/upnp/upnpwidget.h b/plugins/upnp/upnpwidget.h index 29675664..b6026f84 100644 --- a/plugins/upnp/upnpwidget.h +++ b/plugins/upnp/upnpwidget.h @@ -1,78 +1,78 @@ /*************************************************************************** * Copyright (C) 2005-2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTUPNPPREFPAGE_H #define KTUPNPPREFPAGE_H #include #include #include "ui_upnpwidget.h" namespace bt { class WaitJob; class UPnPRouter; class UPnPMCastSocket; } namespace kt { class RouterModel; /** * @author Joris Guisson * * Page in the preference dialog for the UPnP plugin. */ class UPnPWidget : public QWidget, public Ui_UPnPWidget, public net::PortListener { Q_OBJECT public: UPnPWidget(bt::UPnPMCastSocket* sock, QWidget* parent); - ~UPnPWidget(); + ~UPnPWidget() override; void shutdown(bt::WaitJob* job); public slots: /** * Add a device to the list. * @param r The device */ void addDevice(bt::UPnPRouter* r); protected slots: void onForwardBtnClicked(); void onUndoForwardBtnClicked(); void onRescanClicked(); void updatePortMappings(); void onCurrentDeviceChanged(const QModelIndex& current, const QModelIndex& previous); private: void portAdded(const net::Port& port) override; void portRemoved(const net::Port& port) override; private: bt::UPnPMCastSocket* sock; RouterModel* model; }; } #endif diff --git a/plugins/zeroconf/torrentservice.h b/plugins/zeroconf/torrentservice.h index e42a11fe..23996646 100644 --- a/plugins/zeroconf/torrentservice.h +++ b/plugins/zeroconf/torrentservice.h @@ -1,66 +1,66 @@ /*************************************************************************** * Copyright (C) 2005-2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KT_TORRENTSERVICE_HH #define KT_TORRENTSERVICE_HH #include #include #include #include namespace bt { class TorrentInterface; } namespace kt { /** * Zeroconf service which publishes a torrent * */ class TorrentService : public bt::PeerSource { Q_OBJECT public: TorrentService(bt::TorrentInterface* tc); - ~TorrentService(); + ~TorrentService() override; void stop(bt::WaitJob* wjob = 0) override; void start() override; void aboutToBeDestroyed() override; signals: void serviceDestroyed(TorrentService* av); public slots: void onPublished(bool ok); void onServiceAdded(KDNSSD::RemoteService::Ptr ptr); void hostResolved(net::AddressResolver* ar); private: bt::TorrentInterface* tc; KDNSSD::PublicService* srv; KDNSSD::ServiceBrowser* browser; }; } #endif diff --git a/plugins/zeroconf/zeroconfplugin.h b/plugins/zeroconf/zeroconfplugin.h index e594623a..92982e30 100644 --- a/plugins/zeroconf/zeroconfplugin.h +++ b/plugins/zeroconf/zeroconfplugin.h @@ -1,73 +1,73 @@ /*************************************************************************** * Copyright (C) 2005-2007 by Joris Guisson * * joris.guisson@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef KTZEROCONFPLUGIN_H #define KTZEROCONFPLUGIN_H #include #include #include #include namespace kt { class TorrentService; /** * @author Joris Guisson * * Plugin which handles the zeroconf service. */ class ZeroConfPlugin : public Plugin { Q_OBJECT public: ZeroConfPlugin(QObject* parent, const QVariantList& args); - ~ZeroConfPlugin(); + ~ZeroConfPlugin() override; void load() override; void unload() override; bool versionCheck(const QString& version) const override; private slots: /** * A TorrentInterface was added * @param tc */ void torrentAdded(bt::TorrentInterface* tc); /** * A TorrentInterface was removed * @param tc */ void torrentRemoved(bt::TorrentInterface* tc); /** * An AvahiService has been destroyed by the psman */ void avahiServiceDestroyed(TorrentService* av); private: bt::PtrMap services; }; } #endif