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
    }
}
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
Thiago Macieira
Qt
KDE
News
Posted by Thiago Macieira
 in Qt, KDE, News
 on Tuesday, May 06, 2008 @ 14:58

Qt logoThat’s the moment we’ve all been waiting for… or dreading. We’ve worked for long months getting it done and you’ve all been asking for it. Some of you even realised it has already been available for a few days, unannounced… And now it’s finally, at last, there!

Qt 4.4.0 is released

Last week, we had a sneak release to current customers. And now it’s on the Trolltech homepage for the world to see. To make your life easier, here’s a download button:

Download Qt

We’re quite proud of this release. It’s the most feature-packed release of Qt ever and certainly the largest release since Qt 4.0.0 itself. This release adds:

  • The Windows CE platform
  • The Phonon new module: multimedia integration
  • The QtWebKit new module: web integration
  • The QtXmlPatterns new module: powerful XML support
  • The QtHelp new module: flexible help support
  • The QtConcurrent framework: parallel programming
  • A new network resource access stack
  • Support for regular widgets on Graphics View
  • Support for non-native windows
  • Support for shared memory
  • Support for inter-process semaphores
  • Support for painting on auxiliary threads
  • Support for atomic operations on integers and pointers
  • Improved printing support
  • A new Qt Assistant
  • And much more, since I will never be able to remember everything we’ve done

Not happy with all of that, we’re also bringing you:

Continuing with the tradition started with the past minor release, we bring you those who did the work:

Oslo team Berlin team
Oslo team Berlin team

Trivia: there’s someone on both pictures. Can you spot who?

Thiago Macieira
Qt
Posted by Thiago Macieira
 in Qt
 on Monday, April 28, 2008 @ 08:04

You know that every toolkit and language that is more recent than C has its own string class. Some say it’s a feature of the C language not to have a string built-in, keeping it lean and simple. Others say it’s a drawback, thus making people have to roll out their own and make beginners always fall to the trap of comparing two strings for equality with == instead of strcmp.

C++ inherited that and its initial versions did not have a string class. It wasn’t until the Standard Template Library was standardised that the language got std::string. But that was too late for Qt: Qt 1.x had long been out and it included its own string class (QString). And for a long while, Qt could not rely on there being a sane implementation of STL in the user’s compilers.

Today that problem is solved, but QString is still there. For several reasons, including:

  • QString is implicitly-shared
  • QString is a Unicode string

The first of those innovations was already present in Qt 1.x, but the second is the one that interests us now. For Qt 2.0, QString was transformed from a simple array of bytes into a proper Unicode string. The old Qt 1 string class became the QCString class from Qt 2 and 3 fame and survives today in the form of Q3CString in Qt4, but implemented using the new QByteArray. (The old Qt 1 to 3 QByteArray class is still available as Q3MemArray today, using the almost identical class that used to be Qt 1.x’s QGArray).

As soon as you have Unicode strings in an 8-bit source code, a question always comes about: what encoding is your file? Even today, with the widespread use of UTF-8, we can’t rely on that fact (text editors in Windows being the worst example). And since Qt must convert from a given 8-bit encoding into the UTF-16 format used by QString, it has to know what you used. That’s why you can find the function QTextCodec::setCodecForCStrings() in the Qt API.

That’s fine for application developers, but how about library developers? If you want your library to be used by application developers who use other encodings in their applications, how do you solve the problem? One solution is to restrict yourself to ASCII codepoints only (that is, from 0 to 127), hoping that will be the correct thing. In most cases, that will work out just fine, but there are some weird encodings out there that are not fully compatible with ASCII.

(For example, did you know that the Shift-JIS encoding for Japanese does not have a backslash? Most Japanese users of Windows think that “C:¥Windows¥System32″ is what everyone sees)

