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

List:       kde-commits
Subject:    extragear/multimedia/amarok/src
From:       Gábor Lehel <illissius () gmail ! com>
Date:       2006-04-30 21:33:33
Message-ID: 1146432813.247693.4062.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 535979 by illissius:

allow repeat album without random albums

 M  +2 -9      actionclasses.cpp  
 M  +1 -0      amarok.h  
 M  +13 -16    playlist.cpp  
 M  +1 -2      playlist.h  
 M  +4 -4      playlistitem.cpp  


--- trunk/extragear/multimedia/amarok/src/actionclasses.cpp #535978:535979
@@ -43,6 +43,7 @@
     bool favorScores() { return AmarokConfig::favorTracks() == \
                AmarokConfig::EnumFavorTracks::HigherScores; }
     bool favorRatings() { return AmarokConfig::favorTracks() == \
                AmarokConfig::EnumFavorTracks::HigherRatings; }
     bool favorLastPlay() { return AmarokConfig::favorTracks() == \
AmarokConfig::EnumFavorTracks::LessRecentlyPlayed; } +    bool entireAlbums() { \
return repeatAlbum() || randomAlbums(); }  }
 
 using namespace amaroK;
@@ -467,10 +468,6 @@
 {
     if( KAction *a = parentCollection()->action( "favor_tracks" ) )
         a->setEnabled( n );
-    SelectAction *a = static_cast<SelectAction*>( parentCollection()->action( \
                "repeat" ) );
-    if( a->currentItem() == AmarokConfig::EnumRepeat::Album && n != \
                AmarokConfig::EnumRandomMode::Albums )
-        a->setCurrentItem( AmarokConfig::EnumRepeat::Off );
-    a->popupMenu()->setItemEnabled( AmarokConfig::EnumRepeat::Album, n == \
AmarokConfig::EnumRandomMode::Albums );  SelectAction::setCurrentItem( n );
 }
 
@@ -499,11 +496,7 @@
     setItems( QStringList() << i18n( "&Off" ) << i18n( "&Track" )
                             << i18n( "&Album" ) << i18n( "&Playlist" ) );
     setIcons( QStringList() << "bottom" << "repeat_track" << "cdrom_mount" << \
                "repeat_playlist" );
-    if( amaroK::repeatAlbum() && !amaroK::randomAlbums() )
-        setCurrentItem( AmarokConfig::EnumRepeat::Off );
-    else
-        setCurrentItem( AmarokConfig::repeat() );
-    popupMenu()->setItemEnabled( AmarokConfig::EnumRepeat::Album, \
amaroK::randomAlbums() ); +    setCurrentItem( AmarokConfig::repeat() );
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
                
--- trunk/extragear/multimedia/amarok/src/amarok.h #535978:535979
@@ -177,6 +177,7 @@
     bool favorScores();
     bool favorRatings();
     bool favorLastPlay();
+    bool entireAlbums(); //repeatAlbum() || randomAlbums()
 
     const DynamicMode *dynamicMode(); //defined in playlist.cpp
 
--- trunk/extragear/multimedia/amarok/src/playlist.cpp #535978:535979
@@ -355,8 +355,9 @@
 
     //ensure we update action enabled states when repeat Playlist is toggled
     connect( ac->action( "repeat" ), SIGNAL(activated( int )), \
                SLOT(updateNextPrev()) );
-    connect( ac->action( "favor_tracks" ), SIGNAL( activated( int ) ), SLOT( \
                generateTotals( int ) ) );
-    connect( ac->action( "random_mode" ), SIGNAL( activated( int ) ), SLOT( \
generateAlbumInfo( int ) ) ); +    connect( ac->action( "repeat" ), SIGNAL( \
activated( int ) ), SLOT( generateInfo() ) ); +    connect( ac->action( \
"favor_tracks" ), SIGNAL( activated( int ) ), SLOT( generateInfo() ) ); +    connect( \
ac->action( "random_mode" ), SIGNAL( activated( int ) ), SLOT( generateInfo() ) );  
     m_undoButton->setEnabled( false );
     m_redoButton->setEnabled( false );
@@ -1036,10 +1037,10 @@
             emit queueChanged( PLItemList(), PLItemList( item ) );
         }
 
