Sunday 22 December 2013

Deploying Additional Packages to the Sailfish Emulator and SDK updated

As new versions of the Sailfish SDK are released, so installing stuff changes a little.

Because of that, over the past few days I have made several updates to this article to reflect these changes, especially the use of PkCon / PackageKit.

http://flyingsheeponsailfish.blogspot.ch/2013/11/deploying-additional-packages-to.html

As I used QtLocation and QtPositioning in the examples, I am also posting a link to this tutorial

https://github.com/b0bben/SailfishOS_MapTutorial

This tutorial gives more in-depth advice on the use of QtLocation and QtPositioning, in addition to how to install.

Saturday 2 November 2013

Deploying Additional Packages to the Sailfish Emulator and SDK

Latest update is 24 Dec 2013 11:40 UK time.

One of the areas that raises the most questions on the Sailfish Developers' mailing list is the sticky topic of Installing additional packages to the Sailfish Emulator and SDK. Many developers, including myself have found installation very confusing.

The reasons for the confusion are clear: there is no official documentation on this topic yet, thought it is promised; there are a number of different ways that a package can be installed; both the Emulator and SDK may required installation; each package is available in a number of flavours; and then there is the challenge of identifying the correct package in the first page, and determining the correct name of that package. And if that was not enough, due to the refactoring of Qt Mobility from Qt 4 to Qt 5, some of our favourite components are now offered by quite different packages.

This post should give you a broad understanding of the different installation techniques. To those who live and breath Linux, who first compiled the kernel before they went to school, much of this may be obvious. To the rest of us from different development backgrounds it is less so, hence this post

We will look at zypper, PkCon, ScratchBox2, yaml and spectacle. We will find out how to install "by hand*, and automatically on building and running.


Friday 25 October 2013

Alpha 2: After the update of 22 Oct 2013

Hi All

As announced by Jarko here there is a refresh of the Sailfish Alpha available now.

This post lists some immediate differences I have noticed, and some changes I had to make to get "things" working again.

As / If I discover other stuff, I will update this post


Saturday 12 October 2013

Alpha 2: Migrating Landed

Note this article is work-in-profess, reflecting work that is work-in-progress, and will be updated / corrected as the migration moves forwards . . .

Last update is: 06 Nove 2013

It is the weekend, but as it is wet and cold outside, with new snow only a few hundred metres higher, there is no flying today. So I am back to programming, and more importantly porting my app Landed to the Sailfish Alpha 2.

As I explained in my last post, recently I have concentrated on the Harmattan version of Landed, making it easier to use, and adding more functionality. While it is not yet finished (will it ever be?). Landed is now fully functional, and thus another stab at porting to the Sailfish Alpha 2 makes sense.

This time, rather than porting all of Landed, I decided to cut out the section I had spent most time on recently into a throwaway demo, and port that. I know from my first attempt that porting all of Landed will take quite some effort: Porting part of it first follows the old software engineering concept of solving large problems by dividing into smaller problems.

The demo is called MigratePhoneContactsDemo. I will soon post the Harmattan code, and the ported Sailfish equivalent code to Github, and add links here.

This article charts the progress of the porting. As the porting is not yet finished at the time I start this article, I will revisit the article over the next few days and make updates as I find solutions, and as I walk into new problems. I will try and keep the article at a high level, and will add child posts if I need to go into detail on particular challenges.


Thursday 26 September 2013

A Status Update

The eagle-eyed will have noticed that I have not updated this blog for several weeks. For this I apologise.

The evil-minded will probably have suspected that I have thrown in the towel, and have moved on to better things. They are wrong, I have been very busy, fighting on two fronts.

I spent quite a bit of time porting Landed and LandedSettings to the new Sailfish Alpha 2 (Qt 5.x), and was on the point of writing an article on the lessons learned when I went on holiday to Greece.


Tuesday 6 August 2013

Alpha 2: Passing simple C++ properties from main.cpp to the QML Side with Qt5

One of the first challenges in migrating LandedSettings from the Sailfish Alpha 1 7 Qtt to Alpha 2 / Qt5 was that I pass a simple property from the main.cpp file (C++) to the QML side via a setContextProperty call.

The property was platform, and was intended to allow the Qml side to change font size etc according to the platform it was running on. I originally added this functionality to handle differences between the Nokia Simulator and the Haramattan Emulator (QEMU).

In Qt4 I was able to pass such properties via a call to setContextProperty, offered by a bit of Nokia code called the QmlApplicationViewer. As this is no longer included with the Sailfish Alpha 2, and will not run unchanged, I needed to migrate this to something different. As we will see their were a number of approaches I could have taken.


Monday 5 August 2013

Alpha 2: Installing an Import Library on the Emulator

In a previous post I covered the code migration of my import library AbstractUI from Qt4 to Qt5.

However the greatest problem proved to be not in the code, but rather where to install my newly migrated library. Read on to find out the solution.


Alpha 2: Migrating LocalStorage from Qt4 to Qt5

This morning I successfully migrated the LocalStorage part of my app LandedSettings from the Sailfish Alpha 1 (Qt4) style to the new Sailfish Alpha 2 (Qt5) style.

 

