Plasma/DeveloperGuide: Difference between revisions
choosing a category, from PIG |
No edit summary |
||
Line 3: | Line 3: | ||
=Introduction= | =Introduction= | ||
This guide explains the basic steps to build a fully integrated application. This guide is targeted at developers with basic knowledge of QML. It guides through the complete process of developing an application from scratch. | |||
Plasma allows to write applications that work well on different form factors or devices. Plasma is built to adapt to different input methods (mouse, touch, keyboard, etc.) screen sizes and to be resolution-independent. Most of the information in this guide is applicable to all form factors. Topics that may differ for different form factors are indicated as such. | |||
A well-architectured Plasma application will be able to offer different user interface per form factor. For desktops, a landscape layout with quite a lot of space for display and interaction can be used, while the same underlying components in a different, portrait-oriented layout can be used to present the user interface on a phone. A tablet user interface may use either, or combine the components in yet another fashion to make the best use of available screen real estate. | |||
In general, Plasma widgets such as buttons and other controls, work well on touch, mouse and with keyboard input, but can be switched at application start or runtime, transparently to the application using it. | |||
==Is this guide for you?== | |||
Plasma makes extensive use of QtQuick and QML to write the user interface and business logic of your application. Basic understanding of QtQuick is necessary, though Plasma is also a great environment to learn by doing it. This guide targets developers that are familiar with common programming paradigms, but do not have special knowledge of the Plasma APIs, libraries and mechanisms to solve certain problems. | |||
Many things can be implemented without knowing or being able to write C++ code. Plasma provides high-level APIs to solve a great number of tasks and provide common functionality such as retrieving data, displaying information as well as widgets for common interaction patterns and themes and artwork to make your app beautiful and consistent. | |||
In some cases, or in more complex apps, you may extend the functionality by writing a C++ plugin (or "import"). This allows to access custom functionality in your system, leverage an existing library, or move logic into a type-safe language that is easier to test (using unit tests, for example) or performs better. | |||
==App, Plasmoid, or both?== | ==App, Plasmoid, or both?== | ||
Line 8: | Line 23: | ||
- app vs plasmoid | - app vs plasmoid | ||
=An app in 5 easy steps= | |||
- download template | |||
- hack application | |||
- metadata.desktop & main.qml | |||
==install and test with plasmoidviewer== | |||
kpackagetool5 -i basic | |||
==Software Stack | kpackagelauncherqml -a org.kde.example.developerguide.basic | ||
kpackagetool5 -r basic | |||
- kpackagelauncherqml & .desktop file | |||
=Requirements Analysis & Design== | |||
=Software Stack= | |||
- QML / QtQuick: ui primitives, app logic, rendering, states | - QML / QtQuick: ui primitives, app logic, rendering, states | ||
Line 18: | Line 50: | ||
- kpackage | - kpackage | ||
Line 36: | Line 67: | ||
===metadata.desktop=== | ===metadata.desktop=== | ||
- system integration (systray, alternatives, mimetypes, arguments, formfactors) | - system integration (systray, alternatives, mimetypes, arguments, formfactors) | ||
====Choosing a Category==== | ====Choosing a Category==== | ||
The following are acceptable known entries for plasmoids and applets. If your applet does not fall within one of the following categories, leave the category field empty (it will be automatically categorized under "Miscellaneous" for the time being) and contact the Plasma development team to have a suitable category added to the list (at which point you may then use that category). | The following are acceptable known entries for plasmoids and applets. If your applet does not fall within one of the following categories, leave the category field empty (it will be automatically categorized under "Miscellaneous" for the time being) and contact the Plasma development team to have a suitable category added to the list (at which point you may then use that category). | ||
Line 58: | Line 88: | ||
*'''Utilities''' Useful tools like calculators | *'''Utilities''' Useful tools like calculators | ||
*'''Windows and Tasks''' managers for application windows and/or tasks, such as taskbars | *'''Windows and Tasks''' managers for application windows and/or tasks, such as taskbars | ||
===installation=== | ===installation=== |
Revision as of 15:19, 25 August 2015
The Ultimate Guide to Plasma Development
Introduction
This guide explains the basic steps to build a fully integrated application. This guide is targeted at developers with basic knowledge of QML. It guides through the complete process of developing an application from scratch.
Plasma allows to write applications that work well on different form factors or devices. Plasma is built to adapt to different input methods (mouse, touch, keyboard, etc.) screen sizes and to be resolution-independent. Most of the information in this guide is applicable to all form factors. Topics that may differ for different form factors are indicated as such.
A well-architectured Plasma application will be able to offer different user interface per form factor. For desktops, a landscape layout with quite a lot of space for display and interaction can be used, while the same underlying components in a different, portrait-oriented layout can be used to present the user interface on a phone. A tablet user interface may use either, or combine the components in yet another fashion to make the best use of available screen real estate. In general, Plasma widgets such as buttons and other controls, work well on touch, mouse and with keyboard input, but can be switched at application start or runtime, transparently to the application using it.
Is this guide for you?
Plasma makes extensive use of QtQuick and QML to write the user interface and business logic of your application. Basic understanding of QtQuick is necessary, though Plasma is also a great environment to learn by doing it. This guide targets developers that are familiar with common programming paradigms, but do not have special knowledge of the Plasma APIs, libraries and mechanisms to solve certain problems.
Many things can be implemented without knowing or being able to write C++ code. Plasma provides high-level APIs to solve a great number of tasks and provide common functionality such as retrieving data, displaying information as well as widgets for common interaction patterns and themes and artwork to make your app beautiful and consistent.
In some cases, or in more complex apps, you may extend the functionality by writing a C++ plugin (or "import"). This allows to access custom functionality in your system, leverage an existing library, or move logic into a type-safe language that is easier to test (using unit tests, for example) or performs better.
App, Plasmoid, or both?
- app vs plasmoid
An app in 5 easy steps
- download template - hack application - metadata.desktop & main.qml
install and test with plasmoidviewer
kpackagetool5 -i basic
kpackagelauncherqml -a org.kde.example.developerguide.basic
kpackagetool5 -r basic
- kpackagelauncherqml & .desktop file
Requirements Analysis & Design=
Software Stack
- QML / QtQuick: ui primitives, app logic, rendering, states - imports - Plasma libs - underlying frameworks - runtime environment - kpackage
Getting Started
Developing a Plasmoid
Creating the empty package
filesystem structure
metadata.desktop
- system integration (systray, alternatives, mimetypes, arguments, formfactors)
Choosing a Category
The following are acceptable known entries for plasmoids and applets. If your applet does not fall within one of the following categories, leave the category field empty (it will be automatically categorized under "Miscellaneous" for the time being) and contact the Plasma development team to have a suitable category added to the list (at which point you may then use that category).
- Accessibility tools that help those with special needs or disabilities use their computer
- Application Launchers application starters and file openers.
- Astronomy anything to do with the night sky or other celestial bodies.
- Date and Time clocks, calendars, scheduling, etc
- Development Tools tools and utilities to aid software developers
- Education teaching and educational aides
- Environment and Weather add-ons that display information regarding the weather or other environmentally related data
- Examples samples that are not meant for production systems
- File System anything that operates on files or the file system as it's primary purpose, such as file watchers or directory listings. Simply using a file as storage does not qualify the add-on for this category.
- Fun and Games for games and amusements
- Graphics for add-ons where displaying images, photos or graphical eye candy is the primary purpose
- Language add-ons whose primary purpose is language related, such as dictionaries and translators.
- Mapping geography and geographic data add-ons
- Multimedia music and video.
- Online Services add-ons that provide an interface to online services such as social networking or blogging sites. If there is another more appropriate category for the add-on given the topic (e.g. mapping if the applet's purpose is to show maps), even if the data is retrieved from the Internet prefer that other category over this one.
- System Information display and interaction with information about the computer such as network activity, hardware health, memory usage, etc
- Utilities Useful tools like calculators
- Windows and Tasks managers for application windows and/or tasks, such as taskbars
installation
- cmake - plasmapkg2
Starting the Code
main.qml stuffz
- Layouts - plasmoid object - fullRepresentation vs. popup
Plasma API
+ links to API documentation! - PlasmaCore - PlasmaComponents - PlasmaExtras - kdeclarative's useful stuff: kcmOpen? more useful imports
- general guidelines: units, iconSizes,
Development Environment Setup
Tools
- editor - commandline - plasmapkg2 - plasmoidviewer - plasmathemething - cuttlefish -
Display and Rendering
- theming - image display - dpi - ColorScope - Wayland vs. X11
Supporting Multiple Devices
- touch friendliness - layout considerations - formfactor support (X-KDE-FormFactors) - touch-specific overrides
Workspace Integration
- system tray - plasmoid status - dbus autoload
Translations
- i18n() & friends - making sure i18n is set up & how to x-test
Distribution
- plasmoid package - appstream metadata - kdeapps online installation - distros - upstreaming code