There’s a drawback though: if the application developer set the codec to be something complex, all of your simple ASCII strings will still be parsed using that codec. You’ll then suggest using QString::fromLatin1, which appeared in Qt 2. That function converts a Latin 1-encoded (ISO-8859-1) string into UTF-16. That is, actually, a very simple operation because the ISO-8859-1 encoding matches exactly the first 256 codepoints in Unicode. Therefore, that’s a fast operation and you won’t have a performance penalty due to slow codecs.

The use of QString::fromLatin1 is widespread in Qt 2 and 3 applications and libraries, as well as Qt itself. In fact, you’re likely to find code like the following in many source files:

#define QFL1(x)     QString::fromLatin1(x)

That doesn’t eliminate all performance penalty, though. It creates a QString in any case and that could be a waste of processor time for some simple operations, especially on temporaries. For example, a comparison like:

    if (text == QString::fromLatin1("Qt"))
        doSomething()

will trigger the construction of a QString temporary and its internal data structures, will allocate memory on the heap to accommodate the UTF-16 version of “Qt”, execute the comparison and then delete all of that. Seems like a waste, right?

Well, we thought so too. For Qt 4.0, we introduced a very small new class called QLatin1String. I can summarise it like this:

class QLatin1String
{
public:
    inline explicit QLatin1String(const char *s) : chars(s) {}
    inline QLatin1String &operator=(const QLatin1String &other)
    { chars = other.chars; return *this; }

    // add here inlined operator==, operator!=, operator< , operator>, etc.
    // against QString and against const char*
private:
    const char *chars;
};

You can look up the complete version in Qt’s source code of today. But you can readily see that it’s small and almost trivial. This allows us to rewrite the comparison above as:

    if (text == QLatin1String("Qt"))
        doSomething()

And given a suitable operator== function that compares a QString against a QLatin1String without having to first convert any of them, we’re set. This is the best we can squeeze out of it.

Or is it?

Well, unfortunately, there are two problems with current Qt 4.4 code: first, there are many overloads missing in QString that could take a QLatin1String. Take, for example, QString::replace. It has overloads taking a QChar, QString and QRegExp. What that means is that a QString temporary is created if you were to call that function with a QLatin1String argument. We’re addressing this issue in Qt 4.5, along with a series of other optimisations. (the replace function itself will get an improvement)

The other issue is the signature of those functions. Let me take the simplest example from qstring.h, the QString constructor:

    inline QString(const QLatin1String &latin1);

As you can see, the function takes a constant reference to a QLatin1String object. And we saw in the definition above that QLatin1String is nothing more than a wrapper around a const char * pointer. That unfortunately means we’re telling the compiler to pass a reference to a pointer, or a double indirection to the actual data. You’d never write a function whose argument is of type const char * const &, would you?

In other words, in order to complete that call, the compiler must compute the address of the data, save it somewhere on a scratch area and then pass the address of that scratch area as argument to the callee. An analysis of the assembly code reveals our mistake:

C++ code x86 assembly x86-64 assembly IA-64 assembly
extern "C" function(const char*);
function("foo");
Non-PIC
        movl    $.LC0, (%esp)
        call    _function
        movl    $.LC0, %edi
        call    _function
Doesn’t exist
PIC code
        leal    .LC0@GOTOFF(%ebx), %eax
        movl    %eax, (%esp)
        call    _function
        leaq    .LC0(%rip), %rdi
        call    _function
        addl    out0 = @gprel(.LC0), r1;;
        br.call rp = _function
extern "C" function(const QLatin1String &);
function(QLatin1String("foo"));
Non-PIC code
        leal    -4(%ebp), %eax
        movl    $.LC0, -4(%ebp)
        movl    %eax, (%esp)
        call    _function
        movq    %rsp, %rdi
        movq    $.LC0, (%rsp)
        call    _function
Doesn’t exist
PIC code
        leal    .LC0@GOTOFF(%ebx), %eax
        movl    %eax, -8(%ebp)
        leal    -8(%ebp), %eax
        movl    %eax, (%esp)
        call    _function
        leaq    .LC0(%rip), %rax
        movq    %rsp, %rdi
        movq    %rax, (%rsp)
        call    _function
        addl r14 = @gprel(.LC0), r1
        adds out0 = 16, r12;;
        st8 [out0] = r14
        br.call rp = _function
    

