Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: shaque/Cascades-Samples
base: e594e72102
...
head fork: shaque/Cascades-Samples
compare: 8c0aefe9d8
  • 10 commits
  • 64 files changed
  • 0 commit comments
  • 5 contributors
Commits on Sep 25, 2012
John A Hodgson johodgson small fix to pushCollector project 390f62d
Commits on Oct 05, 2012
ekke ekke using this .gitignore it's easier to clone and pull for changes
Signed-off-by: ekkes-corner <ekke@ekkes-corner.org>
02c6678
ekke ekke changes for Beta 3
is now running without compile errors under Beta 3.
removed FileBrowser and FileSaver, because this is now part of Filepicker sample

Signed-off-by: ekkes-corner <ekke@ekkes-corner.org>
56f50a2
Commits on Oct 06, 2012
ekke ekke added support for Landscape
UI Controls are re-layouted
now the Dictaphone can be used in Portrait and Landscape

Signed-off-by: ekkes-corner <ekke@ekkes-corner.org>
fb821d4
Commits on Oct 12, 2012
Adam Sosnowski CodeHoarder initial submit of sensor demo sample b16368e
Eduardo Pelegri-Llopart pelegri Merge pull request #18 from blackberry-core/master
Sensors from BBJam
e69d8c3
ekke ekke Merge branch 'master' of git://github.com/blackberry/Cascades-Samples 542d78e
Eduardo Pelegri-Llopart pelegri Merge pull request #21 from ekke/master
gitignore and DialogSample (Beta 3)
b12f8c7
Commits on Oct 30, 2012
Shadid Haque Added mapping capabilities. Several minor bug fixes.. 622314b
Shadid Haque Translation files 8c0aefe
Showing with 5,139 additions and 1,178 deletions.
  1. +26 −0 .gitignore
  2. +6 −0 DialogSample/.project
  3. +2 −3 DialogSample/README.md
  4. +6 −63 DialogSample/assets/main.qml
  5. +2 −3 DialogSample/readme.txt
  6. +0 −158 DialogSample/src/FileBrowseDialog.cpp
  7. +0 −102 DialogSample/src/FileBrowseDialog.hpp
  8. +0 −126 DialogSample/src/FileSaveDialog.cpp
  9. +0 −57 DialogSample/src/FileSaveDialog.hpp
  10. +0 −44 DialogSample/src/app.cpp
  11. +0 −30 DialogSample/src/app.hpp
  12. +35 −7 DialogSample/src/main.cpp
  13. BIN  SensorDemo/.DS_Store
  14. +210 −0 SensorDemo/.cproject
  15. +91 −0 SensorDemo/.project
  16. +25 −0 SensorDemo/.settings/org.eclipse.cdt.core.prefs
  17. +35 −0 SensorDemo/Makefile
  18. +55 −0 SensorDemo/SensorDemo.pro
  19. 0  SensorDemo/arm/.gitignore
  20. +106 −0 SensorDemo/assets/collisiondetector.qml
  21. +154 −0 SensorDemo/assets/compass.qml
  22. +177 −0 SensorDemo/assets/flashlight.qml
  23. BIN  SensorDemo/assets/images/MID-Dial-reverse.png
  24. BIN  SensorDemo/assets/images/MID-Dial.png
  25. BIN  SensorDemo/assets/images/alarm.png
  26. BIN  SensorDemo/assets/images/compass.png
  27. BIN  SensorDemo/assets/images/crash.png
  28. BIN  SensorDemo/assets/images/device.png
  29. BIN  SensorDemo/assets/images/flashlight.png
  30. BIN  SensorDemo/assets/images/magnet.png
  31. BIN  SensorDemo/assets/images/rotation3d.png
  32. +110 −0 SensorDemo/assets/main.qml
  33. +114 −0 SensorDemo/assets/metalfinder.qml
  34. +120 −0 SensorDemo/assets/motionalarm.qml
  35. +105 −0 SensorDemo/assets/rotation3D.qml
  36. +109 −0 SensorDemo/bar-descriptor.xml
  37. +4 −0 SensorDemo/device-assets.xml
  38. +57 −0 SensorDemo/src/Flashlight.cpp
  39. +48 −0 SensorDemo/src/Flashlight.hpp
  40. +52 −0 SensorDemo/src/main.cpp
  41. +12 −0 SensorDemo/translations/Makefile
  42. +1 −0  SensorDemo/translations/SensorDemo.pro
  43. 0  SensorDemo/x86/.gitignore
  44. BIN  dictaphone/assets/images/background_landscape.png
  45. +93 −54 dictaphone/assets/main.qml
  46. +1 −2  dictaphone/bar-descriptor.xml
  47. +2 −2 locationdiagnostics/assets/LabelLabel.qml
  48. +88 −137 locationdiagnostics/assets/LocationPage.qml
  49. BIN  locationdiagnostics/assets/images/background.png
  50. +66 −102 locationdiagnostics/assets/main.qml
  51. +10 −3 locationdiagnostics/bar-descriptor.xml
  52. BIN  locationdiagnostics/icon.png
  53. +2 −2 locationdiagnostics/locationdiagnostics.pro
  54. +4 −2 locationdiagnostics/src/LocationDiagnostics.cpp
  55. +8 −1 locationdiagnostics/src/LocationDiagnostics.hpp
  56. +241 −269 locationdiagnostics/src/LocationSession.cpp
  57. +27 −10 locationdiagnostics/src/LocationSession.hpp
  58. +489 −0 locationdiagnostics/translations/locationdiagnostics.ts
  59. +489 −0 locationdiagnostics/translations/locationdiagnostics_de.ts
  60. +489 −0 locationdiagnostics/translations/locationdiagnostics_en_GB.ts
  61. +489 −0 locationdiagnostics/translations/locationdiagnostics_es.ts
  62. +489 −0 locationdiagnostics/translations/locationdiagnostics_fr.ts
  63. +489 −0 locationdiagnostics/translations/locationdiagnostics_it.ts
  64. +1 −1  pushCollector/readme.txt
