lorn
Qt
Qtopia
KDE
Posted by lorn
 in Qt, Qtopia, KDE
 on Monday, June 23, 2008 @ 04:13

After many moons, I have started to work again on my personal project, Gutenbrowser. It is in need of much maintenance and love.

Since Qt finally has a good webview, QWebView, I can finally start working towards version 1.0! With very little work, gutenbrowser can now show Gutenberg Project etexts that come with images.

Since I have a macmini at home, I can distribute Mac binaries, as well as Windows and a few Linux embedded devices (Openmoko Neo and possibly Nokia’s n8×0’s Qtopia )
and with the help of Petter Reinholdtsen, fix a few bugs and be in the standard Debian distribution.

For those that do not know of the Gutenberg Project, there are over 25,000 free books available!

lorn
Qt
Qtopia
KDE
Posted by lorn
 in Qt, Qtopia, KDE
 on Monday, June 16, 2008 @ 19:55

New Nokia Sign

Well,
I start work for a different company today, namely Nokia. Perhaps you have heard of them? No? Well, they used to make rubber boots but now make phones. Lot’s of them. They have a few employees. Lot’s of them. and now, a few more, thanks to the (more or less) peaceful assimilation of Trolltech.

Am I worried? A bit. The management structure at Nokia is overbearing, not like Trolltech’s lean and mean machine. I doubt I will see the CEO of Nokia getting drunk and wrestling with engineers any time soon. I doubt I will ever be called to a meeting with him to pick my brain about community matters, much less even get an email from him. I liked that about Trolltech. The openness, the friendliness.
Hopefully my boss will stop wearing his shoes so much. He used to go barefoot a lot more than he does now. I liked that about him.

Today, I start work for Nokia, sitting in the same desk (I hope), loging into the same machines (I hope), and continuing my work from yesterday (except today is the BBQ beer fest.. wweeeeeeeeeee!), on the Qtopia SDK, on the n8×0 and Neo devices. I still get to work with the greatest multi licensed cross platform toolkit ever - Qt. I get to use the greatest and Kool Desktop Environment - blackboxqt! heh and also - KDE.

Best of all - I get a new phone and some Nokia schwag.

I, for one, welcome our new Nokia overlords!

lorn
Qt
Qtopia
KDE
Posted by lorn
 in Qt, Qtopia, KDE
 on Monday, June 16, 2008 @ 09:01

Well,
This is my last post as a Trolltech employee. I have worked for Trolltech Pty Ltd, in Australia. since 2003. I can proudly say I helped Qtopia become more open, and fully GPL. It’s been a short 5 or so years, I have seen the Brisbane office grow from around 14 people to around 50, found my wife, had a son and daughter. A lot has happened in the past years. Ran ‘make’ more times that I want to think about. Got Qtopia running on all the devices I could. Yelled and complained and praised till I was blue in the face.

Tomorrow (Tuesday), I will be employed by Nokia, doing the same things I did today (well, maybe the day after next, tomorrow is the obigitory write-off “1st day”, BBQ and beer drinking).

It will be a challenging year ahead, I am sure both Nokia and Trolltech ^H^H^H^H^H^H^H^H Qt Software have things to learn from one another. I am personally wishing Trolltech’s seeds of open source will blossom Nokia into a greater thing.

So tonight, while I am unemployed, am going to live it up! and… uh… well… write some code (having small kids really saps your energy) and get more familiar with scratchbox2. (which thankfully uses a real cross toolchain).

I feel it is a bit like Christmas… So, if you talk to a Troll today, shake his/her hand and tell him/her thanks for making the world a more peaceful place.

Thomas Zander
KDE
Bindings Generator
Posted by Thomas Zander
 in KDE, Bindings Generator
 on Wednesday, June 11, 2008 @ 19:00

As many of you know, I’m an OpenDocument fan, I love working on making KOffice rock, which is something I do at every opportunity. The work I do is mostly outside of the KOffice repository nowadays and others are picking up the slack. One really cool development is that I found some people willing to put some corporate funding into making our ODF compliance rock!

If you want to write some software and you want to maintain it for various years the best way to do this is to have regular testing in place to ensure that with further development the features you released in a previous release didn’t break. This is a common practice and the quality of your release is directly linked to the amount of testing you do. In the open source world the many users tend to work as testers, which is a concept that generally works pretty well. A much better solution is to have auto-tests. This is basically a program that does a certain task and checks the outcome for the expected values.

