* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
- #include <QDebug>
+ //#include <QDebug>
#include <QTime>
#include <QtGui>
#include "playermainwindow.h"
#include "settingsdialog.h"
#include "appsettings.h"
#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
-#include <QMaemo5InformationBox>
+ #include <QMaemo5InformationBox>
+ #include <mce/dbus-names.h>
+ #include <mce/mode-names.h>
+ #include <QDBusConnection>
+ #include <QDBusMessage>
+ #include <QDBusInterface>
#endif
#include <QMessageBox>
+#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)
#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);
}
}
+#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();
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()));
}
}
void PlayerMainWindow::error(QNetworkReply::NetworkError code) {
- qDebug() << "Error Code: " << code;
+ Q_UNUSED(code);
+ //qDebug() << "Error Code: " << code;
}
void PlayerMainWindow::readReady() {
QNetworkReply * reply = qobject_cast<QNetworkReply*>(sender());
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()));
}
}
else {
- qDebug() << "image load failed!";
- qDebug() << "data.length" << data.length();
ui->labelArtPortrait->setVisible(false);
ui->labelArtLandscape->setVisible(false);
}
#include "browsemainwindow.h"
#include "favouritesmainwindow.h"
#include "vlcstatus.h"
+#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
+ #include <mce/dbus-names.h>
+ #include <mce/mode-names.h>
+ #include <QDBusConnection>
+ #include <QDBusMessage>
+ #include <QDBusInterface>
+#endif
namespace Ui {
class PlayerMainWindow;
~PlayerMainWindow();
public slots:
+ void displayStateChanged(const QDBusMessage &message);
void askStatus();
void showSettings();
void showConfig();
bool mIsLandscape;
bool mHasImage;
bool mIsFirstStatusCall;
-
+ static QDBusConnection dBusConnection;
+ static QDBusInterface* dBusInterface;
};
#endif // PLAYERMAINWINDOW_H