From b1137e4cb1aa2dd6bb1068cd26f761e6ebee3032 Mon Sep 17 00:00:00 2001 From: lordmulder Date: Mon, 15 Nov 2010 22:07:46 +0100 Subject: [PATCH] Fix detection of Nero AAA encoder + use canonicalPath() where suitable --- src/Dialog_MainWindow.cpp | 9 +++++---- src/Global.cpp | 6 +++--- src/LockedFile.cpp | 6 +++--- src/Model_FileList.cpp | 4 ++-- src/Thread_Initialization.cpp | 6 +++--- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp index 8100f6d6..e012082b 100644 --- a/src/Dialog_MainWindow.cpp +++ b/src/Dialog_MainWindow.cpp @@ -348,7 +348,7 @@ void MainWindow::dropEvent(QDropEvent *event) QList list = QDir(file.canonicalFilePath()).entryInfoList(QDir::Files); for(int j = 0; j < list.count(); j++) { - droppedFiles << list.at(j).absoluteFilePath(); + droppedFiles << list.at(j).canonicalFilePath(); } } } @@ -390,7 +390,7 @@ void MainWindow::windowShown(void) } //Check for AAC support - if(radioButtonEncoderAAC->isEnabled()) + if(lamexp_check_tool("neroAacEnc.exe") && lamexp_check_tool("neroAacDec.exe") && lamexp_check_tool("neroAacTag.exe")) { if(lamexp_tool_version("neroAacEnc.exe") < lamexp_toolver_neroaac()) { @@ -404,6 +404,7 @@ void MainWindow::windowShown(void) } else { + radioButtonEncoderAAC->setEnabled(false); QString messageText; messageText += "The Nero AAC encoder could not be found. AAC encoding support will be disabled.
"; messageText += "Please put 'neroAacEnc.exe', 'neroAacDec.exe' and 'neroAacTag.exe' into the LameXP directory!

