class: title-slide # There's a Framework for That! ## Seven and a Half Seconds of Fame Adriaan de Groot September 8th, 2019 --- # A little history .left-column[ ## KDE Frameworks Replace monolithic *kdelibs4* with something easier to use. Something - lightweight, - self-contained, - focused, - easier to consume externally. *Cool extensions to Qt* ] .right-column[ ## History - July 1st, 2014 - ECM from the start - 53 libraries in the first release - 72 in 5.61 on August 3rd, 2019 ] --- # That's great! ## it starts with an .. --- # Tier 1 .left-column[ ## Extra-CMake-Modules Support for finding and managing all the frameworks ] .right-column[ ## Earthquake
![Earthquake](earthquake.png) ] --- # Tier 1 .left-column[ ## Attica Open Collaboration Services API ## KUserFeedback User feedback framework ] .right-column[ ## Birds
![Birds](bird.png) ] --- # Tier 1 .left-column[ ## BreezeIcons Breeze icon theme ## Oxygen-icons Oxygen icon theme ## QQC2-Desktop-Style QtQuickControls 2 style that integrates with the desktop ] .right-column[ ## Snakes
![Snakes](snake.jpg) ] --- # Tier 1 .left-column[ ## BluezQt Qt wrapper for BlueZ 5 DBus API ## ModemManagerQt Qt wrapper for ModemManager API ## NetworkManagerQt Qt wrapper for NetworkManager API ## Solid Hardware integration and detection ] .right-column[ ## Aeroplanes
![Aeroplane](airplane.png) ] --- # Tier 1 .left-column[ ## KHolidays Holiday calculation library ## KI18n Advanced internationalization framework ] .right-column[ ## Lenny Bruce
![Lenny Bruce](lenny.jpg) ] --- # Tier 1 .left-column[ ## Kirigami2 QtQuick plugins to build user interfaces based on the KDE human interface guidelines ## KItemModels Models for Qt Model/View system ## KItemViews Widget addons for Qt Model/View ## Quick Charts A QtQuick module providing high-performance charts. ] .right-column[ ## Eye of a Hurricane
![Hurricane](hurricane.jpg) ] --- # Tier 1 .left-column[ ## Prison Barcode abstraction layer providing uniform access to generation of barcodes ] .right-column[ ## Listen to yourself churn
![Butter Churn](churn.jpg) ] --- # Tier 1 .left-column[ ## KApiDox Scripts and data for building API documentation (dox) in a standard format and style ] .right-column[ ## World serves its own needs
![World](earth.jpg) ] --- # Tier 1 .left-column[ ## ThreadWeaver High-level multithreading framework ] .right-column[ ## Speed it up a notch
![Speedometer](speed.jpg) ] --- # Tier 1 .left-column[ ## KSyntaxHighlighting Syntax Highlighting ## Sonnet Support for spellchecking ] .right-column[ ## Grunt
![Grunt](grunt.png) ] --- # Tier 1 .left-column[ ## KArchive File compression ## KCodecs Text encoding ] .right-column[ ## Strength
![Arm](arm.png) ] --- # Tier 1 .left-column[ ## KCoreAddons Addons to QtCore ## KDBusAddons Addons to QtDBus ## KGuiAddons Addons to QtGui ## KWidgetsAddons Addons to QtWidgets ] .right-column[ ## The ladders clatter
![Ladder](ladder.jpg) ] --- # Tier 1 .left-column[ ## KWayland Qt-style API to interact with the wayland-client and wayland-server API ## KWindowSystem Access to the windowing system ] .right-column[ ## Wire in a fire
![Firewire](fw.png) ] --- # Tier 1 .left-column[ ## KConfig Configuration system ## KDNSSD Abstraction to system DNSSD features ] .right-column[ ## Wasn't coming in a hurry
![Hurriers](hurry.jpg) ] --- # Tier 1 .left-column[ ## KIdleTime Monitoring user activity ## KPlotting Lightweight plotting framework ] .right-column[ ## Furies breathing down your neck
![Furies](fury.jpg) ] --- .left-column[ .. and that's just Tier 1, the little libraries. Tiers 2, 3 and 4 build higher and further. ] .right-column[ ![Slow](slow.png) ] --- class: title-slide # KCoreAddons ## Addons to QtCore --- . # KCoreAddons **Still** 30 classes of awesomeness in 670kB - About this application - Jobs - Plugins - System information
So let's pick just two bits: `KOSRelease` and `KWordMacroExpander`. --- # KCoreAddons ## KOSRelease - `/etc/os-release` is a FreeDesktop standard file - It describes part of the Linux system - Mostly *vendor* information - Mix of text, URLs --- # KCoreAddons ## KOSRelease Why bother? - Parsing the file is pretty trivial - Getting it right once is enough Use it because: - One source of truth about the contents of `/etc/os-release` - Supports alternate paths - Also supported on FreeBSD --- # KCoreAddons ## KOSRelease ``` #include
/* Reporting a bug? */ KOSRelease r; QUrl url( r.bugReportUrl() ); QString description = QStringLiteral( "Bug in %1 %2" ) .arg( r.prettyName(), r.variant() ); ``` --- # KCoreAddons ## KWordMacroExpander - Going beyond `QString::arg()` - But not all the way to Grantlee
The style is familiar to shell, Makefile, CMake .. --- # KCoreAddons ## Talk about $FRAMEWORK $CLASSNAME - Configurable with a command-character - Replaces the word after a command-character
Convenience functions in `KMacroExpander` namespace for **static** replacement.
Class `KWordMacroExpander` is base-class for **dynamic** replacement. --- # KCoreAddons ## KMacroExpander - Free functions in namespace work on a QString - Replacements defined in a QHash - Configurable command-character ``` KOSRelease r; QHash h; h.insert( "NAME", r.prettyName() ); h.insert( "VARIANT", r.variant() ); QString description = KMacroExpander::expandMacros( QStringLiteral( "Bug in $NAME $VARIANT" ), h ); ``` - There's also a single-char-names version --- # KCoreAddons ## KWordMacroExpander Why bother? - `QString::arg()` could do the job - You rarely need unstructured replacement Use it because: - Missing arguments are a mess - Names are easier to understand - Dealing with edge cases (escaping, quoting) is annoying --- class: title-slide # Credits - *End of the World as We Know It (and I feel fine)* by R.E.M. - *Puffin* by
Richard Bartz
-
Own work
,
CC BY-SA 3.0
,
Link
- *Cobra* by
Kamalnv
-
Own work
,
CC BY 3.0
,
Link
--- class: title-slide # Credits - *Churn* by
Musphot
-
Own work
,
CC BY-SA 3.0
,
Link
- *Speed* by
Brian Snelson
from Hockley, Essex, England -
Speedometer
,
CC BY 2.0
,
Link
--- class: title-slide # Credits - *Ladder* by
Amin
-
Own work
,
CC BY-SA 4.0
,
Link
--- class: title-slide # There's a Framework for That! ## Seven and a Half Seconds of Fame https://api.kde.org/frameworks/ (LGPL 2.1)