4

Mobile Phone Programming - Aalborg Universitetmobiledevices.kom.aau.dk/fileadmin/mobiledevices/teaching/summe… · 13 Create new project seksdfsdf • Select target and press run

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Mobile Phone Programming - Aalborg Universitetmobiledevices.kom.aau.dk/fileadmin/mobiledevices/teaching/summe… · 13 Create new project seksdfsdf • Select target and press run

1

Mobile Phone Programming

Quick Start Qt

2

Agenda

Lecture 1: Qt quick startLecture 2: Qt coreLecture 3: Mobile development overview (iPhone, Windows Phone 7 and Java ME). Lecture 4: Qt Project, Tools & Qt DesignerLecture 5: Qt Widgets & Nice to know Qt classes

Lecture 6: Qt MobilityLecture 7: Qt Networking and general networkingLecture 8: Deploy your applications. Mobile app. stores etc.Lecture 9: Android part 1Lecture 10: Android part 2

� Objectiveso Get up and running with the Qt SDK

Page 2: Mobile Phone Programming - Aalborg Universitetmobiledevices.kom.aau.dk/fileadmin/mobiledevices/teaching/summe… · 13 Create new project seksdfsdf • Select target and press run

7

Running "hello world"

� Lets get started by creating and running a "hello world" on the desktop, in the Qt simulator, on Symbian and Maemo

� Download and install Nokia Qt SDK� Download and install the appropriate desktop SDK � Launch Qt Creator� Create a new project� Add source files� Compile and run on the target devices

8

Installation:

� Download preferred version for your platformo Offline to download the entire SDK in one package

(update later).o Online to let installer get latest version.

� For Windows, run setup.� For Linux

o chmod u+x installer_filenameo ./installer_filename

9

Create new project:

2

� File -> New File or Project � Empty Qt project

� Set project name and

location

1

10

Create new project

� Select the targets you want to support

� Finish the project

creation

4

3

11

Create new project

� Right click project -> Add New

� Select C++ source file.

o Name: main.cppo Path: project path

(default)

� Accept default project

management options and finish.

12

Create new project� Adding our "hello world" source code to the empty main.cpp

#include <QtGui>

int main(int argc, char *argv[]){ QApplication app(argc, argv);

QLabel *label = new QLabel("hello world"); label->show(); return app.exec();}

Page 3: Mobile Phone Programming - Aalborg Universitetmobiledevices.kom.aau.dk/fileadmin/mobiledevices/teaching/summe… · 13 Create new project seksdfsdf • Select target and press run

13

Create new project

seksdfsdf

� Select target and press run 14

Hello World - Elements

� QApplicationo One per GUI applicationo Manages application wide resources.o Contains the application event loop (handles mouse

clicks, etc.).� QLabel

o Qt GUI element (called a Widget)o Useful for displaying text and images

#include <QtGui>

int main(int argc, char *argv[]){ QApplication app(argc, argv); QLabel *label = new QLabel("hello world"); label->show(); return app.exec();}

15

Nokia Qt SDK: Simulator

� Efficient Testingo Quick Launcho Scripting possibilitieso Simulate phone events &

Qt mobility eventso Skins for different platformso Not a full phone emulator.

16

Launching Qt Simulator

� Run "hello world" in simulatoro Select Qt Simulator targeto Click play

17

Run "hello world" on the N900

� Two options:o Full Linux Environment

(Scratchbox) o Nokia Qt SDK (based on

MADDE)

� Using Nokia Qt SDKo Setup deviceo Select the Maemo targeto Press the run button

http://doc.qt.nokia.com/sdk-1.1/creator-developing-maemo.html 18

Running on Symbian

� Building Symbian applications is currently best supported using a Windows host, or:o Use of Remote Compiler o Use of GnuPoc tools

� Depending on the device OS we have to install some

prerequisites: � path\NokiaQtSDK\Symbian\sis\qt_installer.sis - Qt libraries� path\NokiaQtSDK\Symbian\sis\qtmobility.sis - Qt Mobility

� Install by sending files over Bluetooth or use Nokia PC Suite

or Ovi Suite

Page 4: Mobile Phone Programming - Aalborg Universitetmobiledevices.kom.aau.dk/fileadmin/mobiledevices/teaching/summe… · 13 Create new project seksdfsdf • Select target and press run

19

Automatic Deployment & On-Device Debugging

� Requires debug agent running on device: App Trk� Install:

o path\NokiaQtSdk\Symbian\sis\s60_5_0_app_trk_3_x_x.sisx

o Install to phone memory (C:\)o Also required on Symbian^3 devices

� Start the TRK application on the deviceo Create connection via Bluetooth or USBo Recommended: USB

http://doc.qt.nokia.com/sdk-1.1/creator-developing-symbian.html

20

Using Qt Creator

Demo

22

Exercises

� Install the SDK on you computer� Create and run "hello world". � Try some examples.