mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 05:08:05 -06:00
Add availability column to torrent properties window
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include <QProxyStyle>
|
||||
#endif
|
||||
|
||||
#include "base/unicodestrings.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "propertieswidget.h"
|
||||
@@ -131,6 +132,19 @@ void PropListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
|
||||
QItemDelegate::drawDisplay(painter, opt, option.rect, text);
|
||||
}
|
||||
break;
|
||||
case AVAILABILITY: {
|
||||
const qreal availability = index.data().toDouble();
|
||||
if (availability < 0) {
|
||||
QItemDelegate::drawDisplay(painter, opt, option.rect, tr("N/A"));
|
||||
}
|
||||
else {
|
||||
const QString value = (availability >= 1.0)
|
||||
? QLatin1String("100")
|
||||
: Utils::String::fromDouble(availability * 100., 1);
|
||||
QItemDelegate::drawDisplay(painter, opt, option.rect, value + C_THIN_SPACE + QLatin1Char('%'));
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
QItemDelegate::paint(painter, option, index);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user