Playlist tweak - minimizing impact of refresh on the UI.
[vlc-remote] / playermainwindow.cpp
index c77bd56..a7c284e 100644 (file)
@@ -23,6 +23,7 @@
   #include "configdialog.h"
   #include "aboutdialog.h"
   #include "accountdialog.h"
+  #include "appsettings.h"
   //#include "vlcstatus.h"
 
   PlayerMainWindow::PlayerMainWindow(QWidget *parent) :
@@ -86,6 +87,7 @@
       connect(ui->actionAbout,SIGNAL(triggered()),this,SLOT(showAbout()));
       connect(ui->actionPortrait,SIGNAL(triggered()),this,SLOT(setPortrait()));
       connect(ui->actionLandscape,SIGNAL(triggered()),this,SLOT(setLandscape()));
+      connect(ui->actionAutoRotate,SIGNAL(triggered()),this,SLOT(setAutoRotate()));
       connect(ui->playlistButton,SIGNAL(clicked()),mPlayListMainWindow,SLOT(show()));
       connect(ui->playlistButton,SIGNAL(clicked()),mPlayListMainWindow,SLOT(showPlayList()));
       connect(ui->browseButton,SIGNAL(clicked()),mBrowserMainWindow,SLOT(show()));
 
   void PlayerMainWindow::setPortrait()
   {
-     #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
-     this->setAttribute(Qt::WA_Maemo5PortraitOrientation, true);
+    #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
+      AppSettings::setOrientation(PORTRAIT);
+    this->setAttribute(Qt::WA_Maemo5PortraitOrientation, true);
     #endif
-    
-      
   }
 
   void PlayerMainWindow::setLandscape()
   {
-      #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
-      this->setAttribute(Qt::WA_Maemo5LandscapeOrientation, true);
-      #endif
+    #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
+      AppSettings::setOrientation(LANDSCAPE);
+    this->setAttribute(Qt::WA_Maemo5LandscapeOrientation, true);
+    #endif
   }
 
   void PlayerMainWindow::setAutoRotate()
   {
     #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
-   this->setAttribute(Qt::WA_Maemo5AutoOrientation, true);
-   #endif
+      AppSettings::setOrientation(AUTO_ROTATE);
+    this->setAttribute(Qt::WA_Maemo5AutoOrientation, true);
+    #endif
   }
 
   void PlayerMainWindow::orientationChanged() {
           // setCoverArtFromPixmap();
       }
   }
+  void PlayerMainWindow::error(QNetworkReply::NetworkError code) {
+      qDebug() << "Error Code: " << code;
+  }
   void PlayerMainWindow::readReady() {
     QNetworkReply * reply = qobject_cast<QNetworkReply*>(sender());
     // append to buffer
     disconnect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(finished(QNetworkReply *)));
   }
   void PlayerMainWindow::getCoverArt(int id) {
+      qDebug() << "getCoverArt id=!" << id;
     mResponse.clear();
     QNetworkReply * reply =  mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/art?id=" + QString::number(id))));
     connect(reply,SIGNAL(readyRead()),this,SLOT(readReady()));
+    connect(reply,SIGNAL(error(QNetworkReply::NetworkError)),this,SLOT(error(QNetworkReply::NetworkError)));
     connect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(finished(QNetworkReply *)));
 
   }
         }
     }
     else {
+        qDebug() << "image load failed!";
+        qDebug() << "data.length" << data.length();
         ui->labelArtPortrait->setVisible(false);
         ui->labelArtLandscape->setVisible(false);
     }