Add icon's to songs in playlist
authorElias Woods <EliasWoods@gmail.com>
Sat, 8 Jan 2011 21:36:07 +0000 (16:36 -0500)
committerElias Woods <EliasWoods@gmail.com>
Sat, 8 Jan 2011 21:36:07 +0000 (16:36 -0500)
playlist.cpp
playlist.h
pwin.h
pwin.ui

index f43a19f..57f17b6 100644 (file)
@@ -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())
             {
index bcf9aea..ef404dc 100644 (file)
@@ -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 (file)
--- 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 (file)
--- a/pwin.ui
+++ b/pwin.ui
@@ -13,7 +13,7 @@
   <property name="windowTitle">
    <string>Form</string>
   </property>
-  <layout class="QHBoxLayout" name="horizontalLayout">
+  <layout class="QVBoxLayout" name="verticalLayout">
    <property name="spacing">
     <number>0</number>
    </property>
     <number>0</number>
    </property>
    <item>
-    <widget class="QTableView" name="tabv">
-     <property name="selectionBehavior">
-      <enum>QAbstractItemView::SelectRows</enum>
+    <widget class="QLabel" name="label">
+     <property name="text">
+      <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Playlist&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
      </property>
-     <property name="horizontalScrollMode">
-      <enum>QAbstractItemView::ScrollPerPixel</enum>
-     </property>
-     <attribute name="horizontalHeaderVisible">
-      <bool>false</bool>
-     </attribute>
-     <attribute name="verticalHeaderVisible">
-      <bool>false</bool>
-     </attribute>
     </widget>
    </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <property name="spacing">
+      <number>0</number>
+     </property>
+     <property name="topMargin">
+      <number>0</number>
+     </property>
+     <item>
+      <widget class="QTableView" name="tabv">
+       <property name="selectionMode">
+        <enum>QAbstractItemView::SingleSelection</enum>
+       </property>
+       <property name="selectionBehavior">
+        <enum>QAbstractItemView::SelectRows</enum>
+       </property>
+       <property name="horizontalScrollMode">
+        <enum>QAbstractItemView::ScrollPerPixel</enum>
+       </property>
+       <attribute name="horizontalHeaderVisible">
+        <bool>false</bool>
+       </attribute>
+       <attribute name="verticalHeaderVisible">
+        <bool>false</bool>
+       </attribute>
+      </widget>
+     </item>
+     <item>
+      <layout class="QVBoxLayout" name="verticalLayout_2">
+       <item>
+        <widget class="QPushButton" name="upbutton">
+         <property name="text">
+          <string/>
+         </property>
+         <property name="icon">
+          <iconset resource="res.qrc">
+           <normaloff>:/groove/icons/general_up.png</normaloff>:/groove/icons/general_up.png</iconset>
+         </property>
+         <property name="flat">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QPushButton" name="downbutton">
+         <property name="text">
+          <string/>
+         </property>
+         <property name="icon">
+          <iconset resource="res.qrc">
+           <normaloff>:/groove/icons/general_down.png</normaloff>:/groove/icons/general_down.png</iconset>
+         </property>
+         <property name="flat">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer name="verticalSpacer">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
   </layout>
  </widget>
- <resources/>
+ <resources>
+  <include location="res.qrc"/>
+ </resources>
  <connections/>
 </ui>