In KOffice we are working on improving out ODF compliance by first writing a test, and then making sure that the feature gets implemented. Before committing all tests ever written are ran and only when all of them (still) pass we can say the new feature is done. It should become obvious to anyone reading this that writing new software like this will create better software that is easier to maintain over time. Especially in open source where new people come and go on a regular basis.

I’m therefor extremely happy to report that Girish Ramakrishnan has so far created and made passing 51 61 OpenDocument Format loading tests. This in effect means we have lots of ODF features we researched what they should do (by reading the ISO specification) and then make sure we actually do that. Now and years from now they will do what they are meant to do.

The features we are testing are, for example, lists. That a document that is meant to have a numbered list with any sort of complex numbering load and show correctly. But sometimes we have some quite different test, things that KOffice never did before. In that case new features have to be added to KOffice. One such feature is the dropcaps. This is a feature that people that write newspaper style documents will love. Let me show a screenshot which explains it best. :)

For this new feature we have yet to add some dialogs to configure this, so to try it out I started OOo and loaded the odt doc in KWord. Which I admit is a pretty cool way to show how far we have come in the interoperability area :D

Update; updated number of passing tests.

lorn
Qt
Qtopia
KDE
Posted by lorn
 in Qt, Qtopia, KDE
 on Thursday, June 05, 2008 @ 19:27

In case you missed it, it is now official
Trolltech merges with Nokia

But do not be scared, my open source friends. This means that Qt and Qtopia will continue to be developed, and have even wider recognition that it is the greatest cross platform GUI toolkit on the planet.

More info here

I am sure there will be more press releases coming soon, so I won’t comment on anything else that might happen. But I can say this, this merger is a two way street. i.e. Nokia wants to learn from Trolltech and Trolltech can learn from Nokia.

What I wonder, is if Nokia can make a rubber boot for my phone. After all, it has been fairly rainy here in Brisbane this year.

Remember, “Trolltech has benefited greatly from the feedback the community has been providing while using Qt to develop free software. We respect the symbiotic relationship Qt has with the community and we wish to continue and enhance this relationship.”

So, keep on hackin’ Qt, Qtopia and Kde hackers, there’s good things around the corner!!

Thiago Macieira
Qt
KDE
Posted by Thiago Macieira
 in Qt, KDE
 on Thursday, June 05, 2008 @ 09:52

I have just committed an interesting change to Qt 4.4 now, fixing an open task reported by David Faure. By itself, the change is hardly worth mentioning:

-#if (defined(Q_OS_UNIX) || defined(Q_CC_MINGW)) && defined(QT_DEBUG)
+#if (defined(Q_OS_UNIX) || defined(Q_CC_MINGW))
abort(); // trap; generates core dump
#else
exit(1); // goodbye cruel world

The interesting part is the story behind the change.

Last night, some KDE friends (Dirk and David to be precise) pointed out that Q_ASSERT and qFatal only call abort(2) if Qt was compiled in debug mode, thereby making it impossible to use a crash handler to display a message to the user, maybe to restart the application as well. You could argue that an application shipped to a user should not have assertions enabled and should not be tripping them anyways, even if you had them enabled. And you’d be correct. The issue was that the application in question was still in development phase, in debug mode, therefore with assertions enabled. But Qt was in release mode, so it simply called exit(3) instead of aborting. The result is that the application being debugged and developed simply disappears, leaving no trace behind of why.

So they asked me: why was that the code like that in the first place?

Inspired by a recent movie I watched in the cinema, that set me off in an archeology expedition, digging through the history of Qt code — more precisely, the qglobal.cpp file. After a few minutes, I had managed to trace down the actual change, after going through two renames of the file (from src/tools/qglobal.cpp [Qt 1 to 3 forms] to src/core/global/qglobal.cpp [unreleased Qt 4 form] to src/corelib/global/qglobal.cpp [current form]), one wide-reaching whitespace change, removing all Tabs in Qt source code, and several renames of the macros, to this change:

Author: Haavard Nord
Date: Tue Apr 18 15:43:46 1995 +0100

fatal() calls abort() if debug flag defined

-#if defined(UNIX)
+#if defined(UNIX) && defined(DEBUG)
abort(); // trap; generates core dump
#else
exit( 1 ); // goodbye cruel world

That means I have just reverted a 13-year-old commit by one of the Trolltech founders!

If we dig further, to the history of the abort() line itself, we end up in change number 43, whose log message is:

Author: Haavard Nord
Date: Mon Sep 5 05:54:23 1994 +0100

Initial revision

And I can’t go beyond that… As with many projects, Qt’s first authors decision to use a version control system was an afterthought. That change above added 43 files and 8438 lines of code.

