X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fplayermainwindow.cpp;h=f5b5d5518f199262e433f579979e7040be2b01a3;hb=a2ae6a8e153e0fab468bbd7d13052d81eba6e665;hp=a400cd7aec06c27134d9bd9964975a943c70ee02;hpb=dab264c804c469e7c8c24f4a79ce72673aec954a;p=vlc-remote diff --git a/src/playermainwindow.cpp b/src/playermainwindow.cpp index a400cd7..f5b5d55 100644 --- a/src/playermainwindow.cpp +++ b/src/playermainwindow.cpp @@ -23,10 +23,12 @@ #include "configdialog.h" #include "aboutdialog.h" #include "accountdialog.h" + #include "settingsdialog.h" #include "appsettings.h" #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) #include #endif +#include PlayerMainWindow::PlayerMainWindow(QWidget *parent) : QMainWindow(parent), @@ -90,11 +92,13 @@ #endif connect(mTimer,SIGNAL(timeout()),this,SLOT(askStatus())); + connect(ui->actionSettings,SIGNAL(triggered()),this,SLOT(showSettings())); connect(ui->actionConfiguration,SIGNAL(triggered()),this,SLOT(showConfig())); 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->actionFavourites,SIGNAL(triggered()),this,SLOT(showFavourites())); + //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())); @@ -184,6 +188,27 @@ mFavouritesMainWindow->init(); } + void PlayerMainWindow::updateFromSettings() + { + #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + switch (AppSettings::getOrientation()) { + case LANDSCAPE: + this->setAttribute(Qt::WA_Maemo5LandscapeOrientation, true); + break; + case PORTRAIT: + this->setAttribute(Qt::WA_Maemo5PortraitOrientation, true); + break; + case AUTO_ROTATE: + this->setAttribute(Qt::WA_Maemo5AutoOrientation, true); + break; + } + #endif + if (AppSettings::getShowAlbumArt()) { + this->mIsFirstStatusCall = true; + } + mTimer->start(AppSettings::getStatusPollTimeout()); + } + void PlayerMainWindow::setPortrait() { #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) @@ -298,6 +323,12 @@ mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=seek&val="+QString::number(value)+"%25"))); } + void PlayerMainWindow::showSettings() + { + SettingsDialog * dialog = new SettingsDialog(this); + connect(dialog, SIGNAL(closeSignal()), this, SLOT(updateFromSettings())); + dialog->exec(); + } void PlayerMainWindow::showConfig() { mTimer->stop(); @@ -473,7 +504,7 @@ ui->playpauseButton->setIcon(QIcon::fromTheme("camera_playback")); } - if (STOP == mCurrentStatus.state) { + if (STOP == mCurrentStatus.state || !AppSettings::getShowAlbumArt()) { ui->labelArtPortrait->setVisible(false); ui->labelArtLandscape->setVisible(false); } @@ -482,8 +513,10 @@ // potential actions: // rebuild display layout // retrieve album art - mHasImage = false; - QTimer::singleShot(AppSettings::getRetrieveArtTimeout(), mPlayListMainWindow, SLOT(requestPlayList())); + if (AppSettings::getShowAlbumArt()) { + mHasImage = false; + QTimer::singleShot(AppSettings::getRetrieveArtTimeout(), mPlayListMainWindow, SLOT(requestPlayList())); + } } // Update the buttons on the playlist window if (NULL != this->mPlayListMainWindow) { @@ -563,4 +596,21 @@ ui->labelArtPortrait->setVisible(true); } } + void PlayerMainWindow::closeEvent(QCloseEvent * event) { + if (!AppSettings::getAlertOnClose() || PLAYING != mCurrentStatus.state) { + event->accept(); + } + else { // handle alert + if (QMessageBox::Yes == QMessageBox::question(this + , tr("Really quit?") + , tr("You currently have media playing on your remote machine. Are you sure you wish to quit vlc-remote?") + , QMessageBox::Yes | QMessageBox::No + , QMessageBox::No)) { + event->accept(); + } + else { + event->ignore(); + } + } + }