[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: Patch for system tray layouting
From:       Bernhard <mustermaxi () gmail ! com>
Date:       2008-06-14 18:44:49
Message-ID: 6ce7cd2c0806141144u767b61dfn4136c85e63dfb491 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi!

I can't say anything about your patch in generally because I'm just not
familiar with the internals of KDE yet ... but (and I don't know if it's
your fault) why the hell is the size of the systray icons hardcoded??
(22px). Shouldn't there be a global setting for the icon size?

Best Regards,

Bernhard

2008/6/14, Mathias Kraus <k.matze@gmx.net>:
>
> Hi,
>
> this is my first patch for KDE, so I hope I don't break plasma ;)
>
> OK, it's only a small patch for a layouting bug which occurs when you have
> a
> system tray with multiple rows/columns. See attached picture.
>
> The bug is in
> kdebase/workspace/plasma/applets/systemtray/systemtraywidget.cpp.
> In addWidgetToLayout the conditions in line 140
> minimumHeight() + widget->height() + m_mainLayout->spacing() >
> maximumHeight()
> is always true after the first column is full, the same applies for a
> vertical
> panel with rows.
>
> My patch calculates the maximum number of items that fits into the panel
> and
> jumps into the next row/column if there is an overflow.
>
> void SystemTrayWidget::addWidgetToLayout(QWidget *widget)
> {
>     // Add the widget to the layout
>     m_mainLayout->setRowMinimumHeight(m_nextRow, 22);
>     m_mainLayout->setColumnMinimumWidth(m_nextColumn, 22);
>     widget->resize(22,22);
>     m_mainLayout->addWidget(widget, m_nextRow, m_nextColumn, 1, 1,
> Qt::AlignCenter);
>
>     // Figure out where the next widget should go
>     if (m_orientation == Qt::Horizontal) {
>         // Calculate the items that fit into a column
>         m_maxCount = (maximumHeight() + m_mainLayout->spacing()) / (widget-
> >height() + m_mainLayout->spacing()) -1;
>
>         setMinimumSize(QSize(22 * (m_nextColumn + 1) +
> m_mainLayout->spacing()
> * m_nextColumn,
>                              22 * (m_maxCount + 1) +
> m_mainLayout->spacing() *
> m_maxCount));
>
>         // Add down then across when horizontal
>         m_nextRow++;
>         if (m_nextRow > m_maxCount){
>             m_nextColumn++;
>             m_nextRow = 0;
>         }
>     } else {
>         // Calculate the items that fit into a row
>         m_maxCount = (maximumWidth() + m_mainLayout->spacing()) / (widget-
> >width() + m_mainLayout->spacing()) -1;
>
>         setMinimumSize(QSize(22 * (m_maxCount + 1) +
> m_mainLayout->spacing() *
> m_maxCount,
>                              22 * (m_nextRow + 1) + m_mainLayout->spacing()
> *
> m_nextRow));
>
>         // Add across then down when vertical
>         m_nextColumn++;
>         if (m_nextColumn > m_maxCount) {
>             m_nextRow++;
>             m_nextColumn = 0;
>         }
>     }
> }
>
> BTW you guys rock. Keep on the good work.
>
> Best regards,
>
> Mathias Kraus
>
>
>
> _______________________________________________
> Panel-devel mailing list
> Panel-devel@kde.org
> https://mail.kde.org/mailman/listinfo/panel-devel
>
>
>

[Attachment #5 (text/html)]

<p>Hi!</p><p>I can&#39;t say anything about your patch in generally because I&#39;m \
just not familiar with the internals of KDE yet ... but (and I don&#39;t know if \
it&#39;s your fault) why the hell is the size of the systray icons hardcoded?? \
(22px). Shouldn&#39;t there be a global setting for the icon size?</p> <p>Best \
Regards,</p><p>Bernhard</p><br><div><span class="gmail_quote">2008/6/14, Mathias \
Kraus &lt;<a href="mailto:k.matze@gmx.net">k.matze@gmx.net</a>&gt;:</span><blockquote \
class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc \
solid;padding-left:1ex"> Hi,<br> <br> this is my first patch for KDE, so I hope I \
don&#39;t break plasma ;)<br> <br> OK, it&#39;s only a small patch for a layouting \
bug which occurs when you have a<br> system tray with multiple rows/columns. See \
attached picture.<br>  <br> The bug is in<br> \
kdebase/workspace/plasma/applets/systemtray/systemtraywidget.cpp.<br> In \
addWidgetToLayout the conditions in line 140<br> minimumHeight() + \
widget-&gt;height() + m_mainLayout-&gt;spacing() &gt; maximumHeight()<br>  is always \
true after the first column is full, the same applies for a vertical<br> panel with \
rows.<br> <br> My patch calculates the maximum number of items that fits into the \
panel and<br> jumps into the next row/column if there is an overflow.<br>  <br> void \
SystemTrayWidget::addWidgetToLayout(QWidget *widget)<br> \
{<br>&nbsp;&nbsp;&nbsp;&nbsp;// Add the widget to the \
layout<br>&nbsp;&nbsp;&nbsp;&nbsp;m_mainLayout-&gt;setRowMinimumHeight(m_nextRow, \
22);<br>&nbsp;&nbsp;&nbsp;&nbsp;m_mainLayout-&gt;setColumnMinimumWidth(m_nextColumn, \
22);<br> &nbsp;&nbsp;&nbsp;&nbsp;widget-&gt;resize(22,22);<br>&nbsp;&nbsp;&nbsp;&nbsp;m_mainLayout-&gt;addWidget(widget, \
m_nextRow, m_nextColumn, 1, 1,<br> Qt::AlignCenter);<br> \
<br>&nbsp;&nbsp;&nbsp;&nbsp;// Figure out where the next widget should \
go<br>&nbsp;&nbsp;&nbsp;&nbsp;if (m_orientation == Qt::Horizontal) {<br> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Calculate the items that fit into \
a column<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_maxCount = \
(maximumHeight() + m_mainLayout-&gt;spacing()) / (widget-<br> &gt;height() + \
m_mainLayout-&gt;spacing()) -1;<br> \
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setMinimumSize(QSize(22 * \
                (m_nextColumn + 1) + m_mainLayout-&gt;spacing()<br>
 * m_nextColumn,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
22 * (m_maxCount + 1) + m_mainLayout-&gt;spacing() *<br> m_maxCount));<br> \
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Add down then across when \
horizontal<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_nextRow++;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if \
(m_nextRow &gt; m_maxCount){<br> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_nextColumn++ \
;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_nextRow \
= 0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;} \
else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Calculate the items that \
fit into a row<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_maxCount = \
(maximumWidth() + m_mainLayout-&gt;spacing()) / (widget-<br>  &gt;width() + \
m_mainLayout-&gt;spacing()) -1;<br> \
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setMinimumSize(QSize(22 * \
(m_maxCount + 1) + m_mainLayout-&gt;spacing() *<br> \
m_maxCount,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
22 * (m_nextRow + 1) + m_mainLayout-&gt;spacing() *<br>  m_nextRow));<br> \
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Add across then down when \
vertical<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_nextColumn++;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if \
(m_nextColumn &gt; m_maxCount) \
{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_nextRow \
++;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_nextColumn \
= 0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>
  }<br> <br> BTW you guys rock. Keep on the good work.<br> <br> Best regards,<br> \
<br>Mathias Kraus<br> <br> <br> \
<br>_______________________________________________<br> Panel-devel mailing list<br> \
<a href="mailto:Panel-devel@kde.org">Panel-devel@kde.org</a><br>  <a \
href="https://mail.kde.org/mailman/listinfo/panel-devel">https://mail.kde.org/mailman/listinfo/panel-devel</a><br> \
<br><br></blockquote></div><br>



_______________________________________________
Panel-devel mailing list
Panel-devel@kde.org
https://mail.kde.org/mailman/listinfo/panel-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic