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. 38
      src/FinishedTorrents.cpp
  4. 1
      src/FinishedTorrents.h
  5. 5
      src/seeding.ui

1
Changelog

@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
- FEATURE: Allow to open torrent destination folder
- FEATURE: Real progress bar in torrent properties that displays downloaded pieces
- 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
- FEATURE: Based on new libtorrent v0.13

23
src/FinishedListDelegate.h

@ -34,11 +34,10 @@ @@ -34,11 +34,10 @@
// Defines for download list list columns
#define F_NAME 0
#define F_SIZE 1
#define F_PROGRESS 2
#define F_UPSPEED 3
#define F_SEEDSLEECH 4
#define F_RATIO 5
#define F_HASH 6
#define F_UPSPEED 2
#define F_LEECH 3
#define F_RATIO 4
#define F_HASH 5
class FinishedListDelegate: public QItemDelegate {
Q_OBJECT
@ -67,20 +66,6 @@ class FinishedListDelegate: public QItemDelegate { @@ -67,20 +66,6 @@ class FinishedListDelegate: public QItemDelegate {
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString(QByteArray::number(ratio, 'f', 1)));
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:
QItemDelegate::paint(painter, option, index);
}

38
src/FinishedTorrents.cpp

@ -37,16 +37,15 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par @@ -37,16 +37,15 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par
actionStart->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/play.png")));
actionPause->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/pause.png")));
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_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_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"));
finishedList->setModel(finishedListModel);
loadHiddenColumns();
// Hide ETA & hash column
// Hide hash column
finishedList->hideColumn(F_HASH);
// Load last columns width for download list
if(!loadColWidthFinishedList()){
@ -78,7 +77,6 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par @@ -78,7 +77,6 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par
connect(actionHOSColName, SIGNAL(triggered()), this, SLOT(hideOrShowColumnName()));
connect(actionHOSColSize, SIGNAL(triggered()), this, SLOT(hideOrShowColumnSize()));
connect(actionHOSColProgress, SIGNAL(triggered()), this, SLOT(hideOrShowColumnProgress()));
connect(actionHOSColUpSpeed, SIGNAL(triggered()), this, SLOT(hideOrShowColumnUpSpeed()));
connect(actionHOSColLeechers, SIGNAL(triggered()), this, SLOT(hideOrShowColumnLeechers()));
connect(actionHOSColRatio, SIGNAL(triggered()), this, SLOT(hideOrShowColumnRatio()));
@ -110,10 +108,9 @@ void FinishedTorrents::addTorrent(QString hash){ @@ -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_SIZE), QVariant((qlonglong)h.actual_size()));
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_HASH), QVariant(hash));
finishedListModel->setData(finishedListModel->index(row, F_PROGRESS), QVariant((double)1.));
if(h.is_paused()) {
finishedListModel->setData(finishedListModel->index(row, F_NAME), QIcon(":/Icons/skin/paused.png"), Qt::DecorationRole);
setRowColor(row, "red");
@ -240,9 +237,6 @@ void FinishedTorrents::updateFinishedList(){ @@ -240,9 +237,6 @@ void FinishedTorrents::updateFinishedList(){
Q_ASSERT(row != -1);
if(h.is_paused()) continue;
if(BTSession->getTorrentsToPauseAfterChecking().indexOf(hash) != -1) {
if(!finishedList->isColumnHidden(F_PROGRESS)) {
finishedListModel->setData(finishedListModel->index(row, F_PROGRESS), QVariant((double)h.progress()));
}
continue;
}
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(){ @@ -256,9 +250,6 @@ void FinishedTorrents::updateFinishedList(){
if(h.state() == torrent_status::checking_files){
finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/time.png"))), Qt::DecorationRole);
setRowColor(row, QString::fromUtf8("grey"));
if(!finishedList->isColumnHidden(F_PROGRESS)) {
finishedListModel->setData(finishedListModel->index(row, F_PROGRESS), QVariant((double)h.progress()));
}
continue;
}
setRowColor(row, QString::fromUtf8("orange"));
@ -266,15 +257,12 @@ void FinishedTorrents::updateFinishedList(){ @@ -266,15 +257,12 @@ void FinishedTorrents::updateFinishedList(){
if(!finishedList->isColumnHidden(F_UPSPEED)) {
finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)h.upload_payload_rate()));
}
if(!finishedList->isColumnHidden(F_SEEDSLEECH)) {
finishedListModel->setData(finishedListModel->index(row, F_SEEDSLEECH), misc::toQString(h.num_peers() - h.num_seeds(), true));
if(!finishedList->isColumnHidden(F_LEECH)) {
finishedListModel->setData(finishedListModel->index(row, F_LEECH), misc::toQString(h.num_peers() - h.num_seeds(), true));
}
if(!finishedList->isColumnHidden(F_RATIO)) {
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) { @@ -294,7 +282,7 @@ void FinishedTorrents::pauseTorrent(QString hash) {
Q_ASSERT(row != -1);
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_SEEDSLEECH), QVariant(QString::fromUtf8("0")));
finishedListModel->setData(finishedListModel->index(row, F_LEECH), QVariant(QString::fromUtf8("0")));
setRowColor(row, QString::fromUtf8("red"));
}
@ -452,16 +440,12 @@ void FinishedTorrents::hideOrShowColumnSize() { @@ -452,16 +440,12 @@ void FinishedTorrents::hideOrShowColumnSize() {
hideOrShowColumn(F_SIZE);
}
void FinishedTorrents::hideOrShowColumnProgress() {
hideOrShowColumn(F_PROGRESS);
}
void FinishedTorrents::hideOrShowColumnUpSpeed() {
hideOrShowColumn(F_UPSPEED);
}
void FinishedTorrents::hideOrShowColumnLeechers() {
hideOrShowColumn(F_SEEDSLEECH);
hideOrShowColumn(F_LEECH);
}
void FinishedTorrents::hideOrShowColumnRatio() {
@ -520,13 +504,10 @@ QAction* FinishedTorrents::getActionHoSCol(int index) { @@ -520,13 +504,10 @@ QAction* FinishedTorrents::getActionHoSCol(int index) {
case F_SIZE :
return actionHOSColSize;
break;
case F_PROGRESS :
return actionHOSColProgress;
break;
case F_UPSPEED :
return actionHOSColUpSpeed;
break;
case F_SEEDSLEECH :
case F_LEECH :
return actionHOSColLeechers;
break;
case F_RATIO :
@ -555,7 +536,6 @@ void FinishedTorrents::sortFinishedList(int index){ @@ -555,7 +536,6 @@ void FinishedTorrents::sortFinishedList(int index){
switch(index){
case F_SIZE:
case F_UPSPEED:
case F_PROGRESS:
sortFinishedListFloat(index, sortOrder);
break;
default:

1
src/FinishedTorrents.h

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

5
src/seeding.ui

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

Loading…
Cancel
Save