qt Syndicate content

warning: Creating default object from empty value in /www/htdocs/w0065fc9/milianw/modules/taxonomy/taxonomy.pages.inc on line 33.

» KDevelop 5.0 Beta 2 and 4.7.3 Releases!

Sun, 01/31/2016 - 23:54

Hey all!

I have the pleasure to announce the releases of two new KDevelop versions:

On one hand, there is the new and shiny KDevelop 5.0 Beta 2 release, which brings us much closer to a final release. Tons of issues have been resolved, many features got polished, and even our UI cleaned up a bit here and there. And did I mention impoved OS X and Windows support? See here for more:

https://www.kdevelop.org/news/kdevelop-50-beta2-release

Besides this new beta release, which is where most of our effort went into, I am also happy to announce KDevelop 4.7.3, a new bugfix release of our latest stable KDE 4 based KDevelop. Several annoying problems are resolved now, see the announcement for more information:

https://www.kdevelop.org/news/kdevelop-473-release

Many thanks to everyone involved!

Cheers

» Akademy 2014 - Come to my Profiling 101 Workshop!

Tue, 08/26/2014 - 19:08

Hello all!

I have the pleasure to attend Akademy this year again. From my past experience, I’m really looking forward to have a good time again. Lots of hacking, meeting known and unknown faces, drinking beer and socializing ahead! I also love that it’s in a (to me) new country again, and wonder what I will see of the Czech Republic and Brno!

This year, the conference schedule is a bit different from the past years. Not only do we have the usual two days packed with interesting talks and keynotes. No - this year there will also be workshops on the third day! These are more in-depth talks which hopefully teach the audience some new skills, be it QML, mobile development, testing, or … profiling :) Your’s truly has the honor to hold a one-hour Profiling 101 workshop.


I’m going to Akademy and will hold a Profiling 101 Workshop

I welcome all of you to attend my presentation. My plan, currently, is to do some life demoing of how I profile and optimize code. For that purpose, I just wrote a (really slow and badly written) word count test-app. I pushed the sources to kde:scratch/mwolff/akademy-2014.git. If you plan to join my workshop, I encourage you to download the sources and take a shot at optimizing it. I tried my best to write slow code this time, to leave plenty of opportunity for optimizations :) There are many low-hanging fruits in the code. I’m confident that I’ll be able to teach you some more advanced tips and tricks on how you can improve a Qt application’s performance. We’ll see in the end who can come up with the fastest version :)

During my workshop, I’ll investigate the performance of the wordcount app with various tools: On one hand this should teach you how to use the powerful existing opensource tools such as Linux perf and the valgrind suite. I will also show you Intel VTune though, as it is still unparalleled in many aspects and available free-of-charge for non-commercial usage on Linux. Then, I’ll present a few of my own tools to you, such as heaptrack. If you never heard of some of these tools, go try them out before Akademy!

I’ll see what else I’ll fit in and maybe I’ll extend my akademy-2014.git scratch repository with more examples over the next days.

Bye, hope to see you soon!

» Qt: Tint alphatransparent PNG

Wed, 09/21/2011 - 18:07

Let’s assume you want to display the logo of your company in your Qt app. Most probably that logo has just single color with an alpha channel.But: Having the color hard coded in the image is not nice, there are users (like me!) out there, who use a custom (dark!) color scheme. Meaning: If your logo is black/dark and assumes a bright background and you just embed it blindly in your app, I probably won’t see it since the background will be dark in my case.

Here is a solution for the simple case of a mono-colored PNG with an alpha channel which I came up with:

  1. QLabel* label = new QLabel;
  2. // load your image
  3. QImage img(QString("..."));
  4. // morph it into a grayscale image
  5. img = img.alphaChannel();
  6. // the new color we want the logo to have
  7. QColor foreground = label->palette().foreground().color();
  8. // now replace the colors in the image
  9. for(int i = 0; i < img.colorCount(); ++i) {
  10. foreground.setAlpha(qGray(img.color(i)));
  11. img.setColor(i, foreground.rgba());
  12. }
  13. // display the new logo
  14. label->setPixmap(QPixmap::fromImage(img));
  15. label->show();

