diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index b50f2ba84..795bdd0c8 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -1184,6 +1184,7 @@ void Bittorrent::addConsoleMessage(QString msg, QColor color) { consoleMessages.removeFirst(); } consoleMessages.append(QString::fromUtf8("")+ QDateTime::currentDateTime().toString(QString::fromUtf8("dd/MM/yyyy hh:mm:ss")) + QString::fromUtf8(" - ") + msg + QString::fromUtf8("")); + emit newConsoleMessage(QDateTime::currentDateTime().toString("dd/MM/yyyy hh:mm:ss") + " - " + msg); } void Bittorrent::addPeerBanMessage(QString ip, bool from_ipfilter) { diff --git a/src/bittorrent.h b/src/bittorrent.h index 8ea40788f..f89d0dc5e 100644 --- a/src/bittorrent.h +++ b/src/bittorrent.h @@ -233,6 +233,7 @@ signals: void downloadFromUrlFailure(QString url, QString reason); void torrentFinishedChecking(QTorrentHandle& h); void metadataReceived(QTorrentHandle &h); + void newConsoleMessage(QString msg); }; #endif diff --git a/src/headlessloader.h b/src/headlessloader.h index 3d3988faa..c3dfc51ef 100644 --- a/src/headlessloader.h +++ b/src/headlessloader.h @@ -49,6 +49,7 @@ class HeadlessLoader: QObject { // TODO: Listen on socket for parameters // Instanciate Bittorrent Object BTSession = new Bittorrent(); + connect(BTSession, SIGNAL(newConsoleMessage(QString)), this, SLOT(displayConsoleMessage(QString))); // Resume unfinished torrents BTSession->startUpTorrents(); // TODO: Process command line parameter @@ -64,6 +65,10 @@ class HeadlessLoader: QObject { void exit() { qApp->quit(); } + + void displayConsoleMessage(QString msg) { + std::cout << msg.toLocal8Bit().data() << std::endl; + } }; #endif