QZeeControl for MeeGo/Harmattan

This month I finally started to work on a small project I wanted to do already since long time ago: QZeeControl enables controlling your Harmattan/MeeGo based smartphone via a Zeemote bluetooth remote control. For those of you who already used Zeecontrol on the N900, the usage of QZeeControl is very similar to Zeecontrol on Maemo 5/Fremantle.

QZeeControl features include:

  • discovery mechanism for remote controls,
  • discovered remote controls are stored to speed-up subsequent connects,
  • interactive test functionality,
  • settings menu for configuring key mappings/bindings,
  • and support for using up to two remote controls simultaneously.

Note that the interactive test functionality is only activated when the QZeeControl window is active. Consequently, there are no performance penalties due to this during normal operation.

You can download QZeeControl from: http://qzeecontrol.garage.maemo.org/releases/

For more information about QZeeControl and how to use it please visit the QZeeControl homepage.

There is also a forum thread over at talk.maemo.org with discussion about QZeeControl. Feedback like feature requests, bug reports, etc. is always highly appreciated. Alternatively, you can just comment in here as well.

As usual, the whole code is Open Source and you can get it at the corresponding garage.maemo.org project site: https://garage.maemo.org/projects/qzeecontrol

Please note that Zeemote (TM) is a trademark of Zeemote Technology Inc. Other trademarks are property of their respective owners.

Posted in Announcements, My Applications, QZeeControl | Tagged , , , , | 2 Comments

Q To-Do Version 0.7.1 + Updated QML TreeView

I had a little time to continue hacking on the Qt/QML port of To-Do O, Q To-Do. During this work I also reworked and updated my QML TreeView code a bit.

You can get a compiled version for Harmattan (N9/N950) from my repository. The source code (including the new QML TreeView) can be downloaded from the To-Do O Sourceforge project site.

Improvements on the QML TreeView include:

  • swipe gestures for navigating the tree (additional to the already existing navigation via buttons),
  • integrated handling for onDoubleClicked and onPressAndHold on tree items in the tree code,
  • improved color setting for the tree view,
  • and some minor, general clean up work in the code.

Q To-Do ships with the new QML TreeView. Hence, it includes all improvements included in the new QML TreeView. Additionally, Q To-Do now comes with the following improvements:

  • “harmattanized” UI, the UI should look a little bit more like “native” Harmattan apps now,
  • a progress bar indicates the progress of a to-do (This is especially intended for to-dos that contain sub to-dos. See also the screenshots below.),
  • double click on an item opens the edit dialog,
  • long pressing an item shows a context menu with further actions,
  • and the edit/new item dialog is now scrollable to make handling of long text easier.
Posted in Announcements, Q To-Do, Qt/QML, Snippets, To-Do-O | Tagged , , , , , | 7 Comments

Display Relative Paths in taglist.vim

While the “Tag List” plug-in for Vim is really great, there is one peculiarity that I wasn’t so happy about. By default the displayed directory names are absolute paths. Hence, working in a little bit (depending on the displayed width of your tag window) deeper subdirectory already yields the issue that the displayed directory information is not particularly helpful; personally, I don’t care about knowing that I am working somewhere beneath “/home/foo/bar/my-sources…” while the actual interesting information would be to know that I work on “./project-a”, “./a-different-project”, etc. Admittedly, this may also be caused by my personal workflow, but well, at least for me this was a little bit inconvenient.
To fix this issue I had a look at the taglist.vim source code and came up with a small patch that changes the displayed path from an absolute to a relative one. Note that I just commented the original line of code.