In LandedSettings all the Database access functionality is encapsulated in 3 javascript files. In order to focus the migration on the LocalStorage only, I created a new throwaway project QT5TestLS, copied the 3 JavaScript files to the new project, and added just enough code to the project to setup and populate the Database.


The Full code of  QT5TestLS can be found on GitHub.

 

 

Below is a summary of the things I had to change:

 


Saturday 3 August 2013

Alpha 2: Migrating an Import Library

Note: As my experience and understanding of migrating to Qt5 / Sailfish Alpha 2 increases, I will update this post if required.

Having installed the second Sailfish Alpha (which I will refer to as Alpha 2), and checked that the default "Hello Sailors" project runs on the Emulator, I jumped in feet first to try and get LandedSettings running using Qt5.

Almost at once I ran into a problem, one that should have been obvious from the start: LandedSettings depends on an import library AbstractUI, and of course this must be migrated first.

As abstractui is intended to abstract out the differences between Harmattan and Sailfish, and Sailfish is now on a higher Qt level than Harmattan this does raise the question whether this approach is still valid. But I prefer to defer that question to slightly later For the moment I want to get LandedSetttings up and running on the new Alpha, thus I need to get AbstractUI ported.

The irony of a tool that was intended to ease porting needing porting itself does not escape me.

Therefore I decided to make a throwaway demo import library native to Qt5, and a throwaway QML project to import it. I could then compare the throwaway library to AbstractUI, and identify what needs changing.

The first pleasant surprise is that there is now a project template for Libraries. I chose "New Project / Libraries / Qt Quick 2 Extension Plugin". In the first alpha this template was not available. if I remember correctly i actually created the project in the Qt Project SDK as a a Qt Quick 1 Extension Plugin, and adapted it for Sailfish to the point that I got it working.

Having tested that the throwaway was importable and installable (more on this in a follow-up post) it was time to start porting abstractui.

As the original Sailfish flavour of the abstractui library was not created in the Sailfish SDK (but now could be), I decided to start from fresh, creating a new project in the Saillfish QtCreator, and would then merge in the bits of code required from the old version of the library.

 


Update after the Sailfish Qt5 Alpha

Hi all

This is just a quick update to say what I am up to, and the changes I hope to make to this blog over the next few days and weeks.

The announcement of the second Sailfish Alpha: this one Qt5 is a tipping point. Plus the fact that the Sailfish guys were kind enough to link this blog from their official website has put a cat amongst the pigeons!

Due to the differences between Qt4 and Qt5 some of the exiting articles will no longer be relevant. Most however will be, but with small changes. So I am doing the following:

1) I have marked most posts indicating that they will be revised for the new Alpha soon.

2) Started updating posts for Qt5.

3) I have started porting my app LandedSettings so that it runs with the new Alpha. Whilst doing so I will gradually review existing posts and update these with differences. As LandedSettings currently uses the AbstractUI library this is a good "complicated" example to start with.

4) Where I encounter major differences (headaches) I will post new articles highlighting these!

5) I am pondering just how viable an abstraction library supporting Harmattan (Qt4.7.4) and Sailfish (Qt 5) remains, . I am convinced that the technique is highly relevant for different platforms on Qt 5, but less so for platforms on different Qt Versions. Once I am past the pondering stage I will post in detail on this topic.

Friday 2 August 2013

Sailfish Qt5 Alpha Available!

Hi All

As of last night the SailfishOs Qt5 Alpha is now available for download.

The biggest and most obvious change is that the "old" alpha used Qt 4.8.3, the "new" alpha uses Qt 5.

Equally interesting, X11 has been replaced by Wayland.

Whereas Qt 4.7.4 (Harmattan) and Qt 4.8.3 (Sailfish Silica) were close enough as to make very little difference, Qt5 brings some big changes. It remains to be seen as to how this makes supporting an app with a common code base for Harmattan and Sailfish more difficult (or even impossible….)

Sailfish have added a webpage on porting from Harmattan. It can be found here.

In the meantime I have installed the Qt5 Alpha on OSX and Lubuntu 64 bit, and been able to run and deploy the default "Hello Sailor" app on both. Windows is downloading in the background as I type this.

Note that before you install the new SDK, you should first deinstall the old SDK using the SDKMaintenance tool. As I am by nature suspicious I simply renamed the original install directory and the hidden .scratchbox2 directory, so that I could easily restore these if required.

My next step is to try running Landed and LandedSettings.. I hope to bring news over the next few days of how this works.

 

 

 

 

 

Thursday 27 June 2013

QML: Faking an SQLResultSet Object with JavaScript

A few days ago while hunting down an elusive bug in the way the Silica ContextMenu component work I decided to produce a radically stripped down version of LandedSettings. The idea was to prove that the strange behaviour was still present in a pure Sailfish project, and make things much more readable by removing anything from the project not directly related to the issue.

Now LandedSettings is ultimately a front end to an SQLite database. But in my simplified project I only needed data from one table, basically a list which is returned from the Javascript handling SQLite as a JavaScript rs object.

I was keen to remove all the code concerned with database setup and access, yet did not want to change the code deep in my app that processes the resultset. 

So would it be possible to produce a JavaScript object equivalent to that returned from SQLite? This object would return the same data (a list of 6 items), and would have to have the same structure as its SQLite equivalent.

In effect, could I replace the whole database access code with a simple javascript method returning a javascript object?