The assembly generated for a calling with a character constant almost doesn’t involve memory operations: on the x86, function arguments are always passed on the stack, so there’s no avoiding that. However, on both the x86-64 and the IA-64, where the arguments are passed on registers, there are no memory operations at all. When the code gets assembled, all that will remain is an addition. However, the call with a contant reference always causes memory operations, in all architectures.

So what happens if we passed the QLatin1String object by value?

C++ code x86 assembly x86-64 assembly IA-64 assembly
extern "C" function(QLatin1String);
function(QLatin1String("foo"));
Non-PIC
        movl    $.LC0, (%esp)
        call    _function
        movl    $.LC0, %edi
        call    _function
Doesn’t exist
PIC code
        leal    .LC0@GOTOFF(%ebx), %eax
        movl    %eax, (%esp)
        call    _function
        leaq    .LC0(%rip), %rdi
        call    _function
        addl    out0 = @gprel(.LC0), r1;;
        br.call rp = _function

As you can see from the assembly output above, it’s exactly the same as the const char * version! So what should I do now? I should replace all of the arguments that take a const QLatin1String & in Qt’s API with a simple QLatin1String argument. And I have to do that now without breaking source or binary compatibility.

Some assembly explanation: PIC means “Position Independent Code”, meaning the code in question can be loaded at any address in memory. That’s the default and only mode for IA-64, whereas on the x86 and x86-64 platforms, it’s usually used in libraries in ELF-based systems. The .LC0 symbol is where the compiler put my “foo” NUL-terminated string. On the IA-64, the r1 register is called “global pointer” (sometimes seen as “gp” in the source code) and points to the center of the module’s data, whereas the r12 register is the “stack pointer” (sometimes seen as “sp”). On the x86, the compiler uses any available register to store the address to the GOT and, in this case, it chose the %ebx register; on the x86-64, it is not necessary since it used addressing relative to the instruction pointer. Those symbols starting with @ are linker flags: they tell the linker to generate some relocation information at that point in the code (GOTOFF is the offset to the GOT [Global Offset Table], @gprel is “relative to the gp”, which is the exact same thing under a different name, so the operation above was: “out0 = (.LCO - gp) + gp”).

The code above was generated with gcc -O2 -S, but I removed the instructions that weren’t relevant to the calling sequence.

Thiago Macieira
Qt
KDE
Greenphone
Posted by Thiago Macieira
 in Qt, KDE, Greenphone
 on Friday, April 18, 2008 @ 13:42

I am writing now from the Trolltech booth at FISL, where the KDE contributors have also taken up shop. It’s the second of three days and I’m already very tired. I was very surprised by the toll that booth duty takes in such a large conference!

FISL (International Free Software Forum, in its acronym in Portuguese) is held yearly in the city of Porto Alegre, of the southern state of Rio Grande do Sul in Brazil. It is probably the largest South American event and one of the largest in the world. Yesterday I’m told there were 7000 people walking by and today it’s probably going to be even more, since it’s Friday. This is the first time that Trolltech has a booth here, but technically not the first that it has had presence.

At several points in time yesterday, we had our 3m x 3m booth packed with people listening to my ramblings (or Knut’s, or Helio’s, or Josef’s more constructive speeches). Questions ranged from people who wanted to know what Qt was and if it could be used for their application purposes (”Does Qt have forms?” or “Do I have to know C++?”), to people who were asking about Qt 4.4 new features, such as WebKit and Phonon.

There were also people asking about KDE 4 and its current state. Hélio had a nice presentation yesterday showing the state of things. Today, Kévin Ottens from KDAB is holding an introductory course to Qt4 development. Later on, there’ll be a KDE-Edu presentation by Maurício Piacentini (the KDE Games coordinator) and one by Andreas Hanssen on the future of graphics development in Qt. He says it’s Qt 4.6 material…

