|
|
@ -127,14 +127,14 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis |
|
|
|
tabs = new QTabWidget(); |
|
|
|
tabs = new QTabWidget(); |
|
|
|
// Download torrents tab
|
|
|
|
// Download torrents tab
|
|
|
|
downloadingTorrentTab = new DownloadingTorrents(this, BTSession); |
|
|
|
downloadingTorrentTab = new DownloadingTorrents(this, BTSession); |
|
|
|
tabs->addTab(downloadingTorrentTab, tr("Downloads") + QString::fromUtf8(" (0)")); |
|
|
|
tabs->addTab(downloadingTorrentTab, tr("Downloads") + QString::fromUtf8(" (0/0)")); |
|
|
|
tabs->setTabIcon(0, QIcon(QString::fromUtf8(":/Icons/skin/downloading.png"))); |
|
|
|
tabs->setTabIcon(0, QIcon(QString::fromUtf8(":/Icons/skin/downloading.png"))); |
|
|
|
vboxLayout->addWidget(tabs); |
|
|
|
vboxLayout->addWidget(tabs); |
|
|
|
connect(downloadingTorrentTab, SIGNAL(unfinishedTorrentsNumberChanged(unsigned int)), this, SLOT(updateUnfinishedTorrentNumber(unsigned int))); |
|
|
|
connect(downloadingTorrentTab, SIGNAL(unfinishedTorrentsNumberChanged(unsigned int)), this, SLOT(updateUnfinishedTorrentNumber(unsigned int))); |
|
|
|
connect(downloadingTorrentTab, SIGNAL(torrentDoubleClicked(QString, bool)), this, SLOT(torrentDoubleClicked(QString, bool))); |
|
|
|
connect(downloadingTorrentTab, SIGNAL(torrentDoubleClicked(QString, bool)), this, SLOT(torrentDoubleClicked(QString, bool))); |
|
|
|
// Finished torrents tab
|
|
|
|
// Finished torrents tab
|
|
|
|
finishedTorrentTab = new FinishedTorrents(this, BTSession); |
|
|
|
finishedTorrentTab = new FinishedTorrents(this, BTSession); |
|
|
|
tabs->addTab(finishedTorrentTab, tr("Finished") + QString::fromUtf8(" (0)")); |
|
|
|
tabs->addTab(finishedTorrentTab, tr("Finished") + QString::fromUtf8(" (0/0)")); |
|
|
|
tabs->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/skin/seeding.png"))); |
|
|
|
tabs->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/skin/seeding.png"))); |
|
|
|
connect(finishedTorrentTab, SIGNAL(torrentDoubleClicked(QString, bool)), this, SLOT(torrentDoubleClicked(QString, bool))); |
|
|
|
connect(finishedTorrentTab, SIGNAL(torrentDoubleClicked(QString, bool)), this, SLOT(torrentDoubleClicked(QString, bool))); |
|
|
|
|
|
|
|
|
|
|
@ -1021,11 +1021,13 @@ void GUI::configureSession(bool deleteOptions) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void GUI::updateUnfinishedTorrentNumber(unsigned int nb) { |
|
|
|
void GUI::updateUnfinishedTorrentNumber(unsigned int nb) { |
|
|
|
tabs->setTabText(0, tr("Downloads") +QString::fromUtf8(" (")+misc::toQString(nb)+QString::fromUtf8(")")); |
|
|
|
unsigned int paused = BTSession->getUnfinishedPausedTorrentsNb(); |
|
|
|
|
|
|
|
tabs->setTabText(0, tr("Downloads") +QString::fromUtf8(" (")+misc::toQString(nb-paused)+"/"+misc::toQString(nb)+QString::fromUtf8(")")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void GUI::updateFinishedTorrentNumber(unsigned int nb) { |
|
|
|
void GUI::updateFinishedTorrentNumber(unsigned int nb) { |
|
|
|
tabs->setTabText(1, tr("Finished") +QString::fromUtf8(" (")+misc::toQString(nb)+QString::fromUtf8(")")); |
|
|
|
unsigned int paused = BTSession->getFinishedPausedTorrentsNb(); |
|
|
|
|
|
|
|
tabs->setTabText(1, tr("Finished") +QString::fromUtf8(" (")+misc::toQString(nb-paused)+"/"+misc::toQString(nb)+QString::fromUtf8(")")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Allow to change action on double-click
|
|
|
|
// Allow to change action on double-click
|
|
|
@ -1072,15 +1074,19 @@ void GUI::togglePausedState(QString hash) { |
|
|
|
downloadingTorrentTab->setInfoBar(tr("'%1' resumed.", "e.g: xxx.avi resumed.").arg(h.name())); |
|
|
|
downloadingTorrentTab->setInfoBar(tr("'%1' resumed.", "e.g: xxx.avi resumed.").arg(h.name())); |
|
|
|
if(inDownloadList) { |
|
|
|
if(inDownloadList) { |
|
|
|
downloadingTorrentTab->resumeTorrent(hash); |
|
|
|
downloadingTorrentTab->resumeTorrent(hash); |
|
|
|
|
|
|
|
updateUnfinishedTorrentNumber(downloadingTorrentTab->getNbTorrentsInList()); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
finishedTorrentTab->resumeTorrent(hash); |
|
|
|
finishedTorrentTab->resumeTorrent(hash); |
|
|
|
|
|
|
|
updateFinishedTorrentNumber(finishedTorrentTab->getNbTorrentsInList()); |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
BTSession->pauseTorrent(hash); |
|
|
|
BTSession->pauseTorrent(hash); |
|
|
|
if(inDownloadList) { |
|
|
|
if(inDownloadList) { |
|
|
|
downloadingTorrentTab->pauseTorrent(hash); |
|
|
|
downloadingTorrentTab->pauseTorrent(hash); |
|
|
|
|
|
|
|
updateUnfinishedTorrentNumber(downloadingTorrentTab->getNbTorrentsInList()); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
finishedTorrentTab->pauseTorrent(hash); |
|
|
|
finishedTorrentTab->pauseTorrent(hash); |
|
|
|
|
|
|
|
updateFinishedTorrentNumber(finishedTorrentTab->getNbTorrentsInList()); |
|
|
|
} |
|
|
|
} |
|
|
|
downloadingTorrentTab->setInfoBar(tr("'%1' paused.", "xxx.avi paused.").arg(h.name())); |
|
|
|
downloadingTorrentTab->setInfoBar(tr("'%1' paused.", "xxx.avi paused.").arg(h.name())); |
|
|
|
} |
|
|
|
} |
|
|
@ -1104,8 +1110,11 @@ void GUI::on_actionPause_All_triggered() { |
|
|
|
finishedTorrentTab->pauseTorrent(hash); |
|
|
|
finishedTorrentTab->pauseTorrent(hash); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(change) |
|
|
|
if(change) { |
|
|
|
|
|
|
|
updateUnfinishedTorrentNumber(downloadingTorrentTab->getNbTorrentsInList()); |
|
|
|
|
|
|
|
updateFinishedTorrentNumber(finishedTorrentTab->getNbTorrentsInList()); |
|
|
|
downloadingTorrentTab->setInfoBar(tr("All downloads were paused.")); |
|
|
|
downloadingTorrentTab->setInfoBar(tr("All downloads were paused.")); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// pause selected items in the list
|
|
|
|
// pause selected items in the list
|
|
|
@ -1125,8 +1134,10 @@ void GUI::on_actionPause_triggered() { |
|
|
|
if(BTSession->pauseTorrent(hash)){ |
|
|
|
if(BTSession->pauseTorrent(hash)){ |
|
|
|
if(inDownloadList) { |
|
|
|
if(inDownloadList) { |
|
|
|
downloadingTorrentTab->pauseTorrent(hash); |
|
|
|
downloadingTorrentTab->pauseTorrent(hash); |
|
|
|
|
|
|
|
updateUnfinishedTorrentNumber(downloadingTorrentTab->getNbTorrentsInList()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
finishedTorrentTab->pauseTorrent(hash); |
|
|
|
finishedTorrentTab->pauseTorrent(hash); |
|
|
|
|
|
|
|
updateFinishedTorrentNumber(finishedTorrentTab->getNbTorrentsInList()); |
|
|
|
} |
|
|
|
} |
|
|
|
downloadingTorrentTab->setInfoBar(tr("'%1' paused.", "xxx.avi paused.").arg(BTSession->getTorrentHandle(hash).name())); |
|
|
|
downloadingTorrentTab->setInfoBar(tr("'%1' paused.", "xxx.avi paused.").arg(BTSession->getTorrentHandle(hash).name())); |
|
|
|
} |
|
|
|
} |
|
|
@ -1136,6 +1147,8 @@ void GUI::on_actionPause_triggered() { |
|
|
|
void GUI::pauseTorrent(QString hash) { |
|
|
|
void GUI::pauseTorrent(QString hash) { |
|
|
|
downloadingTorrentTab->pauseTorrent(hash); |
|
|
|
downloadingTorrentTab->pauseTorrent(hash); |
|
|
|
finishedTorrentTab->pauseTorrent(hash); |
|
|
|
finishedTorrentTab->pauseTorrent(hash); |
|
|
|
|
|
|
|
updateUnfinishedTorrentNumber(downloadingTorrentTab->getNbTorrentsInList()); |
|
|
|
|
|
|
|
updateFinishedTorrentNumber(finishedTorrentTab->getNbTorrentsInList()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Resume All Downloads in DL list
|
|
|
|
// Resume All Downloads in DL list
|
|
|
@ -1156,8 +1169,11 @@ void GUI::on_actionStart_All_triggered() { |
|
|
|
finishedTorrentTab->resumeTorrent(hash); |
|
|
|
finishedTorrentTab->resumeTorrent(hash); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(change) |
|
|
|
if(change) { |
|
|
|
|
|
|
|
updateUnfinishedTorrentNumber(downloadingTorrentTab->getNbTorrentsInList()); |
|
|
|
|
|
|
|
updateFinishedTorrentNumber(finishedTorrentTab->getNbTorrentsInList()); |
|
|
|
downloadingTorrentTab->setInfoBar(tr("All downloads were resumed.")); |
|
|
|
downloadingTorrentTab->setInfoBar(tr("All downloads were resumed.")); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// start selected items in the list
|
|
|
|
// start selected items in the list
|
|
|
@ -1177,8 +1193,10 @@ void GUI::on_actionStart_triggered() { |
|
|
|
if(BTSession->resumeTorrent(hash)){ |
|
|
|
if(BTSession->resumeTorrent(hash)){ |
|
|
|
if(inDownloadList) { |
|
|
|
if(inDownloadList) { |
|
|
|
downloadingTorrentTab->resumeTorrent(hash); |
|
|
|
downloadingTorrentTab->resumeTorrent(hash); |
|
|
|
|
|
|
|
updateUnfinishedTorrentNumber(downloadingTorrentTab->getNbTorrentsInList()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
finishedTorrentTab->resumeTorrent(hash); |
|
|
|
finishedTorrentTab->resumeTorrent(hash); |
|
|
|
|
|
|
|
updateFinishedTorrentNumber(finishedTorrentTab->getNbTorrentsInList()); |
|
|
|
} |
|
|
|
} |
|
|
|
downloadingTorrentTab->setInfoBar(tr("'%1' resumed.", "e.g: xxx.avi resumed.").arg(BTSession->getTorrentHandle(hash).name())); |
|
|
|
downloadingTorrentTab->setInfoBar(tr("'%1' resumed.", "e.g: xxx.avi resumed.").arg(BTSession->getTorrentHandle(hash).name())); |
|
|
|
} |
|
|
|
} |
|
|
|