|
|
@ -205,9 +205,6 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis |
|
|
|
checkConnect->start(5000); |
|
|
|
checkConnect->start(5000); |
|
|
|
// Accept drag 'n drops
|
|
|
|
// Accept drag 'n drops
|
|
|
|
setAcceptDrops(true); |
|
|
|
setAcceptDrops(true); |
|
|
|
if(!settings.value(QString::fromUtf8("Preferences/General/StartMinimized"), false).toBool()) { |
|
|
|
|
|
|
|
show(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
createKeyboardShortcuts(); |
|
|
|
createKeyboardShortcuts(); |
|
|
|
connecStatusLblIcon = new QLabel(); |
|
|
|
connecStatusLblIcon = new QLabel(); |
|
|
|
connecStatusLblIcon->setFrameShape(QFrame::NoFrame); |
|
|
|
connecStatusLblIcon->setFrameShape(QFrame::NoFrame); |
|
|
@ -238,6 +235,9 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis |
|
|
|
QMainWindow::statusBar()->addPermanentWidget(upSpeedLbl); |
|
|
|
QMainWindow::statusBar()->addPermanentWidget(upSpeedLbl); |
|
|
|
QMainWindow::statusBar()->addPermanentWidget(statusSep4); |
|
|
|
QMainWindow::statusBar()->addPermanentWidget(statusSep4); |
|
|
|
QMainWindow::statusBar()->addPermanentWidget(ratioLbl); |
|
|
|
QMainWindow::statusBar()->addPermanentWidget(ratioLbl); |
|
|
|
|
|
|
|
if(!settings.value(QString::fromUtf8("Preferences/General/StartMinimized"), false).toBool()) { |
|
|
|
|
|
|
|
show(); |
|
|
|
|
|
|
|
} |
|
|
|
qDebug("GUI Built"); |
|
|
|
qDebug("GUI Built"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -621,6 +621,12 @@ void GUI::on_actionAbout_triggered() { |
|
|
|
new about(this); |
|
|
|
new about(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void GUI::showEvent(QShowEvent *e) { |
|
|
|
|
|
|
|
qDebug("** Show Event **"); |
|
|
|
|
|
|
|
updateLists(true); |
|
|
|
|
|
|
|
e->accept(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Called when we close the program
|
|
|
|
// Called when we close the program
|
|
|
|
void GUI::closeEvent(QCloseEvent *e) { |
|
|
|
void GUI::closeEvent(QCloseEvent *e) { |
|
|
|
|
|
|
|
|
|
|
@ -1338,28 +1344,30 @@ void GUI::on_actionTorrent_Properties_triggered() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void GUI::updateLists() { |
|
|
|
void GUI::updateLists(bool force) { |
|
|
|
// update global informations
|
|
|
|
if(isVisible() || force) { |
|
|
|
dlSpeedLbl->setText(tr("DL: %1 KiB/s").arg(QString(QByteArray::number(BTSession->getPayloadDownloadRate()/1024., 'f', 1)))); |
|
|
|
// update global informations
|
|
|
|
upSpeedLbl->setText(tr("UP: %1 KiB/s").arg(QString(QByteArray::number(BTSession->getPayloadUploadRate()/1024., 'f', 1)))); |
|
|
|
dlSpeedLbl->setText(tr("DL: %1 KiB/s").arg(QString(QByteArray::number(BTSession->getPayloadDownloadRate()/1024., 'f', 1)))); |
|
|
|
std::vector<torrent_handle> torrents = BTSession->getTorrents(); |
|
|
|
upSpeedLbl->setText(tr("UP: %1 KiB/s").arg(QString(QByteArray::number(BTSession->getPayloadUploadRate()/1024., 'f', 1)))); |
|
|
|
std::vector<torrent_handle>::iterator torrentIT; |
|
|
|
std::vector<torrent_handle> torrents = BTSession->getTorrents(); |
|
|
|
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) { |
|
|
|
std::vector<torrent_handle>::iterator torrentIT; |
|
|
|
QTorrentHandle h = QTorrentHandle(*torrentIT); |
|
|
|
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) { |
|
|
|
if(!h.is_valid()) continue; |
|
|
|
QTorrentHandle h = QTorrentHandle(*torrentIT); |
|
|
|
if(h.is_seed()) { |
|
|
|
if(!h.is_valid()) continue; |
|
|
|
// Update in finished list
|
|
|
|
if(h.is_seed()) { |
|
|
|
finishedTorrentTab->updateTorrent(h); |
|
|
|
// Update in finished list
|
|
|
|
} else { |
|
|
|
finishedTorrentTab->updateTorrent(h); |
|
|
|
// Delete from finished list, if it moved back
|
|
|
|
} else { |
|
|
|
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+h.hash()+".finished")) { |
|
|
|
// Delete from finished list, if it moved back
|
|
|
|
if(h.state() != torrent_status::checking_files && h.state() != torrent_status::queued_for_checking) { |
|
|
|
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+h.hash()+".finished")) { |
|
|
|
finishedTorrentTab->deleteTorrent(h.hash()); |
|
|
|
if(h.state() != torrent_status::checking_files && h.state() != torrent_status::queued_for_checking) { |
|
|
|
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+h.hash()+".finished"); |
|
|
|
finishedTorrentTab->deleteTorrent(h.hash()); |
|
|
|
|
|
|
|
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+h.hash()+".finished"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Update in download list
|
|
|
|
|
|
|
|
downloadingTorrentTab->updateTorrent(h); |
|
|
|
} |
|
|
|
} |
|
|
|
// Update in download list
|
|
|
|
|
|
|
|
downloadingTorrentTab->updateTorrent(h); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(displaySpeedInTitle) { |
|
|
|
if(displaySpeedInTitle) { |
|
|
|