Show a warning when the user tries to add a Cue Sheet like a normal file.

This commit is contained in:
LoRd_MuldeR 2011-05-17 01:14:50 +02:00
parent 5cccd4de81
commit db661fc50c
17 changed files with 185 additions and 45 deletions

View File

@ -1094,7 +1094,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>CDA Files</source>
<source>CDDA Files</source>
<translation type="unfinished"></translation>
</message>
<message>
@ -1109,6 +1109,18 @@
<source>We recommend using %1 for that purpose.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1 file(s) have been rejected, because they appear to be Cue Sheet images!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please use LameXP&apos;s Cue Sheet wizard for importing Cue Sheet files.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Files Rejected</source>
<translation type="unfinished"></translation>

View File

@ -1390,10 +1390,6 @@
<source>Cannot write to the selected directory. Please choose another directory!</source>
<translation>In das ausgewählte Verzeichnis kann nicht geschrieben werden. Bitte ein anderes Verzeichnis auswählen!</translation>
</message>
<message>
<source>CDA Files</source>
<translation>CDA Dateien</translation>
</message>
<message>
<source>%1 file(s) have been rejected, because they are dummy CDDA files!</source>
<translation>%1 Datei(en) wurden abgewiesen, weil es sich um CDDA Platzhalter&amp;minus;Dateien handelt!</translation>
@ -1570,6 +1566,22 @@
<source>Cue Sheet File</source>
<translation>Cuesheet Datei</translation>
</message>
<message>
<source>CDDA Files</source>
<translation>CDDA Dateien</translation>
</message>
<message>
<source>Cue Sheet</source>
<translation>Cuesheet</translation>
</message>
<message>
<source>%1 file(s) have been rejected, because they appear to be Cue Sheet images!</source>
<translation>%1 Datei(en) wurden abgewiesen, weil es sich um Cuesheet Image&amp;minus;Dateien handelt!</translation>
</message>
<message>
<source>Please use LameXP&apos;s Cue Sheet wizard for importing Cue Sheet files.</source>
<translation>Bitte benutzen Sie zum Importieren von Cuesheets den LameXP Cuesheet Assistenten.</translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1389,10 +1389,6 @@
<source>Cannot write to the selected directory. Please choose another directory!</source>
<translation>¡No se puede escribir en la carpeta seleccionada. Por favor, seleccione otra!</translation>
</message>
<message>
<source>CDA Files</source>
<translation>Archivos CDA</translation>
</message>
<message>
<source>%1 file(s) have been rejected, because they are dummy CDDA files!</source>
<translation>¡%1 archivo(s) rechazado(s), ya que son archivos CDDA vacíos!</translation>
@ -1569,6 +1565,22 @@
<source>Cue Sheet File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CDDA Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1 file(s) have been rejected, because they appear to be Cue Sheet images!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please use LameXP&apos;s Cue Sheet wizard for importing Cue Sheet files.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1398,10 +1398,6 @@ Sélection automatique (par défaut)</translation>
<source>Cannot write to the selected directory. Please choose another directory!</source>
<translation>Impossible d&apos;écrire dans le répertoire sélectionné. Veuillez choisir un autre répertoire !</translation>
</message>
<message>
<source>CDA Files</source>
<translation>Fichiers CDA</translation>
</message>
<message>
<source>%1 file(s) have been rejected, because they are dummy CDDA files!</source>
<translation>%1 fichiers ont é rejetés parce qu&apos;ils sont des fichiers CDDA fictifs !</translation>
@ -1579,6 +1575,22 @@ Ouvrir le dossier récursivement...</translation>
<source>Cue Sheet File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CDDA Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1 file(s) have been rejected, because they appear to be Cue Sheet images!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please use LameXP&apos;s Cue Sheet wizard for importing Cue Sheet files.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1390,10 +1390,6 @@
<source>Cannot write to the selected directory. Please choose another directory!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CDA Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1 file(s) have been rejected, because they are dummy CDDA files!</source>
<translation type="unfinished"></translation>
@ -1570,6 +1566,22 @@
<source>Cue Sheet File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CDDA Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1 file(s) have been rejected, because they appear to be Cue Sheet images!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please use LameXP&apos;s Cue Sheet wizard for importing Cue Sheet files.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -993,10 +993,6 @@
<source>This usually means the file is locked by another process.</source>
<translation type="unfinished"> .</translation>
</message>
<message>
<source>CDA Files</source>
<translation type="unfinished">CDA </translation>
</message>
<message>
<source>%1 file(s) have been rejected, because they are dummy CDDA files!</source>
<translation type="unfinished">%1 . CDDA !</translation>
@ -1569,6 +1565,22 @@
<source>Cue Sheet File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CDDA Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1 file(s) have been rejected, because they appear to be Cue Sheet images!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please use LameXP&apos;s Cue Sheet wizard for importing Cue Sheet files.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1403,10 +1403,6 @@
<source>Cannot write to the selected directory. Please choose another directory!</source>
<translation type="unfinished">Директория недоступна для записи. Пожалуйса, выберите другую директорию!</translation>
</message>
<message>
<source>CDA Files</source>
<translation type="unfinished">Файлы CDA</translation>
</message>
<message>
<source>%1 file(s) have been rejected, because they are dummy CDDA files!</source>
<translation type="unfinished">%1 файла(ов) было отменено, изза пустых CDDA файлов!</translation>
@ -1571,6 +1567,22 @@
<source>Cue Sheet File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CDDA Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1 file(s) have been rejected, because they appear to be Cue Sheet images!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please use LameXP&apos;s Cue Sheet wizard for importing Cue Sheet files.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1389,10 +1389,6 @@
<source>Open Folder Recursively...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CDA Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1 file(s) have been rejected, because they are dummy CDDA files!</source>
<translation type="unfinished"></translation>
@ -1569,6 +1565,22 @@
<source>Cue Sheet File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CDDA Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cue Sheet</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1 file(s) have been rejected, because they appear to be Cue Sheet images!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please use LameXP&apos;s Cue Sheet wizard for importing Cue Sheet files.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 2
#define VER_LAMEXP_TYPE Beta
#define VER_LAMEXP_PATCH 1
#define VER_LAMEXP_BUILD 529
#define VER_LAMEXP_BUILD 530
///////////////////////////////////////////////////////////////////////////////
// Tools versions

