mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
Make dashboard a standalone target
This commit is contained in:
@@ -15,6 +15,7 @@ add_subdirectory( libtomahawk-widgets )
|
|||||||
# plugins
|
# plugins
|
||||||
add_subdirectory( accounts )
|
add_subdirectory( accounts )
|
||||||
add_subdirectory( infoplugins )
|
add_subdirectory( infoplugins )
|
||||||
|
add_subdirectory( viewpages )
|
||||||
|
|
||||||
|
|
||||||
# application
|
# application
|
||||||
|
@@ -6,14 +6,12 @@ list(APPEND ${TOMAHAWK_WIDGETS_LIBRARY_TARGET}_SOURCES
|
|||||||
PlaylistWidget.cpp
|
PlaylistWidget.cpp
|
||||||
|
|
||||||
# ViewPages
|
# ViewPages
|
||||||
Dashboard.cpp
|
|
||||||
NetworkActivityWidget.cpp
|
NetworkActivityWidget.cpp
|
||||||
NetworkActivityWorker.cpp
|
NetworkActivityWorker.cpp
|
||||||
SocialPlaylistWidget.cpp
|
SocialPlaylistWidget.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND ${TOMAHAWK_WIDGETS_LIBRARY_TARGET}_UI
|
list(APPEND ${TOMAHAWK_WIDGETS_LIBRARY_TARGET}_UI
|
||||||
DashboardWidget.ui
|
|
||||||
NetworkActivityWidget.ui
|
NetworkActivityWidget.ui
|
||||||
SocialPlaylistWidget.ui
|
SocialPlaylistWidget.ui
|
||||||
)
|
)
|
||||||
|
@@ -38,7 +38,6 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "WidgetsDllMacro.h"
|
#include "WidgetsDllMacro.h"
|
||||||
#include "Dashboard.h"
|
|
||||||
|
|
||||||
|
|
||||||
class PlayableModel;
|
class PlayableModel;
|
||||||
|
@@ -20,8 +20,9 @@
|
|||||||
|
|
||||||
#include "sourcetree/SourcesModel.h"
|
#include "sourcetree/SourcesModel.h"
|
||||||
|
|
||||||
|
#include "../../viewpages/dashboard/Dashboard.h"
|
||||||
|
|
||||||
#include <libtomahawk-widgets/NetworkActivityWidget.h>
|
#include <libtomahawk-widgets/NetworkActivityWidget.h>
|
||||||
#include <libtomahawk-widgets/Dashboard.h>
|
|
||||||
|
|
||||||
#include "sourcetree/items/ScriptCollectionItem.h"
|
#include "sourcetree/items/ScriptCollectionItem.h"
|
||||||
#include "sourcetree/items/SourceTreeItem.h"
|
#include "sourcetree/items/SourceTreeItem.h"
|
||||||
@@ -44,6 +45,7 @@
|
|||||||
#include "playlist/dynamic/widgets/DynamicWidget.h"
|
#include "playlist/dynamic/widgets/DynamicWidget.h"
|
||||||
#include "utils/ImageRegistry.h"
|
#include "utils/ImageRegistry.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
#include "utils/PluginLoader.h"
|
||||||
|
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
@@ -338,19 +340,29 @@ SourcesModel::appendGroups()
|
|||||||
|
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
|
|
||||||
// addDynamicPage takes care of begin/endInsertRows itself
|
|
||||||
ViewManager::instance()->addDynamicPage( new Tomahawk::Widgets::Dashboard, Tomahawk::Widgets::DASHBOARD_VIEWPAGE_NAME );
|
|
||||||
|
|
||||||
//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( Tomahawk::Widgets::DASHBOARD_VIEWPAGE_NAME );
|
|
||||||
|
|
||||||
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 ),
|
||||||
boost::lambda::bind( boost::lambda::new_ptr< Tomahawk::Widgets::NetworkActivityWidget >() ),
|
boost::lambda::bind( boost::lambda::new_ptr< Tomahawk::Widgets::NetworkActivityWidget >() ),
|
||||||
2
|
2
|
||||||
);
|
);
|
||||||
|
|
||||||
|
QHash< QString, QObject* > plugins = Tomahawk::Utils::PluginLoader( "viewpage" ).loadPlugins();
|
||||||
|
foreach ( QObject* plugin, plugins.values() )
|
||||||
|
{
|
||||||
|
Tomahawk::ViewPagePlugin* viewPagePlugin = qobject_cast< ViewPagePlugin* >( plugin );
|
||||||
|
if ( viewPagePlugin )
|
||||||
|
{
|
||||||
|
tDebug() << Q_FUNC_INFO << "Loaded viewpage plugin:" << plugins.key( plugin );
|
||||||
|
ViewManager::instance()->addDynamicPage( viewPagePlugin );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tDebug() << Q_FUNC_INFO << "Loaded invalid plugin:" << plugins.key( plugin );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewManager::instance()->showDynamicPage( Tomahawk::Widgets::DASHBOARD_VIEWPAGE_NAME );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
7
src/viewpages/CMakeLists.txt
Normal file
7
src/viewpages/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
file(GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*")
|
||||||
|
foreach(SUBDIRECTORY ${SUBDIRECTORIES})
|
||||||
|
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}" AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/CMakeLists.txt")
|
||||||
|
add_subdirectory(${SUBDIRECTORY})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
33
src/viewpages/ViewPageDllMacro.h
Normal file
33
src/viewpages/ViewPageDllMacro.h
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ACCOUNTDLLMACRO_H
|
||||||
|
#define ACCOUNTDLLMACRO_H
|
||||||
|
|
||||||
|
#include <QtCore/qglobal.h>
|
||||||
|
|
||||||
|
#ifndef TOMAHAWK_VIEWPAGE_EXPORT
|
||||||
|
# if defined (TOMAHAWK_VIEWPAGE_EXPORT_PRO)
|
||||||
|
# define TOMAHAWK_VIEWPAGE_EXPORT Q_DECL_EXPORT
|
||||||
|
# else
|
||||||
|
# define TOMAHAWK_VIEWPAGE_EXPORT Q_DECL_IMPORT
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
10
src/viewpages/dashboard/CMakeLists.txt
Normal file
10
src/viewpages/dashboard/CMakeLists.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
tomahawk_add_plugin(dashboard
|
||||||
|
TYPE viewpage
|
||||||
|
EXPORT_MACRO TOMAHAWK_VIEWPAGE_EXPORT_PRO
|
||||||
|
SOURCES
|
||||||
|
Dashboard.cpp
|
||||||
|
UI
|
||||||
|
DashboardWidget.ui
|
||||||
|
LINK_LIBRARIES
|
||||||
|
tomahawk-widgets
|
||||||
|
)
|
@@ -21,13 +21,14 @@
|
|||||||
#include "Dashboard.h"
|
#include "Dashboard.h"
|
||||||
#include "ui_DashboardWidget.h"
|
#include "ui_DashboardWidget.h"
|
||||||
|
|
||||||
|
#include "libtomahawk-widgets/PlaylistDelegate.h"
|
||||||
|
|
||||||
#include "ViewManager.h"
|
#include "ViewManager.h"
|
||||||
#include "SourceList.h"
|
#include "SourceList.h"
|
||||||
#include "TomahawkSettings.h"
|
#include "TomahawkSettings.h"
|
||||||
#include "widgets/RecentPlaylistsModel.h"
|
#include "widgets/RecentPlaylistsModel.h"
|
||||||
#include "widgets/RecentlyPlayedPlaylistsModel.h"
|
#include "widgets/RecentlyPlayedPlaylistsModel.h"
|
||||||
#include "MetaPlaylistInterface.h"
|
#include "MetaPlaylistInterface.h"
|
||||||
#include "PlaylistDelegate.h"
|
|
||||||
#include "audio/AudioEngine.h"
|
#include "audio/AudioEngine.h"
|
||||||
#include "playlist/AlbumModel.h"
|
#include "playlist/AlbumModel.h"
|
||||||
#include "playlist/RecentlyPlayedModel.h"
|
#include "playlist/RecentlyPlayedModel.h"
|
@@ -33,7 +33,7 @@
|
|||||||
#include <QListWidgetItem>
|
#include <QListWidgetItem>
|
||||||
#include <QStyledItemDelegate>
|
#include <QStyledItemDelegate>
|
||||||
|
|
||||||
#include "WidgetsDllMacro.h"
|
#include "../ViewPageDllMacro.h"
|
||||||
|
|
||||||
class AlbumModel;
|
class AlbumModel;
|
||||||
class RecentlyPlayedModel;
|
class RecentlyPlayedModel;
|
||||||
@@ -83,7 +83,7 @@ private:
|
|||||||
|
|
||||||
const QString DASHBOARD_VIEWPAGE_NAME = "dashboard";
|
const QString DASHBOARD_VIEWPAGE_NAME = "dashboard";
|
||||||
|
|
||||||
class TOMAHAWK_WIDGETS_EXPORT Dashboard : public Tomahawk::ViewPageLazyLoader< DashboardWidget >
|
class TOMAHAWK_VIEWPAGE_EXPORT Dashboard : public Tomahawk::ViewPageLazyLoader< DashboardWidget >
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES( Tomahawk::ViewPagePlugin )
|
Q_INTERFACES( Tomahawk::ViewPagePlugin )
|
@@ -298,7 +298,7 @@
|
|||||||
<customwidget>
|
<customwidget>
|
||||||
<class>Tomahawk::Widgets::PlaylistWidget</class>
|
<class>Tomahawk::Widgets::PlaylistWidget</class>
|
||||||
<extends>QListWidget</extends>
|
<extends>QListWidget</extends>
|
||||||
<header>PlaylistWidget.h</header>
|
<header>libtomahawk-widgets/PlaylistWidget.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
Reference in New Issue
Block a user