Code clean up

This commit is contained in:
Christophe Dumez
2010-12-04 14:09:41 +00:00
parent 9bf673210f
commit 1c0f1b91e7
3 changed files with 43 additions and 51 deletions

View File

@@ -45,10 +45,9 @@ public:
// Enable Web UI
pref.setWebUiEnabled(true);
// Instanciate Bittorrent Object
BTSession = QBtSession::instance();
connect(BTSession, SIGNAL(newConsoleMessage(QString)), this, SLOT(displayConsoleMessage(QString)));
connect(QBtSession::instance(), SIGNAL(newConsoleMessage(QString)), this, SLOT(displayConsoleMessage(QString)));
// Resume unfinished torrents
BTSession->startUpTorrents();
QBtSession::instance()->startUpTorrents();
// Process command line parameters
processParams(torrentCmdLine);
// Display some information to the user
@@ -88,24 +87,21 @@ public slots:
foreach(QString param, params) {
param = param.trimmed();
if(param.startsWith(QString::fromUtf8("http://"), Qt::CaseInsensitive) || param.startsWith(QString::fromUtf8("ftp://"), Qt::CaseInsensitive) || param.startsWith(QString::fromUtf8("https://"), Qt::CaseInsensitive)) {
BTSession->downloadFromUrl(param);
QBtSession::instance()->downloadFromUrl(param);
}else{
if(param.startsWith("bc://bt/", Qt::CaseInsensitive)) {
qDebug("Converting bc link to magnet link");
param = misc::bcLinkToMagnet(param);
}
if(param.startsWith("magnet:", Qt::CaseInsensitive)) {
BTSession->addMagnetUri(param);
QBtSession::instance()->addMagnetUri(param);
} else {
BTSession->addTorrent(param);
QBtSession::instance()->addTorrent(param);
}
}
}
}
private:
QBtSession *BTSession;
};
#endif