extragear/multimedia/amarok/src

Mark Kretschmann markey at web.de
Thu Nov 30 19:32:40 UTC 2006


SVN commit 609431 by markey:

Ok, here is a new idea I'm toying with, inspired by KMail: Whenever new items arrive in the playlist, we draw them in a different color (red currently). This is cool because when you merge two playlists, you have a visual cue that tells you where the new playlist begins.

Well so far this is just 10-minute hack to demonstrate the idea. If people like it, we could develop it further.

CCMAIL: amarok at kde.org


 M  +8 -0      playlist.cpp  
 M  +7 -3      playlistitem.cpp  
 M  +2 -0      playlistitem.h  


--- trunk/extragear/multimedia/amarok/src/playlist.cpp #609430:609431
@@ -4426,6 +4426,14 @@
       saveXML( fileName );
       list.append( fileName );
 
+      // Reset isNew state of all items in the playlist (determines font coloring)
+      PlaylistItem* item = static_cast<PlaylistItem*>( firstChild() ); 
+      while( item ) {
+         item->setIsNew( false );
+         item = item->nextSibling();
+      }
+      triggerUpdate();
+
       return true;
    }
 
--- trunk/extragear/multimedia/amarok/src/playlistitem.cpp #609430:609431
@@ -63,6 +63,7 @@
         , m_album( 0 )
         , m_deleteAfterEdit( false )
         , m_isBeingRenamed( false )
+        , m_isNew( true )
 {
     setDragEnabled( true );
 
@@ -688,8 +689,7 @@
         }
         #endif
 
-        const QColor textc = isSelected() ? _cg.highlightedText()
-                            : _cg.text();
+        const QColor textc = isSelected() ? _cg.highlightedText() : _cg.text();
 
         buf.fill( bg );
 
@@ -726,7 +726,11 @@
                                 + painter->fontMetrics().minRightBearing();
             }
             p.setFont( font );
-            p.setPen( textc );
+            if( m_isNew )
+                p.setPen( Qt::red );
+            else
+                p.setPen( textc );
+            
             const int _width = width - leftMargin - margin + minbearing - 1; // -1 seems to be necessary
             const QString _text = KStringHandler::rPixelSqueeze( colText, painter->fontMetrics(), _width );
             p.drawText( leftMargin, 0, _width, height(), align, _text );
--- trunk/extragear/multimedia/amarok/src/playlistitem.h #609430:609431
@@ -81,6 +81,7 @@
         bool isBeingRenamed() const { return m_isBeingRenamed; }
         void setDeleteAfterEditing( bool dae ) { m_deleteAfterEdit = dae; }
         bool deleteAfterEditing() const { return m_deleteAfterEdit; }
+        void setIsNew( bool is ) { m_isNew = is; }
 
         /// convenience functions
         Playlist *listView() const { return reinterpret_cast<Playlist*>( KListViewItem::listView() ); }
@@ -162,6 +163,7 @@
         bool m_filestatusEnabled;
         bool m_deleteAfterEdit;
         bool m_isBeingRenamed;
+        bool m_isNew;
 
         static bool s_pixmapChanged;
         static const QString &editingText();



More information about the Amarok mailing list