Maemo application cleanup and final merge

This commit is contained in:
Xawotihs@gmail.com
2012-01-22 10:39:16 +00:00
parent 595f0b5690
commit 14962385b6
7 changed files with 55 additions and 60 deletions

View File

@@ -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 <mce/dbus-names.h>
#include <mce/mode-names.h>
#include <QDBusConnection>
#include <QDBusMessage>
#include <QDBusInterface>
#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)

View File

@@ -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

View File

@@ -1,2 +0,0 @@
/home/user/MyDocs/wagic/Res/
/home/user/wagic/Res/

View File

@@ -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 <xawotihs@gmail.com> 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 <xawotihs@gmail.com> Mon, 21 Jan 2012 14:11:42 +0200

View File

@@ -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

View File

@@ -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

View File

@@ -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