- Android port fixes for the Qt frontend
- Coded a small resource downloader in QML from the Qt frontend. It's completly useless for the moment and it's poorly integrated - Various tweaking in the Qt project file for Symbian and Android
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <QtOpenGL>
|
||||
#include <QTime>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtDeclarative>
|
||||
#include "qmlapplicationviewer.h"
|
||||
#include "filedownloader.h"
|
||||
|
||||
#if (defined FORCE_GLES)
|
||||
#undef GL_ES_VERSION_2_0
|
||||
@@ -107,7 +111,7 @@ protected:
|
||||
{
|
||||
if (event->type() == QEvent::Gesture)
|
||||
return gestureEvent(static_cast<QGestureEvent*>(event));
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN)
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID)
|
||||
else if (event->type() == QEvent::WindowActivate)
|
||||
{
|
||||
JGE::GetInstance()->Resume();
|
||||
@@ -165,7 +169,7 @@ protected:
|
||||
bool timerStarted;
|
||||
QRect viewPort;
|
||||
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN)
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID)
|
||||
int mMouseDownX;
|
||||
int mMouseDownY;
|
||||
qint64 mLastFingerDownTime;
|
||||
@@ -398,7 +402,7 @@ void JGEQtRenderer::paintGL()
|
||||
void JGEQtRenderer::timerEvent( QTimerEvent* )
|
||||
{
|
||||
if(this->isVisible()
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN)
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID)
|
||||
// This one is funny, this gives us 0% CPU when the app is in background for 1 line of code =)
|
||||
&& this->isActiveWindow()
|
||||
#endif
|
||||
@@ -416,7 +420,9 @@ void JGEQtRenderer::timerEvent( QTimerEvent* )
|
||||
g_engine->SetDelta((float)dt / 1000.0f);
|
||||
g_engine->Update((float)dt / 1000.0f);
|
||||
|
||||
updateGL();
|
||||
// we stop rendering if the window is hidden
|
||||
if(!isHidden())
|
||||
updateGL();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,7 +450,7 @@ void JGEQtRenderer::mousePressEvent(QMouseEvent *event)
|
||||
g_engine->LeftClicked(
|
||||
((lastPos.x()-viewPort.left())*SCREEN_WIDTH)/actualWidth,
|
||||
((lastPos.y()-viewPort.top())*SCREEN_HEIGHT)/actualHeight);
|
||||
#if (!defined Q_WS_MAEMO_5) && (!defined MEEGO_EDITION_HARMATTAN)
|
||||
#if (!defined Q_WS_MAEMO_5) && (!defined MEEGO_EDITION_HARMATTAN) && (!defined Q_WS_ANDROID)
|
||||
g_engine->HoldKey_NoRepeat(JGE_BTN_OK);
|
||||
#else
|
||||
mMouseDownX = lastPos.x();
|
||||
@@ -486,7 +492,7 @@ void JGEQtRenderer::mouseReleaseEvent(QMouseEvent *event)
|
||||
lastPos.y() <= viewPort.bottom() &&
|
||||
lastPos.x() <= viewPort.right() &&
|
||||
lastPos.x() >= viewPort.left()) {
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN)
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID)
|
||||
if(g_startTimer.elapsed() - mLastFingerDownTime <= kTapEventTimeout )
|
||||
{
|
||||
if(abs(mMouseDownX - lastPos.x()) < kHitzonePliancy &&
|
||||
@@ -629,7 +635,7 @@ void JGEQtRenderer::showEvent ( QShowEvent * event )
|
||||
{
|
||||
if(!timerStarted)
|
||||
{
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN)
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID)
|
||||
// 30 fps max on mobile
|
||||
timerId = startTimer(33);
|
||||
#else
|
||||
@@ -642,61 +648,76 @@ void JGEQtRenderer::showEvent ( QShowEvent * event )
|
||||
|
||||
void JGEQtRenderer::hideEvent ( QHideEvent * event )
|
||||
{
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID)
|
||||
if(timerStarted)
|
||||
{
|
||||
killTimer(timerId);
|
||||
timerStarted = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QApplication a( argc, argv );
|
||||
QDir::setCurrent(QCoreApplication::applicationDirPath () );
|
||||
QScopedPointer<QApplication> app(createApplication(argc, argv));
|
||||
QDir::setCurrent(QCoreApplication::applicationDirPath () );
|
||||
qDebug() << "Current path : " << QCoreApplication::applicationDirPath ();
|
||||
|
||||
qDebug() << "Current path : " << QCoreApplication::applicationDirPath ();
|
||||
QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
|
||||
// FIXME with something actually useful
|
||||
FileDownloader fileDownloader(QUrl("http://wagic.googlecode.com/files/wagic_0.16.0meego0_armel.deb"), "w00t.dat", 0);
|
||||
|
||||
g_launcher = new JGameLauncher();
|
||||
if(!fileDownloader.isDone()){
|
||||
viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
|
||||
viewer->setMainQmlFile(QLatin1String("qml/QmlWagic/main.qml"));
|
||||
viewer->rootContext()->setContextProperty("fileDownloader", &fileDownloader);
|
||||
viewer->showExpanded();
|
||||
|
||||
u32 flags = g_launcher->GetInitFlags();
|
||||
// FIXME we're actually have to close the QML app to start the native app...
|
||||
app->exec();
|
||||
}
|
||||
|
||||
if ((flags&JINIT_FLAG_ENABLE3D)!=0)
|
||||
{
|
||||
JRenderer::Set3DFlag(true);
|
||||
}
|
||||
g_launcher = new JGameLauncher();
|
||||
|
||||
g_glwidget = new JGEQtRenderer(NULL);
|
||||
g_glwidget->resize(ACTUAL_SCREEN_WIDTH, ACTUAL_SCREEN_HEIGHT);
|
||||
u32 flags = g_launcher->GetInitFlags();
|
||||
|
||||
a.setApplicationName(g_launcher->GetName());
|
||||
//a.setAutoSipEnabled(true);
|
||||
if ((flags&JINIT_FLAG_ENABLE3D)!=0)
|
||||
{
|
||||
JRenderer::Set3DFlag(true);
|
||||
}
|
||||
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN)
|
||||
// We start in fullscreen on mobile
|
||||
g_glwidget->showFullScreen();
|
||||
g_glwidget = new JGEQtRenderer(NULL);
|
||||
g_glwidget->resize(ACTUAL_SCREEN_WIDTH, ACTUAL_SCREEN_HEIGHT);
|
||||
|
||||
app->setApplicationName(g_launcher->GetName());
|
||||
//a.setAutoSipEnabled(true);
|
||||
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID)
|
||||
// We start in fullscreen on mobile
|
||||
g_glwidget->showFullScreen();
|
||||
#else
|
||||
// not on desktop
|
||||
g_glwidget->show();
|
||||
// not on desktop
|
||||
g_glwidget->show();
|
||||
#endif
|
||||
|
||||
JGECreateDefaultBindings();
|
||||
JGECreateDefaultBindings();
|
||||
|
||||
if (!InitGame())
|
||||
{
|
||||
qCritical("Could not init the game\n");
|
||||
return 1;
|
||||
}
|
||||
if (!InitGame())
|
||||
{
|
||||
qCritical("Could not init the game\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
a.exec();
|
||||
app->exec();
|
||||
|
||||
if (g_launcher)
|
||||
delete g_launcher;
|
||||
if (g_launcher)
|
||||
delete g_launcher;
|
||||
|
||||
if(g_glwidget)
|
||||
delete g_glwidget;
|
||||
if(g_glwidget)
|
||||
delete g_glwidget;
|
||||
|
||||
// Shutdown
|
||||
DestroyGame();
|
||||
// Shutdown
|
||||
DestroyGame();
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
48
projects/mtg/qml/QmlWagic/ProgressBar.qml
Normal file
48
projects/mtg/qml/QmlWagic/ProgressBar.qml
Normal file
@@ -0,0 +1,48 @@
|
||||
import QtQuick 1.0
|
||||
|
||||
Rectangle {
|
||||
id: progressbar
|
||||
|
||||
property int minimum: 0
|
||||
property int maximum: 100
|
||||
property int value: 0
|
||||
|
||||
width: 150
|
||||
height: 80
|
||||
radius: 10
|
||||
gradient: Gradient {
|
||||
GradientStop { id: gradient1; position: 0.0; color: "red" }
|
||||
GradientStop { id: gradient2; position: 0.7; color: "blue" }
|
||||
}
|
||||
border.width: 2
|
||||
border.color: "blue"
|
||||
opacity: 0.7
|
||||
smooth: true
|
||||
clip: true
|
||||
|
||||
|
||||
Rectangle {
|
||||
id: highlight
|
||||
|
||||
property int widthDest: ((progressbar.width * (value - minimum)) / (maximum - minimum))
|
||||
|
||||
anchors { left: parent.left; top: parent.top; bottom: parent.bottom }
|
||||
width: highlight.widthDest
|
||||
radius: 10
|
||||
gradient: Gradient {
|
||||
GradientStop { id: gradient3; position: 0.0; color: "blue" }
|
||||
GradientStop { id: gradient4; position: 0.7; color: "red" }
|
||||
}
|
||||
smooth: true
|
||||
|
||||
Behavior on width { SmoothedAnimation { velocity: 1200 } }
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors { centerIn: progressbar }
|
||||
color: "black"
|
||||
font.pixelSize: 12
|
||||
font.bold: true
|
||||
text: Math.floor((value - minimum) / (maximum - minimum) * 100) + '%'
|
||||
}
|
||||
}
|
||||
43
projects/mtg/qml/QmlWagic/main.qml
Normal file
43
projects/mtg/qml/QmlWagic/main.qml
Normal file
@@ -0,0 +1,43 @@
|
||||
import QtQuick 1.0
|
||||
|
||||
Rectangle {
|
||||
id: main
|
||||
width: 360
|
||||
height: 360
|
||||
scale: 1
|
||||
|
||||
Column{
|
||||
id: column1
|
||||
x: -48
|
||||
y: 0
|
||||
width: 457
|
||||
height: 374
|
||||
anchors.horizontalCenterOffset: 1
|
||||
scale: 1
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
spacing: 35
|
||||
Image {
|
||||
id: logo
|
||||
|
||||
fillMode: Image.PreserveAspectFit
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
source: "http://wololo.net/forum/styles/prosilver/imageset/site_logo.gif"
|
||||
}
|
||||
|
||||
Text {
|
||||
text: qsTr("Downloading resources")
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
|
||||
ProgressBar {
|
||||
id: progressbar
|
||||
value: fileDownloader.received
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
174
projects/mtg/qml/qmlapplicationviewer/qmlapplicationviewer.cpp
Normal file
174
projects/mtg/qml/qmlapplicationviewer/qmlapplicationviewer.cpp
Normal file
@@ -0,0 +1,174 @@
|
||||
// checksum 0xee24 version 0x70013
|
||||
/*
|
||||
This file was generated by the Qt Quick Application wizard of Qt Creator.
|
||||
QmlApplicationViewer is a convenience class containing mobile device specific
|
||||
code such as screen orientation handling. Also QML paths and debugging are
|
||||
handled here.
|
||||
It is recommended not to modify this file, since newer versions of Qt Creator
|
||||
may offer an updated version of it.
|
||||
*/
|
||||
|
||||
#include "qmlapplicationviewer.h"
|
||||
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtDeclarative/QDeclarativeComponent>
|
||||
#include <QtDeclarative/QDeclarativeEngine>
|
||||
#include <QtDeclarative/QDeclarativeContext>
|
||||
|
||||
#include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN
|
||||
|
||||
#ifdef HARMATTAN_BOOSTER
|
||||
#include <MDeclarativeCache>
|
||||
#endif
|
||||
|
||||
#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
|
||||
|
||||
#include <qt_private/qdeclarativedebughelper_p.h>
|
||||
|
||||
#if !defined(NO_JSDEBUGGER)
|
||||
#include <jsdebuggeragent.h>
|
||||
#endif
|
||||
#if !defined(NO_QMLOBSERVER)
|
||||
#include <qdeclarativeviewobserver.h>
|
||||
#endif
|
||||
|
||||
// Enable debugging before any QDeclarativeEngine is created
|
||||
struct QmlJsDebuggingEnabler
|
||||
{
|
||||
QmlJsDebuggingEnabler()
|
||||
{
|
||||
QDeclarativeDebugHelper::enableDebugging();
|
||||
}
|
||||
};
|
||||
|
||||
// Execute code in constructor before first QDeclarativeEngine is instantiated
|
||||
static QmlJsDebuggingEnabler enableDebuggingHelper;
|
||||
|
||||
#endif // QMLJSDEBUGGER
|
||||
|
||||
class QmlApplicationViewerPrivate
|
||||
{
|
||||
QString mainQmlFile;
|
||||
friend class QmlApplicationViewer;
|
||||
static QString adjustPath(const QString &path);
|
||||
};
|
||||
|
||||
QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
|
||||
{
|
||||
#ifdef Q_OS_UNIX
|
||||
#ifdef Q_OS_MAC
|
||||
if (!QDir::isAbsolutePath(path))
|
||||
return QString::fromLatin1("%1/../Resources/%2")
|
||||
.arg(QCoreApplication::applicationDirPath(), path);
|
||||
#else
|
||||
const QString pathInInstallDir =
|
||||
QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
|
||||
if (QFileInfo(pathInInstallDir).exists())
|
||||
return pathInInstallDir;
|
||||
#endif
|
||||
#endif
|
||||
return path;
|
||||
}
|
||||
|
||||
QmlApplicationViewer::QmlApplicationViewer(QWidget *parent)
|
||||
: QDeclarativeView(parent)
|
||||
, d(new QmlApplicationViewerPrivate())
|
||||
{
|
||||
connect(engine(), SIGNAL(quit()), SLOT(close()));
|
||||
setResizeMode(QDeclarativeView::SizeRootObjectToView);
|
||||
// Qt versions prior to 4.8.0 don't have QML/JS debugging services built in
|
||||
#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
|
||||
#if !defined(NO_JSDEBUGGER)
|
||||
new QmlJSDebugger::JSDebuggerAgent(engine());
|
||||
#endif
|
||||
#if !defined(NO_QMLOBSERVER)
|
||||
new QmlJSDebugger::QDeclarativeViewObserver(this, this);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
QmlApplicationViewer::~QmlApplicationViewer()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
QmlApplicationViewer *QmlApplicationViewer::create()
|
||||
{
|
||||
return new QmlApplicationViewer();
|
||||
}
|
||||
|
||||
void QmlApplicationViewer::setMainQmlFile(const QString &file)
|
||||
{
|
||||
d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file);
|
||||
setSource(QUrl::fromLocalFile(d->mainQmlFile));
|
||||
}
|
||||
|
||||
void QmlApplicationViewer::addImportPath(const QString &path)
|
||||
{
|
||||
engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path));
|
||||
}
|
||||
|
||||
void QmlApplicationViewer::setOrientation(ScreenOrientation orientation)
|
||||
{
|
||||
#if defined(Q_OS_SYMBIAN)
|
||||
// If the version of Qt on the device is < 4.7.2, that attribute won't work
|
||||
if (orientation != ScreenOrientationAuto) {
|
||||
const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.'));
|
||||
if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) {
|
||||
qWarning("Screen orientation locking only supported with Qt 4.7.2 and above");
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif // Q_OS_SYMBIAN
|
||||
|
||||
Qt::WidgetAttribute attribute;
|
||||
switch (orientation) {
|
||||
#if QT_VERSION < 0x040702
|
||||
// Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes
|
||||
case ScreenOrientationLockPortrait:
|
||||
attribute = static_cast<Qt::WidgetAttribute>(128);
|
||||
break;
|
||||
case ScreenOrientationLockLandscape:
|
||||
attribute = static_cast<Qt::WidgetAttribute>(129);
|
||||
break;
|
||||
default:
|
||||
case ScreenOrientationAuto:
|
||||
attribute = static_cast<Qt::WidgetAttribute>(130);
|
||||
break;
|
||||
#else // QT_VERSION < 0x040702
|
||||
case ScreenOrientationLockPortrait:
|
||||
attribute = Qt::WA_LockPortraitOrientation;
|
||||
break;
|
||||
case ScreenOrientationLockLandscape:
|
||||
attribute = Qt::WA_LockLandscapeOrientation;
|
||||
break;
|
||||
default:
|
||||
case ScreenOrientationAuto:
|
||||
attribute = Qt::WA_AutoOrientation;
|
||||
break;
|
||||
#endif // QT_VERSION < 0x040702
|
||||
};
|
||||
setAttribute(attribute, true);
|
||||
}
|
||||
|
||||
void QmlApplicationViewer::showExpanded()
|
||||
{
|
||||
#if defined(Q_OS_SYMBIAN) || defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
|
||||
showFullScreen();
|
||||
#elif defined(Q_WS_MAEMO_5)
|
||||
showMaximized();
|
||||
#else
|
||||
show();
|
||||
#endif
|
||||
}
|
||||
|
||||
QApplication *createApplication(int &argc, char **argv)
|
||||
{
|
||||
#ifdef HARMATTAN_BOOSTER
|
||||
return MDeclarativeCache::qApplication(argc, argv);
|
||||
#else
|
||||
return new QApplication(argc, argv);
|
||||
#endif
|
||||
}
|
||||
46
projects/mtg/qml/qmlapplicationviewer/qmlapplicationviewer.h
Normal file
46
projects/mtg/qml/qmlapplicationviewer/qmlapplicationviewer.h
Normal file
@@ -0,0 +1,46 @@
|
||||
// checksum 0x898f version 0x70013
|
||||
/*
|
||||
This file was generated by the Qt Quick Application wizard of Qt Creator.
|
||||
QmlApplicationViewer is a convenience class containing mobile device specific
|
||||
code such as screen orientation handling. Also QML paths and debugging are
|
||||
handled here.
|
||||
It is recommended not to modify this file, since newer versions of Qt Creator
|
||||
may offer an updated version of it.
|
||||
*/
|
||||
|
||||
#ifndef QMLAPPLICATIONVIEWER_H
|
||||
#define QMLAPPLICATIONVIEWER_H
|
||||
|
||||
#include <QtDeclarative/QDeclarativeView>
|
||||
|
||||
class QmlApplicationViewer : public QDeclarativeView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum ScreenOrientation {
|
||||
ScreenOrientationLockPortrait,
|
||||
ScreenOrientationLockLandscape,
|
||||
ScreenOrientationAuto
|
||||
};
|
||||
|
||||
explicit QmlApplicationViewer(QWidget *parent = 0);
|
||||
virtual ~QmlApplicationViewer();
|
||||
|
||||
static QmlApplicationViewer *create();
|
||||
|
||||
void setMainQmlFile(const QString &file);
|
||||
void addImportPath(const QString &path);
|
||||
|
||||
// Note that this will only have an effect on Symbian and Fremantle.
|
||||
void setOrientation(ScreenOrientation orientation);
|
||||
|
||||
void showExpanded();
|
||||
|
||||
private:
|
||||
class QmlApplicationViewerPrivate *d;
|
||||
};
|
||||
|
||||
QApplication *createApplication(int &argc, char **argv);
|
||||
|
||||
#endif // QMLAPPLICATIONVIEWER_H
|
||||
148
projects/mtg/qml/qmlapplicationviewer/qmlapplicationviewer.pri
Normal file
148
projects/mtg/qml/qmlapplicationviewer/qmlapplicationviewer.pri
Normal file
@@ -0,0 +1,148 @@
|
||||
# checksum 0x5b42 version 0x70013
|
||||
# This file was generated by the Qt Quick Application wizard of Qt Creator.
|
||||
# The code below adds the QmlApplicationViewer to the project and handles the
|
||||
# activation of QML debugging.
|
||||
# It is recommended not to modify this file, since newer versions of Qt Creator
|
||||
# may offer an updated version of it.
|
||||
|
||||
QT += declarative
|
||||
|
||||
SOURCES += $$PWD/qmlapplicationviewer.cpp
|
||||
HEADERS += $$PWD/qmlapplicationviewer.h
|
||||
INCLUDEPATH += $$PWD
|
||||
|
||||
# Include JS debugger library if QMLJSDEBUGGER_PATH is set
|
||||
!isEmpty(QMLJSDEBUGGER_PATH) {
|
||||
include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
|
||||
} else {
|
||||
DEFINES -= QMLJSDEBUGGER
|
||||
}
|
||||
|
||||
contains(CONFIG,qdeclarative-boostable):contains(MEEGO_EDITION,harmattan) {
|
||||
DEFINES += HARMATTAN_BOOSTER
|
||||
}
|
||||
# This file was generated by an application wizard of Qt Creator.
|
||||
# The code below handles deployment to Symbian and Maemo, aswell as copying
|
||||
# of the application data to shadow build directories on desktop.
|
||||
# It is recommended not to modify this file, since newer versions of Qt Creator
|
||||
# may offer an updated version of it.
|
||||
|
||||
defineTest(qtcAddDeployment) {
|
||||
for(deploymentfolder, DEPLOYMENTFOLDERS) {
|
||||
item = item$${deploymentfolder}
|
||||
itemsources = $${item}.sources
|
||||
$$itemsources = $$eval($${deploymentfolder}.source)
|
||||
itempath = $${item}.path
|
||||
$$itempath= $$eval($${deploymentfolder}.target)
|
||||
export($$itemsources)
|
||||
export($$itempath)
|
||||
DEPLOYMENT += $$item
|
||||
}
|
||||
|
||||
MAINPROFILEPWD = $$PWD
|
||||
|
||||
symbian {
|
||||
isEmpty(ICON):exists($${TARGET}.svg):ICON = $${TARGET}.svg
|
||||
isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
|
||||
} else:win32 {
|
||||
copyCommand =
|
||||
for(deploymentfolder, DEPLOYMENTFOLDERS) {
|
||||
source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
|
||||
source = $$replace(source, /, \\)
|
||||
sourcePathSegments = $$split(source, \\)
|
||||
target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments)
|
||||
target = $$replace(target, /, \\)
|
||||
target ~= s,\\\\\\.?\\\\,\\,
|
||||
!isEqual(source,$$target) {
|
||||
!isEmpty(copyCommand):copyCommand += &&
|
||||
isEqual(QMAKE_DIR_SEP, \\) {
|
||||
copyCommand += $(COPY_DIR) \"$$source\" \"$$target\"
|
||||
} else {
|
||||
source = $$replace(source, \\\\, /)
|
||||
target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
|
||||
target = $$replace(target, \\\\, /)
|
||||
copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\"
|
||||
}
|
||||
}
|
||||
}
|
||||
!isEmpty(copyCommand) {
|
||||
copyCommand = @echo Copying application data... && $$copyCommand
|
||||
copydeploymentfolders.commands = $$copyCommand
|
||||
first.depends = $(first) copydeploymentfolders
|
||||
export(first.depends)
|
||||
export(copydeploymentfolders.commands)
|
||||
QMAKE_EXTRA_TARGETS += first copydeploymentfolders
|
||||
}
|
||||
} else:unix {
|
||||
maemo5 {
|
||||
desktopfile.files = $${TARGET}.desktop
|
||||
desktopfile.path = /usr/share/applications/hildon
|
||||
icon.files = $${TARGET}64.png
|
||||
icon.path = /usr/share/icons/hicolor/64x64/apps
|
||||
} else:!isEmpty(MEEGO_VERSION_MAJOR) {
|
||||
desktopfile.files = $${TARGET}_harmattan.desktop
|
||||
desktopfile.path = /usr/share/applications
|
||||
icon.files = $${TARGET}80.png
|
||||
icon.path = /usr/share/icons/hicolor/80x80/apps
|
||||
} else { # Assumed to be a Desktop Unix
|
||||
copyCommand =
|
||||
for(deploymentfolder, DEPLOYMENTFOLDERS) {
|
||||
source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
|
||||
source = $$replace(source, \\\\, /)
|
||||
macx {
|
||||
target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target)
|
||||
} else {
|
||||
target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
|
||||
}
|
||||
target = $$replace(target, \\\\, /)
|
||||
sourcePathSegments = $$split(source, /)
|
||||
targetFullPath = $$target/$$last(sourcePathSegments)
|
||||
targetFullPath ~= s,/\\.?/,/,
|
||||
!isEqual(source,$$targetFullPath) {
|
||||
!isEmpty(copyCommand):copyCommand += &&
|
||||
copyCommand += $(MKDIR) \"$$target\"
|
||||
copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\"
|
||||
}
|
||||
}
|
||||
!isEmpty(copyCommand) {
|
||||
copyCommand = @echo Copying application data... && $$copyCommand
|
||||
copydeploymentfolders.commands = $$copyCommand
|
||||
first.depends = $(first) copydeploymentfolders
|
||||
export(first.depends)
|
||||
export(copydeploymentfolders.commands)
|
||||
QMAKE_EXTRA_TARGETS += first copydeploymentfolders
|
||||
}
|
||||
}
|
||||
installPrefix = /opt/$${TARGET}
|
||||
for(deploymentfolder, DEPLOYMENTFOLDERS) {
|
||||
item = item$${deploymentfolder}
|
||||
itemfiles = $${item}.files
|
||||
$$itemfiles = $$eval($${deploymentfolder}.source)
|
||||
itempath = $${item}.path
|
||||
$$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target)
|
||||
export($$itemfiles)
|
||||
export($$itempath)
|
||||
INSTALLS += $$item
|
||||
}
|
||||
|
||||
!isEmpty(desktopfile.path) {
|
||||
export(icon.files)
|
||||
export(icon.path)
|
||||
export(desktopfile.files)
|
||||
export(desktopfile.path)
|
||||
INSTALLS += icon desktopfile
|
||||
}
|
||||
|
||||
target.path = $${installPrefix}/bin
|
||||
export(target.path)
|
||||
INSTALLS += target
|
||||
}
|
||||
|
||||
export (ICON)
|
||||
export (INSTALLS)
|
||||
export (DEPLOYMENT)
|
||||
export (TARGET.EPOCHEAPSIZE)
|
||||
export (TARGET.CAPABILITY)
|
||||
export (LIBS)
|
||||
export (QMAKE_EXTRA_TARGETS)
|
||||
}
|
||||
@@ -1,45 +1,47 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2010-06-30T19:48:30
|
||||
#
|
||||
#-------------------------------------------------
|
||||
# Add more folders to ship with the application, here
|
||||
folder_01.source = qml/QmlWagic
|
||||
folder_01.target = qml
|
||||
DEPLOYMENTFOLDERS = folder_01
|
||||
|
||||
QT += core gui opengl phonon
|
||||
TARGET = wagic
|
||||
|
||||
QT += core gui opengl network
|
||||
!android:QT += phonon
|
||||
maemo5:QT += dbus
|
||||
|
||||
#CONFIG += warn_off precompile_header // causes some massives errors on mac.
|
||||
VERSION = 0.16.0
|
||||
TARGET = wagic
|
||||
TEMPLATE = app
|
||||
|
||||
#!macx:CONFIG += precompile_header
|
||||
unix|macx:QMAKE_CXXFLAGS += -Wno-unused-parameter
|
||||
unix|macx:!maemo5:QMAKE_CXXFLAGS += -Werror
|
||||
unix|macx:!maemo5:!symbian:QMAKE_CXXFLAGS += -Werror
|
||||
windows:DEFINES += WIN32
|
||||
windows:DEFINES += _CRT_SECURE_NO_WARNINGS
|
||||
unix|macx:DEFINES += LINUX
|
||||
CONFIG(debug, debug|release):DEFINES += _DEBUG
|
||||
DEFINES += QT_CONFIG
|
||||
DEFINES += USE_PHONON
|
||||
maemo5 {
|
||||
QT += dbus
|
||||
}
|
||||
!android:DEFINES += USE_PHONON
|
||||
DEFINES += QT_NO_DEBUG_OUTPUT
|
||||
|
||||
windows:INCLUDEPATH += ../../JGE/Dependencies/include
|
||||
windows:INCLUDEPATH += extra
|
||||
unix:!symbian:INCLUDEPATH += /usr/include/GL
|
||||
macx:INCLUDEPATH += /opt/include
|
||||
INCLUDEPATH += ../../JGE/include/qt
|
||||
INCLUDEPATH += ../../JGE/include
|
||||
INCLUDEPATH += ../../JGE/src/zipFS
|
||||
INCLUDEPATH += ../../Boost
|
||||
INCLUDEPATH += include
|
||||
OBJECTS_DIR = objs
|
||||
MOC_DIR = objs
|
||||
DESTDIR = bin
|
||||
symbian:DEFINES += FORCE_GLES
|
||||
symbian:DEFINES += QT_OPENGL_ES_1
|
||||
!symbian:DESTDIR = bin
|
||||
|
||||
unix:LIBS += -lz
|
||||
unix:!symbian:LIBS += -lz
|
||||
PRECOMPILED_HEADER = include/PrecompiledHeader.h
|
||||
|
||||
# MGT
|
||||
#DEFINES += TESTSUITE
|
||||
#DEFINES += TRACK_OBJECT_USAGE
|
||||
DEFINES += AI_CHANGE_TESTING
|
||||
#DEFINES += ACTION_LOGGING_TESTING
|
||||
|
||||
SOURCES += \
|
||||
src/AbilityParser.cpp\
|
||||
src/ActionElement.cpp\
|
||||
@@ -48,7 +50,7 @@ SOURCES += \
|
||||
src/AIHints.cpp\
|
||||
src/AIMomirPlayer.cpp\
|
||||
src/AIPlayer.cpp\
|
||||
src/AIPlayerBaka.cpp\
|
||||
src/AIPlayerBaka.cpp\
|
||||
src/AIStats.cpp\
|
||||
src/AllAbilities.cpp\
|
||||
src/CardDescriptor.cpp\
|
||||
@@ -57,7 +59,6 @@ SOURCES += \
|
||||
src/CardGui.cpp\
|
||||
src/CardPrimitive.cpp\
|
||||
src/CardSelector.cpp\
|
||||
src/CardSelectorSingleton.cpp\
|
||||
src/Closest.cpp\
|
||||
src/Counters.cpp\
|
||||
src/Credits.cpp\
|
||||
@@ -146,12 +147,26 @@ SOURCES += \
|
||||
src/WFilter.cpp\
|
||||
src/WFont.cpp\
|
||||
src/WGui.cpp\
|
||||
src/WResourceManager.cpp
|
||||
src/WResourceManager.cpp \
|
||||
src/GameSerializer.cpp \
|
||||
src/AIPlayerBakaB.cpp
|
||||
|
||||
CONFIG(debug, debug|release):SOURCES += src/TestSuiteAI.cpp
|
||||
CONFIG(debug, debug|release):
|
||||
SOURCES += src/TestSuiteAI.cpp
|
||||
|
||||
HEADERS += \
|
||||
include/CacheEngine.h\
|
||||
include/AllAbilities.h\
|
||||
include/AbilityParser.h\
|
||||
include/PrecompiledHeader.h\
|
||||
include/WResource_Fwd.h\
|
||||
include/PlayRestrictions.h\
|
||||
include/ModRules.h\
|
||||
include/AIHints.h\
|
||||
include/AIPlayerBaka.h\
|
||||
include/AIPlayerBakaB.h\
|
||||
include/DeckEditorMenu.h\
|
||||
include/WResourceManagerImpl.h\
|
||||
include/DeckMenu.h\
|
||||
include/DeckMenuItem.h\
|
||||
include/ExtraCost.h\
|
||||
@@ -209,7 +224,6 @@ HEADERS += \
|
||||
include/OSD.h\
|
||||
include/Translate.h\
|
||||
include/CardSelector.h\
|
||||
include/CardSelectorSingleton.h\
|
||||
include/GuiBackground.h\
|
||||
include/PhaseRing.h\
|
||||
include/TranslateKeys.h\
|
||||
@@ -253,10 +267,12 @@ HEADERS += \
|
||||
include/DeckManager.h\
|
||||
include/SimplePopup.h\
|
||||
include/SimpleMenu.h\
|
||||
include/ObjectAnalytics.h
|
||||
include/ObjectAnalytics.h \
|
||||
include/GameSerializer.h
|
||||
|
||||
# JGE, could probably be moved outside
|
||||
SOURCES += \
|
||||
../../JGE/src/qt/filedownloader.cpp\
|
||||
../../JGE/src/Qtmain.cpp\
|
||||
../../JGE/src/Encoding.cpp\
|
||||
../../JGE/src/JAnimator.cpp\
|
||||
@@ -288,13 +304,15 @@ SOURCES += \
|
||||
../../JGE/src/hge/hgeparticle.cpp\
|
||||
../../JGE/src/hge/hgerect.cpp\
|
||||
../../JGE/src/hge/hgevector.cpp\
|
||||
../../JGE/src/zipFS/zfsystem.cpp\
|
||||
../../JGE/src/zipFS/ziphdr.cpp\
|
||||
../../JGE/src/zipFS/zstream.cpp\
|
||||
../../JGE/src/zipFS/zfsystem.cpp\
|
||||
../../JGE/src/zipFS/ziphdr.cpp\
|
||||
../../JGE/src/zipFS/zstream.cpp\
|
||||
../../JGE/src/pc/JSfx.cpp\
|
||||
../../JGE/src/pc/JGfx.cpp
|
||||
|
||||
HEADERS += \
|
||||
../../JGE/include/qt/filedownloader.h\
|
||||
../../JGE/include/Threading.h\
|
||||
../../JGE/include/decoder_prx.h\
|
||||
../../JGE/include/DebugRoutines.h\
|
||||
../../JGE/include/Encoding.h\
|
||||
@@ -328,10 +346,28 @@ HEADERS += \
|
||||
../../JGE/include/Vector2D.h\
|
||||
../../JGE/include/Vector3D.h\
|
||||
../../JGE/include/vram.h\
|
||||
../../JGE/include/hge/hgecolor.h\
|
||||
../../JGE/include/hge/hgedistort.h\
|
||||
../../JGE/include/hge/hgefont.h\
|
||||
../../JGE/include/hge/hgeparticle.h\
|
||||
../../JGE/include/hge/hgerect.h\
|
||||
../../JGE/include/hge/hgevector.h\
|
||||
../../JGE/src/unzip/unzip.h\
|
||||
../../JGE/src/unzip/ioapi.h\
|
||||
../../JGE/src/zipFS/zstream_zlib.h\
|
||||
../../JGE/src/zipFS/zfsystem.h\
|
||||
../../JGE/src/zipFS/zstream.h\
|
||||
../../JGE/src/zipFS/ziphdr.h\
|
||||
../../JGE/src/zipFS/stdafx.h\
|
||||
../../JGE/src/zipFS/fileio.h\
|
||||
../../JGE/src/tinyxml/tinystr.h\
|
||||
../../JGE/src/tinyxml/tinyxml.h\
|
||||
../../JGE/include/vram.h
|
||||
|
||||
# Please do not modify the following two lines. Required for deployment.
|
||||
include(qml/qmlapplicationviewer/qmlapplicationviewer.pri)
|
||||
qtcAddDeployment()
|
||||
|
||||
# maemo 5 packaging
|
||||
maemo5: {
|
||||
# Variables
|
||||
@@ -364,16 +400,9 @@ maemo5: {
|
||||
|
||||
launcher.path = $$BINDIR
|
||||
launcher.files += debian/launcher
|
||||
}
|
||||
|
||||
# Meego/maemo 6 packaging (no launcher)
|
||||
#unix:!symbian:!maemo5 {
|
||||
exists($$QMAKE_INCDIR_QT"/../qmsystem2/qmkeys.h"):!contains(MEEGO_EDITION,harmattan): {
|
||||
MEEGO_VERSION_MAJOR = 1
|
||||
MEEGO_VERSION_MINOR = 2
|
||||
MEEGO_VERSION_PATCH = 0
|
||||
MEEGO_EDITION = harmattan
|
||||
DEFINES += MEEGO_EDITION_HARMATTAN
|
||||
} else:contains(MEEGO_EDITION,harmattan): {
|
||||
|
||||
# Variables
|
||||
BINDIR = /opt/wagic/bin
|
||||
@@ -443,10 +472,76 @@ exists($$QMAKE_INCDIR_QT"/../qmsystem2/qmkeys.h"):!contains(MEEGO_EDITION,harmat
|
||||
|
||||
res_themes.path = $$RESDIR/themes
|
||||
res_themes.files += bin/Res/themes/*
|
||||
|
||||
} else:symbian {
|
||||
TARGET.UID3 = 0xE1D807D3
|
||||
|
||||
# Smart Installer package's UID
|
||||
# This UID is from the protected range
|
||||
# and therefore the package will fail to install if self-signed
|
||||
# By default qmake uses the unprotected range value if unprotected UID is defined for the application
|
||||
# and 0x2002CCCF value if protected UID is given to the application
|
||||
#symbian:DEPLOYMENT.installer_header = 0x2002CCCF
|
||||
|
||||
# Allow network access on Symbian... that's probably pointless
|
||||
TARGET.CAPABILITY += NetworkServices
|
||||
|
||||
RESDIR = some/res/dir
|
||||
USERDIR = some/user/dir
|
||||
DEFINES += RESDIR=\"$$RESDIR\"
|
||||
DEFINES += USERDIR=\"$$USERDIR\"
|
||||
|
||||
} else:android {
|
||||
DEFINES += Q_WS_ANDROID
|
||||
RESDIR = Res
|
||||
USERDIR = /sdcard/Wagic/Res
|
||||
DEFINES += RESDIR=\\\"$$RESDIR\\\"
|
||||
DEFINES += USERDIR=\\\"$$USERDIR\\\"
|
||||
} else:unix {
|
||||
RESDIR = Res
|
||||
USERDIR = ~/.Wagic
|
||||
DEFINES += RESDIR=\\\"$$RESDIR\\\"
|
||||
DEFINES += USERDIR=\\\"$$USERDIR\\\"
|
||||
RESDIR = Res
|
||||
USERDIR = ~/.Wagic
|
||||
DEFINES += RESDIR=\\\"$$RESDIR\\\"
|
||||
DEFINES += USERDIR=\\\"$$USERDIR\\\"
|
||||
|
||||
} else:windows {
|
||||
RESDIR = ./Res
|
||||
USERDIR = ./user
|
||||
DEFINES += RESDIR=\\\"$$RESDIR\\\"
|
||||
DEFINES += USERDIR=\\\"$$USERDIR\\\"
|
||||
}
|
||||
|
||||
OTHER_FILES += \
|
||||
android/AndroidManifest.xml \
|
||||
android/res/layout/splash.xml \
|
||||
android/res/values-ru/strings.xml \
|
||||
android/res/values-it/strings.xml \
|
||||
android/res/values/strings.xml \
|
||||
android/res/values/libs.xml \
|
||||
android/res/values-id/strings.xml \
|
||||
android/res/values-rs/strings.xml \
|
||||
android/res/values-nl/strings.xml \
|
||||
android/res/values-zh-rCN/strings.xml \
|
||||
android/res/values-ro/strings.xml \
|
||||
android/res/drawable-ldpi/icon.png \
|
||||
android/res/drawable-mdpi/icon.png \
|
||||
android/res/values-et/strings.xml \
|
||||
android/res/values-fr/strings.xml \
|
||||
android/res/values-ja/strings.xml \
|
||||
android/res/values-el/strings.xml \
|
||||
android/res/values-pt-rBR/strings.xml \
|
||||
android/res/values-fa/strings.xml \
|
||||
android/res/drawable/logo.png \
|
||||
android/res/drawable/icon.png \
|
||||
android/res/values-nb/strings.xml \
|
||||
android/res/values-ms/strings.xml \
|
||||
android/res/values-de/strings.xml \
|
||||
android/res/values-zh-rTW/strings.xml \
|
||||
android/res/values-pl/strings.xml \
|
||||
android/res/drawable-hdpi/icon.png \
|
||||
android/src/org/kde/necessitas/origo/QtApplication.java \
|
||||
android/src/org/kde/necessitas/origo/QtActivity.java \
|
||||
android/src/org/kde/necessitas/ministro/IMinistroCallback.aidl \
|
||||
android/src/org/kde/necessitas/ministro/IMinistro.aidl
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user