Start adding support for playlist and progress on downloading songs
authorElias Woods <EliasWoods@gmail.com>
Thu, 17 Jun 2010 04:45:07 +0000 (00:45 -0400)
committerElias Woods <EliasWoods@gmail.com>
Thu, 17 Jun 2010 04:45:07 +0000 (00:45 -0400)
Groove.pro
Makefile
groove.cpp
gscom.cpp
gscom.h
playlist.cpp [new file with mode: 0644]
playlist.h [new file with mode: 0644]

index 2762e5f..4b36e10 100644 (file)
@@ -25,10 +25,12 @@ SOURCES += main.cpp \
     groove.cpp \
     gscom.cpp \
     splayer.cpp \
-    streamio.cpp
+    streamio.cpp \
+    playlist.cpp
 
 HEADERS += \
     groove.h \
     gscom.h \
     splayer.h \
-    streamio.h
+    streamio.h \
+    playlist.h
index eec5371..ef443ed 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 #############################################################################
 # Makefile for building: groove
-# Generated by qmake (2.01a) (Qt 4.6.2) on: Fri Jun 4 15:49:00 2010
+# Generated by qmake (2.01a) (Qt 4.6.2) on: Wed Jun 16 21:13:23 2010
 # Project:  Groove.pro
 # Template: app
 # Command: /usr/bin/qmake -unix -o Makefile Groove.pro
index 46da9d3..02bda40 100644 (file)
@@ -12,16 +12,19 @@ groove::groove(QWidget *parent) :
     player = new sPlayer();
     QHBoxLayout *layout = new QHBoxLayout();
     QVBoxLayout *vlayout = new QVBoxLayout();
+    QHBoxLayout *bottomLayout = new QHBoxLayout();
     button = new QPushButton("Search");
     QPushButton *dButton = new QPushButton("Play");
+    QPushButton *stopButton = new QPushButton("Stop");
+    QPushButton *moreButton = new QPushButton();
     resultView = new QTableView();
     QMenu *pushMenu = new QMenu();
     //showFullScreen();
     lineEdit->insert("");
     lineEdit->setDisabled(true);
     pushMenu->addAction("Song:");
-    pushMenu->addAction("Artist:");
-    pushMenu->addAction("Album:");
+    //pushMenu->addAction("Artist:");
+    //pushMenu->addAction("Album:");
 
     //sMethod->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Maximum);
     sMethod->setMaximumWidth(sMethod->sizeHint().rwidth());
@@ -37,14 +40,21 @@ groove::groove(QWidget *parent) :
     resultView->setSelectionMode(QAbstractItemView::SingleSelection);
     resultView->setEditTriggers(QAbstractItemView::NoEditTriggers);
     resultView->setColumnHidden(2,true);
+    resultView->setColumnHidden(3,true);
     resultView->setAutoScroll(false);
+    /*QPalette pal = resultView->palette();
+    pal.setBrush(QPalette::Highlight,QBrush(Qt::transparent,Qt::NoBrush));
+    resultView->setPalette(pal);*/
 
     layout->addWidget(sMethod);
     layout->addWidget(lineEdit);
     layout->addWidget(button);
     vlayout->addLayout(layout);
     vlayout->addWidget(resultView);
-    vlayout->addWidget(dButton);
+    vlayout->addLayout(bottomLayout);
+    bottomLayout->addWidget(dButton);
+    bottomLayout->addWidget(stopButton);
+    bottomLayout->addWidget(moreButton);
     vlayout->setMenuBar(mBar);
     setLayout(vlayout);
     setWindowTitle("GrooveShark");
index 69f7497..1e6d055 100644 (file)
--- a/gscom.cpp
+++ b/gscom.cpp
@@ -19,6 +19,7 @@ gscom::gscom()
     model->setHorizontalHeaderLabels(
         QStringList() << "Online");
     addDebugMsg("You may now search for a song");
+    addProgressbar("test");
     //getSessionKey();
 }
 
@@ -261,6 +262,28 @@ void gscom::addDebugMsg(QString debug)
     }
     return;
 }
+void gscom::addProgressbar(QString debug)
+{
+    QList<QStringList> rows = QList<QStringList>()
+        << (QStringList() << debug);
+    foreach (QStringList row, rows) {
+        QList<QStandardItem *> items;
+        foreach (QString text, row)
+        {
+            QLinearGradient gradient(0,0,250,0);
+            gradient.setColorAt(0, QColor::fromRgbF(0, 1, 0, 1));
+            gradient.setColorAt(0.9, QColor::fromRgbF(0, 1, 0, 1));
+            gradient.setColorAt(1, QColor::fromRgbF(0, 0, 0, 0));
+            QBrush brush(gradient);
+            QStandardItem *pBar = new QStandardItem(text);
+            pBar->setBackground(brush);
+            pBar->setSelectable(false);
+            items.append(pBar);
+        }
+        model->appendRow(items);
+    }
+    return;
+}
 QString* gscom::getToken(gMETHOD meth)
 {
     QCryptographicHash *hasher = new QCryptographicHash(QCryptographicHash::Sha1);
diff --git a/gscom.h b/gscom.h
index f39e9a0..42bc5ef 100644 (file)
--- a/gscom.h
+++ b/gscom.h
@@ -49,6 +49,7 @@ private:
     QNetworkAccessManager *manager;
     QNetworkCookieJar *cookies;
     void addDebugMsg(QString debug);
+    void addProgressbar(QString debug);
     bool firstR;
     QByteArray *postdata;
 };
diff --git a/playlist.cpp b/playlist.cpp
new file mode 100644 (file)
index 0000000..6c0cb7f
--- /dev/null
@@ -0,0 +1,6 @@
+#include "playlist.h"
+
+playlist::playlist(QObject *parent) :
+    QObject(parent)
+{
+}
diff --git a/playlist.h b/playlist.h
new file mode 100644 (file)
index 0000000..d33386b
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef PLAYLIST_H
+#define PLAYLIST_H
+
+#include <QObject>
+#include <QStandardItem>
+
+class playlist : public QObject
+{
+    Q_OBJECT
+public:
+    explicit playlist(QObject *parent = 0);
+    void addSong(QStandardItem item);
+    QList<QStandardItem *> getPlaylist();
+    void removeSong(int position);
+
+
+signals:
+
+public slots:
+
+};
+
+#endif // PLAYLIST_H