From a0b5006a731f74c268980464588365bf4060f6bd Mon Sep 17 00:00:00 2001
From: Christian Muehlhaeuser <muesli@gmail.com>
Date: Wed, 28 Nov 2012 12:55:49 +0100
Subject: [PATCH] * Remove mode handling from ViewManager.

---
 src/libtomahawk/ViewManager.cpp | 51 ---------------------------------
 src/libtomahawk/ViewManager.h   |  2 --
 2 files changed, 53 deletions(-)

diff --git a/src/libtomahawk/ViewManager.cpp b/src/libtomahawk/ViewManager.cpp
index ae44c171b..c11074012 100644
--- a/src/libtomahawk/ViewManager.cpp
+++ b/src/libtomahawk/ViewManager.cpp
@@ -121,7 +121,6 @@ ViewManager::ViewManager( QObject* parent )
 
 ViewManager::~ViewManager()
 {
-    saveCurrentPlaylistSettings();
     delete m_whatsHotWidget;
     delete m_newReleasesWidget;
     delete m_welcomeWidget;
@@ -525,8 +524,6 @@ ViewManager::setPage( ViewPage* page, bool trackHistory )
     if ( page == m_currentPage )
         return;
 
-    // save the old playlist shuffle state in config before we change playlists
-    saveCurrentPlaylistSettings();
     unlinkPlaylist();
 
     if ( m_stack->indexOf( page->widget() ) < 0 )
@@ -606,29 +603,6 @@ ViewManager::unlinkPlaylist()
 }
 
 
-void
-ViewManager::saveCurrentPlaylistSettings()
-{
-    TomahawkSettings* s = TomahawkSettings::instance();
-    Tomahawk::playlist_ptr pl = playlistForInterface( currentPlaylistInterface() );
-
-    if ( !pl.isNull() )
-    {
-        s->setShuffleState( pl->guid(), currentPlaylistInterface()->shuffled() );
-        s->setRepeatMode( pl->guid(), currentPlaylistInterface()->repeatMode() );
-    }
-    else
-    {
-        Tomahawk::dynplaylist_ptr dynPl = dynamicPlaylistForInterface( currentPlaylistInterface() );
-        if ( !dynPl.isNull() )
-        {
-            s->setShuffleState( dynPl->guid(), currentPlaylistInterface()->shuffled() );
-            s->setRepeatMode( dynPl->guid(), currentPlaylistInterface()->repeatMode() );
-        }
-    }
-}
-
-
 void
 ViewManager::updateView()
 {
@@ -672,31 +646,6 @@ ViewManager::updateView()
     }
     m_infobar->setLongDescription( currentPage()->longDescription() );
     m_infobar->setPixmap( currentPage()->pixmap() );
-
-    // turn on shuffle/repeat mode for the new playlist view if specified in config
-    loadCurrentPlaylistSettings();
-}
-
-
-void
-ViewManager::loadCurrentPlaylistSettings()
-{
-    TomahawkSettings* s = TomahawkSettings::instance();
-    Tomahawk::playlist_ptr pl = playlistForInterface( currentPlaylistInterface() );
-
-    if ( !pl.isNull() )
-    {
-        currentPlaylistInterface()->setShuffled( s->shuffleState( pl->guid() ));
-        currentPlaylistInterface()->setRepeatMode( s->repeatMode( pl->guid() ));
-    }
-    else
-    {
-        Tomahawk::dynplaylist_ptr dynPl = dynamicPlaylistForInterface( currentPlaylistInterface() );
-        if ( !dynPl.isNull() )
-        {
-            currentPlaylistInterface()->setShuffled( s->shuffleState( dynPl->guid() ));
-        }
-    }
 }
 
 
diff --git a/src/libtomahawk/ViewManager.h b/src/libtomahawk/ViewManager.h
index 238897f02..5b7d86e25 100644
--- a/src/libtomahawk/ViewManager.h
+++ b/src/libtomahawk/ViewManager.h
@@ -175,8 +175,6 @@ private:
     void setPage( Tomahawk::ViewPage* page, bool trackHistory = true );
     void updateView();
     void unlinkPlaylist();
-    void saveCurrentPlaylistSettings();
-    void loadCurrentPlaylistSettings();
 
     Tomahawk::playlist_ptr playlistForInterface( Tomahawk::playlistinterface_ptr plInterface ) const;
     Tomahawk::dynplaylist_ptr dynamicPlaylistForInterface( Tomahawk::playlistinterface_ptr plInterface ) const;