mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-02-26 04:43:06 +01:00
Make dashboard a standalone target
This commit is contained in:
parent
66e2a57beb
commit
545321436b
@ -15,6 +15,7 @@ add_subdirectory( libtomahawk-widgets )
|
||||
# plugins
|
||||
add_subdirectory( accounts )
|
||||
add_subdirectory( infoplugins )
|
||||
add_subdirectory( viewpages )
|
||||
|
||||
|
||||
# application
|
||||
|
@ -6,14 +6,12 @@ list(APPEND ${TOMAHAWK_WIDGETS_LIBRARY_TARGET}_SOURCES
|
||||
PlaylistWidget.cpp
|
||||
|
||||
# ViewPages
|
||||
Dashboard.cpp
|
||||
NetworkActivityWidget.cpp
|
||||
NetworkActivityWorker.cpp
|
||||
SocialPlaylistWidget.cpp
|
||||
)
|
||||
|
||||
list(APPEND ${TOMAHAWK_WIDGETS_LIBRARY_TARGET}_UI
|
||||
DashboardWidget.ui
|
||||
NetworkActivityWidget.ui
|
||||
SocialPlaylistWidget.ui
|
||||
)
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include <QWidget>
|
||||
|
||||
#include "WidgetsDllMacro.h"
|
||||
#include "Dashboard.h"
|
||||
|
||||
|
||||
class PlayableModel;
|
||||
|
@ -20,8 +20,9 @@
|
||||
|
||||
#include "sourcetree/SourcesModel.h"
|
||||
|
||||
#include "../../viewpages/dashboard/Dashboard.h"
|
||||
|
||||
#include <libtomahawk-widgets/NetworkActivityWidget.h>
|
||||
#include <libtomahawk-widgets/Dashboard.h>
|
||||
|
||||
#include "sourcetree/items/ScriptCollectionItem.h"
|
||||
#include "sourcetree/items/SourceTreeItem.h"
|
||||
@ -44,6 +45,7 @@
|
||||
#include "playlist/dynamic/widgets/DynamicWidget.h"
|
||||
#include "utils/ImageRegistry.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/PluginLoader.h"
|
||||
|
||||
#include <QMimeData>
|
||||
#include <QSize>
|
||||
@ -338,19 +340,29 @@ SourcesModel::appendGroups()
|
||||
|
||||
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",
|
||||
tr( "Network Activity" ),
|
||||
TomahawkUtils::defaultPixmap( TomahawkUtils::NetworkActivity, TomahawkUtils::Original ),
|
||||
boost::lambda::bind( boost::lambda::new_ptr< Tomahawk::Widgets::NetworkActivityWidget >() ),
|
||||
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
|
||||
|
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 "ui_DashboardWidget.h"
|
||||
|
||||
#include "libtomahawk-widgets/PlaylistDelegate.h"
|
||||
|
||||
#include "ViewManager.h"
|
||||
#include "SourceList.h"
|
||||
#include "TomahawkSettings.h"
|
||||
#include "widgets/RecentPlaylistsModel.h"
|
||||
#include "widgets/RecentlyPlayedPlaylistsModel.h"
|
||||
#include "MetaPlaylistInterface.h"
|
||||
#include "PlaylistDelegate.h"
|
||||
#include "audio/AudioEngine.h"
|
||||
#include "playlist/AlbumModel.h"
|
||||
#include "playlist/RecentlyPlayedModel.h"
|
@ -33,7 +33,7 @@
|
||||
#include <QListWidgetItem>
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
#include "WidgetsDllMacro.h"
|
||||
#include "../ViewPageDllMacro.h"
|
||||
|
||||
class AlbumModel;
|
||||
class RecentlyPlayedModel;
|
||||
@ -83,7 +83,7 @@ private:
|
||||
|
||||
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_INTERFACES( Tomahawk::ViewPagePlugin )
|
@ -298,7 +298,7 @@
|
||||
<customwidget>
|
||||
<class>Tomahawk::Widgets::PlaylistWidget</class>
|
||||
<extends>QListWidget</extends>
|
||||
<header>PlaylistWidget.h</header>
|
||||
<header>libtomahawk-widgets/PlaylistWidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
Loading…
x
Reference in New Issue
Block a user