mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Put last DL column in order
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6666 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
5dee253030
commit
a6905df48c
@ -25,6 +25,8 @@
|
||||
#include <QStyleOptionProgressBarV2>
|
||||
#include <QProgressBar>
|
||||
#include <QApplication>
|
||||
#include <QDateTime>
|
||||
#include <limits>
|
||||
|
||||
#include "DLListDelegate.h"
|
||||
|
||||
@ -51,9 +53,10 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
||||
double dlspeed, multi;
|
||||
int seconds,minutes, hours, days;
|
||||
qlonglong remaining;
|
||||
QString temp , status;
|
||||
QString temp ;
|
||||
qlonglong completed;
|
||||
qlonglong downloadtime;
|
||||
qint64 qi64Value;
|
||||
|
||||
// prepare
|
||||
painter->save();
|
||||
@ -216,6 +219,15 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
||||
}
|
||||
painter->drawText(option.rect.translated(pixmap.size().width(), 0), Qt::AlignLeft, temp);
|
||||
break;
|
||||
case COLUMN_LASTDL:
|
||||
qi64Value = index.data().value<qint64>();
|
||||
if (qi64Value < std::numeric_limits<qint64>::max()){
|
||||
QDateTime qdtLastDL = QDateTime::fromMSecsSinceEpoch(qi64Value);
|
||||
painter->drawText(option.rect, Qt::AlignCenter, qdtLastDL.toString("yyyy-MM-dd_hh:mm:ss"));
|
||||
} else {
|
||||
painter->drawText(option.rect, Qt::AlignCenter, tr("File Never Seen"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
painter->drawText(option.rect, Qt::AlignCenter, index.data().toString());
|
||||
}
|
||||
@ -224,14 +236,8 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
QSize DLListDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const
|
||||
QSize DLListDelegate::sizeHint(const QStyleOptionViewItem & /*option*/, const QModelIndex & /*index*/) const
|
||||
{
|
||||
return QSize(50,17);
|
||||
QVariant value = index.data(Qt::FontRole);
|
||||
QFont fnt = value.isValid() ? qvariant_cast<QFont>(value) : option.font;
|
||||
QFontMetrics fontMetrics(fnt);
|
||||
const QString text = index.data(Qt::DisplayRole).toString();
|
||||
QRect textRect = QRect(0, 0, 0, fontMetrics.lineSpacing() * (text.count(QLatin1Char('\n')) + 1));
|
||||
return textRect.size();
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ class DLListDelegate: public QAbstractItemDelegate {
|
||||
DLListDelegate(QObject *parent=0);
|
||||
~DLListDelegate();
|
||||
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const;
|
||||
QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const;
|
||||
QSize sizeHint(const QStyleOptionViewItem &, const QModelIndex &) const;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include <gui/common/FilesDefs.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
|
||||
#include "TransfersDialog.h"
|
||||
#include <gui/RetroShareLink.h>
|
||||
@ -932,7 +933,8 @@ int TransfersDialog::addItem(int row, const FileInfo &fileInfo, const std::map<s
|
||||
qlonglong completed = fileInfo.transfered;
|
||||
qlonglong remaining = fileInfo.size - fileInfo.transfered;
|
||||
qlonglong downloadtime = (fileInfo.size - fileInfo.transfered) / (fileInfo.tfRate * 1024.0);
|
||||
QString strLastDL = tr("File Never Seen");
|
||||
qint64 qi64LastDL = std::numeric_limits<qint64>::max();
|
||||
|
||||
{
|
||||
QFileInfo file;
|
||||
|
||||
@ -943,7 +945,7 @@ int TransfersDialog::addItem(int row, const FileInfo &fileInfo, const std::map<s
|
||||
}
|
||||
/*Get Last Access on File */
|
||||
if (file.exists()) {
|
||||
strLastDL= file.lastModified().toString("yyyy-MM-dd_hh:mm:ss");
|
||||
qi64LastDL = file.lastModified().toMSecsSinceEpoch();
|
||||
}
|
||||
}
|
||||
QString strPath = QString::fromUtf8(fileInfo.path.c_str());
|
||||
@ -1003,7 +1005,7 @@ int TransfersDialog::addItem(int row, const FileInfo &fileInfo, const std::map<s
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_PRIORITY), QVariant(priority));
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_REMAINING), QVariant((qlonglong)remaining));
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_DOWNLOADTIME), QVariant((qlonglong)downloadtime));
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_LASTDL), QVariant(strLastDL));
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_LASTDL), QVariant(qi64LastDL));
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_PATH), QVariant(strPathAfterDL));
|
||||
DLListModel->item(row,COLUMN_PATH)->setToolTip(strPath);
|
||||
DLListModel->item(row,COLUMN_STATUS)->setToolTip(tooltip);
|
||||
|
Loading…
Reference in New Issue
Block a user