summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-09-17 15:02:23 +0200
committerAlex Blasche <alexander.blasche@digia.com>2014-09-18 08:14:11 +0200
commit86c62fa1f17630d78d249bec2471f81c38bbd8df (patch)
tree0d68415a4a6f587442bc135163b5b3e98fcc38c0 /examples
parent88ba6ede3986c119d9e95804539bbe6dfbc5bf64 (diff)
Fix a couple of issues in the maze example
1.) Remove dependency on QtSystemInfo. The module is not officially supported at this stage and screen saver related code is not really required for the example. 2.) Add AndroidManifest.xml to lock the screen orientation in portrait mode. Since the example depends on the tilt sensor a rotating UI is messing the game up. 3.) Port app to current TiltSensor API. The game works but its biggest problem remains the UI. It uses fixed-size UI elements which makes it tiny on High DPI screens. Task-number: QTBUG-31076 Change-Id: I73df9361b5171da930df66072e8ee9eba89b71ad Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/sensors/maze/android/AndroidManifest.xml56
-rw-r--r--examples/sensors/maze/maze.pro7
-rw-r--r--examples/sensors/maze/maze.qml8
-rw-r--r--examples/sensors/sensors.pro4
4 files changed, 65 insertions, 10 deletions
diff --git a/examples/sensors/maze/android/AndroidManifest.xml b/examples/sensors/maze/android/AndroidManifest.xml
new file mode 100644
index 00000000..de787fad
--- /dev/null
+++ b/examples/sensors/maze/android/AndroidManifest.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0"?>
+<manifest package="org.qtproject.example" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
+ <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --">
+ <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="portrait" android:launchMode="singleTop">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
+ <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
+ <meta-data android:name="android.app.repository" android:value="default"/>
+ <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
+ <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
+ <!-- Deploy Qt libs as part of package -->
+ <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
+ <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
+ <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
+ <!-- Run with local libs -->
+ <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
+ <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
+ <meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
+ <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
+ <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
+ <!-- Messages maps -->
+ <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
+ <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
+ <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
+ <!-- Messages maps -->
+
+ <!-- Splash screen -->
+ <!--
+ <meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/>
+ -->
+ <!-- Splash screen -->
+
+ <!-- Background running -->
+ <!-- Warning: changing this value to true may cause unexpected crashes if the
+ application still try to draw after
+ "applicationStateChanged(Qt::ApplicationSuspended)"
+ signal is sent! -->
+ <meta-data android:name="android.app.background_running" android:value="false"/>
+ <!-- Background running -->
+ </activity>
+ </application>
+ <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="14"/>
+ <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
+
+ <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
+ Remove the comment if you do not require these default permissions. -->
+ <!-- %%INSERT_PERMISSIONS -->
+
+ <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
+ Remove the comment if you do not require these default features. -->
+ <!-- %%INSERT_FEATURES -->
+
+</manifest>
diff --git a/examples/sensors/maze/maze.pro b/examples/sensors/maze/maze.pro
index e4c4d866..f15fa570 100644
--- a/examples/sensors/maze/maze.pro
+++ b/examples/sensors/maze/maze.pro
@@ -1,16 +1,19 @@
TEMPLATE = app
TARGET = maze
-QT += quick
+QT += quick sensors
SOURCES = main.cpp
OTHER_FILES = \
components \
$$files(*.qml) \
$$files(*.js) \
- content
+ content \
+ android/AndroidManifest.xml
target.path = $$[QT_INSTALL_EXAMPLES]/sensors/maze
INSTALLS += target
RESOURCES += \
maze.qrc
+
+ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
diff --git a/examples/sensors/maze/maze.qml b/examples/sensors/maze/maze.qml
index eeaea28f..19174a4f 100644
--- a/examples/sensors/maze/maze.qml
+++ b/examples/sensors/maze/maze.qml
@@ -75,7 +75,6 @@ import "components"
//! [0]
import QtSensors 5.0
//! [0]
-import QtSystemInfo 5.0
//Import the javascript functions for this game
import "lib.js" as Lib
@@ -86,7 +85,6 @@ ApplicationWindow {
property Mouse mouseCtrl;
property LabyrinthSquare cheeseSquare;
property Congratulation congratulation;
- ScreenSaver { screenSaverEnabled: !tiltTimer.running }
Rectangle {
id: gameRect
@@ -171,9 +169,9 @@ ApplicationWindow {
}
//! [1]
- TiltSensor{
+ TiltSensor {
id: tiltSensor
- enabled: true
+ active: true
}
//! [1]
@@ -185,7 +183,7 @@ ApplicationWindow {
//! [2]
onTriggered: {
if (!tiltSensor.enabled)
- tiltSensor.enabled = true;
+ tiltSensor.active = true;
//! [2]
if (mouseCtrl === null)
diff --git a/examples/sensors/sensors.pro b/examples/sensors/sensors.pro
index 6b994b85..20537a8c 100644
--- a/examples/sensors/sensors.pro
+++ b/examples/sensors/sensors.pro
@@ -4,6 +4,7 @@ SUBDIRS += grue
qtHaveModule(quick) {
SUBDIRS += \
+ maze \
qmlsensorgestures \
qmlqtsensors \
sensor_explorer \
@@ -19,7 +20,4 @@ qtHaveModule(widgets): SUBDIRS += \
qtHaveModule(3d): SUBDIRS += \
cubehouse
-qtHaveModule(systeminfo): SUBDIRS += \
- maze
-
OTHER_FILES = stub.h