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

List:       kde-panel-devel
Subject:    Re: Review Request: Fix the issues introduced with the iconshrink patch
From:       "Aaron J. Seigo" <aseigo () kde ! org>
Date:       2012-01-13 11:29:46
Message-ID: 20120113112946.18178.36167 () vidsolbach ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/103685/#review9786
-----------------------------------------------------------



plasma/applets/folderview/iconview.cpp
<http://git.reviewboard.kde.org/r/103685/#comment8098>

    Qt::AlignCenter	== Qt::AlignVCenter | Qt::AlignHCenter, so this could just be \
Qt::AlignCenter



plasma/applets/folderview/iconview.cpp
<http://git.reviewboard.kde.org/r/103685/#comment8096>

    this doesn't make much sense -> above the rect is aligned vertical and horizontal \
center, then it is moved to the top?



plasma/applets/folderview/iconview.cpp
<http://git.reviewboard.kde.org/r/103685/#comment8097>

    why 0.05? is this the amount the icon is shrunk by?


- Aaron J. Seigo


On Jan. 12, 2012, 7:40 p.m., Ignat Semenov wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/103685/
> -----------------------------------------------------------
> 
> (Updated Jan. 12, 2012, 7:40 p.m.)
> 
> 
> Review request for Plasma and Aaron J. Seigo.
> 
> 
> Description
> -------
> 
> With the iconshrink patch, I introduced an issue with the icon text clipping. The \
> thing is, the iconview items painting code is written in a way that the text will \
> accomodate fully only if the icon touches the top of the rect r \
> (iconview.cpp:1050), else the text will get clipped. TO achieve this effect, \
> Qt:AlignTop had been used. I changed that to Qt:AlignCenter and introduced the \
> issue. 
> This patch tries to locate the icon at the top border of the rect r (as it had been \
> before the commit), but when the icon shrinks, it moves towards its own center, \
> same as the first commit. 
> ir.moveTop(r.top());
> 
> Now when the icon is shrinked, it is moved down by half the difference between its \
> normal size and its shrinked size, which is perfectly logical. 
> ir.translate(0, (m_drawIconShrinked && m_pressedIndex == index) ? \
> 0.05*option.decorationSize.height() : 0); 
> This centers the icon nicely around its own center. The text keeps "scaling" \
> towards the top as well, as it had been before the commit. In the idle state, the \
> text is accomodated fully, as it had been before the commit. 
> 
> Diffs
> -----
> 
> plasma/applets/folderview/iconview.cpp d295588 
> 
> Diff: http://git.reviewboard.kde.org/r/103685/diff/diff
> 
> 
> Testing
> -------
> 
> This is not final, there is 1 pixel offset bug in the halo drawing code. I'm going \
> to sleep today, this review request is just to show that I'm aware that I have \
> screwed things up and am working on getting the proper patch done. 
> 
> Thanks,
> 
> Ignat Semenov
> 
> 


