mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-15 02:44:20 -05:00
Added Download Time column to Downloads
changed show for Remaining the Filesize which need to be downloaded, on Download Time column show the remaining Time. added to DetailsDialog Download Time label added formating the filesize's for FileTransferInfoWidget git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2470 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
8e8022daf6
commit
c582e29773
@ -53,6 +53,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
||||
qlonglong remaining;
|
||||
QString temp , status;
|
||||
qlonglong completed;
|
||||
qlonglong downloadtime;
|
||||
|
||||
//set text color
|
||||
QVariant value = index.data(Qt::TextColorRole);
|
||||
@ -102,23 +103,22 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
||||
break;
|
||||
case REMAINING:
|
||||
remaining = index.data().toLongLong();
|
||||
minutes = remaining / 60;
|
||||
seconds = remaining % 60;
|
||||
hours = minutes / 60;
|
||||
minutes = minutes % 60 ;
|
||||
days = hours / 24;
|
||||
hours = hours % 24 ;
|
||||
if(days > 0) {
|
||||
temp = QString::number(days)+"d "+QString::number(hours)+"h" ;
|
||||
} else if(hours > 0 || days > 0) {
|
||||
temp = QString::number(hours)+"h "+QString::number(minutes)+"m" ;
|
||||
} else if(minutes > 0 || hours > 0) {
|
||||
temp = QString::number(minutes)+"m"+QString::number(seconds)+"s" ;
|
||||
} else if(seconds > 0) {
|
||||
temp = QString::number(seconds)+"s" ;
|
||||
} else
|
||||
temp = "" ;
|
||||
painter->drawText(option.rect, Qt::AlignCenter, temp);
|
||||
if(remaining <= 0){
|
||||
temp = "";
|
||||
} else {
|
||||
multi = 1.0;
|
||||
for(int i = 0; i < 5; ++i) {
|
||||
if (remaining < 1024) {
|
||||
remaining = index.data().toLongLong();
|
||||
temp.sprintf("%.2f ", remaining / multi);
|
||||
temp += byteUnits[i];
|
||||
break;
|
||||
}
|
||||
remaining /= 1024;
|
||||
multi *= 1024.0;
|
||||
}
|
||||
}
|
||||
painter->drawText(option.rect, Qt::AlignRight, temp);
|
||||
break;
|
||||
case COMPLETED:
|
||||
completed = index.data().toLongLong();
|
||||
@ -179,6 +179,26 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
||||
}
|
||||
painter->drawText(option.rect, Qt::AlignCenter, newopt.text);
|
||||
break;
|
||||
case DOWNLOADTIME:
|
||||
downloadtime = index.data().toLongLong();
|
||||
minutes = downloadtime / 60;
|
||||
seconds = downloadtime % 60;
|
||||
hours = minutes / 60;
|
||||
minutes = minutes % 60 ;
|
||||
days = hours / 24;
|
||||
hours = hours % 24 ;
|
||||
if(days > 0) {
|
||||
temp = QString::number(days)+"d "+QString::number(hours)+"h" ;
|
||||
} else if(hours > 0 || days > 0) {
|
||||
temp = QString::number(hours)+"h "+QString::number(minutes)+"m" ;
|
||||
} else if(minutes > 0 || hours > 0) {
|
||||
temp = QString::number(minutes)+"m"+QString::number(seconds)+"s" ;
|
||||
} else if(seconds > 0) {
|
||||
temp = QString::number(seconds)+"s" ;
|
||||
} else
|
||||
temp = "" ;
|
||||
painter->drawText(option.rect, Qt::AlignCenter, temp);
|
||||
break;
|
||||
case NAME:
|
||||
// decoration
|
||||
value = index.data(Qt::DecorationRole);
|
||||
|
@ -36,7 +36,8 @@
|
||||
#define STATUS 6
|
||||
#define PRIORITY 7
|
||||
#define REMAINING 8
|
||||
#define ID 9
|
||||
#define DOWNLOADTIME 9
|
||||
#define ID 10
|
||||
|
||||
|
||||
#define MAX_CHAR_TMP 128
|
||||
|
@ -178,7 +178,12 @@ void DetailsDialog::setCompleted(const qulonglong & completed)
|
||||
|
||||
void DetailsDialog::setRemaining(const qulonglong & remaining)
|
||||
{
|
||||
ui.remaining_line->setText(misc::userFriendlyDuration(remaining));
|
||||
ui.remaining_line->setText(misc::friendlyUnit(remaining));
|
||||
}
|
||||
|
||||
void DetailsDialog::setDownloadtime(const qulonglong & downloadtime)
|
||||
{
|
||||
ui.downloadtime_line->setText(misc::userFriendlyDuration(downloadtime));
|
||||
}
|
||||
|
||||
void DetailsDialog::setLink(const QString & link)
|
||||
|
@ -59,6 +59,7 @@ public slots:
|
||||
void setDatarate(const double & datarate);
|
||||
void setCompleted(const qulonglong & completed);
|
||||
void setRemaining(const qulonglong & remaining) ;
|
||||
void setDownloadtime(const qulonglong & downloadtime);
|
||||
void setType(const QString & type);
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>525</width>
|
||||
<height>448</height>
|
||||
<height>480</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -31,7 +31,7 @@
|
||||
<attribute name="title">
|
||||
<string>General</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="genralgroupBox">
|
||||
<property name="title">
|
||||
@ -291,6 +291,42 @@ p, li { white-space: pre-wrap; }
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Date</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Download time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="downloadtime_line">
|
||||
<property name="text">
|
||||
<string>Download Time Label</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>274</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <QDebug>
|
||||
#include <rsiface/rsfiles.h>
|
||||
#include <rsiface/rstypes.h>
|
||||
#include "util/misc.h"
|
||||
#include "FileTransferInfoWidget.h"
|
||||
|
||||
// Variables to decide of display behaviour. Should be adapted to window size.
|
||||
@ -218,13 +219,13 @@ void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info
|
||||
y += block_sep ;
|
||||
y += text_height ; painter->drawText(20,y,tr("File hash: ")) ; painter->drawText(tab_size,y,QString::fromStdString(nfo.hash)) ;
|
||||
y += block_sep ;
|
||||
y += text_height ; painter->drawText(20,y,tr("File size: ")) ; painter->drawText(tab_size,y,QString::number(info.file_size)) ;
|
||||
y += text_height ; painter->drawText(20,y,tr("File size: ")) ; painter->drawText(tab_size,y,misc::friendlyUnit(info.file_size)) ;
|
||||
y += block_sep ;
|
||||
y += text_height ; painter->drawText(20,y,tr("Chunk size: ")) ; painter->drawText(tab_size,y,QString::number(info.chunk_size)) ;
|
||||
y += text_height ; painter->drawText(20,y,tr("Chunk size: ")) ; painter->drawText(tab_size,y,misc::friendlyUnit(info.chunk_size)) ;
|
||||
y += block_sep ;
|
||||
y += text_height ; painter->drawText(20,y,tr("Number of chunks: ")) ; painter->drawText(tab_size,y,QString::number(info.chunks.size())) ;
|
||||
y += block_sep ;
|
||||
y += text_height ; painter->drawText(20,y,tr("Transfered: ")) ; painter->drawText(tab_size,y,QString::number(nfo.transfered)) ;
|
||||
y += text_height ; painter->drawText(20,y,tr("Transfered: ")) ; painter->drawText(tab_size,y,misc::friendlyUnit(nfo.transfered)) ;
|
||||
y += block_sep ;
|
||||
y += text_height ; painter->drawText(20,y,tr("Number of sources: ")) ; painter->drawText(tab_size,y,QString::number(info.compressed_peer_availability_maps.size())) ;
|
||||
y += block_sep ;
|
||||
|
@ -93,7 +93,8 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
||||
DLListModel->setHeaderData(SOURCES, Qt::Horizontal, tr("Sources", "i.e: Sources"));
|
||||
DLListModel->setHeaderData(STATUS, Qt::Horizontal, tr("Status"));
|
||||
DLListModel->setHeaderData(PRIORITY, Qt::Horizontal, tr("Speed / Queue priority"));
|
||||
DLListModel->setHeaderData(REMAINING, Qt::Horizontal, tr("Remaining", "i.e: Estimated Time of Arrival / Time left"));
|
||||
DLListModel->setHeaderData(REMAINING, Qt::Horizontal, tr("Remaining"));
|
||||
DLListModel->setHeaderData(DOWNLOADTIME, Qt::Horizontal, tr("Download time", "i.e: Estimated Time of Arrival / Time left"));
|
||||
DLListModel->setHeaderData(ID, Qt::Horizontal, tr("Core-ID"));
|
||||
ui.downloadList->setModel(DLListModel);
|
||||
ui.downloadList->hideColumn(ID);
|
||||
@ -423,7 +424,7 @@ TransfersDialog::~TransfersDialog()
|
||||
|
||||
|
||||
int TransfersDialog::addItem(const QString& symbol, const QString& name, const QString& coreID, qlonglong fileSize, const FileProgressInfo& pinfo, double dlspeed,
|
||||
const QString& sources, const QString& status, const QString& priority, qlonglong completed, qlonglong remaining)
|
||||
const QString& sources, const QString& status, const QString& priority, qlonglong completed, qlonglong remaining, qlonglong downloadtime)
|
||||
{
|
||||
int row;
|
||||
QList<QStandardItem *> list = DLListModel->findItems(coreID, Qt::MatchExactly, ID);
|
||||
@ -444,6 +445,7 @@ int TransfersDialog::addItem(const QString& symbol, const QString& name, const Q
|
||||
DLListModel->setData(DLListModel->index(row, STATUS), QVariant((QString)status));
|
||||
DLListModel->setData(DLListModel->index(row, PRIORITY), QVariant((QString)priority));
|
||||
DLListModel->setData(DLListModel->index(row, REMAINING), QVariant((qlonglong)remaining));
|
||||
DLListModel->setData(DLListModel->index(row, DOWNLOADTIME), QVariant((qlonglong)downloadtime));
|
||||
DLListModel->setData(DLListModel->index(row, ID), QVariant((QString)coreID));
|
||||
|
||||
|
||||
@ -688,8 +690,10 @@ void TransfersDialog::insertTransfers() {
|
||||
default: priority = tr("Average");break;
|
||||
}
|
||||
|
||||
qlonglong completed = info.transfered;
|
||||
qlonglong remaining = (info.size - info.transfered) / (info.tfRate * 1024.0);
|
||||
qlonglong completed = info.transfered;
|
||||
qlonglong remaining = info.size - info.transfered;
|
||||
qlonglong downloadtime = (info.size - info.transfered) / (info.tfRate * 1024.0);
|
||||
|
||||
|
||||
FileChunksInfo fcinfo ;
|
||||
if(!rsFiles->FileDownloadChunksDetails(*it,fcinfo))
|
||||
@ -701,7 +705,7 @@ void TransfersDialog::insertTransfers() {
|
||||
pinfo.progress = completed*100.0/info.size ;
|
||||
pinfo.nb_chunks = pinfo.cmap._map.empty()?0:fcinfo.chunks.size() ;
|
||||
|
||||
int addedRow = addItem("", fileName, fileHash, fileSize, pinfo, fileDlspeed, sources, status, priority, completed, remaining);
|
||||
int addedRow = addItem("", fileName, fileHash, fileSize, pinfo, fileDlspeed, sources, status, priority, completed, remaining, downloadtime);
|
||||
|
||||
/* continue to next download item if no peers to add */
|
||||
if (!info.peers.size()) continue;
|
||||
@ -770,7 +774,7 @@ void TransfersDialog::insertTransfers() {
|
||||
|
||||
addItem("", QString::fromUtf8(dit->fname.c_str()),
|
||||
QString::fromStdString(dit->hash), dit->count, pinfo, 0, 0,
|
||||
tr("Queued"), "", 0, 0);
|
||||
tr("Queued"), "", 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -993,6 +997,8 @@ void TransfersDialog::showDetailsDialog()
|
||||
qulonglong fcompleted = ind.model ()->data (ind.model ()->index (ind.row (), COMPLETED)).toULongLong() ;
|
||||
qulonglong fremaining = ind.model ()->data (ind.model ()->index (ind.row (), REMAINING)).toULongLong() ;
|
||||
|
||||
qulonglong fdownloadtime = ind.model ()->data (ind.model ()->index (ind.row (), DOWNLOADTIME)).toULongLong() ;
|
||||
|
||||
int nb_select = 0 ;
|
||||
|
||||
for(int i = 0; i <= DLListModel->rowCount(); i++)
|
||||
@ -1021,6 +1027,9 @@ void TransfersDialog::showDetailsDialog()
|
||||
detailsdlg->setCompleted(fcompleted);
|
||||
detailsdlg->setRemaining(fremaining);
|
||||
|
||||
//Date GroupBox
|
||||
detailsdlg->setDownloadtime(fdownloadtime);
|
||||
|
||||
// retroshare link(s) Tab
|
||||
analyzer.setRetroShareLink (fname, fsize, fhash);
|
||||
detailsdlg->setLink(analyzer.getRetroShareLink ());
|
||||
|
@ -171,7 +171,7 @@ private:
|
||||
Ui::TransfersDialog ui;
|
||||
|
||||
public slots:
|
||||
int addItem(const QString& symbol, const QString& name, const QString& coreID, qlonglong size, const FileProgressInfo& pinfo, double dlspeed, const QString& sources, const QString& status, const QString& priority, qlonglong completed, qlonglong remaining);
|
||||
int addItem(const QString& symbol, const QString& name, const QString& coreID, qlonglong size, const FileProgressInfo& pinfo, double dlspeed, const QString& sources, const QString& status, const QString& priority, qlonglong completed, qlonglong remaining, qlonglong downloadtime);
|
||||
bool addPeerToItem(int row, const QString& name, const QString& coreID, double dlspeed, const QString& status, const FileProgressInfo& peerInfo);
|
||||
void delItem(int row);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user