Archive for the ‘Qt’ Category

new Plasma Quick module: PlasmaExtras

Tuesday, April 3rd, 2012

Plasma Quick is KDE Plasma’s user interface toolkit which brings system and data integration, theming and artwork and tools to build workspace and mobile applications to the world of QtQuick. Plasma Quick provides everything needed to build high-quality apps. PlasmaExtras provides an extended set of Plasma QtQuick components.Active Microblog using Plasma Components and Plasma Extras

In Plasma 4.8, we released a set of QtQuick (QML) components that are providing an implementation of Qt Quick’s standard component API. While QtQuick itself only provides very basic components for texts, for example, Plasma Component’s Text Input adds an integrated look & feel to them. Often, you will find that in your app, you’ll also need a few higher level widgets, ui elements with a higher degree of intgration. PlasmaExtras has now been added to our git master tree, so it will be released with KDE SC 4.9 in July.

So, what does PlasmaExtras contain right now? One very important thing is that it adds an image loader, which allows the runtime to resolve theme-internal URLs, such as image://appbackgrounds/contextarea, giving you themed application backgrounds.

ResourceInstance adds support for Share Like Connect. Basically, ResourceInstance exports the currently viewed or active document (or “Thing” really), identified by a url and a name. Share Like Connect provides a standardised mechanism to share and “like” information. It also gives you the tools to connect a document to an Activity, which makes collecting information on a certain topic easy. Adding share like connect support to your application becomes as easy as:

// Example in an imaginary webbrowser
import org.kde.plasma.extras 0.1 as PlasmaExtras
[...]
    PlasmaExtras.ResourceInstance {
        uri: webbrowser.currentUrl
        name: webbrowser.pageTitle
    }

A default set of animations allows the developer to streamline app-internal animations with the rest of the ui. It also allows us to provide a set of high-quality and fast animations, app developers can just reuse them in their ui:

Button {
    [...]
    onClicked: PlasmaExtras.AppearAnimation { targetItem: infoPopup }
}

If you want to do some work in the background while the animation is playing, you can do it like this:

onClicked: ParallelAnimation {
    ScriptAction { script: thisFunctionMayTakeAWhile() }
    AppearAnimation { targetItem: infoPopup }
}

The ParallelAnimation, which we compose when our button is clicked will start all its children at once. A ScriptAction is not an animation per se, but runs a bit of inlined javascript (usually, you can just call another function here which does the real work). Both are run in parallel, so this pattern can be used to hide computational tasks in an elegant way. This way, you can of course also combine animations, or run them in sequence (using SequentialAnimation { … }).

We’ve also added a few Label subclasses, Title, Heading and Paragraph, which theme the standard Plasma Components Label to provide more consistent layout of static texts.

import org.kde.plasma.extras 0.1 as PlasmaExtras
[...]
Column{
    PlasmaExtras.Title { text: "Fruit sweetness on the rise" }
    PlasmaExtras.Heading { text: "Apples in the sunlight"; level: 2 }
    PlasmaExtras.Paragraph { text: "Long text about fruit and apples [...]" }
    [...]
}

PlasmaExtras QtQuick components

There is also an experimental App class in PlasmaExtras. The goal of this component is a container for apps that is adaptive to the device. It provides a basic workflow pattern around different parts of your app and navigation between them. This is achieved by providing separate areas, such as toolbars, navigation and content. Since we’re still experimenting a bit with this stuff, this one needs a bit more work.

More examples can be found in the gallery app, which is also shown in the screenshot, it’s in the kde-runtime git module under kde-runtime/plasma/declarativeimports/test/. The API documentation gives you an overview about available classes, properties and signals, and also contains code examples. Over time, I expect PlasmaExtras to grow a bit and provide more useful things for developers.

Most of these components have already been in use for some time in Plasma Active. they’ve now “moved up” in the hierarchy being made available on more systems. They are a nice example how work is shared across formfactors in Plasma, and how the Desktop UI benefits from development on mobile systems.

Happy hacking!

Active Settings: Modular, embeddable configuration

Friday, January 6th, 2012