--- Downloads/taglist/plugin/taglist.vim  2007-09-21 18:11:20.000000000 +0200
+++ .vim/plugin/taglist.vim 2012-03-12 13:34:10.907582194 +0100
@@ -1917,7 +1917,8 @@ function! s:Tlist_Window_Refresh_File(fi
endif

let txt = fnamemodify(s:tlist_{fidx}_filename, ':t') . ' (' .
-                \ fnamemodify(s:tlist_{fidx}_filename, ':p:h') . ')'
+                \ fnamemodify(s:tlist_{fidx}_filename, ':.:h') . ')'
+"                \ fnamemodify(s:tlist_{fidx}_filename, ':p:h') . ')'
if g:Tlist_Compact_Format == 0
silent! put =txt
else

For more details about what’s going on there and what other options you have see “:help fnamemodify” and “:help filename-modifiers”.

Posted in Snippets | Tagged , , | Leave a comment

SectionScroller vs. QAbstractProxyModel

In this post I wrote about how to use a Qt model with the QML SectionScroller. A more advanced use case is to encapsulate such a “basic” model in a QAbstractProxyModel instance like QSortFilterProxyModel.

This at first will brake your QML SectionScroller as some important methods and properties are missing in the proxy that are present in your initial model. However, there is no need for being in despair; adding the missing bits is quite straight forward and simply requires to forward the missing method calls to your initial model.

Recall that we added (amongst others) a read only “count” property, its corresponding accessor method, and a “get(int index)” method that returns the item in the model at the given index to our initial model to make SectionScroller work. By encapsulating the initial model in a proxy those parts are not accessible for the SectionScroller code anymore. What we need to do to fix this issue is to simply add some forwarding methods plus the missing property and we are back in business. I took the following code excerpts from the current MeePasswords version as can be found on Gitorious:

...
class EntrySortFilterProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
// Needed to make SectionScroller happy.
Q_PROPERTY(int count READ rowCount)

public:
...
// Needed to make SectionScroller happy.
Q_INVOKABLE Entry* get(int index) { return ((EntryListModel*)sourceModel())->get(index); }
Q_INVOKABLE int rowCount(const QModelIndex &parent = QModelIndex()) const {
return ((EntryListModel*)sourceModel())->rowCount(parent);
}
    ...
};
...
Posted in Qt/QML, Snippets | Tagged , , | Leave a comment

Speed up TDD in Clojure with lein-reload

Personally, I am a big fan of the Test-driven Development (TDD) approach; iterative development by writing tests first and then implementing the required functionality is just so much fun and very efficient as well. As a very nice side effect you always maintain a working “product” and get your regression tests for free.

In this post I’ll write about how to significantly speed up TDD in Clojure with Leiningen and the lein-reload plug-in. There is a very well written introduction to Clojure and TDD written by Dave Ray. Note: while the guide by Dave Ray uses the Lazytest library written by Stuart Sierra for testing, I prefer to use the testing functionality as provided by clojure.test (which, by the way, is also written by Stuart Sierra plus et al.) as it is built into Clojure itself. Nonetheless, the guide by Dave Ray very nicely shows the ideas behind and approaches on TDD using Clojure.

Using Leiningen you can run all your tests via executing:

lein test

in the project directory.

While this technically works very well and there is actually nothing wrong with it there is the problem that this takes quite some time to run tests this way. Things wasting time are, e.g., the JVM being started or Leiningen firing up.

Within Leiningen there is the option to start an interactive shell in which you can execute Leiningen tasks:

lein interactive

In this shell you can for example simply type “test” to execute all unit tests the same way as if you would have typed “lein test” directly. Running tests repetitively in the interactive shell, you will notice that the first test run takes quite some time to execute while subsequent test runs execute much faster.

However, this alone is not suited for interactive TDD yet. The problem is that changes to your source files will not be picked up. To circumvent this issue there is the lein-reload plug-in by Sebastián B. Galkin: it keeps track of the modification dates of your source files and reloads those namespaces for which the source files have “changed” (actually, the modification date of the file changed).

The guide on the lein-reload homepage explains how to add this plug-in to a single project. Alternatively you can install it “globally” for a user by typing:

lein plugin install lein-reload "1.0.0"

To verify that the lein-reload plug-in works just go to one of your existing projects, enter the Leiningen interactive shell by executing “lein interactive”, type “reload”, change one of your source files (simply using touch from another shell: “touch src/foo/core.clj”, will work as well), and type “reload” in the interactive Leiningen shell again. You should now see a message that the namespace “foo.core” got reloaded.

The guide on the lein-reload homepage further shows how to add a hook to your project such that “reload” is always called when, e.g., “test” is run. However, this needs to be done for each project.