"; @@ -808,7 +809,7 @@ void MainWindow::makeFolderButtonClicked(void) QDir createdDir = basePath; if(createdDir.cd(newFolder)) { - outputFolderView->setCurrentIndex(m_fileSystemModel->index(createdDir.absolutePath())); + outputFolderView->setCurrentIndex(m_fileSystemModel->index(createdDir.canonicalPath())); outputFolderViewClicked(outputFolderView->currentIndex()); outputFolderView->setFocus(); } @@ -925,7 +926,7 @@ void MainWindow::handleDelayedFiles(void) QList list = QDir(currentFile.canonicalFilePath()).entryInfoList(QDir::Files); for(int j = 0; j < list.count(); j++) { - selectedFiles << list.at(j).absoluteFilePath(); + selectedFiles << list.at(j).canonicalFilePath(); } } } diff --git a/src/Global.cpp b/src/Global.cpp index 754199e4..6c906110 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -492,7 +492,7 @@ const QString &lamexp_temp_folder(void) if(tempFolder.cd(uuid)) { - g_lamexp_temp_folder = tempFolder.absolutePath(); + g_lamexp_temp_folder = tempFolder.canonicalPath(); } else { @@ -520,11 +520,11 @@ bool lamexp_clean_folder(const QString folderPath) if(entryList.at(i).isDir()) { - lamexp_clean_folder(entryList.at(i).absoluteFilePath()); + lamexp_clean_folder(entryList.at(i).canonicalFilePath()); } else { - QFile::remove(entryList.at(i).absoluteFilePath()); + QFile::remove(entryList.at(i).canonicalFilePath()); } } diff --git a/src/LockedFile.cpp b/src/LockedFile.cpp index 1206d0b9..0f7a1523 100644 --- a/src/LockedFile.cpp +++ b/src/LockedFile.cpp @@ -43,7 +43,7 @@ LockedFile::LockedFile(const QString &resourcePath, const QString &outPath, cons { if(outFile.write(reinterpret_cast(resource.data()), resource.size()) != resource.size()) { - QFile::remove(QFileInfo(outFile).absoluteFilePath()); + QFile::remove(QFileInfo(outFile).canonicalFilePath()); char error_msg[512]; strcpy_s(error_msg, 512, QString("File '%1' could not be written!").arg(QFileInfo(outFile).fileName()).toUtf8().constData()); throw error_msg; @@ -62,7 +62,7 @@ LockedFile::LockedFile(const QString &resourcePath, const QString &outPath, cons if(m_fileHandle == INVALID_HANDLE_VALUE) { - QFile::remove(QFileInfo(outFile).absoluteFilePath()); + QFile::remove(QFileInfo(outFile).canonicalFilePath()); char error_msg[512]; strcpy_s(error_msg, 512, QString("File '%1' could not be locked!").arg(QFileInfo(outFile).fileName()).toLatin1().constData()); throw error_msg; @@ -81,7 +81,7 @@ LockedFile::LockedFile(const QString &resourcePath, const QString &outPath, cons { qWarning("\nFile checksum error:\n Expected = %040s\n Detected = %040s\n", expectedHash.constData(), fileHash.result().toHex().constData()); LAMEXP_CLOSE(m_fileHandle); - QFile::remove(QFileInfo(outFile).absoluteFilePath()); + QFile::remove(QFileInfo(outFile).canonicalFilePath()); char error_msg[512]; strcpy_s(error_msg, 512, QString("File '%1' is corruputed, take care!").arg(QFileInfo(outFile).fileName()).toLatin1().constData()); throw error_msg; diff --git a/src/Model_FileList.cpp b/src/Model_FileList.cpp index 37d078ed..bb58a86e 100644 --- a/src/Model_FileList.cpp +++ b/src/Model_FileList.cpp @@ -129,14 +129,14 @@ void FileListModel::addFile(const QString &filePath) for(int i = 0; i < m_fileList.count(); i++) { - if(m_fileList.at(i).filePath().compare(fileInfo.absoluteFilePath(), Qt::CaseInsensitive) == 0) + if(m_fileList.at(i).filePath().compare(fileInfo.canonicalFilePath(), Qt::CaseInsensitive) == 0) { return; } } beginResetModel(); - m_fileList.append(AudioFileModel(fileInfo.absoluteFilePath(), fileInfo.baseName())); + m_fileList.append(AudioFileModel(fileInfo.canonicalFilePath(), fileInfo.baseName())); endResetModel(); } diff --git a/src/Thread_Initialization.cpp b/src/Thread_Initialization.cpp index 2ba78a3f..3835c924 100644 --- a/src/Thread_Initialization.cpp +++ b/src/Thread_Initialization.cpp @@ -150,7 +150,7 @@ void InitializationThread::initNeroAac(void) return; } - qDebug("Found Nero AAC encoder binary:\n%s\n", neroFileInfo[0].absoluteFilePath().toUtf8().constData()); + qDebug("Found Nero AAC encoder binary:\n%s\n", neroFileInfo[0].canonicalFilePath().toUtf8().constData()); LockedFile *neroBin[3]; for(int i = 0; i < 3; i++) neroBin[i] = NULL; @@ -159,7 +159,7 @@ void InitializationThread::initNeroAac(void) { for(int i = 0; i < 3; i++) { - neroBin[i] = new LockedFile(neroFileInfo[i].absoluteFilePath()); + neroBin[i] = new LockedFile(neroFileInfo[i].canonicalFilePath()); } } catch(...) @@ -172,7 +172,7 @@ void InitializationThread::initNeroAac(void) QProcess process; process.setProcessChannelMode(QProcess::MergedChannels); process.setReadChannel(QProcess::StandardOutput); - process.start(neroFileInfo[0].absoluteFilePath()); + process.start(neroFileInfo[0].canonicalFilePath()); if(!process.waitForStarted()) {