Browse Source

- COSMETIC: Do not display progress bar in seeding list (always 100%)

adaptive-webui-19844
Christophe Dumez 17 years ago
parent
commit
b24a1e9123
  1. 1
      Changelog
  2. 23
      src/FinishedListDelegate.h
  3. 48
      src/FinishedTorrents.cpp
  4. 1
      src/FinishedTorrents.h
  5. 5
      src/seeding.ui

1
Changelog

@ -5,6 +5,7 @@
- FEATURE: Allow to open torrent destination folder - FEATURE: Allow to open torrent destination folder
- FEATURE: Real progress bar in torrent properties that displays downloaded pieces - FEATURE: Real progress bar in torrent properties that displays downloaded pieces
- BUGFIX: Do not display seeds number in seeding list (always 0) - BUGFIX: Do not display seeds number in seeding list (always 0)
- COSMETIC: Do not display progress bar in seeding list (always 100%)
* Unknown - Christophe Dumez <chris@qbittorrent.org> - v1.0.0 * Unknown - Christophe Dumez <chris@qbittorrent.org> - v1.0.0
- FEATURE: Based on new libtorrent v0.13 - FEATURE: Based on new libtorrent v0.13

23
src/FinishedListDelegate.h

@ -34,11 +34,10 @@
// Defines for download list list columns // Defines for download list list columns
#define F_NAME 0 #define F_NAME 0
#define F_SIZE 1 #define F_SIZE 1
#define F_PROGRESS 2 #define F_UPSPEED 2
#define F_UPSPEED 3 #define F_LEECH 3
#define F_SEEDSLEECH 4 #define F_RATIO 4
#define F_RATIO 5 #define F_HASH 5
#define F_HASH 6
class FinishedListDelegate: public QItemDelegate { class FinishedListDelegate: public QItemDelegate {
Q_OBJECT Q_OBJECT
@ -67,20 +66,6 @@ class FinishedListDelegate: public QItemDelegate {
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString(QByteArray::number(ratio, 'f', 1))); QItemDelegate::drawDisplay(painter, opt, opt.rect, QString(QByteArray::number(ratio, 'f', 1)));
break; break;
} }
case F_PROGRESS:{
QStyleOptionProgressBarV2 newopt;
double progress = index.data().toDouble()*100.;
newopt.rect = opt.rect;
newopt.text = QString(QByteArray::number(progress, 'f', 1))+QString::fromUtf8("%");
newopt.progress = (int)progress;
newopt.maximum = 100;
newopt.minimum = 0;
newopt.state |= QStyle::State_Enabled;
newopt.textVisible = true;
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt,
painter);
break;
}
default: default:
QItemDelegate::paint(painter, option, index); QItemDelegate::paint(painter, option, index);
} }

48
src/FinishedTorrents.cpp

