diff options
author | Uwe Klotz <uwe_klotz@web.de> | 2016-12-08 22:26:50 +0100 |
---|---|---|
committer | Uwe Klotz <uwe_klotz@web.de> | 2016-12-09 23:45:42 +0100 |
commit | 7d2e0fce392413c7a4f4292ccc0dd5e5f45f496f (patch) | |
tree | 353080c6a7e3ab2b8bba9ff2d8c2b48a18a41c27 /src/library/banshee | |
parent | e49571835af3278537630b1d09af94cb54c38e26 (diff) |
Improve and simplify the design/interface of TreeItem
Diffstat (limited to 'src/library/banshee')
-rw-r--r-- | src/library/banshee/bansheefeature.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/library/banshee/bansheefeature.cpp b/src/library/banshee/bansheefeature.cpp index 05ee9c67a3..884c79947c 100644 --- a/src/library/banshee/bansheefeature.cpp +++ b/src/library/banshee/bansheefeature.cpp @@ -91,7 +91,7 @@ void BansheeFeature::activate() { m_isActivated = true; - TreeItem* playlist_root = new TreeItem(); + TreeItem* playlist_root = new TreeItem(this); QList<struct BansheeDbConnection::Playlist> list = m_connection.getPlaylists(); @@ -99,8 +99,8 @@ void BansheeFeature::activate() { foreach (playlist, list) { qDebug() << playlist.name; // append the playlist to the child model - TreeItem *item = new TreeItem(playlist.name, playlist.playlistId, this, playlist_root); - playlist_root->appendChild(item); + playlist_root->appendChild( + new TreeItem(this, playlist.name, playlist.playlistId)); } if (playlist_root) { @@ -123,11 +123,9 @@ void BansheeFeature::activate() { void BansheeFeature::activateChild(const QModelIndex& index) { TreeItem *item = static_cast<TreeItem*>(index.internalPointer()); - //qDebug() << "BansheeFeature::activateChild " << item->data() << " " << item->dataPath(); - QString playlist = item->dataPath().toString(); - int playlistID = playlist.toInt(); + int playlistID = item->getData().toInt(); if (playlistID > 0) { - qDebug() << "Activating " << item->data().toString(); + qDebug() << "Activating " << item->getLabel(); m_pBansheePlaylistModel->setTableModel(playlistID); emit(showTrackModel(m_pBansheePlaylistModel)); emit(enableCoverArtDisplay(false)); @@ -141,10 +139,9 @@ TreeItemModel* BansheeFeature::getChildModel() { void BansheeFeature::appendTrackIdsFromRightClickIndex(QList<TrackId>* trackIds, QString* pPlaylist) { if (m_lastRightClickedIndex.isValid()) { TreeItem *item = static_cast<TreeItem*>(m_lastRightClickedIndex.internalPointer()); - *pPlaylist = item->data().toString(); - QString playlistStId = item->dataPath().toString(); - int playlistID = playlistStId.toInt(); - qDebug() << "BansheeFeature::appendTrackIdsFromRightClickIndex " << *pPlaylist << " " << playlistStId; + *pPlaylist = item->getLabel(); + int playlistID = item->getData().toInt(); + qDebug() << "BansheeFeature::appendTrackIdsFromRightClickIndex " << *pPlaylist << " " << playlistID; if (playlistID > 0) { BansheePlaylistModel* pPlaylistModelToAdd = new BansheePlaylistModel(this, m_pTrackCollection, &m_connection); pPlaylistModelToAdd->setTableModel(playlistID); |