attempt fix for autobuilder
[groove] / groove.cpp
index 102c369..050a743 100644 (file)
@@ -1,5 +1,5 @@
 #include "groove.h"
-
+#include "qmaemo5rotator.h"
 
 
 groove::groove(QWidget *parent) :
@@ -51,11 +51,9 @@ groove::groove(QWidget *parent) :
     /*QPalette pal = resultView->palette();
     pal.setBrush(QPalette::Highlight,QBrush(Qt::transparent,Qt::NoBrush));
     resultView->setPalette(pal);*/
-
+    portrait = false;
     layout->addWidget(sMethod);
-#ifdef Q_WS_MAEMO_5
-    setAttribute(Qt::WA_Maemo5AutoOrientation,true);
-#endif
+    rot = new QMaemo5Rotator(QMaemo5Rotator::AutomaticBehavior,this);
     layout->addWidget(lineEdit);
     layout->addWidget(button);
     vlayout->addLayout(layout);
@@ -76,8 +74,11 @@ groove::groove(QWidget *parent) :
     connect(pushMenu,SIGNAL(triggered(QAction*)),this,SLOT(changeS(QAction*)));
     connect(dButton,SIGNAL(clicked()),this, SLOT(play()));
     connect(stopButton,SIGNAL(clicked()),this,SLOT(stop()));
-    connect(gs,SIGNAL(sKeyFound()),this,SLOT(startP()));
     connect(moreButton,SIGNAL(clicked()),this,SLOT(moreB()));
+    //connect(rotator,SIGNAL(orientationChanged(Orientation)),this,SLOT(orientationChanged()));
+    pl = new playlist();
+    pl->setGscom(gs);
+    player->setPlaylist(pl);
 }
 void groove::search()
 {
@@ -133,20 +134,11 @@ void groove::play()
         if(item == 0)
             return;
         //gs->getSong();
-        gs->getSong(item->text());
+        player->play(pl->addSong(item));
     }
     //selected.
     //if
 }
-void groove::startP()
-{
-    if(!gs->sku.isValid())
-        return;
-    player->~sPlayer();
-    player = new sPlayer();
-    player->play(gs->streamID,gs->sku);
-
-}
 void groove::stop()
 {
     player->stop();
@@ -155,3 +147,13 @@ void groove::moreB()
 {
     qDebug() << "He pressed the button";
 }
+void groove::orientationChanged()
+{
+#ifdef Q_WS_MAEMO_5
+    QRect screenGeometry = QApplication::desktop()->screenGeometry();
+    if (screenGeometry.width() > screenGeometry.height())
+        portrait = false;
+    else
+        portrait = true;
+#endif
+}