We also had people asking about Java and other languages. I was pleased to be able to tell them about Jambi, but I think I need to learn I lot more about it. Thankfully, Helio downloaded and installed Qt/Jambi on one of the demo computers here. It’s packaged by Mandriva, so it was a matter of a few commands only.

What amazed me was how much crowd two books and one Greenphone attract. Lots of people asked us when the Greenphone would be on the market — to which we had to answer that it’s already over. They also kept on asking if we were selling the C++ GUI Programming with Qt4 books we had on display.

Things to remember for next time:

  • Bring A4 or A5 leaflets with information on Trolltech
  • Bring a set of small loudspeakers so that the Qt4 Dance video can be heard
Comments Off
Thiago Macieira
Qt
KDE
Posted by Thiago Macieira
 in Qt, KDE
 on Thursday, April 03, 2008 @ 17:47

Exactly one month ago, I blogged about three different Qt 4 releases in the space of two weeks, even though one was an alpha. Now, I’m happy to bring you to the Qt 4.4.0 Release Candidate, which you can readily download from our FTP servers and mirrors in the Open Source version, or from the commercial distribution server for our commercial licensees.

This is the last scheduled step before the final release. If all goes well, we’ll have the final packages out the door in more or less a month. In the mean time, our team will be resting and doing nothing…

Wait, no, just kidding. ;-)

As the name says, this is a release that we consider to be of release quality. While we still have a few outstanding issues we want to fix before the release, this release is good enough to be used for most tasks. In special, we’re interested in knowing if anything is broken as compared to previous releases.

We’re doing our best to anticipate the ways our product could break, but we can’t catch all cases. And as proven by our own final sanity checks this morning, it’s getting more and more difficult to do it. And there comes a point when you can’t think of creative new ideas to do it (pasting 1 MB worth of junk into line edits, for instance).

Here’s where you, dear reader, comes in. Please download the RC1 and run your Qt4 application with it. If you see things not working like they used to, let us know.

I won’t be talking anymore of the cool new features of this release. I did that one month ago and I’ll let our Marketing Team take over now. Besides, there are no new features since the beta. In fact, there haven’t been any since the Technical Preview, which was when we entered Feature Freeze mode. But soon we will have Qt 4.5 development start and Labs will fill again with blogs from developers about the CoolNewStuff™they’ll be working on, as well as information from our roadmap.

Snapshots

Some people have already noticed that there are changes in the Qt snapshots. A couple of weeks ago, we started publishing snapshots of the Qt 4.5.x tree (mainline development, a.k.a. “trunk” for Subversion users). We’re publishing those snapshots in the so-called “minimal set”: only the Qt/Embedded Linux, Qt/Windows CE and the merged Qt/X11+Mac+Win (the misleadingly called “qt-all” package) packages are published daily.

Also, last week, the Qt 4.4.x tree snapshots changed version numbers to 4.4.1. What happened there was that the 4.4.0 release was branched off for final fixes, while other development continues in what will become Qt 4.4.1. Our development process calls for a branch before public releases so we can do some intensive testing without many changes going in and potentially invalidating previous test results.

Thiago Macieira
Qt
KDE
Posted by Thiago Macieira
 in Qt, KDE
 on Monday, March 03, 2008 @ 19:01

The former Release Manager here at Trolltech told me that the former former Release Manager had a saying:

The release is not out until you blog about it

So I’m doing a 3-in-1 blog!

Qt 4.3

A week and a half ago, we released Qt 4.3.4, containing some bug fixes to issues reported to us since 4.3.3 was released. It seems old news now (even though it’s only my last blog entry), but Qt 4.3.4 is also the first Qt 4 release under the GPL version 3. The snapshots were already under that license, but now system integrators and Linux distributions can upgrade their packages to an officially released version.

Qt 4.4

