lamad n.
Skip this Video
Loading SlideShow in 5 Seconds..
LAMAD PowerPoint Presentation


227 Views Download Presentation
Download Presentation


- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. LAMAD Symbian Qt 17.3.2013

  2. Symbian OS

  3. Symbian OS One of the first modern mobile operating systems Most popular smartphone OS until the end of 2010 Main Nokia OS until 2011 Maintained by Accenture Nokia 808 PureView is the last ever Symbian smartphone

  4. Symbian OS + True multi-tasking operating system + Wide range of available phones (from cheap keypad-based to large touchscreen smartphones) + Still has a big user base, especially in developing countries - More suited for non-touch keypad devices - Slow and outdated - Declining user base Initial partners of Symbian OS

  5. S60 3rd edition For keypad-only devices Nokia C5 Nokia E72 Nokia N95 Nokia E52

  6. S60 5th edition Touch and touch&type devices Nokia N97 Nokia C5-03 Nokia E5 Nokia 5800

  7. Symbian^3 For touchscreen devices Multiple home screens Better hardware Nokia C7 Nokia E7 Nokia N8 Nokia 808

  8. Market share 2012

  9. Developing for Symbian 3 options available

  10. Java ME + Easy memory management + Easy to develop + Application can be ported to S40 Asha (Nokia’s feature-phone OS) - Lack of APIs(maps, navigation, UI controls) - Limited access to hardware - Needs certification and signing - Limited subset of Java

  11. Symbian C++ Subset of C++ + Full access to hardware + Low memory footprint + Good profiling and debugging tools - Lack of APIs (maps, navigation, UI controls) - Steep learning curve - Difficult memory management - Needs certification and signing

  12. Qt Framework + Good set of UI controls + Good customization options + Fast to develop + Application can be deployed for MeeGo with minor changes - Large memory footprint on older Symbian versions - Lack of Symbian emulator (although Qt Simulator can simulate Qt on Symbian) - The Mobility package can have some bugs

  13. Qt – Introduction

  14. What is Qt? “Qt is a cross platform developmentframework written in C++.” C++ framework – bindings for other languages Python, Ruby, C#, etc. Originally for user interfaces – now for: Databases, XML, WebKit, multimedia, networking, OpenGL, scripting, location, telephony, non-GUI...

  15. Desktop target platforms • Windows • Mac OS X • Linux/Unix X11

  16. Mobile target platforms • Windows CE • Symbian • Maemo/MeeGo • Embedded Linux

  17. What is Qt? Qt is made up of modules All modules have a common scheme and are built from the same API design ideas QtCore QtGui QtMobility QtOpenGL QtWebKit QtNetwork QtXml Phonon QtOpenVG QtSql QtScript QtXmlPatterns QtMultimedia QtSvg

  18. What is Qt? Qt extends C++ with macros and introspection All Qt object inherit QObject base class All code is still plain C++ //foreach macro foreach(intvalue,intList){…} //QObject is the base class of Qt QObject*o=newQPushButton; o->metaObject()->className();//returns”QPushButton” //Event handling with signal and solts connect(button,SIGNAL(clicked()),window,SLOT(close()));

  19. Getting Qt • Easiest way to get started is to download Qt SDK. It contains: • Qt headers and documentation • Pre-built Qt libraries and tools • The QtCreator integrated development environment

  20. Windows Installation • Download the Qt SDK for Windows • Run the downloaded installer • Click through the installer • Start QtCreator from the start menu

  21. Hello World Linux Mac Windows #include<QApplication> #include<Qlabel> intmain(intargc,char**argv){ QApplicationapp(argc,argv); QLabell("HelloWorld!");; returnapp.exec(); } Symbian

  22. Qt – QObject

  23. The QObject QObject is the base class of almost all Qt classes and all widgets It contains many of the mechanisms of Qt: • events • signals and slots • properties • memory management

  24. The QObject QObject is the base class to most Qt classes. Examples of exceptions are: • Classes that need to be lightweight such as graphical primitives • Data containers (QString, QList, QChar, etc) • Classes that needs to be copyable, as QObjects cannot be copied

  25. Meta data Qt implements introspection in C++ Every QObject has a meta object The meta object knows about: • class name (QObject::className) • inheritance (QObject::inherits) • properties • signals and slots • general information (QObject::classInfo)

  26. QObject must be inherited first (could be indirect) The Q_OBJECT macro, usually first General info about the class Qt keywords Meta data How meta data is generated? classLocationHandler:publicQObject{ Q_OBJECT Q_CLASSINFO("author","Mopsi") Q_PROPERTY(QGeoPositionInfolocation READlocation WRITEsetInitialLocation) public: LocationHandler(constint&desiredAccuracy,QObject*parent=0); QGeoPositionInfolocation() const; publicslots: voidsetInitialLocation(constQGeoPositionInfo&aLocation); signals: voidlocationChanged(QGeoPositionInfo); private: QGeoPositionInfom_location; };

  27. Getter, const, returns value, takes no arguments Setter, returns void, takes value as only argument Macro with property declaration Private state QObject properties QObject has properties with getter and setter methods Naming policy: color, setColor For booleans: isEnabled, setEnabled classLocationHandler:publicQObject{ Q_OBJECT Q_CLASSINFO("author", "Mopsi") Q_PROPERTY(QGeoPositionInfolocation READlocation WRITEsetInitialLocation) public: LocationHandler(const int &desiredAccuracy, QObject *parent=0); QGeoPositionInfolocation() const; publicslots: voidsetInitialLocation(constQGeoPositionInfo&aLocation); signals: void locationChanged(QGeoPositionInfo ); private: QGeoPositionInfom_location; };

  28. Using properties Direct access Through the meta info and property system Discover properties at run-time QStringtext=label->text(); label->setText("HelloWorld!"); QStringtext=object->property("text").toString(); object->setProperty("text","HelloWorld"); intQMetaObject::propertyCount(); QMetaPropertyQMetaObject::property(i); QMetaProperty::name/isConstant/isDesignable/read/write/...

  29. parent deletes box and button box deletes option1 and option2 Memory Management QObject can have parent and children When a parent object is deleted, it deletes its children This is used when implementing visual hierarchies. QDialog*parent=newQDialog(); QGroupBox*box=newQGroupBox(parent); QPushButton*button=newQPushButton(parent); QRadioButton*option1=newQRadioButton(box); QRadioButton*option2=newQRadioButton(box); deleteparent; parent box button option1 option2

  30. Qt – Signals and slots

  31. Signals and Slots Is the default event handling mechanism in Qt Dynamically and loosely ties together events and state changes with reactions It’s what makes Qt tick //Event handling with signal and solts connect(button,SIGNAL(clicked()),window,SLOT(close()));

  32. Signals and Slots in Action emit clicked();

  33. Signals and Slots in Action connect(trackingButton,SIGNAL(clicked()), this, SLOT(showTrackingScreen()));24 private slots: voidshowTrackingScreen();

  34. Signals and Slots vs Callbacks A callback is a pointer to a function that is called when an event occurs, any function can be assigned to a callback • No type-safety • Always works as a direct call Signals and Slots are more dynamic • A more generic mechanism • Easier to interconnect two existing classes • Less knowledge shared between involved classes

  35. Qt – User interface

  36. QLabel QScrollBar QLineEdit QPushButton QDoubleSpinBox Qt Widgets User interfaces are built from individual widgets 46 widgets in Designer 59+ direct descendants from QWidget

  37. Qt Quick Qt Quick is the alternative to Qt Widgets Qt Quick consists of • QML – the language (similar to JavaScript) • Designed for building device user interfaces • Can be used in other application too • Qt Declarative – the Qt module • Contains the QML engine, context and view • Qt bindings for QML • Mechanisms for integrating C++ and QML There is tooling support in Qt Creator Qt Quick supported ONLY in Symbian^3 and desktop

  38. Traits of a Widget Occupies a rectangular area of the screen Receives events from input devices Emits signals for “notable” changes Are structured in a hierarchy Can contain other widgets

  39. Cross Platform Styles Widgets are drawn using a platform specific style to ensure a native look

  40. Using Designer drag-and-drop

  41. Using the Code #ifndef MOPSIMAINSCREEN_H #define MOPSIMAINSCREEN_H #include <QWidget> namespaceUi { classMopsiMainScreen; } classMopsMainScreen: publicQWidget { Q_OBJECT public: MopsiMainScreen(QWidget *parent=0); ~MopsiMainScreen (); private: Ui::MopsiMainScreen *ui; }; #endif // MOPSIMAINSCREEN_H Forward declaration of the Ui::MopsiMainScreen class Basically a standard QWidget derived class A Ui::Widget pointer, ui, refers to all widgets

  42. Using the Code #include “mopsimainscreen.h" #include "ui_widget.h" MopsiMainScreen::MopsiMainScreen (QWidget *parent) : QWidget(parent), ui(newUi:: MopsiMainScreen) { ui->setupUi(this); } MopsiMainScreen::~MopsiMainScreen() { deleteui; } Instanciates the Ui::MopsiMainScreen class as ui Calls setupUi, creating all the widgets as children to the given parent (this). Deletes the ui object

  43. Style sheets For highlighting and cross platform styling, all QWidget classes have a styleSheet property To style an entire application: QApplication::setStyleSheet Style sheets are inspired from CSS No stylesheet QToolButton { background-color: blue; color: white; text-align: center; font-size: 14pt; }

  44. Style sheets The easiest way to apply a style sheet to an individual widget is to use Designer

  45. Qt – Internet

  46. Accessing internet QtWebKit classes uses the QNetworkAccessManager Provides access to web: • Independent of UI • Handle requests and replies • Cache web pages • Keep track of cookies • Use proxies • Act as a protocol translator networkAccessManager=newQNetworkAccessManager(this); connect(networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(parseResponse(QNetworkReply*)));

  47. Classes for Network Access QNetworkRequest QNetworkReply QNetworkAccessManager QNetworkProxyFactory QNetworkCookieJar QAbstractNetworkCache

  48. Accessing HTTP programatically Example – download a file via HTTP using QNetworkAccessManager QNetworkAccessManager*manager=newQNetworkAccessManager(this); connect(manager,SIGNAL(finished(QNetworkReply*)),this, SLOT(downloadDone(QNetworkReply*))); manager->get(QNetworkRequest(QUrl(""))); InternetUtil::downloadDone(QNetworkReply*reply){ QImageReaderreader(reply,"png");; emiticonDownloaded(mImage); reply->deleteLater(); }

  49. Qt – Location

  50. Location