mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-02 18:04:32 +00:00
- Made progress on torrent properties (main tab)
This commit is contained in:
parent
707e87f5b8
commit
75e5a7e3d4
@ -141,8 +141,8 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
|
|||||||
hSplitter = new QSplitter(Qt::Vertical, vSplitter);
|
hSplitter = new QSplitter(Qt::Vertical, vSplitter);
|
||||||
|
|
||||||
// Transfer List tab
|
// Transfer List tab
|
||||||
properties = new PropertiesWidget(hSplitter);
|
transferList = new TransferListWidget(hSplitter, BTSession);
|
||||||
transferList = new TransferListWidget(vSplitter, BTSession);
|
properties = new PropertiesWidget(hSplitter, transferList);
|
||||||
transferListFilters = new TransferListFiltersWidget(vSplitter, transferList);
|
transferListFilters = new TransferListFiltersWidget(vSplitter, transferList);
|
||||||
hSplitter->addWidget(transferList);
|
hSplitter->addWidget(transferList);
|
||||||
hSplitter->addWidget(properties);
|
hSplitter->addWidget(properties);
|
||||||
|
@ -789,6 +789,12 @@ void TransferListWidget::loadLastSortedColumn() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TransferListWidget::currentChanged(const QModelIndex& current, const QModelIndex&) {
|
||||||
|
int row = proxyModel->mapToSource(current).row();
|
||||||
|
QTorrentHandle h = BTSession->getTorrentHandle(getHashFromRow(row));
|
||||||
|
emit currentTorrentChanged(h);
|
||||||
|
}
|
||||||
|
|
||||||
void TransferListWidget::applyFilter(int f) {
|
void TransferListWidget::applyFilter(int f) {
|
||||||
switch(f) {
|
switch(f) {
|
||||||
case DOWNLOADING:
|
case DOWNLOADING:
|
||||||
|
@ -74,6 +74,7 @@ protected slots:
|
|||||||
void saveHiddenColumns();
|
void saveHiddenColumns();
|
||||||
void displayListMenu(const QPoint&);
|
void displayListMenu(const QPoint&);
|
||||||
void updateMetadata(QTorrentHandle &h);
|
void updateMetadata(QTorrentHandle &h);
|
||||||
|
void currentChanged(const QModelIndex& current, const QModelIndex&);
|
||||||
//void setRowColor(int row, QColor color);
|
//void setRowColor(int row, QColor color);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@ -101,6 +102,9 @@ public slots:
|
|||||||
void displayDLHoSMenu(const QPoint&);
|
void displayDLHoSMenu(const QPoint&);
|
||||||
void applyFilter(int f);
|
void applyFilter(int f);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void currentTorrentChanged(QTorrentHandle &h);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TRANSFERLISTWIDGET_H
|
#endif // TRANSFERLISTWIDGET_H
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<widget class="QWidget" name="page">
|
<widget class="QWidget" name="page">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupTorrentInfos">
|
<widget class="QGroupBox" name="groupTorrentInfos">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
@ -34,11 +34,19 @@
|
|||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Torrent information</string>
|
<string>Torrent information</string>
|
||||||
</property>
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="savePath_lbl">
|
<widget class="QLabel" name="savePath_lbl">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>22</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<weight>50</weight>
|
<weight>50</weight>
|
||||||
@ -97,17 +105,10 @@
|
|||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="save_path">
|
<widget class="QLabel" name="save_path">
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="changeSavePathButton">
|
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>27</width>
|
<width>16777215</width>
|
||||||
<height>16777215</height>
|
<height>22</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
@ -117,7 +118,26 @@
|
|||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="changeSavePathButton">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>22</width>
|
||||||
|
<height>22</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>50</weight>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">...</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -125,6 +145,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="creator">
|
<widget class="QLabel" name="creator">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>50</weight>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -132,9 +158,18 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="hash_lbl">
|
<widget class="QLabel" name="hash_lbl">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>50</weight>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -152,6 +187,8 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -159,7 +196,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>185</width>
|
<width>190</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -303,6 +340,12 @@
|
|||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="upTotal">
|
<widget class="QLabel" name="upTotal">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>50</weight>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -310,6 +353,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="dlTotal">
|
<widget class="QLabel" name="dlTotal">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>50</weight>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -317,6 +366,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="shareRatio">
|
<widget class="QLabel" name="shareRatio">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>50</weight>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -324,6 +379,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="failed">
|
<widget class="QLabel" name="failed">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>50</weight>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
|
@ -28,12 +28,88 @@
|
|||||||
* Contact : chris@qbittorrent.org
|
* Contact : chris@qbittorrent.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QVBoxLayout>
|
||||||
#include "propertieswidget.h"
|
#include "propertieswidget.h"
|
||||||
|
#include "TransferListWidget.h"
|
||||||
|
#include "torrentPersistentData.h"
|
||||||
|
#include "realprogressbar.h"
|
||||||
|
#include "realprogressbarthread.h"
|
||||||
|
|
||||||
PropertiesWidget::PropertiesWidget(QWidget *parent): QWidget(parent) {
|
PropertiesWidget::PropertiesWidget(QWidget *parent, TransferListWidget *transferList): QWidget(parent), transferList(transferList) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
connect(transferList, SIGNAL(currentTorrentChanged(QTorrentHandle&)), this, SLOT(loadTorrentInfos(QTorrentHandle &)));
|
||||||
|
// Downloaded pieces progress bar
|
||||||
|
progressBar = new RealProgressBar(this);
|
||||||
|
progressBar->setForegroundColor(Qt::blue);
|
||||||
|
progressBarVbox = new QVBoxLayout(RealProgressBox);
|
||||||
|
progressBarVbox->addWidget(progressBar);
|
||||||
|
progressBarUpdater = 0;
|
||||||
|
// Dynamic data refresher
|
||||||
|
refreshTimer = new QTimer(this);
|
||||||
|
connect(refreshTimer, SIGNAL(timeout()), this, SLOT(loadDynamicData()));
|
||||||
|
refreshTimer->start(10000); // 10sec
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertiesWidget::~PropertiesWidget() {
|
PropertiesWidget::~PropertiesWidget() {
|
||||||
|
delete refreshTimer;
|
||||||
|
if(progressBarUpdater)
|
||||||
|
delete progressBarUpdater;
|
||||||
|
delete progressBar;
|
||||||
|
delete progressBarVbox;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertiesWidget::loadTorrentInfos(QTorrentHandle &_h) {
|
||||||
|
h = _h;
|
||||||
|
if(!h.is_valid()) return;
|
||||||
|
if(progressBarUpdater)
|
||||||
|
delete progressBarUpdater;
|
||||||
|
progressBarUpdater = 0;
|
||||||
|
try {
|
||||||
|
// Save path
|
||||||
|
save_path->setText(TorrentPersistentData::getSavePath(h.hash()));
|
||||||
|
// Author
|
||||||
|
QString author = h.creator().trimmed();
|
||||||
|
if(author.isEmpty())
|
||||||
|
author = tr("Unknown");
|
||||||
|
creator->setText(author);
|
||||||
|
// Hash
|
||||||
|
hash_lbl->setText(h.hash());
|
||||||
|
// Comment
|
||||||
|
comment_lbl->setText(h.comment());
|
||||||
|
// downloaded pieces updater
|
||||||
|
progressBarUpdater = new RealProgressBarThread(progressBar, h);
|
||||||
|
progressBarUpdater->start();
|
||||||
|
} catch(invalid_handle e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// Load dynamic data
|
||||||
|
loadDynamicData();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertiesWidget::loadDynamicData() {
|
||||||
|
if(!h.is_valid()) return;
|
||||||
|
try {
|
||||||
|
// Session infos
|
||||||
|
failed->setText(misc::friendlyUnit(h.total_failed_bytes()));
|
||||||
|
upTotal->setText(misc::friendlyUnit(h.total_payload_upload()));
|
||||||
|
dlTotal->setText(misc::friendlyUnit(h.total_payload_download()));
|
||||||
|
// Update ratio info
|
||||||
|
float ratio;
|
||||||
|
if(h.total_payload_download() == 0){
|
||||||
|
if(h.total_payload_upload() == 0)
|
||||||
|
ratio = 1.;
|
||||||
|
else
|
||||||
|
ratio = 10.; // Max ratio
|
||||||
|
}else{
|
||||||
|
ratio = (double)h.total_payload_upload()/(double)h.total_payload_download();
|
||||||
|
if(ratio > 10.){
|
||||||
|
ratio = 10.;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
shareRatio->setText(QString(QByteArray::number(ratio, 'f', 1)));
|
||||||
|
// Downloaded pieces
|
||||||
|
if(progressBarUpdater)
|
||||||
|
progressBarUpdater->refresh();
|
||||||
|
} catch(invalid_handle e) {}
|
||||||
|
}
|
||||||
|
@ -33,11 +33,31 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "ui_propertiesWidget.h"
|
#include "ui_propertiesWidget.h"
|
||||||
|
#include "qtorrenthandle.h"
|
||||||
|
|
||||||
|
class TransferListWidget;
|
||||||
|
class QTimer;
|
||||||
|
class RealProgressBar;
|
||||||
|
class QVBoxLayout;
|
||||||
|
class RealProgressBarThread;
|
||||||
|
|
||||||
class PropertiesWidget : public QWidget, private Ui::PropertiesWidget {
|
class PropertiesWidget : public QWidget, private Ui::PropertiesWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
private:
|
||||||
|
TransferListWidget *transferList;
|
||||||
|
QTorrentHandle h;
|
||||||
|
QTimer *refreshTimer;
|
||||||
|
RealProgressBar *progressBar;
|
||||||
|
RealProgressBarThread *progressBarUpdater;
|
||||||
|
QVBoxLayout *progressBarVbox;
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void loadTorrentInfos(QTorrentHandle &h);
|
||||||
|
void loadDynamicData();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PropertiesWidget(QWidget *parent);
|
PropertiesWidget(QWidget *parent, TransferListWidget *transferList);
|
||||||
~PropertiesWidget();
|
~PropertiesWidget();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user