]> Some of my projects - AniAdd.git/commitdiff
Creator updates
authorAPTX <marek321@gmail.com>
Fri, 6 Jan 2012 19:07:38 +0000 (20:07 +0100)
committerAPTX <marek321@gmail.com>
Fri, 6 Jan 2012 19:07:38 +0000 (20:07 +0100)
qmlapplicationviewer/qmlapplicationviewer.cpp
qmlapplicationviewer/qmlapplicationviewer.h
qmlapplicationviewer/qmlapplicationviewer.pri

index f81fb4d800da41c9678b2e1cbe0080f51cca0273..997bbfcc743034ec9ec749e9311295a4e1b2bc65 100644 (file)
@@ -1,4 +1,4 @@
-// checksum 0x5e4a version 0x5000d
+// 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
 
 #include "qmlapplicationviewer.h"
 
-#include <QtCore/QCoreApplication>
 #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>
@@ -54,24 +60,21 @@ QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
 #ifdef Q_OS_UNIX
 #ifdef Q_OS_MAC
     if (!QDir::isAbsolutePath(path))
-        return QCoreApplication::applicationDirPath()
-                + QLatin1String("/../Resources/") + path;
+        return QString::fromLatin1("%1/../Resources/%2")
+                .arg(QCoreApplication::applicationDirPath(), path);
 #else
-    const QString pathInInstallDir = QCoreApplication::applicationDirPath()
-        + QLatin1String("/../") + path;
-    if (pathInInstallDir.contains(QLatin1String("opt"))
-            && pathInInstallDir.contains(QLatin1String("bin"))
-            && QFileInfo(pathInInstallDir).exists()) {
+    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),
-    m_d(new QmlApplicationViewerPrivate)
+QmlApplicationViewer::QmlApplicationViewer(QWidget *parent)
+    : QDeclarativeView(parent)
+    , d(new QmlApplicationViewerPrivate())
 {
     connect(engine(), SIGNAL(quit()), SLOT(close()));
     setResizeMode(QDeclarativeView::SizeRootObjectToView);
@@ -88,13 +91,18 @@ QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) :
 
 QmlApplicationViewer::~QmlApplicationViewer()
 {
-    delete m_d;
+    delete d;
+}
+
+QmlApplicationViewer *QmlApplicationViewer::create()
+{
+    return new QmlApplicationViewer();
 }
 
 void QmlApplicationViewer::setMainQmlFile(const QString &file)
 {
-    m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file);
-    setSource(QUrl::fromLocalFile(m_d->mainQmlFile));
+    d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file);
+    setSource(QUrl::fromLocalFile(d->mainQmlFile));
 }
 
 void QmlApplicationViewer::addImportPath(const QString &path)
@@ -147,7 +155,7 @@ void QmlApplicationViewer::setOrientation(ScreenOrientation orientation)
 
 void QmlApplicationViewer::showExpanded()
 {
-#if defined(Q_OS_SYMBIAN) || defined(MEEGO_EDITION_HARMATTAN)
+#if defined(Q_OS_SYMBIAN) || defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
     showFullScreen();
 #elif defined(Q_WS_MAEMO_5)
     showMaximized();
@@ -155,3 +163,12 @@ void QmlApplicationViewer::showExpanded()
     show();
 #endif
 }
+
+QApplication *createApplication(int &argc, char **argv)
+{
+#ifdef HARMATTAN_BOOSTER
+    return MDeclarativeCache::qApplication(argc, argv);
+#else
+    return new QApplication(argc, argv);
+#endif
+}
index 3fe17ab6b2becd8a79c082aa79fc0f0c54095018..b01cc886f024a5f48b2b9bcfe4f2cb62a5614cb0 100644 (file)
@@ -1,4 +1,4 @@
-// checksum 0x382f version 0x5000d
+// 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
@@ -27,6 +27,8 @@ public:
     explicit QmlApplicationViewer(QWidget *parent = 0);
     virtual ~QmlApplicationViewer();
 
+    static QmlApplicationViewer *create();
+
     void setMainQmlFile(const QString &file);
     void addImportPath(const QString &path);
 
@@ -36,7 +38,9 @@ public:
     void showExpanded();
 
 private:
-    class QmlApplicationViewerPrivate *m_d;
+    class QmlApplicationViewerPrivate *d;
 };
 
+QApplication *createApplication(int &argc, char **argv);
+
 #endif // QMLAPPLICATIONVIEWER_H
index 343adfeac5781c278648e56a2d20fce3c2dff29f..b6931d04528d7b15204a7e2f775f87516276b2c8 100644 (file)
@@ -1,4 +1,4 @@
-# checksum 0x83a9 version 0x5000d
+# 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.
@@ -6,7 +6,6 @@
 # may offer an updated version of it.
 
 QT += declarative
-CONFIG(debug, debug|release):CONFIG += declarative_debug
 
 SOURCES += $$PWD/qmlapplicationviewer.cpp
 HEADERS += $$PWD/qmlapplicationviewer.h
@@ -18,6 +17,10 @@ INCLUDEPATH += $$PWD
 } 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.
@@ -49,6 +52,7 @@ symbian {
         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, \\) {
@@ -75,11 +79,12 @@ symbian {
         desktopfile.path = /usr/share/applications/hildon
         icon.files = $${TARGET}64.png
         icon.path = /usr/share/icons/hicolor/64x64/apps
-    } else {
+    } 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)
@@ -92,6 +97,7 @@ symbian {
             target = $$replace(target, \\\\, /)
             sourcePathSegments = $$split(source, /)
             targetFullPath = $$target/$$last(sourcePathSegments)
+            targetFullPath ~= s,/\\.?/,/,
             !isEqual(source,$$targetFullPath) {
                 !isEmpty(copyCommand):copyCommand += &&
                 copyCommand += $(MKDIR) \"$$target\"
@@ -118,13 +124,18 @@ symbian {
         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(icon.files)
-    export(icon.path)
-    export(desktopfile.files)
-    export(desktopfile.path)
     export(target.path)
-    INSTALLS += desktopfile icon target
+    INSTALLS += target
 }
 
 export (ICON)