Plasma Active‘s goal is develop an elegant, Free user experience for the device spectrum, for example touch-based tablets. Active Settings is a modular application hosting configuration user interfaces for apps and the system.

With Plasma Active Two, we released a first version of Active Settings, an app that lets you configure a few key parts of your system, such as time settings, and options for web browsing. Plasma Active Two contains a first stable, but still fairly bare-bones release, with only two modules.

Plasma Active's Time and Date settings

Active Settings provides a one-stop shop for app and system settings, and an interface for developer to ship settings user interfaces with their applications, or extend Active Settings with custom, or vendor-specific modules. Active Settings is a shell that loads, and displays a number of modules, in order to add a module, the app doesn’t need any code changes. This is done using KDE’s plugin system and Plasma packages.

Embeddings settings modules

In order to achieve a higher degree of consistency, settings modules can be loaded both from the settings app, and directly inside applications. This is done using a new set of QML bindings, which provide a settings loader item. This item is designed to lazy-load the settings plugin, so you can avoid touching config files, or loading a complex UI on startup and rather do it when the UI is needed, keeping startup times of your app low.

Plasma Active's Time and Date settings

In the screenshots, you can see the web browser module running in the settings app. I’ve also integrated the settings dialog into the dashboard of the web browser, so you can easily change things while browsing. Settings are synchronized across applications.

Workflow and design

Active Settings modules get loaded into the settings app. Often you will find that embedding these pieces of UI into your app makes the workflow more natural, as it puts things into context, which means you don’t have to switch to another app to change settings, both is possible. One of the reasons we want to share this code between apps and the general settings app is to present a more consistent UI. Along with the work on the guts of Active Settings, Thomas Pfeiffer has started to work on a HIG, human interface guidelines for designing settings dialogs. These guidelines complement the implementation nicely, and will make it easier for developers to write apps that feel naturally integrated into the system.
One thing we’re implementing in Active is instant apply of settings, so you’ll only find those “apply” buttons very rarely (we’re still discussing a few corner cases).
Plasma Active's Time and Date settings Active Settings uses the new Plasma QML Components, providing a standard implementation of the Qt Components API. Plasma Components can appear in different variations, in Active we default to the touch-friendly components. This of course makes it easier to share settings dialogs across devices, as we can provide standard widgets optimized for a given input method, screen form factor, etc..

Writing a settings module

We have now made it very easy to write settings plugins. A new set of QML bindings allow loading and embedding dialogs by providing components for the shell and loading of the modules, and a few pre-made bindings for domain-specific settings (time for example). These bindings allow you to ship a Plasma package containing your QML code, data files, images, etc. with your application, and have it available both in the settings app, and also in your own application. You can write pure QML settings modules, and it is very easy to extend your module with C++ code, which is automatically loaded and can export additional functionality to your QML runtime. These plugins are in principle really light-weight with minimal build dependencies (basically QObject, KPluginFactory and kdelibs’ macros for plugins), so deployment is made rather easy. Even if you’re doing a QML-only app, you can still provide a compiled plugin for the settings with it.

The API is designed to be minimal, the plugins can be very light-weight, as they’re basically exporting QObject-deriven classes to the QML runtime. Of course you can go completely wild here. Plasma packages provide a loading mechanisms for “pieces of UI” written in QML. This mechanism makes it very easy to share parts of the UI across different applications. As these packages do not contain compiled code, they’re architecture independent, small and easy to share and deploy. I’ve described the whole process of writing your own Active Settings module on TechBase, so hop over there if you’re interested in more details.

Those familiar with kdelibs’ classes and frameworks such as KControl, System settings, KCModule will not be surprised that much of this architecture has been inspired by these fine shoulders of giants. :)

Plasma Active Perspectives: The App Story

Tuesday, October 11th, 2011

Plasma Active brings a flexible, elegant, activity-driven user experience to a spectrum of devices. This article is part of a series of articles about different perspectives on Plasma Active. In the first installment, we look at a number of applications that come with Plasma Active. Kontact Touch, Calligra Active, Bangarang and a collection of Active Apps provide a stable and powerful set of functionality, making Plasma Active suitable for personal and professional use cases.