As we will see, not only is it possible, but it is actually very simple, elegant and easy to achieve. (But as is often the case, working out how to do this was not so easy …)


Sunday 23 June 2013

Playing around with the guts of Sailfish Silica Components

Have you ever felt the need to dig around in the guts of the Sailfish Silica provided QML components to work out how things are done? This article explains how you can do this.

Recently I decided to change the way my LandedSettings app allows the user to create, edit and delete entries in the settings database.

Under the existing solution, when the user double-clicked an item in a view (and I have four views), the view delegate would push an appropriate configuration page. This page was festooned with new, edit and delete buttons. Each of these would push a further page allowing that action to be carried out.

I was never entirely happy with this solution. It always struck me as more than a little clumsy and very "desktop", but as LandedSettings was a secondary app supporting the main app Landed I stuck with it.

Then I started porting to Sailfish Silica. Using the Sailfish ComponentsGallery as a reference (click on the propeller on the home screen) I found that under Silica, when a view entry is pressed and held, a context menu drops down.

This seemed to be a much better solution to offer new, copy, edit and delete options, so I set about changing LandedSettings to use this type of context menu.


Thursday 20 June 2013

Connecting to the Harmattan QEMU: Learning from Sailfish!

A few days ago I wanted to compare some differences in behavior between the Sailfish Emulator, and the old Harmattan Equivalent QEMU.

These are two very different beasts, with the QEMU being so slow and unresponsive as to be just barely usable, while the Sailfish Emulator is a much snappier affair. But that is not the point of this post.

On starting up on the QEMU I realized that I had not installed my AbstractUI library on QEMU, and even more surprisingly that I had never connected to the thing via SSH for a peak inside.

A quick google found this link:

http://harmattan-dev.nokia.com/docs/library/html/guide/html/Developer_Library_Alternative_development_environments_Platform_SDK_user_guide_Using_QEMU_in_Scratchbox.html

 

So we can connect like this:

 

ssh -p6666 root@localhost

 

no password required!


Thursday 13 June 2013

Menu Abstraction with AbstractUI Part 2

Hi all

In a post some days ago I pointed out that menu handling is substantially different between Harmattan and Sailfish Silica. I may even have mentioned jumping through flaming hoops ...

Well the solution I now have is not perfect. I would still categorize it as a workaround, but it is one that I can live with as it fits my needs, and I am aware of the weaknesses.

From a user's point of view (and we should never forget our users) the differences in Menu Handling are these:

1) Launching

A Harmattan menu is launched from the Toolbar which sits at the bottom of the screen occupying valuable screen real-estate.

The Silica Menu is launched by swiping the screen (up in the case of a PushUpMenu, down in the case of a PullDownMenu). While no screen real-estate is consumed by a ToolBar, the menu is indicated by a MenuIndicator. The trouble is that the new user will naturally try and open the menu by the indicator: that's the intuitive thing to do: but it is the part of the screen that cannot be used to open the menu: if you drag there you will slide the whole app away!

2) Behaviour on Opening

When the Harmattan Menu opens, it slides over other content on the page, without any programmer intervention, and as the menu is non-transparent, there is no "interference" between menu items and components now under the open menu.

The Silica Menu, at least in the demo new project, causes other page content (page childs) to slide away with the menu as it opens

So how do these affect us as programmers? Read on:

 


Connecting to a Nokia N9 with a RSA Key File: Learning from Sailfish!

I recently had to reflash my Nokia N9 because Bluetooth would no longer start. The reflashing itself is a story for another time (and maybe another blog post), but the process of restoring apps and stuff after the reflash made me think about how I interact with the N9 as a developer.

Until now when I have needed to move files onto the N9 I have connected via SSH using the password prompted in the N9's SDK Connectivity App. While this works well it is a bit cumbersome.

Then I reflected on how we interact with the Sailfish SDK and Emulator. Here we authenticate via RSA key files. No password needed. Much nicer, yet equally secure.

So this raised the question: can we apply the same technique to the N9? Can we connect to the N9 with a RSA key file?

After a little bit of googling and experimentation, the answer is a resounding yes; and it proves to be very easy.

I found the basic idea here: http://talk.maemo.org/showthread.php?t=41547. So thanks to Greygoo the author. My post takes a slightly simpler approach, and is specific to the N9.


Sunday 9 June 2013

Where is my SQLite DB on the Sailfish Emulator ?

Note: This post will be updated for the Qt5 Alpha shortly!

By default, SQLite Database files are stored here on the Emulator:

/home/nemo/.local/share/data/QML/OfflineStorage/Databases/

Landed Project Source Posted to Github

I have hinted in previous posts at my core app Landed, which started over a year ago on Harmattan, and is now up and running on Sailfish as well. Getting Landed running on both platforms was the motivation for creating the AbstractUI abstraction library.

For sometime I have been mulling over the idea of publishing the source of Landed, but it was never quite ready enough: there was always something else to correct, improve or add, and the migration to Sailfish (and abstract) proved to be a distraction.

It was not until I realized that this is likely to always be the case: there will always be something to improve or tweak, or a cleaner way of doing things, that to quote the Duke of Wellington I decided to "Publish and be Dammed!".

So both Landed, and its sidekick LandedSettings are now posted to: https://github.com/sailfishapps/landed

