From 01437996236ac1f5ef1e01fab4ca7bc67f25e9c3 Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Sat, 30 Apr 2016 01:38:24 +0300 Subject: [PATCH] Don't show added torrent notification during startup. --- src/base/bittorrent/session.cpp | 3 +++ src/base/bittorrent/session.h | 1 + src/gui/mainwindow.cpp | 4 ++-- src/gui/mainwindow.h | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index 831af3fb4..b1a608a33 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -2458,6 +2458,9 @@ void Session::createTorrentHandle(const libt::torrent_handle &nativeHandle) // Send torrent addition signal emit torrentAdded(torrent); + // Send new torrent signal + if (!data.resumed) + emit torrentNew(torrent); } void Session::handleAddTorrentAlert(libt::add_torrent_alert *p) diff --git a/src/base/bittorrent/session.h b/src/base/bittorrent/session.h index 705893185..f55d1a310 100644 --- a/src/base/bittorrent/session.h +++ b/src/base/bittorrent/session.h @@ -285,6 +285,7 @@ namespace BitTorrent void torrentsUpdated(); void addTorrentFailed(const QString &error); void torrentAdded(BitTorrent::TorrentHandle *const torrent); + void torrentNew(BitTorrent::TorrentHandle *const torrent); void torrentAboutToBeRemoved(BitTorrent::TorrentHandle *const torrent); void torrentPaused(BitTorrent::TorrentHandle *const torrent); void torrentResumed(BitTorrent::TorrentHandle *const torrent); diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 306ed7402..4306d7c68 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -186,7 +186,7 @@ MainWindow::MainWindow(QWidget *parent) // Creating Bittorrent session connect(BitTorrent::Session::instance(), SIGNAL(fullDiskError(BitTorrent::TorrentHandle *const, QString)), this, SLOT(fullDiskError(BitTorrent::TorrentHandle *const, QString))); connect(BitTorrent::Session::instance(), SIGNAL(addTorrentFailed(const QString &)), this, SLOT(addTorrentFailed(const QString &))); - connect(BitTorrent::Session::instance(), SIGNAL(torrentAdded(BitTorrent::TorrentHandle *const)), this, SLOT(torrentAdded(BitTorrent::TorrentHandle *const))); + connect(BitTorrent::Session::instance(), SIGNAL(torrentNew(BitTorrent::TorrentHandle *const)), this, SLOT(torrentNew(BitTorrent::TorrentHandle *const))); connect(BitTorrent::Session::instance(), SIGNAL(torrentFinished(BitTorrent::TorrentHandle *const)), this, SLOT(finishedTorrent(BitTorrent::TorrentHandle *const))); connect(BitTorrent::Session::instance(), SIGNAL(trackerAuthenticationRequired(BitTorrent::TorrentHandle *const)), this, SLOT(trackerAuthenticationRequired(BitTorrent::TorrentHandle *const))); connect(BitTorrent::Session::instance(), SIGNAL(downloadFromUrlFailed(QString, QString)), this, SLOT(handleDownloadFromUrlFailure(QString, QString))); @@ -723,7 +723,7 @@ void MainWindow::addTorrentFailed(const QString &error) const } // called when a torrent was added -void MainWindow::torrentAdded(BitTorrent::TorrentHandle *const torrent) const +void MainWindow::torrentNew(BitTorrent::TorrentHandle *const torrent) const { if (isTorrentAddedNotificationsEnabled()) showNotificationBaloon(tr("Torrent added"), tr("'%1' was added.", "e.g: xxx.avi was added.").arg(torrent->name())); diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 8d67b235a..82b78ae05 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -126,7 +126,7 @@ private slots: void loadPreferences(bool configureSession = true); void addUnauthenticatedTracker(const QPair &tracker); void addTorrentFailed(const QString &error) const; - void torrentAdded(BitTorrent::TorrentHandle *const torrent) const; + void torrentNew(BitTorrent::TorrentHandle *const torrent) const; void finishedTorrent(BitTorrent::TorrentHandle *const torrent) const; void askRecursiveTorrentDownloadConfirmation(BitTorrent::TorrentHandle *const torrent); void optionsSaved();