<pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" color:#000080;">#ifdef</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">Q_WS_WIN</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">TagLib</span>::<span style=" color:#800080;">FileRef</span><span style=" color:#c0c0c0;"> </span>fref(to.toLocalFile().toStdWString().c_str());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" color:#000080;">#else</span><span style=" color:#c0c0c0;"> </span>defined(<span style=" color:#800080;">Q_WS_MACX</span>)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" color:#c0c0c0;"> </span>TagLib::FileRef<span style=" color:#c0c0c0;"> </span>fref(to.toLocalFile().toUtf8());</pre><pre style="margin-top: 0px; margin-bottom: 0px; ">
<span style=" color:#000080;">#endif</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" color:#000080;"><br></span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" color:#000080;">...</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" color:#000080;"><br></span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" color:#800080;">TagLib</span>::<span style=" color:#800080;">MPEG</span>::<span style=" color:#800080;">File</span><span style=" color:#c0c0c0;"> </span>*fileMPEG<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">dynamic_cast</span><<span style=" color:#800080;">TagLib</span>::<span style=" color:#800080;">MPEG</span>::<span style=" color:#800080;">File</span><span style=" color:#c0c0c0;"> </span>*>(fref.file());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px; "><pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" color:#808000;">if</span>(fileMPEG)</pre><pre style="margin-top: 0px; margin-bottom: 0px; "><font color="#c0c0c0"> </font>fileMPEG->save(<span style=" color:#800080;">MPEG</span>::<span style=" color:#800080;">File</span>::<span style=" color:#800080;">AllTags</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">true</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">3</span>); // Many programs can't read id3v2.4 tags </pre>
<pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" color:#808000;">else</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><font color="#c0c0c0"> </font>fref.save();</pre></pre><pre style="margin-top: 0px; margin-bottom: 0px; ">
<span style=" color:#000080;"><br></span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" color:#800080;">TagLib</span>::<span style=" color:#800080;">String</span><span style=" color:#c0c0c0;"> </span>toTString(const <span style=" color:#800080;">QString*</span><span style=" color:#c0c0c0;"> </span>str)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px; ">{</pre><pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">TagLib</span>::<span style=" color:#800080;">String</span>(<span style=" color:#808000;">reinterpret_cast</span><<span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">wchar_t</span><span style=" color:#c0c0c0;"> </span>*>(str.toStdWString().data()));</pre>
<pre style="margin-top: 0px; margin-bottom: 0px; ">}</pre><pre style="margin-top: 0px; margin-bottom: 0px; "><br></pre><pre style="margin-top: 0px; margin-bottom: 0px; ">\\ To fix id3v1 encoding bug</pre><pre style="margin-top: 0px; margin-bottom: 0px; ">
<pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" color:#800080;">QString</span><span style=" color:#c0c0c0;"> </span>toQString(<span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">TagLib</span>::<span style=" color:#800080;">String</span>&<span style=" color:#c0c0c0;"> </span>str)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px; ">{</pre><pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span>(str.isLatin1())</pre><pre style="margin-top: 0px; margin-bottom: 0px; ">
<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QString</span>::fromLocal8Bit(str.to8Bit().c_str());</pre><pre style="margin-top: 0px; margin-bottom: 0px; ">
<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QString</span>::fromStdWString(str.toWString());</pre><pre style="margin-top: 0px; margin-bottom: 0px; ">
}</pre></pre></pre><br><div class="gmail_quote">2011/11/14 Hoài Linh Nguyễn <span dir="ltr"><<a href="mailto:mrsherlock88@gmail.com">mrsherlock88@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I use : Qt Creator in Window 7 x86. Visual Studio 9 2008, CMake 2.8.6, latest taglib in Git.<div>I Generate in Cmake 2.8.6 like image attached, another hidden varialble are default.</div><div>I build from Visual studio 9, first, I get tag.lib file and size is 520KB. code I use:</div>
<div><span style="color:#c0c0c0"> </span><span style="color:#800080">QString</span><span style="color:#c0c0c0"> </span>filepath<span style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> </span>fileInfo.absoluteFilePath();
<pre style="margin-top:0px;margin-bottom:0px"></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#808000">int</span><span style="color:#c0c0c0"> </span>fnLen<span style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> </span>filepath.length();</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#808000">wchar_t</span>*<span style="color:#c0c0c0"> </span>fnWs<span style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> </span><span style="color:#808000">new</span><span style="color:#c0c0c0"> </span><span style="color:#808000">wchar_t</span>[fnLen<span style="color:#c0c0c0"> </span>+<span style="color:#c0c0c0"> </span><span style="color:#000080">1</span>];</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>fnWs[fnLen]<span style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> </span><span style="color:#000080">0</span>;</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>filepath.toWCharArray(fnWs);</pre>
<pre style="margin-top:0px;margin-bottom:0px"></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#800080">TagLib</span>::<span style="color:#800080">FileRef</span><span style="color:#c0c0c0"> </span>f(filepath.constData());</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#800080">TagLib</span>::<span style="color:#800080">FileName</span><span style="color:#c0c0c0"> </span>filename(fnWs);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#008000">//</span><span style="color:#c0c0c0"> </span><span style="color:#008000">TagLib::FileRef</span><span style="color:#c0c0c0"> </span><span style="color:#008000">f(filename);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#808000">delete</span><span style="color:#c0c0c0"> </span>[]<span style="color:#c0c0c0"> </span>fnWs;</pre>
<pre style="margin-top:0px;margin-bottom:0px"></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#808000">if</span>(!f.isNull()<span style="color:#c0c0c0"> </span>&&<span style="color:#c0c0c0"> </span>f.tag())</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>{</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#800080">TagLib</span>::<span style="color:#800080">Tag</span><span style="color:#c0c0c0"> </span>*tag<span style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> </span>f.tag();</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#808000">this</span>-><span style="color:#800000">artist</span><span style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> </span>TStringToQString(tag-><span style="font-style:italic">artist</span>());</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#808000">this</span>-><span style="color:#800000">album</span><span style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> </span>TStringToQString(tag-><span style="font-style:italic">album</span>());</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#808000">this</span>-><span style="color:#800000">title</span><span style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> </span>TStringToQString(tag-><span style="font-style:italic">title</span>());</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>}</pre><pre style="margin-top:0px;margin-bottom:0px"><font face="arial"><span style="white-space:normal">With tag.lib in 520KB, only one error occurs is "cannot convert parameter from QChar * to Taglib::FileName, no constructor found". When change to:</span></font></pre>
<pre style="margin-top:0px;margin-bottom:0px"><pre style="margin-top:0px;margin-bottom:0px"><span style="color:#008000">//</span><span style="color:#c0c0c0"> </span><span style="color:#008000">TagLib::FileRef</span><span style="color:#c0c0c0"> </span><span style="color:#008000">f(filepath.constData());</span>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#800080">TagLib</span>::<span style="color:#800080">FileName</span><span style="color:#c0c0c0"> </span>filename(fnWs);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#800080">TagLib</span>::<span style="color:#800080">FileRef</span><span style="color:#c0c0c0"> </span>f(filename);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><pre style="margin-top:0px;margin-bottom:0px"><font face="arial"><span style="white-space:normal">I get "unresolved external symbol".</span></font></pre>
<pre style="margin-top:0px;margin-bottom:0px"><font face="arial"><span style="white-space:normal"><br></span></font></pre><pre style="margin-top:0px;margin-bottom:0px"><font face="arial"><span style="white-space:normal">After that, I re-generate with cmake, and re-build (try clean, or delete all file, re-extract from *.tar.gz file). But I get tag.lib with ~6MB, alway.</span></font></pre>
<pre style="margin-top:0px;margin-bottom:0px"><font face="arial"><span style="white-space:normal">I try re-install CMake.</span></font></pre><pre style="margin-top:0px;margin-bottom:0px"><font face="arial"><span style="white-space:normal"><br>
</span></font></pre><pre style="margin-top:0px;margin-bottom:0px"><font face="arial"><span style="white-space:normal">Is there other way to construct FileName from QString ? Or fix that with new Constructor? Or I must generate with other config? Please help, I rather to use Taglib.</span></font></pre>
<pre style="margin-top:0px;margin-bottom:0px"><font face="arial"><span style="white-space:normal"><br></span></font></pre><pre style="margin-top:0px;margin-bottom:0px"><font face="arial"><span style="white-space:normal">Sorry for my bad English.</span></font></pre>
</pre></pre></pre></div>
<br>_______________________________________________<br>
taglib-devel mailing list<br>
<a href="mailto:taglib-devel@kde.org">taglib-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/taglib-devel" target="_blank">https://mail.kde.org/mailman/listinfo/taglib-devel</a><br>
<br></blockquote></div><br>