See the https://github.com/sailfishapps/landed/blob/master/README.md file for an explanation of what Landed does, requirements, how to setup etc.

I make no apologies for the fact that Landed and LandedSettings are at the time of this post not finished. Most of the functionality works, but some does not. The abstract still throws lots of errors to the output, but am I working on the that.

Now for some food (cold fillet steak from last night), and some ale, then back to programming ….

Saturday 1 June 2013

Menu Abstraction with AbstractUI

I have been doing more work migrating my core apps to Sailfish using AbstractUI, extending this library as I find problems.

One of major stumbling blocks so far is Menu handling. Not only do Harmattan and Silica Menus look and behave a little bit differently (not really a problem), they also interact differently with other associated components (Page, MenuLayout etc.).

This means that the Harmattan and Sailfish versions of these abstraction controls have to differ substantially, yet still provide a common interface which can be used from one code base to target both platforms.

I will go into the differences and the flaming hoops I jumped through to address them in a second post later this weekend. For now I want to point out 4 demo menu handling projects that I have posted to Github last night to demonstrate menu handling, with and without AbstractUI.

Each of these projects offers a menu with two options. One increments a counter on the page, the other decrements it. Each is based on a stripped down version of the "new project" created by the Harmattan and Sailfish QtCreators.

The HarmattanMenuDemo shows native Harmattan menu handling: A ToolBar at the bottom of the screen, with a ToolIcon, which when pressed opens or closes the menu.

The SilicaMenuDemo is the Silica equivalent, with a native Silica PulldownMenu which is accessed by dragging down on anywhere on the screen other than the glowy MenuIndicator at the top. (This is a bit counter intuitive at first).

The HarmattanAbstractMenuDemo is a copy of the HarmattanMenuDemo, but with the native controls abstracted out via the Harmattan flavour of AbstractUI.

The SilicaAbstractMenuDemo is the Silica equivalent, using the Silica flavour of AbstractUI.

There are some minor differences between the native and abstracted handling / look and feel, but I should be able to iron those out later.

For these demos I started with separate Harmattan and Silica projects a) to show the implementation(s) as natively as possible, and b) because I could not get a new Sailfish project to start up on Harmattan (the reverse should work), and I did not want to get side tracked into that issue…

In a later post I will dive deeper into the implementation.

Update: 2013.06.01 14:03

The Sailfish native implementation has all Page child items in a Flickable control sized to the Page, so all items move down when the menu opens

 

My current AUI implementation does not do this, so while the menu opens, other page controls stay in place, and the menu may open behind them, rendering it not very useful!


Update: 2013.06.09 17:05


The Sailfish flavour of  AUIPageWithMenu, now changes the z: axis of the menu to high when the menu is active (i.e. open) and low when not active (closed). Also when the menu opens, the opacity of all page childs is reduced (fading these out), so while they are still visible behind the menu, the menu is readable.

Sunday 26 May 2013

Deploying Files to the Sailfish Emulator using the Unix rsync Command: Part 2

Note: As of Alpha 2: The correct install location on the Emulator for import libraries is: /usr/lib/qt5/qml/

In my last post I showed how rsync can be used to sync files to the Emulator excluding unwanted files. We also required an additional set of commands to correctly set the owner and privileges.

Since then I have been working on the Sailfish flavour of AbstractUI, and testing this with my 2 core apps. This means frequent changes to the AbstractUI qmls, and the frequent need to synchronize to the Emulator.

Getting tired of rerunning the same 2 commands; I decided to make life even easier by creating a script synchAUI2Emulator.sh:.

# This script syncs abstractui files from the localhost to the Sailfish Emulator
# and then sets owners and rights

# make this script executable with chmod 755 syncAUI2Emulator.sh
# call it with ./syncAUI2Emulator.sh

rsync -avz -e "ssh -p 2223 -i $HOME/.ssh/mer-qt-creator-rsa" org root@localhost:/usr/lib/qt5/qml/ --exclude .DS_Store \
&& \
ssh -p 2223 -i ~/.ssh/mer-qt-creator-rsa root@localhost "cd /usr/lib/qt5/qml/ && \

chown -R root:root org && \
cd org/flyingsheep/abstractui && \
chmod 755 *.so && \
chmod 644 *.qml && \
chmod 644 qmldir && \
ls -ahl && \
exit \
; bash"

The script lives in my AbstractUI project, at the same level as the org directory which contains everything I need to synchronise.

Now just one call synchronizes all changes: the output shows the files that have been synchronized, and the privileges of all files on the destination.

Saturday 25 May 2013

Deploying Files to the Sailfish Emulator using the Unix rsync Command

Introduction


Note: Now adapted for Alpha 2 / Qt5. See Part 2 of this post for this technique as a script. 

 

In a previous post I showed how files could be deployed to various Harmattan and Sailfish devices.

 

For emulators and real devices we used the unix scp secure copy command.

 

Which worked. . .

 

. . . and would have worked well if Steve Jobs had not thrown  a nasty little spanner in the works.

 

My primary development Qt Host is OSX, primarily because a MacBookAir has just the right combination of portability and power that allows me develop in dead time on the train on the way to work, or like now sitting in an armchair, with Apple-Pip on my lap, a pint of ale on the floor next to my armchair, and my Linn system streaming sweet sweet music.

 

