mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-17 19:37:09 +02:00
* Make DynamicQmlWidget a proper ViewPage.
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
#include "DynamicQmlWidget.h"
|
#include "DynamicQmlWidget.h"
|
||||||
|
|
||||||
|
#include "playlist/dynamic/DynamicModel.h"
|
||||||
|
#include "playlist/PlayableProxyModel.h"
|
||||||
#include "utils/TomahawkUtilsGui.h"
|
#include "utils/TomahawkUtilsGui.h"
|
||||||
|
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
@@ -6,19 +9,52 @@
|
|||||||
namespace Tomahawk
|
namespace Tomahawk
|
||||||
{
|
{
|
||||||
|
|
||||||
DynamicQmlWidget::DynamicQmlWidget( const dynplaylist_ptr& playlist, QWidget* parent)
|
DynamicQmlWidget::DynamicQmlWidget( const dynplaylist_ptr& playlist, QWidget* parent )
|
||||||
: QDeclarativeView( parent )
|
: QDeclarativeView( parent )
|
||||||
{
|
{
|
||||||
setResizeMode(QDeclarativeView::SizeRootObjectToView);
|
setResizeMode(QDeclarativeView::SizeRootObjectToView);
|
||||||
|
|
||||||
setSource(QUrl("qrc" RESPATH "qml/ArtistInfoScene.qml"));
|
setSource(QUrl("qrc" RESPATH "qml/ArtistInfoScene.qml"));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DynamicQmlWidget::~DynamicQmlWidget()
|
DynamicQmlWidget::~DynamicQmlWidget()
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Tomahawk::playlistinterface_ptr
|
||||||
|
DynamicQmlWidget::playlistInterface() const
|
||||||
|
{
|
||||||
|
return m_proxyModel->playlistInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString
|
||||||
|
DynamicQmlWidget::title() const
|
||||||
|
{
|
||||||
|
return m_model->title();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString
|
||||||
|
DynamicQmlWidget::description() const
|
||||||
|
{
|
||||||
|
return m_model->description();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QPixmap
|
||||||
|
DynamicQmlWidget::pixmap() const
|
||||||
|
{
|
||||||
|
return QPixmap( RESPATH "images/station.png" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
DynamicQmlWidget::jumpToCurrentTrack()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -24,17 +24,35 @@
|
|||||||
|
|
||||||
#include <QDeclarativeView>
|
#include <QDeclarativeView>
|
||||||
|
|
||||||
|
class PlayableProxyModel;
|
||||||
|
|
||||||
namespace Tomahawk
|
namespace Tomahawk
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class DynamicModel;
|
||||||
|
|
||||||
class DynamicQmlWidget : public QDeclarativeView, public Tomahawk::ViewPage
|
class DynamicQmlWidget : public QDeclarativeView, public Tomahawk::ViewPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit DynamicQmlWidget( const dynplaylist_ptr& playlist, QWidget* parent = 0);
|
explicit DynamicQmlWidget( const dynplaylist_ptr& playlist, QWidget* parent = 0 );
|
||||||
virtual ~DynamicQmlWidget();
|
virtual ~DynamicQmlWidget();
|
||||||
|
|
||||||
|
virtual QWidget* widget() { return this; }
|
||||||
|
virtual Tomahawk::playlistinterface_ptr playlistInterface() const;
|
||||||
|
|
||||||
|
virtual QString title() const;
|
||||||
|
virtual QString description() const;
|
||||||
|
virtual QPixmap pixmap() const;
|
||||||
|
|
||||||
|
virtual bool showModes() const { return true; }
|
||||||
|
virtual bool showFilter() const { return true; }
|
||||||
|
|
||||||
|
virtual bool jumpToCurrentTrack();
|
||||||
|
|
||||||
|
private:
|
||||||
|
DynamicModel* m_model;
|
||||||
|
PlayableProxyModel* m_proxyModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user