So, here’s what the qFatal function looked like in Sep 5, 1994:

void fatal( const char *msg, ... )              // print message and exit
{
    char buf[240];
    va_list ap;
    va_start( ap, msg );                        // use variable arg list
    if ( handler ) {
        vsprintf( buf, msg, ap );
        (*handler)( buf );
    }
    else {
        vfprintf( stderr, msg, ap );
        fprintf( stderr, "n" );                // add newline
    }
    va_end( ap );
#if defined(UNIX)
    abort();                                    // trap; generates core dump
#else
    exit( 1 );                                  // goodbye cruel world
#endif
}

And here’s what the equivalent code looks like today, June 5th, 2008, in what will be released as Qt 4.4.1 (edited for brevity):

void qFatal(const char *msg, ...)
{
    char buf[QT_BUFFER_LENGTH];
    buf[QT_BUFFER_LENGTH - 1] = '';
    va_list ap;
    va_start(ap, msg); // use variable arg list
    if (msg)
        qvsnprintf(buf, QT_BUFFER_LENGTH - 1, msg, ap);
    va_end(ap);

    qt_message_output(QtFatalMsg, buf);
}

void qt_message_output(QtMsgType msgType, const char *buf)
{
    if (handler) {
        (*handler)(msgType, buf);
    } else {
[...]
        fprintf(stderr, "%sn", buf);
        fflush(stderr);
    }

    if (msgType == QtFatalMsg
        || (msgType == QtWarningMsg
            && (!qgetenv("QT_FATAL_WARNINGS").isNull())) ) {
[...]
#if (defined(Q_OS_UNIX) || defined(Q_CC_MINGW))
        abort(); // trap; generates core dump
#else
        exit(1); // goodbye cruel world
#endif
    }
}
Andreas
Qt
KDE
Graphics View
Posted by Andreas
 in Qt, KDE, Graphics View
 on Friday, May 30, 2008 @ 13:57

I’m studying how we can add light and shadow to widgets and items. I want to hear what you think :-). So I’ll just throw out my ideas and see what happens.

Light and shadow are special effects that follow and decorate items, and affect how they are rendered, at the same time as they’re a bit different from regular items / subitems, or subwidgets. For both light and shadow effects, there’s sometimes a need to render outside the item’s boundaries and blend into surroundings. For widgets, we then need to do something to break out of the box model… to make that happen. For inside-widget light effects, we’re limited to what we can do inside paintEvent() or inside the paint() function. I don’t know about you, but I think both light and shadow effects should be primary citizens of the scene graph, which essentially means they are also items. Stack-above / always-on-top (overlays) or stack-below / always-below items (underlays?).

Here’s a flash video showing a sample of what I’m working on. This is based on Graphics View.

The scene consists of 150 elliptoid items with shadows, and one light source that’s flying over it. It’s a bit psychedelic; anyone who loves colliding mice will love this. ;-) Haha.

Let’s start with shadows. In 2D, shadows can be pretty simple. Shadows can be thought of as transformed filled outlines of an object with a dark semitransparent fill and possibly fuzzy/blurred edges, stacked below the object itself. It has an offset, and/or an angle. The offset can be fixed for all items, or relative to one or more light sources. Ideally two shadows on top of each other don’t make a darker shadow, rather they blend with each other along the edges. Exact shadows are expensive to do accurately, and in many cases they’re completely pointless because they’re hard to see in the first place; at least the types of shadows we foresee being used in 2D / 2.5D UIs… Extreme shadows are cool but useless, subtle shadows, however, to me, are/can be beautiful. There seems to be a “market” for simple stupid fast shadows (e.g., bounding rect / bounding region based), pretty good medium-speed shadows (e.g., shape based), and custom shadows. And possibly perfect shadows (e.g., based on paint()) but I don’t really think that market is very big :-)).

As for how shadows are stacked, the easiest way is to just say that an item with a shadow always renders the shadow before itself. This works fine for most cases. But as soon as sibling items come close, and one’s shadow renders on top of the other, it starts looking wrong.

Sibling Shadows 1 Sibling Shadows 2
Take 1: Sibling shadow overlaps Take 2: Sibling shadows behind both

It would be nice if I could set a shadow on our favorite “Drag And Drop Robot” without having lower leg shadows cast on the upper legs, or a shadow from the left leg draw on top of the right leg. I can see the need for both, but what would the API look like? And how would the items be stacked? My solution right now is to add a special flag to QGraphicsItem called QGraphicsItem::ItemStacksBehindParent (the child and its children are behind the parent), which is certainly one step on the way.

