mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-25 22:14:32 +00:00
commit
475aa6aad8
BIN
src/Icons/oxygen/office-chart-bar.png
Normal file
BIN
src/Icons/oxygen/office-chart-bar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
@ -294,6 +294,7 @@
|
|||||||
<file>Icons/oxygen/network-server.png</file>
|
<file>Icons/oxygen/network-server.png</file>
|
||||||
<file>Icons/oxygen/network-wired.png</file>
|
<file>Icons/oxygen/network-wired.png</file>
|
||||||
<file>Icons/oxygen/object-locked.png</file>
|
<file>Icons/oxygen/object-locked.png</file>
|
||||||
|
<file>Icons/oxygen/office-chart-bar.png</file>
|
||||||
<file>Icons/oxygen/preferences-desktop.png</file>
|
<file>Icons/oxygen/preferences-desktop.png</file>
|
||||||
<file>Icons/oxygen/preferences-other.png</file>
|
<file>Icons/oxygen/preferences-other.png</file>
|
||||||
<file>Icons/oxygen/preferences-system-network.png</file>
|
<file>Icons/oxygen/preferences-system-network.png</file>
|
||||||
|
@ -123,6 +123,7 @@ MainWindow::MainWindow(QWidget *parent, const QStringList& torrentCmdLine) : QMa
|
|||||||
actionSet_global_download_limit->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/download.png")));
|
actionSet_global_download_limit->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/download.png")));
|
||||||
actionCreate_torrent->setIcon(IconProvider::instance()->getIcon("document-edit"));
|
actionCreate_torrent->setIcon(IconProvider::instance()->getIcon("document-edit"));
|
||||||
actionAbout->setIcon(IconProvider::instance()->getIcon("help-about"));
|
actionAbout->setIcon(IconProvider::instance()->getIcon("help-about"));
|
||||||
|
actionStatistics->setIcon(IconProvider::instance()->getIcon("office-chart-bar"));
|
||||||
actionBugReport->setIcon(IconProvider::instance()->getIcon("tools-report-bug"));
|
actionBugReport->setIcon(IconProvider::instance()->getIcon("tools-report-bug"));
|
||||||
actionDecreasePriority->setIcon(IconProvider::instance()->getIcon("go-down"));
|
actionDecreasePriority->setIcon(IconProvider::instance()->getIcon("go-down"));
|
||||||
actionDelete->setIcon(IconProvider::instance()->getIcon("list-remove"));
|
actionDelete->setIcon(IconProvider::instance()->getIcon("list-remove"));
|
||||||
@ -361,6 +362,8 @@ MainWindow::~MainWindow() {
|
|||||||
delete m_executionLog;
|
delete m_executionLog;
|
||||||
if (aboutDlg)
|
if (aboutDlg)
|
||||||
delete aboutDlg;
|
delete aboutDlg;
|
||||||
|
if (statsDlg)
|
||||||
|
delete statsDlg;
|
||||||
if (options)
|
if (options)
|
||||||
delete options;
|
delete options;
|
||||||
if (downloadFromURLDialog)
|
if (downloadFromURLDialog)
|
||||||
@ -740,6 +743,13 @@ void MainWindow::on_actionAbout_triggered() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionStatistics_triggered() {
|
||||||
|
if (statsDlg)
|
||||||
|
statsDlg->setFocus();
|
||||||
|
else
|
||||||
|
statsDlg = new StatsDialog(this);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::showEvent(QShowEvent *e) {
|
void MainWindow::showEvent(QShowEvent *e) {
|
||||||
qDebug("** Show Event **");
|
qDebug("** Show Event **");
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
#include "qtorrenthandle.h"
|
#include "qtorrenthandle.h"
|
||||||
|
#include "statsdialog.h"
|
||||||
|
|
||||||
class QBtSession;
|
class QBtSession;
|
||||||
class downloadFromURL;
|
class downloadFromURL;
|
||||||
@ -93,6 +94,7 @@ protected slots:
|
|||||||
void dragEnterEvent(QDragEnterEvent *event);
|
void dragEnterEvent(QDragEnterEvent *event);
|
||||||
void toggleVisibility(QSystemTrayIcon::ActivationReason e = QSystemTrayIcon::Trigger);
|
void toggleVisibility(QSystemTrayIcon::ActivationReason e = QSystemTrayIcon::Trigger);
|
||||||
void on_actionAbout_triggered();
|
void on_actionAbout_triggered();
|
||||||
|
void on_actionStatistics_triggered();
|
||||||
void on_actionCreate_torrent_triggered();
|
void on_actionCreate_torrent_triggered();
|
||||||
void on_actionWebsite_triggered() const;
|
void on_actionWebsite_triggered() const;
|
||||||
void on_actionBugReport_triggered() const;
|
void on_actionBugReport_triggered() const;
|
||||||
@ -165,6 +167,7 @@ private:
|
|||||||
QPointer<options_imp> options;
|
QPointer<options_imp> options;
|
||||||
QPointer<consoleDlg> console;
|
QPointer<consoleDlg> console;
|
||||||
QPointer<about> aboutDlg;
|
QPointer<about> aboutDlg;
|
||||||
|
QPointer<StatsDialog> statsDlg;
|
||||||
QPointer<TorrentCreatorDlg> createTorrentDlg;
|
QPointer<TorrentCreatorDlg> createTorrentDlg;
|
||||||
QPointer<downloadFromURL> downloadFromURLDialog;
|
QPointer<downloadFromURL> downloadFromURLDialog;
|
||||||
QPointer<QSystemTrayIcon> systrayIcon;
|
QPointer<QSystemTrayIcon> systrayIcon;
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionOptions"/>
|
<addaction name="actionOptions"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionStatistics"/>
|
||||||
<addaction name="menuAuto_Shutdown_on_downloads_completion"/>
|
<addaction name="menuAuto_Shutdown_on_downloads_completion"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menu_File">
|
<widget class="QMenu" name="menu_File">
|
||||||
@ -375,6 +376,11 @@
|
|||||||
<string notr="true">Minimize</string>
|
<string notr="true">Minimize</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionStatistics">
|
||||||
|
<property name="text">
|
||||||
|
<string>Statistics</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="icons.qrc"/>
|
<include location="icons.qrc"/>
|
||||||
|
@ -2781,6 +2781,14 @@ qlonglong QBtSession::getETA(const QString &hash) const
|
|||||||
return m_speedMonitor->getETA(hash);
|
return m_speedMonitor->getETA(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quint64 QBtSession::getAlltimeDL() const {
|
||||||
|
return m_speedMonitor->getAlltimeDL();
|
||||||
|
}
|
||||||
|
|
||||||
|
quint64 QBtSession::getAlltimeUL() const {
|
||||||
|
return m_speedMonitor->getAlltimeUL();
|
||||||
|
}
|
||||||
|
|
||||||
void QBtSession::handleIPFilterParsed(int ruleCount)
|
void QBtSession::handleIPFilterParsed(int ruleCount)
|
||||||
{
|
{
|
||||||
addConsoleMessage(tr("Successfully parsed the provided IP filter: %1 rules were applied.", "%1 is a number").arg(ruleCount));
|
addConsoleMessage(tr("Successfully parsed the provided IP filter: %1 rules were applied.", "%1 is a number").arg(ruleCount));
|
||||||
|
@ -107,6 +107,8 @@ public:
|
|||||||
inline bool isLSDEnabled() const { return LSDEnabled; }
|
inline bool isLSDEnabled() const { return LSDEnabled; }
|
||||||
inline bool isPexEnabled() const { return PeXEnabled; }
|
inline bool isPexEnabled() const { return PeXEnabled; }
|
||||||
inline bool isQueueingEnabled() const { return queueingEnabled; }
|
inline bool isQueueingEnabled() const { return queueingEnabled; }
|
||||||
|
quint64 getAlltimeDL() const;
|
||||||
|
quint64 getAlltimeUL() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
QTorrentHandle addTorrent(QString path, bool fromScanDir = false, QString from_url = QString(), bool resumed = false);
|
QTorrentHandle addTorrent(QString path, bool fromScanDir = false, QString from_url = QString(), bool resumed = false);
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "qbtsession.h"
|
#include "qbtsession.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "torrentspeedmonitor.h"
|
#include "torrentspeedmonitor.h"
|
||||||
|
#include "qinisettings.h"
|
||||||
|
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
@ -64,12 +65,14 @@ TorrentSpeedMonitor::TorrentSpeedMonitor(QBtSession* session) :
|
|||||||
{
|
{
|
||||||
connect(m_session, SIGNAL(deletedTorrent(QString)), SLOT(removeSamples(QString)));
|
connect(m_session, SIGNAL(deletedTorrent(QString)), SLOT(removeSamples(QString)));
|
||||||
connect(m_session, SIGNAL(pausedTorrent(QTorrentHandle)), SLOT(removeSamples(QTorrentHandle)));
|
connect(m_session, SIGNAL(pausedTorrent(QTorrentHandle)), SLOT(removeSamples(QTorrentHandle)));
|
||||||
|
loadStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
TorrentSpeedMonitor::~TorrentSpeedMonitor() {
|
TorrentSpeedMonitor::~TorrentSpeedMonitor() {
|
||||||
m_abort = true;
|
m_abort = true;
|
||||||
m_abortCond.wakeOne();
|
m_abortCond.wakeOne();
|
||||||
wait();
|
wait();
|
||||||
|
saveStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentSpeedMonitor::run()
|
void TorrentSpeedMonitor::run()
|
||||||
@ -77,6 +80,7 @@ void TorrentSpeedMonitor::run()
|
|||||||
do {
|
do {
|
||||||
m_mutex.lock();
|
m_mutex.lock();
|
||||||
getSamples();
|
getSamples();
|
||||||
|
saveStats();
|
||||||
m_abortCond.wait(&m_mutex, 1000);
|
m_abortCond.wait(&m_mutex, 1000);
|
||||||
m_mutex.unlock();
|
m_mutex.unlock();
|
||||||
} while(!m_abort);
|
} while(!m_abort);
|
||||||
@ -153,6 +157,16 @@ qlonglong TorrentSpeedMonitor::getETA(const QString &hash) const
|
|||||||
return (h.total_wanted() - h.total_wanted_done()) / speed_average.download;
|
return (h.total_wanted() - h.total_wanted_done()) / speed_average.download;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quint64 TorrentSpeedMonitor::getAlltimeDL() const {
|
||||||
|
QMutexLocker l(&m_mutex);
|
||||||
|
return alltimeDL;
|
||||||
|
}
|
||||||
|
|
||||||
|
quint64 TorrentSpeedMonitor::getAlltimeUL() const {
|
||||||
|
QMutexLocker l(&m_mutex);
|
||||||
|
return alltimeUL;
|
||||||
|
}
|
||||||
|
|
||||||
void TorrentSpeedMonitor::getSamples()
|
void TorrentSpeedMonitor::getSamples()
|
||||||
{
|
{
|
||||||
const std::vector<torrent_handle> torrents = m_session->getSession()->get_torrents();
|
const std::vector<torrent_handle> torrents = m_session->getSession()->get_torrents();
|
||||||
@ -163,8 +177,27 @@ void TorrentSpeedMonitor::getSamples()
|
|||||||
try {
|
try {
|
||||||
torrent_status st = it->status(0x0);
|
torrent_status st = it->status(0x0);
|
||||||
if (!st.paused) {
|
if (!st.paused) {
|
||||||
m_samples[misc::toQString(it->info_hash())].addSample(st.download_payload_rate, st.upload_payload_rate);
|
int up = st.upload_payload_rate;
|
||||||
|
int down = st.download_payload_rate;
|
||||||
|
m_samples[misc::toQString(it->info_hash())].addSample(down, up);
|
||||||
|
alltimeDL += down;
|
||||||
|
alltimeUL += up;
|
||||||
}
|
}
|
||||||
} catch(invalid_handle&) {}
|
} catch(invalid_handle&) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TorrentSpeedMonitor::saveStats() const {
|
||||||
|
QIniSettings s;
|
||||||
|
QVariantHash v;
|
||||||
|
v.insert("AlltimeDL", alltimeDL);
|
||||||
|
v.insert("AlltimeUL", alltimeUL);
|
||||||
|
s.setValue("Stats/AllStats", v);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TorrentSpeedMonitor::loadStats() {
|
||||||
|
QIniSettings s;
|
||||||
|
QVariantHash v(s.value("Stats/AllStats", QVariantHash()).toHash());
|
||||||
|
alltimeDL = v["AlltimeDL"].toULongLong();
|
||||||
|
alltimeUL = v["AlltimeUL"].toULongLong();
|
||||||
|
}
|
||||||
|
@ -49,26 +49,30 @@ public:
|
|||||||
explicit TorrentSpeedMonitor(QBtSession* session);
|
explicit TorrentSpeedMonitor(QBtSession* session);
|
||||||
~TorrentSpeedMonitor();
|
~TorrentSpeedMonitor();
|
||||||
qlonglong getETA(const QString &hash) const;
|
qlonglong getETA(const QString &hash) const;
|
||||||
|
quint64 getAlltimeDL() const;
|
||||||
|
quint64 getAlltimeUL() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void getSamples();
|
void getSamples();
|
||||||
|
void saveStats() const;
|
||||||
|
void loadStats();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void removeSamples(const QString& hash);
|
void removeSamples(const QString& hash);
|
||||||
void removeSamples(const QTorrentHandle& h);
|
void removeSamples(const QTorrentHandle& h);
|
||||||
|
|
||||||
private:
|
|
||||||
static const int sampling_interval = 1000; // 1s
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_abort;
|
bool m_abort;
|
||||||
QWaitCondition m_abortCond;
|
QWaitCondition m_abortCond;
|
||||||
QHash<QString, SpeedSample> m_samples;
|
QHash<QString, SpeedSample> m_samples;
|
||||||
mutable QMutex m_mutex;
|
mutable QMutex m_mutex;
|
||||||
QBtSession *m_session;
|
QBtSession *m_session;
|
||||||
|
// Will overflow at 15.9 EiB
|
||||||
|
quint64 alltimeUL;
|
||||||
|
quint64 alltimeDL;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TORRENTSPEEDMONITOR_H
|
#endif // TORRENTSPEEDMONITOR_H
|
||||||
|
@ -149,7 +149,8 @@ nox {
|
|||||||
updownratiodlg.h \
|
updownratiodlg.h \
|
||||||
loglistwidget.h \
|
loglistwidget.h \
|
||||||
addnewtorrentdialog.h \
|
addnewtorrentdialog.h \
|
||||||
autoexpandabledialog.h
|
autoexpandabledialog.h \
|
||||||
|
statsdialog.h
|
||||||
|
|
||||||
SOURCES += mainwindow.cpp \
|
SOURCES += mainwindow.cpp \
|
||||||
ico.cpp \
|
ico.cpp \
|
||||||
@ -167,7 +168,8 @@ nox {
|
|||||||
updownratiodlg.cpp \
|
updownratiodlg.cpp \
|
||||||
loglistwidget.cpp \
|
loglistwidget.cpp \
|
||||||
addnewtorrentdialog.cpp \
|
addnewtorrentdialog.cpp \
|
||||||
autoexpandabledialog.cpp
|
autoexpandabledialog.cpp \
|
||||||
|
statsdialog.cpp
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
HEADERS += programupdater.h
|
HEADERS += programupdater.h
|
||||||
@ -193,7 +195,8 @@ nox {
|
|||||||
torrentimportdlg.ui \
|
torrentimportdlg.ui \
|
||||||
executionlog.ui \
|
executionlog.ui \
|
||||||
addnewtorrentdialog.ui \
|
addnewtorrentdialog.ui \
|
||||||
autoexpandabledialog.ui
|
autoexpandabledialog.ui \
|
||||||
|
statsdialog.ui
|
||||||
}
|
}
|
||||||
|
|
||||||
DESTDIR = .
|
DESTDIR = .
|
||||||
|
109
src/statsdialog.cpp
Normal file
109
src/statsdialog.cpp
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
/*
|
||||||
|
* Bittorrent Client using Qt4 and libtorrent.
|
||||||
|
* Copyright (C) 2013 Nick Tiskov
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* In addition, as a special exception, the copyright holders give permission to
|
||||||
|
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
||||||
|
* modified versions of it that use the same license as the "OpenSSL" library),
|
||||||
|
* and distribute the linked executables. You must obey the GNU General Public
|
||||||
|
* License in all respects for all of the code used other than "OpenSSL". If you
|
||||||
|
* modify file(s), you may extend this exception to your version of the file(s),
|
||||||
|
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||||
|
* exception statement from your version.
|
||||||
|
*
|
||||||
|
* Contact : daymansmail@gmail.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "statsdialog.h"
|
||||||
|
#include "ui_statsdialog.h"
|
||||||
|
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
|
StatsDialog::StatsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::StatsDialog) {
|
||||||
|
ui->setupUi(this);
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
connect(ui->buttonOK, SIGNAL(clicked()), SLOT(close()));
|
||||||
|
session = QBtSession::instance();
|
||||||
|
updateUI();
|
||||||
|
t = new QTimer(this);
|
||||||
|
t->setInterval(1500);
|
||||||
|
connect(t, SIGNAL(timeout()), SLOT(updateUI()));
|
||||||
|
t->start();
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
|
||||||
|
StatsDialog::~StatsDialog() {
|
||||||
|
t->stop();
|
||||||
|
delete t;
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void StatsDialog::updateUI() {
|
||||||
|
libtorrent::session* s = session->getSession();
|
||||||
|
libtorrent::cache_status cache = s->get_cache_status();
|
||||||
|
libtorrent::session_status ss = s->status();
|
||||||
|
|
||||||
|
// Alltime DL/UL
|
||||||
|
quint64 atd = session->getAlltimeDL();
|
||||||
|
quint64 atu = session->getAlltimeUL();
|
||||||
|
ui->labelAlltimeDL->setText(misc::friendlyUnit(atd));
|
||||||
|
ui->labelAlltimeUL->setText(misc::friendlyUnit(atu));
|
||||||
|
// Total waste (this session)
|
||||||
|
ui->labelWaste->setText(misc::friendlyUnit(ss.total_redundant_bytes + ss.total_failed_bytes));
|
||||||
|
// Global ratio
|
||||||
|
ui->labelGlobalRatio->setText(
|
||||||
|
( atd > 0 && atu > 0 ) ?
|
||||||
|
QString::number( (qreal)atu / (qreal)atd, 'f', 2) :
|
||||||
|
"-"
|
||||||
|
);
|
||||||
|
// Cache hits
|
||||||
|
ui->labelCacheHits->setText(
|
||||||
|
( cache.blocks_read > 0 && cache.blocks_read_hit > 0 ) ?
|
||||||
|
QString("%L1\%").arg(100. * (qreal)cache.blocks_read_hit / (qreal)cache.blocks_read, 0, 'f', 2) :
|
||||||
|
"-"
|
||||||
|
);
|
||||||
|
// Buffers size
|
||||||
|
ui->labelTotalBuf->setText(misc::friendlyUnit(cache.total_used_buffers * 16 * 1024));
|
||||||
|
// Disk overload (100%) equivalent
|
||||||
|
// From lt manual: disk_write_queue and disk_read_queue are the number of peers currently waiting on a disk write or disk read
|
||||||
|
// to complete before it receives or sends any more data on the socket. It'a a metric of how disk bound you are.
|
||||||
|
|
||||||
|
// num_peers is not reliable (adds up peers, which didn't even overcome tcp handshake)
|
||||||
|
const std::vector<libtorrent::torrent_handle> torrents = session->getTorrents();
|
||||||
|
std::vector<libtorrent::torrent_handle>::const_iterator iBegin = torrents.begin();
|
||||||
|
std::vector<libtorrent::torrent_handle>::const_iterator iEnd = torrents.begin();
|
||||||
|
quint32 peers = 0;
|
||||||
|
for ( ; iBegin < iEnd ; ++iBegin)
|
||||||
|
peers += (*iBegin).status().num_peers;
|
||||||
|
ui->labelWriteStarve->setText(
|
||||||
|
( ss.disk_write_queue > 0 && peers > 0 ) ?
|
||||||
|
QString("%L1\%").arg(100. * (qreal)ss.disk_write_queue / (qreal)peers, 0, 'f', 2) :
|
||||||
|
QString("0\%")
|
||||||
|
);
|
||||||
|
ui->labelReadStarve->setText(
|
||||||
|
( ss.disk_read_queue > 0 && peers > 0 ) ?
|
||||||
|
QString("%L1\%").arg(100. * (qreal)ss.disk_read_queue / (qreal)peers, 0, 'f', 2) :
|
||||||
|
QString("0\%")
|
||||||
|
);
|
||||||
|
// Disk queues
|
||||||
|
ui->labelQueuedJobs->setText(QString::number(cache.job_queue_length));
|
||||||
|
ui->labelJobsTime->setText(QString::number(cache.average_job_time));
|
||||||
|
ui->labelQueuedBytes->setText(misc::friendlyUnit(cache.queued_bytes));
|
||||||
|
|
||||||
|
// Total connected peers
|
||||||
|
ui->labelPeers->setText(QString::number(ss.num_peers));
|
||||||
|
}
|
58
src/statsdialog.h
Normal file
58
src/statsdialog.h
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Bittorrent Client using Qt4 and libtorrent.
|
||||||
|
* Copyright (C) 2013 Nick Tiskov
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* In addition, as a special exception, the copyright holders give permission to
|
||||||
|
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
||||||
|
* modified versions of it that use the same license as the "OpenSSL" library),
|
||||||
|
* and distribute the linked executables. You must obey the GNU General Public
|
||||||
|
* License in all respects for all of the code used other than "OpenSSL". If you
|
||||||
|
* modify file(s), you may extend this exception to your version of the file(s),
|
||||||
|
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||||
|
* exception statement from your version.
|
||||||
|
*
|
||||||
|
* Contact : daymansmail@gmail.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef STATSDIALOG_H
|
||||||
|
#define STATSDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QTimer>
|
||||||
|
#include "qbtsession.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class StatsDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class StatsDialog : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit StatsDialog(QWidget *parent = 0);
|
||||||
|
~StatsDialog();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void updateUI();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::StatsDialog *ui;
|
||||||
|
QBtSession* session;
|
||||||
|
QTimer* t;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // STATSDIALOG_H
|
253
src/statsdialog.ui
Normal file
253
src/statsdialog.ui
Normal file
@ -0,0 +1,253 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>StatsDialog</class>
|
||||||
|
<widget class="QDialog" name="StatsDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>273</width>
|
||||||
|
<height>395</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Statistics</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupUser">
|
||||||
|
<property name="title">
|
||||||
|
<string>User statistics</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="11" column="0">
|
||||||
|
<widget class="QLabel" name="labelPeersText">
|
||||||
|
<property name="text">
|
||||||
|
<string>Total peer connections:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="labelGlobalRatioText">
|
||||||
|
<property name="text">
|
||||||
|
<string>Global ratio:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="11" column="1" alignment="Qt::AlignRight">
|
||||||
|
<widget class="QLabel" name="labelPeers">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="labelAlltimeDLText">
|
||||||
|
<property name="text">
|
||||||
|
<string>Alltime download:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" alignment="Qt::AlignRight">
|
||||||
|
<widget class="QLabel" name="labelAlltimeUL">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" alignment="Qt::AlignRight">
|
||||||
|
<widget class="QLabel" name="labelAlltimeDL">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="labelAlltimeULText">
|
||||||
|
<property name="text">
|
||||||
|
<string>Alltime upload:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1" alignment="Qt::AlignRight">
|
||||||
|
<widget class="QLabel" name="labelGlobalRatio">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="labelWasteText">
|
||||||
|
<property name="text">
|
||||||
|
<string>Total waste (this session):</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1" alignment="Qt::AlignRight">
|
||||||
|
<widget class="QLabel" name="labelWaste">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupCache">
|
||||||
|
<property name="title">
|
||||||
|
<string>Cache statistics</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="labelCacheHitsText">
|
||||||
|
<property name="text">
|
||||||
|
<string>Read cache Hits:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" alignment="Qt::AlignRight">
|
||||||
|
<widget class="QLabel" name="labelCacheHits">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1" alignment="Qt::AlignRight">
|
||||||
|
<widget class="QLabel" name="labelTotalBuf">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="labelTotalBufText">
|
||||||
|
<property name="text">
|
||||||
|
<string>Total buffers size:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupPerf">
|
||||||
|
<property name="title">
|
||||||
|
<string>Performance statistics</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="3" column="1" alignment="Qt::AlignRight">
|
||||||
|
<widget class="QLabel" name="labelJobsTime">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1" alignment="Qt::AlignRight">
|
||||||
|
<widget class="QLabel" name="labelQueuedJobs">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" alignment="Qt::AlignRight">
|
||||||
|
<widget class="QLabel" name="labelWriteStarve">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" alignment="Qt::AlignRight">
|
||||||
|
<widget class="QLabel" name="labelReadStarve">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="labelQueuedJobsText">
|
||||||
|
<property name="text">
|
||||||
|
<string>Queued I/O jobs:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="labelWriteStarveText">
|
||||||
|
<property name="text">
|
||||||
|
<string>Write cache overload:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="labelJobsTimeText">
|
||||||
|
<property name="text">
|
||||||
|
<string>Average time in queue (ms):</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="labelReadStarveText">
|
||||||
|
<property name="text">
|
||||||
|
<string>Read cache overload:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="labelQueuedBytesText">
|
||||||
|
<property name="text">
|
||||||
|
<string>Total queued size:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1" alignment="Qt::AlignRight">
|
||||||
|
<widget class="QLabel" name="labelQueuedBytes">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="buttonOK">
|
||||||
|
<property name="text">
|
||||||
|
<string>OK</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
Loading…
x
Reference in New Issue
Block a user