diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts index 1afe2468..744ace1d 100644 --- a/etc/Translation/Blank.ts +++ b/etc/Translation/Blank.ts @@ -350,153 +350,183 @@ CueImportDialog - + Import Cue Sheet - + The following Cue Sheet will be split and imported into LameXP. - + Loading Cue Sheet file, please be patient... - - + + Failed to load the Cue Sheet file: - + The specified file could not be found! - - - - + + + + Cue Sheet Error - + + (System Default) + + + + + Select ANSI Codepage for Cue Sheet file: + + + + + OK + + + + + Cancel + + + + An unknown error has occured! - + The file could not be opened for reading. Make sure you have the required rights! - + The provided file does not look like a valid Cue Sheet disc image file! - + Could not find any supported audio track in the Cue Sheet image! - + Note that LameXP can not handle "binary" Cue Sheet images. - + The selected Cue Sheet file contains inconsistent information. Take care! - - + + Unknown Artist + + + + + Unknown Album + + + + + Choose Output Directory - - + + LameXP - + Error: The selected output directory could not be created! - + Error: The selected output directory is not writable! - + Low Diskspace Warning - + There are less than %1 GB of free diskspace available in the selected output directory. - + It is highly recommend to free up more diskspace before proceeding with the import! - + Analyzing file(s), please wait... - + Analysis Failed - + Warning: The format of some of the input files could not be determined! - + Continue Anyway - + Abort - + Splitting file(s), please wait... - + Process was aborted by the user after %1 track(s)! - + An unexpected error has occured while splitting the Cue Sheet! - + Imported %1 track(s) from the Cue Sheet and skipped %2 track(s). - + Cue Sheet Completed @@ -505,37 +535,47 @@ CueSheetImport - + Import Cue Sheet - + + Artist: + + + + + Album: + + + + Existing Source File - + Missing Source File (Tracks will be skipped!) - + Output Directory - + Browse... - + Load a different Cue Sheet - + Discard diff --git a/etc/Translation/LameXP_DE.ts b/etc/Translation/LameXP_DE.ts index e39dc321..ba581c37 100644 --- a/etc/Translation/LameXP_DE.ts +++ b/etc/Translation/LameXP_DE.ts @@ -385,6 +385,30 @@ Process was aborted by the user after %1 track(s)! Der Vorgang wurde vom Benutzter nach %1 Track(s) abgebrochen! + + (System Default) + (Systemstandard) + + + Select ANSI Codepage for Cue Sheet file: + ANSI Codepage fürCuesheet Datei auswählen: + + + OK + OK + + + Cancel + Abbrechen + + + Unknown Artist + Unbekannter Künstler + + + Unknown Album + Unbekanntes Album + CueSheetImport @@ -416,6 +440,14 @@ Load a different Cue Sheet Ein anderes Cuesheet laden + + Artist: + Künstler: + + + Album: + Album: + CueSheetModel diff --git a/etc/Translation/LameXP_ES.ts b/etc/Translation/LameXP_ES.ts index 96b84e77..c4d58689 100644 --- a/etc/Translation/LameXP_ES.ts +++ b/etc/Translation/LameXP_ES.ts @@ -385,6 +385,30 @@ Process was aborted by the user after %1 track(s)! ¡El proceso fue cancelado tras %1 pista(s)! + + (System Default) + + + + Select ANSI Codepage for Cue Sheet file: + + + + OK + Aceptar + + + Cancel + Cancelar + + + Unknown Artist + Artista desconocido + + + Unknown Album + Álbum desconocido + CueSheetImport @@ -416,6 +440,14 @@ Load a different Cue Sheet Cargar otro Cue sheet + + Artist: + + + + Album: + + CueSheetModel diff --git a/etc/Translation/LameXP_FR.ts b/etc/Translation/LameXP_FR.ts index dd69e419..2368fdc1 100644 --- a/etc/Translation/LameXP_FR.ts +++ b/etc/Translation/LameXP_FR.ts @@ -389,6 +389,30 @@ Process was aborted by the user after %1 track(s)! + + (System Default) + + + + Select ANSI Codepage for Cue Sheet file: + + + + OK + OK + + + Cancel + Annuler + + + Unknown Artist + Artiste inconnu + + + Unknown Album + + CueSheetImport @@ -420,6 +444,14 @@ Load a different Cue Sheet + + Artist: + + + + Album: + + CueSheetModel diff --git a/etc/Translation/LameXP_IT.ts b/etc/Translation/LameXP_IT.ts index ed698285..dd02275e 100644 --- a/etc/Translation/LameXP_IT.ts +++ b/etc/Translation/LameXP_IT.ts @@ -385,6 +385,30 @@ Process was aborted by the user after %1 track(s)! + + (System Default) + + + + Select ANSI Codepage for Cue Sheet file: + + + + OK + + + + Cancel + Cancella + + + Unknown Artist + + + + Unknown Album + + CueSheetImport @@ -416,6 +440,14 @@ Load a different Cue Sheet + + Artist: + + + + Album: + + CueSheetModel diff --git a/etc/Translation/LameXP_KR.ts b/etc/Translation/LameXP_KR.ts index 96b38026..724e007d 100644 --- a/etc/Translation/LameXP_KR.ts +++ b/etc/Translation/LameXP_KR.ts @@ -385,6 +385,30 @@ Process was aborted by the user after %1 track(s)! + + (System Default) + + + + Select ANSI Codepage for Cue Sheet file: + + + + OK + 확인 + + + Cancel + 취소 + + + Unknown Artist + + + + Unknown Album + + CueSheetImport @@ -416,6 +440,14 @@ Load a different Cue Sheet + + Artist: + + + + Album: + + CueSheetModel diff --git a/etc/Translation/LameXP_PL.ts b/etc/Translation/LameXP_PL.ts index bad301a5..11442c41 100644 --- a/etc/Translation/LameXP_PL.ts +++ b/etc/Translation/LameXP_PL.ts @@ -350,153 +350,183 @@ CueImportDialog - + Import Cue Sheet Importuj Cue Sheet - + The following Cue Sheet will be split and imported into LameXP. Dany plik Cue Sheet będzie podzielony i zaimortowany do LameXP. - + Loading Cue Sheet file, please be patient... Ładowanie pliku Cue Sheet, prosze być cierpliwy... - - + + Failed to load the Cue Sheet file: Ładowanie pliku Cue Sheet zakończone niepowodzeniem: - + The specified file could not be found! Podany plik nie może być odnaleziony! - - - - + + + + Cue Sheet Error Błąd pliku Cue Sheet - + + (System Default) + + + + + Select ANSI Codepage for Cue Sheet file: + + + + + OK + OK + + + + Cancel + Anuluj + + + An unknown error has occured! Wystąpił nieokreśłony błąd! - + The file could not be opened for reading. Make sure you have the required rights! Plik nie mógł zostać odczytany. Upewnij się że masz prawo odczytu! - + The provided file does not look like a valid Cue Sheet disc image file! Dany plik nie wydaje się prawidłowym plikiem obrazu Cue Sheet! - + Could not find any supported audio track in the Cue Sheet image! Nie znaleziono wspieranego formatu dźwięku w żadnej ze ścieżek obrazu Cue Sheet! - + Note that LameXP can not handle "binary" Cue Sheet images. LameXP nie radzi sobie z formatem "binarnym" obrazu Cue Sheet. - + The selected Cue Sheet file contains inconsistent information. Take care! Wybrany plik Cue Sheet zawiera niespójne informacje. Prosze zachować ostrożność! - - + + Unknown Artist + Nieznany Artysta + + + + Unknown Album + Nieznany Album + + + + Choose Output Directory Wybierz folder wyjściowy - - + + LameXP LameXP - + Error: The selected output directory could not be created! Błąd: Wybrana lokalizacja wyjściowa nie może zostać utworzona! - + Error: The selected output directory is not writable! Błąd: Nie można zapisać w wybranej lokalizacji wyjściowej! - + Low Diskspace Warning Ostrzeżenie o małej ilości miejsca na dysku - + There are less than %1 GB of free diskspace available in the selected output directory. Jest mniej niż %1 GB wolnego miejsca w wybranej lokalizacji wyjściowej. - + It is highly recommend to free up more diskspace before proceeding with the import! Jest wysoce zalecane zwolnić miejsce na dysku zanim zaczniesz importować! - + Analyzing file(s), please wait... Analizowanie pliku/ów, prosze czekać... - + Analysis Failed Analiza zakończona niepowodzeniem - + Warning: The format of some of the input files could not be determined! Ostrzeżenie: Nie można rozpoznać formatu kilku plików wejściowych! - + Continue Anyway Kontynuuj pomimo to - + Abort Przerwij - + Splitting file(s), please wait... Dzielenie pliku/ów, prosze czekać... - + Process was aborted by the user after %1 track(s)! Proces został przerwany przez użytkownika po imporcie %1 ścieżek! - + An unexpected error has occured while splitting the Cue Sheet! Wystąpił nieoczekiwany błąd podczas podziału pliku Cue Sheet! - + Imported %1 track(s) from the Cue Sheet and skipped %2 track(s). Zaimportowano %1 ścieżek i opuszczono %2 ścieżek z pliku Cue Sheet. - + Cue Sheet Completed Stworzono plik Cue Sheet @@ -505,37 +535,47 @@ CueSheetImport - + Import Cue Sheet Importuj plik Cue Sheet - + + Artist: + + + + + Album: + + + + Existing Source File Istniejący plik źródłowy - + Missing Source File (Tracks will be skipped!) Brakujące pliki źródłowe (Ścieżki zostaną pominięte!) - + Output Directory Folder wyjściowy - + Browse... Wybierz... - + Load a different Cue Sheet Załaduj inny plik Cue Sheet - + Discard Wyjdź diff --git a/etc/Translation/LameXP_RU.ts b/etc/Translation/LameXP_RU.ts index 67b367a5..f6300efe 100644 --- a/etc/Translation/LameXP_RU.ts +++ b/etc/Translation/LameXP_RU.ts @@ -387,6 +387,30 @@ Process was aborted by the user after %1 track(s)! Процесс отменён пользователем после %1 трэк(ов)! + + (System Default) + + + + Select ANSI Codepage for Cue Sheet file: + + + + OK + ОК + + + Cancel + Отмена + + + Unknown Artist + Неизвестный Артист + + + Unknown Album + Неизвестный Альбом + CueSheetImport @@ -418,6 +442,14 @@ Load a different Cue Sheet Загрузить другой Cue плэйлист + + Artist: + + + + Album: + + CueSheetModel diff --git a/etc/Translation/LameXP_UK.ts b/etc/Translation/LameXP_UK.ts index f50fe493..864dfb4e 100644 --- a/etc/Translation/LameXP_UK.ts +++ b/etc/Translation/LameXP_UK.ts @@ -386,6 +386,30 @@ Cue Sheet Completed Обробку списку Cue завершено + + (System Default) + + + + Select ANSI Codepage for Cue Sheet file: + + + + OK + Ок + + + Cancel + Відмінити + + + Unknown Artist + Невідомий виконавець + + + Unknown Album + Невідомий альбом + CueSheetImport @@ -417,6 +441,14 @@ Load a different Cue Sheet Обрати інший список CUE + + Artist: + + + + Album: + + CueSheetModel diff --git a/gui/CueSheetImport.ui b/gui/CueSheetImport.ui index 69c54837..5273b60e 100644 --- a/gui/CueSheetImport.ui +++ b/gui/CueSheetImport.ui @@ -175,6 +175,111 @@ 2 + + + + + + + 75 + true + + + + Artist: + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + N/A + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 16 + 20 + + + + + + + + + 75 + true + + + + Album: + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + N/A + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + diff --git a/res/localization/LameXP_DE.qm b/res/localization/LameXP_DE.qm index 65f8db1c..e5215637 100644 Binary files a/res/localization/LameXP_DE.qm and b/res/localization/LameXP_DE.qm differ diff --git a/res/localization/LameXP_ES.qm b/res/localization/LameXP_ES.qm index 4ab0f05f..e8036835 100644 Binary files a/res/localization/LameXP_ES.qm and b/res/localization/LameXP_ES.qm differ diff --git a/res/localization/LameXP_FR.qm b/res/localization/LameXP_FR.qm index 1a66b3b4..904aeb85 100644 Binary files a/res/localization/LameXP_FR.qm and b/res/localization/LameXP_FR.qm differ diff --git a/res/localization/LameXP_IT.qm b/res/localization/LameXP_IT.qm index 9fd29114..983260cc 100644 Binary files a/res/localization/LameXP_IT.qm and b/res/localization/LameXP_IT.qm differ diff --git a/res/localization/LameXP_KR.qm b/res/localization/LameXP_KR.qm index a879de53..5f87d220 100644 Binary files a/res/localization/LameXP_KR.qm and b/res/localization/LameXP_KR.qm differ diff --git a/res/localization/LameXP_PL.qm b/res/localization/LameXP_PL.qm index 93edf60c..4b65c103 100644 Binary files a/res/localization/LameXP_PL.qm and b/res/localization/LameXP_PL.qm differ diff --git a/res/localization/LameXP_RU.qm b/res/localization/LameXP_RU.qm index 3398c3df..df2e84e0 100644 Binary files a/res/localization/LameXP_RU.qm and b/res/localization/LameXP_RU.qm differ diff --git a/res/localization/LameXP_UK.qm b/res/localization/LameXP_UK.qm index d2b199b1..46d6d94c 100644 Binary files a/res/localization/LameXP_UK.qm and b/res/localization/LameXP_UK.qm differ diff --git a/src/Config.h b/src/Config.h index ac9fcc07..1f111f93 100644 --- a/src/Config.h +++ b/src/Config.h @@ -29,8 +29,8 @@ #define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_LO 4 #define VER_LAMEXP_TYPE Alpha -#define VER_LAMEXP_PATCH 7 -#define VER_LAMEXP_BUILD 804 +#define VER_LAMEXP_PATCH 8 +#define VER_LAMEXP_BUILD 806 /////////////////////////////////////////////////////////////////////////////// // Tool versions (minimum expected versions!) diff --git a/src/Dialog_CueImport.cpp b/src/Dialog_CueImport.cpp index 930d2c1d..3f205059 100644 --- a/src/Dialog_CueImport.cpp +++ b/src/Dialog_CueImport.cpp @@ -36,8 +36,11 @@ #include #include #include +#include +#include #define SET_FONT_BOLD(WIDGET,BOLD) { QFont _font = WIDGET->font(); _font.setBold(BOLD); WIDGET->setFont(_font); } +#define EXPAND(STR) QString(STR).leftJustified(96, ' ') //////////////////////////////////////////////////////////// // Constructor & Destructor @@ -111,6 +114,63 @@ int CueImportDialog::exec(void) return CueSheetModel::ErrorIOFailure; } + //----------------------// + + QTextCodec *codec = NULL; + + QFile cueFile(cueFileInfo.canonicalFilePath()); + cueFile.open(QIODevice::ReadOnly); + QByteArray bomCheck = cueFile.isOpen() ? cueFile.peek(128) : QByteArray(); + + if((!bomCheck.isEmpty()) && bomCheck.contains("\xef\xbb\xbf")) + { + codec = QTextCodec::codecForName("UTF-8"); + } + else + { + const QString systemDefault = tr("(System Default)"); + + QStringList codecList; codecList << systemDefault; + QList availableCodecs = QTextCodec::availableCodecs(); + while(!availableCodecs.isEmpty()) + { + QByteArray current = availableCodecs.takeFirst(); + if(!(current.startsWith("system") || current.startsWith("System"))) + { + codecList << QString::fromLatin1(current.constData(), current.size()); + } + } + + QInputDialog *input = new QInputDialog(progress); + input->setLabelText(EXPAND(tr("Select ANSI Codepage for Cue Sheet file:"))); + input->setOkButtonText(tr("OK")); + input->setCancelButtonText(tr("Cancel")); + input->setTextEchoMode(QLineEdit::Normal); + input->setComboBoxItems(codecList); + + if(input->exec() > 0) + { + qDebug("User-selected codec is: %s", input->textValue().toLatin1().constData()); + if(input->textValue().compare(systemDefault, Qt::CaseInsensitive)) + { + qDebug("Going to use a user-selected codec!"); + codec = QTextCodec::codecForName(input->textValue().toLatin1().constData()); + } + } + + if(!codec) + { + qDebug("Going to use the system's default codec!"); + codec = QTextCodec::codecForName("System"); + } + + LAMEXP_DELETE(input); + } + + bomCheck.clear(); + + //----------------------// + m_outputDir = QString("%1/%2").arg(cueFileInfo.canonicalPath(), cueFileInfo.completeBaseName()); for(int n = 2; QDir(m_outputDir).exists(); n++) { @@ -119,7 +179,7 @@ int CueImportDialog::exec(void) setWindowTitle(QString("%1: %2").arg(windowTitle().split(":", QString::SkipEmptyParts).first().trimmed(), cueFileInfo.fileName())); - int iResult = m_model->loadCueSheet(m_cueFileName, QApplication::instance()); + int iResult = m_model->loadCueSheet(m_cueFileName, QApplication::instance(), codec); if(iResult != CueSheetModel::ErrorSuccess) { QString errorMsg = tr("An unknown error has occured!"); @@ -156,6 +216,8 @@ void CueImportDialog::modelChanged(void) { treeView->expandAll(); editOutputDir->setText(QDir::toNativeSeparators(m_outputDir)); + labelArtist->setText(m_model->getAlbumPerformer().isEmpty() ? tr("Unknown Artist") : m_model->getAlbumPerformer()); + labelAlbum->setText(m_model->getAlbumTitle().isEmpty() ? tr("Unknown Album") : m_model->getAlbumTitle()); } void CueImportDialog::browseButtonClicked(void) diff --git a/src/Model_CueSheet.cpp b/src/Model_CueSheet.cpp index 97fe50dd..b8385b92 100644 --- a/src/Model_CueSheet.cpp +++ b/src/Model_CueSheet.cpp @@ -527,9 +527,10 @@ unsigned int CueSheetModel::getAlbumYear(void) // Cue Sheet Parser //////////////////////////////////////////////////////////// -int CueSheetModel::loadCueSheet(const QString &cueFileName, QCoreApplication *application) +int CueSheetModel::loadCueSheet(const QString &cueFileName, QCoreApplication *application, QTextCodec *forceCodec) { QMutexLocker lock(&m_mutex); + const QTextCodec *codec = (forceCodec != NULL) ? forceCodec : QTextCodec::codecForName("System"); QFile cueFile(cueFileName); if(!cueFile.open(QIODevice::ReadOnly)) @@ -540,16 +541,17 @@ int CueSheetModel::loadCueSheet(const QString &cueFileName, QCoreApplication *ap clearData(); beginResetModel(); - int iResult = parseCueFile(cueFile, QDir(QFileInfo(cueFile).canonicalPath()), application); + int iResult = parseCueFile(cueFile, QDir(QFileInfo(cueFile).canonicalPath()), application, codec); endResetModel(); return iResult; } -int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplication *application) +int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplication *application, const QTextCodec *codec) { cueFile.seek(0); qDebug("\n[Cue Sheet Import]"); + bool bForceLatin1 = false; //Reject very large files, as parsing might take until forever if(cueFile.size() >= 10485760i64) @@ -558,28 +560,18 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic return 2; } - //Get system local Codec - const QTextCodec *codec = QTextCodec::codecForName("System"); - - //Check for UTF-8 BOM in order to guess encoding - bool bUTF8 = false, bForceLatin1 = false; - QByteArray bomCheck = cueFile.peek(128); - bUTF8 = (!bomCheck.isEmpty()) && bomCheck.contains("\xef\xbb\xbf"); - qDebug("Encoding is %s.", (bUTF8 ? "UTF-8" : "Local 8-Bit")); - bomCheck.clear(); - //Test selected Codepage for decoding errors - if(!bUTF8) + qDebug("Character encoding is: %s.", codec->name().constData()); + const QString replacementSymbol = QString(QChar(QChar::ReplacementCharacter)); + QByteArray testData = cueFile.peek(1048576); + if((!testData.isEmpty()) && codec->toUnicode(testData.constData(), testData.size()).contains(replacementSymbol)) { - const QString replacementSymbol = QString(QChar(QChar::ReplacementCharacter)); - QByteArray data = cueFile.peek(1048576); - if((!data.isEmpty()) && codec->toUnicode(data.constData(), data.size()).contains(replacementSymbol)) - { - qWarning("Decoding error using local 8-Bit codepage. Enforcing Latin-1."); - bForceLatin1 = true; - } + qWarning("Decoding error using local codepage. Enforcing Latin-1."); + bForceLatin1 = true; } + testData.clear(); + //Create regular expressions QRegExp rxFile("^FILE\\s+(\"[^\"]+\"|\\S+)\\s+(\\w+)$", Qt::CaseInsensitive); QRegExp rxTrack("^TRACK\\s+(\\d+)\\s(\\w+)$", Qt::CaseInsensitive); QRegExp rxIndex("^INDEX\\s+(\\d+)\\s+([0-9:]+)$", Qt::CaseInsensitive); @@ -615,7 +607,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic break; } - QString line = (bUTF8 ? QString::fromUtf8(lineData.constData(), lineData.size()) : (bForceLatin1 ? QString::fromLatin1(lineData.constData(), lineData.size()) : codec->toUnicode(lineData.constData(), lineData.size()))).trimmed(); + QString line = (bForceLatin1 ? QString::fromLatin1(lineData.constData(), lineData.size()) : codec->toUnicode(lineData.constData(), lineData.size())).trimmed(); /* --- FILE --- */ if(rxFile.indexIn(line) >= 0) diff --git a/src/Model_CueSheet.h b/src/Model_CueSheet.h index 8def56cd..dc50d9c0 100644 --- a/src/Model_CueSheet.h +++ b/src/Model_CueSheet.h @@ -28,6 +28,7 @@ class CueSheetFile; class QApplication; class QDir; +class QTextCodec; class CueSheetModel : public QAbstractItemModel { @@ -73,10 +74,10 @@ public: unsigned int getAlbumYear(void); //Cue Sheet functions - int loadCueSheet(const QString &cueFile, QCoreApplication *application = NULL); + int loadCueSheet(const QString &cueFile, QCoreApplication *application = NULL, QTextCodec *forceCodec= NULL); private: - int parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplication *application); + int parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplication *application, const QTextCodec *codec); double parseTimeIndex(const QString &index); QString indexToString(const double index) const;