diff --git a/share/qtcreator/templates/wizards/bb-cascades-app/assets/SecondPage.qml b/share/qtcreator/templates/wizards/bb-cascades-app/assets/SecondPage.qml deleted file mode 100644 index 429ea6078eb67f5f35afbae21e8ab697979ed9bf..0000000000000000000000000000000000000000 --- a/share/qtcreator/templates/wizards/bb-cascades-app/assets/SecondPage.qml +++ /dev/null @@ -1,24 +0,0 @@ -import bb.cascades 1.0 - -Page { - id: seconPage - paneProperties: NavigationPaneProperties { - backButton: ActionItem { - onTriggered: { - navigationPane.pop() - } - } - } - Container { - layout: DockLayout {} - Label { - text: qsTr("Hello Cascades!") - horizontalAlignment: HorizontalAlignment.Center - verticalAlignment: VerticalAlignment.Center - textStyle { - base: SystemDefaults.TextStyles.TitleText - } - } - } -} - diff --git a/share/qtcreator/templates/wizards/bb-cascades-app/assets/main.qml b/share/qtcreator/templates/wizards/bb-cascades-app/assets/main.qml index a02479065e3c6a0f7dc59e27f9c9597d8e07ec6d..d57ad95f392df1204a2c26a412ca41a00781cefd 100644 --- a/share/qtcreator/templates/wizards/bb-cascades-app/assets/main.qml +++ b/share/qtcreator/templates/wizards/bb-cascades-app/assets/main.qml @@ -1,37 +1,13 @@ import bb.cascades 1.0 -NavigationPane { - id: navigationPane - Page { - Container { - layout: DockLayout {} - Button { - horizontalAlignment: HorizontalAlignment.Center - verticalAlignment: VerticalAlignment.Center - text: qsTr("Next") - onClicked: { - var page = getSecondPage(); - navigationPane.push(page); - } - property Page secondPage - function getSecondPage() { - if (! secondPage) { - secondPage = secondPageDefinition.createObject(); - } - return secondPage; - } - attachedObjects: [ - ComponentDefinition { - id: secondPageDefinition - source: "SecondPage.qml" - } - ] - } +Page { + Container { + layout: DockLayout { } + Label { + text: qsTr("Hello World") + textStyle.base: SystemDefaults.TextStyles.BigText + verticalAlignment: VerticalAlignment.Center + horizontalAlignment: HorizontalAlignment.Center } } - onCreationCompleted: { - console.log("NavigationPane - onCreationCompleted()"); - OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.All; - } } - diff --git a/share/qtcreator/templates/wizards/bb-cascades-app/bar-descriptor.xml b/share/qtcreator/templates/wizards/bb-cascades-app/bar-descriptor.xml index 4737c1bc861fe2db52d0792216b6e66c1d747819..670ecd224fe7fa9c863035201ccc1a1d23f5878c 100644 --- a/share/qtcreator/templates/wizards/bb-cascades-app/bar-descriptor.xml +++ b/share/qtcreator/templates/wizards/bb-cascades-app/bar-descriptor.xml @@ -4,14 +4,25 @@ <name>%ProjectName%</name> <versionNumber>1.0.0</versionNumber> <description>DESCRIPTION</description> + <initialWindow> <systemChrome>none</systemChrome> <transparent>false</transparent> <autoOrients>true</autoOrients> <aspectRatio>landscape</aspectRatio> </initialWindow> + + <!-- The icon for the application, which should be 114x114. --> + <icon> + <image>icon.png</image> + </icon> + <env value="app/native/lib:/usr/lib/qt4/lib/" var="LD_LIBRARY_PATH"/> + <action system="true">run_native</action> - <asset path="%ProjectName%" type="Qnx/Elf" entry="true">%ProjectName%</asset> + + <!-- Application assets --> + <asset path="%SRC_DIR%/icon.png">icon.png</asset> <asset path="%SRC_DIR%/assets">assets</asset> + <asset path="%ProjectName%" type="Qnx/Elf" entry="true">%ProjectName%</asset> </qnx> diff --git a/share/qtcreator/templates/wizards/bb-cascades-app/main.cpp b/share/qtcreator/templates/wizards/bb-cascades-app/main.cpp deleted file mode 100644 index 08eef18c2b96448263e17d9a99086052d3c9f2d4..0000000000000000000000000000000000000000 --- a/share/qtcreator/templates/wizards/bb-cascades-app/main.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "%ProjectName%.hpp" - -#include <bb/cascades/Application> -#include <Qt/qdeclarativedebug.h> - -Q_DECL_EXPORT int main(int argc, char **argv) -{ - bb::cascades::Application app(argc, argv); - - new %ProjectName:s%(&app); - - return bb::cascades::Application::exec(); -} diff --git a/share/qtcreator/templates/wizards/bb-cascades-app/project.cpp b/share/qtcreator/templates/wizards/bb-cascades-app/project.cpp deleted file mode 100644 index 34de18ad120fb7d02f48ddcfc10de1c7b172647e..0000000000000000000000000000000000000000 --- a/share/qtcreator/templates/wizards/bb-cascades-app/project.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "%ProjectName%.hpp" - -#include <bb/cascades/Application> -#include <bb/cascades/QmlDocument> -#include <bb/cascades/AbstractPane> - -%ProjectName:s%::%ProjectName:s%(bb::cascades::Application *app) - : QObject(app) -{ - bb::cascades::QmlDocument *qml = bb::cascades::QmlDocument::create("asset:///main.qml").parent(this); - bb::cascades::AbstractPane *root = qml->createRootObject<bb::cascades::AbstractPane>(); - app->setScene(root); -} - diff --git a/share/qtcreator/templates/wizards/bb-cascades-app/project.hpp b/share/qtcreator/templates/wizards/bb-cascades-app/project.hpp deleted file mode 100644 index de0b701395ce957b6ed3a0370e897565c7be109d..0000000000000000000000000000000000000000 --- a/share/qtcreator/templates/wizards/bb-cascades-app/project.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef %ProjectName:h%_HPP_ -#define %ProjectName:h%_HPP_ - -#include <QObject> - -namespace bb { namespace cascades { class Application; }} - -class %ProjectName:s% : public QObject -{ - Q_OBJECT -public: - %ProjectName:s%(bb::cascades::Application *app); - virtual ~%ProjectName:s%() {} -}; - -#endif /* %ProjectName:h%_HPP_ */ diff --git a/share/qtcreator/templates/wizards/bb-cascades-app/project.pro b/share/qtcreator/templates/wizards/bb-cascades-app/project.pro index a0034bfcf2eba959b7e0f83d9cd4839557a525fb..47597de12a7e08be31e3cffc36df075aa836daa1 100644 --- a/share/qtcreator/templates/wizards/bb-cascades-app/project.pro +++ b/share/qtcreator/templates/wizards/bb-cascades-app/project.pro @@ -3,11 +3,15 @@ TEMPLATE = app LIBS += -lbbdata -lbb -lbbcascades QT += declarative xml -SOURCES += main.cpp \ - %ProjectName%.cpp +SOURCES += \ + src/main.cpp \ + src/applicationui.cpp \ -HEADERS += %ProjectName%.hpp +HEADERS += \ + src/applicationui.h \ -OTHER_FILES += bar-descriptor.xml \ +OTHER_FILES += \ + bar-descriptor.xml \ assets/main.qml \ - assets/SecondPage.qml + + diff --git a/share/qtcreator/templates/wizards/bb-cascades-app/src/applicationui.cpp b/share/qtcreator/templates/wizards/bb-cascades-app/src/applicationui.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e61e3fc5cc299f9e9a01aa33f3cd429af95ad939 --- /dev/null +++ b/share/qtcreator/templates/wizards/bb-cascades-app/src/applicationui.cpp @@ -0,0 +1,22 @@ +#include "applicationui.h" + +#include <bb/cascades/Application> +#include <bb/cascades/QmlDocument> +#include <bb/cascades/AbstractPane> + +using namespace bb::cascades; + +ApplicationUI::ApplicationUI(bb::cascades::Application *app) : + QObject(app) +{ + // By default the QmlDocument object is owned by the Application instance + // and will have the lifespan of the application + QmlDocument *qml = QmlDocument::create("asset:///main.qml"); + + // Create root object for the UI + AbstractPane *root = qml->createRootObject<AbstractPane>(); + + // Set created root object as the application scene + app->setScene(root); +} + diff --git a/share/qtcreator/templates/wizards/bb-cascades-app/src/applicationui.h b/share/qtcreator/templates/wizards/bb-cascades-app/src/applicationui.h new file mode 100644 index 0000000000000000000000000000000000000000..16f28af444406e762f77eeaa9fcfdbd4ea3db086 --- /dev/null +++ b/share/qtcreator/templates/wizards/bb-cascades-app/src/applicationui.h @@ -0,0 +1,20 @@ +#ifndef APPLICATIONUI_H +#define APPLICATIONUI_H + +#include <QObject> + +namespace bb { + namespace cascades { + class Application; + } +} + +class ApplicationUI : public QObject +{ + Q_OBJECT +public: + ApplicationUI(bb::cascades::Application *app); + virtual ~ApplicationUI() {} +}; + +#endif /* APPLICATIONUI_H */ diff --git a/share/qtcreator/templates/wizards/bb-cascades-app/src/main.cpp b/share/qtcreator/templates/wizards/bb-cascades-app/src/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2f3212f90be913dc57caabe95da407d33a758732 --- /dev/null +++ b/share/qtcreator/templates/wizards/bb-cascades-app/src/main.cpp @@ -0,0 +1,19 @@ +#include "applicationui.h" + +#include <bb/cascades/Application> + +#include <Qt/qdeclarativedebug.h> + +using namespace bb::cascades; + +Q_DECL_EXPORT int main(int argc, char **argv) +{ + Application app(argc, argv); + + // Create the Application UI object, this is where the main.qml file + // is loaded and the application scene is set. + new ApplicationUI(&app); + + // Enter the application main event loop. + return Application::exec(); +} diff --git a/share/qtcreator/templates/wizards/bb-cascades-app/wizard.xml b/share/qtcreator/templates/wizards/bb-cascades-app/wizard.xml index fc1da4f02e790c73e3a36355ec5a77953482cab6..f61033f2c1f3feb778f14e592422878a9c0f9344 100644 --- a/share/qtcreator/templates/wizards/bb-cascades-app/wizard.xml +++ b/share/qtcreator/templates/wizards/bb-cascades-app/wizard.xml @@ -38,12 +38,12 @@ <displayname>BlackBerry Cascades Application</displayname>; <description>Creates a Cascades application for BlackBerry 10.</description> <files> - <file source="main.cpp" openeditor="true"/> <file source="assets/main.qml" openeditor="true"/> - <file source="assets/SecondPage.qml" openeditor="true"/> <file source="bar-descriptor.xml" openeditor="true"/> <file source="project.pro" target="%ProjectName%.pro" openproject="true"/> - <file source="project.hpp" target="%ProjectName%.hpp" openproject="true"/> - <file source="project.cpp" target="%ProjectName%.cpp" openproject="true"/> - </files> + <file source="src/main.cpp" openeditor="true"/> + <file source="src/applicationui.h" openproject="true"/> + <file source="src/applicationui.cpp" openproject="true"/> + <file source="icon.png"/> + </files> </wizard>