Skip to content

Commit

Permalink
Expose DisplayRole as name in sourcesModel
Browse files Browse the repository at this point in the history
  • Loading branch information
dschmidt committed Sep 7, 2011
1 parent 2472171 commit 354f1f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/active/tomahawktouchwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include "utils/logger.h"
#include "audio/audioengine.h"
#include "globalactionmanager.h"
#include "sourcesmodel.h"


#include <QFileSystemWatcher>
#include <QtDeclarative>
Expand Down Expand Up @@ -70,18 +72,14 @@ TomahawkTouchWindow::loadQml()
tLog()<< Q_FUNC_INFO << "clear component cache";
m_view->engine()->clearComponentCache();

tLog()<< Q_FUNC_INFO << "set source";
m_view->setSource( QUrl::fromLocalFile( QMLGUI "/main.qml" ) );

tLog()<< Q_FUNC_INFO << "set context property";
QDeclarativeContext* context = m_view->rootContext();
//context->setContextProperty( "myModel", m_superCollectionProxyModel );

tLog()<< Q_FUNC_INFO << "make objects accessible from qml";
context->setContextProperty( "audioEngine", AudioEngine::instance() );

context->setContextProperty( "globalActionManager", GlobalActionManager::instance() );

context->setContextProperty( "sourcesModel", s_sourcesModel );

tLog()<< Q_FUNC_INFO << "finished";
tLog()<< Q_FUNC_INFO << "set source";
m_view->setSource( QUrl::fromLocalFile( QMLGUI "/main.qml" ) );
}
4 changes: 4 additions & 0 deletions src/sourcetree/sourcesmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ SourcesModel::SourcesModel( QObject* parent )
connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ) );
connect( SourceList::instance(), SIGNAL( sourceRemoved( Tomahawk::source_ptr ) ), SLOT( onSourceRemoved( Tomahawk::source_ptr ) ) );
connect( ViewManager::instance(), SIGNAL( viewPageActivated( Tomahawk::ViewPage* ) ), this, SLOT( viewPageActivated( Tomahawk::ViewPage* ) ) );

QHash<int, QByteArray> roles;
roles[Qt::DisplayRole] = "name";
setRoleNames(roles);
}


Expand Down

0 comments on commit 354f1f8

Please sign in to comment.