|
|
|
@ -2159,6 +2159,7 @@ void QBtSession::readAlerts() {
@@ -2159,6 +2159,7 @@ void QBtSession::readAlerts() {
|
|
|
|
|
// look at session alerts and display some infos
|
|
|
|
|
std::auto_ptr<alert> a = s->pop_alert(); |
|
|
|
|
while (a.get()) { |
|
|
|
|
try { |
|
|
|
|
if (torrent_finished_alert* p = dynamic_cast<torrent_finished_alert*>(a.get())) { |
|
|
|
|
QTorrentHandle h(p->handle); |
|
|
|
|
if (h.is_valid()) { |
|
|
|
@ -2190,13 +2191,13 @@ void QBtSession::readAlerts() {
@@ -2190,13 +2191,13 @@ void QBtSession::readAlerts() {
|
|
|
|
|
} |
|
|
|
|
} catch(std::exception&) { |
|
|
|
|
qDebug("Caught error loading torrent"); |
|
|
|
|
#if defined(Q_WS_WIN) || defined(Q_OS_OS2) |
|
|
|
|
#if defined(Q_WS_WIN) || defined(Q_OS_OS2) |
|
|
|
|
QString displayed_path = torrent_fullpath; |
|
|
|
|
displayed_path.replace("/", "\\"); |
|
|
|
|
addConsoleMessage(tr("Unable to decode %1 torrent file.").arg(displayed_path), QString::fromUtf8("red")); |
|
|
|
|
#else |
|
|
|
|
#else |
|
|
|
|
addConsoleMessage(tr("Unable to decode %1 torrent file.").arg(torrent_fullpath), QString::fromUtf8("red")); |
|
|
|
|
#endif |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -2221,21 +2222,21 @@ void QBtSession::readAlerts() {
@@ -2221,21 +2222,21 @@ void QBtSession::readAlerts() {
|
|
|
|
|
qDebug("Emitting finishedTorrent() signal"); |
|
|
|
|
emit finishedTorrent(h); |
|
|
|
|
qDebug("Received finished alert for %s", qPrintable(h.name())); |
|
|
|
|
#ifndef DISABLE_GUI |
|
|
|
|
#ifndef DISABLE_GUI |
|
|
|
|
bool will_shutdown = (pref.shutdownWhenDownloadsComplete() || |
|
|
|
|
pref.shutdownqBTWhenDownloadsComplete() || |
|
|
|
|
pref.suspendWhenDownloadsComplete()) |
|
|
|
|
&& !hasDownloadingTorrents(); |
|
|
|
|
#else |
|
|
|
|
#else |
|
|
|
|
bool will_shutdown = false; |
|
|
|
|
#endif |
|
|
|
|
#endif |
|
|
|
|
// AutoRun program
|
|
|
|
|
if (pref.isAutoRunEnabled()) |
|
|
|
|
autoRunExternalProgram(h, will_shutdown); |
|
|
|
|
// Mail notification
|
|
|
|
|
if (pref.isMailNotificationEnabled()) |
|
|
|
|
sendNotificationEmail(h); |
|
|
|
|
#ifndef DISABLE_GUI |
|
|
|
|
#ifndef DISABLE_GUI |
|
|
|
|
// Auto-Shutdown
|
|
|
|
|
if (will_shutdown) { |
|
|
|
|
bool suspend = pref.suspendWhenDownloadsComplete(); |
|
|
|
@ -2267,7 +2268,7 @@ void QBtSession::readAlerts() {
@@ -2267,7 +2268,7 @@ void QBtSession::readAlerts() {
|
|
|
|
|
qApp->exit(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
#endif // DISABLE_GUI
|
|
|
|
|
#endif // DISABLE_GUI
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -2541,6 +2542,10 @@ void QBtSession::readAlerts() {
@@ -2541,6 +2542,10 @@ void QBtSession::readAlerts() {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} catch (const std::exception& e) { |
|
|
|
|
qWarning() << "Caught exception in readAlerts(): " << e.what(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
a = s->pop_alert(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|