mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-09-02 10:24:01 +02:00
added a common DeclarativeView class that sets commonly used stuff
This commit is contained in:
@@ -72,7 +72,7 @@ Item {
|
|||||||
|
|
||||||
Row {
|
Row {
|
||||||
function createStation() {
|
function createStation() {
|
||||||
rootView.startStationFromArtist(artistInputField.text)
|
mainView.startStationFromArtist(artistInputField.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -106,7 +106,7 @@ Item {
|
|||||||
showPlayButton: true
|
showPlayButton: true
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
rootView.startStationFromArtist(modelData);
|
mainView.startStationFromArtist(modelData);
|
||||||
stationCreator.next()
|
stationCreator.next()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -131,7 +131,7 @@ Item {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: parent.width
|
width: parent.width
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
rootView.startStationFromArtist(text)
|
mainView.startStationFromArtist(text)
|
||||||
stationCreator.next()
|
stationCreator.next()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,7 +145,7 @@ Item {
|
|||||||
id: createByGenre
|
id: createByGenre
|
||||||
Row {
|
Row {
|
||||||
function createStation() {
|
function createStation() {
|
||||||
rootView.startStationFromGenre(genreInputField.text)
|
mainView.startStationFromGenre(genreInputField.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -167,7 +167,7 @@ Item {
|
|||||||
model: styleModel//generator.styles()
|
model: styleModel//generator.styles()
|
||||||
|
|
||||||
onTagClicked: {
|
onTagClicked: {
|
||||||
rootView.startStationFromGenre(item)
|
mainView.startStationFromGenre(item)
|
||||||
stationCreator.next()
|
stationCreator.next()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@ Item {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: parent.width
|
width: parent.width
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
rootView.startStationFromGenre(text)
|
mainView.startStationFromGenre(text)
|
||||||
stationCreator.next()
|
stationCreator.next()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -224,7 +224,7 @@ Item {
|
|||||||
spacing: selectYearText.height
|
spacing: selectYearText.height
|
||||||
|
|
||||||
function decadeClicked(decade) {
|
function decadeClicked(decade) {
|
||||||
rootView.startStationFromYear(decade)
|
mainView.startStationFromYear(decade)
|
||||||
stationCreator.next()
|
stationCreator.next()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,7 +251,7 @@ Item {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: parent.width
|
width: parent.width
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
rootView.startStationFromYear(text)
|
mainView.startStationFromYear(text)
|
||||||
stationCreator.next()
|
stationCreator.next()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -10,6 +10,16 @@ Item {
|
|||||||
|
|
||||||
signal itemClicked(int index)
|
signal itemClicked(int index)
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Listen to radio..."
|
||||||
|
color: "white"
|
||||||
|
anchors {
|
||||||
|
left: parent.left
|
||||||
|
top: parent.top
|
||||||
|
margins: height * 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GridView {
|
GridView {
|
||||||
id: gridView
|
id: gridView
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
@@ -14,7 +14,7 @@ Item {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
height: backButton.height
|
height: backButton.height
|
||||||
width: height
|
width: height
|
||||||
visible: rootView.loading
|
visible: mainView.loading
|
||||||
RotationAnimation { target: busyIndicator; from: 360; to: 0; duration: 1500; running: visible; loops: Animation.Infinite }
|
RotationAnimation { target: busyIndicator; from: 360; to: 0; duration: 1500; running: visible; loops: Animation.Infinite }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,11 +29,11 @@ Item {
|
|||||||
currentIndex: currentlyPlayedIndex
|
currentIndex: currentlyPlayedIndex
|
||||||
|
|
||||||
onItemPlayPauseClicked: {
|
onItemPlayPauseClicked: {
|
||||||
rootView.playItem(index)
|
mainView.playItem(index)
|
||||||
}
|
}
|
||||||
|
|
||||||
onItemClicked: {
|
onItemClicked: {
|
||||||
rootView.playItem(index)
|
mainView.playItem(index)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ Item {
|
|||||||
font.pointSize: 18
|
font.pointSize: 18
|
||||||
width: parent.width
|
width: parent.width
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
text: rootView.title
|
text: mainView.title
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
color: "white"
|
color: "white"
|
||||||
|
@@ -149,6 +149,7 @@ set( libGuiSources
|
|||||||
widgets/SocialPlaylistWidget.cpp
|
widgets/SocialPlaylistWidget.cpp
|
||||||
widgets/SourceTreePopupDialog.cpp
|
widgets/SourceTreePopupDialog.cpp
|
||||||
widgets/DeclarativeCoverArtProvider.cpp
|
widgets/DeclarativeCoverArtProvider.cpp
|
||||||
|
widgets/DeclarativeView.cpp
|
||||||
widgets/infowidgets/SourceInfoWidget.cpp
|
widgets/infowidgets/SourceInfoWidget.cpp
|
||||||
widgets/infowidgets/ArtistInfoWidget.cpp
|
widgets/infowidgets/ArtistInfoWidget.cpp
|
||||||
widgets/infowidgets/AlbumInfoWidget.cpp
|
widgets/infowidgets/AlbumInfoWidget.cpp
|
||||||
|
@@ -1,3 +1,21 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2012, Michael Zanetti <mzanetti@kde.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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#include "QmlGridView.h"
|
#include "QmlGridView.h"
|
||||||
#include "widgets/DeclarativeCoverArtProvider.h"
|
#include "widgets/DeclarativeCoverArtProvider.h"
|
||||||
#include "PlayableProxyModelPlaylistInterface.h"
|
#include "PlayableProxyModelPlaylistInterface.h"
|
||||||
@@ -5,7 +23,6 @@
|
|||||||
#include "audio/AudioEngine.h"
|
#include "audio/AudioEngine.h"
|
||||||
|
|
||||||
#include <QDeclarativeContext>
|
#include <QDeclarativeContext>
|
||||||
#include <QDeclarativeEngine>
|
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
@@ -39,20 +56,14 @@ private:
|
|||||||
QWeakPointer<QmlGridView> m_view;
|
QWeakPointer<QmlGridView> m_view;
|
||||||
};
|
};
|
||||||
|
|
||||||
QmlGridView::QmlGridView(QWidget *parent) : QDeclarativeView(parent)
|
QmlGridView::QmlGridView(QWidget *parent) : DeclarativeView(parent)
|
||||||
{
|
{
|
||||||
m_proxyModel = new PlayableProxyModel( this );
|
m_proxyModel = new PlayableProxyModel( this );
|
||||||
m_playlistInterface = playlistinterface_ptr( new QmlGridPlaylistInterface( m_proxyModel, this ) );
|
m_playlistInterface = playlistinterface_ptr( new QmlGridPlaylistInterface( m_proxyModel, this ) );
|
||||||
|
|
||||||
setResizeMode( QDeclarativeView::SizeRootObjectToView );
|
|
||||||
|
|
||||||
// QML image providers will be deleted by the view
|
|
||||||
engine()->addImageProvider( "albumart", new DeclarativeCoverArtProvider( m_proxyModel ) );
|
|
||||||
|
|
||||||
rootContext()->setContextProperty( "mainModel", m_proxyModel );
|
rootContext()->setContextProperty( "mainModel", m_proxyModel );
|
||||||
rootContext()->setContextProperty( "rootView", this );
|
|
||||||
setSource( QUrl( "qrc" RESPATH "qml/GridView.qml" ) );
|
|
||||||
|
|
||||||
|
setSource( QUrl( "qrc" RESPATH "qml/GridView.qml" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlGridView::~QmlGridView()
|
QmlGridView::~QmlGridView()
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
#ifndef QMLGRIDVIEW_H
|
#ifndef QMLGRIDVIEW_H
|
||||||
#define QMLGRIDVIEW_H
|
#define QMLGRIDVIEW_H
|
||||||
|
|
||||||
#include <QDeclarativeView>
|
#include <widgets/DeclarativeView.h>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ class GridItemDelegate;
|
|||||||
class PlayableModel;
|
class PlayableModel;
|
||||||
class GridPlaylistInterface;
|
class GridPlaylistInterface;
|
||||||
|
|
||||||
class DLLEXPORT QmlGridView : public QDeclarativeView, public Tomahawk::ViewPage
|
class DLLEXPORT QmlGridView : public Tomahawk::DeclarativeView, public Tomahawk::ViewPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@@ -12,48 +12,33 @@
|
|||||||
#include "audio/AudioEngine.h"
|
#include "audio/AudioEngine.h"
|
||||||
|
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QSize>
|
||||||
#include <qdeclarative.h>
|
#include <qdeclarative.h>
|
||||||
#include <QDeclarativeContext>
|
#include <QDeclarativeContext>
|
||||||
#include <QDeclarativeEngine>
|
|
||||||
#include <QSize>
|
|
||||||
|
|
||||||
namespace Tomahawk
|
namespace Tomahawk
|
||||||
{
|
{
|
||||||
|
|
||||||
DynamicQmlWidget::DynamicQmlWidget( const dynplaylist_ptr& playlist, QWidget* parent )
|
DynamicQmlWidget::DynamicQmlWidget( const dynplaylist_ptr& playlist, QWidget* parent )
|
||||||
: QDeclarativeView( parent )
|
: DeclarativeView( parent )
|
||||||
, m_playlist( playlist )
|
, m_playlist( playlist )
|
||||||
, m_runningOnDemand( false )
|
, m_runningOnDemand( false )
|
||||||
, m_activePlaylist( false )
|
, m_activePlaylist( false )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setResizeMode( QDeclarativeView::SizeRootObjectToView );
|
|
||||||
|
|
||||||
m_model = new DynamicModel( this );
|
m_model = new DynamicModel( this );
|
||||||
|
|
||||||
m_proxyModel = new PlayableProxyModel( this );
|
m_proxyModel = new PlayableProxyModel( this );
|
||||||
m_proxyModel->setSourcePlayableModel( m_model );
|
m_proxyModel->setSourcePlayableModel( m_model );
|
||||||
m_proxyModel->setShowOfflineResults( false );
|
m_proxyModel->setShowOfflineResults( false );
|
||||||
|
|
||||||
// QML image providers will be deleted by the view
|
|
||||||
engine()->addImageProvider( "albumart", new DeclarativeCoverArtProvider( m_proxyModel ) );
|
|
||||||
|
|
||||||
m_model->loadPlaylist( m_playlist );
|
m_model->loadPlaylist( m_playlist );
|
||||||
|
|
||||||
|
|
||||||
qDebug() << "###got" << m_playlist->generator()->controls().size() << "controls";
|
|
||||||
|
|
||||||
// TODO: In case QML is used in more places, this should probably be moved to some generic place
|
|
||||||
qmlRegisterType<PlayableItem>("tomahawk", 1, 0, "PlayableItem");
|
|
||||||
qmlRegisterUncreatableType<GeneratorInterface>("tomahawk", 1, 0, "Generator", "you cannot create it on your own - should be set in context");
|
qmlRegisterUncreatableType<GeneratorInterface>("tomahawk", 1, 0, "Generator", "you cannot create it on your own - should be set in context");
|
||||||
qmlRegisterUncreatableType<PlayableItem>("tomahawk", 1, 0, "PlayableItem", "you cannot create it on your own - they will appear in the model");
|
|
||||||
|
|
||||||
|
|
||||||
rootContext()->setContextProperty( "dynamicModel", m_proxyModel );
|
rootContext()->setContextProperty( "dynamicModel", m_proxyModel );
|
||||||
rootContext()->setContextProperty( "generator", m_playlist->generator().data() );
|
rootContext()->setContextProperty( "generator", m_playlist->generator().data() );
|
||||||
rootContext()->setContextProperty( "rootView", this );
|
|
||||||
|
|
||||||
setSource( QUrl( "qrc" RESPATH "qml/StationScene.qml" ) );
|
setSource( QUrl( "qrc" RESPATH "qml/StationScene.qml" ) );
|
||||||
|
|
||||||
@@ -67,9 +52,6 @@ DynamicQmlWidget::DynamicQmlWidget( const dynplaylist_ptr& playlist, QWidget* pa
|
|||||||
|
|
||||||
connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), this, SLOT( trackStarted() ) );
|
connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), this, SLOT( trackStarted() ) );
|
||||||
connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::playlistinterface_ptr ) ), this, SLOT( playlistChanged( Tomahawk::playlistinterface_ptr ) ) );
|
connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::playlistinterface_ptr ) ), this, SLOT( playlistChanged( Tomahawk::playlistinterface_ptr ) ) );
|
||||||
|
|
||||||
// m_playlist->generator()->generate( 20 );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
#include "ViewPage.h"
|
#include "ViewPage.h"
|
||||||
#include "Typedefs.h"
|
#include "Typedefs.h"
|
||||||
|
#include "widgets/DeclarativeView.h"
|
||||||
|
|
||||||
#include <QDeclarativeView>
|
|
||||||
#include <QDeclarativeImageProvider>
|
#include <QDeclarativeImageProvider>
|
||||||
|
|
||||||
class PlayableProxyModel;
|
class PlayableProxyModel;
|
||||||
@@ -32,7 +32,7 @@ namespace Tomahawk
|
|||||||
|
|
||||||
class DynamicModel;
|
class DynamicModel;
|
||||||
|
|
||||||
class DynamicQmlWidget : public QDeclarativeView, public Tomahawk::ViewPage
|
class DynamicQmlWidget : public DeclarativeView, public Tomahawk::ViewPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -13,9 +13,8 @@
|
|||||||
namespace Tomahawk
|
namespace Tomahawk
|
||||||
{
|
{
|
||||||
|
|
||||||
DeclarativeCoverArtProvider::DeclarativeCoverArtProvider( PlayableProxyModel *model )
|
DeclarativeCoverArtProvider::DeclarativeCoverArtProvider( )
|
||||||
: QDeclarativeImageProvider( QDeclarativeImageProvider::Pixmap )
|
: QDeclarativeImageProvider( QDeclarativeImageProvider::Pixmap )
|
||||||
, m_model( model )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -34,22 +33,9 @@ QPixmap DeclarativeCoverArtProvider::requestPixmap(const QString &id, QSize *siz
|
|||||||
if( size )
|
if( size )
|
||||||
*size = QSize( width, height );
|
*size = QSize( width, height );
|
||||||
|
|
||||||
// PlayableItem *item = m_model->itemFromIndex( id.toInt() );
|
|
||||||
// if( item ) {
|
|
||||||
// qDebug() << "item:" << item;
|
|
||||||
// qDebug() << "item2:" << item->artistName() << item->name();
|
|
||||||
// if ( !item->query().isNull() ) {
|
|
||||||
// return item->query()->displayQuery()->cover( *size );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
QPixmap cover;
|
QPixmap cover;
|
||||||
|
|
||||||
tDebug() << "Getting by id:" << id << requestedSize;
|
tDebug() << "Getting by id:" << id << requestedSize;
|
||||||
/* query_ptr query = Query::getByCoverId( id );
|
|
||||||
if ( !query.isNull() ) {
|
|
||||||
return query->cover( requestedSize );
|
|
||||||
}*/
|
|
||||||
|
|
||||||
album_ptr album = Album::getByCoverId( id );
|
album_ptr album = Album::getByCoverId( id );
|
||||||
if ( !album.isNull() )
|
if ( !album.isNull() )
|
||||||
|
@@ -13,13 +13,10 @@ namespace Tomahawk
|
|||||||
class DeclarativeCoverArtProvider: public QDeclarativeImageProvider
|
class DeclarativeCoverArtProvider: public QDeclarativeImageProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DeclarativeCoverArtProvider( PlayableProxyModel *model );
|
DeclarativeCoverArtProvider();
|
||||||
~DeclarativeCoverArtProvider();
|
~DeclarativeCoverArtProvider();
|
||||||
|
|
||||||
QPixmap requestPixmap( const QString &id, QSize *size, const QSize &requestedSize );
|
QPixmap requestPixmap( const QString &id, QSize *size, const QSize &requestedSize );
|
||||||
|
|
||||||
private:
|
|
||||||
PlayableProxyModel *m_model;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
52
src/libtomahawk/widgets/DeclarativeView.cpp
Normal file
52
src/libtomahawk/widgets/DeclarativeView.cpp
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2012, Michael Zanetti <mzanetti@kde.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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "DeclarativeView.h"
|
||||||
|
#include "playlist/PlayableItem.h"
|
||||||
|
#include "DeclarativeCoverArtProvider.h"
|
||||||
|
|
||||||
|
#include <qdeclarative.h>
|
||||||
|
#include <QDeclarativeEngine>
|
||||||
|
#include <QDeclarativeContext>
|
||||||
|
|
||||||
|
namespace Tomahawk
|
||||||
|
{
|
||||||
|
|
||||||
|
DeclarativeView::DeclarativeView( QWidget *parent ):
|
||||||
|
QDeclarativeView( parent )
|
||||||
|
{
|
||||||
|
|
||||||
|
// Needed to make the QML contents scale with tomahawk
|
||||||
|
setResizeMode( QDeclarativeView::SizeRootObjectToView );
|
||||||
|
|
||||||
|
// This types seem to be needed everywhere anyways, lets the register here
|
||||||
|
qmlRegisterUncreatableType<PlayableItem>( "tomahawk", 1, 0, "PlayableItem", "bla" );
|
||||||
|
|
||||||
|
// QML image providers will be deleted by the view
|
||||||
|
engine()->addImageProvider( "albumart", new DeclarativeCoverArtProvider() );
|
||||||
|
|
||||||
|
// Register the view itself to make it easy to invoke the view's slots from QML
|
||||||
|
rootContext()->setContextProperty( "mainView", this );
|
||||||
|
}
|
||||||
|
|
||||||
|
DeclarativeView::~DeclarativeView()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
59
src/libtomahawk/widgets/DeclarativeView.h
Normal file
59
src/libtomahawk/widgets/DeclarativeView.h
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2012, Michael Zanetti <mzanetti@kde.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 DECLARATIVEVIEW_H
|
||||||
|
#define DECLARATIVEVIEW_H
|
||||||
|
|
||||||
|
#include <QDeclarativeView>
|
||||||
|
|
||||||
|
class QAbstractItemModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class This is the main class for Tomahawk's declarative views
|
||||||
|
*
|
||||||
|
* DeclarativeView inherits from QDeclarativeView and registers some
|
||||||
|
* common types, properties and functions used by all of Tomhawk's
|
||||||
|
* declarative views:
|
||||||
|
*
|
||||||
|
* Registered Types:
|
||||||
|
* - PlayableItem
|
||||||
|
*
|
||||||
|
* Set context properties:
|
||||||
|
* - mainView: This view, so you can invoke this view's slots from QML
|
||||||
|
*
|
||||||
|
* It also registers an albumart image provider. You can access album art
|
||||||
|
* in QML with the source url "image://albumart/<coverid>".
|
||||||
|
* The cover id can be obtained by the CoverIdRole in PlayableModels
|
||||||
|
*
|
||||||
|
* After subclassing this, all you have to do is call setSource() to
|
||||||
|
* load the QML file and optionally setModel().
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Tomahawk
|
||||||
|
{
|
||||||
|
|
||||||
|
class DeclarativeView: public QDeclarativeView
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
DeclarativeView(QWidget *parent = 0);
|
||||||
|
~DeclarativeView();
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
Reference in New Issue
Block a user