Then, one week ago, we released the long-awaited first beta for Qt 4.4, containing a lot of new features, like WebKit, Phonon & backends, network access, Qt Concurrent, Widgets on the Canvas, improved printing support, Patternist, Aliens, a new help system and a lot more that Trolltech developers have been blogging about. This release is so big that we could have split it in two or three and we’d still have enough to go around — note how there are 17 links to blogs about different features in the previous sentence alone! (We’re still writing the change log file for the release) It’s also very daring: who could have imagined a full web engine built in the toolkit a year ago? And just like Qt 4.3.4, the 4.4.0 beta 1 Open Source edition is licensed under the GPL versions 2 and 3.

The beta 1 also marks the first new platform for Qt in many years: Qt/Embedded for Windows CE. It’s now the fifth platform that Qt supports, after X11, Windows, Mac and Embedded Linux (QWS). It’s the result of a year and a half of work done mostly by the Trolltech Berlin office, trying to adapt our existing Windows code to a deceptively similar platform. If you have tried to develop for WinCE, you’ll have noticed that the APIs that are available in the Microsoft products are full of subtle differences and not-so-subtle omissions. Well, Qt brings you a unified, cross-platform API, across the board.

Qt 4.5… (not quite)

Talking about new platforms and deceptively similar platforms brings me to the Mac. Apple has not been afraid of changing their platform under you. The 10.5 (Leopard) release of MacOS X is full of those changes, including some that may break existing Qt applications. Qt 4.3.3 introduced initial support for Leopard and that was improved with 4.3.4, with a fix for OpenGL because Apple changed the typedef of a type.

And today we announced the first alpha of the Qt/Mac Cocoa port (hmm… can I call it the sixth platform?). It comes to emphasise our commitment to the desktop PCs, to our customers and providing them with an upgrade path to newer systems. (For those of you not following the Mac news, Apple decided to halt development of the 64-bit version of the base libraries that Qt depends on, called Carbon; so we had to rewrite a good portion of our code using the Cocoa libraries) As any other alpha, this release is expected to be full of bugs and missing functionality. Trenton has posted a list of what’s known to work and what isn’t in his blog. As soon as possible, we’ll make snapshots of the Mac Cocoa tree public so users can follow what’s going on. More news on snapshots at a later date.

Conclusion

So, that’s it: in the space of a week and a half, we have released three Qt versions, in three different minor series: 4.3, 4.4 and 4.5. And that’s not it: we’re scheduling a 4.3.5 and possibly a 4.3.6 release some time in the future, for those clients who cannot or will not upgrade to 4.4.0 when it’s out. And since no more betas for 4.4 are planned, the next release will be the first Release Candidate sometime in the next 3-5 weeks. (In fact, I wrote a rough initial timeline for a year and a half worth of releases. And no, I cannot share that document, since it’s pure speculation at this point)

I’d like to thank everyone involved in making those releases possible: the development team (the Windows CE and Mac Cocoa teams in particular), the support engineers, the Product Management team and all of our users and clients. Yeah, without the input and feedback from you, we wouldn’t have come up with the releases.

I couldn’t finish this blog without mentioning Nokia: while the planning of the integration is proceeding in several fronts, we continue to work. And quite hard. I hope three releases in a week in a half shows how committed we are to what we do. And we will continue to do what we do best: provide you with the best toolkit you can find. For all platforms: “Code once, deploy everywhere” (I think I have to pitch this slogan to Marketing…)

Thiago Macieira
Qt
KDE
Posted by Thiago Macieira
 in Qt, KDE
 on Saturday, January 19, 2008 @ 01:29

I know this information is in Trolltech’s frontpage right now, but I’m told some people prefer to stay informed by reading blogs, so I oblige. Apparently newspapers, telecasts, press releases are a thing of the past… when was the last time you tuned to the news on the radio anyways? (Hmm… do you even have a radio?)

The headline is “Trolltech’s Qt to be licensed under the GPL v3,” which was announced by our CEO, Haavard Nord, during the KDE 4.0 Release Event, in Mountain View. Even Richard Stallman, president of the FSF and pointman in the efforts to update the license, has commented. Aside from the fortunate timing reason, we chose this time to make the announcement because it shows our commitment to Free Software. And what better time than the celebration of the release of probably the largest open source project there is?