[Attachment #5 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;">  <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/103685/">http://git.reviewboard.kde.org/r/103685/</a>
  </td>
    </tr>
   </table>
   <br />









<div>




<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="http://git.reviewboard.kde.org/r/103685/diff/2/?file=46530#file46530line1056" \
style="color: black; font-weight: bold; text-decoration: \
underline;">plasma/applets/folderview/iconview.cpp</a>  <span style="font-weight: \
normal;">

     (Diff revision 2)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
IconView::paintItem(QPainter *painter, const QStyleOptionViewItemV4 &amp;option, \
const QModelIndex &amp;index) const</pre></td>

  </tr>
 </tbody>



 
 




 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">1056</font></th>  <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">   <span class="hl"> \
</span><span class="k"><span class="hl">const</span></span> <span \
class="n">QRect</span> <span class="n">ir</span> <span class="o">=</span> <span \
class="n">QStyle</span><span class="o">::</span><span \
class="n">alignedRect</span><span class="p">(</span><span \
class="n">option</span><span class="p">.</span><span class="n">direction</span><span \
class="p">,</span> <span class="n">Qt</span><span class="o">::</span><span \
class="n">Align<span class="hl">V</span>Center</span> <span class="o">|</span> <span \
class="n">Qt</span><span class="o">::</span><span class="n">AlignHCenter</span><span \
class="p">,</span></pre></td>  <th bgcolor="#e9eaa8" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">1056</font></th>  <td bgcolor="#fdfebc" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; ">    <span class="n">QRect</span> <span \
class="n">ir</span> <span class="o">=</span> <span class="n">QStyle</span><span \
class="o">::</span><span class="n">alignedRect</span><span class="p">(</span><span \
class="n">option</span><span class="p">.</span><span class="n">direction</span><span \
class="p">,</span> <span class="n">Qt</span><span class="o">::</span><span \
class="n">AlignCenter</span> <span class="o">|</span> <span class="n">Qt</span><span \
class="o">::</span><span class="n">AlignHCenter</span><span \
class="p">,</span></pre></td>  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Qt::AlignCenter	== Qt::AlignVCenter | Qt::AlignHCenter, so this could \
just be Qt::AlignCenter</pre> </div>
<br />

<div>




<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="http://git.reviewboard.kde.org/r/103685/diff/2/?file=46530#file46530line1058" \
style="color: black; font-weight: bold; text-decoration: \
underline;">plasma/applets/folderview/iconview.cpp</a>  <span style="font-weight: \
normal;">

     (Diff revision 2)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
IconView::paintItem(QPainter *painter, const QStyleOptionViewItemV4 &amp;option, \
const QModelIndex &amp;index) const</pre></td>

  </tr>
 </tbody>




 
 



 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">1058</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span \
class="n">ir</span><span class="p">.</span><span class="n">moveTop</span><span \
class="p">(</span><span class="n">r</span><span class="p">.</span><span \
class="n">top</span><span class="p">());</span></pre></td>  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">this \
doesn&#39;t make much sense -&gt; above the rect is aligned vertical and horizontal \
center, then it is moved to the top?</pre> </div>
<br />

<div>




<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="http://git.reviewboard.kde.org/r/103685/diff/2/?file=46530#file46530line1059" \
style="color: black; font-weight: bold; text-decoration: \
underline;">plasma/applets/folderview/iconview.cpp</a>  <span style="font-weight: \
normal;">

     (Diff revision 2)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
IconView::paintItem(QPainter *painter, const QStyleOptionViewItemV4 &amp;option, \
const QModelIndex &amp;index) const</pre></td>

  </tr>
 </tbody>




 
 



 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">1059</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span \
class="n">ir</span><span class="p">.</span><span class="n">translate</span><span \
class="p">(</span><span class="mi">0</span><span class="p">,</span> <span \
class="p">(</span><span class="n">m_drawIconShrinked</span> <span \
class="o">&amp;&amp;</span> <span class="n">m_pressedIndex</span> <span \
class="o">==</span> <span class="n">index</span><span class="p">)</span> <span \
class="o">?</span> <span class="mf">0.05</span><span class="o">*</span><span \
class="n">option</span><span class="p">.</span><span \
class="n">decorationSize</span><span class="p">.</span><span \
class="n">height</span><span class="p">()</span> <span class="o">:</span> <span \
class="mi">0</span><span class="p">);</span></pre></td>  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">why 0.05? \
is this the amount the icon is shrunk by?</pre> </div>
<br />



<p>- Aaron J.</p>


<br />
<p>On January 12th, 2012, 7:40 p.m., Ignat Semenov wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;">  <tr>
  <td>

<div>Review request for Plasma and Aaron J. Seigo.</div>
<div>By Ignat Semenov.</div>


<p style="color: grey;"><i>Updated Jan. 12, 2012, 7:40 p.m.</i></p>






<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">With the iconshrink patch, I introduced an issue with the icon text \
clipping. The thing is, the iconview items painting code is written in a way that the \
text will accomodate fully only if the icon touches the top of the rect r \
(iconview.cpp:1050), else the text will get clipped. TO achieve this effect, \
Qt:AlignTop had been used. I changed that to Qt:AlignCenter and introduced the issue.

This patch tries to locate the icon at the top border of the rect r (as it had been \
before the commit), but when the icon shrinks, it moves towards its own center, same \
as the first commit.

ir.moveTop(r.top());

Now when the icon is shrinked, it is moved down by half the difference between its \
normal size and its shrinked size, which is perfectly logical.

ir.translate(0, (m_drawIconShrinked &amp;&amp; m_pressedIndex == index) ? \
0.05*option.decorationSize.height() : 0);

This centers the icon nicely around its own center. The text keeps \
&quot;scaling&quot; towards the top as well, as it had been before the commit. In the \
idle state, the text is accomodated fully, as it had been before the commit.</pre>  \
</td>  </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">This is not final, there is 1 pixel offset bug in the halo drawing code. \
I&#39;m going to sleep today, this review request is just to show that I&#39;m aware \
that I have screwed things up and am working on getting the proper patch done.</pre>  \
</td>  </tr>
</table>




<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>plasma/applets/folderview/iconview.cpp <span style="color: \
grey">(d295588)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/103685/diff/" style="margin-left: \
3em;">View Diff</a></p>




  </td>
 </tr>
</table>








  </div>
 </body>
</html>



_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


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

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