From 8d6fe056768695bddc4bc7f9ad6f423d9ec918cb Mon Sep 17 00:00:00 2001 From: Elias Woods Date: Sat, 8 Jan 2011 16:36:07 -0500 Subject: [PATCH] Add icon's to songs in playlist --- playlist.cpp | 13 ++++++++ playlist.h | 6 ++-- pwin.h | 1 + pwin.ui | 99 +++++++++++++++++++++++++++++++++++++++++++++++++--------- 4 files changed, 103 insertions(+), 16 deletions(-) diff --git a/playlist.cpp b/playlist.cpp index f43a19f..57f17b6 100644 --- a/playlist.cpp +++ b/playlist.cpp @@ -9,6 +9,7 @@ playlist::playlist(QObject *parent) : this->currentplayingitem = -1; this->currentSkeyItem = -1; this->reply = NULL; + icon = new QIcon(":/groove/icons/general_forward.png"); } //Implemented model class information @@ -22,6 +23,18 @@ QVariant playlist::data(const QModelIndex &index, int role) const return QVariant(); if (role == Qt::TextAlignmentRole) { return int(Qt::AlignLeft | Qt::AlignVCenter); + } else if (role == Qt::DecorationRole) { + switch(index.column()) + { + case sName: + if(play->currentplaying()==index.row()) + dat = QVariant(*play->icon); + else + dat = QVariant(); + break; + default: + dat = QVariant(); + } } else if (role == Qt::DisplayRole) { switch(index.column()) { diff --git a/playlist.h b/playlist.h index bcf9aea..ef404dc 100644 --- a/playlist.h +++ b/playlist.h @@ -25,9 +25,10 @@ public: }; //this Enum MUST BE sequantial //And when changed must update the length -#define PLAYLISTENUMS 8 +#define PLAYLISTENUMS 9 enum coulmnStruct { + sPlaying, sName, sID, sKey, @@ -35,7 +36,7 @@ public: sBuff, sDownloaded, sPlayed, - sReady, + sReady }; struct songElement @@ -106,6 +107,7 @@ private: int currentdownloaditem; gscom *gs; QTime startStreamT; + QIcon *icon; }; #endif // PLAYLIST_H diff --git a/pwin.h b/pwin.h index 16ead58..769ea3b 100644 --- a/pwin.h +++ b/pwin.h @@ -19,6 +19,7 @@ public: private: void resizeEvent(QResizeEvent *); + Ui::pWin *ui; }; diff --git a/pwin.ui b/pwin.ui index 35bbe4d..c62e647 100644 --- a/pwin.ui +++ b/pwin.ui @@ -13,7 +13,7 @@ Form - + 0 @@ -21,23 +21,94 @@ 0 - - - QAbstractItemView::SelectRows + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Playlist</p></body></html> - - QAbstractItemView::ScrollPerPixel - - - false - - - false - + + + + 0 + + + 0 + + + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + QAbstractItemView::ScrollPerPixel + + + false + + + false + + + + + + + + + + + + + :/groove/icons/general_up.png:/groove/icons/general_up.png + + + true + + + + + + + + + + + :/groove/icons/general_down.png:/groove/icons/general_down.png + + + true + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + - + + + -- 1.7.9.5