diff --git a/Changelog b/Changelog index b7bd8d700..bf4431ca5 100644 --- a/Changelog +++ b/Changelog @@ -21,6 +21,7 @@ - COSMETIC: Display tracker errors in a cleaner way - COSMETIC: Display "unpaused/total_torrent" in download/upload tabs - COSMETIC: Allow to resize RSS column + - COSMETIC: Global UP/DL speeds and ratio are displayed above tabs * Fri Apr 11 2008 - Christophe Dumez - v1.0.0 - FEATURE: Based on new libtorrent v0.13 diff --git a/src/GUI.cpp b/src/GUI.cpp index 6f476039d..4a136cb58 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -107,6 +107,8 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis actionDelete_Permanently->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/delete_perm.png"))); actionTorrent_Properties->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/properties.png"))); actionCreate_torrent->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/new.png"))); + // Set default ratio + lbl_ratio_icon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/stare.png"))); // Fix Tool bar layout toolBar->layout()->setSpacing(7); // creating options @@ -129,7 +131,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis downloadingTorrentTab = new DownloadingTorrents(this, BTSession); tabs->addTab(downloadingTorrentTab, tr("Downloads") + QString::fromUtf8(" (0/0)")); tabs->setTabIcon(0, QIcon(QString::fromUtf8(":/Icons/skin/downloading.png"))); - vboxLayout->addWidget(tabs); + verticalLayout->addWidget(tabs); connect(downloadingTorrentTab, SIGNAL(unfinishedTorrentsNumberChanged(unsigned int)), this, SLOT(updateUnfinishedTorrentNumber(unsigned int))); connect(downloadingTorrentTab, SIGNAL(torrentDoubleClicked(QString, bool)), this, SLOT(torrentDoubleClicked(QString, bool))); // Finished torrents tab @@ -225,6 +227,32 @@ GUI::~GUI() { qDebug("5"); } +void GUI::updateRatio() { + // Update ratio info + float ratio = 1.; + session_status sessionStatus = BTSession->getSessionStatus(); + if(sessionStatus.total_payload_download == 0) { + if(sessionStatus.total_payload_upload == 0) + ratio = 1.; + else + ratio = 10.; + }else{ + ratio = (double)sessionStatus.total_payload_upload / (double)sessionStatus.total_payload_download; + if(ratio > 10.) + ratio = 10.; + } + LCD_Ratio->display(QString(QByteArray::number(ratio, 'f', 1))); + if(ratio < 0.5) { + lbl_ratio_icon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/unhappy.png"))); + }else{ + if(ratio > 1.0) { + lbl_ratio_icon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/smile.png"))); + }else{ + lbl_ratio_icon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/stare.png"))); + } + } +} + void GUI::on_actionWebsite_triggered() const { QDesktopServices::openUrl(QUrl(QString::fromUtf8("http://www.qbittorrent.org"))); } @@ -1232,6 +1260,9 @@ void GUI::on_actionTorrent_Properties_triggered() { } void GUI::updateLists() { + // update global informations + LCD_UpSpeed->display(QString(QByteArray::number(BTSession->getPayloadUploadRate()/1024., 'f', 1))); // UP LCD + LCD_DownSpeed->display(QString(QByteArray::number(BTSession->getPayloadDownloadRate()/1024., 'f', 1))); // DL LCD switch(getCurrentTabIndex()){ case 0: downloadingTorrentTab->updateDlList(); @@ -1261,8 +1292,7 @@ void GUI::trackerAuthenticationRequired(QTorrentHandle& h) { void GUI::checkConnectionStatus() { // qDebug("Checking connection status"); // Update Ratio - if(getCurrentTabIndex() == 0) - downloadingTorrentTab->updateRatio(); + updateRatio(); // update global informations if(systrayIntegration) { QString html = "
"; diff --git a/src/GUI.h b/src/GUI.h index 57457a440..22fc5c022 100644 --- a/src/GUI.h +++ b/src/GUI.h @@ -156,6 +156,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{ void setTabText(int index, QString text) const; void openDestinationFolder() const; void goBuyPage() const; + void updateRatio(); protected: void closeEvent(QCloseEvent *); diff --git a/src/MainWindow.ui b/src/MainWindow.ui index ee3a316f8..93203e9ea 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -16,13 +16,194 @@ - - - 6 - - - 9 - + + + 0 + 58 + 849 + 505 + + + + + + + 6 + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Total DL Speed: + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + true + + + QFrame::Raised + + + false + + + 6 + + + QLCDNumber::Flat + + + 0.000000000000000 + + + 0 + + + + + + + KiB/s + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Session ratio: + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + true + + + 4 + + + QLCDNumber::Flat + + + 1.000000000000000 + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Total UP Speed: + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + true + + + false + + + 6 + + + QLCDNumber::Flat + + + 0.000000000000000 + + + + + + + KiB/s + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + @@ -31,7 +212,7 @@ 0 0 849 - 29 + 26 @@ -82,6 +263,14 @@ true + + + 0 + 26 + 849 + 32 + + Qt::NoContextMenu @@ -98,7 +287,7 @@ - 4 + TopToolBarArea false diff --git a/src/download.ui b/src/download.ui index 63a606483..4d2ab6a77 100644 --- a/src/download.ui +++ b/src/download.ui @@ -18,206 +18,9 @@ 6 - + 0 - - 0 - - - 0 - - - 0 - - - - - 6 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Total DL Speed: - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - true - - - QFrame::Raised - - - false - - - 6 - - - QLCDNumber::Flat - - - 0.000000000000000 - - - 0 - - - - - - - KiB/s - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Session ratio: - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - true - - - 4 - - - QLCDNumber::Flat - - - 1.000000000000000 - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Total UP Speed: - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - true - - - false - - - 6 - - - QLCDNumber::Flat - - - 0.000000000000000 - - - - - - - KiB/s - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - @@ -260,6 +63,14 @@ 0 + + + 0 + 0 + 765 + 138 + + Log @@ -267,16 +78,7 @@ 6 - - 9 - - - 9 - - - 9 - - + 9 @@ -301,6 +103,14 @@ + + + 0 + 0 + 765 + 138 + + IP filter @@ -308,16 +118,7 @@ 6 - - 9 - - - 9 - - - 9 - - + 9 @@ -382,7 +183,8 @@ - :/Icons/folder.png + + :/Icons/folder.png:/Icons/folder.png Open destination folder @@ -430,12 +232,15 @@ - :/Icons/money.png + + :/Icons/money.png:/Icons/money.png Buy it + tabBottom + diff --git a/src/downloadingTorrents.cpp b/src/downloadingTorrents.cpp index 3dc8b6176..fd4346a3e 100644 --- a/src/downloadingTorrents.cpp +++ b/src/downloadingTorrents.cpp @@ -47,8 +47,6 @@ DownloadingTorrents::DownloadingTorrents(QObject *parent, bittorrent *BTSession) actionTorrent_Properties->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/properties.png"))); // tabBottom->setTabIcon(0, QIcon(QString::fromUtf8(":/Icons/log.png"))); // tabBottom->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/filter.png"))); - // Set default ratio - lbl_ratio_icon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/stare.png"))); // Set Download list model DLListModel = new QStandardItemModel(0,9); @@ -490,32 +488,6 @@ QStringList DownloadingTorrents::getSelectedTorrents(bool only_one) const{ return res; } -void DownloadingTorrents::updateRatio() { - // Update ratio info - float ratio = 1.; - session_status sessionStatus = BTSession->getSessionStatus(); - if(sessionStatus.total_payload_download == 0) { - if(sessionStatus.total_payload_upload == 0) - ratio = 1.; - else - ratio = 10.; - }else{ - ratio = (double)sessionStatus.total_payload_upload / (double)sessionStatus.total_payload_download; - if(ratio > 10.) - ratio = 10.; - } - LCD_Ratio->display(QString(QByteArray::number(ratio, 'f', 1))); - if(ratio < 0.5) { - lbl_ratio_icon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/unhappy.png"))); - }else{ - if(ratio > 1.0) { - lbl_ratio_icon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/smile.png"))); - }else{ - lbl_ratio_icon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/stare.png"))); - } - } -} - void DownloadingTorrents::displayInfoBarMenu(const QPoint& pos) { // Log Menu QMenu myLogMenu(this); @@ -534,9 +506,6 @@ void DownloadingTorrents::sortProgressColumnDelayed() { // get information from torrent handles and // update download list accordingly void DownloadingTorrents::updateDlList() { - // update global informations - LCD_UpSpeed->display(QString(QByteArray::number(BTSession->getPayloadUploadRate()/1024., 'f', 1))); // UP LCD - LCD_DownSpeed->display(QString(QByteArray::number(BTSession->getPayloadDownloadRate()/1024., 'f', 1))); // DL LCD // browse handles QStringList unfinishedTorrents = BTSession->getUnfinishedTorrents(); QString hash; diff --git a/src/downloadingTorrents.h b/src/downloadingTorrents.h index b57c23f4e..58b5ce0ad 100644 --- a/src/downloadingTorrents.h +++ b/src/downloadingTorrents.h @@ -100,7 +100,6 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{ void setInfoBar(QString info, QColor color=QApplication::palette().color(QPalette::WindowText)); void pauseTorrent(QString hash); void resumeTorrent(QString hash); - void updateRatio(); void deleteTorrent(QString hash); void setBottomTabEnabled(unsigned int index, bool b); void propertiesSelection();