-        else if( amaroK::randomAlbums() && m_currentTrack && \
m_currentTrack->nextInAlbum() ) +        else if( amaroK::entireAlbums() && \
m_currentTrack && m_currentTrack->nextInAlbum() )  item = \
m_currentTrack->nextInAlbum();  
-        else if( amaroK::randomAlbums() && amaroK::repeatAlbum() &&
+        else if( amaroK::repeatAlbum() &&
                  repeatAlbumTrackCount() && ( repeatAlbumTrackCount() > 1 || \
!forceNext ) )  item = m_currentTrack->m_album->tracks.getFirst();
 
@@ -1248,7 +1249,7 @@
 {
     PlaylistItem *item = m_currentTrack;
 
-    if( amaroK::randomAlbums() )
+    if( amaroK::entireAlbums() )
     {
         item = 0;
         if( m_currentTrack )
@@ -1533,22 +1534,18 @@
         return DoNotStop;
 }
 
-void Playlist::generateAlbumInfo( int n )
+void Playlist::generateInfo()
 {
     m_albums.clear();
-    if( n == AmarokConfig::EnumRandomMode::Albums )
+    if( amaroK::entireAlbums() )
         for( MyIt it( this, MyIt::All ); *it; ++it )
             (*it)->refAlbum();
     m_total = 0;
-    for( MyIt it( this, MyIt::Visible ); *it; ++it )
-        (*it)->incrementTotals();
+    if( amaroK::entireAlbums() || AmarokConfig::favorTracks() )
+        for( MyIt it( this, MyIt::Visible ); *it; ++it )
+            (*it)->incrementTotals();
 }
 
-void Playlist::generateTotals( int /*favor*/ )
-{
-    generateAlbumInfo( AmarokConfig::randomMode() );
-}
-
 void Playlist::doubleClicked( QListViewItem *item )
 {
     /* We have to check if the item exists before calling activate, otherwise \
clicking on an empty @@ -1626,7 +1623,7 @@
     if( !item->isEnabled() )
         return;
 
-    if( amaroK::randomAlbums() )
+    if( amaroK::entireAlbums() )
     {
         if( !item->nextInAlbum() )
             appendToPreviousAlbums( item->m_album );
@@ -3762,7 +3759,7 @@
 
     if( itemCount == 1 && ( item->isCurrent() || item->isQueued() || \
                m_stopAfterTrack == item ||
                             ( !AmarokConfig::randomMode() && ( \
                amaroK::repeatPlaylist() || afterCurrent ) ) ||
-                            ( amaroK::randomAlbums() && m_currentTrack &&
+                            ( amaroK::entireAlbums() && m_currentTrack &&
                               item->m_album == m_currentTrack->m_album &&
                               ( amaroK::repeatAlbum() || ( ( !item->track() && \
                afterCurrent ) ||
                                                              item->track() > \
                m_currentTrack->track() ) ) ) ) )
--- trunk/extragear/multimedia/amarok/src/playlist.h #535978:535979
@@ -249,8 +249,7 @@
         void columnResizeEvent( int, int, int );
         void doubleClicked( QListViewItem* );
 
-        void generateAlbumInfo( int n ); //generates info for Random Albums
-        void generateTotals( int favor ); //generates info for Favor Tracks
+        void generateInfo(); //generates info for Random Albums
 
         void queue( QListViewItem*, bool multi = false );
            /* the only difference multi makes is whether it emits queueChanged(). \
                (if multi, then no)
--- trunk/extragear/multimedia/amarok/src/playlistitem.cpp #535978:535979
@@ -1005,7 +1005,7 @@
 
 void PlaylistItem::refAlbum()
 {
-    if( amaroK::randomAlbums() )
+    if( amaroK::entireAlbums() )
     {
         if( listView()->m_albums[artist_album()].find( album() ) == \
                listView()->m_albums[artist_album()].end() )
             listView()->m_albums[artist_album()][album()] = new PlaylistAlbum;
@@ -1016,7 +1016,7 @@
 
 void PlaylistItem::derefAlbum()
 {
-    if( amaroK::randomAlbums() )
+    if( amaroK::entireAlbums() )
     {
         m_album->refcount--;
         if( !m_album->refcount )
@@ -1032,7 +1032,7 @@
 
 void PlaylistItem::incrementTotals()
 {
-    if( amaroK::randomAlbums() )
+    if( amaroK::entireAlbums() )
     {
         const uint prevCount = m_album->tracks.count();
         if( !track() || !m_album->tracks.count() || ( \
m_album->tracks.getLast()->track() && m_album->tracks.getLast()->track() < track() ) \
) @@ -1057,7 +1057,7 @@
 
 void PlaylistItem::decrementTotals()
 {
-    if( amaroK::randomAlbums() )
+    if( amaroK::entireAlbums() )
     {
         const Q_INT64 prevTotal = m_album->total;
         Q_INT64 total = m_album->total * m_album->tracks.count();


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

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