3. Adapt instead of dumbing down
● Different interfaces for different devices
● UI as thin layer
● Switchable input profiles (part of the platform, “for free”)
● Switchable layouts (per app, usually one file per device)
● Work with different input methods
● Reusable components
Developing Device-Adaptive Apps – General
4. Technologies
● Qt / QML
● KDE libraries
● UI profile switchable by env var
● Reusable components
Developing Device-Adaptive Apps – General
5. Developer Story
● Chad – casual hacker, familiar with web technologies
● Plasmate introduces Chad to Plasma
● Lwing – experienced C++ developer, own codebase
● Lwing ports, develops and packages her applications using the Mer SDK
● Brian – KDE Hacker
● Brian is part of the KDE team and regularly contributes patches
Developing Device-Adaptive Apps – General
9. Qt Quick Anchor Layouts
• Align objects to each other
• Useful for flexible layouts
• Dynamic sizing of objects: Scales well
• Surprisingly painless and logical
• Very powerful
Developing Device-Adaptive Apps – QtQuick Intro
11. QML & C++ Hybrids: Basics
● QML can be extended using C++
● Getting data from C++ to QML:
● setContextProperty()
● qmlRegisterType()
● Creating new imports (careful, public API!)
● QObject as base class
● Q_PROPERTY() for getter, setter, notify
● Q_INVOKABLE() for methods
Developing Device-Adaptive Apps – Advanced QML
12. QML & C++ Hybrids: Models
● QStringList – really basic, “modelData” holds your string
● QList<QObject*> – useful for smallish lists
● QAbstractItemModel – Full power, full control, full pain
• http://qt-project.org/doc/qt-4.8/qdeclarativemodels.html
• http://qt-project.org/doc/qt-4.8/qdeclarativemodels.html#qml-c-models
•
http://steveire.wordpress.com/2010/02/19/qml-with-akonadi-or-how-to-use-your-existing-model-view
• http://sf2011.meego.com/program/sessions/data-models-qml
Developing Device-Adaptive Apps – Advanced QML
16. Tips & Tricks
● git clone kde:kdeexamples → plasma/declarative/*
● Use PlasmaComponents.Label instead of Text
● Think about splitting into reusable components
● grep in kde:declarative-plasmoids and kde:plasma-mobile
● Rectangle { color: “orange”; opacity: 0.3; anchors.fill: parent; }
inside your Item helps finding sizing problems
Developing Device-Adaptive Apps – Tips & Tricks
17. Plasmate
Workflow-driven IDE for Plasmoids:
● Create – Hack – Test – Deploy – Publish
● 1.0 end of summer
● Clone from git://anongit.kde.org/plasmate
● Build using cmake (needs kdelibs-devel)
● Start hacking
Developing Device-Adaptive Apps – SDK “light”
18. Mer SDK
Chroot environment with everything pre-setup
● Work in progress: involves a bit of manual setup
● Easy way to cross-compile
● Easy way to build packages for $DEVICE
● Takes complexity away big time
Developing Device-Adaptive Apps – Limitless SDK
19. Help!
• #plasma on Freenode
• plasma-devel@kde.org
Sebastian Kügler