This seems to work just fine for me. YMMV.

» Should all callgrind bottlenecks be optimized?

Thu, 12/09/2010 - 19:12

Hey all,

I’d like to have some feedback from you. Consider this code:

  1. #include <iostream>
  2. #include <memory.h>
  3.  
  4. using namespace std;
  5.  
  6. struct List {
  7. List(int size) {
  8. begin = new int[size];
  9. memset(begin, 0, size);
  10. end = begin + size;
  11. }
  12. ~List() {
  13. delete[] begin;
  14. }
  15. int at(int i) const {
  16. return begin[i];
  17. }
  18. int size() const {
  19. // std::cout << "size called" << std::endl;
  20. return end - begin;
  21. }
  22. int& operator[](int i) {
  23. return begin[i];
  24. }
  25.  
  26. private:
  27. int* begin;
  28. int* end;
  29. };
  30.  
  31. int main() {
  32. const int s = 1000000;
  33. for (int reps = 0; reps < 1000; ++reps) {
  34. List l(s);
  35. List l2(s);
  36. // version 1
  37. for ( int i = 0; i < l.size(); ++i ) {
  38. // version 2
  39. // for ( int i = 0, c = l.size(); i < c; ++i ) {
  40. l2[i] = l.at(i);;
  41. }
  42. }
  43. return 0;
  44. }

If you run this through callgrind, you’ll see quite some time being spent in l.size(), the compiler doesn’t seem to optimize that away. Now, fixing this “bottleneck” is simple, look at version 2. That way, l.size() will only be called once and you’ll save quite some instructions according to callgrind.

Now, my first impression was: Yes, lets fix this! On the other hand, this optimization is not really that noticable in terms of user-experience. So my question is: Is it worth it? Should everything one sees in callgrind that is easily avoidable and optimizable (like the stuff above) be optimized?

I ask because QTextEngine e.g. doesn’t use the optimized version and I wonder whether I should create a merge request for that. According to callgrind the difference is noticeable: One of my testcases shows ~8% of the time being spent in QVector<QScriptItem>::size() (via QTextEngine::setBoundary()). In Kate the difference is even bigger with ~16% of the time being spent in QList<QTextLayout:.FormatRange>::size() via QTextEngine::format(). Hence I’d say: yes, lets optimize that. I just wonder whether it’s noticeably in the end.

Bye

EDIT: See this comment thread for an answer.

» Spotlight: linux-minidisc

Thu, 09/03/2009 - 18:36

Hi there!

Today I want to abuse the fact, that my blog is aggregated on some planets, to bring a project of a friend of mine into the spotlight:

The Linux-Minidisc project

It’s a project to bring Read/Write access on mini discs to Linux. It consists of a CLI and a Qt Gui. All code is licensed under the GPL and can be accessed via Git.

To get a nice introduction about the project, read this excerpt from a recent Linux Journal edition: http://users.physik.fu-berlin.de/~glaubitz/minidisclj.pdf

The project itself has a wiki under the following address: https://wiki.physik.fu-berlin.de/linux-minidisc/doku.php

As every other FOSS project, Adrian and his fellow developers need more man power. Especially someone who can spruce up the Qt GUI is needed. Help them!

» Dear Lazy Web: Hackable Mobile Phone with good Music Player?

Mon, 07/06/2009 - 10:31

Hey all, I need your help:

I lost my Ipod and now have to live without music on the road… Sucks pretty much, I can’t live without music…

Since my current mobile phone is pretty shabby I thought about fixing both in one go: Buy a mobile phone which could replace my Ipod as well!

Now lets first say what I need most:

  • should’nt be too expensive: A new Ipod with 120gb costs only ~200€. So even though I hate that device, I doubt I’ll pay like twice the sum just to get something different…
  • It needs a “Klinke” stereo output, i.e. something where I can put my normal headphones in.
  • I need space for my music: My last Ipod (80Gb) was completly full… Ok, I think I can make a few cuts, though 8gb only is not enough. Hence the phone should support hot-swapping of SDHC cards at least.
  • If I buy such an expensive device, I’d like to be able to write my own software for it, or put existing software on it.