But I am not a mac-head. I point out things that are wrong with OSX, and one of those things is .DS_Store files.

 

OSX automatically litters its file system with these hidden files. These serve some internal cabalistic purpose as sanely documented here. Bill Gates's equivalents are Thumbs.db files, which are just as pesky, but at least have a vaguely amusing name.

 

While these files are harmless in themselves, they cause extra headaches when interacting with version control systems, or when replicating between heterogeneous systems.


The reference above to my Linn was not entirely spurious. For a few years I have been enjoying music steaming at CD quality and above, all stored in FLAC format on 2 NAS systems. Ever so often I sync the NASes with a backup on Butschgi my Mac Pro Tower. I use disparate sources (CDs ripped on Windows using dbPowerAmp), hi-res Albums (legally) downloaded on what ever machine i happen to be on, so after a bit of copying around and syncing between systems I like to count the number of files on each stem; but I always have the problems of those hidden .DS_Store and Thumbs.db files distorting the results .


But getting back to the Sailfish Emulator. Here we again have heterogeneous systems: our host, and the Emulator; and want to copy files from the host to the Emulator without any pesky .DS_Store files polluting our innocent Emulator.


The answer, as previously indicated is the unix command rsync.

 


Tuesday 21 May 2013

Adding Additional Qt Packages to Sailfish SDK and Emulator

Note: 06 Nov 20 13: This post refers to Qt4 packages, thought the techniques are still relevant for the Qt5 Alpha:  Please also see the newer post:

http://flyingsheeponsailfish.blogspot.com/2013/11/deploying-additional-packages-to.html

Having posted the code of AbstractUI  to GitHub yesterday, I plan to post the code to Landed and LandedSettings: my two core apps that use AbstractUI.

However before we do that we need to address one of the first problems that you may encounter when migrating from Harmattan to Sailfish.

Your app may start up on the Sailfish Emulator, but parts of it don't do anything:

The cause?

"Missing" Qt packages on the Sailfish Alpha: Some of the packages installed as standard on Harmattan and that your app relies on, are not installed as standard on the Sailfish Alpha.

Luckily in many cases we can fix that: We simply install the packages to Sailfish.

Many things come in two halves. One example is the new Jolla smart phone just announced: Another is installing packages to Sailfish. We need to install on both the SDK and the Emulator.

In the case of Landed and its sidekick LandedSettings I had to install the packages.

  • qt-components-devel: this gives me access to the com.nokia.meego component Harmattan component set which I will use temporarily to get my apps runnable on Sailfish.
  • qt-mobility-devel: gives me access to the Qt Mobility API for things like Camera and GPS functionality.
  • sqlite-devel: for database access.

Your first step has to be to ascertain which packages are missing, and what they are called. A little bit of googling may help here (or alternatively, searching using zypper on the Emulator).

Installing to the SDK

Then our next port-of-call is the Sailfish SDK Control Center. If you have not yet stumbled over this, it is accessed by the Sailfish Icon between the Projects and Analyze icons on the icon bar on the lefthand edge of QtCreator.

On the Targets tab, click the "Manage" button. This should give you a long list of packages to install or deinstall. The rest is easy: find your desired package and click install.

Installing to the Emulator

This is initially marginally less easy, as we have to do this on the command line via SSH. We will be using the package management tool zypper:

zypper is pretty cool, as it sorts out dependencies, and will install other packages that your target package depends on.

http://en.opensuse.org/File:Zypper-cheat-sheet-1.pdf

http://en.opensuse.org/File:Zypper-cheat-sheet-2.pdf

Connect to the Emulator as described in this post.

As an example, to install the package  sqlite-devel, including other packages this depends on:

[root@SailfishEmul ~]# zypper in sqlite-devel

Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following NEW packages are going to be installed:
pkgconfig sqlite-devel

2 new packages to install.
Overall download size: 322.5 KiB. After the operation, additional 936.9 KiB will be used.
Continue? [y/n/?] (y): y
Retrieving package pkgconfig-0.27.1-1.4.i486 (1/2), 220.3 KiB (574.5 KiB unpacked)
Retrieving: pkgconfig-0.27.1-1.4.i486.rpm ........................................................[done (33.1 KiB/s)]
Retrieving package sqlite-devel-3.7.15.2-1.3.i486 (2/2), 102.2 KiB (362.4 KiB unpacked)
Retrieving: sqlite-devel-3.7.15.2-1.3.i486.rpm ....................................................[done (5.6 KiB/s)]
Installing: pkgconfig-0.27.1-1.4 ..............................................................................[done]
Installing: sqlite-devel-3.7.15.2-1.3 .........................................................................[done]

zypper also supports search, which is great if you don' t know the exact name of a package: You can find packages using the se command. e.g. to find packages with "mobility" in the name:

[root@SailfishEmul ~]# zypper se 'mobility'
Loading repository data...
Reading installed packages...

S | Name                                      | Summary                                                     | Type
--+-------------------------------------------+-------------------------------------------------------------+-----------
  | qt-mobility-debuginfo                     | Debug information for package qt-mobility                   | package
  | qt-mobility-debugsource                   | Debug sources for package qt-mobility                       | package
  | qt-mobility-devel                         | APIs for mobile device functionality - development files    | package
  | qt-mobility-examples                      | Qt Mobility examples                                        | package
  | qt-mobility-haptics-ffmemless             | Plugin which provides haptic feedback via ffmemless ioctl   | srcpackage
