Persist orientation settings.
[vlc-remote] / playermainwindow.cpp
index c2186e9..ee806f1 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()
   {
-      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()
   {
-      this->setAttribute(Qt::WA_Maemo5LandscapeOrientation, true);
+    #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
+      AppSettings::setOrientation(LANDSCAPE);
+    this->setAttribute(Qt::WA_Maemo5LandscapeOrientation, true);
+    #endif
   }
 
   void PlayerMainWindow::setAutoRotate()
   {
-      this->setAttribute(Qt::WA_Maemo5AutoOrientation, true);
+    #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
+      AppSettings::setOrientation(AUTO_ROTATE);
+    this->setAttribute(Qt::WA_Maemo5AutoOrientation, true);
+    #endif
   }
 
   void PlayerMainWindow::orientationChanged() {
           //   rebuild display layout
           //   retrieve album art
           mHasImage = false;
-          mPlayListMainWindow->requestPlayList();
+          QTimer::singleShot(500, mPlayListMainWindow, SLOT(requestPlayList()));
       }
       // Update the buttons on the playlist window
       if (NULL != this->mPlayListMainWindow) {
   void PlayerMainWindow::setCoverArtFromPixmap(QPixmap image) {
     mHasImage = true;
     ui->labelArtLandscape->setPixmap(image.scaledToHeight(120, Qt::SmoothTransformation));
-    ui->labelArtPortrait->setPixmap(image.scaledToHeight(310, Qt::SmoothTransformation));
+    ui->labelArtPortrait->setPixmap(image.scaledToHeight(320, Qt::SmoothTransformation));
     if (mIsLandscape) {
         ui->labelArtPortrait->setVisible(false);
         ui->labelArtLandscape->setVisible(true);