1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-05 05:37:29 +02:00

Move Dashboard to libtomahawk-widgets

This commit is contained in:
Dominik Schmidt
2013-06-30 23:30:00 +02:00
parent 62f1fde90a
commit edbc60f274
8 changed files with 23 additions and 30 deletions

View File

@@ -47,7 +47,6 @@
#include "playlist/dynamic/widgets/DynamicWidget.h" #include "playlist/dynamic/widgets/DynamicWidget.h"
#include "widgets/NewReleasesWidget.h" #include "widgets/NewReleasesWidget.h"
#include "widgets/Dashboard.h"
#include "widgets/WhatsHotWidget.h" #include "widgets/WhatsHotWidget.h"
#include "widgets/infowidgets/SourceInfoWidget.h" #include "widgets/infowidgets/SourceInfoWidget.h"
#include "widgets/infowidgets/ArtistInfoWidget.h" #include "widgets/infowidgets/ArtistInfoWidget.h"
@@ -57,6 +56,7 @@
#include "widgets/AnimatedSplitter.h" #include "widgets/AnimatedSplitter.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/TomahawkUtilsGui.h"
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QMetaMethod> #include <QMetaMethod>
@@ -79,7 +79,6 @@ ViewManager::instance()
ViewManager::ViewManager( QObject* parent ) ViewManager::ViewManager( QObject* parent )
: QObject( parent ) : QObject( parent )
, m_widget( new QWidget() ) , m_widget( new QWidget() )
, m_dashboard( new Dashboard() )
, m_whatsHotWidget( 0 ) , m_whatsHotWidget( 0 )
, m_newReleasesWidget( 0 ) , m_newReleasesWidget( 0 )
, m_recentPlaysWidget( 0 ) , m_recentPlaysWidget( 0 )
@@ -130,7 +129,6 @@ ViewManager::~ViewManager()
{ {
delete m_whatsHotWidget; delete m_whatsHotWidget;
delete m_newReleasesWidget; delete m_newReleasesWidget;
delete m_dashboard;
delete m_recentPlaysWidget; delete m_recentPlaysWidget;
delete m_inboxWidget; delete m_inboxWidget;
delete m_contextWidget; delete m_contextWidget;
@@ -401,13 +399,6 @@ ViewManager::playlistInterfaceChanged( Tomahawk::playlistinterface_ptr interface
} }
Tomahawk::ViewPage*
ViewManager::showDashboard()
{
return show( m_dashboard );
}
Tomahawk::ViewPage* Tomahawk::ViewPage*
ViewManager::showWhatsHotPage() ViewManager::showWhatsHotPage()
{ {
@@ -849,13 +840,6 @@ ViewManager::showCurrentTrack()
} }
Tomahawk::ViewPage*
ViewManager::dashboard() const
{
return m_dashboard;
}
Tomahawk::ViewPage* Tomahawk::ViewPage*
ViewManager::whatsHotWidget() const ViewManager::whatsHotWidget() const
{ {

View File

@@ -56,7 +56,6 @@ class SourceInfoWidget;
class InfoBar; class InfoBar;
class TrackInfoWidget; class TrackInfoWidget;
class NewReleasesWidget; class NewReleasesWidget;
class Dashboard;
class WhatsHotWidget; class WhatsHotWidget;
class QPushButton; class QPushButton;
class InboxModel; class InboxModel;
@@ -92,7 +91,6 @@ public:
Tomahawk::ViewPage* show( Tomahawk::ViewPage* page ); Tomahawk::ViewPage* show( Tomahawk::ViewPage* page );
Tomahawk::ViewPage* dashboard() const;
Tomahawk::ViewPage* whatsHotWidget() const; Tomahawk::ViewPage* whatsHotWidget() const;
Tomahawk::ViewPage* newReleasesWidget() const; Tomahawk::ViewPage* newReleasesWidget() const;
Tomahawk::ViewPage* recentPlaysWidget() const; Tomahawk::ViewPage* recentPlaysWidget() const;
@@ -138,7 +136,6 @@ signals:
public slots: public slots:
Tomahawk::ViewPage* showSuperCollection(); Tomahawk::ViewPage* showSuperCollection();
Tomahawk::ViewPage* showDashboard();
Tomahawk::ViewPage* showWhatsHotPage(); Tomahawk::ViewPage* showWhatsHotPage();
Tomahawk::ViewPage* showNewReleasesPage(); Tomahawk::ViewPage* showNewReleasesPage();
Tomahawk::ViewPage* showRecentPlaysPage(); Tomahawk::ViewPage* showRecentPlaysPage();
@@ -192,7 +189,6 @@ private:
TreeModel* m_superCollectionModel; TreeModel* m_superCollectionModel;
TreeWidget* m_superCollectionView; TreeWidget* m_superCollectionView;
QueueView* m_queue; QueueView* m_queue;
Dashboard* m_dashboard;
WhatsHotWidget* m_whatsHotWidget; WhatsHotWidget* m_whatsHotWidget;
NewReleasesWidget* m_newReleasesWidget; NewReleasesWidget* m_newReleasesWidget;
Tomahawk::ViewPage* m_recentPlaysWidget; Tomahawk::ViewPage* m_recentPlaysWidget;

View File

@@ -47,6 +47,7 @@
#define HISTORY_TRACK_ITEMS 15 #define HISTORY_TRACK_ITEMS 15
using namespace Tomahawk; using namespace Tomahawk;
using namespace Tomahawk::Widgets;
Dashboard::Dashboard( QWidget* parent ) Dashboard::Dashboard( QWidget* parent )

View File

@@ -44,6 +44,11 @@ namespace Ui
class Dashboard; class Dashboard;
} }
namespace Tomahawk
{
namespace Widgets
{
class DLLEXPORT PlaylistDelegate : public QStyledItemDelegate class DLLEXPORT PlaylistDelegate : public QStyledItemDelegate
{ {
Q_OBJECT Q_OBJECT
@@ -124,4 +129,6 @@ private:
Tomahawk::playlistinterface_ptr m_playlistInterface; Tomahawk::playlistinterface_ptr m_playlistInterface;
}; };
}; // Widgets
}; // Tomahawk
#endif // DASHBOARD_H #endif // DASHBOARD_H

View File

@@ -261,7 +261,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="PlaylistWidget" name="playlistWidget"/> <widget class="Tomahawk::Widgets::PlaylistWidget" name="playlistWidget"/>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -296,7 +296,7 @@
<header location="global">playlist/GridView.h</header> <header location="global">playlist/GridView.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>PlaylistWidget</class> <class>Tomahawk::Widgets::PlaylistWidget</class>
<extends>QListWidget</extends> <extends>QListWidget</extends>
<header>widgets/Dashboard.h</header> <header>widgets/Dashboard.h</header>
</customwidget> </customwidget>

View File

@@ -50,7 +50,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="PlaylistWidget" name="mostPlayedPlaylists"/> <widget class="Tomahawk::Widgets::PlaylistWidget" name="mostPlayedPlaylists"/>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -97,7 +97,7 @@
<header location="global">playlist/GridView.h</header> <header location="global">playlist/GridView.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>PlaylistWidget</class> <class>Tomahawk::Widgets::PlaylistWidget</class>
<extends>QListWidget</extends> <extends>QListWidget</extends>
<header>widgets/Dashboard.h</header> <header>widgets/Dashboard.h</header>
</customwidget> </customwidget>

View File

@@ -150,7 +150,6 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
audioStopped(); audioStopped();
vm->setQueue( m_queueView ); vm->setQueue( m_queueView );
vm->showDashboard();
if ( TomahawkSettings::instance()->fullscreenEnabled() ) if ( TomahawkSettings::instance()->fullscreenEnabled() )
{ {

View File

@@ -34,6 +34,7 @@
#include "Source.h" #include "Source.h"
#include "ViewManager.h" #include "ViewManager.h"
#include "widgets/NetworkActivityWidget.h" #include "widgets/NetworkActivityWidget.h"
#include "widgets/Dashboard.h"
#include "GlobalActionManager.h" #include "GlobalActionManager.h"
#include "DropJob.h" #include "DropJob.h"
#include "items/PlaylistItems.h" #include "items/PlaylistItems.h"
@@ -302,10 +303,6 @@ SourcesModel::appendGroups()
// new SourceTreeItem( this, m_rootItem, SourcesModel::Divider, 2 ); // new SourceTreeItem( this, m_rootItem, SourcesModel::Divider, 2 );
m_myMusicGroup = new GroupItem( this, m_rootItem, tr( "My Music" ), 3 ); m_myMusicGroup = new GroupItem( this, m_rootItem, tr( "My Music" ), 3 );
GenericPageItem* dashboard = new GenericPageItem( this, m_browse, tr( "Dashboard" ), ImageRegistry::instance()->icon( RESPATH "images/dashboard.svg" ),
boost::bind( &ViewManager::showDashboard, ViewManager::instance() ),
boost::bind( &ViewManager::dashboard, ViewManager::instance() ) );
dashboard->setSortValue( 0 );
// super collection // super collection
GenericPageItem* sc = new GenericPageItem( this, m_browse, tr( "SuperCollection" ), ImageRegistry::instance()->icon( RESPATH "images/supercollection.svg" ), GenericPageItem* sc = new GenericPageItem( this, m_browse, tr( "SuperCollection" ), ImageRegistry::instance()->icon( RESPATH "images/supercollection.svg" ),
@@ -343,6 +340,15 @@ SourcesModel::appendGroups()
endInsertRows(); endInsertRows();
// addDynamicPage takes care of begin/endInsertRows itself // addDynamicPage takes care of begin/endInsertRows itself
ViewManager::instance()->addDynamicPage("dashboard",
tr( "Dashboard" ),
ImageRegistry::instance()->icon( RESPATH "images/dashboard.svg" ),
boost::lambda::bind( boost::lambda::new_ptr< Tomahawk::Widgets::Dashboard >() )
);
//HACK: this may not belong here, but adding the pages probably doesn't belong here either
//TODO: find a good place for this
ViewManager::instance()->showDynamicPage("dashboard");
ViewManager::instance()->addDynamicPage("network_activity", ViewManager::instance()->addDynamicPage("network_activity",
tr( "Network Activity" ), tr( "Network Activity" ),
TomahawkUtils::defaultPixmap( TomahawkUtils::NetworkActivity, TomahawkUtils::Original ), TomahawkUtils::defaultPixmap( TomahawkUtils::NetworkActivity, TomahawkUtils::Original ),