i | qt-mobility-haptics-ffmemless             | Plugin which provides haptic feedback via ffmemless ioctl   | package
  | qt-mobility-haptics-ffmemless-debuginfo   | Debug information for package qt-mobility-haptics-ffmemless | package
  | qt-mobility-haptics-ffmemless-debugsource | Debug sources for package qt-mobility-haptics-ffmemless     | package
i | qt-mobility-l10n                          | APIs for mobile device functionality - localization files   | package
  | qt5-qtdeclarative-import-mobility-sensors | QtQml mobility sensors import                               | package

 


Monday 20 May 2013

AbstractUI Code Posted to GitHub

I have now posted the current version(s) of the AbstractUI to GitHub

The Harmattan flavour can be found under:

https://github.com/harmattan/AbstractUI-for-Harmattan

The Sailfish Silica flavour can be found under:

https://github.com/sailfishapps/AbstractUI-for-Sailfish-Silica

Note: This library is still very much work in progress. While the Harmattan version unsurprisingly works well (the dependency on com.nokia.meego being moved form the core apps to the library), I still have some work to do on the Sailfish Silica flavor due to:

  • The conundrum of the missing components
  • Missing properties on Silica components.

This will become food for a future post ...

I also plan to add a repository with the source of my core app Landed sometime soon, once I have done some further tidying up.

Sunday 19 May 2013

Off Topic: Offline Blogger Editing

Offline Blogging

This post is a little bit off-topic, in that it is about blogging, and specifically Blog Editors; rather than the main theme of this blog which is Sailfish.
But given that the SailfsihOS is only in alpha, the communication of ideas and help amongst the nascent Sailfish community is valuable, and blogs are a vital tool to enable that. Hence this "off-topic" post.
I tend to write the first drafts of posts to this blog in dead time; often on the train to and from work; or when we have bad weather of the Föhn is blowing, either of which render flying impossible or dangerous.
This means that I prefer to build up the bulk of the content behind each article off-line.
My first attempt was with MS Word, on the basis that I have it open any way. However I found that the resulting HTML in Blogger was polluted with lots of Microsoft specific tags; and as I found myself editing the Blogger HTML more than I like, this just made life much harder than it need be.
So I next settled on TextEdit, the OSX default text editor, which actually worked well in terms of trapping content. But of course I had to format everything in the online Blogger editor.
And that is not as nice as it should be. Headings and line / paragraph spacings are a real pain. Hence the need to edit the HTML.

Deploying Import Packages to Sailfish and Harmattan Devices the Hard Way

Introduction

Note: This post will be updated for the Qt5 Alpha shortly!

In one of my recent posts I described how to create an import library / package that abstracted out imports of Harmattan and Sailfish Silica components from our core projects.

Towards the end I wrote something like "now deploy to your device" but did not say how as the article was already lengthy in danger of being long winded. Instead I snuck off and did some thing more satisfying like pouring a glass of ale.

So here is a separate article detailing how to install my abstract import package to a variety of Sailfish and Harmattan "devices".

a) The SailfishOS SDK
b) The SailfishOS Emulator
c) The Harmatttan Simulator
d) A real Harmattan Device (e.g. N9)
e) The Harmattan QEMU Emulator (will be added later)

To each of these we will add the library org.flyingsheep.abstracui, including all the .qml and library files  to the respective  "imports" directory.

Note: this article describes how to install packages manually: i.e the hard way.  While it should be possible to do this more elegantly for instance by using the "Deploy to Device" option in QtCreator, there are 2 reasons for doing it manually:
1) general nosiness and a desire to understand what is happening under the hood,
2) The "deploy to device" seems to not be properly working yet for Sailfish, as discussed in this Sailfish Developers' Mailing list thread.
 
I am using an OSX host for this article, so if you are using Windows or Linux, just change the host paths accordingly.

For some of the devices we will create symbolic links (symlinks): I have found this article showing how the equivalent can be achieved on Windows hosts: 

How to deploy an import package to the Sailfish SDK

Here the easy answer is don't!: Instead we will cheat!

My working copy of the qmls and plugins (i.e. where Qt Creator accesses them) is:
/Users/<your home dir>/SailfishProjects/abstractui/org/flyingsheep/abstractui

A proper installation on the SDK would result in:
/Users/<your home dir>/SailfishOS/mersdk/targets/SailfishOS-i486-x86/usr/lib/qt4/imports/org/flyingsheep/abstractui

But we don't want the hassle of replicating the files to the SDK every time we make a change. So let's cheat with a symlink pointing from the imports directory to the working copy. We will actually only have one copy of the files (in the working copy dir), but the operating system will "see" two directories.

We create the symlink as follows:

cd /Users/<your home dir>/SailfishOS/mersdk/targets/SailfishOS-i486-x86/usr/lib/qt4/imports

ln -s /Users/<your home dir>//SailfishProjects/abstractui/org org

Now every time we change a file in the working copy, this change will be available to the SDK without me having to do anything!

How to deploy an import package to the SailfishOS Emulator