What I found is the Nokia 5800 express music. It costs like ~260€. 16Gb more space costs like ~45€… It has stereo output and SDHC support. But what I don’t know: Where will custom software be saved on? Also on the SDHC? That would make hot-swapping kind of pointless…

Good thing: It’s S60 5th gen, so Qt will run it and I can write my own software - that’s pretty cool. Though one question: Do I need Windows for the SDKs or can I develop under Linux?

So… Does anyone have a better suggestion? Or any experience with that mobile phone? I really hate that there is no alternative to Ipods with a lot of space… Monopoly sucks! And I can’t even put my own stuff on such an Ipod… Not even Rockbox any more :( I hate Apple for that!

But since I’m a poor student I somehow really doubt that I’ll get myself a new phone, esp. since additional SDHC cards cost quite much…

» PHP support for KDevelop 4 (and eventually Quanta+)

Tue, 03/03/2009 - 00:28

Hello Planet KDE!

I want to give you a little insight on the current state of PHP support in KDevelop4:

Me and Nikolaus Sams (nsams) are working diligently on a plugin for PHP support in playground. It’s somewhat stable, i.e. we fix any crashes we stumble upon, but I would call it Alpha state at most. It may eat your babies so to speak. Yet I’m happy to say that at least one user is already using it for production (hi leinir ;-) ).

implemented PHP support

Well, here’s a (not complete) list of features that are already working. Though I have to warn you: no screenshots included ;-) It’s actually all very similar to the C++ screenies you can see on the web.

sematic highlighting

Let’s start with a feature that only very recently was added for PHP - semantic highlighting. Niko moved some language independent parts of the C++ plugin from KDevelop to KDevplatform and now PHP has the same code highlighting features as C++.

I personally love this feature since it makes it even easier to grasp code and it makes the code highlighting more consistent since there is no visual difference between PHP built-in functions/constants and your own.

code completion

Arguably one of the most useful features the DUChain enables us to write is code completion. There’s already full support for:

  • PHP built-in functions, classes, constants, superglobals
  • user-defined functions, classes, constants, superglobals, variables, etc.
  • proper code completion for objects which respects access modifiers (private, public, protected) and differentiates between static/non-static members and methods
  • code completion for overridable and implementable functions inside classes
  • hints in the argument list of function- and method class
  • sane code completion after keywords such as “extends, implements, catch(), new, throw” and some more I think

There’s still some bugs to fix and a few features to implement. But I can easily say that even the current state of code completion makes one wonder how he could use Quanta (from KDE3 times) for such a long time! It’s simply nothing compared to this!

The next feature I hope to add is support for type hinting in function calls. I.e. only show arrays where arrays are requested and the same for objects of a given type. Also no PHP keywords are currently completed at all

other DUChain/UseBuilder stuff

Thanks to the DUChain you already get lots of information about declarations, such as uses (which files, which lines etc.). Also very neat is the hover popup you might now from C++ which among others shows you phpdoc comments inside your browser. I also plan to integrate the php.net documentation into KDevelop, similar to what is already possible for QtHelp.

inline validation / syntax checking / linting

Another feature which saves lots of time is on-the-fly syntax checking: You won’t have to fire up your web-app inside a browser just to be greated by that pesty “syntax error, unexpected ‘CHAR’ in FILE on line XYZ” message… No! Instead you will see a nice reddish zig-zag line where you made the error and can fix it before heading off to the browser.

But we don’t only do basic syntax checking. We do more than that, thanks again to the power of the (holy?) DUChain. You can spot undeclared variables, function/method/class/constant redeclarations and more. Actually I hope that one day we spot most of the notices, warnings and errors PHP could emit.

tests

We already have a multitude of regression tests which will make sure that we don’t mess up any existing stuff. Lets hope for even more of them :) I love test-driven development.

The End

Well, thats pretty much it for the moment. You can have a look at what we are up to at the Quanta Feature plan on techbase.

If you are a PHP developer and can write C++ with Qt, why not get in touch with us? You can find us both on the KDevelop mailinglist and at least me and leinir are often found in #kdevelop on freenode.

PS:

Let me finish with a quick introduction of myself:

