QString::fromLocal8Bit() doesn't work as expected, as we explicitly set the CodecForLocale to UTF-8 in the initialization code. Therefore we can't use QString::fromLocal8Bit() at places where the system's default Codec is needed. Instead we will now get the actual system Codec via QTextCodec::codecForName("System") at those places. That's not nice, but solves the problem.
This commit is contained in:
parent
545b9b4967
commit
6770f1ec90
@ -543,44 +543,44 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>CueSheetModel</name>
|
<name>CueSheetModel</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Model_CueSheet.cpp" line="208"/>
|
<location filename="../../src/Model_CueSheet.cpp" line="209"/>
|
||||||
<source>No.</source>
|
<source>No.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Model_CueSheet.cpp" line="211"/>
|
<location filename="../../src/Model_CueSheet.cpp" line="212"/>
|
||||||
<source>File / Track</source>
|
<source>File / Track</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Model_CueSheet.cpp" line="214"/>
|
<location filename="../../src/Model_CueSheet.cpp" line="215"/>
|
||||||
<source>Index</source>
|
<source>Index</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Model_CueSheet.cpp" line="217"/>
|
<location filename="../../src/Model_CueSheet.cpp" line="218"/>
|
||||||
<source>Duration</source>
|
<source>Duration</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Model_CueSheet.cpp" line="243"/>
|
<location filename="../../src/Model_CueSheet.cpp" line="244"/>
|
||||||
<source>File %1</source>
|
<source>File %1</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Model_CueSheet.cpp" line="258"/>
|
<location filename="../../src/Model_CueSheet.cpp" line="259"/>
|
||||||
<source>Track %1</source>
|
<source>Track %1</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Model_CueSheet.cpp" line="267"/>
|
<location filename="../../src/Model_CueSheet.cpp" line="268"/>
|
||||||
<location filename="../../src/Model_CueSheet.cpp" line="275"/>
|
<location filename="../../src/Model_CueSheet.cpp" line="276"/>
|
||||||
<source>Unknown Artist</source>
|
<source>Unknown Artist</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Model_CueSheet.cpp" line="271"/>
|
<location filename="../../src/Model_CueSheet.cpp" line="272"/>
|
||||||
<location filename="../../src/Model_CueSheet.cpp" line="275"/>
|
<location filename="../../src/Model_CueSheet.cpp" line="276"/>
|
||||||
<source>Unknown Title</source>
|
<source>Unknown Title</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -543,44 +543,44 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>CueSheetModel</name>
|
<name>CueSheetModel</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Model_CueSheet.cpp" line="208"/>
|
<location filename="../../src/Model_CueSheet.cpp" line="209"/>
|
||||||
<source>No.</source>
|
<source>No.</source>
|
||||||
<translation type="unfinished">Numer.</translation>
|
<translation type="unfinished">Numer.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Model_CueSheet.cpp" line="211"/>
|
<location filename="../../src/Model_CueSheet.cpp" line="212"/>
|
||||||
<source>File / Track</source>
|
<source>File / Track</source>
|
||||||
<translation type="unfinished">Plik/ŚcieżKa</translation>
|
<translation type="unfinished">Plik/ŚcieżKa</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Model_CueSheet.cpp" line="214"/>
|
<location filename="../../src/Model_CueSheet.cpp" line="215"/>
|
||||||
<source>Index</source>
|
<source>Index</source>
|
||||||
<translation type="unfinished">Indeks</translation>
|
<translation type="unfinished">Indeks</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Model_CueSheet.cpp" line="217"/>
|
<location filename="../../src/Model_CueSheet.cpp" line="218"/>
|
||||||
<source>Duration</source>
|
<source>Duration</source>
|
||||||
<translation type="unfinished">Czas trwania</translation>
|
<translation type="unfinished">Czas trwania</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Model_CueSheet.cpp" line="243"/>
|
<location filename="../../src/Model_CueSheet.cpp" line="244"/>
|
||||||
<source>File %1</source>
|
<source>File %1</source>
|
||||||
<translation type="unfinished">Plik %1</translation>
|
<translation type="unfinished">Plik %1</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Model_CueSheet.cpp" line="258"/>
|
<location filename="../../src/Model_CueSheet.cpp" line="259"/>
|
||||||
<source>Track %1</source>
|
<source>Track %1</source>
|
||||||
<translation type="unfinished">Ścieżka %1</translation>
|
<translation type="unfinished">Ścieżka %1</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Model_CueSheet.cpp" line="267"/>
|
<location filename="../../src/Model_CueSheet.cpp" line="268"/>
|
||||||
<location filename="../../src/Model_CueSheet.cpp" line="275"/>
|
<location filename="../../src/Model_CueSheet.cpp" line="276"/>
|
||||||
<source>Unknown Artist</source>
|
<source>Unknown Artist</source>
|
||||||
<translation type="unfinished">Nieznany Artysta</translation>
|
<translation type="unfinished">Nieznany Artysta</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Model_CueSheet.cpp" line="271"/>
|
<location filename="../../src/Model_CueSheet.cpp" line="272"/>
|
||||||
<location filename="../../src/Model_CueSheet.cpp" line="275"/>
|
<location filename="../../src/Model_CueSheet.cpp" line="276"/>
|
||||||
<source>Unknown Title</source>
|
<source>Unknown Title</source>
|
||||||
<translation type="unfinished">Nieznany Tytuł</translation>
|
<translation type="unfinished">Nieznany Tytuł</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#define VER_LAMEXP_MINOR_LO 4
|
#define VER_LAMEXP_MINOR_LO 4
|
||||||
#define VER_LAMEXP_TYPE Alpha
|
#define VER_LAMEXP_TYPE Alpha
|
||||||
#define VER_LAMEXP_PATCH 7
|
#define VER_LAMEXP_PATCH 7
|
||||||
#define VER_LAMEXP_BUILD 803
|
#define VER_LAMEXP_BUILD 804
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Tool versions (minimum expected versions!)
|
// Tool versions (minimum expected versions!)
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
#include <QTextCodec>
|
||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@ -557,6 +558,9 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Get system local Codec
|
||||||
|
const QTextCodec *codec = QTextCodec::codecForName("System");
|
||||||
|
|
||||||
//Check for UTF-8 BOM in order to guess encoding
|
//Check for UTF-8 BOM in order to guess encoding
|
||||||
bool bUTF8 = false, bForceLatin1 = false;
|
bool bUTF8 = false, bForceLatin1 = false;
|
||||||
QByteArray bomCheck = cueFile.peek(128);
|
QByteArray bomCheck = cueFile.peek(128);
|
||||||
@ -569,7 +573,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic
|
|||||||
{
|
{
|
||||||
const QString replacementSymbol = QString(QChar(QChar::ReplacementCharacter));
|
const QString replacementSymbol = QString(QChar(QChar::ReplacementCharacter));
|
||||||
QByteArray data = cueFile.peek(1048576);
|
QByteArray data = cueFile.peek(1048576);
|
||||||
if((!data.isEmpty()) && QString::fromLocal8Bit(data.constData(), data.size()).contains(replacementSymbol))
|
if((!data.isEmpty()) && codec->toUnicode(data.constData(), data.size()).contains(replacementSymbol))
|
||||||
{
|
{
|
||||||
qWarning("Decoding error using local 8-Bit codepage. Enforcing Latin-1.");
|
qWarning("Decoding error using local 8-Bit codepage. Enforcing Latin-1.");
|
||||||
bForceLatin1 = true;
|
bForceLatin1 = true;
|
||||||
@ -611,7 +615,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString line = bUTF8 ? QString::fromUtf8(lineData.constData(), lineData.size()).trimmed() : (bForceLatin1 ? QString::fromLatin1(lineData.constData(), lineData.size()).trimmed() : QString::fromLocal8Bit(lineData.constData(), lineData.size()).trimmed());
|
QString line = (bUTF8 ? QString::fromUtf8(lineData.constData(), lineData.size()) : (bForceLatin1 ? QString::fromLatin1(lineData.constData(), lineData.size()) : codec->toUnicode(lineData.constData(), lineData.size()))).trimmed();
|
||||||
|
|
||||||
/* --- FILE --- */
|
/* --- FILE --- */
|
||||||
if(rxFile.indexIn(line) >= 0)
|
if(rxFile.indexIn(line) >= 0)
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <QDate>
|
#include <QDate>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QTextCodec>
|
||||||
|
|
||||||
//Un-escape XML characters
|
//Un-escape XML characters
|
||||||
static const struct
|
static const struct
|
||||||
@ -133,6 +134,8 @@ bool PlaylistImporter::parsePlaylist_m3u(QFile &data, QStringList &fileList, con
|
|||||||
{
|
{
|
||||||
QByteArray line = data.readLine();
|
QByteArray line = data.readLine();
|
||||||
const bool preferUTF8 = data.fileName().endsWith(".m3u8", Qt::CaseInsensitive);
|
const bool preferUTF8 = data.fileName().endsWith(".m3u8", Qt::CaseInsensitive);
|
||||||
|
const QTextCodec *codec = QTextCodec::codecForName("System");
|
||||||
|
|
||||||
|
|
||||||
while(line.size() > 0)
|
while(line.size() > 0)
|
||||||
{
|
{
|
||||||
@ -141,12 +144,12 @@ bool PlaylistImporter::parsePlaylist_m3u(QFile &data, QStringList &fileList, con
|
|||||||
if(preferUTF8)
|
if(preferUTF8)
|
||||||
{
|
{
|
||||||
filePath[0] = QString(QDir::fromNativeSeparators(QString::fromUtf8(line.constData(), line.size()).trimmed()));
|
filePath[0] = QString(QDir::fromNativeSeparators(QString::fromUtf8(line.constData(), line.size()).trimmed()));
|
||||||
filePath[1] = QString(QDir::fromNativeSeparators(QString::fromLocal8Bit(line.constData(), line.size()).trimmed()));
|
filePath[1] = QString(QDir::fromNativeSeparators(codec->toUnicode(line.constData(), line.size()).trimmed()));
|
||||||
filePath[2] = QString(QDir::fromNativeSeparators(QString::fromLatin1(line.constData(), line.size()).trimmed()));
|
filePath[2] = QString(QDir::fromNativeSeparators(QString::fromLatin1(line.constData(), line.size()).trimmed()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
filePath[0] = QString(QDir::fromNativeSeparators(QString::fromLocal8Bit(line.constData(), line.size()).trimmed()));
|
filePath[0] = QString(QDir::fromNativeSeparators(codec->toUnicode(line.constData(), line.size()).trimmed()));
|
||||||
filePath[1] = QString(QDir::fromNativeSeparators(QString::fromLatin1(line.constData(), line.size()).trimmed()));
|
filePath[1] = QString(QDir::fromNativeSeparators(QString::fromLatin1(line.constData(), line.size()).trimmed()));
|
||||||
filePath[2] = QString(QDir::fromNativeSeparators(QString::fromUtf8(line.constData(), line.size()).trimmed()));
|
filePath[2] = QString(QDir::fromNativeSeparators(QString::fromUtf8(line.constData(), line.size()).trimmed()));
|
||||||
}
|
}
|
||||||
@ -179,15 +182,16 @@ bool PlaylistImporter::parsePlaylist_m3u(QFile &data, QStringList &fileList, con
|
|||||||
bool PlaylistImporter::parsePlaylist_pls(QFile &data, QStringList &fileList, const QDir &baseDir, const QDir &rootDir)
|
bool PlaylistImporter::parsePlaylist_pls(QFile &data, QStringList &fileList, const QDir &baseDir, const QDir &rootDir)
|
||||||
{
|
{
|
||||||
QRegExp plsEntry("File(\\d+)=(.+)", Qt::CaseInsensitive);
|
QRegExp plsEntry("File(\\d+)=(.+)", Qt::CaseInsensitive);
|
||||||
|
const QTextCodec *codec = QTextCodec::codecForName("System");
|
||||||
QByteArray line = data.readLine();
|
QByteArray line = data.readLine();
|
||||||
|
|
||||||
while(line.size() > 0)
|
while(line.size() > 0)
|
||||||
{
|
{
|
||||||
QString filePath[3];
|
QString filePath[3];
|
||||||
|
|
||||||
filePath[0] = QString(QDir::fromNativeSeparators(QString::fromLocal8Bit(line.constData(), line.size()).trimmed()));
|
filePath[0] = QString(QDir::fromNativeSeparators(codec->toUnicode(line.constData(), line.size()).trimmed()));
|
||||||
filePath[2] = QString(QDir::fromNativeSeparators(QString::fromLatin1(line.constData(), line.size()).trimmed()));
|
filePath[1] = QString(QDir::fromNativeSeparators(QString::fromLatin1(line.constData(), line.size()).trimmed()));
|
||||||
filePath[1] = QString(QDir::fromNativeSeparators(QString::fromUtf8(line.constData(), line.size()).trimmed()));
|
filePath[2] = QString(QDir::fromNativeSeparators(QString::fromUtf8(line.constData(), line.size()).trimmed()));
|
||||||
|
|
||||||
for(size_t i = 0; i < 3; i++)
|
for(size_t i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user