The other thing is how the shadow is placed. I don’t know about you, but I hate it how some presentation tools rotate the shadow relative to the item when you rotate and item that has a shadow on it. A picture says more than a thousand words:

Shadow follows item transform Shadow transform relative to scene
No :-( Shadow follows item. Yes! Shadow follows scene :-)).

It’s a bit complicated though because you want the shadow to follow the item, but you wants its offset to be done scene-relative. Turns out it’s just that the item’s local transform is prepended to instead of appended to the parent item’s scene transform. So I added a flag for that: QGraphicsItem::ItemBeforeSceneTransform. Btw this is just research, it’s not in Qt snapshots or anything.

Now light effects come in many different shapes and colors. Light can affect shadows, or it can just add a glow to an item. Light is typically represented by an abstract member of the scene, to which you can calculate distance and angle and apply a suitable effect to your item, or the background, and so on. In styling, we usually fake light big-time by just applying light and dark effects to our button bevels, or use pixmaps that look shiny and sparkly. Which, of course, is in many cases much faster than doing “correct lighting”. I recall once Zack Rusin and I were talking crap, I don’t know who brought it up but if the whole UI was a complex detailed 3D scene graph, lighting could come by itself (I think the discussion started with why buttons in RTL mode don’t have shadows cast as if the sun shine from the upper right).

For blend effects it’s also necessary to apply aftereffects that combine the source and destination. That can be done in two ways - either just via an offscreen buffer, or directly onto the destination device / framebuffer / or so. If we want blend effects I think we need some type of shader integration. Let’s not digress though.

So, ball in your court. What are your thoughts about light and shadow?

Thiago Macieira
Qt
KDE
News
Posted by Thiago Macieira
 in Qt, KDE, News
 on Wednesday, May 28, 2008 @ 15:51

Earlier this month, we released the single, largest release of Qt since the 4.0.0 release two years ago. Qt 4.4.0 is the result of 10 months of hard work by the Trolls, including numerous distractions. And while it’s being digested by our clients and users, we’re working on Qt 4.4.1, which will include fixes for bugs that were already known at the time of the 4.4.0 release, as well as some that people have reported.

In the meantime, we take two steps back, to the 4.3.x series, and then one step forward: we’re releasing today Qt version 4.3.5. This release is meant for those who cannot upgrade to Qt 4.4.0 yet, but need fixes for some important issues. All of the changes done for 4.3.5 will be present in 4.4.1 and some are even part of 4.4.0 already.

This is the first time ever we’re doing a public release of the previous minor series. In the past, we’ve always stopped development of the previous minor series when the next one came out. Sure, we’ve done security fixes when needed and Trolltech Support continued to support clients using them, but we’ve never made a public release. So this is news for us too. :-)

One of the main reasons that made us decide to release 4.3.5 was the sheer size of the 4.4.0 upgrade. Many customers are scared to take the leap. Not that 4.4.0 is a bad release — no, far from it, all indications so far are that it is a great release. (At least, the Trolltech head of Support hasn’t tried to kill me yet for it!) But nonetheless, we decided we would reassert our commitment to all clients and users despite all distractions, by providing them with one more 4.3 release.

If this proves to be a good thing, we may repeat it for the 4.4.x branch when Qt 4.5.0 is released, although we’re not expecting anything as groundbreaking for that release as 4.4.0 was. We also have two or three bugfixes up our sleeves in the 4.3 branch, which may lead to a 4.3.6 release if necessary.

Including the pictures of the Qt developer team again, since a few more people have been patched in.

Oslo team Berlin team
Oslo team Berlin team
lorn
Qt
Qtopia
KDE
Posted by lorn
 in Qt, Qtopia, KDE
 on Tuesday, May 20, 2008 @ 20:00

It’s been a long time since I have blogged anything. Been busy finding a new house to live in, then moving house, then holiday/being sick at Waikiki in Hawaii. Waikiki is much like the Gold Coast here in Queensland, except people there wear shoes, and tops. Australia is much more baby/family friendly, although. My 2 years old son finally conquered his fear of ocean waves, and was happily swimming in the ocean. Now we just need to wait for summer here so we can go swimming at the beach.

Been working on Qtopia integrations on the ficgta02 and n810 and readying for the upcoming Qtopia 4.4 release.