Email & Groupware: Kontact Touch

Kontact Touch's mail in Plasma ActiveIn the area of groupware and email, Plasma Active really shines thanks to Kontact Touch, a mature groupware suite designed specifically for touchscreen interfaces. Kontact Touch has all the features already known from its desktop counterpart, among which a vast variety of connectors to groupware servers, among which Exchange and Kolab. For on-the-go use-cases, Kontact Touch’s offline features are a big win, making it easy to catch up on what happened during offline periods. Kontact Touch’s email client performs really well on the underpowered tablet, even for insanely large mailboxes with tens of thousands of emails. Since Kontact Touch’s underlying data cache, Akonadi also feeds its data into the Nepomuk semantic store, all the groupware data is not locked into an application, but naturally available in Contour, becoming part of your activities.
Kontact Touch supports strong encryptions methods in an audible, open source code-base, satisfying even highly security- and privacy-aware use cases. There is a number of companies offering commercial support and services around Kontact Touch, and its integration in enterprise infrastructure.
Kontact Touch with its touch-friendly ergonomic interface, feature set, scalability, groupware server compatibility and strong contender satisfying unique use-cases for enterprise and institutional use-cases, allowing to organically extend an organisations groupware infrastructure onto new devices.

Office: Calligra Active

Another highlight in Plasma Active is Calligra Active. In Plasma Active One, we ship it as a beta version, with a stable follow-up planned for one of the next releases. The first release of Calligra Active will be a capable, performant document, finger-friendly viewer for tablets that can pan and zoom smoothly and display office documents. Calligra comes with excellent support for OpenDocument and compatibility with many of Microsoft’s office applications such as Word, Excel and Powerpoint.
With its capable engine, which is also part of the office suite on Nokia’s N9 and its touch-friendly user experience specifically built around Plasma Active, Calligra Active fills another important role by adding dependable office capabilities to Plasma Active devices.
Calligra Active builds on top of Plasma Quick and semantic engine, bringing a seamless UX between your activities and documents.

Web: Active Browser

The Active BrowserOne of the most important applications on a device is the web browser. For Plasma Active, we have developed a touch-friendly and lean web browser that builds on top of WebKit for HTML rendering, and the kdewebkit integration for cookies, network and SSL, caching and cookie sharing. Some of its features, such as AdBlock could be re-used from the Rekonq project. It uses the bookmarks from Nepomuk and shares these with the Contour shell. Building a customized web browser for Plasma Active ended up being the way to go after we had looked at alternatives, such as making Rekonq touch-friendly, or using Fennec, since the work to adapt these browsers really well would have been too extensive. Designing the browser from the ground up allows us to have it perfectly integrate with the Contour workspace and the rest of the system (such as sharing login credentials with widgets or other apps). While the Active Browser provides already a basic set of features, it is still a first release, that being a central part of Plasma Active will see further improvements. There are many good things we basically get for Free through Qt Webkit, such as 100% ACID compliance, excellent support for CSS, good performance and stability and a lot of “just works” for many websites around. The Active Browser does not manage bookmarks itself. It rather makes the currently open page known to Share Like Connect, so you can bookmark a page from the top panel — or connect it to your activity and thereby collect links on the go. Keeping multiple pages open and organized is aided by the peek area at the top, where you can find open pages belonging to your current activity.

Multimedia: Bangarang

Bangarang for MultimediaFor all your multimedia needs, we have pre-installed a slightly adapted version of Bangarang. Bangarang comes with an elegant interface, it provides a stable and feature-rich media player. Bangarang also uses the Nepomuk semantic layer as underlying data store, so its knowledge blends in with the Contour workspace and other applications and widgets. Additionally, Bangarang supports retrieving meta data from various online sources, and adds this lyrics, information about artists to your movies and music to your media. This data is transparantly available in the Contour shell as well. The Now Playing widget can be used as widget in your actvity as a remote control, for example for skipping a song, pause, play.

Widgets: Plasma

