user-avatar
Today is Wednesday
February 22, 2012

Archives: March 2009

March 10, 2009

Fixing qmake missing rule for *.ts -> *.qm

by Thomas Capricelli — Categories: Gentoo, KDE — Tags: , 9 Comments

We are used to polished and great tools from the trolls, but qmake has always been the big exception to this: ugly documentation, lot of undocumented tricks, and missing features.

For me the biggest one was that it would not automatically create the rule to transform *.ts to *.qm in the generated Makefile. I have been trying for very long to fix this problem. This is especially a shame because this is Qt’s very own translation stuff, and qmake should really knows about it.

Today, thanks to ‘luks’ on #qt, I know have the solution, and I think it’s really worth a blog entry, for my own record, and to help all those having the same problem. : put this in a file updateqm.pri and include it from your *pro(s).

isEmpty(QMAKE_LRELEASE) {
    win32:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\lrelease.exe
    else:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease
}
updateqm.input = TRANSLATIONS
updateqm.output = ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.qm
updateqm.commands = $$QMAKE_LRELEASE ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.qm
updateqm.CONFIG += no_link
QMAKE_EXTRA_COMPILERS += updateqm
PRE_TARGETDEPS += compiler_updateqm_make_all

March 6, 2009

updating to KDE 4.2.1 : delete your plasma files (again)

by Thomas Capricelli — Categories: Gentoo, KDE — Tags: 14 Comments

Thanks to the great work of the gentoo KDE packaging team, I have been able to update to KDE 4.2.1 yesterday. And since then, a couple of processes  suck up all my CPUs.

The first one is a well-known issue : lancelot does that when used with Qt 4.5. Ok, this one was quick to remove.

The second one is plasma. Somehow I was not really surprised : it often happens. I usually first blame gentoo for that, and I’ve tried to re-install a few things in order to fix it (like emerge @preserved-ebuilds, and so on…). But actually, that was not the problem. On #gentoo-kde, some other people seem to have either this very same problem, or worse (crashes). Removing your ~/.kde4.2 directory is said to help. That’s too much a loss for me so I have spent a little time to narrow the solution a bit.

And finally the solution is to remove only share/config/plasma*. How come did I not first think about it ?

So if you have the same problem, hopefully now you know how to fix it.

March 5, 2009

Support for ‘long double’ in Qt tests.

by Thomas Capricelli — Categories: Gentoo, KDE — Tags: , 3 Comments

Qt supports most types for most compilers…… but long double.  I do not know why. When asking on #qt (IRC), people say that nobody seems to care. Well… I do. long double have some use in scientific software at least. If you ever need to use long double in QTest, you will need to add this somewhere in some of your headers used by unit tests.

This is tested with Qt 4.4.2 and 4.5, on linux(gcc 4.3.3) and windows (mingw/gcc 3.4.5).

Once you have this code, you can do things like QCOMPARE() between long double and so on.

namespace QTest {

    template <>

    inline char *toString<long double>(const long double &t)

    {

        char *msg = new char[128];

        ::snprintf(msg, 128, "%.123Lg", t);

        return msg;

    }

    static inline bool qFuzzyCompare(long double p1, long double p2)

    {

        return (qAbs(p1 - p2) <= 0.00000000000001 * qMin(qAbs(p1), qAbs(p2)));

    }

    template <>

    inline bool Q_TESTLIB_EXPORT qCompare<long double>(long double const &t1,

            long double const &t2, const char *actual, const char *expected, const char *file, int line)

    {

        return qFuzzyCompare(t1, t2)

            ? compare_helper(true, "COMPARE()", file, line)

            : compare_helper(false, "Compared long doubles are not the same (fuzzy compare)",

                    toString(t1), toString(t2), actual, expected, file, line);

    }

}
© 2012 Thomas Capricelli All rights reserved - Wallow theme v0.46.5 by ([][]) TwoBeers - Powered by WordPress - Have fun!