Bug 147059 - [Patch]OSD stars are shown too small
Summary: [Patch]OSD stars are shown too small
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: general (show other bugs)
Version: 1.4.6
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-21 21:29 UTC by Tuomas Nurmi
Modified: 2007-06-25 11:01 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Fixes the star size in OSD (does not support coloured stars, but they're not enabled in the code any more, so it is not necessary?) (5.29 KB, patch)
2007-06-21 21:51 UTC, Tuomas Nurmi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tuomas Nurmi 2007-06-21 21:29:33 UTC
Version:           1.4.6 (using KDE KDE 3.5.7)
Installed from:    Compiled From Sources
Compiler:          gcc (GCC) 4.1.2 
OS:                Linux

In Amarok 1.4.6, the new class StarManager pre-loads & pre-scales the rating stars for playlist to use. The problem is that OSD uses the same stars, unscaled, and due to that, the stars in OSD are shown too small.
Comment 1 Tuomas Nurmi 2007-06-21 21:51:53 UTC
Created attachment 20921 [details]
Fixes the star size in OSD (does not support coloured stars, but they're not enabled in the code any more, so it is not necessary?)
Comment 2 Mark Kretschmann 2007-06-25 11:01:31 UTC
SVN commit 679991 by markey:

Show the stars for the rating with the correct full size in the OSD. Thanks Tuomas :)

BUG: 147059


 M  +2 -0      ChangeLog  
 M  +4 -4      src/osd.cpp  
 M  +22 -8     src/starmanager.cpp  
 M  +8 -4      src/starmanager.h  


--- branches/stable/extragear/multimedia/amarok/ChangeLog #679990:679991
@@ -10,6 +10,8 @@
       Gosta <gostaj@gmail.com>. (BR 142999)
 
   BUGFIXES:
+   * The stars indicating the track rating would be shown too small in the
+     OSD. Patch by Tuomas Nurmi <tnurmi@edu.kauhajoki.fi>. (BR 147059)
 
 
 VERSION 1.4.6
--- branches/stable/extragear/multimedia/amarok/src/osd.cpp #679990:679991
@@ -203,7 +203,7 @@
 
     if( m_rating )
     {
-        QPixmap* star = StarManager::instance()->getStar( 1 );
+        QPixmap* star = StarManager::instance()->getStar( 1, true );
         if( rect.width() < star->width() * 5 )
             rect.setWidth( star->width() * 5 ); //changes right edge position
         rect.setHeight( rect.height() + star->height() + M ); //changes bottom edge pos
@@ -419,7 +419,7 @@
         m_volume = false;
     }
 
-    QPixmap* star = StarManager::instance()->getStar( m_rating/2 );
+    QPixmap* star = StarManager::instance()->getStar( m_rating/2, true );
     int graphicsHeight = 0;
 
     if( useMoodbar() )
@@ -448,9 +448,9 @@
 
         if( half )
         {
-            QPixmap* halfStar = StarManager::instance()->getHalfStar( m_rating/2 + 1 );
+            QPixmap* halfStar = StarManager::instance()->getHalfStar( m_rating/2 + 1, true );
             p.drawPixmap( r.left() + star->width() * ( m_rating / 2 ), r.top(), *halfStar );
-            star = StarManager::instance()->getStar( m_rating/2 + 1 );
+            star = StarManager::instance()->getStar( m_rating/2 + 1, true );
         }
 
         for( int i = 0; i < m_rating/2; i++ )
--- branches/stable/extragear/multimedia/amarok/src/starmanager.cpp #679990:679991
@@ -61,16 +61,22 @@
 
     int hval = m_height + m_margin * 2 - 4 + ( ( m_height % 2 ) ? 1 : 0 );
     QImage star = QImage( locate( "data", "amarok/images/star.png" ) ).smoothScale( hval, hval, QImage::ScaleMin );
+    QImage fullStar = QImage( locate( "data", "amarok/images/star.png" ) );
     m_star = star.copy();
+    m_fullStar = fullStar.copy();
     m_starPix.convertFromImage( star );
+    m_fullStarPix.convertFromImage( fullStar );
     m_greyedStar = star.copy();
     KIconEffect::toGray( m_greyedStar, 1.0 );
     m_greyedStarPix.convertFromImage( m_greyedStar );
     QImage half = QImage( locate( "data", "amarok/images/smallstar.png" ) ).smoothScale( hval, hval, QImage::ScaleMin );
+    QImage fullHalf = QImage( locate( "data", "amarok/images/smallstar.png" ) );
     m_halfStar = half.copy();
+    m_fullHalfStar = fullHalf.copy();
     if( AmarokConfig::customRatingsColors() )
         KIconEffect::colorize( m_halfStar, m_halfStarColor, 1.0 );
     m_halfStarPix.convertFromImage( m_halfStar );
+    m_fullHalfStarPix.convertFromImage( m_fullHalfStar );
 
     QImage tempstar;
     QImage temphalfstar;
@@ -99,36 +105,44 @@
 }
 
 QPixmap*
