mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 07:29:33 -05:00
Improved downloads and uploads tree display
This commit is contained in:
parent
d9f7e96c68
commit
3063e74e59
16
retroshare-gui/src/gui/FileTransfer/DLListDelegate.cpp
Normal file → Executable file
16
retroshare-gui/src/gui/FileTransfer/DLListDelegate.cpp
Normal file → Executable file
@ -102,7 +102,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
||||
multi *= 1024.0;
|
||||
}
|
||||
}
|
||||
painter->drawText(option.rect, Qt::AlignRight, temp);
|
||||
painter->drawText(option.rect, Qt::AlignRight | Qt::AlignVCenter, temp);
|
||||
break;
|
||||
case COLUMN_REMAINING:
|
||||
remaining = index.data().toLongLong();
|
||||
@ -121,7 +121,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
||||
multi *= 1024.0;
|
||||
}
|
||||
}
|
||||
painter->drawText(option.rect, Qt::AlignRight, temp);
|
||||
painter->drawText(option.rect, Qt::AlignRight | Qt::AlignVCenter, temp);
|
||||
break;
|
||||
case COLUMN_COMPLETED:
|
||||
completed = index.data().toLongLong();
|
||||
@ -140,7 +140,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
||||
multi *= 1024.0;
|
||||
}
|
||||
}
|
||||
painter->drawText(option.rect, Qt::AlignRight, temp);
|
||||
painter->drawText(option.rect, Qt::AlignRight | Qt::AlignVCenter, temp);
|
||||
break;
|
||||
case COLUMN_DLSPEED:
|
||||
dlspeed = index.data().toDouble();
|
||||
@ -151,7 +151,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
||||
temp.sprintf("%.2f", dlspeed/1024.);
|
||||
temp += " KB/s";
|
||||
}
|
||||
painter->drawText(option.rect, Qt::AlignRight, temp);
|
||||
painter->drawText(option.rect, Qt::AlignRight | Qt::AlignVCenter, temp);
|
||||
break;
|
||||
case COLUMN_PROGRESS:
|
||||
{
|
||||
@ -236,7 +236,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
||||
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);
|
||||
pixmapRect = (pixmap.isNull() ? QRect(0, 0, 0, 0): QRect(QPoint(0, 0), option.decorationSize));
|
||||
if (pixmapRect.isValid()){
|
||||
QPoint p = QStyle::alignedRect(option.direction, Qt::AlignLeft, pixmap.size(), option.rect).topLeft();
|
||||
QPoint p = QStyle::alignedRect(option.direction, Qt::AlignLeft | Qt::AlignVCenter, pixmap.size(), option.rect).topLeft();
|
||||
p.setX( p.x() + pixOffset);
|
||||
painter->drawPixmap(p, pixmap);
|
||||
temp = " " + temp;
|
||||
@ -247,13 +247,13 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
||||
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);
|
||||
pixmapRect = (pixmap.isNull() ? QRect(0, 0, 0, 0): QRect(QPoint(0, 0), option.decorationSize));
|
||||
if (pixmapRect.isValid()){
|
||||
QPoint p = QStyle::alignedRect(option.direction, Qt::AlignLeft, pixmap.size(), option.rect).topLeft();
|
||||
QPoint p = QStyle::alignedRect(option.direction, Qt::AlignLeft | Qt::AlignVCenter, pixmap.size(), option.rect).topLeft();
|
||||
p.setX( p.x() + pixOffset);
|
||||
painter->drawPixmap(p, pixmap);
|
||||
temp = " " + temp;
|
||||
pixOffset += pixmap.size().width();
|
||||
}
|
||||
painter->drawText(option.rect.translated(pixOffset, 0), Qt::AlignLeft, temp);
|
||||
painter->drawText(option.rect.translated(pixOffset, 0), Qt::AlignLeft | Qt::AlignVCenter, temp);
|
||||
}
|
||||
break;
|
||||
case COLUMN_LASTDL:
|
||||
@ -279,7 +279,7 @@ QSize DLListDelegate::sizeHint(const QStyleOptionViewItem & option, const QModel
|
||||
{
|
||||
float w = QFontMetricsF(option.font).width(index.data(Qt::DisplayRole).toString());
|
||||
|
||||
int S = QFontMetricsF(option.font).height() ;
|
||||
int S = QFontMetricsF(option.font).height()*1.5 ;
|
||||
return QSize(w,S);
|
||||
}
|
||||
|
||||
|
12
retroshare-gui/src/gui/FileTransfer/ULListDelegate.cpp
Normal file → Executable file
12
retroshare-gui/src/gui/FileTransfer/ULListDelegate.cpp
Normal file → Executable file
@ -101,7 +101,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
||||
multi *= 1024.0;
|
||||
}
|
||||
}
|
||||
painter->drawText(option.rect, Qt::AlignRight, temp);
|
||||
painter->drawText(option.rect, Qt::AlignRight | Qt::AlignVCenter, temp);
|
||||
break;
|
||||
case COLUMN_UTRANSFERRED:
|
||||
transferred = index.data().toLongLong();
|
||||
@ -120,7 +120,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
||||
multi *= 1024.0;
|
||||
}
|
||||
}
|
||||
painter->drawText(option.rect, Qt::AlignRight, temp);
|
||||
painter->drawText(option.rect, Qt::AlignRight | Qt::AlignVCenter, temp);
|
||||
break;
|
||||
case COLUMN_ULSPEED:
|
||||
ulspeed = index.data().toDouble();
|
||||
@ -131,7 +131,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
||||
temp.sprintf("%.2f", ulspeed/1024.);
|
||||
temp += " KB/s";
|
||||
}
|
||||
painter->drawText(option.rect, Qt::AlignRight, temp);
|
||||
painter->drawText(option.rect, Qt::AlignRight | Qt::AlignVCenter, temp);
|
||||
break;
|
||||
case COLUMN_UPROGRESS:
|
||||
{
|
||||
@ -164,10 +164,10 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
||||
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);
|
||||
pixmapRect = (pixmap.isNull() ? QRect(0, 0, 0, 0): QRect(QPoint(0, 0), option.decorationSize));
|
||||
if (pixmapRect.isValid()){
|
||||
QPoint p = QStyle::alignedRect(option.direction, Qt::AlignLeft, pixmap.size(), option.rect).topLeft();
|
||||
QPoint p = QStyle::alignedRect(option.direction, Qt::AlignLeft | Qt::AlignVCenter, pixmap.size(), option.rect).topLeft();
|
||||
painter->drawPixmap(p, pixmap);
|
||||
}
|
||||
painter->drawText(option.rect.translated(pixmap.size().width(), 0), Qt::AlignLeft, index.data().toString());
|
||||
painter->drawText(option.rect.translated(pixmap.size().width(), 0), Qt::AlignLeft | Qt::AlignVCenter, index.data().toString());
|
||||
break;
|
||||
default:
|
||||
painter->drawText(option.rect, Qt::AlignCenter, index.data().toString());
|
||||
@ -181,7 +181,7 @@ QSize ULListDelegate::sizeHint(const QStyleOptionViewItem & option, const QModel
|
||||
{
|
||||
float w = QFontMetricsF(option.font).width(index.data(Qt::DisplayRole).toString());
|
||||
|
||||
int S = QFontMetricsF(option.font).height() ;
|
||||
int S = QFontMetricsF(option.font).height()*1.5 ;
|
||||
return QSize(w,S);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user