Please review: Virtual keyboard plasmoid - Plasmaboard

Björn Ruberg bjoern at ruberg-wegener.de
Mon Aug 3 11:17:53 CEST 2009


Hello,

>* there's a mix of whitespace usage in there; sometimes tabs are used to
>indent, sometimes spaces. your goal is kdeplasma-addons, so you aren't
>required to follow the kdelibs coding style (though you get extra cookies
> for doing so ;) but could you use just one formatting style? throughout the
> code

I use tabs, but used different code editors. Some tabs must have been turned 
into whitespaces :(

> * the tab key, when pressed, just keeps pressing tab over and over :)

hmm, that's wanted I think. The key is repeated when you keep it pressed. The 
key repeat rate is the same as you have it with your physical keyboard. 

> * lots of "magic numbers"; e.g. FuncKey *funcKeys[14] in the header file
> and then this in the implementation:
>
> ·       ·       i = 0;
> ·       ·       while ( i < 14 ) {
> ·       ·       ·       delete funcKeys[i];
> ·       ·       ·       i++;
> ·       ·       }
>
> perhaps it makes sense to use a QVector here instead. that way you can
> replace the above with:
>
> 	qDeleteAll(funcKeys);
> 	funcKeys.clear();
>
> no magic numbers :)

I'll have a look. 

> * it'd be great if the keyboard modifier state was harmonized; e.g. if i
> press CAPS LOCK on my keyboard, it would set this on the virtual keyboard
> and vice versa. note that there is a "keystate" DataEngine that makes this
> all very easy and cross-platform (it has serviceForSource() which lets you
> modify the global state of modifiers)

Should be doable with that engine. Did not thought that users may need that. 
If you use plasmaboard, you have a touchscreen. If you have touchscreen and 
type on plasmaboard, you don't want to use another keyboard at the same time.

> * in FunkKey::toggleOn there is this:
>
> ·       Plasma::PushButton::setStyleSheet(oldStyle + "color:red;text-
> align:center;"); // sorry, but I need some visual confirmation
>
> that color should really be coming out of the Plasma::Theme::colorScheme so
> it works with all themes. in any case, i don't ever see the red color? is
> it really needed?

No, it's not. That's old code that was used before I drawed the arrows on the 
keys with QPainter.

> * the biggest challenge i see is that there's no support (that i could
> see?) for keyboard layouts. this will make our friends around the world
> sad. :) i can think of various ways of accomplishing this but probably the
> most sane one is to just follow xkb:
>
> http://hektor.umcs.lublin.pl/~mikosmul/computing/articles/custom-keyboard-
> layouts-xkb.html
>
> the upside to this is that we can just use what's already there and follow
> the system layout settings

Hehe, that's the nice thing about it. Plasmaboard automatically adapts to your 
keyboard layout! The main magic is done in the X-Server, so it's no wonder 
that you didn't see it. Feel free to change your keyboard layout to "french" 
or something like that. Plasmaboard will adapt and show french keys. (okay, 
you'll have to press shift or restart plasmaboard to get the buttons 
relabelled, I don't get a notification of the changed layout to do it 
automatically)

> > My last addition was this tooltip, which shows the key you last hit.
> > That's probably no optimal solution but I failed finding a better one. If
> > someone can give me some hints how I can implement a popup like on the
> > iphone virtual keyboard, I'm thankful.
>
> what sort of popup are thinking of or wanting? if you can give me a mockup
> or a screenshot, i'm sure we can make it happen ;)

Basically I need a simple QGraphicswidget which can be displayed fast. (this 
will run on MIDs and Netvertibles, slow CPUs) It shall be plasma themed. It 
should appear near to the button you pressed, must be drawn above the 
keyboard, must be able to draw outside the sceneRect of the keyboard and must 
be shown above anything else on the desktop.
Well, I didn't found a better solution than this missused tooltip I have now. 
(The delay before it opens is bad for my use case)

So (sorry, I don't know the way), can I move this into kdeplasma-addons and do 
the further development there - or do I have to go on in kdereview and ask 
again? 




More information about the Plasma-devel mailing list