Browse Source

Signal / slot fixes

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
19db0d471f
  1. 18
      src/mainwindow.cpp
  2. 8
      src/mainwindow.h
  3. 12
      src/properties/propertieswidget.cpp
  4. 6
      src/properties/propertieswidget.h
  5. 7
      src/qtlibtorrent/qbtsession.cpp
  6. 24
      src/qtlibtorrent/qbtsession.h
  7. 20
      src/qtlibtorrent/qtorrenthandle.cpp
  8. 20
      src/qtlibtorrent/qtorrenthandle.h
  9. 12
      src/qtlibtorrent/torrentmodel.cpp
  10. 2
      src/qtlibtorrent/torrentmodel.h
  11. 2
      src/transferlistwidget.h
  12. 4
      src/webui/eventmanager.cpp
  13. 4
      src/webui/eventmanager.h
  14. 2
      src/webui/httpserver.cpp

18
src/mainwindow.cpp

@ -134,13 +134,13 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo
toolBar->layout()->setSpacing(7); toolBar->layout()->setSpacing(7);
// Creating Bittorrent session // Creating Bittorrent session
BTSession = QBtSession::instance(); BTSession = QBtSession::instance();
connect(BTSession, SIGNAL(fullDiskError(QTorrentHandle&, QString)), this, SLOT(fullDiskError(QTorrentHandle&, QString))); connect(BTSession, SIGNAL(fullDiskError(QTorrentHandle, QString)), this, SLOT(fullDiskError(QTorrentHandle, QString)));
connect(BTSession, SIGNAL(finishedTorrent(QTorrentHandle&)), this, SLOT(finishedTorrent(QTorrentHandle&))); connect(BTSession, SIGNAL(finishedTorrent(QTorrentHandle)), this, SLOT(finishedTorrent(QTorrentHandle)));
connect(BTSession, SIGNAL(trackerAuthenticationRequired(QTorrentHandle&)), this, SLOT(trackerAuthenticationRequired(QTorrentHandle&))); connect(BTSession, SIGNAL(trackerAuthenticationRequired(QTorrentHandle)), this, SLOT(trackerAuthenticationRequired(QTorrentHandle)));
connect(BTSession, SIGNAL(newDownloadedTorrent(QString, QString)), this, SLOT(processDownloadedFiles(QString, QString))); 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(downloadFromUrlFailure(QString, QString)), this, SLOT(handleDownloadFromUrlFailure(QString, QString)));
connect(BTSession, SIGNAL(alternativeSpeedsModeChanged(bool)), this, SLOT(updateAltSpeedsBtn(bool))); 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 #ifdef Q_WS_MAC
connect(static_cast<QMacApplication*>(qApp), SIGNAL(newFileOpenMacEvent(QString)), this, SLOT(processParams(QString))); connect(static_cast<QMacApplication*>(qApp), SIGNAL(newFileOpenMacEvent(QString)), this, SLOT(processParams(QString)));
#endif #endif
@ -448,13 +448,13 @@ void MainWindow::writeSettings() {
} }
// called when a torrent has finished // called when a torrent has finished
void MainWindow::finishedTorrent(QTorrentHandle& h) const { void MainWindow::finishedTorrent(const QTorrentHandle& h) const {
if(!TorrentPersistentData::isSeed(h.hash())) if(!TorrentPersistentData::isSeed(h.hash()))
showNotificationBaloon(tr("Download completion"), tr("%1 has finished downloading.", "e.g: xxx.avi has finished downloading.").arg(h.name())); showNotificationBaloon(tr("Download completion"), tr("%1 has finished downloading.", "e.g: xxx.avi has finished downloading.").arg(h.name()));
} }
// Notification when disk is full // 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; 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)); 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; Preferences pref;
if(pref.recursiveDownloadDisabled()) return; 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())); 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<QTorrentHandle,QString> &
} }
// Called when a tracker requires authentication // Called when a tracker requires authentication
void MainWindow::trackerAuthenticationRequired(QTorrentHandle& h) { void MainWindow::trackerAuthenticationRequired(const QTorrentHandle& h) {
if(unauthenticated_trackers.indexOf(QPair<QTorrentHandle,QString>(h, h.current_tracker())) < 0) { if(unauthenticated_trackers.indexOf(QPair<QTorrentHandle,QString>(h, h.current_tracker())) < 0) {
// Tracker login // Tracker login
new trackerLogin(this, h); new trackerLogin(this, h);
@ -1223,7 +1223,7 @@ void MainWindow::on_action_Import_Torrent_triggered()
void MainWindow::on_actionDownload_from_URL_triggered() { void MainWindow::on_actionDownload_from_URL_triggered() {
if(!downloadFromURLDialog) { if(!downloadFromURLDialog) {
downloadFromURLDialog = new downloadFromURL(this); downloadFromURLDialog = new downloadFromURL(this);
connect(downloadFromURLDialog, SIGNAL(urlsReadyToBeDownloaded(const QStringList&)), this, SLOT(downloadFromURLList(const QStringList&))); connect(downloadFromURLDialog, SIGNAL(urlsReadyToBeDownloaded(QStringList)), this, SLOT(downloadFromURLList(QStringList)));
} }
} }

8
src/mainwindow.h

@ -74,7 +74,7 @@ public:
PropertiesWidget *getProperties() const { return properties; } PropertiesWidget *getProperties() const { return properties; }
public slots: public slots:
void trackerAuthenticationRequired(QTorrentHandle& h); void trackerAuthenticationRequired(const QTorrentHandle& h);
void setTabText(int index, QString text) const; void setTabText(int index, QString text) const;
void showNotificationBaloon(QString title, QString msg) const; void showNotificationBaloon(QString title, QString msg) const;
void downloadFromURLList(const QStringList& urls); void downloadFromURLList(const QStringList& urls);
@ -97,7 +97,7 @@ protected slots:
void readSettings(); void readSettings();
void on_actionExit_triggered(); void on_actionExit_triggered();
void createTrayIcon(); void createTrayIcon();
void fullDiskError(QTorrentHandle& h, QString msg) const; void fullDiskError(const QTorrentHandle& h, QString msg) const;
void handleDownloadFromUrlFailure(QString, QString) const; void handleDownloadFromUrlFailure(QString, QString) const;
void createSystrayDelayed(); void createSystrayDelayed();
void tab_changed(int); void tab_changed(int);
@ -123,8 +123,8 @@ protected slots:
void addTorrent(QString path); void addTorrent(QString path);
void addUnauthenticatedTracker(const QPair<QTorrentHandle,QString> &tracker); void addUnauthenticatedTracker(const QPair<QTorrentHandle,QString> &tracker);
void processDownloadedFiles(QString path, QString url); void processDownloadedFiles(QString path, QString url);
void finishedTorrent(QTorrentHandle& h) const; void finishedTorrent(const QTorrentHandle& h) const;
void askRecursiveTorrentDownloadConfirmation(QTorrentHandle &h); void askRecursiveTorrentDownloadConfirmation(const QTorrentHandle &h);
// Options slots // Options slots
void on_actionOptions_triggered(); void on_actionOptions_triggered();
void optionsSaved(); void optionsSaved();

12
src/properties/propertieswidget.cpp

@ -79,11 +79,11 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow* main_window, Tra
connect(PropListModel, SIGNAL(filteredFilesChanged()), this, SLOT(filteredFilesChanged())); connect(PropListModel, SIGNAL(filteredFilesChanged()), this, SLOT(filteredFilesChanged()));
connect(addWS_button, SIGNAL(clicked()), this, SLOT(askWebSeed())); connect(addWS_button, SIGNAL(clicked()), this, SLOT(askWebSeed()));
connect(deleteWS_button, SIGNAL(clicked()), this, SLOT(deleteSelectedUrlSeeds())); 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(PropDelegate, SIGNAL(filteredFilesChanged()), this, SLOT(filteredFilesChanged()));
connect(stackedProperties, SIGNAL(currentChanged(int)), this, SLOT(loadDynamicData())); connect(stackedProperties, SIGNAL(currentChanged(int)), this, SLOT(loadDynamicData()));
connect(QBtSession::instance(), SIGNAL(savePathChanged(QTorrentHandle&)), this, SLOT(updateSavePath(QTorrentHandle&))); connect(QBtSession::instance(), SIGNAL(savePathChanged(QTorrentHandle)), this, SLOT(updateSavePath(QTorrentHandle)));
connect(QBtSession::instance(), SIGNAL(metadataReceived(QTorrentHandle&)), this, SLOT(updateTorrentInfos(QTorrentHandle&))); connect(QBtSession::instance(), SIGNAL(metadataReceived(QTorrentHandle)), this, SLOT(updateTorrentInfos(QTorrentHandle)));
// Downloaded pieces progress bar // Downloaded pieces progress bar
downloaded_pieces = new DownloadedPiecesBar(this); downloaded_pieces = new DownloadedPiecesBar(this);
@ -199,7 +199,7 @@ QTorrentHandle PropertiesWidget::getCurrentTorrent() const {
return h; return h;
} }
void PropertiesWidget::updateSavePath(QTorrentHandle& _h) { void PropertiesWidget::updateSavePath(const QTorrentHandle& _h) {
if(h.is_valid() && h == _h) { if(h.is_valid() && h == _h) {
QString p; QString p;
if(h.has_metadata() && h.num_files() == 1) { 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) { if(h.is_valid() && h == _h) {
loadTorrentInfos(h); loadTorrentInfos(h);
} }
} }
void PropertiesWidget::loadTorrentInfos(QTorrentHandle &_h) { void PropertiesWidget::loadTorrentInfos(const QTorrentHandle &_h) {
clear(); clear();
h = _h; h = _h;
if(!h.is_valid()) { if(!h.is_valid()) {

6
src/properties/propertieswidget.h

@ -69,8 +69,8 @@ protected:
bool applyPriorities(); bool applyPriorities();
protected slots: protected slots:
void loadTorrentInfos(QTorrentHandle &h); void loadTorrentInfos(const QTorrentHandle &h);
void updateTorrentInfos(QTorrentHandle &h); void updateTorrentInfos(const QTorrentHandle &h);
void loadUrlSeeds(); void loadUrlSeeds();
void askWebSeed(); void askWebSeed();
void deleteSelectedUrlSeeds(); void deleteSelectedUrlSeeds();
@ -91,7 +91,7 @@ public slots:
void saveSettings(); void saveSettings();
void reloadPreferences(); void reloadPreferences();
void openDoubleClickedFile(QModelIndex); void openDoubleClickedFile(QModelIndex);
void updateSavePath(QTorrentHandle& h); void updateSavePath(const QTorrentHandle& h);
private: private:
TransferListWidget *transferList; TransferListWidget *transferList;

7
src/qtlibtorrent/qbtsession.cpp

@ -409,6 +409,7 @@ void QBtSession::configureSession() {
sessionSettings.outgoing_ports = std::make_pair(pref.outgoingPortsMin(), pref.outgoingPortsMax()); sessionSettings.outgoing_ports = std::make_pair(pref.outgoingPortsMin(), pref.outgoingPortsMax());
setSessionSettings(sessionSettings); setSessionSettings(sessionSettings);
// Ignore limits on LAN // Ignore limits on LAN
qDebug() << "Ignore limits on LAN" << pref.ignoreLimitsOnLAN();
sessionSettings.ignore_limits_on_local_network = pref.ignoreLimitsOnLAN(); sessionSettings.ignore_limits_on_local_network = pref.ignoreLimitsOnLAN();
// Include overhead in transfer limits // Include overhead in transfer limits
sessionSettings.rate_limit_ip_overhead = pref.includeOverheadInLimits(); sessionSettings.rate_limit_ip_overhead = pref.includeOverheadInLimits();
@ -1645,7 +1646,7 @@ void QBtSession::setDefaultTempPath(QString temppath) {
} }
#if LIBTORRENT_VERSION_MINOR > 14 #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; if(!h.is_valid() || !h.has_metadata()) return;
std::vector<size_type> fp; std::vector<size_type> fp;
h.file_progress(fp); h.file_progress(fp);
@ -1673,7 +1674,7 @@ void QBtSession::appendqBextensionToTorrent(QTorrentHandle &h, bool append) {
} }
#endif #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(!h.is_valid()) return;
if(!appendLabelToSavePath) return; if(!appendLabelToSavePath) return;
QString old_save_path = TorrentPersistentData::getSavePath(h.hash()); 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; if(!h.is_valid()) return;
const QString label = TorrentPersistentData::getLabel(h.hash()); const QString label = TorrentPersistentData::getLabel(h.hash());
if(label.isEmpty()) return; if(label.isEmpty()) return;

24
src/qtlibtorrent/qbtsession.h

@ -135,10 +135,10 @@ public slots:
void startTorrentsInPause(bool b); void startTorrentsInPause(bool b);
void setDefaultTempPath(QString temppath); void setDefaultTempPath(QString temppath);
void setAppendLabelToSavePath(bool append); void setAppendLabelToSavePath(bool append);
void appendLabelToTorrentSavePath(QTorrentHandle &h); void appendLabelToTorrentSavePath(const QTorrentHandle &h);
void changeLabelInTorrentSavePath(QTorrentHandle &h, QString old_label, QString new_label); void changeLabelInTorrentSavePath(const QTorrentHandle &h, QString old_label, QString new_label);
#if LIBTORRENT_VERSION_MINOR > 14 #if LIBTORRENT_VERSION_MINOR > 14
void appendqBextensionToTorrent(QTorrentHandle &h, bool append); void appendqBextensionToTorrent(const QTorrentHandle &h, bool append);
void setAppendqBExtension(bool append); void setAppendqBExtension(bool append);
#endif #endif
void applyEncryptionSettings(libtorrent::pe_settings se); void applyEncryptionSettings(libtorrent::pe_settings se);
@ -186,21 +186,21 @@ signals:
void addedTorrent(const QTorrentHandle& h); void addedTorrent(const QTorrentHandle& h);
void deletedTorrent(QString hash); void deletedTorrent(QString hash);
void torrentAboutToBeRemoved(const QTorrentHandle &h); void torrentAboutToBeRemoved(const QTorrentHandle &h);
void pausedTorrent(QTorrentHandle& h); void pausedTorrent(const QTorrentHandle& h);
void resumedTorrent(QTorrentHandle& h); void resumedTorrent(const QTorrentHandle& h);
void finishedTorrent(QTorrentHandle& h); void finishedTorrent(const QTorrentHandle& h);
void fullDiskError(QTorrentHandle& h, QString msg); void fullDiskError(const QTorrentHandle& h, QString msg);
void trackerError(QString hash, QString time, 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 newDownloadedTorrent(QString path, QString url);
void updateFileSize(QString hash); void updateFileSize(QString hash);
void downloadFromUrlFailure(QString url, QString reason); void downloadFromUrlFailure(QString url, QString reason);
void torrentFinishedChecking(QTorrentHandle& h); void torrentFinishedChecking(const QTorrentHandle& h);
void metadataReceived(QTorrentHandle &h); void metadataReceived(const QTorrentHandle &h);
void savePathChanged(QTorrentHandle &h); void savePathChanged(const QTorrentHandle &h);
void newConsoleMessage(QString msg); void newConsoleMessage(QString msg);
void alternativeSpeedsModeChanged(bool alternative); void alternativeSpeedsModeChanged(bool alternative);
void recursiveTorrentDownloadPossible(QTorrentHandle &h); void recursiveTorrentDownloadPossible(const QTorrentHandle &h);
private: private:
#if LIBTORRENT_VERSION_MINOR < 15 #if LIBTORRENT_VERSION_MINOR < 15

20
src/qtlibtorrent/qtorrenthandle.cpp

@ -381,13 +381,13 @@ void QTorrentHandle::downloading_pieces(bitfield &bf) const {
// Setters // Setters
// //
void QTorrentHandle::pause() { void QTorrentHandle::pause() const {
torrent_handle::auto_managed(false); torrent_handle::auto_managed(false);
torrent_handle::pause(); torrent_handle::pause();
torrent_handle::save_resume_data(); torrent_handle::save_resume_data();
} }
void QTorrentHandle::resume() { void QTorrentHandle::resume() const {
if(has_error()) torrent_handle::clear_error(); if(has_error()) torrent_handle::clear_error();
const QString torrent_hash = hash(); const QString torrent_hash = hash();
bool has_persistant_error = TorrentPersistentData::hasError(torrent_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()); 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(); const std::string str_seed = seed.toStdString();
qDebug("calling torrent_handle::add_url_seed(%s)", str_seed.c_str()); qDebug("calling torrent_handle::add_url_seed(%s)", str_seed.c_str());
torrent_handle::add_url_seed(str_seed); torrent_handle::add_url_seed(str_seed);
} }
void QTorrentHandle::prioritize_files(const std::vector<int> &v) { void QTorrentHandle::prioritize_files(const std::vector<int> &v) const {
// Does not do anything for seeding torrents // Does not do anything for seeding torrents
if(v.size() != (unsigned int)torrent_handle::get_torrent_info().num_files()) if(v.size() != (unsigned int)torrent_handle::get_torrent_info().num_files())
return; 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())); 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()); 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; if(!torrent_handle::has_metadata()) return false;
QFile met_file(path); QFile met_file(path);
if(met_file.open(QIODevice::WriteOnly)) { if(met_file.open(QIODevice::WriteOnly)) {
@ -489,7 +489,7 @@ bool QTorrentHandle::save_torrent_file(QString path) {
return false; return false;
} }
void QTorrentHandle::add_tracker(const announce_entry& url) { void QTorrentHandle::add_tracker(const announce_entry& url) const {
#if LIBTORRENT_VERSION_MINOR > 14 #if LIBTORRENT_VERSION_MINOR > 14
torrent_handle::add_tracker(url); torrent_handle::add_tracker(url);
#else #else
@ -510,7 +510,7 @@ void QTorrentHandle::add_tracker(const announce_entry& url) {
#endif #endif
} }
void QTorrentHandle::prioritize_first_last_piece(bool b) { void QTorrentHandle::prioritize_first_last_piece(bool b) const {
// Detect main file // Detect main file
int rank=0; int rank=0;
int main_file_index = 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); 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())); torrent_handle::rename_file(index, std::string(name.toUtf8().constData()));
} }

20
src/qtlibtorrent/qtorrenthandle.h

@ -115,18 +115,18 @@ class QTorrentHandle : public libtorrent::torrent_handle {
// //
// Setters // Setters
// //
void pause(); void pause() const;
void resume(); void resume() const;
void remove_url_seed(QString seed); void remove_url_seed(QString seed) const;
void add_url_seed(QString seed); void add_url_seed(QString seed) const;
void prioritize_files(const std::vector<int> &v); void prioritize_files(const std::vector<int> &v) const;
void file_priority(int index, int priority) 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 move_storage(QString path) const;
void add_tracker(const libtorrent::announce_entry& url); void add_tracker(const libtorrent::announce_entry& url) const;
void prioritize_first_last_piece(bool b); void prioritize_first_last_piece(bool b) const;
void rename_file(int index, QString name); void rename_file(int index, QString name) const;
bool save_torrent_file(QString path); bool save_torrent_file(QString path) const;
// //
// Operators // Operators

12
src/qtlibtorrent/torrentmodel.cpp

@ -210,11 +210,11 @@ void TorrentModel::populate() {
connect(QBtSession::instance(), SIGNAL(addedTorrent(QTorrentHandle)), SLOT(addTorrent(QTorrentHandle))); connect(QBtSession::instance(), SIGNAL(addedTorrent(QTorrentHandle)), SLOT(addTorrent(QTorrentHandle)));
connect(QBtSession::instance(), SIGNAL(torrentAboutToBeRemoved(QTorrentHandle)), SLOT(handleTorrentAboutToBeRemoved(QTorrentHandle))); connect(QBtSession::instance(), SIGNAL(torrentAboutToBeRemoved(QTorrentHandle)), SLOT(handleTorrentAboutToBeRemoved(QTorrentHandle)));
connect(QBtSession::instance(), SIGNAL(deletedTorrent(QString)), SLOT(removeTorrent(QString))); connect(QBtSession::instance(), SIGNAL(deletedTorrent(QString)), SLOT(removeTorrent(QString)));
connect(QBtSession::instance(), SIGNAL(finishedTorrent(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(metadataReceived(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle)));
connect(QBtSession::instance(), SIGNAL(resumedTorrent(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(pausedTorrent(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle)));
connect(QBtSession::instance(), SIGNAL(torrentFinishedChecking(QTorrentHandle&)), SLOT(handleTorrentUpdate(QTorrentHandle&))); connect(QBtSession::instance(), SIGNAL(torrentFinishedChecking(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle)));
} }
TorrentModel::~TorrentModel() { TorrentModel::~TorrentModel() {
@ -356,7 +356,7 @@ void TorrentModel::endRemoveTorrent()
endRemoveRows(); endRemoveRows();
} }
void TorrentModel::handleTorrentUpdate(QTorrentHandle &h) void TorrentModel::handleTorrentUpdate(const QTorrentHandle &h)
{ {
const int row = torrentRow(h.hash()); const int row = torrentRow(h.hash());
if(row >= 0) { if(row >= 0) {

2
src/qtlibtorrent/torrentmodel.h

@ -103,7 +103,7 @@ signals:
private slots: private slots:
void addTorrent(const QTorrentHandle& h); void addTorrent(const QTorrentHandle& h);
void removeTorrent(const QString &hash); void removeTorrent(const QString &hash);
void handleTorrentUpdate(QTorrentHandle &h); void handleTorrentUpdate(const QTorrentHandle &h);
void notifyTorrentChanged(int row); void notifyTorrentChanged(int row);
void forceModelRefresh(); void forceModelRefresh();
void handleTorrentLabelChange(QString previous, QString current); void handleTorrentLabelChange(QString previous, QString current);

2
src/transferlistwidget.h

@ -107,7 +107,7 @@ protected slots:
void askNewLabelForSelection(); void askNewLabelForSelection();
signals: signals:
void currentTorrentChanged(QTorrentHandle &h); void currentTorrentChanged(const QTorrentHandle &h);
private: private:
TransferListDelegate *listDelegate; TransferListDelegate *listDelegate;

4
src/webui/eventmanager.cpp

@ -365,7 +365,7 @@ QVariantMap EventManager::getPropGeneralInfo(QString hash) const {
return data; return data;
} }
void EventManager::addedTorrent(QTorrentHandle& h) void EventManager::addedTorrent(const QTorrentHandle& h)
{ {
modifiedTorrent(h); modifiedTorrent(h);
} }
@ -375,7 +375,7 @@ void EventManager::deletedTorrent(QString hash)
event_list.remove(hash); event_list.remove(hash);
} }
void EventManager::modifiedTorrent(QTorrentHandle h) void EventManager::modifiedTorrent(const QTorrentHandle& h)
{ {
QString hash = h.hash(); QString hash = h.hash();
QVariantMap event; QVariantMap event;

4
src/webui/eventmanager.h

@ -57,9 +57,9 @@ public:
void setGlobalPreferences(QVariantMap m) const; void setGlobalPreferences(QVariantMap m) const;
public slots: public slots:
void addedTorrent(QTorrentHandle& h); void addedTorrent(const QTorrentHandle& h);
void deletedTorrent(QString hash); void deletedTorrent(QString hash);
void modifiedTorrent(QTorrentHandle h); void modifiedTorrent(const QTorrentHandle& h);
}; };
#endif #endif

2
src/webui/httpserver.cpp

@ -97,7 +97,7 @@ HttpServer::HttpServer(int msec, QObject* parent) : QTcpServer(parent) {
manager->addedTorrent(h); manager->addedTorrent(h);
} }
//connect QBtSession::instance() to manager //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))); connect(QBtSession::instance(), SIGNAL(deletedTorrent(QString)), manager, SLOT(deletedTorrent(QString)));
//set timer //set timer
timer = new QTimer(this); timer = new QTimer(this);

Loading…
Cancel
Save