-StarManager::getStar( int num )
+StarManager::getStar( int num, bool full )
 {
-    if( num < 1 || num > 5 )
+    if(full)
+	return &m_fullStarPix;
+    else if( num < 1 || num > 5 )
         return &m_starPix;
     else
         return &m_pixmaps[num - 1];
 }
 
 QImage&
-StarManager::getStarImage( int num )
+StarManager::getStarImage( int num, bool full )
 {
-    if( num < 1 || num > 5 )
+    if(full)
+        return m_fullStar;
+    else if( num < 1 || num > 5 )
         return m_star;
     else
         return m_images[num - 1];
 }
 
 QPixmap*
-StarManager::getHalfStar( int num )
+StarManager::getHalfStar( int num, bool full )
 {
-    if( AmarokConfig::fixedHalfStarColor() || num == -1 )
+    if( full )
+        return &m_fullHalfStarPix;
+    else if( AmarokConfig::fixedHalfStarColor() || num == -1 )
         return &m_halfStarPix;
     else
         return &m_halfpixmaps[num - 1];
 }
 
 QImage&
-StarManager::getHalfStarImage( int num  )
+StarManager::getHalfStarImage( int num, bool full )
 {
-    if( AmarokConfig::fixedHalfStarColor() || num == -1 )
+    if( full )
+        return m_fullHalfStar;
+    else if( AmarokConfig::fixedHalfStarColor() || num == -1 )
         return m_halfStar;
     else
         return m_halfimages[num - 1];
--- branches/stable/extragear/multimedia/amarok/src/starmanager.h #679990:679991
@@ -27,12 +27,12 @@
         ~StarManager();
         static StarManager *instance();
 
-        QPixmap* getStar( int num );
+        QPixmap* getStar( int num, bool full = false );
         QPixmap* getGreyStar() { return &m_greyedStarPix; }
-        QPixmap* getHalfStar( int num = -1 );
-        QImage& getStarImage( int num );
+        QPixmap* getHalfStar( int num = -1, bool full = false  );
+        QImage& getStarImage( int num, bool full = false  );
         QImage& getGreyStarImage() { return m_greyedStar; }
-        QImage& getHalfStarImage( int num = -1 );
+        QImage& getHalfStarImage( int num = -1, bool full = false  );
 
         bool setColor( int starNum, const QColor &color );
         bool setHalfColor( const QColor &color );
@@ -50,10 +50,14 @@
         //cached stars...why both?  For faster conversion when drawing context browser
         QPixmap m_starPix;
         QImage m_star;
+        QPixmap m_fullStarPix;
+        QImage m_fullStar;
         QPixmap m_greyedStarPix;
         QImage m_greyedStar;
         QPixmap m_halfStarPix;
+        QPixmap m_fullHalfStarPix;
         QImage m_halfStar;
+        QImage m_fullHalfStar;
 
         QImage m_images[5];
         QImage m_halfimages[5];