diff --git a/src/libtomahawk/ViewManager.cpp b/src/libtomahawk/ViewManager.cpp index f0b43a57a..4b3f05495 100644 --- a/src/libtomahawk/ViewManager.cpp +++ b/src/libtomahawk/ViewManager.cpp @@ -1,6 +1,6 @@ /* === This file is part of Tomahawk Player - === * - * Copyright 2010-2011, Christian Muehlhaeuser + * Copyright 2010-2013, Christian Muehlhaeuser * Copyright 2010-2011, Jeff Mitchell * Copyright 2010-2012, Leo Franchi * Copyright 2013, Teo Mrnjavac @@ -586,6 +586,17 @@ ViewManager::destroyPage( ViewPage* page ) } +bool +ViewManager::destroyCurrentPage() +{ + if ( !currentPage() || !currentPage()->isTemporaryPage() ) + return false; + + destroyPage( currentPage() ); + return true; +} + + void ViewManager::setPage( ViewPage* page, bool trackHistory ) { @@ -649,7 +660,7 @@ ViewManager::setPage( ViewPage* page, bool trackHistory ) m_stack->setCurrentWidget( page->widget() ); //This should save the CPU cycles, especially with pages like the visualizer - if(previousPage && previousPage != page->widget()) + if ( previousPage && previousPage != page->widget() ) previousPage->hide(); updateView(); diff --git a/src/libtomahawk/ViewManager.h b/src/libtomahawk/ViewManager.h index 682058988..0a7ad623f 100644 --- a/src/libtomahawk/ViewManager.h +++ b/src/libtomahawk/ViewManager.h @@ -1,6 +1,6 @@ /* === This file is part of Tomahawk Player - === * - * Copyright 2010-2011, Christian Muehlhaeuser + * Copyright 2010-2013, Christian Muehlhaeuser * Copyright 2010-2011, Jeff Mitchell * * Tomahawk is free software: you can redistribute it and/or modify @@ -164,6 +164,7 @@ public slots: QList< Tomahawk::ViewPage* > allPages() const; QList< Tomahawk::ViewPage* > historyPages() const; void destroyPage( Tomahawk::ViewPage* page ); + bool destroyCurrentPage(); void showQueue() { emit showQueueRequested(); } void hideQueue() { emit hideQueueRequested(); }