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

List:       kde-panel-devel
Subject:    Re: Review Request: battery: Support for any amount of brightness
From:       Sebastian_Kügler <sebas () kde ! org>
Date:       2010-07-30 12:32:02
Message-ID: 20100730123202.7061.75861 () localhost
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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


I understand it in principle, but would like to know which specific case this one \
fixes. Can you give an example of what works with the patch that doesn't work without \
it?

I've also added some comments inline.


/trunk/KDE/kdebase/workspace/plasma/generic/applets/battery/battery.cpp
<http://reviewboard.kde.org/r/4796/#comment6528>

    Just sender should be fine here, this part looks a little like you were trying to \
make sure you don't receive bogus signals. Any special case that I'm missing?



/trunk/KDE/kdebase/workspace/plasma/generic/applets/battery/battery.cpp
<http://reviewboard.kde.org/r/4796/#comment6529>

    This won't work if you check for the sender(), no?



/trunk/KDE/kdebase/workspace/plasma/generic/applets/battery/battery.cpp
<http://reviewboard.kde.org/r/4796/#comment6531>

    There's no user-visible distinction between the brightness sliders. How should \
the user tell which slider she's manipulating? Just adding every brightness device we \
find is a bit rough I think.



/trunk/KDE/kdebase/workspace/plasma/generic/applets/battery/battery.cpp
<http://reviewboard.kde.org/r/4796/#comment6530>

    remove this, and we have kDebug() :-)



/trunk/KDE/kdebase/workspace/plasma/generic/applets/battery/battery.cpp
<http://reviewboard.kde.org/r/4796/#comment6532>

    Is this really necessary? If at all, it should use Plasma's font, not \
KGlobalSetting's font.  
    Anyway, what's the reason to do this?


- Sebastian


