Skip navigation.
KDE Developer's Journals

Maemo

oever's picture

SlideCompare: improving rendering of slides in KOffice

Rendering slides is a complicated business. Slides can contain tons of different features just like webpages can. People expect that presentations look the same in different programs. Perhaps not pixel-perfect but very similar nevertheless.

OpenOffice and KOffice (and the Maemo/Meego Office Viewer) both have ODF as their main file format. ODF is an open standard and this means exchanging data between these programs should be simple and lossless. To help the developers of these programs find differences in rendering of slides, I have written a program that loads a presentation and shows it as rendered by KOffice and OpenOffice.

As an added bonus, it also shows how these programs render PowerPoint files. PowerPoint files are converted to ODP first and then loaded into each of the two rendering engines. That gives four types of output:

  • Converted by OpenOffice to ODP and rendered by OpenOffice
  • Converted by KOffice to ODP and rendered by KOffice
  • Converted by KOffice to ODP and rendered by OpenOffice
  • Converted by OpenOffice to ODP and rendered by KOffice

You can see an example view in the screenshot and screencast below.

The code has been announced on the koffice mailing list.

Ogg Theora screencast of SlideCompare
Flash screencast of SlideCompare

jaroslaw staniek's picture

Qt for Android, 2nd try

Remember the last call? After less than 5 months we can see apparent success, and a lot more than a proof of concept.


Click to enjoy the show

oever's picture

Silent Metronome in QML

Tonight I could not attend band rehearsal so I used the time to play with the new QML language. There is a nice tutorial online and a good screencast.

QML allows one to write flashy applications with little code. My first QML program is a metronome. The N900 has a metronome program but it is rather boring. It does not look and feel like a real metronome. So I set out to write one in QML and managed to do so in 56 lines of QML. The interaction is simple: tap it to toggle between on and off and slide up and down to move the cross-bar on the metronome which will adjust the tempo in the range 40 to 208 beats per minute.

Without further ado here is the code. You can run it in qmlviewer. Two things are lacking at the moment: a nice SVG image of a metronome and of course the ticking sound. I am keen to find out how to make the metronome produce sound to make it useful.

import Qt 4.6

Rectangle {
    width: 640
    height: 480

    Rectangle { // metronome bar
        id: bar
        x: 320; y: 100; width: 30; height: 300
        color: "#aaaaaa"
        property double tempo: 120

        Rectangle { // weight on metronome bar that determines the tempo
            x: -15; y: parent.tempo; width: 60; height: 30
            color: "#aaaaaa"
        }

        transformOrigin: Item.Bottom
        rotation: 0
        rotation: SequentialAnimation {
            id: anim
            repeat: true
            NumberAnimation { to: 35; easing: "easeInOutQuad"; duration: 60000/bar.tempo }
            NumberAnimation { to: -35; easing: "easeInOutQuad"; duration: 60000/bar.tempo }
        }
    }

    Text { // tempo indicator
        x: 0; y: 0;
        font.pointSize: 24; font.bold: true
        text: bar.tempo
    }

    MouseRegion { // logic for tempo tuning and turning metronome on and off
        anchors.fill: parent
        property int start: -1
        property bool moved: false
        property bool wasrunning: true

        onReleased: { // start or stop the metronome
            anim.running = (moved) ?wasrunning :!wasrunning
            bar.rotation = 0
            start = -1
        }
        onPositionChanged: { // adjust the tempo
            moved = start != -1
            wasrunning = (moved) ?wasrunning :anim.running
            bar.tempo += (moved) ?(mouse.y - start) :0
            bar.tempo = (bar.tempo > 208) ?208 :bar.tempo
            bar.tempo = (bar.tempo < 40) ?40 :bar.tempo
            anim.running = false;
            bar.rotation = 0
            start = mouse.y
        }
    }
}

silent metronome in qmlreal metronome

oever's picture

Silent metronome

Silent metronome
oever's picture

Presentation

Presentation
oever's picture

kword

kword
oever's picture

Alpha version of Office Viewer for Nokia N900 available

Today, Nokia released the first public version of the office document viewer for the Nokia N900 phone. It was uploaded to the Maemo repositories. This version supports text files, spreadsheets and presentations in OpenDocument format (ODF) and Microsoft Office formats. The viewer requires the latest update (PR1.1) to the N900 software. You can install 'Office Viewer' by adding the maemo-devel repository to your N900 catalogues:

Catalog name:
Maemo Extras-devel
Web address:
http://repository.maemo.org/extras-devel
Distribution:
fremantle
Components:
free

Then the application 'freoffice' will be available in the category 'Office'. The install is 9 megabytes.

With the viewer, you can open multiple files at once, open office documents from your e-mail, search in office files and copy and paste from your documents. A very nice feature is the ability to give presentations with the phone. Here are some screen shots of the viewer running on the N900.

Presentation Spreadsheet Text Document Overview

The code for this viewer is available in the KOffice repository. New releases of the viewer will be uploaded to the repository as KOffice progresses towards version 2.2.

The viewer has a simple user interface and responds quickly to user input such as page changing and scrolling.

oever's picture

Sensors in the N900

Nokia has been kind enough for lending me an awesome N900. This will allow me to test KOffice on the phone. Document loading, parsing and scrolling speed could do with improvements.

Apart from using the N900 for serious things, I've also done a bit of playing with it. Qt has a famous OpenGL demo that shows the Qt logo in a QGLWidget. Instead of controlling the rotation of the object with the scrollbars, the adapted version uses the accelerometers in the device to move the logo.

This was a simple adaptation: reading the accelerometers is simple:

Nokia-N900-41-10:~# cat /sys/class/i2c-adapter/i2c-3/3-001d/coord
36 -18 -1134

The application source and a debian package for the N900 are now available.

Here is a screenshot of five running instances in the application overview. The five logos all move if you move the phone.
N900 running qtup

Perhaps a Qt on Maemo guru can adapt this program to be a desktop widget with a transparent background.

oever's picture

qtup running 5 times in N900

qtup running 5 times in N900
mkruisselbrink's picture

Plasma widgets on Maemo5

Yesterday nokia gave away 300 pre-production n900 devices to all attendants of this years Maemo summit in Amsterdam (in the form of a six months loan, after that they'll have to go back to Nokia). I'm also attending, so I also got one. Deciding what the first thing to port to a new device is is always hard, but in the end I figured that something with plasma might be nice.

Syndicate content