Browse Source

- Display console messages on Terminal

- Program seems to be working
adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
8e39eef7aa
  1. 1
      src/bittorrent.cpp
  2. 1
      src/bittorrent.h
  3. 5
      src/headlessloader.h

1
src/bittorrent.cpp

@ -1184,6 +1184,7 @@ void Bittorrent::addConsoleMessage(QString msg, QColor color) {
consoleMessages.removeFirst(); consoleMessages.removeFirst();
} }
consoleMessages.append(QString::fromUtf8("<font color='grey'>")+ QDateTime::currentDateTime().toString(QString::fromUtf8("dd/MM/yyyy hh:mm:ss")) + QString::fromUtf8("</font> - <font color='") + color.name() +QString::fromUtf8("'><i>") + msg + QString::fromUtf8("</i></font>")); consoleMessages.append(QString::fromUtf8("<font color='grey'>")+ QDateTime::currentDateTime().toString(QString::fromUtf8("dd/MM/yyyy hh:mm:ss")) + QString::fromUtf8("</font> - <font color='") + color.name() +QString::fromUtf8("'><i>") + msg + QString::fromUtf8("</i></font>"));
emit newConsoleMessage(QDateTime::currentDateTime().toString("dd/MM/yyyy hh:mm:ss") + " - " + msg);
} }
void Bittorrent::addPeerBanMessage(QString ip, bool from_ipfilter) { void Bittorrent::addPeerBanMessage(QString ip, bool from_ipfilter) {

1
src/bittorrent.h

@ -233,6 +233,7 @@ signals:
void downloadFromUrlFailure(QString url, QString reason); void downloadFromUrlFailure(QString url, QString reason);
void torrentFinishedChecking(QTorrentHandle& h); void torrentFinishedChecking(QTorrentHandle& h);
void metadataReceived(QTorrentHandle &h); void metadataReceived(QTorrentHandle &h);
void newConsoleMessage(QString msg);
}; };
#endif #endif

5
src/headlessloader.h

@ -49,6 +49,7 @@ class HeadlessLoader: QObject {
// TODO: Listen on socket for parameters // TODO: Listen on socket for parameters
// Instanciate Bittorrent Object // Instanciate Bittorrent Object
BTSession = new Bittorrent(); BTSession = new Bittorrent();
connect(BTSession, SIGNAL(newConsoleMessage(QString)), this, SLOT(displayConsoleMessage(QString)));
// Resume unfinished torrents // Resume unfinished torrents
BTSession->startUpTorrents(); BTSession->startUpTorrents();
// TODO: Process command line parameter // TODO: Process command line parameter
@ -64,6 +65,10 @@ class HeadlessLoader: QObject {
void exit() { void exit() {
qApp->quit(); qApp->quit();
} }
void displayConsoleMessage(QString msg) {
std::cout << msg.toLocal8Bit().data() << std::endl;
}
}; };
#endif #endif

Loading…
Cancel
Save