Luca Filigheddu - Sviluppiamo in Cascades per Blackberry 10
1. Cascades 101
How To Build Astonishing User Interfaces for
BlackBerry 10
Luca Filigheddu
Head of Developer Evangelism EMEA
lfiligheddu@blackberry.com
@filos
2. What is Cascades?
• Qt toolkit
• Cascades replaces QtQuick – QtGui
• UI runs in separate thread
• “Talks” to C++ and vice-versa
3. Why Use Cascades?
Elegant UI Framework
• Great looking core UI components
• Easy to build custom UI components
• Dedicated UI tooling including design
preview (w/ Photoshop Plugin)
Increase Productivity
• Higher level APIs
• QT flavoured C++ and declarative UI
approach
4. The NDK – Two layers
High Level – Cascades
Ÿ High level APIs / C++
Ÿ Qt + QML + JavaScript
Ÿ Built-in Elegance, beautiful UI
Ÿ Provides the BlackBerry 10 UX
Low Level
Ÿ Posix/Low level C; great for porting
Ÿ Raw OS access, windowing, etc.
Ÿ OpenGL ES, OpenAL, ...Excellent for
games
Ÿ Great for Open Source Integration
4
8. Cascades APIs
•
•
•
•
•
•
•
•
•
•
•
Advertising Service
App Integration (Invocation Framework)
BBM integration
Location
Payment services (in-app purchases)
Push services and notifications
Audio and Video
Imaging
Camera
Sensors
Networking
8
9. Cascades – New in 10.2
•
•
•
•
•
•
•
Custom fonts
Screen reader
Headless Applications
GeoFencing
Bluetooth improvements
Peripheral discovery
…MORE…
• à http://bit.ly/cascades102
9
10. A typical Cascades app
JavaScript-based
UI logic
QML-based UI
structure
Qt/C++ Base
10
11. C++ layer
Qt makes C++ easy to use and provides
structure
APIs and platform services exposed as
C++ classes
Qt/C++
Base
UI framework exposed as C++ classes
Access to the underlying low level NDK
and OpenGL
11
12. C++ layer
JavaScript
QML
UI structure
Declarative UI model – Declare the
structure of your app, Cascades will piece
it together for you
Add runtime logic and react to user
events in JavaScript
Realtime UI preview in the tool
Many platform features exposed in QML as
well
12
13. Any mix is possible
JavaScript
QML
UI structure
Qt/C++
Base
13
14. Moving between QML and C++ is
easy
JavaScript
myCppFunction()
myJSFunction{
}
QML
MyObject {
MyProperty: x
}
MyObject {
MyOtherObj {…}
}
C++
myCppFunction {
}
myJSFunction()
class MyClass {
int property;
}
QmlDocument::create
("asset:///main.qml")
14
18. Same thing in C++
Page* root = new Page;
Label* label = Label::create()
.text("Hello World");
root->setContent(label);
Application::instance()->setScene(root);
49. How create an adaptable UI?
Ÿ Built in controls adapt to device type
Ÿ Layouts, space quota, 9-sliced images, …
Ÿ Unique (sub)set of assets per configuration
50. Asset selectors
Based on resolution and/or visual style
assets/
main_screen.qml
dialog.qml
picture.png
icon.png
720x720/
main_screen.qml
picture.png