incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From long...@apache.org
Subject qt commit: rename reference js according to mobile-spec repo
Date Fri, 27 Apr 2012 17:46:15 GMT
Updated Branches:
  refs/heads/master b6c00928f -> 40790e6e7


rename reference js according to mobile-spec repo


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/40790e6e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/tree/40790e6e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/diff/40790e6e

Branch: refs/heads/master
Commit: 40790e6e7bd5ba4bb7884b22f220d7272810b00b
Parents: b6c0092
Author: Longwei Su <lsu@ics.com>
Authored: Fri Apr 27 13:45:28 2012 -0400
Committer: Longwei Su <lsu@ics.com>
Committed: Fri Apr 27 13:45:28 2012 -0400

----------------------------------------------------------------------
 cordovaqt.pro         |    8 +-
 www/cordova-1.7.0.js  |   15 +++++
 www/index.html        |  133 ++++++++++++++++++++++++++++---------------
 www/phonegap-1.3.0.js |   15 -----
 4 files changed, 105 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/40790e6e/cordovaqt.pro
----------------------------------------------------------------------
diff --git a/cordovaqt.pro b/cordovaqt.pro
index d4eb061..b1985f2 100644
--- a/cordovaqt.pro
+++ b/cordovaqt.pro
@@ -23,8 +23,8 @@ SOURCES += main.cpp \
     src/cordova.cpp \
     src/cplugin.cpp \
     src/plugins/contacts.cpp \
-    src/plugins/camera.cpp \
-    src/plugins/media.cpp
+    src/plugins/camera.cpp 
+    #src/plugins/media.cpp
     
 HEADERS += \
     src/plugins/notification.h \
@@ -41,8 +41,8 @@ HEADERS += \
     src/cplugin.h \
     src/plugins/contacts.h \
     src/plugins/camera.h \
