Add QGraphicView Objects
[groove] / gscom.cpp
index 69f7497..9506ed8 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");
     model->setHorizontalHeaderLabels(
         QStringList() << "Online");
     addDebugMsg("You may now search for a song");
+    //addProgressbar("test");
     //getSessionKey();
 }
 
     //getSessionKey();
 }
 
@@ -52,7 +53,7 @@ QStandardItemModel* gscom::getSongModel(QString song)
         jlist.insertMulti("header",header);
         QVariantMap param;
         param.insert("type","Songs");
         jlist.insertMulti("header",header);
         QVariantMap param;
         param.insert("type","Songs");
-        param.insert("query",song.toAscii());
+        param.insert("query",song);
         jlist.insertMulti("parameters",param);
         QJson::Serializer *serializer = new QJson::Serializer();
         //qDebug() << serializer->serialize(jlist);
         jlist.insertMulti("parameters",param);
         QJson::Serializer *serializer = new QJson::Serializer();
         //qDebug() << serializer->serialize(jlist);
@@ -173,6 +174,8 @@ void gscom::replyFinished(QNetworkReply *reply)
                 if(cookie.name() == "PHPSESSID")
                 {
                     phpSession = new QString(cookie.value());
                 if(cookie.name() == "PHPSESSID")
                 {
                     phpSession = new QString(cookie.value());
+                    qDebug() << QDateTime::currentDateTime();
+                    qDebug() << cookie.expirationDate();
                 }
             }
             reply->readAll();
                 }
             }
             reply->readAll();
@@ -196,6 +199,7 @@ void gscom::replyFinished(QNetworkReply *reply)
                 sessionKey = new QString(result["result"].toString());
                 qDebug() << sessionKey->toAscii();
             }
                 sessionKey = new QString(result["result"].toString());
                 qDebug() << sessionKey->toAscii();
             }
+            qDebug() << result;
             currentaction = none;
             reply->close();
             emit finishedSearch();
             currentaction = none;
             reply->close();
             emit finishedSearch();
@@ -215,6 +219,7 @@ void gscom::replyFinished(QNetworkReply *reply)
                 currentaction = getPHP;
                 manager->get(QNetworkRequest(QUrl(QString("http://") + GS_LISTEN)));
                 qDebug() << reply->readAll();
                 currentaction = getPHP;
                 manager->get(QNetworkRequest(QUrl(QString("http://") + GS_LISTEN)));
                 qDebug() << reply->readAll();
+                qDebug() << result;
                 reply->close();
                 return;
             }
                 reply->close();
                 return;
             }
@@ -261,6 +266,28 @@ void gscom::addDebugMsg(QString debug)
     }
     return;
 }
     }
     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(Qt::red);
+            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);
 QString* gscom::getToken(gMETHOD meth)
 {
     QCryptographicHash *hasher = new QCryptographicHash(QCryptographicHash::Sha1);