In particular dynamic rotation. Still small things to be fixed up for Qtopia 4, as a late addition to the Qtopia 4 game. We used to have it way back in Qtopia 1 and 2, but for Qtopia 4 it was never ported or really thought about, as most devices we were developing for did not need it, or didn’t really seem sensible to have it. But the Neo and n800/n810 are different. In particular, the Neo, has no buttons, so it can be oriented in any direction.

Qtopia 4 is much more complicated than Qtopia 2, with theming, styling and all that jazz.

Qtopia on the Openmoko Neo (ficgta01 and ficgta02) is mostly working. The Openmoko folks have picked up on Qtopia on X11 porting/demo code we had done, and started working more extensively on it for the Neo phones. They plan on trying to meld Qtopia with Enlightenment stuff. Or at least make them work together. Who says Qt and Gtk can’t live together?

Qtopia on n800/n810 is coming along nicely as well. We made the n810 rotate whenever the keyboard is slid in or out. Being in portrait mode when in and using the few buttons it has that way. Probably the most difficult thing for the n810 so far was the keyboard driver, going back to the days of the Sharp Zaurus qwerty keyboard.

Other projects going on I cannot speak of, but they generally benefit Qtopia.

Thomas Zander
KDE
News
Posted by Thomas Zander
 in KDE, News
 on Friday, May 16, 2008 @ 18:48

Its been a while since I introduced ‘Vng’. Vng is still under production and innovation is happening :)

As a quick intro can be read here, which will tell you that vng is a version control system made to be usable by humans.

So, what has happened since my last blog. Well, I’ve been polishing a lot. This means that I have added various options to the major commands. Like adding all files in a dir recursively to the repository. Which you really miss if you need it.
Another thing I added was a matcher. The most obvious place where this is visible is in watching past changes. The changes command will naturally list things like commit-message, author etc. Using the various matchers it becomes trivial to do some more intelligent interrogation of your repository.
vng changes --match zander #show all the records which ‘zander’ made.
vng changes --last 10 #show 10 records
vng changes --from-match 'fix assert' #Find the record with ‘fix assert’ in the message and start showing changes from there.
vng changes --to-patch 'Add.*Command' # show only changes until one that matches the regular expression.
Naturally you can combine all those without problems.

Most of these things you probable just have to try out to see how it works for you. I’m someone that really cares about the tiny details so you’ll find things like showing when you changed whitespace at the end of the line with a colored marker, or being able to type ‘vng what’ instead of the full command ‘vng whatsnew’ since, well, vng knows you must have meant the full one, naturally.

Back to the “what happened” point. I always get a bit excited when I have a tool that is just smart in visualization etc. But I actually started writing this blog for a reason;
The main complaint I have heard from people trying git on the Qt repository (specifically on Windows) is that its slow. Now, we know that git has some scalability problems on Windows, and the git people are working on that. But in my interviews with various perforce users that actually made the above claim I noticed a very different problem.
The way that perforce works is that your checkout has all files checked out as read-only. Whenever you want to edit a file you have to tell perforce. Which tells the server you are editing this file.
The effect of this is that doing a ‘p4 diff’ will first ask the server which files you have opened and then do a compare of only those files with your local copy. This is substantially different from git or darcs or many others which all use the file-date to check if you have edited a file. Using a filedate has the big disadvantage that for a repository the size of Qt (or KDE) you have to stat 30000 files if you ask your app to give you a diff. This is disk-access and thus slow.

So, no matter how much the file-access is optimized and duplicate statting is reduced, the concept of making the user keep track of which files to diff will always be faster then letting the tool auto-detect this.

This conclusion then lead me to investigate in what manner it would be practical to re-use this concept for the people that now have very good reason to complain about slowness. I mean; instantaneous diff, or waiting 30 seconds on cold caches to do a diff of Qt…
I have used my creative-Friday today to work on this in vng and have for the most part finished the implementation. I have added ‘vng edit’ and ‘vng opened’. Edit will ask the user if he wants to switch to the way of working that he has to mark files for editing. After which any whatsnew / record etc will only happen on the files that are being edited. The biggest change, naturally, is the speedup. The results will be on screen instantaneously since we already know which files are changed and we avoid any file listing or statting.
Next step is to make the perforce integration that virtually all tools have work for vng. This integration is in most editors, in diff and various other tools already. They will detect a file that is read-only and will call p4 edit on the file prior to writing out your changes. If we can fool those tools into doing the same but then call vng edit instead we get a huge speedup virtually for free.

Are you interrested in trying out vng; see vng.googlecode.com or just download the sources from repo.or.cz/w/vng.git. Note that the speedups are not in the downloadable executable posted on the projectpage. I’ll have to rebuild that one soon.

Have a good weekend!