incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [4/26] qt commit: Initial version working at Harmattan@Qt5
Date Fri, 24 Feb 2012 20:52:11 GMT
Initial version working at Harmattan@Qt5


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/commit/0e9ba638
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/tree/0e9ba638
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/diff/0e9ba638

Branch: refs/heads/master
Commit: 0e9ba638cd0d6892a33230b92bc310dadd33b2b1
Parents: c69112c
Author: Denis Kormalev <dkormalev@ics.com>
Authored: Fri Feb 24 17:51:37 2012 +0400
Committer: Denis Kormalev <dkormalev@ics.com>
Committed: Fri Feb 24 17:52:52 2012 +0400

----------------------------------------------------------------------
 cordovaqt.pro              |   68 +++++++++++++++++++++-----------------
 main.cpp                   |   31 ++++++++++++++---
 qml/main_harmattan.qml     |    2 +-
 qml/main_harmattan_qt5.qml |   64 ++++++++++++++++++++++++++++++++++++
 src/cordova.cpp            |    2 +-
 src/cplugin.h              |    1 -
 src/cwebpage.cpp           |   28 ----------------
 src/cwebpage.h             |   37 ---------------------
 src/plugins/device.cpp     |    1 +
 src/plugins/fileapi.h      |    1 +
 src/plugins/geolocation.h  |    1 +
 www/js/connection.js       |    2 +-
 12 files changed, 133 insertions(+), 105 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/0e9ba638/cordovaqt.pro
----------------------------------------------------------------------
diff --git a/cordovaqt.pro b/cordovaqt.pro
index 211454e..61d823b 100644
--- a/cordovaqt.pro
+++ b/cordovaqt.pro
@@ -9,16 +9,50 @@ qmlDir.source = qml
 DEPLOYMENTFOLDERS = wwwDir xmlDir qmlDir # file1 dir1
 
 
