X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fplayermainwindow.cpp;h=a2de15d9399890d9eb73f6f040c083d0b914ccc1;hb=7f1ddb47d2b2289177b0bc8a917a7f093075e0e3;hp=8e16fcc8d8d3feea2258cb6b72b5c53c557c9cd0;hpb=e9ea6b04d18bb00722c7cefa0df65657659b78b7;p=vlc-remote diff --git a/src/playermainwindow.cpp b/src/playermainwindow.cpp index 8e16fcc..a2de15d 100644 --- a/src/playermainwindow.cpp +++ b/src/playermainwindow.cpp @@ -15,7 +15,7 @@ * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - #include + //#include #include #include #include "playermainwindow.h" @@ -26,10 +26,21 @@ #include "settingsdialog.h" #include "appsettings.h" #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) -#include + #include + #include + #include + #include + #include + #include #endif #include +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) +QDBusConnection PlayerMainWindow::dBusConnection = QDBusConnection::systemBus(); +QDBusInterface* PlayerMainWindow::dBusInterface = new QDBusInterface(MCE_SERVICE, MCE_REQUEST_PATH, + MCE_REQUEST_IF, dBusConnection); +#endif + PlayerMainWindow::PlayerMainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::PlayerMainWindow) @@ -71,6 +82,9 @@ #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + // Handle screen state on / off + dBusConnection.connect(MCE_SERVICE, MCE_SIGNAL_PATH, MCE_SIGNAL_IF, + MCE_DISPLAY_SIG, this, SLOT(displayStateChanged(const QDBusMessage &))); mPlayListMainWindow->setParent(this); mPlayListMainWindow->setAttribute(Qt::WA_Maemo5StackedWindow, true); @@ -183,6 +197,21 @@ } } +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + void PlayerMainWindow::displayStateChanged(const QDBusMessage &message) + { + QString state = message.arguments().at(0).toString(); + if (!state.isEmpty()) { + if (state == MCE_DISPLAY_ON_STRING) { + mTimer->start(AppSettings::getStatusPollTimeout()); + } + else if (state == MCE_DISPLAY_OFF_STRING) { + mTimer->stop(); + } + } + } +#endif + void PlayerMainWindow::showFavourites() { mFavouritesMainWindow->show(); mFavouritesMainWindow->init(); @@ -361,7 +390,6 @@ void PlayerMainWindow::askStatus() { - //qDebug() << "Status requested. at:" << QTime::currentTime().toString("hh::mm:ss"); if (AppSettings::isConnected()) { QNetworkReply * reply = mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml"))); connect(reply,SIGNAL(readyRead()),this,SLOT(parseXmlStatus())); @@ -537,7 +565,8 @@ } } void PlayerMainWindow::error(QNetworkReply::NetworkError code) { - qDebug() << "Error Code: " << code; + Q_UNUSED(code); + //qDebug() << "Error Code: " << code; } void PlayerMainWindow::readReady() { QNetworkReply * reply = qobject_cast(sender()); @@ -552,7 +581,6 @@ delete reply; } 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())); @@ -576,8 +604,6 @@ } } else { - qDebug() << "image load failed!"; - qDebug() << "data.length" << data.length(); ui->labelArtPortrait->setVisible(false); ui->labelArtLandscape->setVisible(false); }