To add this hook globally for all projects I (for now) use a “hack-ish” solution. I simply added the following code to my “~/.lein/init.clj”:

(use 'leiningen.hooks.reload-on-test)

With this in place all my projects automatically make use of the “redefined” test task that first reloads all changed namespaces prior to running the tests. Note that I am currently using Leiningen 1.7.0.

From what I understand from the Leiningen website the above hack should not be necessary when using Leiningen 2.0.0 or above as there you can add to the built-in profiles via the “~/.lein/profiles.clj” file. Please correct me if I am mistaken.

Posted in Snippets | Tagged , , | Leave a comment

MeePasswords 1.9.0 Released

Yesterday I uploaded version 1.9.0 of MeePasswords. The main change in this version is the UI that had been reworked quite massively by Cornelius. Thanks a lot for this great work!

Additionally, I finally had the time to integrate the FastScroll version of the SectionScroller as published by ph5, which looks much more like the “native” Harmattan applications like the Contacts app. Furthermore, this version includes some fixes for minor issues as well.

Overall, this version looks a lot more “harmattanic” thanks to Cornelius work on the UI and the “harmattanified” SectionScroller as provided by ph5.

Due to some issues I am currently experiencing with the OBS this version is not available via my repository yet. Instead you can download it from the MeePasswords homepage.

Posted in Announcements, MeePasswords, My Applications | Tagged , , , , | 1 Comment

Hotplug an External Screen to your Laptop on Linux

With udev you can trigger actions when an external screen/monitor is connected. This is, e.g., useful when you want to automatically perform some actions when an external Screen is connected to a laptop. Such actions could be to automatically enable the additional screen and set its orientation using xrandr or the like.

The following udev rule (e.g., in a file such as /etc/udev/rules.d/95-monitor-hotplug.rules) executes a script when the external VGA output is connected (Thanks to Andy for the hint in his post.):

#Rule for executing commands when an external screen is plugged in.
#Credits go to: http://unix.stackexchange.com/questions/4489/a-tool-for-automatically-applying-randr-configuration-when-external-display-is-p

ACTION=="change", SUBSYSTEM=="drm", HOTPLUG=="1", RUN+="/usr/local/bin/hotplug_monitor.sh"

Note: you can reload the udev rules, e.g., with “udevadm trigger”. The following script (/usr/local/bin/hotplug_monitor.sh) takes care of executing the appropriate scripts etc. when the external screen is (un-)plugged:

export DISPLAY=:0.0

function connect(){
xrandr --output VGA1 --auto --left-of LVDS1
}

function disconnect(){
xrandr --output VGA1 --off
}

xrandr | grep "VGA1 connected" &> /dev/null && connect || disconnect

This script simply activates or deactivates the external output but different other things could be done as well.

Posted in Snippets | Tagged , | 1 Comment

MeePasswords with NFC support

I added a somewhat experimental feature to the Harmattan version of MeePasswords. The new functionality enables you to use NFC tags as means for authentication instead of having to type in your password.

You can get the most recent version (1.8.0 as of time of writing) of MeePasswords from my repository. Please note that the NFC tag features are still considered experimental.

Posted in MeePasswords, My Applications | Tagged , , | Leave a comment

MeePasswords and Q To-Do on apps.formeego.com

Thanks to the community testers at apps.formeego.com MeePasswords and Q To-Do are now in the official software catalog there. Thanks a lot for your testing work and feedback. 🙂

Posted in Announcements, MeePasswords, My Applications, Q To-Do, To-Do-O | Tagged , , , , , , | Leave a comment

Q To-Do: a Port of To-Do-O to Qt/QML

Q To-Do is a work-in-progress on porting To-Do-O to Qt/QML.

Currently Q To-Do supports the basic features for handling a to-do list, such as: adding new, editing, deleting, or moving entries.
A sync functionality as in To-Do-O is currently missing. So you need to manually copy your existing data from e.g. your N900 or PC to your N9/N950.

You can download Q To-Do from my repository.

Following are some screenshots of the current version:

Posted in My Applications, Q To-Do, To-Do-O | Tagged , , , , , | 1 Comment