diff --git a/JGE/include/qt/corewrapper.h b/JGE/include/qt/corewrapper.h index 5f0f3007f..55c91a284 100644 --- a/JGE/include/qt/corewrapper.h +++ b/JGE/include/qt/corewrapper.h @@ -14,6 +14,15 @@ #include "../include/JRenderer.h" #include "../include/JGameLauncher.h" +#if (defined Q_WS_MAEMO_5) +// For screen on/off events support +#include +#include +#include +#include +#include +#endif //Q_WS_MAEMO_5 + #ifdef QT_WIDGET class WagicCore : public QGLWidget #else @@ -100,6 +109,12 @@ public slots: void start(int); #endif +#ifdef Q_WS_MAEMO_5 +public slots: + void displayStateChanged(const QDBusMessage &message); +#endif //Q_WS_MAEMO_5 + + signals: void activeChanged(); @@ -131,6 +146,11 @@ private: qint64 mLastFingerDownTime; #endif //Q_WS_MAEMO_5 #endif //QT_WIDGET + +#ifdef Q_WS_MAEMO_5 + QDBusConnection dBusConnection; + QDBusInterface* dBusInterface; + #endif //Q_WS_MAEMO_5 }; #ifndef QT_WIDGET QML_DECLARE_TYPE(WagicCore) diff --git a/JGE/src/qt/corewrapper.cpp b/JGE/src/qt/corewrapper.cpp index 2641a99a5..02dc1f334 100644 --- a/JGE/src/qt/corewrapper.cpp +++ b/JGE/src/qt/corewrapper.cpp @@ -41,6 +41,9 @@ QElapsedTimer WagicCore::g_startTimer; WagicCore::WagicCore(super *parent) : super(parent), m_engine(0), m_app(0), m_launcher(0), m_active(false) +#ifdef Q_WS_MAEMO_5 + , dBusConnection(QDBusConnection::systemBus()), dBusInterface(0) +#endif //Q_WS_MAEMO_5 { #ifdef QT_WIDGET #if (defined Q_WS_MAEMO_5) @@ -59,6 +62,14 @@ WagicCore::WagicCore(super *parent) : #endif //QT_WIDGET g_startTimer.restart(); m_lastTickCount = g_startTimer.elapsed(); + +#ifdef Q_WS_MAEMO_5 + dBusInterface = new QDBusInterface(MCE_SERVICE, MCE_REQUEST_PATH, + MCE_REQUEST_IF, dBusConnection); + + // Handle screen state on / off + dBusConnection.connect(MCE_SERVICE, MCE_SIGNAL_PATH, MCE_SIGNAL_IF, MCE_DISPLAY_SIG, this, SLOT(displayStateChanged(const QDBusMessage &))); +#endif } void WagicCore::initApp() @@ -85,6 +96,9 @@ void WagicCore::initApp() WagicCore::~WagicCore() { + if(dBusInterface) + delete dBusInterface; + if(m_launcher) { delete m_launcher; @@ -498,3 +512,18 @@ void WagicCore::start(int) } #endif //QT_WIDGET + +#ifdef Q_WS_MAEMO_5 +void WagicCore::displayStateChanged(const QDBusMessage &message) +{ + QString state = message.arguments().at(0).toString(); + if (!state.isEmpty()) { + if (state == MCE_DISPLAY_ON_STRING && isActiveWindow()) { + setActive(true); + } + else if (state == MCE_DISPLAY_OFF_STRING) { + setActive(false); + } + } +} +#endif diff --git a/projects/mtg/debian/Res.txt b/projects/mtg/debian/Res.txt deleted file mode 100644 index 600f2d236..000000000 --- a/projects/mtg/debian/Res.txt +++ /dev/null @@ -1,2 +0,0 @@ -/home/user/MyDocs/wagic/Res/ -/home/user/wagic/Res/ diff --git a/projects/mtg/debian/changelog b/projects/mtg/debian/changelog index d1ab8a580..f4c9d48b7 100644 --- a/projects/mtg/debian/changelog +++ b/projects/mtg/debian/changelog @@ -1,6 +1,6 @@ -wagic (0.16.0maemo0) unstable; urgency=low +wagic (0.17.1maemo0) unstable; urgency=low - * Fixed Phonon sound problem - * Improved upgrade script - * Wagic 0.16.0 - -- Xawotihs Mon, 18 Jul 2011 14:11:42 +0200 + * Merged UI with Android and Meego versions + * Resources are now downloaded seperately + * Wagic 0.17.1 + -- Xawotihs Mon, 21 Jan 2012 14:11:42 +0200 diff --git a/projects/mtg/debian/launcher b/projects/mtg/debian/launcher deleted file mode 100755 index 5e16ef703..000000000 --- a/projects/mtg/debian/launcher +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -e - -if grep -q /home/user/MyDocs /proc/mounts; then -# FAT partition mounted - mkdir -p /home/user/MyDocs/wagic - mkdir -p /home/user/MyDocs/wagic/Res -# Size needed on the FAT partition - dirSize=`du -s /home/user/wagic/Res | awk '{print $1}'` -# Size available on the FAT partition - avaSize=`df | grep /dev/mmcblk0p1 | awk '{print $4}'` - if [ $avaSize -gt $dirSize ] ; then - if ! [ -e /home/user/MyDocs/wagic/Res/sets/primitives/mtg.txt ]; then - echo "Copying resources on the FAT partition because no file present on FAT partition" - cp -rf /home/user/wagic/Res/* /home/user/MyDocs/wagic/Res - elif [ /home/user/wagic/Res/sets/primitives/mtg.txt -nt /home/user/MyDocs/wagic/Res/sets/primitives/mtg.txt ]; then - echo "Copying resources on the FAT partition because files present on FAT partition are older" - cp -rf /home/user/wagic/Res/* /home/user/MyDocs/wagic/Res - else - echo "Files already up to date" - fi - else - echo "Not enough space on FAT partition" - fi -fi - -/opt/wagic/wagic -exit 0 - diff --git a/projects/mtg/debian/postinst b/projects/mtg/debian/postinst deleted file mode 100644 index 97a4452f2..000000000 --- a/projects/mtg/debian/postinst +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -e - -chmod a+x /opt/wagic/wagic -chmod a+x /opt/wagic/launcher -chmod -R a+rw /home/user/wagic -if grep -q /home/user/MyDocs /proc/mounts; then -# FAT partition mounted - mkdir -p /home/user/MyDocs/wagic - mkdir -p /home/user/MyDocs/wagic/Res -# Size needed on the FAT partition - dirSize=`du -s /home/user/wagic/Res | awk '{print $1}'` -# Size available on the FAT partition - avaSize=`df | grep /dev/mmcblk0p1 | awk '{print $4}'` - if [ $avaSize -gt $dirSize ] ; then - echo "Copying resources on the FAT partition" - cp -rf /home/user/wagic/Res/* /home/user/MyDocs/wagic/Res - else - echo "Not enough space on FAT partition" - fi -fi - -gtk-update-icon-cache -f /usr/share/icons/hicolor - -exit 0 diff --git a/projects/mtg/wagic-qt.pro b/projects/mtg/wagic-qt.pro index cb2e6202e..52ad40b0d 100644 --- a/projects/mtg/wagic-qt.pro +++ b/projects/mtg/wagic-qt.pro @@ -23,7 +23,7 @@ DEFINES += QT_CONFIG !android:!symbian:DEFINES += USE_PHONON android:INCLUDEPATH += $$ANDROID_NDK_ROOT/platforms/android-9/arch-arm/usr/include #DEFINES += QT_NO_DEBUG_OUTPUT -DEFINES += QT_WIDGET +maemo5:DEFINES += QT_WIDGET windows:INCLUDEPATH += ../../JGE/Dependencies/include windows:INCLUDEPATH += extra