Bangarang and the Now Playing widget show nicely, how the Activities in the Contour workspace extend and adapt for different use cases. Media can be controlled directly from the activity (more useful for music) or viewed and managed in a fullscreen app. The data is not locked into a single application, and neither is the user. Like Now Playing, there are hundreds of useful widgets already available, as many of them can be reused from other Plasma workspaces, such as Plasma Netbook or Plasma Desktop. We have pre-selected a number of useful widgets, such as notes, weather, calendar, clocks (Plasma is, after all about clocks!), and a few fun others. In principle, all Plasma widgets are installable also on Plasma Active. On top of that, with Plasma Quick, we’ve made it very easy to create new widgets, or adapt existing ones — more on that in a later episode.

Traditional Applications

Plasma Active comes with a number of powerful applications. These, roughly fall into three categories: Active apps, touch-friendly apps, and everything else. Since Plasma Active builds on top of a well-known Linux stack, many applications from this “eveything else” group are readily avaiable. Among these a huge number of command-line tools which can be used using the Konsole terminal application which we have adapted for on-screen keyboard input.
Traditional desktop applications do run on Plasma Active as well, but they might or might not be suitable (or fun to use) on touchscreens. In our testing, we’ve seen varied success from simple showstoppers (“press space to start”) to flawlessly working and beautiful applications. Especially many games are well-suitable for Plasma Active, some even a lot more fun, such as KDiamond, Blinken, or . (You can tell, I’m not much of a gamer. :-))
Qt and KDE’s refined, system-wide UI settings allow us to take a few general measures, such as ensuring minimal button sizes, suitable text sizes, etc..

As it’s easy to install all kinds of applications, we categorizes applications in categories to make it easier for the user to find high-quality applications.
Active Apps are applications that are specifically designed or adapted to run in a Plasma Active environment. They work well on a given formfactor, are stable and functional, blend in well with the rest of the system (visually, but also through things like share like connect) and quality-controlled. Examples for Active Apps are the pre-installed webbbrowser, the image viewer, the news reader and of course Kontact Touch, our powerful groupware solution.
Touch-friendly apps are a set of applications we have specifically selected to compensate for functionality we have not yet a Plasma Active app for. These apps might not be super-elegant, but do the job well and fill in important functionality. Konsole and kwrite are good examples here, those have been fixed to work well with an on-screen keyboard. A lot of games fall into the same category, there is a good number that work surprisingly well on a touch-screen (Blinken my four year-old nephew’s favourite, KDiamond is mine).

Third Party applications

Users or device vendors can extend Plasma Actives with more applications. Next to a large number of Free software applications, the Plasma Quick stack allows for development of proprietary applications, as its libaries are available under the LGPL license. This allow vendors to extend Plasma Active with product-specific components, and makes available closed source 3rd party components (such as Flash or Skype) on Plasma Active devices.

Where do we go?

Plasma Active provides a place for application developers to bring their creations to new devices. On top of a proven stack, Plasma Active brings the building blocks for easy creation of user interfaces, and easy deployment on the device. Plasma Quick allows to use high-level scripting languages such as JavaScript and Qt Quick’s QML and adds access to all kinds of data and information to widgets. Plasma Active is not just tied to Plasma Quick applications, but it is an open platform able acting as runtime environment for a number of applications. We are also pro-actively looking at new technologies, such as HTML5 WAC, so we will be able to serve as runtime for these applications as well.

Bretzn vorgestellt

Thursday, February 3rd, 2011

Der Bretzn Qt Creator PluginSoftwareentwicklung ist eine nicht ganz triviale Sache. Erstmal muss man natürlich programmieren können — das ist der spassige Teil. Hat man dann allerdings etwas Cooles geschrieben, muss man noch dafür sorgen, dass es irgendwie zum Anwender kommt, und dort in’s System integriert wird. Dass heisst für Linux, dass man Pakete braucht, und ein Repositorium um diese bereit zu stellen. In Zukunft kann man hier auch an Appstores denken, hierzu allerdings später mehr. Um also einerseits dafür zu sorgen, dass die Software installiert werden kann, andererseits aber auch dass die Entwicklung und Bereitstellung für Entwickler attraktiv ist — und damit das Angebot an Software vergrössert — sollte der Prozess so einfach wie möglich sein.