This has been a long process, actually. Ever since the Free Software Foundation announced the final version of the General Public License version 3 text in late June last year, we have been receiving queries from several different parts of the community about if and when we would release Qt under that license. So for the past week, after Trolltech’s management approved the move, I have been working on updating the Qt 3 and 4 packages.

So now the packages are out. You can download the Qt 3.3.8b packages from our servers right now, as well as an update to the Qt 4.3.4 and 4.4.0 snapshots containing the license. Qt 3.3.8b is a simple relicensing of the 3.3.8 release: it contains no new features or bug fixes. It also does not change our support policy towards Qt 3. This release includes only the free Qt 3 packages — that is, Qt/X11, Qt/Mac and Qt/Embedded — because they are the only ones affected.

As for the Qt 4 series, we are not making any special release at this moment. Our snapshots are updated, so all the early adopters can start using the new license if they want to. The upcoming Qt 4.4.0 beta 1 and Qt 4.3.4 releases will be the first ones to actually be under the GPLv3 license.

For clients and users who are somehow constrained to the GPLv2, nothing changes. Qt is now a triple-licensed toolkit: commercial, GPL version 2 and GPL version 3 (technically, the X11 version is even quadruple-licensed). In the Open Source version, you get to choose which one you want to apply to your code. And if neither option is suitable for your needs, there’s always the commercial alternative.

One other thing I would like to point out is the fact that we are “future-proofing” it. The new license headers say specifically that you may:

(at your option) use any later version of the GNU General Public License if such license has been publicly approved by Trolltech ASA (or its successors, if any) and the KDE Free Qt Foundation.

(For those of you who don’t know what it is, the KDE Free Qt Foundation is what we call a “poison pill” for Trolltech: should we ever stop releasing open source versions of Qt, the foundation is given the right to unilaterally release the last version of Qt under the BSD license.)

And a note to our commercial clients: we have not forgotten about you. Besides the Qt source code release that the open source community gets, you also get a few extra features, like more database drivers. And, most certainly, you get priority attention from our team of support engineers, who work to help you solve your problems.

PS: I am not a lawyer and this is not legal advice. I may have understood some facts incorrectly, so do not take my blogs as advice of any kind. In fact, you shouldn’t even be reading this, right?

Thiago Macieira
KDE
News
Posted by Thiago Macieira
 in KDE, News
 on Friday, January 11, 2008 @ 17:32

If you read Planet KDE or the news at all, you must be already aware that KDE 4.0.0 has been released. It’s all people are blogging about, so I think I should give my contribution to the crowd and congratulate everyone who has participated. Trolltech also sends its regards with this press release.

KDE 4.0 - be free

KDE 4 is the product of hundreds or thousands of contributors: developers, artists, technical writers, usability experts, beta testers, promotion people and, why not, users too. All of those who downloaded and ran one of the alphas, betas or RC and came to one of our IRC channels contributed to making it possible. It’s the result of two and a half years of work on top of KDE 3.5 — adding to the 9 years of KDE 1.x, 2.x and 3.x work.

I was a developer already when KDE 3.0 came out, but I was away from KDE at the time, tending to other businesses. Besides, the KDE 4.0 release is more closely related to the 2.0 release, when I was still playing around with KDE code. And when our codebase was much, much smaller.

Really… there’s no comparison to the KDE 4.0 release. Do you realise how many applications have just been released? How many lines of code that is? (Coverity says it’s 4.7 million, but it’s including apps not released today — by the way, we have one of the lowest defect/LOC ratio and by far the lowest in the >1 million line-of-code range).

We at Trolltech are very pleased to see it happening, not only because many of us are KDE developers too (about 15, I guess). KDE is the largest and most visible product (or, should I say, “suite of products”) made with Qt, which means we get a lot of feedback from KDE developers. The development of KDE version 4 has been no exception with thousands of suggestions sent to us. What’s more, Phonon and WebKit, major new features for the next version of Qt, are innovations that originate from the KDE Project.

