The thing I most miss about the Java based BlackBerry’s is decent Twitter apps – I really wish there was a Twitter app for BB10 that was as good as T4BB or one of the other choices, or as good as Blaq for the PlayBook. A close second to that though is theming – I was very disappointed when BlackBerry decided not to launch Theme Builder for BlackBerry 7, and far more disappointed when it was announced that there would be no BlackBerry 10 Theme Builder.
A small amount of customization can be contrived using apps like my recent Z Theme app, but that doesn’t let you modify the device icons. However, there is a way to create a shortcut for many of the existing applictions. For a more in-depth explanation of how these icons work, read this CrackBerry Forums post.
Creating your Custom Icons:
Step 0: Get BlackBerry Signing Keys and configure your PC for signing.
Step1: Download the templates from my Github: https://github.com/SCrid2000/BlackBerry-URI-Builder, and copy the templates you’d like to use into a folder on your desktop.
Step 2 (optional but recommended): Set up the signing tools. To make this easy, I have provided downloads for all needed signing tools. Get the signURI.bat and sideloadFile.bat files from github and put them into a folder with the signing tools contained at http://www.mediafire.com/?qq64yck165xtbwc.
You’ll need to open the .bat files with a text editor to add your Signing Key Password and BlackBerry IP/password to them.
Step 3: Get the icon you’d like to use. Resize it to be 114×114 pixels, and place it in the folder with the META-INF folder.
Step 4: Modify the MANIFEST.MF of the launcher you’d like to create. You will need to modify the following:
Package-Version: must be increased by at least 0.0.0.1 for each successive signing;
Application-Version: must match Package Version;
Archive-Asset-SHA-512-Digest: does not always need to be updated, but sometimes might cause signing to fail. Use a site like http://hash.online-convert.com/sha512-generator to get the appropriate SHA-512 hex for your image.
Other attributes can be modified if you’d like, such as Application-Name, Entry-Point, and others. However, this is unnecessary if you just use the templates included in the Github link above.
Step 5: Compress the icon.png you created and the META-INF folder containing the MANIFEST.MF file into a .zip file. Change the .zip extension to .bar
Step 6: Sign the URI by dragging it onto the signURI.bat
That’s it! Just do that for any icon you want a custom icon for, and sideload it to your BlackBerry!
Keep in mind that these are shortcuts, and will not replace the stock icon.
QML is designed so that data can easily be passed to and from C++. You can use the classes in the Qt Declarative module to load and modify QML documents from C++. In addition, QML and C++ objects can easily communicate using Qt signals and slots.
There are a number of reasons that you might want to mix QML and C++ in your application. For example, you might have a data source for a list that you define in C++, while the visuals for the list are in QML. Or you might define your UI in QML, but you must access functionality in the Qt Declarative module or another Qt class.
Loading a QML document from C++
Loading a QML document into C++ is a common way that Cascades applications are created. You can define your UI in QML, and then load it into your C++ application to be displayed for the user.
To load a QML document into an application, you create a QmlDocument object by callingQmlDocument::create() and specifying the QML asset that you want to load. To display the content of the QmlDocument, you retrieve the root node using QmlDocument::createRootObject(), and display the content using Application::setScene().
The following example demonstrates how to create a Cascades app using QML for the UI:
After you load a QML document into C++, you can modify its properties usingQObject::setProperty(). The following example shows how you can change the text for thelabelText property:
In this example, we can change the text because we define an alias to the text property for the Labelat the root of the QML document. Without an alias to the label’s text property, the value is not accessible because it’s not located at the root of the QML document.
When you set the scene in an application, the root object must be a subclass of AbstractPane. However, the root node of the QML document that you want to load doesn’t need to be an AbstractPane subclass. For example, if your main.qml file includes a Container control at its root, you can load this document and create a scene to display it as follows:
Accessing child objects
Since QML documents are organized in a tree hierarchy, another option for accessing child properties and objects is to search for the object by using QObject::findChild(). In this example, we do a search for the button and change its text property:
To be able to search for the object using findChild(), the button must have an objectName.
Exposing C++ values and objects to QML
There are often cases that require you to embed data from C++ into QML that you loaded into your application. A convenient way of passing C++ data or objects to QML is by using theQDeclarativePropertyMap class. This allows you to define key-value pairs in C++ that you can bind to QML properties.
For example, this is how you could use QDeclarativePropertyMap to pass a name and phone number to QML.
In your QML document, you can access the values by specifying the property name and the key that you define in C++.
Since QDeclarativePropertyMap accepts QVariant objects, you can pass a QObject to QML this way as well.
Exposing C++ objects to QML
In an application, it’s possible to create a C++ object and expose it to QML. Before you can pass a C++ object to QML, there are some important Qt macros that you need to implement in the header file for the C++ class.
- Q_OBJECT is a required macro for classes that use the signals and slots mechanism.
- Q_PROPERTY exposes a class property to QML. It also defines the read and write values from and to the property, as well as the signal that is emitted with the property is changed.
- Q_INVOKABLE exposes member functions so that they can be invoked from QML.
In the example header below, the class has a Q_PROPERTY called value. It also has three functions;value(), setValue(), and reset(). The reset() function is invokable from QML using theQ_INVOKABLE macro. The header also defines the signal that is emitted when the value property changes.
And this is how you could implement the resulting class.
To expose MyCppClass to QML, you create an instance of the class and use setContextProperty()to expose it.
From QML, you can access the Q_PROPERTY by using the property name that is defined in the header file. In the example below, the value property is displayed in the text property of a label.
From QML, you can also change the value of a Q_PROPERTY, connect slots to its signals, and callQ_INVOKABLE functions. In the example below, a button is used to increase the value property each time the user presses it. The button also defines a custom slot and connects it to the property’svalueChanged() signal. When the slot is invoked, the slot changes the text on the button. A reset button is also used, which calls MyCppClass::reset() to reset the value property.
Using C++ classes in QML
In some instances, instead of passing a C++ object or values to QML, you may want to use the C++ class in QML directly. In the Cascades framework, there are a few ways that you can use a C++ class in QML directly, whether it’s a class from the core Qt library, or a class that you define yourself:
- Attach a C++ class to an existing QML component using UIObject::attachedObjects (the class must inherit QObject).
- Extend a C++ class using CustomControl and use it in QML directly.
In both cases, you must register the class for QML, by using qmlRegisterType().
Using the attachedObjects property
Since the attachedObjects property is a member of UIObject, you can use it to attach a QObject to almost any Cascades QML component that has a visual representation. For example, if you want access to the functionality in the QTimer class, this is how you would register the class for use in QML:
After you register the QTimer class, you can create and manipulate QTimer objects within your QML document. In the following example, a QTimer object is attached to a Label. When the page is created, the timer is started. When the timer is complete, the text for the label is updated with new text.
By subclassing CustomControl, you can use your C++ class in a QML document without attaching it to another component using attachedObjects. In the following header file, a simple class calledTextControl is declared. TextControl is composed of a text property, functions to set and get thetext property, and a signal that is emitted when the text changes.
To use the class in QML, first you must register the class.
After you register the class, you can import its library into a QML document, and use it the way you use any other QML component:
Injecting C++ objects into QML
In previous sections, we’ve looked at how to define values and objects in C++ and use them in QML. We’ve also looked at how to expose C++ classes to QML as attached objects or custom controls. In this section, we’ll see how to create objects in C++ and inject them dynamically into QML.
Being able to inject C++ content into to QML is useful if you have a UI that is dynamically generated. For example, you might want the ability to add or remove containers from your screen during run time.
The first step is to provide an objectName for the QML component that you want to add content to (or remove from). In this case, content is going to be added to a Container.
Next, you load the QML file into C++ and create a Page object using the root from the QML file. Once you have the root of the QML file, you use findChild() to search for the Container with the specified object name.
Now that you have the container you want to add content to, it’s just a matter of adding your content. Here’s how to add another container as the last child in the parent.
You aren’t restricted to just adding content though. If you wanted, you could remove components, replace components, or insert components at a specific index.
Here’s an example that demonstrates how to create containers in C++ and inject them into QML. The QML file contains a button that when clicked, calls a function in C++ that creates a new container and adds it to QML.
下面进行第一个BlackBerry 10 Cascades应用。
1、首先打开IDE，然后File -> New -> BlackBerry Cascades C++ Project
6、然后在项目上右键，选择Build Project，最后选择Run as -> BlackBerry C/C++ Application，稍等后即可在模拟器上看到运行结果，效果如下：
至此第一个BlackBerry 10 Cascades应用就完成了，其实BlackBerry 10 Cascades应用和PlayBook开发的相关配置等都是相同的，之前接触过PlayBook Native SDK开发的人员对于当前的Cascades开发会感到相当的熟悉。
根据黑莓世界大会中展示的BlackBerry 10 Dev Alpha来看，部分功能的确让人眼前一亮，例如：输入法的联想输入和照相机的功能。
首先要安装VMware Player. 参考：
序号 线 路 发车时间 途径站点 备 注
1 阳春 – 阳江 6:15 – 21:00 （每 15 分钟一班） 直达
2 阳春 – 春湾 7:30 – 21:00 （每 30 分钟一班） 直达
3 阳春 – 阳江 6:15 – 18:20 （每 20 分钟一班） 岗美、轮水
4 阳春 – 阳西 6:45 – 16:30 （每 1 小时一班） 河口
5 阳春 – 罗阳 6:15 – 18:15 （每 30 分钟一班） 春湾、凌霄
6 阳春 – 圭岗 7:00 – 9:40 （每 30 分钟一班） 合水、黄牛头
7 阳春 – 马贵 6:00 – 16:00 （每 1 小时一班） 三甲、双窖
8 阳春 – 双窖 6:30 – 20:00 （每 30 分钟一班） 潭水、三甲
9 阳春 – 八甲 6:45 – 20:30 （每 30 分钟一班） 潭水、三甲
10 阳春 – 永宁 7:00 – 16:00 （每 1 小时一班） 石录
11 阳春 – 岗美 6:20 – 18:10 （每 20 分钟一班） 公共汽车
12 阳春 – 合水 6:30 – 19:00 （每 20 分钟一班） 公共汽车 二运发车
13 阳春 – 潭水 6:00 – 18:30 （每 20 分钟一班） 公共汽车
14 阳春 – 黄牛头 6:30 – 18:40 （每 30 分钟一班） 公共汽车 二运发车
15 阳春 – 河口 6:40 – 16:30 （每 1 小时一班） 公共汽车
16 阳春 – 锡山 6:15 – 18:30 （每 30 分钟一班） 公共汽车
17 春湾 – 石望 7:00 – 17:30 （每 30 分钟一班） 公共汽车
18 三甲 – 山坪 7:10 – 17:00 （每 30 分钟一班） 公共汽车
19 阳春 – 蟠龙 8:00 – 16:00 （每 2 小时一班） 公共汽车 二运发车