From e5ed55808e27120b4720c6cdd4d0e7a2459e5612 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sat, 24 Jul 2010 02:43:06 +0000 Subject: [PATCH] (trunk qt) use the GTK+ client's compact mode --- qt/formatter.cc | 2 +- qt/formatter.h | 2 +- qt/torrent-delegate-min.cc | 30 ++++++++++++++++-------------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/qt/formatter.cc b/qt/formatter.cc index cf838890b..a6908107f 100644 --- a/qt/formatter.cc +++ b/qt/formatter.cc @@ -29,7 +29,7 @@ namespace unsigned int size_K; } -QString Formatter::unitStrings[3][4]; +QString Formatter::unitStrings[3][5]; void Formatter :: initUnits( ) diff --git a/qt/formatter.h b/qt/formatter.h index 4fd2d7af6..25cb6004d 100644 --- a/qt/formatter.h +++ b/qt/formatter.h @@ -46,7 +46,7 @@ class Formatter: public QObject private: - static QString unitStrings[3][4]; + static QString unitStrings[3][5]; }; #endif diff --git a/qt/torrent-delegate-min.cc b/qt/torrent-delegate-min.cc index 2248677af..47baf22fc 100644 --- a/qt/torrent-delegate-min.cc +++ b/qt/torrent-delegate-min.cc @@ -30,6 +30,7 @@ enum { GUI_PAD = 6, + BAR_WIDTH = 50, BAR_HEIGHT = 12, LINE_SPACING = 4 }; @@ -37,8 +38,7 @@ enum /*** **** **** +---------+-----------------------------------------------+ -**** | Icon | Title shortStatusString | -**** | Icon | [ Progressbar.......................... ] | +**** | Icon | Title shortStatusString [Progressbar] | **** +-------- +-----------------------------------------------+ **** ***/ @@ -63,8 +63,10 @@ TorrentDelegateMin :: sizeHint( const QStyleOptionViewItem& option, const Torren const QSize m( margin( *style ) ); - return QSize( m.width() + iconSize + GUI_PAD + nameSize.width() + GUI_PAD + statusSize.width() + m.width(), - m.height() + nameSize.height() + LINE_SPACING + BAR_HEIGHT + m.height() ); + return QSize( m.width()*2 + iconSize + GUI_PAD + nameSize.width() + + GUI_PAD + statusSize.width() + + GUI_PAD + BAR_WIDTH, + m.height()*2 + std::max( nameSize.height(), (int)BAR_HEIGHT ) ); } void @@ -126,18 +128,18 @@ TorrentDelegateMin :: drawTorrent( QPainter * painter, const QStyleOptionViewIte fillArea.y( ) + ( fillArea.height( ) - iconSize ) / 2, iconSize, iconSize ); - const QRect statusArea( fillArea.width( ) - statusSize.width( ), - fillArea.top( ) + ((nameSize.height()-statusSize.height())/2), - statusSize.width( ), - statusSize.height( ) ); + const QRect barArea( fillArea.x( ) + fillArea.width( ) - BAR_WIDTH, + fillArea.y( ) + ( fillArea.height( ) - BAR_HEIGHT ) / 2, + BAR_WIDTH, + BAR_HEIGHT ); + const QRect statusArea( barArea.x( ) - GUI_PAD - statusSize.width( ), + fillArea.y( ), + fillArea.width( ), + fillArea.height( ) ); const QRect nameArea( iconArea.x( ) + iconArea.width( ) + GUI_PAD, fillArea.y( ), - fillArea.width( ) - statusArea.width( ) - (GUI_PAD*2) - iconArea.width( ), - nameSize.height( ) ); - const QRect barArea( nameArea.left( ), - nameArea.bottom( ), - statusArea.right( ) - nameArea.left( ), - BAR_HEIGHT ); + statusArea.x( ) - ( iconArea.x( ) + iconArea.width( ) + GUI_PAD * 2 ), + fillArea.height( ) ); // render if( tor.hasError( ) ) -- 2.40.0