Our developers on the Unix/X11 platform are all using KDE (with a few exceptions). Some have already migrated to KDE 4, others will follow soon, as soon as Linux distributions start providing packages. This is great for us, because we can readily see the effects of our changes in the KDE applications. With KDE 4 also going even more cross-platform, onto Windows and Mac, all our developers will be able to play this game. :-)

We are also a bit afraid now… Can you imagine the flood of reports we’ll get? The rest of the KDE 3 applications will be ported soon, generating queries, suggestions and bug reports to our support engineers and development team.

I’m sure it’ll be fun. I’m glad I’m here to witness this happening and to be part of the dream coming true.

Congratulations everyone!

PS: the #kde4-devel IRC channel is now gone. Long live #kde-devel!

Comments Off
Thiago Macieira
KDE
Posted by Thiago Macieira
 in KDE
 on Friday, December 28, 2007 @ 18:50

As you may have noticed, the year is almost over. I like the name Trenton is using for it: Space Christmas. This is usually a time when people aren’t working on their day-time jobs, so they are left with some free time to do other stuff. For example, go to the beach or the swimming pool, enjoy the sunshine, etc.

What? You don’t do that? Yeah, I guess it’s my Southern-hemisphere-centric view talking. It’s 32°C in São Paulo right now, so I can only imagine how warm it is at the beach (75 km away and 800 m down).

Anyways, like I was saying, this is a time of the year people start working on other stuff. That is true as well for me. I have decided to actually start working on the Subversion-to-Git conversion tools I’ve been talking about for months. So you can expect a few blog entries from me in the upcoming weeks how the progress is going.

But I’d like to explain first of all why I chose Git. And the short version is: because I’m lazy. Yes, the reasons are entirely personal and not technical, so please don’t post a comment accusing me of that. I already know.

The funny thing is… I didn’t choose Git. I chose Mercurial at first. For two reasons, all of them showing my laziness and stubbornness:

  1. it was installed already on my laptop, because I had had to use it to pull the Em2880 v4l-dvb driver for my USB TV tuner.
  2. because everyone was talking about Git, I wanted to be different

So, sometime in May this year, I decided to convert my local SVK tree of the Qt snapshots. SVK is a good program, written entirely in Perl on top of the Subversion libraries. I suspect that Perl compiling all of that code on-the-fly is a bottleneck, because after a while SVK was too slow for me. Therefore, I chose Mercurial to convert to.

Besides, I figured that, since everyone was talking about Git and using it, I might as well provide another point of view.

Unfortunately, my laziness reared its ugly head again: I failed to make heads or tails of the conversion tool that Mercurial uses. And people say it’s an easy tool, so I must be really lazy.

At the urging of a fellow Troll working on WebKit (though technically I wasn’t a Troll at that date) and a fellow KDE developer trying to convert the entire KDE repository, I decided to give it a try. And after a few fixes on Chris Lee’s svn-fast-export, I managed to convert my SVK local repository to Git! [Note: I now know that tool to be extremely limited and will produce erroneous conversions in some cases]

Since then, I have found more reasons to stick with Git, including the fact that I’m using Git inside Trolltech to avoid using Perforce. I won’t enumerate them here because they are technical. [Who cares about technical reasons backed by numbers? We should all make decisions based on personal feelings! The bikeshed is always blue!]

So last week I started working on a rewrite of svn-fast-export, which I called svn-all-fast-export because it creates multiple Git repositories. It’s a very powerful tool, but not very easy to use. It took me 2 days to finish writing the rule file for the import of the KDE main modules.

But I’m happy to say I’ve reached the third milestone in the conversion process. For those lazy to click the previous link: I managed to convert the KDE modules “arts”, “kdesupport”, “koffice” and “KDE/*“, with all official branches, to Git. For the details, click the link.

PS: have you noticed how I managed to link to 5 different revision control systems in this blog?