-    src/plugins/cameraresolution.h \
-    src/plugins/media.h
+    src/plugins/cameraresolution.h
+    #src/plugins/media.h
 
 greaterThan(QT_MAJOR_VERSION, 4) {
     message("Qt5 build")

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/40790e6e/www/cordova-1.7.0.js
----------------------------------------------------------------------
diff --git a/www/cordova-1.7.0.js b/www/cordova-1.7.0.js
new file mode 100644
index 0000000..1b53740
--- /dev/null
+++ b/www/cordova-1.7.0.js
@@ -0,0 +1,15 @@
+document.write('<script language="javascript" type="text/javascript" src="js/cordova.js"></script>');
+document.write('<script language="javascript" type="text/javascript" src="js/cordova.qt.js"></script>');
+document.write('<script language="javascript" type="text/javascript" src="js/connection.js"></script>');
+document.write('<script language="javascript" type="text/javascript" src="js/console.js"></script>');
+document.write('<script language="javascript" type="text/javascript" src="js/device.js"></script>');
+document.write('<script language="javascript" type="text/javascript" src="js/file.js"></script>');
+document.write('<script language="javascript" type="text/javascript" src="js/geolocation.js"></script>');
+document.write('<script language="javascript" type="text/javascript" src="js/notification.js"></script>');
+document.write('<script language="javascript" type="text/javascript" src="js/compass.js"></script>');
+document.write('<script language="javascript" type="text/javascript" src="js/accelerometer.js"></script>');
+document.write('<script language="javascript" type="text/javascript" src="js/camera.js"></script>');
+document.write('<script language="javascript" type="text/javascript" src="js/contacts.js"></script>');
+document.write('<script language="javascript" type="text/javascript" src="js/media.js"></script>');
+
+

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/40790e6e/www/index.html
----------------------------------------------------------------------
diff --git a/www/index.html b/www/index.html
index 3fb8e67..8886d89 100755
--- a/www/index.html
+++ b/www/index.html
@@ -5,41 +5,92 @@
     <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1
-->
     <title>Cordova Mobile Spec</title>
     <link rel="stylesheet" href="master.css" type="text/css" media="screen" title="no
title" charset="utf-8">
-    <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
-    <script src="http://192.168.1.2:8080/target/target-script-min.js#anonymous"></script>
+    <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
     
 
       
 <script type="text/javascript" charset="utf-8">
 
     var deviceReady = false;
 
-    function interceptBackbutton() {
-    	eventOutput("Back button intercepted");
+    function roundNumber(num) {
+        var dec = 3;
+        var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
+        return result;
     }
-    function interceptMenubutton() {
-    	eventOutput("Menu button intercepted");
-    }
-    function interceptSearchbutton() {
-    	eventOutput("Search button intercepted");
-    }
-    function interceptResume() {
-      eventOutput("Resume event intercepted");
-    }
-    function interceptPause() {
-      eventOutput("Pause event intercepted");
-    }
-    function interceptOnline() {
-      eventOutput("Online event intercepted");
-    }
-    function interceptOffline() {
-      eventOutput("Offline event intercepted");
-    }
-    
-    var eventOutput = function(s) {
-        var el = document.getElementById("results");
-        el.innerHTML = el.innerHTML + s + "<br>";
+
+    //-------------------------------------------------------------------------
+    // Compass
+    //-------------------------------------------------------------------------
+    var watchCompassId = null;
+
+    /**
+     * Start watching compass
+     */
+    var watchCompass = function() {
+        console.log("watchCompass()");
+
+        // Success callback
+        var success = function(a){
+            document.getElementById('compassHeading').innerHTML = roundNumber(a.magneticHeading);
+        };
+
+        // Fail callback
+        var fail = function(e){
+            console.log("watchCompass fail callback with error code "+e);
+            stopCompass();
+            setCompassStatus(e);
+        };
+
+        // Update heading every 1 sec
+        var opt = {};
+        opt.frequency = 1000;
+        watchCompassId = navigator.compass.watchHeading(success, fail, opt);
+
+        setCompassStatus("Running");
+    };
+
+    /**
+     * Stop watching the acceleration
+     */
+    var stopCompass = function() {
+        setCompassStatus("Stopped");
+        if (watchCompassId) {
+            navigator.compass.clearWatch(watchCompassId);
+            watchCompassId = null;
+        }
+    };
+
+    /**
+     * Get current compass
+     */
+    var getCompass = function() {
+        console.log("getCompass()");
+
+        // Stop compass if running
+        stopCompass();
+
+        // Success callback
+        var success = function(a){
+            document.getElementById('compassHeading').innerHTML = roundNumber(a.magneticHeading);
+        };
+
+        // Fail callback
+        var fail = function(e){
+            console.log("getCompass fail callback with error code "+e);
+            setCompassStatus(e);
+        };
+
+        // Make call
+        var opt = {};
+        navigator.compass.getCurrentHeading(success, fail, opt);
     };
 
+    /**
+     * Set compass status
+     */
+    var setCompassStatus = function(status) {
+        document.getElementById('compass_status').innerHTML = status;
+    };
     
     /**
      * Function called when page has finished loading.
@@ -48,7 +99,6 @@
         document.addEventListener("deviceready", function() {
                 deviceReady = true;
                 console.log("Device="+device.platform+" "+device.version);
-                eventOutput("deviceready event: "+device.platform+" "+device.version);
             }, false);
         window.setTimeout(function() {
         	if (!deviceReady) {
@@ -62,28 +112,17 @@
   </head>
   <body onload="init();" id="stage" class="theme">
   
-    <h1>Events</h1>
+    <h1>Compass</h1>
     <div id="info">
-        <b>Results:</b><br>
-        <span id="results"></span>
+        <b>Status:</b> <span id="compass_status">Stopped</span>
+        <table width="100%"><tr>
+            <td width="33%">Heading: <span id="compassHeading"> </span></td>
+        </tr></table>
     </div>
-
     <h2>Action</h2>
-    <div class="btn large" onclick="document.addEventListener('backbutton', interceptBackbutton,
false);">Intercept backbutton</div>
-    <div class="btn large" onclick="document.removeEventListener('backbutton', interceptBackbutton,
false);">Stop intercept of backbutton</div>
-    <div class="btn large" onclick="document.addEventListener('menubutton', interceptMenubutton,
false);">Intercept menubutton</div>
-    <div class="btn large" onclick="document.removeEventListener('menubutton', interceptMenubutton,
false);">Stop intercept of menubutton</div>
-    <div class="btn large" onclick="document.addEventListener('searchbutton', interceptSearchbutton,
false);">Intercept searchbutton</div>
-    <div class="btn large" onclick="document.removeEventListener('searchbutton', interceptSearchbutton,
false);">Stop intercept of searchbutton</div>
-    <div class="btn large" onclick="document.addEventListener('resume', interceptResume,
false);">Intercept resume</div>
-    <div class="btn large" onclick="document.removeEventListener('resume', interceptResume,
false);">Stop intercept of resume</div>
-    <div class="btn large" onclick="document.addEventListener('pause', interceptPause,
false);">Intercept pause</div>
-    <div class="btn large" onclick="document.removeEventListener('pause', interceptPause,
false);">Stop intercept of pause</div>
-    <div class="btn large" onclick="document.addEventListener('online', interceptOnline,
false);">Intercept online</div>
-    <div class="btn large" onclick="document.removeEventListener('online', interceptOnline,
false);">Stop intercept of online</div>
-    <div class="btn large" onclick="document.addEventListener('offline', interceptOffline,
false);">Intercept offline</div>
-    <div class="btn large" onclick="document.removeEventListener('offline', interceptOffline,
false);">Stop intercept of offline</div>
-
+    <div class="btn large" onclick="getCompass();">Get Compass</div>
+    <div class="btn large" onclick="watchCompass();">Start Watching Compass</div>
+    <div class="btn large" onclick="stopCompass();">Stop Watching Compass</div>
     <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
   </body>
-</html>
+</html>      

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/40790e6e/www/phonegap-1.3.0.js
----------------------------------------------------------------------
diff --git a/www/phonegap-1.3.0.js b/www/phonegap-1.3.0.js
deleted file mode 100644
index 1b53740..0000000
--- a/www/phonegap-1.3.0.js
+++ /dev/null
@@ -1,15 +0,0 @@
-document.write('<script language="javascript" type="text/javascript" src="js/cordova.js"></script>');
-document.write('<script language="javascript" type="text/javascript" src="js/cordova.qt.js"></script>');
-document.write('<script language="javascript" type="text/javascript" src="js/connection.js"></script>');
-document.write('<script language="javascript" type="text/javascript" src="js/console.js"></script>');
-document.write('<script language="javascript" type="text/javascript" src="js/device.js"></script>');
-document.write('<script language="javascript" type="text/javascript" src="js/file.js"></script>');
-document.write('<script language="javascript" type="text/javascript" src="js/geolocation.js"></script>');
-document.write('<script language="javascript" type="text/javascript" src="js/notification.js"></script>');
-document.write('<script language="javascript" type="text/javascript" src="js/compass.js"></script>');
-document.write('<script language="javascript" type="text/javascript" src="js/accelerometer.js"></script>');
-document.write('<script language="javascript" type="text/javascript" src="js/camera.js"></script>');
-document.write('<script language="javascript" type="text/javascript" src="js/contacts.js"></script>');
-document.write('<script language="javascript" type="text/javascript" src="js/media.js"></script>');
-
-


Mime
View raw message