View File

@ -467,7 +467,11 @@ void MainWindow::addFiles(const QStringList &files)
}
if(analyzer->filesDummyCDDA())
{
QMessageBox::warning(this, tr("CDA Files"), QString("<nobr>%1<br><br>%2<br>%3</nobr>").arg(tr("%1 file(s) have been rejected, because they are dummy CDDA files!").arg(analyzer->filesDummyCDDA()), tr("Sorry, LameXP cannot extract audio tracks from an Audio&minus;CD at present."), tr("We recommend using %1 for that purpose.").arg("<a href=\"http://www.exactaudiocopy.de/\">Exact Audio Copy</a>")));
QMessageBox::warning(this, tr("CDDA Files"), QString("<nobr>%1<br><br>%2<br>%3</nobr>").arg(tr("%1 file(s) have been rejected, because they are dummy CDDA files!").arg(analyzer->filesDummyCDDA()), tr("Sorry, LameXP cannot extract audio tracks from an Audio&minus;CD at present."), tr("We recommend using %1 for that purpose.").arg("<a href=\"http://www.exactaudiocopy.de/\">Exact Audio Copy</a>")));
}
if(analyzer->filesCueSheet())
{
QMessageBox::warning(this, tr("Cue Sheet"), QString("<nobr>%1<br>%2</nobr>").arg(tr("%1 file(s) have been rejected, because they appear to be Cue Sheet images!").arg(analyzer->filesCueSheet()), tr("Please use LameXP's Cue Sheet wizard for importing Cue Sheet files.")));
}
if(analyzer->filesRejected())
{

View File

@ -57,6 +57,7 @@ FileAnalyzer::FileAnalyzer(const QStringList &inputFiles)
m_filesRejected = 0;
m_filesDenied = 0;
m_filesDummyCDDA = 0;
m_filesCueSheet = 0;
}
////////////////////////////////////////////////////////////
@ -72,16 +73,19 @@ void FileAnalyzer::run()
m_filesRejected = 0;
m_filesDenied = 0;
m_filesDummyCDDA = 0;
m_filesCueSheet = 0;
m_inputFiles.sort();
m_abortFlag = false;
while(!m_inputFiles.isEmpty())
{
int fileType = fileTypeNormal;
QString currentFile = QDir::fromNativeSeparators(m_inputFiles.takeFirst());
qDebug64("Analyzing: %1", currentFile);
emit fileSelected(QFileInfo(currentFile).fileName());
AudioFileModel file = analyzeFile(currentFile);
AudioFileModel file = analyzeFile(currentFile, &fileType);
if(m_abortFlag)
{
@ -91,16 +95,38 @@ void FileAnalyzer::run()
return;
}
if(file.fileName().isEmpty() || file.formatContainerType().isEmpty() || file.formatAudioType().isEmpty())
if(fileType == fileTypeDenied)
{
if(!PlaylistImporter::importPlaylist(m_inputFiles, currentFile))
{
m_filesRejected++;
qDebug64("Skipped: %1", file.filePath());
}
m_filesDenied++;
qWarning("Cannot access file for reading, skipping!");
continue;
}
if(fileType == fileTypeCDDA)
{
m_filesDummyCDDA++;
qWarning("Dummy CDDA file detected, skipping!");
continue;
}
if(file.fileName().isEmpty() || file.formatContainerType().isEmpty() || file.formatAudioType().isEmpty())
{
if(PlaylistImporter::importPlaylist(m_inputFiles, currentFile))
{
qDebug("Imported playlist file.");
}
else if(!QFileInfo(currentFile).suffix().compare("cue", Qt::CaseInsensitive))
{
qWarning("Cue Sheet file detected, skipping!");
m_filesCueSheet++;
}
else
{
qDebug64("Rejected file of unknown type: %1", file.filePath());
m_filesRejected++;
}
continue;
}
m_filesAccepted++;
emit fileAnalyzed(file);
}
@ -113,8 +139,10 @@ void FileAnalyzer::run()
// Privtae Functions
////////////////////////////////////////////////////////////
const AudioFileModel FileAnalyzer::analyzeFile(const QString &filePath)
const AudioFileModel FileAnalyzer::analyzeFile(const QString &filePath, int *type)
{
*type = fileTypeNormal;
AudioFileModel audioFile(filePath);
m_currentSection = sectionOther;
m_currentCover = coverNone;
@ -122,15 +150,13 @@ const AudioFileModel FileAnalyzer::analyzeFile(const QString &filePath)
QFile readTest(filePath);
if(!readTest.open(QIODevice::ReadOnly))
{
qWarning("Cannot access file for reading, skipping!");
m_filesDenied++;
*type = fileTypeDenied;
return audioFile;
}
if(checkFile_CDDA(readTest))
{
qWarning("Dummy CDDA file detected, skipping!");
m_filesDummyCDDA ++;
*type = fileTypeCDDA;
return audioFile;
}
@ -520,7 +546,7 @@ unsigned int FileAnalyzer::filesAccepted(void)
unsigned int FileAnalyzer::filesRejected(void)
{
return max(m_filesRejected - (m_filesDenied + m_filesDummyCDDA), 0);
return m_filesRejected;
}
unsigned int FileAnalyzer::filesDenied(void)
@ -533,6 +559,11 @@ unsigned int FileAnalyzer::filesDummyCDDA(void)
return m_filesDummyCDDA;
}
unsigned int FileAnalyzer::filesCueSheet(void)
{
return m_filesCueSheet;
}
////////////////////////////////////////////////////////////
// EVENTS
////////////////////////////////////////////////////////////

View File

@ -47,6 +47,7 @@ public:
unsigned int filesRejected(void);
unsigned int filesDenied(void);
unsigned int filesDummyCDDA(void);
unsigned int filesCueSheet(void);
signals:
void fileSelected(const QString &fileName);
@ -69,8 +70,14 @@ private:
coverPng,
coverGif
};
enum fileType_t
{
fileTypeNormal = 0,
fileTypeCDDA = 1,
fileTypeDenied = 2
};
const AudioFileModel analyzeFile(const QString &filePath);
const AudioFileModel analyzeFile(const QString &filePath, int *type);
void updateInfo(AudioFileModel &audioFile, const QString &key, const QString &value);
void updateSection(const QString &section);
unsigned int parseYear(const QString &str);
@ -86,6 +93,8 @@ private:
unsigned int m_filesRejected;
unsigned int m_filesDenied;
unsigned int m_filesDummyCDDA;
unsigned int m_filesCueSheet;
volatile bool m_abortFlag;