1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 22:26:32 +02:00

Allow changing current view from qml

This commit is contained in:
Dominik Schmidt
2011-09-07 07:23:46 +02:00
parent 354f1f8f2e
commit d49ce2f242
2 changed files with 14 additions and 2 deletions

View File

@@ -22,6 +22,7 @@
#include "audio/audioengine.h"
#include "globalactionmanager.h"
#include "sourcesmodel.h"
#include "items/sourcetreeitem.h"
#include <QFileSystemWatcher>
@@ -55,6 +56,15 @@ void TomahawkTouchWindow::play(const QModelIndex& index)
}
void TomahawkTouchWindow::activateItem(const QModelIndex& index)
{
tLog() << Q_FUNC_INFO << index;
SourceTreeItem* item = qobject_cast< SourceTreeItem* >( s_sourcesModel->data( index, SourcesModel::SourceTreeItemRole ).value< SourceTreeItem* >() );
item->activate();
}
void
TomahawkTouchWindow::loadQml()
{
@@ -76,6 +86,7 @@ TomahawkTouchWindow::loadQml()
QDeclarativeContext* context = m_view->rootContext();
tLog()<< Q_FUNC_INFO << "make objects accessible from qml";
context->setContextProperty( "touchWindow", this );
context->setContextProperty( "audioEngine", AudioEngine::instance() );
context->setContextProperty( "globalActionManager", GlobalActionManager::instance() );
context->setContextProperty( "sourcesModel", s_sourcesModel );

View File

@@ -34,8 +34,9 @@ public:
TomahawkTouchWindow();
~TomahawkTouchWindow();
public slots:
void play( const QModelIndex& index );
Q_INVOKABLE void play( const QModelIndex& index );
Q_INVOKABLE void activateItem( const QModelIndex& index );
private slots:
void loadQml();