Panel resizing.

閲覧: 55 回
最初の未読メッセージにスキップ

Александр Соколов

未読、
2013/08/06 7:03:212013/08/06
To: razor...@googlegroups.com、lxde...@lists.sourceforge.net
Hello everyone!

I want to discuss an algorithm of panel resizing.

How it works now:
Imagine a vertical panel with two plug-ins - clock and a quicklaunch. The clock has format "Do not show date". The panel has following settings: "Line size" - 10 and "Rows count" - 1.
In result the panel is thin.

Now let's change the clock format to "Show date after time"
As you can see the panel is wide. The clock plugin set a minimum width so that would place the text whole.
 
Advantages:
    * At any size of the line, user sees the all contents of the plugin, not only its part.
    
Disadvantages:
    * The behavior of the panel isn't intuitive. We constantly have issues like "Line size "can be set to 10px but the value is not accepted" https://github.com/Razor-qt/razor-qt/issues/564
    * This approach requires a complex code of the panel.
    * Requires additional code from the plugin authors, not much, but the code is not always obvious.
    * There is always a chance that don't neatly written plug-ins "break" the panel.
    * I have some unresolved problem with the taskbar.
    

Another approach - does not take into account the sizeHint of plugins. The panel always has the size LineSize*RowsCount. And plugins adjusts your size by panel. The plugin can scale content for example decrease font size in date.

Long time I championed the first algorithm, but now I'm inclined to the second. What do you think? Which approach is better? Any opinions are welcome, from the developers, and from the users too.

-- 
Best regards,
Alexander.

Александр Соколов

未読、
2013/08/06 10:04:082013/08/06
To: PCMan、razor...@googlegroups.com、lxde-list、razo...@googlegroups.com
2013/8/6 2noob2banoob <2noob2...@gmail.com>
I think the most elegant way would be a hybrid way, where the user can set a minimum and maximum size and within those bounds the panel tries to automatically adjust its size to the sizehint of plugins.
I do not see sense to have 2 parameters, it will only complicate the algorithm and confuse the user.
 

2013/8/6 PCMan <pcma...@gmail.com>

I got hit by totally the same problem when I tried to do lxpanel in the past.
What we did it, change the orientation of the label, so it can be
shown rotated and the panel remains thin. Of course, this is ugly and
the label became less readable.
This, however, is the only way to make the panel thin and make the
content visible at the same time.
Just tried Windows and it has exactly the same problem. When you make
the panel vertical, the date string determines the total thickness of
the panel.

IMHO, it's better to let the applets determine how important their contents are.
If the applet claim that its content can shrink, then its size is
determined by the panel, and the applet scale its content to adopt the
new size.
Otherwise, if an applet claim that it's not resizable at all, then the
panel respect its special needs.
This kind of claim can be done with a flag which can be set on an applet.
By default, the panel manage the size and ask the child applets to
resize their content to fit the panel, but if some applets ask for a
minimal size explicitly, the panel respect them and do not try to
shrink them.

The applet can also expose a flag telling the panel whether it can
accept a vertical orientation or not. If its content can be rotated
and it supports vertical orientation, then the panel can make the
applet vertical and remains thin.

So, we continue to use the current algorithm.
Any additional flags don't need, an applet can use the minimumSize, maximumSize minimumSizeHint, sizeHint, sizePolicy. This is enough to implement the described algorithm. And it enough to destroy the developer's mind:)



--
Best regards,
Alexander.

Kuzma Shapran

未読、
2013/08/06 17:21:502013/08/06
To: Александр Соколов、PCMan、2noob2...@gmail.com、razor...@googlegroups.com、razo...@googlegroups.com、lxde-list
It can be confusing if a plugin can be only inside of a horizontal panel, but not in a vertical one. Plus - what if it was added to a horizontal panel, and then the panel orientation was changed - it will disappear - not intuitive at all.

What I like in plasma widgets - you can use the same widgets on the desktop and on any panel. Container (panel or desktop) says to a plugin what constraints are on init - whether its horizontal panel (and plugin can expand horizontally, but restricted vertically), vertical or desktop (where it can grow both directions). BTW KDE took the second approach - dictating size to a plugin.

I like the current implementation, though I liked hybrid (with min and max) idea more.

I must warn everyone, that rotating widgets in Qt - is quite a complicated task (I made it for clock plugin), plus there is big penalty in performance - the whole widget is drawn twice!

Cheers,
Kuzma


------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Lxde-list mailing list
Lxde...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxde-list


全員に返信
投稿者に返信
転送
新着メール 0 件