cat /dev/maxilys

A glance in the mind of a KDE/Linux developer to see how ideas turn into code.

2006-05-13

KDE: Open space

It's been a while since last time. I was too busy working on Serenity to have the time to tell what I was doing. And I did a lot!

First, I cleaned the sources. They were split in two files in the most stupid way: A huge file and an as much tiny file which contained just one sub-routine called 128 times along the big file. I gathered the two files in just one. That's enough. I've never done this before but now I know how to do it and how easy it is. I'm gonna apply the recipe to Serenity windec which is still split in several files.

Well, that was just a detail. Now, I need to look at the changelog to remember all that I did!

First, I fixed a bug I introduced when I began to intercept QFrame drawing in the event filter. The edit line frames lost their background when disabled. That was because the edit lines are also QFrame's. The reroute toward the event filter for the QFrame's was done too early, before the edit lines could be "polished". I reordered all this and things have worked as expected again.

The mini-tabs. Oh yeah, that's an example of procastination. I was always saying "Tomorrow, I'll take care of the triangular tabs" and that tomorrow never came. That's the kind of situation where you can expect something to come and bite your lower back. The triangular tabs came once to force me to imagine a quick fix for Krita. But I couldn't read what they wrote on my bottom cheeks with their triangular teeth. ;-) I played a little more with KOffice to see how Serenity behaves. This time the triangular tabs bit my nose and got my undiverted attention. I called them mini-tabs because they are smaller than the regular ones --Well, if the style wants it so.-- and that led to a wrong size of the mouseover effect frame in Serenity. I took my wrench and changed some nuts and bolts. That was it.

A bit later later I also did a little face lift to the tabs and toolbox tabs. Now they look like to be floating above the tabbar thanks to a little shadow and change a surface from concave to convex for the upper tabs. Just another detail that I find very nice.

While I was at the toolbox tabs, I also enabled the mouseover effect over them thanks to a contact (Hello Michael!) who gave me a solution. It's not perfect but it works perfectly in 99% of the cases.

I changed the color of the popup frames which I now also use for the flat popup titles. And it works for KMenu too! The way to detect if the popup title is ugly to say the least: If the widget belongs to Kicker but doesn't use the regular background that's a KMenu popup title. It works but I can easily imagine situations where some QHeader's will be incorrectly interpreted as KMenu popup titles. I'll look for a more definitive solution for a later version.

I totally re-designed the checkboxes and radiobuttons. Somebody proposed me to adopt the same design than Firefox Charamel theme. I didn't go as far as ripping but I took some inspiration and added the serene touch. They're better with a white surface (ColorGroup:Base).

I also changed the slider groove background to white to match and that makes its frame more visible. The overall look of the style configuration dialog has been improved but the result is much more visible in the KMix mixer dialog. I like it.

The QDrawShadeThingies! It works only 95% of the time but when it works... Rhaaa lovely! ;-) No white and black squares any more! Meanwhile it allowed me to change the color of the combobox popup frame. I thought it wasn't possible. I was wrong. It now has the same color than the one of the regular popups. Any way, my favorite frames now are the raised and sunken boxes. You can only see the top left and bottom right corners which melt themselves into the background toward the opposite corner. The effect is at its best when sunken. The frame looks like to be carved in the background with its top left and bottom right corners slightly raised. I like it some much that I took the time to add one on the About page of Serenity's configuration dialog while writing this blog. :-)

Michael also told me that nobody has ever cared about the QCheckList items. That's true that they are ugly but we see them so rarely that who cares? I cared. I even had to redraw a smaller radiobutton just for them. 13 pixels instead of 15. Come on! I'm a real maniac! ;-) These items now look like regular checkboxes and radiobuttons but with a different color. The only problem is that Kate uses its own routines and its checklist items are as ugly as before.

Any way, checking how Kate reacted to my new items made me realize something: The QHeader's can have pixmaps too! I kinda forgot them. So I "remembered" them. There were no legend in the QHeader's above Kate's checklist items. That's no longer a problem.

KKeyButton, KColorButton and KColorCombo are now styled too. KColorCombo resisted me a lot. I had to find a hack around a problem that prevented Serenity from being compiled. It didn't want to tell me what the current selected color was. I kicked it out of my way and used only what QComboBox offers... Until I realized a library wasn't linked when it should. KColorButton on the contrary posed no problem. And my favorite is KKeyButton which also was easy:

KKeyButton image


In the mean time, I also took care of the status bars. It was an horror in Konqueror. I used the same hack than everybody but the hack wasn't powerful enough. This time, my hack is so powerful than one application can't change the color of its status bar any more! No more! I noticed that Kate also played with its status bars when you use the split view. Stop it! It's useless and, thanks to Serenity, it's now invisible.

Because I was in the event filter, I decided to give it a shot to those checkable groupboxes. I couldn't do what I wanted because of the checkbox and its label which erased any background I painfully drew. This is history. I've learned to change the background of the checkbox (Thanks Michael!) and that's it! There was still a problem. The background was OK but the external frame was still erased. I removed it and here is the result:

GroupBoxes image


You can also see the new checkboxes and radiobuttons... and a sunken box.

The rest of the changes will be yours to discover by installing the new version 0.7 of Serenity that should arrive tomorrow or monday at KDE-Look.org. And for those that might be tempted by the idea, I strongly advise you NOT to try to do a diff with version 0.6. There are so many changes that it becomes pointless to note each and every of them. (100KB of diff the last time I tried.) :-D

If you wonder why I used the title "Open space" that because Serenity has become my playground, a vast open space where I can do all that I want... until I collide with an asteroid. Oh yes, there some asteroids because of some over-zealous developers who have apparently nothing else to do than re-write KDE's widgets upto the point of breaking the style. Kate's checklist items is an example I already talked about. I still can't see what they have so special apart from being excluded from any styling. Another example is the rulers in KOffice. They are all different. Some are white, some use the color of the background. It's a total mess and they are all partially excluded from the style because of a tiny dash that's supposed to reflect the position of the mouse on them but that's late if you move too fast. The worst example of widget abuse I've seen so far is a badly re-written KColorCombo. If I ever decided to style this widget that because of this application! As a result, I got two perfectly styled KColorCombo's and an ugly one on the same dialog. And when I say ugly, that's worst than you can imagine. Come on! You can do better! I did.

While I was writing I got an idea: What is the classname of that widget? (Oops! I was giving its name. I don't want to get that personal.) Can I recognize it in the event filter? Yes. So I can style it too.

$ make ; su
Password:
# make install ; exit


Already done! :-D

Give me five minutes and I'll style these broken double spin widgets. Five more minutes and I'll take care of Kate's checklist items. One hour to dig in KOffice sources and I'll undo what they did to the KRulers.

I think I've found a weapon against the "asteroids" in my open space: Their sources. Happy open software world I live in! ;-)

0 Comments:

Post a Comment

<< Home