mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-22 07:49:56 -05:00
reengineered the transfer list display
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2349 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
082d5732b0
commit
3014a9a233
@ -55,36 +55,36 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||||||
qlonglong completed;
|
qlonglong completed;
|
||||||
|
|
||||||
//set text color
|
//set text color
|
||||||
QVariant value = index.data(Qt::TextColorRole);
|
QVariant value = index.data(Qt::TextColorRole);
|
||||||
if(value.isValid() && qvariant_cast<QColor>(value).isValid()) {
|
if(value.isValid() && qvariant_cast<QColor>(value).isValid()) {
|
||||||
opt.palette.setColor(QPalette::Text, qvariant_cast<QColor>(value));
|
opt.palette.setColor(QPalette::Text, qvariant_cast<QColor>(value));
|
||||||
}
|
}
|
||||||
QPalette::ColorGroup cg = option.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
|
QPalette::ColorGroup cg = option.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
|
||||||
if(option.state & QStyle::State_Selected){
|
if(option.state & QStyle::State_Selected){
|
||||||
painter->setPen(opt.palette.color(cg, QPalette::HighlightedText));
|
painter->setPen(opt.palette.color(cg, QPalette::HighlightedText));
|
||||||
} else {
|
} else {
|
||||||
painter->setPen(opt.palette.color(cg, QPalette::Text));
|
painter->setPen(opt.palette.color(cg, QPalette::Text));
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw the background color
|
// draw the background color if not the progress column or if progress is not displayed
|
||||||
if(index.column() != PROGRESS) {
|
if(index.column() != PROGRESS || ((FileProgressInfo)index.data().value<FileProgressInfo>()).nb_chunks == 0) {
|
||||||
if(option.showDecorationSelected && (option.state & QStyle::State_Selected)) {
|
if(option.showDecorationSelected && (option.state & QStyle::State_Selected)) {
|
||||||
if(cg == QPalette::Normal && !(option.state & QStyle::State_Active)) {
|
if(cg == QPalette::Normal && !(option.state & QStyle::State_Active)) {
|
||||||
cg = QPalette::Inactive;
|
cg = QPalette::Inactive;
|
||||||
}
|
}
|
||||||
painter->fillRect(option.rect, option.palette.brush(cg, QPalette::Highlight));
|
painter->fillRect(option.rect, option.palette.brush(cg, QPalette::Highlight));
|
||||||
} else {
|
} else {
|
||||||
value = index.data(Qt::BackgroundColorRole);
|
value = index.data(Qt::BackgroundColorRole);
|
||||||
if(value.isValid() && qvariant_cast<QColor>(value).isValid()) {
|
if(value.isValid() && qvariant_cast<QColor>(value).isValid()) {
|
||||||
painter->fillRect(option.rect, qvariant_cast<QColor>(value));
|
painter->fillRect(option.rect, qvariant_cast<QColor>(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch(index.column()) {
|
switch(index.column()) {
|
||||||
case SIZE:
|
case SIZE:
|
||||||
fileSize = index.data().toLongLong();
|
fileSize = index.data().toLongLong();
|
||||||
if(fileSize < 0){
|
if(fileSize <= 0){
|
||||||
temp = "Unknown";
|
temp = "";
|
||||||
} else {
|
} else {
|
||||||
multi = 1.0;
|
multi = 1.0;
|
||||||
for(int i = 0; i < 5; ++i) {
|
for(int i = 0; i < 5; ++i) {
|
||||||
@ -122,8 +122,8 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||||||
break;
|
break;
|
||||||
case COMPLETED:
|
case COMPLETED:
|
||||||
completed = index.data().toLongLong();
|
completed = index.data().toLongLong();
|
||||||
if(completed < 0){
|
if(completed <= 0){
|
||||||
temp = "Unknown";
|
temp = "";
|
||||||
} else {
|
} else {
|
||||||
multi = 1.0;
|
multi = 1.0;
|
||||||
for(int i = 0; i < 5; ++i) {
|
for(int i = 0; i < 5; ++i) {
|
||||||
@ -140,43 +140,51 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||||||
painter->drawText(option.rect, Qt::AlignRight, temp);
|
painter->drawText(option.rect, Qt::AlignRight, temp);
|
||||||
break;
|
break;
|
||||||
case DLSPEED:
|
case DLSPEED:
|
||||||
dlspeed = index.data().toDouble();
|
dlspeed = index.data().toDouble();
|
||||||
temp.clear();
|
if (dlspeed <= 0) {
|
||||||
temp.sprintf("%.2f", dlspeed/1024.);
|
temp = "";
|
||||||
temp += " KB/s";
|
} else {
|
||||||
|
temp.clear();
|
||||||
|
temp.sprintf("%.2f", dlspeed/1024.);
|
||||||
|
temp += " KB/s";
|
||||||
|
}
|
||||||
painter->drawText(option.rect, Qt::AlignRight, temp);
|
painter->drawText(option.rect, Qt::AlignRight, temp);
|
||||||
break;
|
break;
|
||||||
case PROGRESS:
|
case PROGRESS:
|
||||||
{
|
{
|
||||||
// create a xProgressBar
|
// create a xProgressBar
|
||||||
FileProgressInfo pinfo = index.data().value<FileProgressInfo>() ;
|
FileProgressInfo pinfo = index.data().value<FileProgressInfo>() ;
|
||||||
xProgressBar progressBar(pinfo,option.rect, painter); // the 3rd param is the color schema (0 is the default value)
|
if (pinfo.nb_chunks != 0) {
|
||||||
if(pinfo.type == FileProgressInfo::DOWNLOAD_LINE)
|
xProgressBar progressBar(pinfo,option.rect, painter); // the 3rd param is the color schema (0 is the default value)
|
||||||
{
|
if(pinfo.type == FileProgressInfo::DOWNLOAD_LINE)
|
||||||
progressBar.setDisplayText(true); // should display % text?
|
{
|
||||||
progressBar.setColorSchema(0) ;
|
progressBar.setDisplayText(true); // should display % text?
|
||||||
}
|
progressBar.setColorSchema(0) ;
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
progressBar.setDisplayText(false); // should display % text?
|
{
|
||||||
progressBar.setColorSchema(1) ;
|
progressBar.setDisplayText(false); // should display % text?
|
||||||
}
|
progressBar.setColorSchema(1) ;
|
||||||
progressBar.setVerticalSpan(1);
|
}
|
||||||
progressBar.paint(); // paint the progress bar
|
progressBar.setVerticalSpan(1);
|
||||||
|
progressBar.paint(); // paint the progress bar
|
||||||
|
}
|
||||||
}
|
}
|
||||||
painter->drawText(option.rect, Qt::AlignCenter, newopt.text);
|
painter->drawText(option.rect, Qt::AlignCenter, newopt.text);
|
||||||
break;
|
break;
|
||||||
case NAME:
|
case NAME:
|
||||||
// decoration
|
// decoration
|
||||||
value = index.data(Qt::DecorationRole);
|
value = index.data(Qt::DecorationRole);
|
||||||
pixmap = qvariant_cast<QIcon>(value).pixmap(option.decorationSize, option.state & QStyle::State_Enabled ? QIcon::Normal : QIcon::Disabled, option.state & QStyle::State_Open ? QIcon::On : QIcon::Off);
|
temp = index.data().toString();
|
||||||
pixmapRect = (pixmap.isNull() ? QRect(0, 0, 0, 0): QRect(QPoint(0, 0), option.decorationSize));
|
pixmap = qvariant_cast<QIcon>(value).pixmap(option.decorationSize, option.state & QStyle::State_Enabled ? QIcon::Normal : QIcon::Disabled, option.state & QStyle::State_Open ? QIcon::On : QIcon::Off);
|
||||||
if (pixmapRect.isValid()){
|
pixmapRect = (pixmap.isNull() ? QRect(0, 0, 0, 0): QRect(QPoint(0, 0), option.decorationSize));
|
||||||
QPoint p = QStyle::alignedRect(option.direction, Qt::AlignLeft, pixmap.size(), option.rect).topLeft();
|
if (pixmapRect.isValid()){
|
||||||
painter->drawPixmap(p, pixmap);
|
QPoint p = QStyle::alignedRect(option.direction, Qt::AlignLeft, pixmap.size(), option.rect).topLeft();
|
||||||
}
|
painter->drawPixmap(p, pixmap);
|
||||||
painter->drawText(option.rect.translated(pixmap.size().width(), 0), Qt::AlignLeft, index.data().toString());
|
temp = " " + temp;
|
||||||
break;
|
}
|
||||||
|
painter->drawText(option.rect.translated(pixmap.size().width(), 0), Qt::AlignLeft, temp);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
painter->drawText(option.rect, Qt::AlignCenter, index.data().toString());
|
painter->drawText(option.rect, Qt::AlignCenter, index.data().toString());
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ void FileTransferInfoWidget::updateDisplay()
|
|||||||
|
|
||||||
void FileTransferInfoWidget::paintEvent(QPaintEvent *event)
|
void FileTransferInfoWidget::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
std::cout << "In paint event" << std::endl ;
|
//std::cout << "In paint event" << std::endl ;
|
||||||
QStylePainter painter(this);
|
QStylePainter painter(this);
|
||||||
|
|
||||||
painter.drawPixmap(0, 0, pixmap2);
|
painter.drawPixmap(0, 0, pixmap2);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -46,37 +46,37 @@ class QStandardItemModel;
|
|||||||
|
|
||||||
class TransfersDialog : public RsAutoUpdatePage
|
class TransfersDialog : public RsAutoUpdatePage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Default Constructor */
|
/** Default Constructor */
|
||||||
TransfersDialog(QWidget *parent = 0);
|
TransfersDialog(QWidget *parent = 0);
|
||||||
/** Default Destructor */
|
/** Default Destructor */
|
||||||
~TransfersDialog();
|
~TransfersDialog();
|
||||||
|
|
||||||
virtual void keyPressEvent(QKeyEvent *) ;
|
virtual void keyPressEvent(QKeyEvent *) ;
|
||||||
virtual void updateDisplay() ; // derived from RsAutoUpdateWidget
|
virtual void updateDisplay() ; // derived from RsAutoUpdateWidget
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void insertTransfers();
|
void insertTransfers();
|
||||||
|
|
||||||
void handleDownloadRequest(const QString& url);
|
void handleDownloadRequest(const QString& url);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
/** Create the context popup menu and it's submenus */
|
/** Create the context popup menu and it's submenus */
|
||||||
void downloadListCostumPopupMenu( QPoint point );
|
void downloadListCostumPopupMenu( QPoint point );
|
||||||
|
|
||||||
void cancel();
|
void cancel();
|
||||||
/** removes finished Downloads**/
|
/** removes finished Downloads**/
|
||||||
void clearcompleted();
|
void clearcompleted();
|
||||||
void playSelectedTransfer();
|
void playSelectedTransfer();
|
||||||
|
|
||||||
void copyLink();
|
void copyLink();
|
||||||
void pasteLink();
|
void pasteLink();
|
||||||
|
|
||||||
void rootdecorated();
|
// void rootdecorated();
|
||||||
void rootisnotdecorated();
|
// void rootisnotdecorated();
|
||||||
|
|
||||||
void pauseFileTransfer();
|
void pauseFileTransfer();
|
||||||
void resumeFileTransfer();
|
void resumeFileTransfer();
|
||||||
@ -97,106 +97,99 @@ class TransfersDialog : public RsAutoUpdatePage
|
|||||||
void speedAverage();
|
void speedAverage();
|
||||||
void speedFast();
|
void speedFast();
|
||||||
|
|
||||||
void changeSpeed(int) ;
|
void changeSpeed(int) ;
|
||||||
void changeQueuePriority(int) ;
|
void changeQueuePriority(int) ;
|
||||||
|
|
||||||
void chunkRandom();
|
void chunkRandom();
|
||||||
void chunkStreaming();
|
void chunkStreaming();
|
||||||
|
|
||||||
/** save sort indicators for next transfers display */
|
/** save sort indicators for next transfers display */
|
||||||
void saveSortIndicatorDwl(int logicalIndex, Qt::SortOrder order);
|
// void saveSortIndicatorDwl(int logicalIndex, Qt::SortOrder order);
|
||||||
void saveSortIndicatorUpl(int logicalIndex, Qt::SortOrder order);
|
// void saveSortIndicatorUpl(int logicalIndex, Qt::SortOrder order);
|
||||||
|
|
||||||
void showDetailsDialog();
|
void showDetailsDialog();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void playFiles(QStringList files);
|
void playFiles(QStringList files);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString getPeerName(const std::string& peer_id) const ;
|
QString getPeerName(const std::string& peer_id) const ;
|
||||||
|
|
||||||
QStandardItemModel *DLListModel;
|
QStandardItemModel *DLListModel;
|
||||||
QStandardItemModel *ULListModel;
|
QStandardItemModel *ULListModel;
|
||||||
QItemSelectionModel *selection;
|
QItemSelectionModel *selection;
|
||||||
QItemSelectionModel *selectionup;
|
QItemSelectionModel *selectionup;
|
||||||
|
|
||||||
DLListDelegate *DLDelegate;
|
DLListDelegate *DLDelegate;
|
||||||
ULListDelegate *ULDelegate;
|
ULListDelegate *ULDelegate;
|
||||||
qlonglong fileSize;
|
|
||||||
double progress;
|
|
||||||
double dlspeed;
|
|
||||||
QString status, icon, name;
|
|
||||||
qlonglong completed, remaining;
|
|
||||||
|
|
||||||
int _sortColDwl, _sortColUpl;
|
// int _sortColDwl, _sortColUpl;
|
||||||
Qt::SortOrder _sortOrderDwl, _sortOrderUpl;
|
// Qt::SortOrder _sortOrderDwl, _sortOrderUpl;
|
||||||
|
|
||||||
/** Create the actions on the tray menu or menubar */
|
|
||||||
void createActions();
|
|
||||||
|
|
||||||
/** Define the popup menus for the Context menu */
|
/** Create the actions on the tray menu or menubar */
|
||||||
QMenu* contextMnu;
|
void createActions();
|
||||||
/** Defines the actions for the context menu */
|
|
||||||
QAction* showdowninfoAct;
|
/** Define the popup menus for the Context menu */
|
||||||
QAction* cancelAct;
|
QMenu* contextMnu;
|
||||||
QAction* clearcompletedAct;
|
/** Defines the actions for the context menu */
|
||||||
QAction* copylinkAct;
|
QAction* showdowninfoAct;
|
||||||
|
QAction* cancelAct;
|
||||||
|
QAction* clearcompletedAct;
|
||||||
|
QAction* copylinkAct;
|
||||||
QAction* pastelinkAct;
|
QAction* pastelinkAct;
|
||||||
QAction* rootisnotdecoratedAct;
|
QAction* rootisnotdecoratedAct;
|
||||||
QAction* rootisdecoratedAct;
|
QAction* rootisdecoratedAct;
|
||||||
QAction *pauseAct;
|
QAction *pauseAct;
|
||||||
QAction *resumeAct;
|
QAction *resumeAct;
|
||||||
QAction *openfolderAct;
|
QAction *openfolderAct;
|
||||||
QAction *openfileAct;
|
QAction *openfileAct;
|
||||||
QAction *previewfileAct;
|
QAction *previewfileAct;
|
||||||
QAction *clearQueuedDwlAct;
|
QAction *clearQueuedDwlAct;
|
||||||
QAction *clearQueueAct;
|
QAction *clearQueueAct;
|
||||||
QAction *changePriorityAct;
|
QAction *changePriorityAct;
|
||||||
QAction *prioritySlowAct;
|
QAction *prioritySlowAct;
|
||||||
QAction *priorityMediumAct;
|
QAction *priorityMediumAct;
|
||||||
QAction *priorityFastAct;
|
QAction *priorityFastAct;
|
||||||
QAction *priorityLowAct;
|
QAction *priorityLowAct;
|
||||||
QAction *priorityNormalAct;
|
QAction *priorityNormalAct;
|
||||||
QAction *priorityHighAct;
|
QAction *priorityHighAct;
|
||||||
QAction *priorityAutoAct;
|
QAction *priorityAutoAct;
|
||||||
QAction *chunkRandomAct;
|
QAction *chunkRandomAct;
|
||||||
QAction *chunkStreamingAct;
|
QAction *chunkStreamingAct;
|
||||||
QAction *detailsfileAct;
|
QAction *detailsfileAct;
|
||||||
|
|
||||||
void getIdOfSelectedItems(std::set<QStandardItem *>& items);
|
void getIdOfSelectedItems(std::set<QStandardItem *>& items);
|
||||||
bool controlTransferFile(uint32_t flags);
|
bool controlTransferFile(uint32_t flags);
|
||||||
void changePriority(int priority);
|
void changePriority(int priority);
|
||||||
void setChunkStrategy(FileChunksInfo::ChunkStrategy s) ;
|
void setChunkStrategy(FileChunksInfo::ChunkStrategy s) ;
|
||||||
|
|
||||||
QTreeView *downloadList;
|
QTreeView *downloadList;
|
||||||
|
|
||||||
/** Adds a new action to the toolbar. */
|
/** Adds a new action to the toolbar. */
|
||||||
void addAction(QAction *action, const char *slot = 0);
|
void addAction(QAction *action, const char *slot = 0);
|
||||||
|
|
||||||
/** Qt Designer generated object */
|
/** Qt Designer generated object */
|
||||||
Ui::TransfersDialog ui;
|
Ui::TransfersDialog ui;
|
||||||
|
|
||||||
public slots:
|
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);
|
||||||
bool addPeerToItem(int row, const QString& symbol, const QString& name, const QString& coreID, qlonglong fileSize, const FileProgressInfo& pinfo, double dlspeed, const QString& sources, const QString& status, qlonglong completed, qlonglong remaining);
|
bool addPeerToItem(int row, const QString& name, const QString& coreID, double dlspeed, const QString& status);
|
||||||
void delItem(int row);
|
void delItem(int row);
|
||||||
|
|
||||||
int addUploadItem(const QString& symbol, const QString& name, const QString& coreID, qlonglong size, const FileProgressInfo& pinfo, double dlspeed, const QString& sources, const QString& status, qlonglong completed, qlonglong remaining);
|
int addUploadItem(const QString& symbol, const QString& name, const QString& coreID, qlonglong size, const FileProgressInfo& pinfo, double dlspeed, const QString& sources, const QString& status, qlonglong completed, qlonglong remaining);
|
||||||
void delUploadItem(int row);
|
void delUploadItem(int row);
|
||||||
|
|
||||||
void editItem(int row, int column, QVariant data);
|
void showFileDetails() ;
|
||||||
void updateProgress(int value);
|
|
||||||
void showFileDetails() ;
|
|
||||||
|
|
||||||
double getProgress(int row, QStandardItemModel *model);
|
double getProgress(int row, QStandardItemModel *model);
|
||||||
double getSpeed(int row, QStandardItemModel *model);
|
double getSpeed(int row, QStandardItemModel *model);
|
||||||
QString getFileName(int row, QStandardItemModel *model);
|
QString getFileName(int row, QStandardItemModel *model);
|
||||||
QString getStatus(int row, QStandardItemModel *model);
|
QString getStatus(int row, QStandardItemModel *model);
|
||||||
QString getID(int row, QStandardItemModel *model);
|
QString getID(int row, QStandardItemModel *model);
|
||||||
QString getPriority(int row, QStandardItemModel *model);
|
QString getPriority(int row, QStandardItemModel *model);
|
||||||
qlonglong getFileSize(int row, QStandardItemModel *model);
|
qlonglong getFileSize(int row, QStandardItemModel *model);
|
||||||
qlonglong getTransfered(int row, QStandardItemModel *model);
|
qlonglong getTransfered(int row, QStandardItemModel *model);
|
||||||
qlonglong getRemainingTime(int row, QStandardItemModel *model);
|
qlonglong getRemainingTime(int row, QStandardItemModel *model);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -644,7 +644,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="rootIsDecorated">
|
<property name="rootIsDecorated">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="sortingEnabled">
|
<property name="sortingEnabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -652,6 +652,15 @@ p, li { white-space: pre-wrap; }
|
|||||||
<property name="allColumnsShowFocus">
|
<property name="allColumnsShowFocus">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="headerStretchLastSection">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="headerStretchLastSection">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -727,8 +736,8 @@ p, li { white-space: pre-wrap; }
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>596</width>
|
<width>598</width>
|
||||||
<height>102</height>
|
<height>99</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
@ -834,8 +843,8 @@ p, li { white-space: pre-wrap; }
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>578</width>
|
<width>98</width>
|
||||||
<height>117</height>
|
<height>28</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
@ -850,7 +859,6 @@ p, li { white-space: pre-wrap; }
|
|||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="images.qrc"/>
|
<include location="images.qrc"/>
|
||||||
<include location="../../../../../../../.designer/backup/images.qrc"/>
|
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -82,8 +82,8 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||||||
switch(index.column()) {
|
switch(index.column()) {
|
||||||
case USIZE:
|
case USIZE:
|
||||||
fileSize = index.data().toLongLong();
|
fileSize = index.data().toLongLong();
|
||||||
if(fileSize < 0){
|
if(fileSize <= 0){
|
||||||
temp = "Unknown";
|
temp = "";
|
||||||
} else {
|
} else {
|
||||||
multi = 1.0;
|
multi = 1.0;
|
||||||
for(int i = 0; i < 5; ++i) {
|
for(int i = 0; i < 5; ++i) {
|
||||||
@ -101,8 +101,8 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||||||
break;
|
break;
|
||||||
case UTRANSFERRED:
|
case UTRANSFERRED:
|
||||||
transferred = index.data().toLongLong();
|
transferred = index.data().toLongLong();
|
||||||
if(transferred < 0){
|
if(transferred <= 0){
|
||||||
temp = "Unknown";
|
temp = "";
|
||||||
} else {
|
} else {
|
||||||
multi = 1.0;
|
multi = 1.0;
|
||||||
for(int i = 0; i < 5; ++i) {
|
for(int i = 0; i < 5; ++i) {
|
||||||
@ -119,10 +119,14 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||||||
painter->drawText(option.rect, Qt::AlignRight, temp);
|
painter->drawText(option.rect, Qt::AlignRight, temp);
|
||||||
break;
|
break;
|
||||||
case ULSPEED:
|
case ULSPEED:
|
||||||
ulspeed = index.data().toDouble();
|
ulspeed = index.data().toDouble();
|
||||||
temp.clear();
|
if (ulspeed <= 0) {
|
||||||
temp.sprintf("%.2f", ulspeed/1024.);
|
temp = "";
|
||||||
temp += " KB/s";
|
} else {
|
||||||
|
temp.clear();
|
||||||
|
temp.sprintf("%.2f", ulspeed/1024.);
|
||||||
|
temp += " KB/s";
|
||||||
|
}
|
||||||
painter->drawText(option.rect, Qt::AlignRight, temp);
|
painter->drawText(option.rect, Qt::AlignRight, temp);
|
||||||
break;
|
break;
|
||||||
case UPROGRESS:
|
case UPROGRESS:
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#define UPROGRESS 4
|
#define UPROGRESS 4
|
||||||
#define USTATUS 5
|
#define USTATUS 5
|
||||||
#define USERNAME 6
|
#define USERNAME 6
|
||||||
|
#define UHASH 7
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user