Upload
qt-project
View
1.778
Download
1
Tags:
Embed Size (px)
DESCRIPTION
The Qt Mobility project is developing new Qt APIs. These APIs will benefit all Qt developers. This presentation shall provide an overview of the APIs and demonstrate the use of some the APIs through an example application. This presentation shall fuel ideas for usage of the new APIs in your own projects. Presentation by Alex Luddy held during Qt Developer Days 2009. http://qt.nokia.com/developer/learning/elearning
Citation preview
The Mobility ProjectAlex Luddy
Purpose
• Fuel your ideas for using the Qt APIs from the
Mobility project
1
Agenda
• Background
• Content Overview
– Some examples
• Questions
2
Traditional Qt
3
Qt Going Forward
4
Mobility Project
5
Mobility and Applications
6
Qt Mobility Details
• The Mobility project is creating Qt APIs
• APIs will have supported functional back-ends on
all platforms where it makes sense
• Some APIs on Qt labs now
7
The Story of Bob the Developer
• Wants to make a mobile application
• Wants the application to be cross-platform
• A Web feed reader…
8
Bearer Management
• Enables roaming between
connections
• Choose most appropriate
connection
• Manage connections
9
Bearer Management
10
Bearer Management Demo
11
Bearer Management Example
class BearerCloud : public QGraphicsScene
{
// ...
QNetworkConfigurationManager manager;
};
12
Bearer Management Example
connect(&manager,
SIGNAL(configurationAdded(QNetworkConfiguration)),
this, SLOT(configurationAdded(QNetworkConfiguration)));
connect(&manager,
SIGNAL(configurationUpdated(QNetworkConfiguration)),
this, SLOT(configurationUpdated(QNetworkConfiguration)));
13
Bearer Management Example
void BearerCloud::configurationAdded(
const QNetworkConfiguration& configuration)
{
const QNetworkConfiguration::StateFlags state =
config.state();
// position in cloud based on state
}
14
Back to Bob
• Efficient Internet connection
• Web feed reader with contact interest
information…
15
Contacts
• Work with contact data
• Add custom data
• Introspect contact data
• Enumerate contact stores
– Local and remote
16
Contacts
17
Contacts Example: Show Contacts
// prepare fetch request
QContactManager* manager = new QContactManager();
QContactFetchRequest* fetchRequest = new QContactFetchRequest;
fetchRequest->setManager(manager);
connect(fetchRequest,
SIGNAL(progress(QContactFetchRequest*,bool)), this,
SLOT(showContacts(QContactFetchRequest*,bool)));
m_fetchRequest->start()
18
Contacts Example: Show Contacts
void Example::showContacts(QContactFetchRequest* request,
bool appendOnly)
{
QList<QContact> results = request->contacts();
// handle append only case
// access contacts for display
for (int i = 0; i < results.size(); ++i) {
QString display = results[i].displayLabel().label();
// ...
19
Back to Bob
• Efficient Internet connection
• Access contact details
– Add “interest” as custom data
• Web feed reader that can send messages to
contacts about relevant information..
20
Messaging
• Send (Email, SMS, MMS)
• Work with stored/remote messages
• Access message accounts
• New message notifications
• Retrieve
21
Messaging
22
Messaging Example: Send Message
// get to address
QString to =
contact.detail<QContactEmailAddress>().emailAddress();
// prepare message
QMessage message;
message.setType(QMessage::Email);message.setTo(QMessageAddress(to, QMessageAddress::Email));message.setSubject(“Boating”);message.setBody(“Here is a link you might like...”);
23
Messaging Example: Send Message
// send
QMessageServiceAction service;
connect(&service, SIGNAL(stateChanged(QMessageServiceAction::State)), this, SLOT(stateChanged(QMessageServiceAction::State)));
service.sendMessage(message);
// check send result
void MessageSender::stateChanged(QMessageServiceAction::State state)
{if (state == QMessageServiceAction::Successful)
// all good
24
Back to Bob
• Efficient Internet connection
• Access contact details
• Send messages to contacts
• The “I am going to be late”
application…
25
Location
• Where am I?
– Stream location data
• Be notified when within range of a
location
• Underlying location technology
agnostic
26
Location
27
Location Demo
28
Location Example
// create source
source = new QNmeaPositionInfoSource(
QNmeaPositionInfoSource::SimulationMode, this);
// open NMEA data file and set as device for source
source->setUpdateInterval(1500);
connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),
this, SLOT(positionUpdated(QGeoPositionInfo)));
29
Location Example
void MapWindow::positionUpdated(const QGeoPositionInfo& info)
{
if (info.hasProperty(QGeoPositionInfo::Heading))
// ...
QString url = /* ... */
.arg(QString::number(
info.coordinate().latitude()))
// ...
30
Back to Bob
• Efficient use of network
• Accessing contact details
• Sending messages to contacts
• Knows where user is
31
Other APIs for Application Developers
• Multimedia
• System Information
• Calendar (coming next year)
• Sensors (coming next year)
• More to come…
32
System Developer APIs
• Use case is focused more on development of a
system rather than an application
• Publish and subscribe
• Service framework
33
Publish and Subscribe
• Unifies various sources of hierarchical data into a
single consistent model
• Uses QVariant
/Device/Buttons = 3
/Device/Buttons/1/Name = Context
/Device/Buttons/1/Usable = true
/Device/Buttons/2/Name = Select
34
Service Framework
• Discover and work with
services
• Central service registry
• XML definition
• Out-of-process support
coming next year
35
Service Framework
36
Content Summary
• Bearer Management, Contacts, Messaging,
Location, Multimedia, System Information,
Publish and Subscribe, Service Framework
• …
37
Summary
• Rich cross-platform applications
• Qt brilliant developer offering everywhere
38
Questions
• http://labs.qt.nokia.com/page/Projects/QtMobility
• All API feedback appreciated
39