+SOURCES += main.cpp \
+    src/plugins/notification.cpp \
+    src/plugins/geolocation.cpp \
+    src/plugins/fileapi.cpp \
+    src/plugins/device.cpp \
+    src/pluginregistry.cpp \
+    src/plugins/console.cpp \
+    src/plugins/connection.cpp \
+    src/plugins/compass.cpp \
+    src/plugins/accelerometer.cpp \
+    src/plugins/events.cpp \
+    src/cordova.cpp \
+    src/cplugin.cpp
+HEADERS += \
+    src/plugins/notification.h \
+    src/plugins/geolocation.h \
+    src/plugins/fileapi.h \
+    src/plugins/device.h \
+    src/pluginregistry.h \
+    src/plugins/console.h \
+    src/plugins/connection.h \
+    src/plugins/compass.h \
+    src/plugins/accelerometer.h \
+    src/plugins/events.h \
+    src/cordova.h \
+    src/cplugin.h
+
 greaterThan(QT_MAJOR_VERSION, 4) {
+    message("Qt5 build")
     QT += widgets
     QT += location
+    QT += sensors
     QT += feedback
     QT += systeminfo
-    QT += sensors
     QT += quick declarative
+
     OTHER_FILES += qml/main_qt5.qml \
+        qml/main_harmattan_qt5.qml \
         qml/cordova_wrapper.js
+
 } else:!isEmpty(MEEGO_VERSION_MAJOR) {
+    message("Qt4 build")
+    message("Harmattan build")
+
     OTHER_FILES += qml/main_harmattan.qml \
         qml/cordova_wrapper.js
 
@@ -26,6 +60,9 @@ greaterThan(QT_MAJOR_VERSION, 4) {
     CONFIG += mobility qdeclarative-boostable
     MOBILITY += feedback location systeminfo sensors
 } else {
+    message("Qt4 build")
+    message("Non-harmattan build")
+
     OTHER_FILES += qml/main.qml \
         qml/cordova_wrapper.js
 
@@ -41,35 +78,6 @@ greaterThan(QT_MAJOR_VERSION, 4) {
 
 QT += webkit
 
-SOURCES += main.cpp \
-    src/plugins/notification.cpp \
-    src/plugins/geolocation.cpp \
-    src/plugins/fileapi.cpp \
-    src/plugins/device.cpp \
-    src/pluginregistry.cpp \
-    src/plugins/console.cpp \
-    src/plugins/connection.cpp \
-    src/plugins/compass.cpp \
-    src/plugins/accelerometer.cpp \
-    src/plugins/events.cpp \
-    src/cordova.cpp \
-    src/cplugin.cpp \
-    src/cwebpage.cpp
-HEADERS += \
-    src/plugins/notification.h \
-    src/plugins/geolocation.h \
-    src/plugins/fileapi.h \
-    src/plugins/device.h \
-    src/pluginregistry.h \
-    src/plugins/console.h \
-    src/plugins/connection.h \
-    src/plugins/compass.h \
-    src/plugins/accelerometer.h \
-    src/plugins/events.h \
-    src/cordova.h \
-    src/cplugin.h \
-    src/cwebpage.h
-
 # Please do not modify the following two lines. Required for deployment.
 include(deployment.pri)
 qtcAddDeployment()

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/0e9ba638/main.cpp
----------------------------------------------------------------------
diff --git a/main.cpp b/main.cpp
index a43eb66..e9d66bf 100644
--- a/main.cpp
+++ b/main.cpp
@@ -22,6 +22,7 @@
 #if QT_VERSION < 0x050000
 # include <QDeclarativeView>
 #else
+# include <QDeviceInfo>
 # include <QQuickView>
 #endif
 
@@ -67,12 +68,30 @@ int main(int argc, char *argv[])
 #  endif
 # endif
 #else // QT_VERSION >= 0x050000
-    QQuickView view;
-    Cordova::instance()->setTopLevelEventsReceiver(&view);
-    view.setResizeMode(QQuickView::SizeRootObjectToView);
-    view.rootContext()->setContextProperty("cordova", Cordova::instance());
-    view.setSource(QUrl(QString("%1/qml/main_qt5.qml").arg(Cordova::instance()->workingDir())));
-    view.show();
+
+    //HACK: we don't have any solution to check for harmattan in qt5
+    // so we use check for LINUX OS and for "dfl61" substring in kernel version
+    // (at least pr1.1 and pr1.2 contains it)
+    QDeviceInfo info;
+    bool isHarmattan = info.version(QDeviceInfo::Firmware).contains("dfl61");
+#ifndef Q_OS_LINUX
+    isHarmattan = false;
+#endif
+
+    //TODO: look later at boostable possibility for this here
+    QScopedPointer<QQuickView> view(new QQuickView());;
+
+    Cordova::instance()->setTopLevelEventsReceiver(view.data());
+    view->setResizeMode(QQuickView::SizeRootObjectToView);
+    view->rootContext()->setContextProperty("cordova", Cordova::instance());
+
+    if (isHarmattan) {
+        view->setSource(QUrl(QString("%1/qml/main_harmattan_qt5.qml").arg(Cordova::instance()->workingDir())));
+        view->showFullScreen();
+    } else {
+        view->setSource(QUrl(QString("%1/qml/main_qt5.qml").arg(Cordova::instance()->workingDir())));
+        view->show();
+    }
 #endif
 
     return app->exec();

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/0e9ba638/qml/main_harmattan.qml
----------------------------------------------------------------------
diff --git a/qml/main_harmattan.qml b/qml/main_harmattan.qml
index fe376af..6ee533f 100644
--- a/qml/main_harmattan.qml
+++ b/qml/main_harmattan.qml
@@ -1,5 +1,5 @@
 import QtQuick 1.1
-import com.nokia.meego 1.1
+import com.nokia.meego 1.0
 import QtWebKit 1.0
 import "cordova_wrapper.js" as CordovaWrapper
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/0e9ba638/qml/main_harmattan_qt5.qml
----------------------------------------------------------------------
diff --git a/qml/main_harmattan_qt5.qml b/qml/main_harmattan_qt5.qml
new file mode 100644
index 0000000..d0c6316
--- /dev/null
+++ b/qml/main_harmattan_qt5.qml
@@ -0,0 +1,64 @@
+import QtQuick 2.0
+import com.nokia.meego 2.0
+import QtWebKit 3.0
+import QtWebKit.experimental 1.0
+import "cordova_wrapper.js" as CordovaWrapper
+
+
+PageStackWindow {
+    id: appWindow
+    initialPage: mainPage
+    showToolBar: false
+
+    Page {
+        id: mainPage
+        Flickable {
+            id: webFlickable
+
+            anchors.fill: parent
+
+            contentHeight: webView.height
+            contentWidth: webView.width
+
+            boundsBehavior: "StopAtBounds"
+            clip: true
+
+
+            WebView {
+                id: webView
+                width: appWindow.width
+                height: appWindow.height
+
+
+                experimental.preferences.navigatorQtObjectEnabled: true
+                experimental.onMessageReceived: {
+                    console.log("WebView received Message: " + message.data)
+                    CordovaWrapper.messageHandler(message)
+                }
+                //Uncomment when it will be available
+                //experimental.setFlickableViewportEnabled: false
+
+
+                Component.onCompleted: {
+                    webView.load(cordova.mainUrl)
+                }
+
+                onLoadSucceeded: cordova.loadFinished(true)
+                onLoadFailed: cordova.loadFinished(false)
+
+                Connections {
+                    target: cordova
+                    onJavaScriptExecNeeded: {
+                        webView.experimental.postMessage(JSON.stringify({messageType: "evalJS",
jsData: js}))
+                    }
+
+                    onPluginWantsToBeAdded: {
+                        CordovaWrapper.addPlugin(pluginName, pluginObject)
+                    }
+                }
+            }
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/0e9ba638/src/cordova.cpp
----------------------------------------------------------------------
diff --git a/src/cordova.cpp b/src/cordova.cpp
index 040a44f..269c0cb 100644
--- a/src/cordova.cpp
+++ b/src/cordova.cpp
@@ -16,13 +16,13 @@
 
 #include "cordova.h"
 #include "pluginregistry.h"
-#include "cwebpage.h"
 
 #include <qplatformdefs.h>
 
 #include <QDebug>
 #include <QXmlStreamReader>
 #include <QApplication>
+#include <QUrl>
 
 Cordova *Cordova::m_instance = 0;
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/0e9ba638/src/cplugin.h
----------------------------------------------------------------------
diff --git a/src/cplugin.h b/src/cplugin.h
index 101142b..0b63920 100644
--- a/src/cplugin.h
+++ b/src/cplugin.h
@@ -18,7 +18,6 @@
 #define CPLUGIN_H
 
 #include <QObject>
-#include <QWebFrame>
 
 class CPlugin : public QObject
 {

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/0e9ba638/src/cwebpage.cpp
----------------------------------------------------------------------
diff --git a/src/cwebpage.cpp b/src/cwebpage.cpp
deleted file mode 100644
index 9114460..0000000
--- a/src/cwebpage.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  Copyright 2011 Wolfgang Koller - http://www.gofg.at/
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-#include "cwebpage.h"
-
-#include <QDebug>
-
-CWebPage::CWebPage(QObject *parent) :
-    QWebPage(parent)
-{
-}
-
-void CWebPage::javaScriptConsoleMessage( const QString & message, int lineNumber, const
QString & sourceID ) {
-    qDebug() << sourceID << lineNumber << message;
-}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/0e9ba638/src/cwebpage.h
----------------------------------------------------------------------
diff --git a/src/cwebpage.h b/src/cwebpage.h
deleted file mode 100644
index 3be0e3e..0000000
--- a/src/cwebpage.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Copyright 2011 Wolfgang Koller - http://www.gofg.at/
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-#ifndef CWEBPAGE_H
-#define CWEBPAGE_H
-
-#include <QWebPage>
-
-class CWebPage : public QWebPage
-{
-    Q_OBJECT
-public:
-    explicit CWebPage(QObject *parent = 0);
-
-protected:
-    void javaScriptConsoleMessage( const QString & message, int lineNumber, const QString
& sourceID );
-
-signals:
-
-public slots:
-
-};
-
-#endif // CWEBPAGE_H

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/0e9ba638/src/plugins/device.cpp
----------------------------------------------------------------------
diff --git a/src/plugins/device.cpp b/src/plugins/device.cpp
index 9ceea93..3dab5d8 100644
--- a/src/plugins/device.cpp
+++ b/src/plugins/device.cpp
@@ -74,6 +74,7 @@ void Device::getInfo( int scId, int ecId ) {
 #if QT_VERSION < 0x050000
     this->callback( scId, "'" + systemDeviceInfo->model() + "', '" + CORDOVA + "',
'" + platform + "', '" + systemDeviceInfo->uniqueDeviceID() + "', '" + systemInfo->version(
QSystemInfo::Os ) + "'" );
 #else
+    qDebug() << Q_FUNC_INFO << ":" << systemInfo->imei(0) << ";
" << systemInfo->manufacturer() << "; " << systemInfo->model() <<
"; " << systemInfo->productName() << "; " << systemInfo->uniqueDeviceID()
<< "; " << systemInfo->version(QDeviceInfo::Os) << "; " << systemInfo->version(QDeviceInfo::Firmware);
     this->callback( scId, "'" + systemDeviceInfo->model() + "', '" + CORDOVA + "',
'" + platform + "', '" + systemDeviceInfo->uniqueDeviceID() + "', '" + systemInfo->version(
QDeviceInfo::Os ) + "'" );
 #endif
 }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/0e9ba638/src/plugins/fileapi.h
----------------------------------------------------------------------
diff --git a/src/plugins/fileapi.h b/src/plugins/fileapi.h
index 5a00b68..60e02f4 100644
--- a/src/plugins/fileapi.h
+++ b/src/plugins/fileapi.h
@@ -20,6 +20,7 @@
 #include "../cplugin.h"
 
 #include <QDir>
+#include <QVariantMap>
 
 class FileAPI : public CPlugin
 {

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/0e9ba638/src/plugins/geolocation.h
----------------------------------------------------------------------
diff --git a/src/plugins/geolocation.h b/src/plugins/geolocation.h
index d7772f9..a85ca66 100644
--- a/src/plugins/geolocation.h
+++ b/src/plugins/geolocation.h
@@ -22,6 +22,7 @@
 #include <QGeoPositionInfoSource>
 #include <QGeoPositionInfo>
 #include <QList>
+#include <QVariantMap>
 
 #ifdef QTM_NAMESPACE
 QTM_USE_NAMESPACE

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/0e9ba638/www/js/connection.js
----------------------------------------------------------------------
diff --git a/www/js/connection.js b/www/js/connection.js
index 0f6ca7e..9e39767 100644
--- a/www/js/connection.js
+++ b/www/js/connection.js
@@ -17,7 +17,7 @@
 function Connection() {
 }
 
-Connection.prototype.type = 0;
+Connection.prototype.type = 1;
 Connection.UNKNOWN = 1;
 Connection.ETHERNET = 2;
 Connection.WIFI = 3;


Mime
View raw message