@ -37,16 +37,15 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par
actionStart->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/play.png"))); actionStart->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/play.png")));
actionPause->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/pause.png"))); actionPause->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/pause.png")));
connect(BTSession, SIGNAL(addedTorrent(QString, QTorrentHandle&, bool)), this, SLOT(torrentAdded(QString, QTorrentHandle&, bool))); connect(BTSession, SIGNAL(addedTorrent(QString, QTorrentHandle&, bool)), this, SLOT(torrentAdded(QString, QTorrentHandle&, bool)));
finishedListModel = new QStandardItemModel(0,7); finishedListModel = new QStandardItemModel(0,6);
finishedListModel->setHeaderData(F_NAME, Qt::Horizontal, tr("Name", "i.e: file name")); finishedListModel->setHeaderData(F_NAME, Qt::Horizontal, tr("Name", "i.e: file name"));
finishedListModel->setHeaderData(F_SIZE, Qt::Horizontal, tr("Size", "i.e: file size")); finishedListModel->setHeaderData(F_SIZE, Qt::Horizontal, tr("Size", "i.e: file size"));
finishedListModel->setHeaderData(F_PROGRESS, Qt::Horizontal, tr("Progress", "i.e: % downloaded"));
finishedListModel->setHeaderData(F_UPSPEED, Qt::Horizontal, tr("UP Speed", "i.e: Upload speed")); finishedListModel->setHeaderData(F_UPSPEED, Qt::Horizontal, tr("UP Speed", "i.e: Upload speed"));
finishedListModel->setHeaderData(F_SEEDSLEECH, Qt::Horizontal, tr("Leechers", "i.e: full/partial sources")); finishedListModel->setHeaderData(F_LEECH, Qt::Horizontal, tr("Leechers", "i.e: full/partial sources"));
finishedListModel->setHeaderData(F_RATIO, Qt::Horizontal, tr("Ratio")); finishedListModel->setHeaderData(F_RATIO, Qt::Horizontal, tr("Ratio"));
finishedList->setModel(finishedListModel); finishedList->setModel(finishedListModel);
loadHiddenColumns(); loadHiddenColumns();
// Hide ETA & hash column // Hide hash column
finishedList->hideColumn(F_HASH); finishedList->hideColumn(F_HASH);
// Load last columns width for download list // Load last columns width for download list
if(!loadColWidthFinishedList()){ if(!loadColWidthFinishedList()){
@ -78,7 +77,6 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par
connect(actionHOSColName, SIGNAL(triggered()), this, SLOT(hideOrShowColumnName())); connect(actionHOSColName, SIGNAL(triggered()), this, SLOT(hideOrShowColumnName()));
connect(actionHOSColSize, SIGNAL(triggered()), this, SLOT(hideOrShowColumnSize())); connect(actionHOSColSize, SIGNAL(triggered()), this, SLOT(hideOrShowColumnSize()));
connect(actionHOSColProgress, SIGNAL(triggered()), this, SLOT(hideOrShowColumnProgress()));
connect(actionHOSColUpSpeed, SIGNAL(triggered()), this, SLOT(hideOrShowColumnUpSpeed())); connect(actionHOSColUpSpeed, SIGNAL(triggered()), this, SLOT(hideOrShowColumnUpSpeed()));
connect(actionHOSColLeechers, SIGNAL(triggered()), this, SLOT(hideOrShowColumnLeechers())); connect(actionHOSColLeechers, SIGNAL(triggered()), this, SLOT(hideOrShowColumnLeechers()));
connect(actionHOSColRatio, SIGNAL(triggered()), this, SLOT(hideOrShowColumnRatio())); connect(actionHOSColRatio, SIGNAL(triggered()), this, SLOT(hideOrShowColumnRatio()));
@ -110,10 +108,9 @@ void FinishedTorrents::addTorrent(QString hash){
finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(h.name())); finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(h.name()));
finishedListModel->setData(finishedListModel->index(row, F_SIZE), QVariant((qlonglong)h.actual_size())); finishedListModel->setData(finishedListModel->index(row, F_SIZE), QVariant((qlonglong)h.actual_size()));
finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)0.)); finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)0.));
finishedListModel->setData(finishedListModel->index(row, F_SEEDSLEECH), QVariant("0")); finishedListModel->setData(finishedListModel->index(row, F_LEECH), QVariant("0"));
finishedListModel->setData(finishedListModel->index(row, F_RATIO), QVariant(QString::fromUtf8(misc::toString(BTSession->getRealRatio(hash)).c_str()))); finishedListModel->setData(finishedListModel->index(row, F_RATIO), QVariant(QString::fromUtf8(misc::toString(BTSession->getRealRatio(hash)).c_str())));
finishedListModel->setData(finishedListModel->index(row, F_HASH), QVariant(hash)); finishedListModel->setData(finishedListModel->index(row, F_HASH), QVariant(hash));
finishedListModel->setData(finishedListModel->index(row, F_PROGRESS), QVariant((double)1.));
if(h.is_paused()) { if(h.is_paused()) {
finishedListModel->setData(finishedListModel->index(row, F_NAME), QIcon(":/Icons/skin/paused.png"), Qt::DecorationRole); finishedListModel->setData(finishedListModel->index(row, F_NAME), QIcon(":/Icons/skin/paused.png"), Qt::DecorationRole);
setRowColor(row, "red"); setRowColor(row, "red");
@ -240,9 +237,6 @@ void FinishedTorrents::updateFinishedList(){
Q_ASSERT(row != -1); Q_ASSERT(row != -1);
if(h.is_paused()) continue; if(h.is_paused()) continue;
if(BTSession->getTorrentsToPauseAfterChecking().indexOf(hash) != -1) { if(BTSession->getTorrentsToPauseAfterChecking().indexOf(hash) != -1) {
if(!finishedList->isColumnHidden(F_PROGRESS)) {
finishedListModel->setData(finishedListModel->index(row, F_PROGRESS), QVariant((double)h.progress()));
}
continue; continue;
} }
if(h.state() == torrent_status::downloading || (h.state() != torrent_status::checking_files && h.state() != torrent_status::queued_for_checking && h.progress() < 1.)) { if(h.state() == torrent_status::downloading || (h.state() != torrent_status::checking_files && h.state() != torrent_status::queued_for_checking && h.progress() < 1.)) {
@ -256,9 +250,6 @@ void FinishedTorrents::updateFinishedList(){
if(h.state() == torrent_status::checking_files){ if(h.state() == torrent_status::checking_files){
finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/time.png"))), Qt::DecorationRole); finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/time.png"))), Qt::DecorationRole);
setRowColor(row, QString::fromUtf8("grey")); setRowColor(row, QString::fromUtf8("grey"));
if(!finishedList->isColumnHidden(F_PROGRESS)) {
finishedListModel->setData(finishedListModel->index(row, F_PROGRESS), QVariant((double)h.progress()));
}
continue; continue;
} }
setRowColor(row, QString::fromUtf8("orange")); setRowColor(row, QString::fromUtf8("orange"));
@ -266,15 +257,12 @@ void FinishedTorrents::updateFinishedList(){
if(!finishedList->isColumnHidden(F_UPSPEED)) { if(!finishedList->isColumnHidden(F_UPSPEED)) {
finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)h.upload_payload_rate())); finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)h.upload_payload_rate()));
} }
if(!finishedList->isColumnHidden(F_SEEDSLEECH)) { if(!finishedList->isColumnHidden(F_LEECH)) {
finishedListModel->setData(finishedListModel->index(row, F_SEEDSLEECH), misc::toQString(h.num_peers() - h.num_seeds(), true)); finishedListModel->setData(finishedListModel->index(row, F_LEECH), misc::toQString(h.num_peers() - h.num_seeds(), true));
} }
if(!finishedList->isColumnHidden(F_RATIO)) { if(!finishedList->isColumnHidden(F_RATIO)) {
finishedListModel->setData(finishedListModel->index(row, F_RATIO), QVariant(misc::toQString(BTSession->getRealRatio(hash)))); finishedListModel->setData(finishedListModel->index(row, F_RATIO), QVariant(misc::toQString(BTSession->getRealRatio(hash))));
} }
if(!finishedList->isColumnHidden(F_PROGRESS)) {
finishedListModel->setData(finishedListModel->index(row, F_PROGRESS), QVariant((double)1.));
}
} }
} }
@ -294,7 +282,7 @@ void FinishedTorrents::pauseTorrent(QString hash) {
Q_ASSERT(row != -1); Q_ASSERT(row != -1);
finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)0.0)); finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)0.0));
finishedListModel->setData(finishedListModel->index(row, F_NAME), QIcon(QString::fromUtf8(":/Icons/skin/paused.png")), Qt::DecorationRole); finishedListModel->setData(finishedListModel->index(row, F_NAME), QIcon(QString::fromUtf8(":/Icons/skin/paused.png")), Qt::DecorationRole);
finishedListModel->setData(finishedListModel->index(row, F_SEEDSLEECH), QVariant(QString::fromUtf8("0"))); finishedListModel->setData(finishedListModel->index(row, F_LEECH), QVariant(QString::fromUtf8("0")));
setRowColor(row, QString::fromUtf8("red")); setRowColor(row, QString::fromUtf8("red"));
} }
@ -452,16 +440,12 @@ void FinishedTorrents::hideOrShowColumnSize() {
hideOrShowColumn(F_SIZE); hideOrShowColumn(F_SIZE);
} }
void FinishedTorrents::hideOrShowColumnProgress() {
hideOrShowColumn(F_PROGRESS);
}
void FinishedTorrents::hideOrShowColumnUpSpeed() { void FinishedTorrents::hideOrShowColumnUpSpeed() {
hideOrShowColumn(F_UPSPEED); hideOrShowColumn(F_UPSPEED);
} }
void FinishedTorrents::hideOrShowColumnLeechers() { void FinishedTorrents::hideOrShowColumnLeechers() {
hideOrShowColumn(F_SEEDSLEECH); hideOrShowColumn(F_LEECH);
} }
void FinishedTorrents::hideOrShowColumnRatio() { void FinishedTorrents::hideOrShowColumnRatio() {
@ -516,22 +500,19 @@ QAction* FinishedTorrents::getActionHoSCol(int index) {
switch(index) { switch(index) {
case F_NAME : case F_NAME :
return actionHOSColName; return actionHOSColName;
break; break;
case F_SIZE : case F_SIZE :
return actionHOSColSize; return actionHOSColSize;
break; break;
case F_PROGRESS :
return actionHOSColProgress;
break;
case F_UPSPEED : case F_UPSPEED :
return actionHOSColUpSpeed; return actionHOSColUpSpeed;
break; break;
case F_SEEDSLEECH : case F_LEECH :
return actionHOSColLeechers; return actionHOSColLeechers;
break; break;
case F_RATIO : case F_RATIO :
return actionHOSColRatio; return actionHOSColRatio;
break; break;
default : default :
return NULL; return NULL;
} }
@ -555,7 +536,6 @@ void FinishedTorrents::sortFinishedList(int index){
switch(index){ switch(index){
case F_SIZE: case F_SIZE:
case F_UPSPEED: case F_UPSPEED:
case F_PROGRESS:
sortFinishedListFloat(index, sortOrder); sortFinishedListFloat(index, sortOrder);
break; break;
default: default:

1
src/FinishedTorrents.h

@ -69,7 +69,6 @@ class FinishedTorrents : public QWidget, public Ui::seeding {
void notifyTorrentDoubleClicked(const QModelIndex& index); void notifyTorrentDoubleClicked(const QModelIndex& index);
void hideOrShowColumnName(); void hideOrShowColumnName();
void hideOrShowColumnSize(); void hideOrShowColumnSize();
void hideOrShowColumnProgress();
void hideOrShowColumnUpSpeed(); void hideOrShowColumnUpSpeed();
void hideOrShowColumnLeechers(); void hideOrShowColumnLeechers();
void hideOrShowColumnRatio(); void hideOrShowColumnRatio();

5
src/seeding.ui

@ -111,11 +111,6 @@
<string>Size</string> <string>Size</string>
</property> </property>
</action> </action>
<action name="actionHOSColProgress" >
<property name="text" >
<string>Progress</string>
</property>
</action>
<action name="actionHOSColUpSpeed" > <action name="actionHOSColUpSpeed" >
<property name="text" > <property name="text" >
<string>Upload Speed</string> <string>Upload Speed</string>

Loading…
Cancel
Save