My name is Milian Wolff, I study Physics at the FU Berlin (just finished the 3rd semester). I started learning programming when I was around 14 with PHP. Over the years I became very good in it and the other webdevelopment techniques like Css, JavaScript etc. Recently I started to fullfill my biggest geek dream by learning C++/Qt/KDE and starting to contribute to the KDE project.

Some of you might now my from the LinuxTag in Berlin where I could be found at the Kubuntu-De.org community booth. At least with some of you I had a beer (well, I doubt it was only one). I hope to repeat this tradition in 2009. Every once in a while I can also be spotted at ubuntu-berlin events.

» Patching Kirocker Music Display for volume control via mouse scrolling

Fri, 03/28/2008 - 16:32

Kirocker is such a great application, it’s a pity the developer Sébastien Laoût has given up on it and is using Windows now!

Usually I only use the kicker applet, the full screen window is nice for parties though. But I didn’t like the way the applet handles scroll events: It seeks (if possible). Since I rarely seek when listening to music I’d rather have the behaviour of the Amarok tray icon: volume control!

I had a look inside the sources and found this part in src/coverdisplay.cpp:

  1. void CoverDisplay::wheelEvent(QWheelEvent *event)
  2. {
  3. if (areControlsShown()) {
  4. if (event->orientation() == Qt::Vertical) {
  5. PlayerInformation *infos = PlayerInformation::instance();
  6. if (infos->canSeek()) {
  7. int deltaSeconds = 10 * (event->delta() > 0 ? 1 : -1);
  8. m_infos->seekRelative(deltaSeconds);
  9. }
  10. } else {
  11. if (event->delta() > 0)
  12. AmarokApi::volumeUp();
  13. else
  14. AmarokApi::volumeDown();
  15. }
  16. }
  17. }

As you can see it already supports volume control via scrolling! The thing is I’ve disable four-way scrolling for my MX1000. Thus I’ve simply swapped the if statements and now I’m really happy with Kirocker. Here’s the updated snippet:

  1. void CoverDisplay::wheelEvent(QWheelEvent *event)
  2. {
  3. if (areControlsShown()) {
  4. if (event->orientation() == Qt::Vertical) {
  5. if (event->delta() > 0)
  6. AmarokApi::volumeUp();
  7. else
  8. AmarokApi::volumeDown();
  9. } else {
  10. PlayerInformation *infos = PlayerInformation::instance();
  11. if (infos->canSeek()) {
  12. int deltaSeconds = 10 * (event->delta() > 0 ? 1 : -1);
  13. m_infos->seekRelative(deltaSeconds);
  14. }
  15. }
  16. }
  17. }

Replace the old code, compile Kirocker, install it. Then restart kicker (killall kicker; sleep 1; kicker;) and Kirocker should accept scroll events in the way the Amarok tray icon does!

» Opera 9.50 beta

Tue, 09/04/2007 - 15:43

Opera released their first 9.5 Alpha today, nicknamed Kestrel. Usually I don’t use Opera, I use Firefox for webdevelopment with Firebug and similar tools but it’s pretty slow even on my fast new machine. For my everyday browsing I use Konqueror for it’s neat desktop integration (read ASpell, KWallet, Kio, Filebrowser etc.). And compared to Firefox Konqueror is fast.

But Opera… Well I knew it was fast but in their release note they mentioned even more speed improvements, also for ECMA Script (JavaScript). So I thought, lets give it a try and I have to say I’m pretty much flabbergasted. It feals like it’s more than double as fast as Konqueror! I really might start to use Opera more frequently now… Let’s see what else they got except speed!

Also very interesting is this part of the release note:

Platform integration

We worked to make Kestrel feel even more integrated with your platform. Mac users can expect a nice new visual look and feel, while Opera for Linux will add a QT4 build, so you can easily adjust your skin to match the desktop. 64-bit Linux/FreeBSD packages will also be available.

Neat! I’m really looking foreward to this since I prefer programs which adapt to the widget styles I use and see in other (KDE/Qt) programs.

Downside

Even in my first few minutes of usage I encountered a few problems, most notably some layout quirks with form elements which resolve after a refresh of the page.

via OSNews