<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/101727/">http://git.reviewboard.kde.org/r/101727/</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/101727/diff/2/?file=24900#file24900line58" style="color: black; font-weight: bold; text-decoration: underline;">core/directoryprovider.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="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">QString DirectoryProvider::libDirectory() 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">58</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">DirectoryProvider</span><span class="o">::</span><span class="n">userDir</span><span class="p">(</span><span class="n">QString</span> <span class="n">subDir</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 one should be const &amp; for the argument. In addition, its probably better to name it &quot;name&quot; since we decided that it does not necessarily need to be a subdir.</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/101727/diff/2/?file=24900#file24900line69" style="color: black; font-weight: bold; text-decoration: underline;">core/directoryprovider.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="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">QString DirectoryProvider::libDirectory() 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">69</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span class="n">dir</span><span class="p">.</span><span class="n">mkdir</span><span class="p">(</span><span class="n">finalPath</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;">Bit of a nitpick, but you&#39;re still not caching the final result. If you change the constructor to first get the m_userDataPath, you can then store the absolute path in the hash, which will also make it easier later on to completely change the paths.

In the userDir method you can then do the following:

if(!m_userDirs.contains(subDir))
{
     QString path = QDir::fromNativeSeparators(m_userDataPath + subdir);

     m_userDirs.insert(subDir, path);
     QDir dir;
     dir.mkdir(path);
}

return m_userDirs.value(subDir)

Which means it will only be an extra call to m_userDirs.contains() when stuff is cached.

In addition, you&#39;re using the wrong code style - Gluon uses braces on newline. ;)</pre>
</div>
<br />



<p>- Arjen</p>


<br />
<p>On June 22nd, 2011, 8:50 p.m., Shantanu Tushar Jha 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 Gluon.</div>
<div>By Shantanu Tushar Jha.</div>


<p style="color: grey;"><i>Updated June 22, 2011, 8:50 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;">When we were adding userDir functions to GluonCore::Global, for caching and flexibility purposes it was needed to add two variables. Keeping these static was quite a mess, and I and Arjen concluded that a Singleton is more suited for this kind of stuff.
As agreed on IRC, added a new class DirectoryProvider which has all the functions from GluonCore::Global except version because its not a directory function. Also, except the userDir function, other functions don&#39;t require an instance and can be called directly.</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;">Overall Gluon&#39;s players seem to function properly. The userData function returns correct paths for me, request everyone to check once for their configuration.</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>core/CMakeLists.txt <span style="color: grey">(8fd1dd0)</span></li>

 <li>core/directoryprovider.h <span style="color: grey">(PRE-CREATION)</span></li>

 <li>core/directoryprovider.cpp <span style="color: grey">(PRE-CREATION)</span></li>

 <li>core/gluon_global.h.in <span style="color: grey">(792d65e)</span></li>

 <li>core/gluonobjectfactory.cpp <span style="color: grey">(4501bed)</span></li>

 <li>creator/plugins/docks/projectdock/projectdock.cpp <span style="color: grey">(e02ce53)</span></li>

 <li>graphics/engine.cpp <span style="color: grey">(c4094b0)</span></li>

 <li>graphics/examples/loadtexture/main.cpp <span style="color: grey">(229f9a4)</span></li>

 <li>player/kde/mainwindow.cpp <span style="color: grey">(7071249)</span></li>

 <li>player/lib/models/gameitemsmodel.cpp <span style="color: grey">(63075ed)</span></li>

 <li>player/lib/ocsprovider.cpp <span style="color: grey">(1d5daa4)</span></li>

 <li>player/qt/mainwindow.cpp <span style="color: grey">(0470e33)</span></li>

</ul>

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




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








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