On 2010-07-30 08:23:16, Rafa? Mi?ecki wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/4796/
> -----------------------------------------------------------
> 
> (Updated 2010-07-30 08:23:16)
> 
> 
> Review request for Plasma.
> 
> 
> Summary
> -------
> 
> Currently we always display one brightness slider, even if there is not br device \
> at all (see bug #199520) or if there are more devices that should be controlled. 
> With this patch we fetch all devices and generate one label&slider pair for each.
> 
> The most confusing thing for me in implementation was storing list of sliders \
> assigned to devices names. For that purpose I introduced struct BrightnessSet. I \
> don't know if it is clean and acceptable solution, however keeping something like \
> QMap<QPair<Plasma::Label *, Plasma::Slider *> > *m_brightnessControlls didn't sound \
> too great to me. 
> 
> This addresses bug 199520.
> https://bugs.kde.org/show_bug.cgi?id=199520
> 
> 
> Diffs
> -----
> 
> /trunk/KDE/kdebase/workspace/plasma/generic/applets/battery/battery.h 1156862 
> /trunk/KDE/kdebase/workspace/plasma/generic/applets/battery/battery.cpp 1156862 
> 
> Diff: http://reviewboard.kde.org/r/4796/diff
> 
> 
> Testing
> -------
> 
> I don't have two brightness devices, so I didn't test that part.
> 
> After removing "video" kernel module I didn't get any slider which is good.
> 
> I also put some:
> qDebug() << "setting" << bs->device
> to make sure my list of names and sliders works fine.
> 
> 
> Thanks,
> 
> Rafa?
> 
> 


[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://reviewboard.kde.org/r/4796/">http://reviewboard.kde.org/r/4796/</a>
  </td>
    </tr>
   </table>
   <br />





 <pre>I understand it in principle, but would like to know which specific case this \
one fixes. Can you give an example of what works with the patch that doesn&#39;t work \
without it?

I&#39;ve also added some comments inline.</pre>
 <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="/r/4796/diff/1/?file=31992#file31992line412" style="color: black; font-weight: \
bold; text-decoration: \
underline;">/trunk/KDE/kdebase/workspace/plasma/generic/applets/battery/battery.cpp</a>
  <span style="font-weight: normal;">

     (Diff revision 1)

    </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; \
white-space: pre-wrap; word-wrap: break-word;">void Battery::hibernate()</pre></td>

  </tr>
 </tbody>



 
 




 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">411</font></th>  <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; white-space: pre-wrap; \
word-wrap: break-word;">        <span class="n">Solid</span><span \
class="o">::</span><span class="n">Control</span><span class="o">::</span><span \
class="n">PowerManager</span><span class="o">::</span><span \
class="n">setBrightness</span><span class="p">(</span><span \
class="n">brightness</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">411</font></th>  <td bgcolor="#fdfebc" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; white-space: \
pre-wrap; word-wrap: break-word;">        <span class="k">for</span> <span \
class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span \
class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span \
class="n">i</span> <span class="o">&lt;</span> <span \
class="n">m_brightnessSliders</span><span class="o">-&gt;</span><span \
class="n">size</span><span class="p">();</span> <span class="o">++</span><span \
class="n">i</span><span class="p">)</span> <span class="p">{</span></pre></td>  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em">Just sender should be fine here, this part looks a \
little like you were trying to make sure you don&#39;t receive bogus signals. Any \
special case that I&#39;m missing?</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="/r/4796/diff/1/?file=31992#file31992line436" style="color: black; font-weight: \
bold; text-decoration: \
underline;">/trunk/KDE/kdebase/workspace/plasma/generic/applets/battery/battery.cpp</a>
  <span style="font-weight: normal;">

     (Diff revision 1)

    </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; \
white-space: pre-wrap; word-wrap: break-word;">void \
Battery::setFullBrightness()</pre></td>

  </tr>
 </tbody>






 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">426</font></th>  <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; white-space: pre-wrap; \
word-wrap: break-word;">    <span class="n">brightnessChanged</span><span \
class="p">(</span><span class="mi">100</span><span class="p">);</span></pre></td>  \
<th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">435</font></th>  <td bgcolor="#ffffff" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; white-space: \
pre-wrap; word-wrap: break-word;">    <span class="n">brightnessChanged</span><span \
class="p">(</span><span class="mi">100</span><span class="p">);</span></pre></td>  \
</tr>

 </tbody>

</table>

<pre style="margin-left: 2em">This won&#39;t work if you check for the sender(), \
no?</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="/r/4796/diff/1/?file=31992#file31992line528" style="color: black; font-weight: \
bold; text-decoration: \
underline;">/trunk/KDE/kdebase/workspace/plasma/generic/applets/battery/battery.cpp</a>
  <span style="font-weight: normal;">

     (Diff revision 1)

    </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; \
white-space: pre-wrap; word-wrap: break-word;">void \
Battery::initExtenderItem(Plasma::ExtenderItem *item)</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; white-space: pre-wrap; \
word-wrap: break-word;"></pre></td>  <th bgcolor="#b1ebb0" style="border-left: 1px \
solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">527</font></th>  <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; white-space: pre-wrap; word-wrap: break-word;">    \
<span class="n">foreach</span> <span class="p">(</span><span class="k">const</span> \
<span class="n">QString</span> <span class="o">&amp;</span><span \
class="n">device</span><span class="p">,</span> <span class="n">controls</span><span \
class="p">.</span><span class="n">keys</span><span class="p">())</span> <span \
class="p">{</span></pre></td>  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em">There&#39;s no user-visible distinction between the \
brightness sliders. How should the user tell which slider she&#39;s manipulating? \
Just adding every brightness device we find is a bit rough I think.</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="/r/4796/diff/1/?file=31992#file31992line529" style="color: black; font-weight: \
bold; text-decoration: \
underline;">/trunk/KDE/kdebase/workspace/plasma/generic/applets/battery/battery.cpp</a>
  <span style="font-weight: normal;">

     (Diff revision 1)

    </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; \
white-space: pre-wrap; word-wrap: break-word;">void \
Battery::initExtenderItem(Plasma::ExtenderItem *item)</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; white-space: pre-wrap; \
word-wrap: break-word;"></pre></td>  <th bgcolor="#b1ebb0" style="border-left: 1px \
solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">528</font></th>  <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; white-space: pre-wrap; word-wrap: break-word;">    \
<span class="n">qDebug</span><span class="p">()</span> <span \
class="o">&lt;&lt;</span> <span class="s">&quot;[DBG]&quot;</span> <span \
class="o">&lt;&lt;</span> <span class="n">device</span><span \
class="p">;</span></pre></td>  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em">remove this, and we have kDebug() :-)</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="/r/4796/diff/1/?file=31992#file31992line643" style="color: black; font-weight: \
bold; text-decoration: \
underline;">/trunk/KDE/kdebase/workspace/plasma/generic/applets/battery/battery.cpp</a>
  <span style="font-weight: normal;">

     (Diff revision 1)

    </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; \
white-space: pre-wrap; word-wrap: break-word;">void Battery::popupEvent(bool \
show)</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; white-space: pre-wrap; \
word-wrap: break-word;"></pre></td>  <th bgcolor="#b1ebb0" style="border-left: 1px \
solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">640</font></th>  <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; white-space: pre-wrap; word-wrap: break-word;">    \
<span class="n">m_brightnessSliders</span><span class="o">-&gt;</span><span \
class="n">at</span><span class="p">(</span><span class="n">i</span><span \
class="p">).</span><span class="n">label</span><span class="o">-&gt;</span><span \
class="n">setFont</span><span class="p">(</span><span class="n">infoFont</span><span \
class="p">);</span></pre></td>  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em">Is this really necessary? If at all, it should use \
Plasma&#39;s font, not KGlobalSetting&#39;s font.

Anyway, what&#39;s the reason to do this?</pre>
</div>
<br />



<p>- Sebastian</p>


<br />
<p>On July 30th, 2010, 8:23 a.m., Rafa? Mi?ecki wrote:</p>




<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://reviewboard.kde.orgrb/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.</div>
<div>By Rafa? Mi?ecki.</div>


<p style="color: grey;"><i>Updated 2010-07-30 08:23:16</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;">Currently we always display one brightness \
slider, even if there is not br device at all (see bug #199520) or if there are more \
devices that should be controlled.

With this patch we fetch all devices and generate one label&amp;slider pair for each.

The most confusing thing for me in implementation was storing list of sliders \
assigned to devices names. For that purpose I introduced struct BrightnessSet. I \
don&#39;t know if it is clean and acceptable solution, however keeping something like \
QMap&lt;QPair&lt;Plasma::Label *, Plasma::Slider *&gt; &gt; *m_brightnessControlls \
didn&#39;t sound too great to me.</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;">I don&#39;t have two brightness devices, so I \
didn&#39;t test that part.

After removing &quot;video&quot; kernel module I didn&#39;t get any slider which is \
good.

I also put some:
qDebug() &lt;&lt; &quot;setting&quot; &lt;&lt; bs-&gt;device
to make sure my list of names and sliders works fine.</pre>
  </td>
 </tr>
</table>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>


 <a href="https://bugs.kde.org/show_bug.cgi?id=199520">199520</a>


</div>


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

 <li>/trunk/KDE/kdebase/workspace/plasma/generic/applets/battery/battery.h <span \
style="color: grey">(1156862)</span></li>

 <li>/trunk/KDE/kdebase/workspace/plasma/generic/applets/battery/battery.cpp <span \
style="color: grey">(1156862)</span></li>

</ul>

<p><a href="http://reviewboard.kde.org/r/4796/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