26 .gitignore
View
@@ -0,0 +1,26 @@
+# MAC OSX
+*.DS_Store
+
+# Compiled Object files
+*.slo
+*.lo
+*.o
+
+# Compiled Dynamic libraries
+*.so
+
+# Compiled Static libraries
+*.lai
+*.la
+*.a
+
+# Compiled Translations
+*/translations/*.qm
+
+/.settings/
+*/arm/
+*/x86/
+.metadata/*
+/.metadata/
+192.*
+169.254.0.1
6 DialogSample/.project
View
@@ -73,6 +73,11 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>com.rim.tad.tools.qml.core.qmlFileBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
@@ -80,5 +85,6 @@
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>com.qnx.tools.ide.bbt.core.bbtnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>com.rim.tad.tools.qml.core.qmlNature</nature>
</natures>
</projectDescription>
5 DialogSample/README.md
View
@@ -10,8 +10,7 @@ BPS from Cascades.
Alert Dialogs show a title, message and buttons
Prompt Dialogs show an input title and buttons
Login Dialogs show a customizable login dialog
- File Browse Dialog shows how to browse files on the file system
- File Save Dialogs show how to prompt to save a filename
+ File Browse Dialog and File Save Dialogs are now part of Filepicker
Context Menu dialog shows how to display a context menu with buttons and icons
When a dialog is invoked it creates a thread and builds the dialog using the parameters
@@ -22,7 +21,7 @@ BPS from Cascades.
## Requirements:
- - BlackBerry Native SDK for BlackBerry 10 or later
+ - BlackBerry Native SDK for BlackBerry 10.0.9 or later
- One of the following:
- BlackBerry Alpha Device
- BlackBerry Alpha Device Simulator
69 DialogSample/assets/main.qml
View
@@ -18,22 +18,20 @@ import Dialog.Alert 1.0
import Dialog.ContextMenu 1.0
import Dialog.Prompt 1.0
import Dialog.Login 1.0
-import Dialog.FileBrowse 1.0
-import Dialog.FileSave 1.0
Page {
content: Container {
background : Color.Black
layout : StackLayout {
- layoutDirection : LayoutDirection.TopToBottom
+ orientation : LayoutOrientation.TopToBottom
}
Label {
id: alertDialogLabel
}
Button {
- layoutProperties : StackLayoutProperties {
- horizontalAlignment : HorizontalAlignment.Center
+ layoutProperties : StackLayoutProperties {
}
+ horizontalAlignment : HorizontalAlignment.Center
text : "Simple Alert"
onClicked: {
alertDialog.addCustomButton("Cheese","AlertDialog_Cheese");
@@ -47,8 +45,8 @@ Page {
}
Button {
layoutProperties : StackLayoutProperties {
- horizontalAlignment : HorizontalAlignment.Center
}
+ horizontalAlignment : HorizontalAlignment.Center
text : "Context Menu"
onClicked: {
contextMenu.addCustomButton("Rotate","Menu_Rotate");
@@ -60,8 +58,8 @@ Page {
Label { id: promptDialogLabel }
Button {
layoutProperties : StackLayoutProperties {
- horizontalAlignment : HorizontalAlignment.Center
}
+ horizontalAlignment : HorizontalAlignment.Center
text : "Prompt Dialog"
onClicked: {
promptDialog.show();
@@ -71,37 +69,14 @@ Page {
Label { id: loginDialogLabel }
Button {
layoutProperties : StackLayoutProperties {
- horizontalAlignment : HorizontalAlignment.Center
}
+ horizontalAlignment : HorizontalAlignment.Center
text : "Login Dialog"
onClicked: {
loginDialog.addCustomButton("Something","Login_Something");
loginDialog.show();
}
}
- Divider {}
- Label { id: filebrowseDialogLabel }
- Button {
- layoutProperties : StackLayoutProperties {
- horizontalAlignment : HorizontalAlignment.Center
- }
- text : "File Browse Dialog"
- onClicked: {
- filebrowseDialog.show();
- }
- }
- Divider {}
- Label { id: filesaveDialogLabel }
- Button {
- layoutProperties : StackLayoutProperties {
- horizontalAlignment : HorizontalAlignment.Center
- }
- text : "File Save Dialog"
- onClicked: {
- filesaveDialog.addCustomButton("delete","FileSave_delete");
- filesaveDialog.show();
- }
- }
attachedObjects: [
AlertDialog {
id: alertDialog
@@ -175,38 +150,6 @@ Page {
onCustomButton: {
loginDialogLabel.text = "index: " + index + " label: " + label + " context: " + context;
}
- },
- FileBrowseDialog {
- id: filebrowseDialog
- multiselect : true
- filters : ["*.doc","*.jpg","*.txt"]
- onSelectionCompleted: {
- if(filebrowseDialog.filepaths.length>0)
- filebrowseDialogLabel.text = filebrowseDialog.filepaths[0];
- else
- filebrowseDialogLabel.text = "no file selected";
- }
- onSelectionCancelled: {
- filebrowseDialogLabel.text = "file browse dialog was cancelled";
- }
- },
- FileSaveDialog {
- //not what you would expect, no way to browse and
- //only shows an input box by default, incomplete?
- id: filesaveDialog
- filename : "resume.doc"
- cancelButton : true
- okButton : true
- titleText : "Save file as"
- onOk: {
- filesaveDialogLabel.text = filesaveDialog.filename
- }
- onCancel: {
- filesaveDialogLabel.text = "You clicked on CANCEL button";
- }
- onCustomButton: {
- filesaveDialogLabel.text = "index: " + index + " label: " + label + " context: " + context;
- }
}
]
}
5 DialogSample/readme.txt
View
@@ -10,8 +10,7 @@ BPS from Cascades.
Alert Dialogs show a title, message and buttons
Prompt Dialogs show an input title and buttons
Login Dialogs show a customizable login dialog
- File Browse Dialog shows how to browse files on the file system
- File Save Dialogs show how to prompt to save a filename
+ File Browse Dialog and File Save Dialogs are now part of Filepicker
Context Menu dialog shows how to display a context menu with buttons and icons
When a dialog is invoked it creates a thread and builds the dialog using the parameters
@@ -23,7 +22,7 @@ BPS from Cascades.
========================================================================
Requirements:
- - BlackBerry Native SDK for BlackBerry 10 or later
+ - BlackBerry Native SDK for BlackBerry 10.0.9 or later
- One of the following:
- BlackBerry Alpha Device
- BlackBerry Alpha Device Simulator
158 DialogSample/src/FileBrowseDialog.cpp
View
@@ -1,158 +0,0 @@
-/* Copyright (c) 2012 Research In Motion Limited.
- *
- * 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 "FileBrowseDialog.hpp"
-#include <bps/bps.h>
-#include <QDebug>
-
-FileBrowseDialog::FileBrowseDialog(QObject* parent)
- : QThread(parent)
- , m_multiSelect(false)
-{
- m_filters.push_back(QString("*.*"));
-}
-
-FileBrowseDialog::~FileBrowseDialog()
-{
-}
-
-void FileBrowseDialog::show()
-{
- if (!isRunning())
- {
- m_filePaths.clear();
- start();
- }
-}
-
-QVariant FileBrowseDialog::getFilePaths() const
-{
- return m_filePaths;
-}
-
-bool FileBrowseDialog::getMultiSelect() const
-{
- return m_multiSelect;
-}
-
-void FileBrowseDialog::setMultiSelect(bool value)
-{
- m_multiSelect = value;
-}
-
-QVariant FileBrowseDialog::getFilters() const
-{
- return m_filters;
-}
-
-void FileBrowseDialog::setFilters(QVariant const& value)
-{
- m_filters = value.toList();
- qDebug() << "filter count: " << m_filters.count();
-}
-
-void FileBrowseDialog::run()
-{
- bps_initialize();
-
- //request all dialog events
- dialog_request_events(0);
- if (dialog_create_filebrowse(&m_dialog) != BPS_SUCCESS)
- {
- qDebug() << "Failed to create file browse dialog.";
- emit selectionCancelled();
- return;
- }
-
- //set the selection filters
- if (m_filters.count() > 0)
- {
- char** ext = (char**)new char[m_filters.count()*sizeof(char*)];
- int i = 0;
- for (QVariantList::iterator it = m_filters.begin(); it != m_filters.end(); ++it, ++i)
- {
- QString filter = it->toString();
- if (!filter.trimmed().isEmpty())
- {
- int length = (filter.length() + 1) * sizeof(char);
- ext[i] = new char[length];
- strncpy(ext[i], filter.toAscii(), length);
- }
- }
- if (dialog_set_filebrowse_filter(m_dialog, (const char**)ext, m_filters.count()) != BPS_SUCCESS)
- {
- qDebug() << "unable to set file browse dialog extensions";
- }
- for (i = 0; i < m_filters.count(); i++)
- {
- delete ext[i];
- }
- delete ext;
- }
-
- if (dialog_show(m_dialog) != BPS_SUCCESS)
- {
- qDebug() << "Failed to show file browse dialog.";
- dialog_destroy(m_dialog);
- m_dialog = 0;
- emit selectionCancelled();
- return;
- }
-
- bool shutdown = false;
- while (!shutdown)
- {
- bps_event_t* event = NULL;
- bps_get_event(&event, -1); // -1 means that the function waits
- // for an event before returning
-
- if (event)
- {
- if (bps_event_get_domain(event) == dialog_get_domain())
- {
- //0=ok, 1=cancel
- int selectedIndex = dialog_event_get_selected_index(event);
-
- if (selectedIndex == 1)
- {
- int count;
- char** filepaths;
- if (BPS_SUCCESS == dialog_event_get_filebrowse_filepaths(event, &filepaths, &count))
- {
- for (int i = 0; i < count; i++)
- {
- qDebug() << "selected file: " << filepaths[i];
- m_filePaths.push_back(QString(filepaths[i]));
- }
- bps_free(filepaths);
- }
- emit selectionCompleted();
- }
- else
- {
- emit selectionCancelled();
- }
-
- qDebug() << "Got file browse dialog click";
- shutdown = true;
- }
- }
- }
-
- if (m_dialog)
- {
- dialog_destroy(m_dialog);
- }
-}
102 DialogSample/src/FileBrowseDialog.hpp
View
@@ -1,102 +0,0 @@
-/* Copyright (c) 2012 Research In Motion Limited.
- *
- * 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 FILEBROWSEDIALOG_HPP_
-#define FILEBROWSEDIALOG_HPP_
-
-#include <QThread>
-#include <QVariant>
-#include <bps/dialog.h>
-
-/*
- * The file browse dialog displays a dialog to browse and select
- * files from shared folders on the system.
- */
-class FileBrowseDialog : public QThread
-{
- Q_OBJECT
-
- /*
- * QML property to allow multiple selection
- */
- Q_PROPERTY(bool multiselect READ getMultiSelect WRITE setMultiSelect)
-
- /*
- * QML property to read the selected filenames
- */
- Q_PROPERTY(QVariant filepaths READ getFilePaths)
-
- /*
- * QML property to set or get the file filters. This is an
- * list array variant.
- */
- Q_PROPERTY(QVariant filters READ getFilters WRITE setFilters)
-public:
- /*
- * Ctor and Dtor
- */
- FileBrowseDialog(QObject* parent = 0);
- virtual ~FileBrowseDialog();
-
- /*
- * Exposed to QML to start the run loop which creates and displays the dialog.
- * The dialog is shown until a button is clicked.
- */
- Q_INVOKABLE void show();
-
-public:
- /*
- * Getter for the selected filenames QML property
- */
- QVariant getFilePaths() const;
-
- /*
- * Setter and Getter for the filters QML property
- */
- QVariant getFilters() const;
- void setFilters(QVariant const& value);
-
- /*
- * Getter and Setter for the multiselect QML property
- */
- bool getMultiSelect() const;
- void setMultiSelect(bool value);
-
-signals:
- /*
- * Signal emitted when the OK button has been clicked on the browse dialog
- * The OK button is not enabled unless a file is selected
- */
- void selectionCompleted();
-
- /*
- * Signal emitted when the cancel button has been clicked on the browse dialog
- */
- void selectionCancelled();
-
-protected:
- /*
- * Implements the run loop. Dialog stays open until a button is clicked.
- */
- virtual void run();
-
-protected:
- dialog_instance_t m_dialog;
- bool m_multiSelect;
- QVariantList m_filePaths;
- QVariantList m_filters;
-};
-
-#endif /* FILEBROWSEDIALOG_HPP_ */
126 DialogSample/src/FileSaveDialog.cpp
View
@@ -1,126 +0,0 @@
-/* Copyright (c) 2012 Research In Motion Limited.
- *
- * 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 "FileSaveDialog.hpp"
-#include <bps/bps.h>
-#include <QDebug>
-
-FileSaveDialog::FileSaveDialog(QObject* parent)
- : Dialog(parent)
- , m_filename("")
-{
-}
-
-FileSaveDialog::~FileSaveDialog()
-{
-}
-
-QString FileSaveDialog::getFilename() const
-{
- return m_filename;
-}
-
-void FileSaveDialog::setFilename(QString const& value)
-{
- m_filename = value;
-}
-
-void FileSaveDialog::run()
-{
- bps_initialize();
-
- //request all dialog events
- dialog_request_events(0);
- if (dialog_create_filesave(&m_dialog) != BPS_SUCCESS)
- {
- qDebug() << "Failed to create file save dialog.";
- emit cancel();
- return;
- }
-
- if (!m_filename.trimmed().isEmpty() && dialog_set_filesave_filename(m_dialog, m_filename.toAscii()) != BPS_SUCCESS)
- {
- qDebug() << "Failed to set the file save dialog filename";
- dialog_destroy(m_dialog);
- m_dialog = 0;
- return;
- }
-
- if (!setTitle())
- {
- destroyDialog();
- emit cancel();
- return;
- }
-
- if (!addButtons())
- {
- destroyDialog();
- emit cancel();
- return;
- }
-
- if (!showDialog())
- {
- qDebug() << "Failed to show file save dialog.";
- destroyDialog();
- emit cancel();
- return;
- }
-
- bool shutdown = false;
- while (!shutdown)
- {
- bps_event_t* event = NULL;
- bps_get_event(&event, -1); // -1 means that the function waits
- // for an event before returning
-
- if (event)
- {
- if (bps_event_get_domain(event) == dialog_get_domain())
- {
- int selectedIndex = dialog_event_get_selected_index(event);
- const char* label = dialog_event_get_selected_label(event);
- const char* context = dialog_event_get_selected_context(event);
-
- const char* filename = dialog_event_get_filesave_filepath(event);
- if (filename != NULL)
- {
- m_filename = filename;
- }
-
- if (label != NULL && context != NULL)
- {
- if (QString::compare(context, getCancelButtonContext()) == 0)
- {
- emit cancel();
- }
- else if (QString::compare(context, getOkButtonContext()) == 0)
- {
- emit ok();
- }
- else
- {
- emit customButton(selectedIndex, label, context);
- }
- }
-
- qDebug() << "Got file save dialog click";
- shutdown = true;
- }
- }
- }
- destroyDialog();
-}
57 DialogSample/src/FileSaveDialog.hpp
View
@@ -1,57 +0,0 @@
-/* Copyright (c) 2012 Research In Motion Limited.
- *
- * 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 FILESAVEDIALOG_HPP_
-#define FILESAVEDIALOG_HPP_
-
-#include "Dialog.hpp"
-
-/*
- * The FileSave dialog displays an input box with the name of the file to save
- * This dialog has no title, and does not have a file selection option.
- */
-class FileSaveDialog : public Dialog
-{
- Q_OBJECT
-
- /*
- * QML exposed property for setting and retrieving the filename
- */
- Q_PROPERTY(QString filename READ getFilename WRITE setFilename)
-public:
- /*
- * Ctor & Dtor
- */
- FileSaveDialog(QObject* parent = 0);
- virtual ~FileSaveDialog();
-
-public:
- /*
- * Setter and Getter for the filename QML property
- */
- QString getFilename() const;
- void setFilename(QString const& value);
-
-protected:
- /*
- * Implements the run loop. Dialog stays open until a button is clicked
- */
- virtual void run();
-
-protected:
- QString m_filename;
-};
-
-#endif /* FILESAVEDIALOG_HPP_ */
44 DialogSample/src/app.cpp
View
@@ -1,44 +0,0 @@
-/* Copyright (c) 2012 Research In Motion Limited.
- *
- * 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 <bb/cascades/Application>
-#include <bb/cascades/QmlDocument>
-#include <bb/cascades/AbstractPane>
-
-#include "app.hpp"
-#include "AlertDialog.hpp"
-#include "ContextMenuDialog.hpp"
-#include "PromptDialog.hpp"
-#include "LoginDialog.hpp"
-#include "FileBrowseDialog.hpp"
-#include "FileSaveDialog.hpp"
-
-using namespace bb::cascades;
-
-App::App()
-{
- qmlRegisterType<AlertDialog>("Dialog.Alert", 1, 0, "AlertDialog");
- qmlRegisterType<ContextMenuDialog>("Dialog.ContextMenu", 1, 0, "ContextMenu");
- qmlRegisterType<PromptDialog>("Dialog.Prompt", 1, 0, "PromptDialog");
- qmlRegisterType<LoginDialog>("Dialog.Login", 1, 0, "LoginDialog");
- qmlRegisterType<FileBrowseDialog>("Dialog.FileBrowse", 1, 0, "FileBrowseDialog");
- qmlRegisterType<FileSaveDialog>("Dialog.FileSave", 1, 0, "FileSaveDialog");
-
- QmlDocument* qml = QmlDocument::create("main.qml");
- qml->setContextProperty("cs", this);
-
- AbstractPane* root = qml->createRootNode<AbstractPane>();
- Application::setScene(root);
-}
30 DialogSample/src/app.hpp
View
@@ -1,30 +0,0 @@
-/* Copyright (c) 2012 Research In Motion Limited.
- *
- * 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 APP_H
-#define APP_H
-
-#include <QtCore/QObject>
-
-class App : public QObject
-{
- Q_OBJECT
-
-public:
- App();
-
-};
-
-#endif // ifndef APP_H
42 DialogSample/src/main.cpp
View
@@ -13,18 +13,46 @@
* limitations under the License.
*/
+#include <bb/cascades/QmlDocument>
+#include <bb/cascades/AbstractPane>
#include <bb/cascades/Application>
-#include "app.hpp"
+#include "AlertDialog.hpp"
+#include "ContextMenuDialog.hpp"
+#include "PromptDialog.hpp"
+#include "LoginDialog.hpp"
-using ::bb::cascades::Application;
+#include <QLocale>
+#include <QTranslator>
-int main(int argc, char** argv)
-{
- Application app(argc, argv);
+using namespace bb::cascades;
- App mainApp;
+int main(int argc, char** argv) {
+ qmlRegisterType<AlertDialog>("Dialog.Alert", 1, 0, "AlertDialog");
+ qmlRegisterType<ContextMenuDialog>("Dialog.ContextMenu", 1, 0,
+ "ContextMenu");
+ qmlRegisterType<PromptDialog>("Dialog.Prompt", 1, 0, "PromptDialog");
+ qmlRegisterType<LoginDialog>("Dialog.Login", 1, 0, "LoginDialog");
- return Application::exec();
+ Application app(argc, argv);
+
+ // localization support
+ QTranslator translator;
+ const QString locale_string = QLocale().name();
+ const QString filename = QString::fromLatin1("filepicker_%1").arg(
+ locale_string);
+ if (translator.load(filename, "app/native/qm")) {
+ app.installTranslator(&translator);
+ }
+
+ // Load the UI description from main.qml
+ QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(&app);
+ qml->setContextProperty("cs", Application::instance());
+
+ // Create the application scene
+ AbstractPane *appPage = qml->createRootObject<AbstractPane>();
+ Application::instance()->setScene(appPage);
+
+ return Application::exec();
}
BIN  SensorDemo/.DS_Store
View
Binary file not shown
210 SensorDemo/.cproject
View
@@ -0,0 +1,210 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?>
+
+<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.qnx.qcc.toolChain.1914788226">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.qnx.qcc.toolChain.1914788226" moduleId="org.eclipse.cdt.core.settings" name="Default">
+ <externalSettings/>
+ <extensions>
+ <extension id="com.qnx.tools.ide.qde.core.QDEBynaryParser" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactName="${ProjName}" buildProperties="" id="com.qnx.qcc.toolChain.1914788226" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
+ <folderInfo id="com.qnx.qcc.toolChain.1914788226.1567637013" name="/" resourcePath="">
+ <toolChain id="com.qnx.qcc.toolChain.268032704" name="com.qnx.qcc.toolChain" superClass="com.qnx.qcc.toolChain">
+ <option id="com.qnx.qcc.option.os.614796125" name="Target OS:" superClass="com.qnx.qcc.option.os"/>
+ <option id="com.qnx.qcc.option.cpu.1104539411" name="Target CPU:" superClass="com.qnx.qcc.option.cpu" value="com.qnx.qcc.option.gen.cpu.armle-v7" valueType="enumerated"/>
+ <option id="com.qnx.qcc.option.compiler.1463820271" name="Compiler:" superClass="com.qnx.qcc.option.compiler"/>
+ <option id="com.qnx.qcc.option.runtime.2088679195" name="Runtime:" superClass="com.qnx.qcc.option.runtime"/>
+ <targetPlatform archList="all" binaryParser="com.qnx.tools.ide.qde.core.QDEBynaryParser" id="com.qnx.qcc.targetPlatform.808042757" osList="all" superClass="com.qnx.qcc.targetPlatform"/>
+ <builder autoBuildTarget="Device-Debug" enableAutoBuild="true" id="com.qnx.qcc.toolChain.1914788226.219412183" incrementalBuildTarget="Device-Debug" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+ <tool id="com.qnx.qcc.tool.compiler.317211679" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
+ <option id="com.qnx.qcc.option.compiler.optlevel.279694322" superClass="com.qnx.qcc.option.compiler.optlevel" value="com.qnx.qcc.option.compiler.optlevel.0" valueType="enumerated"/>
+ <option id="com.qnx.qcc.option.compiler.includePath.243892497" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/qt4"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/qt4/QtCore"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp/c"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp/embedded"/>
+ </option>
+ <inputType id="com.qnx.qcc.inputType.compiler.1401074275" superClass="com.qnx.qcc.inputType.compiler"/>
+ </tool>
+ <tool id="com.qnx.qcc.tool.assembler.1437556033" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
+ <inputType id="com.qnx.qcc.inputType.assembler.1559882478" superClass="com.qnx.qcc.inputType.assembler"/>
+ </tool>
+ <tool id="com.qnx.qcc.tool.linker.2076638193" name="QCC Linker" superClass="com.qnx.qcc.tool.linker"/>
+ <tool id="com.qnx.qcc.tool.archiver.340700028" name="QCC Archiver" superClass="com.qnx.qcc.tool.archiver"/>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.qnx.qcc.toolChain.476274684">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.qnx.qcc.toolChain.476274684" moduleId="org.eclipse.cdt.core.settings" name="Device-Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="com.qnx.tools.ide.qde.core.QDEBynaryParser" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactName="${ProjName}" buildProperties="" id="com.qnx.qcc.toolChain.476274684" name="Device-Debug" parent="org.eclipse.cdt.build.core.emptycfg">
+ <folderInfo id="com.qnx.qcc.toolChain.476274684.1760474445" name="/" resourcePath="">
+ <toolChain id="com.qnx.qcc.toolChain.2110843187" name="com.qnx.qcc.toolChain" superClass="com.qnx.qcc.toolChain">
+ <option id="com.qnx.qcc.option.os.2047695202" name="Target OS:" superClass="com.qnx.qcc.option.os"/>
+ <option id="com.qnx.qcc.option.cpu.1827606980" name="Target CPU:" superClass="com.qnx.qcc.option.cpu" value="com.qnx.qcc.option.gen.cpu.armle-v7" valueType="enumerated"/>
+ <option id="com.qnx.qcc.option.compiler.1571334629" name="Compiler:" superClass="com.qnx.qcc.option.compiler"/>
+ <option id="com.qnx.qcc.option.runtime.61587193" name="Runtime:" superClass="com.qnx.qcc.option.runtime"/>
+ <targetPlatform archList="all" binaryParser="com.qnx.tools.ide.qde.core.QDEBynaryParser" id="com.qnx.qcc.targetPlatform.49205793" osList="all" superClass="com.qnx.qcc.targetPlatform"/>
+ <builder autoBuildTarget="Device-Debug" enableAutoBuild="true" id="com.qnx.qcc.toolChain.476274684.50920412" incrementalBuildTarget="Device-Debug" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+ <tool id="com.qnx.qcc.tool.compiler.226507040" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
+ <option id="com.qnx.qcc.option.compiler.optlevel.1427219049" superClass="com.qnx.qcc.option.compiler.optlevel" value="com.qnx.qcc.option.compiler.optlevel.0" valueType="enumerated"/>
+ <option id="com.qnx.qcc.option.compiler.includePath.1591028044" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/qt4"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/qt4/QtCore"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp/c"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp/embedded"/>
+ </option>
+ <inputType id="com.qnx.qcc.inputType.compiler.1271660161" superClass="com.qnx.qcc.inputType.compiler"/>
+ </tool>
+ <tool id="com.qnx.qcc.tool.assembler.1271962789" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
+ <inputType id="com.qnx.qcc.inputType.assembler.1418060320" superClass="com.qnx.qcc.inputType.assembler"/>
+ </tool>
+ <tool id="com.qnx.qcc.tool.linker.1058273877" name="QCC Linker" superClass="com.qnx.qcc.tool.linker"/>
+ <tool id="com.qnx.qcc.tool.archiver.1208347870" name="QCC Archiver" superClass="com.qnx.qcc.tool.archiver"/>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.qnx.qcc.toolChain.1999582179">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.qnx.qcc.toolChain.1999582179" moduleId="org.eclipse.cdt.core.settings" name="Device-Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="com.qnx.tools.ide.qde.core.QDEBynaryParser" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactName="${ProjName}" buildProperties="" id="com.qnx.qcc.toolChain.1999582179" name="Device-Release" parent="org.eclipse.cdt.build.core.emptycfg">
+ <folderInfo id="com.qnx.qcc.toolChain.1999582179.1400832950" name="/" resourcePath="">
+ <toolChain id="com.qnx.qcc.toolChain.5661841" name="com.qnx.qcc.toolChain" superClass="com.qnx.qcc.toolChain">
+ <option id="com.qnx.qcc.option.os.1421273861" name="Target OS:" superClass="com.qnx.qcc.option.os"/>
+ <option id="com.qnx.qcc.option.cpu.1223267367" name="Target CPU:" superClass="com.qnx.qcc.option.cpu" value="com.qnx.qcc.option.gen.cpu.armle-v7" valueType="enumerated"/>
+ <option id="com.qnx.qcc.option.compiler.641423607" name="Compiler:" superClass="com.qnx.qcc.option.compiler"/>
+ <option id="com.qnx.qcc.option.runtime.925370516" name="Runtime:" superClass="com.qnx.qcc.option.runtime"/>
+ <targetPlatform archList="all" binaryParser="com.qnx.tools.ide.qde.core.QDEBynaryParser" id="com.qnx.qcc.targetPlatform.637630960" osList="all" superClass="com.qnx.qcc.targetPlatform"/>
+ <builder autoBuildTarget="Device-Release" enableAutoBuild="true" id="com.qnx.qcc.toolChain.1999582179.85953322" incrementalBuildTarget="Device-Release" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+ <tool id="com.qnx.qcc.tool.compiler.995955721" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
+ <option id="com.qnx.qcc.option.compiler.optlevel.1866448045" superClass="com.qnx.qcc.option.compiler.optlevel" value="com.qnx.qcc.option.compiler.optlevel.0" valueType="enumerated"/>
+ <option id="com.qnx.qcc.option.compiler.includePath.1870699532" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/qt4"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/qt4/QtCore"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp/c"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp/embedded"/>
+ </option>
+ <inputType id="com.qnx.qcc.inputType.compiler.1270728913" superClass="com.qnx.qcc.inputType.compiler"/>
+ </tool>
+ <tool id="com.qnx.qcc.tool.assembler.1697941996" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
+ <inputType id="com.qnx.qcc.inputType.assembler.1846885730" superClass="com.qnx.qcc.inputType.assembler"/>
+ </tool>
+ <tool id="com.qnx.qcc.tool.linker.601583937" name="QCC Linker" superClass="com.qnx.qcc.tool.linker"/>
+ <tool id="com.qnx.qcc.tool.archiver.1271569920" name="QCC Archiver" superClass="com.qnx.qcc.tool.archiver"/>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.qnx.qcc.toolChain.1067285528">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.qnx.qcc.toolChain.1067285528" moduleId="org.eclipse.cdt.core.settings" name="Simulator-Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="com.qnx.tools.ide.qde.core.QDEBynaryParser" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactName="${ProjName}" buildProperties="" id="com.qnx.qcc.toolChain.1067285528" name="Simulator-Debug" parent="org.eclipse.cdt.build.core.emptycfg">
+ <folderInfo id="com.qnx.qcc.toolChain.1067285528.842971467" name="/" resourcePath="">
+ <toolChain id="com.qnx.qcc.toolChain.832948659" name="com.qnx.qcc.toolChain" superClass="com.qnx.qcc.toolChain">
+ <option id="com.qnx.qcc.option.os.1674504591" name="Target OS:" superClass="com.qnx.qcc.option.os"/>
+ <option id="com.qnx.qcc.option.cpu.1524589052" name="Target CPU:" superClass="com.qnx.qcc.option.cpu"/>
+ <option id="com.qnx.qcc.option.compiler.183500169" name="Compiler:" superClass="com.qnx.qcc.option.compiler"/>
+ <option id="com.qnx.qcc.option.runtime.1994343275" name="Runtime:" superClass="com.qnx.qcc.option.runtime"/>
+ <targetPlatform archList="all" binaryParser="com.qnx.tools.ide.qde.core.QDEBynaryParser" id="com.qnx.qcc.targetPlatform.501098322" osList="all" superClass="com.qnx.qcc.targetPlatform"/>
+ <builder autoBuildTarget="Simulator-Debug" enableAutoBuild="true" id="com.qnx.qcc.toolChain.1067285528.2143105166" incrementalBuildTarget="Simulator-Debug" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+ <tool id="com.qnx.qcc.tool.compiler.1842001003" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
+ <option id="com.qnx.qcc.option.compiler.optlevel.1605224816" superClass="com.qnx.qcc.option.compiler.optlevel" value="com.qnx.qcc.option.compiler.optlevel.0" valueType="enumerated"/>
+ <option id="com.qnx.qcc.option.compiler.includePath.1427586403" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/qt4"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/qt4/QtCore"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp/c"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp/embedded"/>
+ </option>
+ <inputType id="com.qnx.qcc.inputType.compiler.206509173" superClass="com.qnx.qcc.inputType.compiler"/>
+ </tool>
+ <tool id="com.qnx.qcc.tool.assembler.948301585" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
+ <inputType id="com.qnx.qcc.inputType.assembler.1330250333" superClass="com.qnx.qcc.inputType.assembler"/>
+ </tool>
+ <tool id="com.qnx.qcc.tool.linker.1128571542" name="QCC Linker" superClass="com.qnx.qcc.tool.linker"/>
+ <tool id="com.qnx.qcc.tool.archiver.1261018377" name="QCC Archiver" superClass="com.qnx.qcc.tool.archiver"/>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="SensorDemo.null.2111163706" name="SensorDemo"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
+ <scannerConfigBuildInfo instanceId="com.qnx.qcc.toolChain.1914788226">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="com.qnx.qcc.toolChain.1999582179">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="com.qnx.qcc.toolChain.1067285528">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="com.qnx.qcc.toolChain.476274684">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
+ </scannerConfigBuildInfo>
+ </storageModule>
+ <storageModule moduleId="refreshScope"/>
+</cproject>
91 SensorDemo/.project
View
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>SensorDemo</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <arguments>
+ <dictionary>
+ <key>?name?</key>
+ <value></value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.append_environment</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.autoBuildTarget</key>
+ <value>Device-Debug</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.buildArguments</key>
+ <value></value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.buildCommand</key>
+ <value>make</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
+ <value>clean</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.contents</key>
+ <value>org.eclipse.cdt.make.core.activeConfigSettings</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableFullBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.fullBuildTarget</key>
+ <value>Device-Debug</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.stopOnError</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
+ <value>true</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.rim.tad.tools.qml.core.qmlFileBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.qnx.tools.bbt.xml.core.bbtXMLValidationBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.rim.tad.tools.wst.jsdt.core.jsNature</nature>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ <nature>com.qnx.tools.ide.bbt.core.bbtnature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>com.rim.tad.tools.qml.core.qmlNature</nature>
+ </natures>
+</projectDescription>
25 SensorDemo/.settings/org.eclipse.cdt.core.prefs
View
@@ -0,0 +1,25 @@
+eclipse.preferences.version=1
+environment/project/com.qnx.qcc.toolChain.1067285528/CPULIST/delimiter=,
+environment/project/com.qnx.qcc.toolChain.1067285528/CPULIST/operation=append
+environment/project/com.qnx.qcc.toolChain.1067285528/CPULIST/value=x86
+environment/project/com.qnx.qcc.toolChain.1067285528/VARIANTLIST/delimiter=,
+environment/project/com.qnx.qcc.toolChain.1067285528/VARIANTLIST/operation=append
+environment/project/com.qnx.qcc.toolChain.1067285528/VARIANTLIST/value=g
+environment/project/com.qnx.qcc.toolChain.1067285528/append=true
+environment/project/com.qnx.qcc.toolChain.1067285528/appendContributed=true
+environment/project/com.qnx.qcc.toolChain.1999582179/CPULIST/delimiter=,
+environment/project/com.qnx.qcc.toolChain.1999582179/CPULIST/operation=append
+environment/project/com.qnx.qcc.toolChain.1999582179/CPULIST/value=arm
+environment/project/com.qnx.qcc.toolChain.1999582179/EXCLUDE_VARIANTLIST/delimiter=,
+environment/project/com.qnx.qcc.toolChain.1999582179/EXCLUDE_VARIANTLIST/operation=append
+environment/project/com.qnx.qcc.toolChain.1999582179/EXCLUDE_VARIANTLIST/value=r
+environment/project/com.qnx.qcc.toolChain.1999582179/append=true
+environment/project/com.qnx.qcc.toolChain.1999582179/appendContributed=true
+environment/project/com.qnx.qcc.toolChain.476274684/CPULIST/delimiter=,
+environment/project/com.qnx.qcc.toolChain.476274684/CPULIST/operation=append
+environment/project/com.qnx.qcc.toolChain.476274684/CPULIST/value=arm
+environment/project/com.qnx.qcc.toolChain.476274684/VARIANTLIST/delimiter=,
+environment/project/com.qnx.qcc.toolChain.476274684/VARIANTLIST/operation=append
+environment/project/com.qnx.qcc.toolChain.476274684/VARIANTLIST/value=g
+environment/project/com.qnx.qcc.toolChain.476274684/append=true
+environment/project/com.qnx.qcc.toolChain.476274684/appendContributed=true
35 SensorDemo/Makefile
View
@@ -0,0 +1,35 @@
+QMAKE_TARGET = SensorDemo
+QMAKE = $(QNX_HOST)/usr/bin/qmake
+TARGET = $(QMAKE_TARGET)
+
+
+all: Makefile $(QMAKE_TARGET)
+
+clean:
+ $(MAKE) -C ./arm -f Makefile sureclean
+ $(MAKE) -C ./x86 -f Makefile sureclean
+
+
+Makefile: FORCE
+ $(QMAKE) -spec unsupported/blackberry-armv7le-g++ -o arm/Makefile $(QMAKE_TARGET).pro CONFIG+=device
+ $(QMAKE) -spec unsupported/blackberry-x86-g++ -o x86/Makefile $(QMAKE_TARGET).pro CONFIG+=simulator
+ $(MAKE) -C ./translations -f Makefile update release
+
+FORCE:
+
+$(QMAKE_TARGET): device simulator
+
+device:
+ $(MAKE) -C ./arm -f Makefile all
+
+Device-Debug: Makefile
+ $(MAKE) -C ./arm -f Makefile debug
+
+Device-Release: Makefile
+ $(MAKE) -C ./arm -f Makefile release
+
+simulator:
+ $(MAKE) -C ./x86 -f Makefile all
+
+Simulator-Debug: Makefile
+ $(MAKE) -C ./x86 -f Makefile debug
55 SensorDemo/SensorDemo.pro
View
@@ -0,0 +1,55 @@
+TEMPLATE = app
+TARGET = SensorDemo
+
+QT += declarative
+CONFIG += qt warn_on debug_and_release cascades mobility
+MOBILITY += sensors
+
+LIBS += -lbbdevice
+LIBS += -lcamapi
+
+INCLUDEPATH += ../src
+SOURCES += ../src/*.cpp
+HEADERS += ../src/*.hpp ../src/*.h
+
+lupdate_inclusion {
+ SOURCES += ../assets/*.qml
+}
+
+device {
+ CONFIG(release, debug|release) {
+ DESTDIR = o.le-v7
+ }
+ CONFIG(debug, debug|release) {
+ DESTDIR = o.le-v7-g
+ }
+}
+
+simulator {
+ CONFIG(release, debug|release) {
+ DESTDIR = o
+ }
+ CONFIG(debug, debug|release) {
+ DESTDIR = o-g
+ }
+}
+
+OBJECTS_DIR = $${DESTDIR}/.obj
+MOC_DIR = $${DESTDIR}/.moc
+RCC_DIR = $${DESTDIR}/.rcc
+UI_DIR = $${DESTDIR}/.ui
+
+suredelete.target = sureclean
+suredelete.commands = $(DEL_FILE) $${MOC_DIR}/*; $(DEL_FILE) $${RCC_DIR}/*; $(DEL_FILE) $${UI_DIR}/*
+suredelete.depends = distclean
+
+QMAKE_EXTRA_TARGETS += suredelete
+
+TRANSLATIONS = \
+ $${TARGET}_en_GB.ts \
+ $${TARGET}_fr.ts \
+ $${TARGET}_it.ts \
+ $${TARGET}_de.ts \
+ $${TARGET}_es.ts \
+ $${TARGET}.ts
+
0  SensorDemo/arm/.gitignore
View
No changes.
106 SensorDemo/assets/collisiondetector.qml
View
@@ -0,0 +1,106 @@
+/* Copyright (c) 2012 Research In Motion Limited.
+*
+* 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.
+*/
+
+import bb.cascades 1.0
+import bb.multimedia 1.0
+import QtMobility.sensors 1.2
+
+Container {
+//! [0]
+ attachedObjects: [
+ SystemSound {
+ id: sound
+ sound: SystemSound.CameraBurstEvent
+ },
+
+ IRProximitySensor {
+ id: irProximity
+
+ // Create a variable to hold movement state
+ property real reflectance: 0
+
+ // Turn on the sensor
+ active: true
+
+ // Keep the sensor active when the app isn't visible or the screen is off (requires app permission in bar-descriptor)
+ alwaysOn: true
+
+ onReadingChanged: { // Called when a new IR proximity reading is available
+ reflectance = reading.reflectance
+ }
+ },
+
+ ProximitySensor {
+ id: proximity
+
+ // Create a variable to hold movement state
+ property bool close: false
+
+ // Turn on the sensor
+ active: true
+
+ // Keep the sensor active when the app isn't visible or the screen is off (requires app permission in bar-descriptor)
+ alwaysOn: true
+
+ onReadingChanged: { // Called when a new proximity reading is available
+ close = reading.close
+ if (close) {
+ sound.play();
+ anim.play();
+ }
+ }
+ }
+ ]
+//! [0]
+
+ layout: DockLayout {}
+
+ Label {
+ horizontalAlignment: HorizontalAlignment.Center
+ verticalAlignment: VerticalAlignment.Bottom
+
+ text: qsTr("Reflectance: %1%").arg((irProximity.reflectance * 100).toPrecision(4))
+ textStyle {
+ base: SystemDefaults.TextStyles.BodyText
+ color: Color.Yellow
+ fontWeight: FontWeight.Bold
+ }
+ }
+
+//! [1]
+ Label {
+ id: alert
+
+ horizontalAlignment: HorizontalAlignment.Center
+ verticalAlignment: VerticalAlignment.Center
+
+ text: proximity.close ? qsTr("!! Mayday, Mayday !!") : qsTr("Cruising")
+ textStyle {
+ base: SystemDefaults.TextStyles.BigText
+ color: Color.Red
+ }
+
+ animations: [
+ FadeTransition {
+ id: anim
+ fromOpacity: 0.5
+ toOpacity: 1
+ duration: 300
+ easingCurve: StockCurve.BounceIn
+ }
+ ]
+ }
+//! [1]
+}
154 SensorDemo/assets/compass.qml
View
@@ -0,0 +1,154 @@
+/* Copyright (c) 2012 Research In Motion Limited.
+*
+* 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.
+*/
+
+import bb.cascades 1.0
+import QtMobility.sensors 1.2
+import bb.vibrationController 1.0
+
+Container {
+//! [0]
+ attachedObjects: [
+ OrientationHandler {
+ onOrientationAboutToChange: { // Callend whenever the screen orientation changes
+
+ // Adapt the compass to current screen orientation
+ if (displayDirection == DisplayDirection.North) {
+ compass.userOrientation = 0;
+ } else if (displayDirection == DisplayDirection.South) {
+ compass.userOrientation = 180;
+ } else if (displayDirection == DisplayDirection.East) {
+ compass.userOrientation = 270;
+ } else if (displayDirection == DisplayDirection.West) {
+ compass.userOrientation = 90;
+ }
+ }
+ },
+
+ Compass {
+ id: compass
+
+ // Create a variable to hold azimuth
+ property double azimuth: 0
+
+ // Turn on the sensor
+ active: true
+
+ // Change sensor axis depending on 'userOrientation' property
+ axesOrientationMode: Compass.UserOrientation
+
+ onReadingChanged: { // Called when a new compass reading is available
+ compass.azimuth = reading.azimuth;
+ }
+ },
+
+ OrientationSensor {
+ id: orientation
+
+ // Create a variable to hold orientation
+ property bool face_down: false
+
+ // Turn on the sensor
+ active: true
+
+ onReadingChanged: { // Called when a new orientation reading is available
+ face_down = (reading.orientation == OrientationReading.FaceDown);
+ }
+ }
+ ]
+//! [0]
+
+ layout: DockLayout {}
+
+ // The compass in face-up device orientation
+ Container {
+ horizontalAlignment: HorizontalAlignment.Center
+ verticalAlignment: VerticalAlignment.Center
+
+ opacity: orientation.face_down ? 0 : 1
+
+//! [1]
+ Label {
+ horizontalAlignment: HorizontalAlignment.Center
+
+ text: qsTr("%1\u00B0").arg(compass.azimuth.toFixed())
+ textStyle {
+ base: SystemDefaults.TextStyles.BodyText
+ color: Color.Yellow
+ fontWeight: FontWeight.Bold
+ }
+ }
+//! [1]
+
+//! [2]
+ ImageView {
+ imageSource: "images/MID-Dial.png"
+ rotationZ: - compass.azimuth
+ maxWidth: 500.0
+ maxHeight: 500.0
+ attachedObjects: [
+ ImplicitAnimationController {
+ // Disable animations to avoid jumps between 0 and 360 degree
+ enabled: false
+ }
+ ]
+ }
+//! [2]
+
+ attachedObjects: [
+ ImplicitAnimationController {
+ enabled: false
+ }
+ ]
+ }
+
+ // The compass in face-down device orientation
+ Container {
+ horizontalAlignment: HorizontalAlignment.Center
+ verticalAlignment: VerticalAlignment.Center
+
+ opacity: orientation.face_down ? 1 : 0
+
+ Label {
+ horizontalAlignment: HorizontalAlignment.Center
+
+ text: qsTr("%1\u00B0").arg(compass.azimuth.toFixed())
+ textStyle {
+ base: SystemDefaults.TextStyles.BodyText
+ color: Color.Yellow
+ fontWeight: FontWeight.Bold
+ }
+ }
+
+ ImageView {
+ imageSource: "images/MID-Dial-reverse.png"
+ rotationZ: - compass.azimuth
+ maxWidth: 500.0
+ maxHeight: 500.0
+
+ attachedObjects: [
+ ImplicitAnimationController {
+ // Disable animations to avoid jumps between 0 and 360 degree
+ enabled: false
+ }
+ ]
+ }
+
+ attachedObjects: [
+ ImplicitAnimationController {
+ enabled: false
+ }
+ ]
+ }
+}
177 SensorDemo/assets/flashlight.qml
View
@@ -0,0 +1,177 @@
+/* Copyright (c) 2012 Research In Motion Limited.
+*
+* 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.
+*/
+
+import bb.cascades 1.0
+import QtMobility.sensors 1.2
+import Flashlight 1.0
+
+Container {
+//! [0]
+ attachedObjects: [
+ Flashlight {
+ id: flashlight
+ },
+
+ Gyroscope {
+ id: accel
+
+ // Create a variable to count the number of sensor readings
+ property int count: 0
+
+ // Turn on the sensor
+ active: true
+
+ // Don't change sensor axis on screen rotation
+ axesOrientationMode: Gyroscope.FixedOrientation
+
+ // Keep the sensor active when the app isn't visible or the screen is off (requires app permission in bar-descriptor)
+ alwaysOn: true
+
+ // If the device isn't moving (x&y&z==0), don't send updates, saves power
+ skipDuplicates: true
+
+ onReadingChanged: { // Called when a gyroscope reading is available
+ // Check whether rotation on Z axis is above the configured threshold
+ if (reading.z > gyroSlider.value.toFixed() * 360 / (2 * 3.14)) {
+ if (count > 5 && ambLight.val < lightDropDown.selectedIndex) {
+ // If after 5 readings the ambient light is darker than the configured threshold, toggle the flash light
+ count = 0
+ flashlight.enabled = ! flashlight.enabled;
+ }
+ }
+ count ++;
+ }
+ },
+
+ AmbientLightSensor {
+ id: ambLight
+
+ // Create a variable to hold the ambient light value
+ property variant val: AmbientLightSensor.Undefined
+
+ // Turn on the sensor
+ active: true
+
+ // Keep the sensor active when the app isn't visible or the screen is off (requires app permission in bar-descriptor)
+ alwaysOn: true
+
+ // If the device isn't moving (x&y&z==0), don't send updates, saves power
+ skipDuplicates: true
+
+ onReadingChanged: { // Called when an ambient light reading is available
+ val = reading.lightLevel;
+ if (ambLight.val >= lightDropDown.selectedIndex && flashlight.enabled) {
+ // Switch off the flash light if current ambient light is brigther than configured threshold
+ flashlight.enabled = false;
+ }
+ }
+ },
+
+ LightSensor {
+ id: light
+
+ // Create a variable to hold the ambient light value
+ property real val: 0
+
+ // Turn on the sensor
+ active: true
+
+ // Keep the sensor active when the app isn't visible or the screen is off (requires app permission in bar-descriptor)
+ alwaysOn: true
+
+ // If the device isn't moving (x&y&z==0), don't send updates, saves power
+ skipDuplicates: true
+
+ onReadingChanged: { // Called when an light reading is available
+ val = reading.lux;
+ }
+ }
+ ]
+//! [0]
+
+ TextArea {
+ text: qsTr("To enable the flash light give the device a clockwise flick with an angular velocity greater then 'Gyro Threshold'. The flashlight is only enabled in environments darker then 'Light Threshold'. The flashlight will automatically turn off in enviroments brighter then 'Light Threshold'.")
+ }
+
+ Label {
+ text: {
+ if (light.val == AmbientLightReading.Dark) {
+ return qsTr("Light: Dark");
+ } else if (light.val == AmbientLightReading.Twilight) {
+ return qsTr("Light: Twilight");
+ } else if (light.val == AmbientLightReading.Light) {
+ return qsTr("Light: Light");
+ } else if (light.val == AmbientLightReading.Bright) {
+ return qsTr("Light: Bright");
+ } else if (light.val == AmbientLightReading.Sunny) {
+ return qsTr("Light: Sunny");
+ } else {
+ return qsTr("Light: Undefined");
+ }
+ }
+ }
+
+ DropDown {
+ id: lightDropDown
+ title: qsTr("Light Threshold")
+
+ Option {
+ text: qsTr("Undefined")
+ }
+ Option {
+ text: qsTr("Dark")
+ }
+ Option {
+ text: qsTr("Twilight")
+ selected: true
+ }
+ Option {
+ text: qsTr("Light")
+ }
+ Option {
+ text: qsTr("Bright")
+ }
+ Option {
+ text: qsTr("Sunny")
+ }
+ }
+
+ Divider {}
+
+ Label {
+ text: qsTr("Gyro Threshold: %1").arg(gyroSlider.value.toFixed())
+ }
+
+ Slider {
+ id: gyroSlider
+ value: 10
+ fromValue: 0
+ toValue: 50
+ }
+
+//! [1]
+ Label {
+ horizontalAlignment: HorizontalAlignment.Center
+
+ text: qsTr("Luminosity: %1 lux").arg(Math.round(light.val))
+ textStyle {
+ base: SystemDefaults.TextStyles.BodyText
+ color: Color.Yellow
+ fontWeight: FontWeight.Bold
+ lineHeight: 2
+ }
+ }
+//! [1]
+}
BIN  SensorDemo/assets/images/MID-Dial-reverse.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  SensorDemo/assets/images/MID-Dial.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  SensorDemo/assets/images/alarm.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  SensorDemo/assets/images/compass.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  SensorDemo/assets/images/crash.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  SensorDemo/assets/images/device.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  SensorDemo/assets/images/flashlight.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  SensorDemo/assets/images/magnet.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  SensorDemo/assets/images/rotation3d.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
110 SensorDemo/assets/main.qml
View
@@ -0,0 +1,110 @@
+/* Copyright (c) 2012 Research In Motion Limited.
+*
+* 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.
+*/
+
+import bb.cascades 1.0
+import QtMobility.sensors 1.2
+
+TabbedPane {
+ id: tabPane
+
+ showTabsOnActionBar: true
+
+//! [0]
+ onCreationCompleted: {
+ OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.All;
+ tabPane.activeTab = compassTab;
+ }
+//! [0]
+
+//! [1]
+ Tab {
+ id: alarmTab
+ title: qsTr("Motion Alarm")
+ imageSource: "images/alarm.png"
+
+ Page {
+ ControlDelegate {
+ source: "motionalarm.qml"
+ delegateActive: (tabPane.activeTab == alarmTab)
+ }
+ }
+ }
+//! [1]
+
+ Tab {
+ id: compassTab
+ title: qsTr("Compass")
+ imageSource: "images/compass.png"
+
+ Page {
+ ControlDelegate {
+ source: "compass.qml"
+ delegateActive: (tabPane.activeTab == compassTab)
+ }
+ }
+ }
+
+ Tab {
+ id: metalFinderTab
+ title: qsTr("Metal Detector")
+ imageSource: "images/magnet.png"
+
+ Page {
+ ControlDelegate {
+ source: "metalfinder.qml"
+ delegateActive: (tabPane.activeTab == metalFinderTab)
+ }
+ }
+ }
+
+ Tab {
+ id: flashlightTab
+ title: qsTr("Flashlight")
+ imageSource: "images/flashlight.png"
+
+ Page {
+ ControlDelegate {
+ source: "flashlight.qml"
+ delegateActive: (tabPane.activeTab == flashlightTab)
+ }
+ }
+ }
+
+ Tab {
+ id: collisionDetectorTab
+ title: qsTr("Collision Detector")
+ imageSource: "images/crash.png"
+
+ Page {
+ ControlDelegate {
+ source: "collisiondetector.qml"
+ delegateActive: (tabPane.activeTab == collisionDetectorTab)
+ }
+ }
+ }
+
+ Tab {
+ id: rotation3DTab
+ title: qsTr("Rotation 3D")
+ imageSource: "images/rotation3d.png"
+
+ Page {
+ ControlDelegate {
+ source: "rotation3D.qml"
+ delegateActive: (tabPane.activeTab == rotation3DTab)
+ }
+ }
+ }
+}
114 SensorDemo/assets/metalfinder.qml
View
@@ -0,0 +1,114 @@
+/* Copyright (c) 2012 Research In Motion Limited.
+*
+* 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.
+*/
+
+import bb.cascades 1.0
+import QtMobility.sensors 1.2
+import bb.vibrationController 1.0
+
+Container {
+//! [0]
+ attachedObjects: [
+ Magnetometer {
+ id: metalfinder
+
+ // Create various variables to hold values from magnetometer reading
+ property double baseline: 0
+ property double magnitude: 0