Before we start copying, first let's connect to the device, and check what's in the imports directory /usr/lib/qt4/imports:

ssh -p 2223  -i ~/.ssh/mer-qt-creator-rsa  root@localhost

cd /usr/lib/qt4/imports

ls -l

Sailfish Emulator already has an org directory in the imports directory, so we will copy from level flying sheep (and not org)
As we can connect with the user root, we can copy direct to the right place in one step (whereas in Harmattan we have to take a multistep process)

cd /Users/<your home dir>/SailfishProjects/abstractui/org

scp -r -P 2223  -i ~/.ssh/mer-qt-creator-rsa flyingsheep root@localhost:/usr/lib/qt4/imports/org/

You should next check the file permissions: My QtCreator is hosted on OSX, and the files created have permissions that are too restrictive

So we connect to the Emulator

ssh -p 2223  -i ~/.ssh/mer-qt-creator-rsa  root@localhost

Change to the directory containing our qml and library files
/usr/lib/qt4/imports/org/flyingsheep/abstractui

Run the following 3 chmod commands:

chmod 755 *.so
chmod 644 *.qml
chmod 644 qmldir


If your host is OSX, then it will almost certainly have polluted our library with a hidden .DS_Store file in each subdirectory.
You can see these with ls -l -a
To remove these files, navigate through each subdirectory and do a rm .DS_Store

The unix command rsync has an exclude option, and can be used to deploy files as covered in this post

How to deploy an Import Package to Harmattan Simulator

One difference between the Harmattan Simulator and other devices is that the library files are binary compatible with the host rather than with a real Harmattan device. In my case this is OSX, which means that the correct library is called libabstractui.dylib instead of  libabstractui.so This can be found in /Users/<your home dir>/QTProjects/abstractui/abstractui-build-Qt_Simulator_N9-Release/

Once we have a copy of this in the working directory, we can take the same sneaky approach we took with the Sailfish SDK above: We will create an equivalent symlink:

First have a quick peak to see what is lurking in /Users/<your home dir>/QtSDK/Simulator/Qt/gcc/imports/

If all is well we can create the symlink as follows:

cd /Users/<your home dir>/QtSDK/Simulator/Qt/gcc/imports

ln -s /Users/<your home dir>QTProjects/abstractui/org org

This should result in Users/<your home dir>/QtSDK/Simulator/Qt/gcc/imports/org/flyingsheep/abstractui/

How to deploy an import package to a N9 Harmattan device

Before we start copying, first let's connect to the device, and check what's in the imports directory /usr/lib/qt4/imports:

ssh developer@192.168.2.15

enter the developer password. You will this in the "SDK Connectivity" app.

cd /usr/lib/qt4/imports

ls -l

In my case there was no "org" sub directory, so I can copy the package at the "org" level.

Unfortunately we need to take a multi-step approach as root level access is not allowed for ssh/scp (unless you do some hacking). So we will copy our package as developer to the root directory, then login and move to the right place.

Back on your host, navigate to the folder containing the N9 Harmatttan version of the org.flyingsheep.abstractui package.

cd /Users/<your home dir>//QTProjects/abstractui
 
Secure copy the directory abstract including contents with user developer:

scp -r org developer@192.168.2.15:

Connect as developer in order to create directories, and move files to proper place
ssh developer@192.168.2.15

This should connect you n the directory /home/developer. Here you should now find a subdirectory "org"

Now we need to set the unix file permissions properly

cd /home/developer/org/flyingsheep/abstractui/

chmod 644 *.qml

chmod 644 qmldir

ls -l

gives me:

total 612
-rw-r--r--    1 user     develope        58 May 19 10:38 AUIButton.qml
-rw-r--r--    1 user     develope        64 May 19 10:38 AUIButtonColumn.qml
-rw-r--r--    1 user     develope        61 May 19 10:38 AUIButtonRow.qml
…more .qml files ….
-rwxr-xr-x    1 user     develope    433033 May 19 10:38 libabstractui.so
-rw----r--    1 user     develope       696 May 19 10:38 qmldir
 
Now we need root level access
devel-su
password rootme

cd /usr/lib/qt4/imports

3) copy the abstractui directory to the imports directory

cp -r /home/developer/org/ /usr/lib/qt4/imports/org/
 

How to deploy an import package to a N9 QEMU Emulator

Coming soon ...

Conclusion

By now you should have deployed your package manually to a variety of Sailfish and Harmattan "devices".

Your next step will be to install and test apps depending on your package.  Have fun doing this!

Sunday 12 May 2013

Migrating from Harmattan to Sailfish Silica using an Abstraction Library

Introduction

Note: This post will be updated for the Qt5 Alpha shortly!

Sailfish Silica and Harmattan are related: both build on Qt  / QML: so it should be possible to port an app from Harmattan to Sailfish, or even to maintain an app that runs on both platforms from a common code base. Indeed doing so, and some of the challenges I have encountered was the trigger for this blog.

In future articles I will examine this theme from an architectural point of view, and question if a multi-platform from one code basis is actually desirable or truly possible; but in the context of this post we will assume that such an endeavor is both possible and desirable; and show how we can achieve this using an abstraction library that will remove direct dependencies on com.nokia.meego or sailfish.silica from the core code of our apps.

The Problem

