Browse Source

COSMETIC: Display number of torrents in transfers tab label

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
defd77b94c
  1. 1
      Changelog
  2. 7
      src/GUI.cpp
  3. 1
      src/GUI.h
  4. 8
      src/transferlistwidget.cpp
  5. 2
      src/transferlistwidget.h

1
Changelog

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
- FEATURE: Added "No action" setting for double-click action
- FEATURE: Several torrents can be moved at once
- COSMETIC: Display peers country name in tooltip
- COSMETIC: Display number of torrents in transfers tab label
* Sun Mar 14 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.2.0
- FEATURE: User can set alternative speed limits for fast toggling

7
src/GUI.cpp

@ -143,6 +143,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis @@ -143,6 +143,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
vSplitter->setCollapsible(0, true);
vSplitter->setCollapsible(1, false);
tabs->addTab(vSplitter, QIcon(QString::fromUtf8(":/Icons/oxygen/folder-remote.png")), tr("Transfers"));
connect(transferList, SIGNAL(torrentStatusUpdate(uint,uint,uint,uint)), this, SLOT(updateNbTorrents(uint,uint,uint,uint)));
vboxLayout->addWidget(tabs);
// Transfer list slots
@ -295,6 +296,12 @@ void GUI::displayRSSTab(bool enable) { @@ -295,6 +296,12 @@ void GUI::displayRSSTab(bool enable) {
}
}
void GUI::updateNbTorrents(unsigned int nb_downloading, unsigned int nb_seeding, unsigned int nb_active, unsigned int nb_inactive) {
Q_UNUSED(nb_downloading);
Q_UNUSED(nb_seeding);
tabs->setTabText(0, tr("Transfers (%1)").arg(QString::number(nb_inactive+nb_active)));
}
void GUI::on_actionWebsite_triggered() const {
QDesktopServices::openUrl(QUrl(QString::fromUtf8("http://www.qbittorrent.org")));
}

1
src/GUI.h

@ -77,6 +77,7 @@ public slots: @@ -77,6 +77,7 @@ public slots:
void showNotificationBaloon(QString title, QString msg) const;
void downloadFromURLList(const QStringList& urls);
void updateAltSpeedsBtn(bool alternative);
void updateNbTorrents(unsigned int nb_downloading, unsigned int nb_seeding, unsigned int nb_active, unsigned int nb_inactive);
protected slots:
// GUI related slots

8
src/transferlistwidget.cpp

@ -209,7 +209,7 @@ void TransferListWidget::addTorrent(QTorrentHandle& h) { @@ -209,7 +209,7 @@ void TransferListWidget::addTorrent(QTorrentHandle& h) {
// Emit signal
emit torrentAdded(listModel->index(row, 0));
// Refresh the list
refreshList();
refreshList(true);
} catch(invalid_handle e) {
// Remove added torrent
listModel->removeRow(row);
@ -235,7 +235,7 @@ void TransferListWidget::deleteTorrent(int row, bool refresh_list) { @@ -235,7 +235,7 @@ void TransferListWidget::deleteTorrent(int row, bool refresh_list) {
emit torrentAboutToBeRemoved(index);
listModel->removeRow(row);
if(refresh_list)
refreshList();
refreshList(true);
}
// Wrapper slot for bittorrent signal
@ -475,11 +475,11 @@ void TransferListWidget::setRefreshInterval(int t) { @@ -475,11 +475,11 @@ void TransferListWidget::setRefreshInterval(int t) {
refreshTimer->start(t);
}
void TransferListWidget::refreshList() {
void TransferListWidget::refreshList(bool force) {
// Stop updating the display
setUpdatesEnabled(false);
// Refresh only if displayed
if(main_window->getCurrentTabIndex() != TAB_TRANSFER) return;
if(!force && main_window->getCurrentTabIndex() != TAB_TRANSFER) return;
unsigned int nb_downloading = 0, nb_seeding=0, nb_active=0, nb_inactive = 0;
if(BTSession->getSession()->get_torrents().size() != (uint)listModel->rowCount()) {
// Oups, we have torrents that are not displayed, fix that

2
src/transferlistwidget.h

@ -53,7 +53,7 @@ public: @@ -53,7 +53,7 @@ public:
QStandardItemModel* getSourceModel() const;
public slots:
void refreshList();
void refreshList(bool force=false);
void addTorrent(QTorrentHandle& h);
void pauseTorrent(QTorrentHandle &h);
void setFinished(QTorrentHandle &h);

Loading…
Cancel
Save