From 3063e74e5931a85ecb9efae101f1615405d70e10 Mon Sep 17 00:00:00 2001 From: defnax Date: Mon, 15 Jan 2024 21:43:09 +0100 Subject: [PATCH] Improved downloads and uploads tree display --- .../src/gui/FileTransfer/DLListDelegate.cpp | 16 ++++++++-------- .../src/gui/FileTransfer/ULListDelegate.cpp | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) mode change 100644 => 100755 retroshare-gui/src/gui/FileTransfer/DLListDelegate.cpp mode change 100644 => 100755 retroshare-gui/src/gui/FileTransfer/ULListDelegate.cpp diff --git a/retroshare-gui/src/gui/FileTransfer/DLListDelegate.cpp b/retroshare-gui/src/gui/FileTransfer/DLListDelegate.cpp old mode 100644 new mode 100755 index 3fc982012..319c284d5 --- a/retroshare-gui/src/gui/FileTransfer/DLListDelegate.cpp +++ b/retroshare-gui/src/gui/FileTransfer/DLListDelegate.cpp @@ -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(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(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); } diff --git a/retroshare-gui/src/gui/FileTransfer/ULListDelegate.cpp b/retroshare-gui/src/gui/FileTransfer/ULListDelegate.cpp old mode 100644 new mode 100755 index 6bad045e0..8bddc5017 --- a/retroshare-gui/src/gui/FileTransfer/ULListDelegate.cpp +++ b/retroshare-gui/src/gui/FileTransfer/ULListDelegate.cpp @@ -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(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); }