From 19db0d471f7bc389f2038c71a07a105a18fbcd16 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Wed, 24 Nov 2010 20:31:14 +0000 Subject: [PATCH] Signal / slot fixes --- src/mainwindow.cpp | 18 +++++++++--------- src/mainwindow.h | 8 ++++---- src/properties/propertieswidget.cpp | 12 ++++++------ src/properties/propertieswidget.h | 6 +++--- src/qtlibtorrent/qbtsession.cpp | 7 ++++--- src/qtlibtorrent/qbtsession.h | 24 ++++++++++++------------ src/qtlibtorrent/qtorrenthandle.cpp | 20 ++++++++++---------- src/qtlibtorrent/qtorrenthandle.h | 20 ++++++++++---------- src/qtlibtorrent/torrentmodel.cpp | 12 ++++++------ src/qtlibtorrent/torrentmodel.h | 2 +- src/transferlistwidget.h | 2 +- src/webui/eventmanager.cpp | 4 ++-- src/webui/eventmanager.h | 4 ++-- src/webui/httpserver.cpp | 2 +- 14 files changed, 71 insertions(+), 70 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 81403ed53..54b2466ac 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -134,13 +134,13 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo toolBar->layout()->setSpacing(7); // Creating Bittorrent session BTSession = QBtSession::instance(); - connect(BTSession, SIGNAL(fullDiskError(QTorrentHandle&, QString)), this, SLOT(fullDiskError(QTorrentHandle&, QString))); - connect(BTSession, SIGNAL(finishedTorrent(QTorrentHandle&)), this, SLOT(finishedTorrent(QTorrentHandle&))); - connect(BTSession, SIGNAL(trackerAuthenticationRequired(QTorrentHandle&)), this, SLOT(trackerAuthenticationRequired(QTorrentHandle&))); + connect(BTSession, SIGNAL(fullDiskError(QTorrentHandle, QString)), this, SLOT(fullDiskError(QTorrentHandle, QString))); + connect(BTSession, SIGNAL(finishedTorrent(QTorrentHandle)), this, SLOT(finishedTorrent(QTorrentHandle))); + connect(BTSession, SIGNAL(trackerAuthenticationRequired(QTorrentHandle)), this, SLOT(trackerAuthenticationRequired(QTorrentHandle))); connect(BTSession, SIGNAL(newDownloadedTorrent(QString, QString)), this, SLOT(processDownloadedFiles(QString, QString))); connect(BTSession, SIGNAL(downloadFromUrlFailure(QString, QString)), this, SLOT(handleDownloadFromUrlFailure(QString, QString))); connect(BTSession, SIGNAL(alternativeSpeedsModeChanged(bool)), this, SLOT(updateAltSpeedsBtn(bool))); - connect(BTSession, SIGNAL(recursiveTorrentDownloadPossible(QTorrentHandle&)), this, SLOT(askRecursiveTorrentDownloadConfirmation(QTorrentHandle&))); + connect(BTSession, SIGNAL(recursiveTorrentDownloadPossible(QTorrentHandle)), this, SLOT(askRecursiveTorrentDownloadConfirmation(QTorrentHandle))); #ifdef Q_WS_MAC connect(static_cast(qApp), SIGNAL(newFileOpenMacEvent(QString)), this, SLOT(processParams(QString))); #endif @@ -448,13 +448,13 @@ void MainWindow::writeSettings() { } // called when a torrent has finished -void MainWindow::finishedTorrent(QTorrentHandle& h) const { +void MainWindow::finishedTorrent(const QTorrentHandle& h) const { if(!TorrentPersistentData::isSeed(h.hash())) showNotificationBaloon(tr("Download completion"), tr("%1 has finished downloading.", "e.g: xxx.avi has finished downloading.").arg(h.name())); } // Notification when disk is full -void MainWindow::fullDiskError(QTorrentHandle& h, QString msg) const { +void MainWindow::fullDiskError(const QTorrentHandle& h, QString msg) const { if(!h.is_valid()) return; showNotificationBaloon(tr("I/O Error", "i.e: Input/Output Error"), tr("An I/O error occured for torrent %1.\n Reason: %2", "e.g: An error occured for torrent xxx.avi.\n Reason: disk is full.").arg(h.name()).arg(msg)); } @@ -529,7 +529,7 @@ void MainWindow::balloonClicked() { } } -void MainWindow::askRecursiveTorrentDownloadConfirmation(QTorrentHandle &h) { +void MainWindow::askRecursiveTorrentDownloadConfirmation(const QTorrentHandle &h) { Preferences pref; if(pref.recursiveDownloadDisabled()) return; QMessageBox confirmBox(QMessageBox::Question, tr("Recursive download confirmation"), tr("The torrent %1 contains torrent files, do you want to proceed with their download?").arg(h.name())); @@ -1005,7 +1005,7 @@ void MainWindow::addUnauthenticatedTracker(const QPair & } // Called when a tracker requires authentication -void MainWindow::trackerAuthenticationRequired(QTorrentHandle& h) { +void MainWindow::trackerAuthenticationRequired(const QTorrentHandle& h) { if(unauthenticated_trackers.indexOf(QPair(h, h.current_tracker())) < 0) { // Tracker login new trackerLogin(this, h); @@ -1223,7 +1223,7 @@ void MainWindow::on_action_Import_Torrent_triggered() void MainWindow::on_actionDownload_from_URL_triggered() { if(!downloadFromURLDialog) { downloadFromURLDialog = new downloadFromURL(this); - connect(downloadFromURLDialog, SIGNAL(urlsReadyToBeDownloaded(const QStringList&)), this, SLOT(downloadFromURLList(const QStringList&))); + connect(downloadFromURLDialog, SIGNAL(urlsReadyToBeDownloaded(QStringList)), this, SLOT(downloadFromURLList(QStringList))); } } diff --git a/src/mainwindow.h b/src/mainwindow.h index ced89b0c4..f349faf81 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -74,7 +74,7 @@ public: PropertiesWidget *getProperties() const { return properties; } public slots: - void trackerAuthenticationRequired(QTorrentHandle& h); + void trackerAuthenticationRequired(const QTorrentHandle& h); void setTabText(int index, QString text) const; void showNotificationBaloon(QString title, QString msg) const; void downloadFromURLList(const QStringList& urls); @@ -97,7 +97,7 @@ protected slots: void readSettings(); void on_actionExit_triggered(); void createTrayIcon(); - void fullDiskError(QTorrentHandle& h, QString msg) const; + void fullDiskError(const QTorrentHandle& h, QString msg) const; void handleDownloadFromUrlFailure(QString, QString) const; void createSystrayDelayed(); void tab_changed(int); @@ -123,8 +123,8 @@ protected slots: void addTorrent(QString path); void addUnauthenticatedTracker(const QPair &tracker); void processDownloadedFiles(QString path, QString url); - void finishedTorrent(QTorrentHandle& h) const; - void askRecursiveTorrentDownloadConfirmation(QTorrentHandle &h); + void finishedTorrent(const QTorrentHandle& h) const; + void askRecursiveTorrentDownloadConfirmation(const QTorrentHandle &h); // Options slots void on_actionOptions_triggered(); void optionsSaved(); diff --git a/src/properties/propertieswidget.cpp b/src/properties/propertieswidget.cpp index 4c3bb50b6..9fc8844bb 100644 --- a/src/properties/propertieswidget.cpp +++ b/src/properties/propertieswidget.cpp @@ -79,11 +79,11 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow* main_window, Tra connect(PropListModel, SIGNAL(filteredFilesChanged()), this, SLOT(filteredFilesChanged())); connect(addWS_button, SIGNAL(clicked()), this, SLOT(askWebSeed())); connect(deleteWS_button, SIGNAL(clicked()), this, SLOT(deleteSelectedUrlSeeds())); - connect(transferList, SIGNAL(currentTorrentChanged(QTorrentHandle&)), this, SLOT(loadTorrentInfos(QTorrentHandle &))); + connect(transferList, SIGNAL(currentTorrentChanged(QTorrentHandle)), this, SLOT(loadTorrentInfos(QTorrentHandle))); connect(PropDelegate, SIGNAL(filteredFilesChanged()), this, SLOT(filteredFilesChanged())); connect(stackedProperties, SIGNAL(currentChanged(int)), this, SLOT(loadDynamicData())); - connect(QBtSession::instance(), SIGNAL(savePathChanged(QTorrentHandle&)), this, SLOT(updateSavePath(QTorrentHandle&))); - connect(QBtSession::instance(), SIGNAL(metadataReceived(QTorrentHandle&)), this, SLOT(updateTorrentInfos(QTorrentHandle&))); + connect(QBtSession::instance(), SIGNAL(savePathChanged(QTorrentHandle)), this, SLOT(updateSavePath(QTorrentHandle))); + connect(QBtSession::instance(), SIGNAL(metadataReceived(QTorrentHandle)), this, SLOT(updateTorrentInfos(QTorrentHandle))); // Downloaded pieces progress bar downloaded_pieces = new DownloadedPiecesBar(this); @@ -199,7 +199,7 @@ QTorrentHandle PropertiesWidget::getCurrentTorrent() const { return h; } -void PropertiesWidget::updateSavePath(QTorrentHandle& _h) { +void PropertiesWidget::updateSavePath(const QTorrentHandle& _h) { if(h.is_valid() && h == _h) { QString p; if(h.has_metadata() && h.num_files() == 1) { @@ -216,13 +216,13 @@ void PropertiesWidget::updateSavePath(QTorrentHandle& _h) { } } -void PropertiesWidget::updateTorrentInfos(QTorrentHandle& _h) { +void PropertiesWidget::updateTorrentInfos(const QTorrentHandle& _h) { if(h.is_valid() && h == _h) { loadTorrentInfos(h); } } -void PropertiesWidget::loadTorrentInfos(QTorrentHandle &_h) { +void PropertiesWidget::loadTorrentInfos(const QTorrentHandle &_h) { clear(); h = _h; if(!h.is_valid()) { diff --git a/src/properties/propertieswidget.h b/src/properties/propertieswidget.h index e75fdecb1..77bea30d3 100644 --- a/src/properties/propertieswidget.h +++ b/src/properties/propertieswidget.h @@ -69,8 +69,8 @@ protected: bool applyPriorities(); protected slots: - void loadTorrentInfos(QTorrentHandle &h); - void updateTorrentInfos(QTorrentHandle &h); + void loadTorrentInfos(const QTorrentHandle &h); + void updateTorrentInfos(const QTorrentHandle &h); void loadUrlSeeds(); void askWebSeed(); void deleteSelectedUrlSeeds(); @@ -91,7 +91,7 @@ public slots: void saveSettings(); void reloadPreferences(); void openDoubleClickedFile(QModelIndex); - void updateSavePath(QTorrentHandle& h); + void updateSavePath(const QTorrentHandle& h); private: TransferListWidget *transferList; diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index 03cf79b22..565be74a7 100644 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -409,6 +409,7 @@ void QBtSession::configureSession() { sessionSettings.outgoing_ports = std::make_pair(pref.outgoingPortsMin(), pref.outgoingPortsMax()); setSessionSettings(sessionSettings); // Ignore limits on LAN + qDebug() << "Ignore limits on LAN" << pref.ignoreLimitsOnLAN(); sessionSettings.ignore_limits_on_local_network = pref.ignoreLimitsOnLAN(); // Include overhead in transfer limits sessionSettings.rate_limit_ip_overhead = pref.includeOverheadInLimits(); @@ -1645,7 +1646,7 @@ void QBtSession::setDefaultTempPath(QString temppath) { } #if LIBTORRENT_VERSION_MINOR > 14 -void QBtSession::appendqBextensionToTorrent(QTorrentHandle &h, bool append) { +void QBtSession::appendqBextensionToTorrent(const QTorrentHandle &h, bool append) { if(!h.is_valid() || !h.has_metadata()) return; std::vector fp; h.file_progress(fp); @@ -1673,7 +1674,7 @@ void QBtSession::appendqBextensionToTorrent(QTorrentHandle &h, bool append) { } #endif -void QBtSession::changeLabelInTorrentSavePath(QTorrentHandle &h, QString old_label, QString new_label) { +void QBtSession::changeLabelInTorrentSavePath(const QTorrentHandle &h, QString old_label, QString new_label) { if(!h.is_valid()) return; if(!appendLabelToSavePath) return; QString old_save_path = TorrentPersistentData::getSavePath(h.hash()); @@ -1687,7 +1688,7 @@ void QBtSession::changeLabelInTorrentSavePath(QTorrentHandle &h, QString old_lab } } -void QBtSession::appendLabelToTorrentSavePath(QTorrentHandle& h) { +void QBtSession::appendLabelToTorrentSavePath(const QTorrentHandle& h) { if(!h.is_valid()) return; const QString label = TorrentPersistentData::getLabel(h.hash()); if(label.isEmpty()) return; diff --git a/src/qtlibtorrent/qbtsession.h b/src/qtlibtorrent/qbtsession.h index 21614b450..ffbcc8db0 100644 --- a/src/qtlibtorrent/qbtsession.h +++ b/src/qtlibtorrent/qbtsession.h @@ -135,10 +135,10 @@ public slots: void startTorrentsInPause(bool b); void setDefaultTempPath(QString temppath); void setAppendLabelToSavePath(bool append); - void appendLabelToTorrentSavePath(QTorrentHandle &h); - void changeLabelInTorrentSavePath(QTorrentHandle &h, QString old_label, QString new_label); + void appendLabelToTorrentSavePath(const QTorrentHandle &h); + void changeLabelInTorrentSavePath(const QTorrentHandle &h, QString old_label, QString new_label); #if LIBTORRENT_VERSION_MINOR > 14 - void appendqBextensionToTorrent(QTorrentHandle &h, bool append); + void appendqBextensionToTorrent(const QTorrentHandle &h, bool append); void setAppendqBExtension(bool append); #endif void applyEncryptionSettings(libtorrent::pe_settings se); @@ -186,21 +186,21 @@ signals: void addedTorrent(const QTorrentHandle& h); void deletedTorrent(QString hash); void torrentAboutToBeRemoved(const QTorrentHandle &h); - void pausedTorrent(QTorrentHandle& h); - void resumedTorrent(QTorrentHandle& h); - void finishedTorrent(QTorrentHandle& h); - void fullDiskError(QTorrentHandle& h, QString msg); + void pausedTorrent(const QTorrentHandle& h); + void resumedTorrent(const QTorrentHandle& h); + void finishedTorrent(const QTorrentHandle& h); + void fullDiskError(const QTorrentHandle& h, QString msg); void trackerError(QString hash, QString time, QString msg); - void trackerAuthenticationRequired(QTorrentHandle& h); + void trackerAuthenticationRequired(const QTorrentHandle& h); void newDownloadedTorrent(QString path, QString url); void updateFileSize(QString hash); void downloadFromUrlFailure(QString url, QString reason); - void torrentFinishedChecking(QTorrentHandle& h); - void metadataReceived(QTorrentHandle &h); - void savePathChanged(QTorrentHandle &h); + void torrentFinishedChecking(const QTorrentHandle& h); + void metadataReceived(const QTorrentHandle &h); + void savePathChanged(const QTorrentHandle &h); void newConsoleMessage(QString msg); void alternativeSpeedsModeChanged(bool alternative); - void recursiveTorrentDownloadPossible(QTorrentHandle &h); + void recursiveTorrentDownloadPossible(const QTorrentHandle &h); private: #if LIBTORRENT_VERSION_MINOR < 15 diff --git a/src/qtlibtorrent/qtorrenthandle.cpp b/src/qtlibtorrent/qtorrenthandle.cpp index 9488eaccd..38b16b02f 100644 --- a/src/qtlibtorrent/qtorrenthandle.cpp +++ b/src/qtlibtorrent/qtorrenthandle.cpp @@ -381,13 +381,13 @@ void QTorrentHandle::downloading_pieces(bitfield &bf) const { // Setters // -void QTorrentHandle::pause() { +void QTorrentHandle::pause() const { torrent_handle::auto_managed(false); torrent_handle::pause(); torrent_handle::save_resume_data(); } -void QTorrentHandle::resume() { +void QTorrentHandle::resume() const { if(has_error()) torrent_handle::clear_error(); const QString torrent_hash = hash(); bool has_persistant_error = TorrentPersistentData::hasError(torrent_hash); @@ -409,17 +409,17 @@ void QTorrentHandle::resume() { } } -void QTorrentHandle::remove_url_seed(QString seed) { +void QTorrentHandle::remove_url_seed(QString seed) const { torrent_handle::remove_url_seed(seed.toStdString()); } -void QTorrentHandle::add_url_seed(QString seed) { +void QTorrentHandle::add_url_seed(QString seed) const { const std::string str_seed = seed.toStdString(); qDebug("calling torrent_handle::add_url_seed(%s)", str_seed.c_str()); torrent_handle::add_url_seed(str_seed); } -void QTorrentHandle::prioritize_files(const std::vector &v) { +void QTorrentHandle::prioritize_files(const std::vector &v) const { // Does not do anything for seeding torrents if(v.size() != (unsigned int)torrent_handle::get_torrent_info().num_files()) return; @@ -458,7 +458,7 @@ void QTorrentHandle::file_priority(int index, int priority) const { } } -void QTorrentHandle::set_tracker_login(QString username, QString password) { +void QTorrentHandle::set_tracker_login(QString username, QString password) const { torrent_handle::set_tracker_login(std::string(username.toLocal8Bit().constData()), std::string(password.toLocal8Bit().constData())); } @@ -472,7 +472,7 @@ void QTorrentHandle::move_storage(QString new_path) const { torrent_handle::move_storage(new_path.toLocal8Bit().constData()); } -bool QTorrentHandle::save_torrent_file(QString path) { +bool QTorrentHandle::save_torrent_file(QString path) const { if(!torrent_handle::has_metadata()) return false; QFile met_file(path); if(met_file.open(QIODevice::WriteOnly)) { @@ -489,7 +489,7 @@ bool QTorrentHandle::save_torrent_file(QString path) { return false; } -void QTorrentHandle::add_tracker(const announce_entry& url) { +void QTorrentHandle::add_tracker(const announce_entry& url) const { #if LIBTORRENT_VERSION_MINOR > 14 torrent_handle::add_tracker(url); #else @@ -510,7 +510,7 @@ void QTorrentHandle::add_tracker(const announce_entry& url) { #endif } -void QTorrentHandle::prioritize_first_last_piece(bool b) { +void QTorrentHandle::prioritize_first_last_piece(bool b) const { // Detect main file int rank=0; int main_file_index = 0; @@ -543,7 +543,7 @@ void QTorrentHandle::prioritize_first_last_piece(bool b) { torrent_handle::piece_priority(last_piece, prio); } -void QTorrentHandle::rename_file(int index, QString name) { +void QTorrentHandle::rename_file(int index, QString name) const { torrent_handle::rename_file(index, std::string(name.toUtf8().constData())); } diff --git a/src/qtlibtorrent/qtorrenthandle.h b/src/qtlibtorrent/qtorrenthandle.h index c9ad52b6b..1d079fe07 100644 --- a/src/qtlibtorrent/qtorrenthandle.h +++ b/src/qtlibtorrent/qtorrenthandle.h @@ -115,18 +115,18 @@ class QTorrentHandle : public libtorrent::torrent_handle { // // Setters // - void pause(); - void resume(); - void remove_url_seed(QString seed); - void add_url_seed(QString seed); - void prioritize_files(const std::vector &v); + void pause() const; + void resume() const; + void remove_url_seed(QString seed) const; + void add_url_seed(QString seed) const; + void prioritize_files(const std::vector &v) const; void file_priority(int index, int priority) const; - void set_tracker_login(QString username, QString password); + void set_tracker_login(QString username, QString password) const; void move_storage(QString path) const; - void add_tracker(const libtorrent::announce_entry& url); - void prioritize_first_last_piece(bool b); - void rename_file(int index, QString name); - bool save_torrent_file(QString path); + void add_tracker(const libtorrent::announce_entry& url) const; + void prioritize_first_last_piece(bool b) const; + void rename_file(int index, QString name) const; + bool save_torrent_file(QString path) const; // // Operators diff --git a/src/qtlibtorrent/torrentmodel.cpp b/src/qtlibtorrent/torrentmodel.cpp index 338322d7d..1bf1d2ee1 100644 --- a/src/qtlibtorrent/torrentmodel.cpp +++ b/src/qtlibtorrent/torrentmodel.cpp @@ -210,11 +210,11 @@ void TorrentModel::populate() { connect(QBtSession::instance(), SIGNAL(addedTorrent(QTorrentHandle)), SLOT(addTorrent(QTorrentHandle))); connect(QBtSession::instance(), SIGNAL(torrentAboutToBeRemoved(QTorrentHandle)), SLOT(handleTorrentAboutToBeRemoved(QTorrentHandle))); connect(QBtSession::instance(), SIGNAL(deletedTorrent(QString)), SLOT(removeTorrent(QString))); - connect(QBtSession::instance(), SIGNAL(finishedTorrent(QTorrentHandle&)), SLOT(handleTorrentUpdate(QTorrentHandle&))); - connect(QBtSession::instance(), SIGNAL(metadataReceived(QTorrentHandle&)), SLOT(handleTorrentUpdate(QTorrentHandle&))); - connect(QBtSession::instance(), SIGNAL(resumedTorrent(QTorrentHandle&)), SLOT(handleTorrentUpdate(QTorrentHandle&))); - connect(QBtSession::instance(), SIGNAL(pausedTorrent(QTorrentHandle&)), SLOT(handleTorrentUpdate(QTorrentHandle&))); - connect(QBtSession::instance(), SIGNAL(torrentFinishedChecking(QTorrentHandle&)), SLOT(handleTorrentUpdate(QTorrentHandle&))); + connect(QBtSession::instance(), SIGNAL(finishedTorrent(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle))); + connect(QBtSession::instance(), SIGNAL(metadataReceived(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle))); + connect(QBtSession::instance(), SIGNAL(resumedTorrent(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle))); + connect(QBtSession::instance(), SIGNAL(pausedTorrent(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle))); + connect(QBtSession::instance(), SIGNAL(torrentFinishedChecking(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle))); } TorrentModel::~TorrentModel() { @@ -356,7 +356,7 @@ void TorrentModel::endRemoveTorrent() endRemoveRows(); } -void TorrentModel::handleTorrentUpdate(QTorrentHandle &h) +void TorrentModel::handleTorrentUpdate(const QTorrentHandle &h) { const int row = torrentRow(h.hash()); if(row >= 0) { diff --git a/src/qtlibtorrent/torrentmodel.h b/src/qtlibtorrent/torrentmodel.h index e9dd3a174..32bcef8f5 100644 --- a/src/qtlibtorrent/torrentmodel.h +++ b/src/qtlibtorrent/torrentmodel.h @@ -103,7 +103,7 @@ signals: private slots: void addTorrent(const QTorrentHandle& h); void removeTorrent(const QString &hash); - void handleTorrentUpdate(QTorrentHandle &h); + void handleTorrentUpdate(const QTorrentHandle &h); void notifyTorrentChanged(int row); void forceModelRefresh(); void handleTorrentLabelChange(QString previous, QString current); diff --git a/src/transferlistwidget.h b/src/transferlistwidget.h index da672b8bd..8018a47f6 100644 --- a/src/transferlistwidget.h +++ b/src/transferlistwidget.h @@ -107,7 +107,7 @@ protected slots: void askNewLabelForSelection(); signals: - void currentTorrentChanged(QTorrentHandle &h); + void currentTorrentChanged(const QTorrentHandle &h); private: TransferListDelegate *listDelegate; diff --git a/src/webui/eventmanager.cpp b/src/webui/eventmanager.cpp index aba8801ab..277010975 100644 --- a/src/webui/eventmanager.cpp +++ b/src/webui/eventmanager.cpp @@ -365,7 +365,7 @@ QVariantMap EventManager::getPropGeneralInfo(QString hash) const { return data; } -void EventManager::addedTorrent(QTorrentHandle& h) +void EventManager::addedTorrent(const QTorrentHandle& h) { modifiedTorrent(h); } @@ -375,7 +375,7 @@ void EventManager::deletedTorrent(QString hash) event_list.remove(hash); } -void EventManager::modifiedTorrent(QTorrentHandle h) +void EventManager::modifiedTorrent(const QTorrentHandle& h) { QString hash = h.hash(); QVariantMap event; diff --git a/src/webui/eventmanager.h b/src/webui/eventmanager.h index b1a025f02..01104c1df 100644 --- a/src/webui/eventmanager.h +++ b/src/webui/eventmanager.h @@ -57,9 +57,9 @@ public: void setGlobalPreferences(QVariantMap m) const; public slots: - void addedTorrent(QTorrentHandle& h); + void addedTorrent(const QTorrentHandle& h); void deletedTorrent(QString hash); - void modifiedTorrent(QTorrentHandle h); + void modifiedTorrent(const QTorrentHandle& h); }; #endif diff --git a/src/webui/httpserver.cpp b/src/webui/httpserver.cpp index 2c07bf339..79078262e 100644 --- a/src/webui/httpserver.cpp +++ b/src/webui/httpserver.cpp @@ -97,7 +97,7 @@ HttpServer::HttpServer(int msec, QObject* parent) : QTcpServer(parent) { manager->addedTorrent(h); } //connect QBtSession::instance() to manager - connect(QBtSession::instance(), SIGNAL(addedTorrent(QTorrentHandle&)), manager, SLOT(addedTorrent(QTorrentHandle&))); + connect(QBtSession::instance(), SIGNAL(addedTorrent(QTorrentHandle)), manager, SLOT(addedTorrent(QTorrentHandle))); connect(QBtSession::instance(), SIGNAL(deletedTorrent(QString)), manager, SLOT(deletedTorrent(QString))); //set timer timer = new QTimer(this);