Vom Code zum Paket

In den letzten Monaten haben wir bei open-slx daran gearbeitet, den Prozess vom funktionierenden Code zu installierbaren Paketen zu vereinfachen. Wir haben uns also mit Nokia und h i v e 01 zusammengesetzt, und einen Plugin für Qt Creator entwickelt, der es einfach, fast trivial, macht, Code zum openSUSE (oder MeeGo) Buildservice hochzuladen, dort zu übersetzen, und als Paket bereitzustellen. Hierzu haben wir libattica erweitert, eine Bibliothek, die die Open Collaboration Services in einer API in Qt Stil anbietet. Auf diesen API Erweiterungen baut ein Plugin auf, der es möglich macht, mit ein paar Mausklicks Software zu paketieren, und dann über die Repos die am OBS hängen anzubieten. (Dies hat zwei Vorteile: RPM Spec-Dateien werden automatisch erstellt (das passiert auf dem OCS Server, der die Kommunikation mit dem OBS relayt), und die Software kann vom OBS für verschiedene CPU Architekturen und Betriebssysteme paketiert werden, was die ganze Arbeit erspart, Entwicklungsumgebungen für allerlei unterstützte Systeme vorzuhalten.

Im Video kann man sehen, wie das funktioniert. Es werden einige Metadaten eingegeben, Accounts eingestellt, und der Code wird hochgeladen. Danach kann man einfach den Buildjobs für verschiedene "Targets" anstossen, sodass das Paket dann z.B. für openSUSE 11.3 auf einem 64 Bit Intel System läuft. Der Prozess verläuft dann grösstenteils in der "Cloud", d.h. auf dem OCS und OBS Servern. Auf dem Client braucht man ausser der eigenen "normalen" Entwicklungsumgebung nur den Qt Creator Plugin zu installieren, d.h. keine chroot oder virtuelle Maschinenen aufzusetzen, oder ähnlich arbeitsaufwändige Dinge.

Im Laden

Prototype AppstoreEs stellt sich die Frage, warum dies über OCS passieren muss, und warum man nicht direkt mit dem Buildservice über die REST API oder Werkzeuge wie "osc" kommuniziert. Die OCS Schnittstelle bringt einerseits Appstore Integration, andererseits auch soziale Features, und in Zukunft vermutlich auch ein Abrechnungssystem (die Plattform soll ja auch attraktiv für solche sein, die für ihre Programme Geld verlangen möchten). Im Appstore Sprint, der kürzlich in Nürnberg stattfand, wurden einige Fragen zur Clientseite besprochen, und ein erster Prototyp entwickelt. Der Ansatz hier ist deutlich: Im Gegensatz zu ‘traditionellen Paketmanagern’ gibt’s hier auch eine soziale Komponente: Benutzer können Software kommentieren und bewerten. Ausserdem ist die Benutzeroberfläche ansprechender gestaltet und bietet Screenshots und möglicherweise Screencasts. Benutzer können Benachrichtigungen bei neuen Veröffentlichungen oder Updates abonnieren.

Mehr Informationen hierzu könnt ihr auf den folgenden Seiten finden:

Das Web, scheibchenweise

Friday, January 28th, 2011

Das Web-Scheibchen Widget ist in Plasma (in kdeplasma-addons, noch bis zum Git-Umzug am Wochenende) seit 4.4 enthalten. Ein Web-Scheibchen ist ein Teil einer Website auf dem Desktop. Das kann hilfreich sein, wenn man einen Ausschnitt einer Website im Auge behalten will, allerdings dafür aber keinen kompletten Browser starten will.

Richard Moore und ich haben das Webslice Applet auf der Akademy 2009 in Akademy geplant, richmoore hat dann einen Prototypen geschrieben, den ich in ein einfaches Plasma Widget umgesetzt habe. Seit dem ersten Release zusammen mit 4.4 hat sich allerdings wenig dran getan. Es funktioniert im Prinzip recht einfach: Wir laden eine Website in einem Webkit Widget (auf der Plasma Canvas), blenden die Scrollbalken aus, scrollen an die richtige Stelle (zur Geometrie einzelner Element kann man Webkit befragen) und zoomen soweit ein oder aus, dass der Ausschnitt in’s Widget passt. Das funktionierte so recht gut, allerdings blieben zwei Probleme: Das Vergrössern bzw. Verkleinern des Widgets war viel zu langsam, und dadurch nicht flüssig genug, und die Auswahl des Ausschnitts war alles andere als intuitiv — man musste den richtigen CSS2 Selector eingeben, diesen also erst aus dem Quellcode der Website puhlen.

Gestern abend habe ich eine Reihe Änderungen eingepflegt, die hier deutliche Verbesserung bringen. Nach Review auf der plasma-devel Mailingliste habe ich diese Änderungen auch in den 4.6 Zweig committet, d.h. dass sie mit 4.6.1 in ca. einem Monat zur Verfügung stehen werden. (Oder ihr besorgt euch den Code aus KDE’s SVN bzw. Git, unter kdeplasma-addons/applets/webslice.) Schau’n wir mal, was ich so geändert habe…

Performance

3 Web-Scheibchen mit verschiedenen Ausschnitten von mehreren Seiten Vor allem das Vergrössern und Verkleinern des Widgets machte eigentlich kaum Spass. Das Web-Scheibchen Widget benutzt eine Webkit View, und zeigt die Seite an einer bestimmten Position an, mit einem zur Plasmoidgrösse passendem Zoomfaktor. Soweit, so gut. Dem Performanceproblem lag zugrunde, dass das Widget während dem Andern seiner Grösse so viele Resize Events abfing, dass es mit dem Zoomen und Positionieren nicht nachkam, und diese sich aufstauten. Dem habe ich Abhilfe verschafft erstmal die Codepfade, die zum diesen “resize events” führen aufgeräumt habe, sodass dieser Vorgang nur stattfindet, wenn es wirklich nötig ist. Dann habe ich mittels eines QTimers verschiedene, schnell aufeinanderfolgende Events zusammengefasst. Beim Zoomen des Widgets war auch noch so Einiges drin, wenn man die Backingstore zeitweise einfriert, und das komplette Neurendern der Seite dann um einige Millisekunden verzögert. Zusammen damit habe ich auch die Seitenverhältnisse flexibler gemacht, diese waren vorher fest eingestellt. (Man kann in Plasma immmer noch unabhängig von den Seitenverhältnissen verkleinern/vergrössern, indem man die CTRL Taste gedrückt hält.) Das erste Problem ist also gründlich gefixt.

Verbesserte Anwenderfreundlichkeit

Während der Konfiguration schaltet das Web-Scheibchen Widget in den Übersichtsmodus Nächster Punkt: Ergonomie. Wie schon erwähnt, schränkt das notwendige extrahieren von CSS2 Selektoren aus Webseiten-Quellcode die Zielgruppe des Widgets gelinde gesagt etwas ein. (Eigentlich sind die recht einfach, was aber nicht heisst, dass ich es auch meinem “Resident non-Geek” zumuten würde — ich hab’s probiert und empfing einen recht leeren Blick als Dank). Ich habe einige Zeit drüber nachgedacht, wie man sowas elegant umsetzen kann. Erstmal wollen wir Quellcode-lesen während des Setup vermeiden, es sollte einfach sein, den gewünschten Ausschnitt auszuwählen, und das Feedback für den Anwender sollte so direkt wie möglich sein. Erster Streich: Die Eingabezeile für das CSS Element hat sich verwandelt in eine editierbare Combobox, über deren Dropdown-Menü man jetzt Elemente auswählen kann. Zweiter Streich: Die URL Eingabezeile hat einen Reload-Knopf zum Nachbarn bekommen, mit dem man eine neue Seite in die Voransicht laden kann (damit werden auch die Elemente in der Combobox erneuert). Dritter Streich: Das Widget zeigt jetzt während der Konfiguration eine Übersicht der ganzen Seite an, und markiert das gerade ausgewählte Element. (Mann kan, wie in allen Comboboxen dann auch mit Maus bzw. Pfeiltasten durch die Liste navigieren, gleichzeitig sieht man im Widget welcher Ausschnitt sich hinter dem kryptischen Namen des Elements (#myid, zum Beispiel) verbirgt. Sobald man bestätigt, zeigt das Widget dann den Ausschnitt passend gezoomt an.

Alles in allem nicht ganz so triviale Änderungen. Da das Widget allerdings bisher kaum benutzbar war, die Änderungen sich recht einfach ohne Änderungen an den Übersetzungen vornehmen liessen, und das Risiko auf Regressions in anderen Teilen sehr gering war, habe ich die Änderungen auch in den 4.6 Zweig eingepflegt. Damit werden sie mit 4.6.1 nächten Monat, und mit openSUSE im März mitgeliefert, und wir somit vielleicht dem ein oder anderen Anwender eine Freude bereiten können.

Hier und da gibt’s natürlich noch Verbesserungsmöglichkeiten. So kann ein erklärender Tooltip hier und da sicherlich nicht schaden, flexiblere Grössenoptionen, wie Proportion, Originalgrösse der Seite (interessant für “flüssige Layouts”), zum Beispiel. Ich habe dafür erstmal sinnvolle Voreinstellungen gewählt, abhängig vom Feedback auf’s jetzige Featureset sehen wir dann mal weiter.

4 Minuten Hobbychirurgie

Abschliessend noch unsere Mitmach-Runde im Mitmach-Web 2.0! Wir haben einen netten Mechanismus, mit dem man kinderleicht eigene Web-Scheibchen-Widgets erstellen kann. Dazu kopiert ihr einfach eine bereits existierende Web-Scheibchen .desktop Datei. Dateinamen ändern (wir wollen ja nichts anderes überschreiben), Namen, Kommentar, ev. auch Übersetzungen updaten (oder einfach löschen, falls nicht nötig), Autor, etc, Einträge die man nicht versteht, einfach drin lassen, auf jeden Fall aber die Plasma Library und Mimetype Einträge. Fügt dann eine Zeile wie diese hinzu, um das Web-Scheibchen auf das Element mit id=”myid” im Tag von der Frontpage von mysite.org läd:

 X-Plasma-Args=http://mysite.org,#myid

Diese Datei muss man dann nur noch nach ~/.kde(4)/share/kde4/services/, kbuildsycoca4 ausführen, um die Plugins und Metadaten auf den neusten Stand zu bringen, und das Widget über den Widget Explorer zur Plasma Arbeitsfläche oder dem Netbook hinzufügen.

Eine mögliche Entwicklungsrichtung für die Zukunft wäre dann, diese selbsterstellten Web-Scheibchen über opendesktop.org mit anderen zu teilen, quasi “Social Desktop für Web-Metzger“…

Slicing up the Web

Friday, January 28th, 2011

The Webslice applet has been in Plasma (kdeplasma-addons, to be precise) since 4.4 already. It allows the user to display a part of a webpage on the desktop. This can be useful for monitoring only a specific part of a webpage, or just to display something nice.

The Webslice applet has been written by Richard Moore and me as a functional prototype, but didn’t see much love since it was added to Plasma for 4.4 in 2009. Its basic mechanism is that you specify a “slice” within a website, which is a rectangular region. This region then gets shown in the applet, and resizes dynamically with it, zooming the “slice” in and out. The widget basically worked, but had two significant problems: Resizing was very sluggish and bound to a kept aspect ratio, and you needed to know CSS2 selector syntax to actually use it.

Earlier tonight, I’ve committed a set of changes which address these problems, and backported them after review on the plasma-devel mailing list to the 4.6 branch, so these changes become part of Plasma 4.6.1, which will be the first service and translation update to 4.6.0, which we released yesterday.

Performance

3 Webslices showing different parts of different webpages in diferent sizes First, the resize issue. The Webslice applet uses a webkit view, which displays the page and is positioned (basically scrolled with scrollbars switched off) and zoomed to fit into the area the applet covers — fairly simple in fact. The performance problem was caused by too much resizing which got passed down the stack (if you scroll and zoom a website every couple of milliseconds, it becomes quite heavy on the CPU easily. I’ve addressed this by cleaning up the codepathes that lead to resizing, so that it only causes the resize (and thus the repositioning and zoom of the webpage) when absolutely necessary. Resize events from the applet are now compressed a bit, so that we don’t get more than 10 resizes a second. That’s “good enough” for the user to see what effect his mouse-dragging has, but doesn’t have the sluggish effect. Then, while resizing, I’m freezing webkit’s tiled backing store, for an additional performance boost. The result is very noticeable, the lag and CPU-hogging while resizing is gone, and the sizing of the applet is much less unwieldy with these changes. In that process, I’ve also switched to a non-fixed aspect ratio. Bug #1 thoroughly fixed.

Improving Interaction

While configuring the widget highlights the selected slice in the page overview Next-up, slice selection. As I already mentioned, that was neither easy, nor user-friendly. (If you’re running, 4.4+, give it a shot, it really sucks ;-).) First off, you need to know CSS2 selectors (they’re quite easy, in most cases you want #myid for an element in the page being marked with id=”myid”), but still limit the utility of the widget to a rather select group. (Does this make the widget 1337?)I’ve been pondering how to best offer this to the user. It should be easy to pick a slice from all the elements that are there. The first thing I did was to turn the lineedit where you’d input the CSS selector (#myid or whatever) into an editable combobox, already containing elements to choose from. That made picking a slice much more “determistic”. Still, the #myid names are not always telling you what part of the page their actually displaying, so some more feedback is desirable. My approach there is the following: When the user opens the configuration dialog, the page is zoomed out and fully shown in the webslice applet, it switches to a preview mode. The user can now enter a different URL, and temporary load this in the slice applet. The combo box containing the elements is now updated to contain the elements of the new page. Website picked, now let’s pick a slice. By selecting a slice from the combobox, the preview mode highlights the position of the currently selected slice in the widget. You apply and it zooms in there. A nice touch is that you can “scroll” through the slice by hovering over the combobox, or flip through them using the arrow keys while focusing the combobox.
All in all, not quite unintrusive changes, but considering the widget wasn’t of much use due to above described problems anyway (there was one bug filed against it — likely a bad sign, I’m not that good a hacker). Marco and Aaron were kind enough to review the patches and agreed that they won’t hurt much, but do provide a nice set of improvements we’d like our users to get fairly quickly, not just next summer with 4.7.

There are a couple of loose ends left for 4.7, though. As I wanted to keep the possibility of a backport open, I’ve not changed any strings in the widget, adding an explaining tooltip here or there might be useful, but also some more flexible sizing options (what proportions to use for the initial rendering — that matters for fluid layouts, how to clip if the size of the widget doesn’t match the aspect ratio of the slice, etc. I’ve chosen “sane defaults” for these things now, but it’ll probably be nice having that available as an option to the user.

Create your own webslice Plasma widgets in 4 minutes

There’s one neat thing left to tell about the webslice: You can easily create your own preconfigured slices. In order to do that, copy and rename the .desktop file, change name, comment, icon, if you wish, then add a line like

 X-Plasma-Args=http://mysite.org,#myid 

Copy the file to ~/.kde(4)/share/kde4/services/, run kbuildsycoca4 and add your newly created webslice to your Plasma using the widget explorer.

A possible direction we can take this is to add a webslice category to opendesktop.org, and start sharing our webslices with each other…

I’m a *real* developer …

Friday, November 20th, 2009

… not just a marketing guy. :-) During the Qt Developer Days in Munich, I took the Qt certification exam (actually as one of the first people to take it). It was my birthday, so they let me pass:

Nokia Certified Qt Developer
Also, right now I’m in Reykjavik, Iceland for the KDAB company meeting and 10 year anniversary. Preliminary conclusions: Watch out for roastbeef, it tastes like whale, riding on a horse feels like riding a square-wheeled bicycle (but slightly more scary) and having infinite amounts of energy under your rearside makes for interesting and relaxing uses and given a large-ish island with tectonic and seismic activity, you’ll find the capital at the most likely spot for an earthquake.