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








<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On October 18th, 2010, 4:45 p.m., <b>Maximilian Kossick</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  



<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/100070/diff/1/?file=1066#file1066line20" style="color: black; font-weight: bold; text-decoration: underline;">src/core/meta/support/MetaConstants.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; "></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">20</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="n">QString</span> <span class="n">Meta</span><span class="o">::</span><span class="n">nameForField</span><span class="p">(</span> <span class="n">qint64</span> <span class="n">field</span> <span class="p">)</span></pre></td>
  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">These mappings are bound to get out of sync. How about using K_GLOBAL_STATIC to create an instance of a simple class which would contain these mappings. The actual mappings can be set up in the class&#39; constructor. There might be a KDE class (&quot;KBiAssociativeContainer&quot;) which allows efficient bi-directional mappings (it seems to be in libkdepim for some reason though)</pre>
 </blockquote>





</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The backwards mapping (QString to qint64) is only used at very few places none is time critical.
The forward mapping is quite performat with the switch.

I agree that you have to take care to update the functions after adding a field.
It&#39;s still better than the current solution where you have at least three places to update (down from 6 from before my MetaQueryWidget).</pre>
<br />

<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On October 18th, 2010, 4:45 p.m., <b>Maximilian Kossick</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  



<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/100070/diff/1/?file=1066#file1066line97" style="color: black; font-weight: bold; text-decoration: underline;">src/core/meta/support/MetaConstants.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; "></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">97</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="n">QString</span> <span class="n">Meta</span><span class="o">::</span><span class="n">i18nForField</span><span class="p">(</span> <span class="n">qint64</span> <span class="n">field</span> <span class="p">)</span></pre></td>
  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">A slightly larger task would be replacing qint64 with a proper enum. In Amarok1, multiple field values where sometimes OR&#39;d. I do not think we still do this in A2. That way the compiler could even tell you if an enum value is missing in a switch statement.  </pre>
 </blockquote>





</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Good idea.
That is something for the next patch.</pre>
<br />




<p>- Ralf</p>


<br />
<p>On October 18th, 2010, 12:07 p.m., Ralf Engels wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://git.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 Amarok.</div>
<div>By Ralf Engels.</div>


<p style="color: grey;"><i>Updated 2010-10-18 12:07:31</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;">Instead of implementing the whole behavior of selecting field and values I am just using the MetaQueryWidget.

Also I am moving all field related texts to src/core/meta/support/MetaConstants.cpp
This would also be a good place for the playlist to get it&#39;s texts from.</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;">Generated several advanced playlists testing a couple of the fields and all the conditions.</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>src/CMakeLists.txt <span style="color: grey">(abdcee8)</span></li>

 <li>src/core-impl/collections/support/XmlQueryReader.h <span style="color: grey">(0088608)</span></li>

 <li>src/core-impl/collections/support/XmlQueryReader.cpp <span style="color: grey">(b5518f0)</span></li>

 <li>src/core-impl/collections/support/XmlQueryWriter.h <span style="color: grey">(11c818e)</span></li>

 <li>src/core-impl/collections/support/XmlQueryWriter.cpp <span style="color: grey">(657e0c8)</span></li>

 <li>src/core/CMakeLists.txt <span style="color: grey">(5863ca1)</span></li>

 <li>src/core/meta/support/MetaConstants.h <span style="color: grey">(40cad34)</span></li>

 <li>src/core/meta/support/MetaConstants.cpp <span style="color: grey">(PRE-CREATION)</span></li>

 <li>src/core/meta/support/MetaUtility.h <span style="color: grey">(b161bdc)</span></li>

 <li>src/core/meta/support/MetaUtility.cpp <span style="color: grey">(0bb29db)</span></li>

 <li>src/dynamic/Bias.h <span style="color: grey">(6ec60b6)</span></li>

 <li>src/dynamic/Bias.cpp <span style="color: grey">(dec2db2)</span></li>

 <li>src/playlistgenerator/PresetModel.cpp <span style="color: grey">(9b74636)</span></li>

 <li>src/playlistgenerator/constraints/PlaylistDuration.h <span style="color: grey">(992215c)</span></li>

 <li>src/playlistgenerator/constraints/PlaylistDuration.cpp <span style="color: grey">(5d83dfe)</span></li>

 <li>src/playlistgenerator/constraints/TagMatch.h <span style="color: grey">(094a68b)</span></li>

 <li>src/playlistgenerator/constraints/TagMatch.cpp <span style="color: grey">(a719825)</span></li>

 <li>src/playlistgenerator/constraints/TagMatchEditWidget.ui <span style="color: grey">(b9d97c6)</span></li>

 <li>src/playlistgenerator/constraints/TagMatchSupport.cpp <span style="color: grey">(d368931)</span></li>

 <li>src/widgets/MetaQueryWidget.h <span style="color: grey">(c720b6d)</span></li>

 <li>src/widgets/MetaQueryWidget.cpp <span style="color: grey">(ae07e6b)</span></li>

</ul>

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




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








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