Add (better) portrait mode support. This commit will temporarily break
[groove] / splayer.cpp
index bc54f00..4b6b07e 100644 (file)
@@ -22,7 +22,17 @@ sPlayer::~sPlayer()
 }
 void sPlayer::abortDownload()
 {
-    reply->abort();
+    //pd->hide();
+    //reply->abort();
+}
+void sPlayer::play(QString StreamKey, QUrl server, QMaemo5Rotator::Orientation orientation)
+{
+    this->play(StreamKey, server);
+#ifdef Q_WS_MAEMO_5
+    if(orientation == QMaemo5Rotator::PortraitOrientation)
+        pd->rot->setCurrentOrientation(orientation);
+#endif
+    //isPortrait = false; //just make the compilier happy on non-maemo
 }
 
 void sPlayer::play(QString StreamKey,QUrl server)
@@ -31,11 +41,10 @@ void sPlayer::play(QString StreamKey,QUrl server)
     {
         //reply->abort();
     }
-    pd = new QProgressDialog("Downloading / Buffering.", "Cancel", 0, 100);
+    pd = new grooveProgressBar();
+    //pd->setAttribute();
+    pd->show();
     pd->setValue(0);
-#ifdef Q_WS_MAEMO_5
-    pd->setAttribute(Qt::WA_Maemo5AutoOrientation,true);
-#endif
     QNetworkRequest req;
     req.setUrl(server);
     qDebug() << server;
@@ -44,7 +53,7 @@ void sPlayer::play(QString StreamKey,QUrl server)
     buffer->open(buffer->ReadWrite | buffer->Truncate);
     connect(reply,SIGNAL(finished()),this,SLOT(start()));
     connect(reply,SIGNAL(downloadProgress(qint64,qint64)),this,SLOT(putb(qint64,qint64)));
-    connect(pd,SIGNAL(canceled()),this,SLOT(abortDownload()));
+    //connect(pd,SIGNAL(canceled()),this,SLOT(abortDownload()));
     media->stop();
     playing = false;
     startStreamT = QTime::currentTime();
@@ -68,6 +77,7 @@ void sPlayer::start()
             playing = true;
             media->setCurrentSource(Phonon::MediaSource(buffer));
             media->play();
+            pd->hide();
             qDebug() << "Playing";
         }
     }
@@ -132,7 +142,7 @@ void sPlayer::putb(qint64 b, qint64 t)
         buffer->seek(last);
         //buffer->data().append(reply->readAll());*/
         //qDebug() << "Download speed (KB/S): " << b/(startStreamT.msecsTo(QTime::currentTime()) + 1)*100/1024;
-        if ( b >= t*0.05 && !playing && b/(startStreamT.msecsTo(QTime::currentTime()) + 1)*100/1024 >= 25)
+        if ( b >= t*0.05 && !playing && b/(startStreamT.msecsTo(QTime::currentTime()) + 1)*100/1024 >= 10)
         {
             pd->hide();
             playing = true;