Unless your app is very basic, the chances are you will have import commands such as import com.nokia.meego 1.0 in your QML code, giving you access to Harmattan components such as PageStackWindow, ToolBarLayout, and even Button, which in turn give your app the Harmattan look and feel.

Equally a native Sailfish Silica app will have imports like import Sailfish.Silica 1.0 which gives access to equivalent Silica components and look and feel.

Now if we are doing a one-way port, abandoning Harmattan in favour of Sailfish Silica, then we can just replace the import call, replace or rename some of the components, and voila we have a Sailfish app.

But if we want to maintain an update an app on both platforms then things get a little more tricky. Clearly we don't want to maintain 2 parallel projects, one importing Harmattan, and the other Sailfish. Every time we add new functionality or fix a bug we will have to remember to change both projects .... 

Equally we don't want the kludge of platform dependent IFs or IFDEFs littering our code. Our app code should concentrate on doing what it is supposed to do, and not need to worry about the platform it is running on.

To achieve this we are going to use an abstraction library.The basic concepts are well documented by Thomas Perl on his blog which you can find here

In this article I will build on Thomas's work, and address some additional problems.


Connecting to the SailfishOS VMs with WinSCP

Introduction

Note: This post will be updated for the Qt5 Alpha shortly!

Ever get fed up with navigating through unix directory structures on the command line? Having to type PWD because you have forgotten exactly where you are?
Do you need to transfer files from your localhost to your VMs?

Well if you are running in on Windows you are in luck: Meet WinSCP

For those who don't know WinSCP, it's an excellent File Transfer tool in the style of 
Norton Commander / Total Commander. It is one of the easiest ways of transferring files from Windows to Unix, and for navigating a remote Unix instance.

This is a guide to setting up WinSCP to connect to Sailfish SDK and Emulator, and in particular how to modify the RSA keys so that this is possible.


Saturday 11 May 2013

Connecting to the SailfishOS SDK and Emulator

Introduction

02 Aug 2013: Adapted for Qt5 Alpha

At some time you will want to get into the heart of the SDK and Emulators. maybe you: 

  • need to install additional packages
  • need to change some settings
  • move some files around
  • have to manually deploy or deinstall your app
  • or are just nosy, and like a small boy delight in taking things apart to find out how they work.

There are two ways to do this:

  • opening a terminal directly on the GUI of the virtual machines. I will call this VM terminal.
  • connecting via SSH from a terminal session on your local host.
In both cases you will working in a unix shell, and be able to do much the same thing. On the whole I have found it better to use the SSH from local host root because:
  • the local terminal uses my local keyboard settings, the VM terminals do not, and trying to figure out half way through a long unix command how to type US special symbols with a Swiss keyboard does not help speed up typing!
  • you can't scroll up in the VM terminal sessions - this forces you to have to pipe commands like ls to more
However there are times where SSH does not work (more on this later). In that case the VM terminal approach is a godsend.

Setting up the SailfishOS Toolkit for both SailfishOs and Harmattan:

Introduction:

Note: This post will be updated for the Qt5 Alpha shortly!

In this post I show how to setup QtCreator from the SailfishOS Toolkit so that we can develop both for Harmattan and for SailfishOS from one IDE.


Why would you want to do this?

If like me you want to port your Harmattan apps to SailfishOS, and wish to keep both versions running from a common project with a common code base, then it is very handy to be able to build run and launch our apps from one IDE in both Emulators side by side.

As a first baby-step in a migration it would be wise to get our existing apps running on the Nokia Simulator, Harmattan QEMU Emulator, and the physical device (e.g. Nokia N9) from the SailfishOS Toolkit before we even think of touching the code to port anything. This follows the basic software engineering principle of only changing one thing at at time.


Once this works, then our next challenge will be to get the same projects running on SailfishOS, and to migrate from Harmattan to Silica components…


The Harmattan to SailfishOS Blog:

Why this Blog?

02 Aug 2013: Note: Most of the posts on this blog were written for the Qt4.8.3 Sailfish Alpha: The Qt5 Alpha 2 has now been released. I am currently reviewing all posts for relevancy to the new Alpha, and will be updating / correcting them over the next few days!

Shortly after I bought my Nokia N9 many moons ago, I downloaded the Harmattan SDK and began developing a set of apps for use by paraglider pilots. My development has been on and off, sometimes centred on weekends where the weather was not good enough to fly, other times on the train in the way to work.


One of these apps has even got me out of a sticky situation on a cold and snowy mountain early this year, but that is a story for another time….(yes it does involve a big red helicopter and a long line ..)
 
Then, a few weeks ago I stumbled across SailfishOS, being developed by Jolla, a start-up staffed by many of the people who were behind the N9.
 
As the SailfishOS is the spiritual successor to Harmattan (we hope that Jolla will one day produced a physical successor to the N9), and given that both platforms are technically very similar I have been embarked on an experiment: porting my apps to SailfishOS.
 
The objective was to port my Harmattan apps to SailfishOS, and to keep them running on both platforms; the one next to dead but still physical (i.e. my phone); and the other the future, but as yet little more than a promise. Naturally I would like to do so with a high degree of common code.
 
While I was able to get my first app started on SailfishOS, almost immediately I encountered problems (let’s call them challenges 8-) ) that took a fair bit of research, creative thinking and experimentation to solve.