Bug 227792

Summary: buttons (last.fm, bookmark flag) in "Now playing" applet are misplaced
Product: [Applications] amarok Reporter: Myriam Schweingruber <myriam>
Component: Context ViewAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal CC: lfranchi, simon.esneault
Priority: NOR Keywords: release_blocker
Version: 2.3-GIT   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: now-playing applet with last.fm button
Screenshot with last.fm buttons
Applet with ruler

Description Myriam Schweingruber 2010-02-20 11:35:23 UTC
The love button and bookmark flag are not placed above the white line where "Play count", "Score" and "Last played" are. When resizing the ContextView those overlap with the text in that line.
Comment 1 Leo Franchi 2010-02-20 20:34:18 UTC
screenshot? looks like this to me:

http://imagebin.ca/view/gd1F47Q5.html
Comment 2 Myriam Schweingruber 2010-02-20 21:26:15 UTC
Created attachment 40967 [details]
now-playing applet with last.fm button

Well, it does look like this here, and the buttons will overlap the text as soon as one resizes the ContextView. Using the default themse and styles of KDE SC 4.4.
Similar reports exist for other ContextView applet layout/resizing problems btw: bug 175039, bug 214156, bug 215171, bug 215509, bug 223113 and bug 227597. Could it be that those have all the same origin?
Comment 3 Myriam Schweingruber 2010-02-21 12:20:26 UTC
Created attachment 40978 [details]
Screenshot with last.fm buttons

And that's how it looks like when playing my last.fm Radio
Comment 4 Leo Franchi 2010-02-22 05:57:05 UTC
what kde version are you running?

also, could you do me a favor and open kruler, to measure the height of the applet exactly? something like this:

http://imagebin.ca/view/iiukAfg.html

thx
Comment 5 Myriam Schweingruber 2010-02-22 09:36:47 UTC
Created attachment 41001 [details]
Applet with ruler

I use KDE SC 4.4, Qt 4.6.1

FWIW, this was always like that, even on KDE 4.3.x
Comment 6 Leo Franchi 2010-02-23 03:39:01 UTC
got it, the applet is of fixed height, but the icons are positioned based on the location of the text labels.

with large font sizes, everything is messed up. will look into it.
Comment 7 Leo Franchi 2010-02-23 04:06:06 UTC
commit 9dcbf2eccb2aaad977211539f6c101bb8418ea18
Author: Leo Franchi <lfranchi@kde.org>
Date:   Mon Feb 22 22:02:29 2010 -0500

    make the current applet bigger if the system font size is bigger, otherwise the layout stops working
    
    BUG: 227792

diff --git a/src/context/applets/currenttrack/CurrentTrack.cpp b/src/context/applets/currenttrack/CurrentTrack.cpp
index 1ce0e77..3431b2a 100644
--- a/src/context/applets/currenttrack/CurrentTrack.cpp
+++ b/src/context/applets/currenttrack/CurrentTrack.cpp
@@ -147,8 +147,13 @@ CurrentTrack::init()
     connect( dataEngine( "amarok-current" ), SIGNAL( sourceAdded( const QString& ) ), this, SLOT( connectSource( const QString& ) ) );
     connect( The::paletteHandler(), SIGNAL( newPalette( const QPalette& ) ), SLOT(  paletteChanged( const QPalette &  ) ) );
 
-    // completely arbitrary yet necessary to kick start the layout before the user acts and resizes manually
-    resize( 500, 180 );
+    // figure out the size we want to be, in order to be able to squeeze in all that we want
+    // depends on the current font size,  basically
+    // height should be increased for larger point sizes. here, the layout works correctly with size 8, which has the fontMetrics height of 13
+    // a size too big, like font size 12, has a fontMetrics height of 19. So we add some height if it's too big
+    int additional = ( QApplication::fontMetrics().height()-13 ) * 2;
+    resize( 500, 180 + additional );
+    
 
     // hide the items while we startup. as soon as the query is done, they'll be shown.
     foreach ( QGraphicsItem * childItem, QGraphicsItem::children() )