]> granicus.if.org Git - transmission/commitdiff
(trunk qt) use the GTK+ client's compact mode
authorCharles Kerr <charles@transmissionbt.com>
Sat, 24 Jul 2010 02:43:06 +0000 (02:43 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Sat, 24 Jul 2010 02:43:06 +0000 (02:43 +0000)
qt/formatter.cc
qt/formatter.h
qt/torrent-delegate-min.cc

index cf838890bdba67cd1ca66bc203954d40fd00c9b0..a6908107fb8877ae85c251d572a6a7b159ea2ef0 100644 (file)
@@ -29,7 +29,7 @@ namespace
     unsigned int size_K;
 }
 
-QString Formatter::unitStrings[3][4];
+QString Formatter::unitStrings[3][5];
 
 void
 Formatter :: initUnits( )
index 4fd2d7af674299f43eb648e87d523967693290b3..25cb6004d8a9113da0556bb4294c3b9ddbf71205 100644 (file)
@@ -46,7 +46,7 @@ class Formatter: public QObject
 
     private:
 
-        static QString unitStrings[3][4];
+        static QString unitStrings[3][5];
 };
 
 #endif
index 2248677af90bcaf0454f065b2b1fa3bc2b5bfd8d..47baf22fc97bc466b37c621b1f72db21967d5bb8 100644 (file)
@@ -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( ) )