[Icon Plasmoid] Provide a generic plasmoid class for icon based plasmoid

Loïc Marteau loic.marteau at gmail.com
Sat May 31 18:02:39 CEST 2008


Aaron J. Seigo wrote:
> On Saturday 24 May 2008, Loïc Marteau wrote:
>   
>> Each plasmoid have a particular way to implement the size stuff and the
>> result is not often perfect.
>>     
>
> setAspectRatioMode(Plasma::Square)?
>
> if that isn't working, it needs to be fixed. but that's what it is there for.
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Panel-devel mailing list
> Panel-devel at kde.org
> https://mail.kde.org/mailman/listinfo/panel-devel
>   
ok

Here is what i have when i try to use  
setAspectRatioMode(Plasma::Square) and make it the most simple as possible.

void ShowDesktop::init()
{
    setBackgroundHints(NoBackground);
    setAspectRatioMode(Plasma::Square);
    m_icon = new Plasma::Icon(KIcon("user-desktop"),QString(),this);

    connect(m_icon, SIGNAL(clicked()), this, SLOT(pressed()));

[...]
}


void ShowDesktop::constraintsEvent(Plasma::Constraints constraints)
{
    Plasma::Applet::constraintsEvent(constraints);
    m_icon->resize(contentsRect().size());
}


i attach the files for the showdesktop plasmoid.

Question 1 :
Is this the good way (tm) to implement icon based plasmoid ?

There is a lot of icon plasmoid and they have all different way to 
implement size constraint stuff. The result is unequal.

The result with this code is a little better than with the actual 
showdesktop plasmoid (he take less unused width space in border).
Question 2 :
Can this code be commited to trunk for showdesktop ?

However, wee  still need to implement the constraintsevent function to 
correctly resize the icon. I think that if we have a generic class icon 
it will be more useful to use.

I think that such icon plasmoid should be a little more little (*0.75 
would be fine) and still take too much unused width space (it is much 
better with setAspectRatioMode(Plasma::Square) but still not perfect).
Question 3 :
How can i do to reduce the size to 75 % ?
Question 4 :
It is possible to reduce the width of unused space when we use the 
setAspectRatioMode(Plasma::Square) shortcut ?

I would like to have a result like this :
http://nuno-icons.com//images/estilo/imagefoldersclock.png


I would like to help, i think that there is some plasmoid to polish with 
the size constraint stuff (showdesktop, showdashboard, trashcan, 
.desktop shortcut plasmoid, notify, new device notifier). I can perhaps 
help to patch them if we found the correct way to deal with this problem.


Best regards,

Loic
-------------- next part --------------
A non-text attachment was scrubbed...
Name: showdesktop.cpp
Type: text/x-c++src
Size: 2591 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20080531/af2843a1/attachment-0002.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: showdesktop.h
Type: text/x-chdr
Size: 1441 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20080531/af2843a1/attachment-0003.bin 


More information about the Panel-devel mailing list