Signal / slot fixes

This commit is contained in:
Christophe Dumez
2010-11-24 20:31:14 +00:00
parent 2f337f9191
commit 19db0d471f
14 changed files with 71 additions and 70 deletions

View File

@@ -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<size_type> 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;

View File

@@ -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

View File

@@ -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<int> &v) {
void QTorrentHandle::prioritize_files(const std::vector<int> &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()));
}

View File

@@ -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<int> &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<int> &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

View File

@@ -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) {

View File

@@ -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);