[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdeextragear-1/amarok/src
From:       Seb Ruiz <seb100 () optusnet ! com ! au>
Date:       2005-04-12 11:38:44
Message-ID: 20050412113844.6DE36633 () office ! kde ! org
[Download RAW message or body]

CVS commit by seb: 

* Disable playlist item after play in party mode


  M +17 -0     playlist.cpp   1.466
  M +1 -0      playlist.h   1.159
  M +6 -4      playlistitem.cpp   1.149
  M +4 -0      playlistitem.h   1.74


--- kdeextragear-1/amarok/src/playlist.cpp  #1.465:1.466
@@ -670,4 +671,5 @@ Playlist::playNextTrack( bool forceNext 
                 if ( *it == currentTrack() )
                 {
+                    slotMakeItemHistory( currentTrack() );
                     if ( x < 5 )
                     {
@@ -776,4 +778,6 @@ Playlist::activate( QListViewItem *item 
     {
         #define item static_cast<PlaylistItem*>(item)
+        if ( item->isHistory() )
+            return;
 
         m_prevTracks.append( item );
@@ -2437,4 +2441,17 @@ Playlist::slotGlowTimer() //SLOT
 
 void
+Playlist::slotMakeItemHistory( PlaylistItem *item )
+{
+    item->setHistory( true );
+
+    //Dont let the user do anything.  ANYTHING! --> All your base are belong to us!
+    static_cast<QListViewItem*>(item)->setDragEnabled( false );
+    static_cast<QListViewItem*>(item)->setDropEnabled( false );
+    static_cast<QListViewItem*>(item)->setSelectable ( false );
+
+    repaintItem( item );
+}
+
+void
 Playlist::slotRepeatTrackToggled( bool enabled )
 {

--- kdeextragear-1/amarok/src/playlistitem.cpp  #1.148:1.149
@@ -71,4 +71,5 @@ PlaylistItem::PlaylistItem( const MetaBu
         , m_url( bundle.url() )
         , m_missing( false )
+        , m_history( false )
 {
     setDragEnabled( true );
@@ -81,4 +82,5 @@ PlaylistItem::PlaylistItem( QDomNode nod
         , m_url( node.toElement().attribute( "url" ) )
         , m_missing( false )
+        , m_history( false )
 {
     setDragEnabled( true );
@@ -335,8 +337,8 @@ void PlaylistItem::paintCell( QPainter *
     else {
         QColorGroup _cg = cg;
-        if( m_missing )
-            //this file doesn't exist
-            //FIXME cg.mid() is not acceptable, it is not the disabled palette
-            _cg.setColor( QColorGroup::Text, cg.mid() );
+        //FIXME not acceptable to hardocode the colour
+        QColor disabledText = QColor( 172, 172, 172 );
+        if( m_missing || m_history )
+            _cg.setColor( QColorGroup::Text, disabledText );
 
         KListViewItem::paintCell( p, _cg, column, width, align );

--- kdeextragear-1/amarok/src/playlist.h  #1.158:1.159
@@ -163,4 +163,5 @@ class Playlist : private KListView, publ
     private slots:
         void slotGlowTimer();
+        void slotMakeItemHistory( PlaylistItem* item );
         void slotRepeatTrackToggled( bool enabled );
         void slotEraseMarker();

--- kdeextragear-1/amarok/src/playlistitem.h  #1.73:1.74
@@ -66,4 +66,7 @@ class PlaylistItem : public KListViewIte
         void setText( int, const QString& ); //virtual
 
+        bool isHistory() { return m_history; }
+        void setHistory( bool enable ) { m_history = enable; }
+
         /// convenience functions
         Playlist *listView() const { return (Playlist*)KListViewItem::listView(); }
@@ -114,4 +117,5 @@ class PlaylistItem : public KListViewIte
         const KURL m_url;
         bool m_missing;
+        bool m_history;
 
         static bool s_pixmapChanged;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic