Added an option to prepend the source file's relative path to the output file's path. This might be useful when converting a lot of files at once that originate from different source folders.
This commit is contained in:
parent
3df600288a
commit
063c53017f
@ -362,11 +362,38 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="saveToSourceFolderCheckBox">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<property name="text">
|
<item>
|
||||||
<string>Save output files to the same location where the input file is located</string>
|
<widget class="QCheckBox" name="saveToSourceFolderCheckBox">
|
||||||
</property>
|
<property name="text">
|
||||||
</widget>
|
<string>Save output files to the same location where the input file is located</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_11">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>15</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="prependRelativePathCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Prepend relative source file path to output file</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
@ -1443,6 +1470,14 @@
|
|||||||
<include location="../res/Images.qrc"/>
|
<include location="../res/Images.qrc"/>
|
||||||
<include location="../res/Icons.qrc"/>
|
<include location="../res/Icons.qrc"/>
|
||||||
<include location="../res/Images.qrc"/>
|
<include location="../res/Images.qrc"/>
|
||||||
|
<include location="../res/Icons.qrc"/>
|
||||||
|
<include location="../res/Images.qrc"/>
|
||||||
|
<include location="../res/Icons.qrc"/>
|
||||||
|
<include location="../res/Images.qrc"/>
|
||||||
|
<include location="../res/Icons.qrc"/>
|
||||||
|
<include location="../res/Images.qrc"/>
|
||||||
|
<include location="../res/Icons.qrc"/>
|
||||||
|
<include location="../res/Images.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
@ -1733,5 +1768,21 @@
|
|||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>saveToSourceFolderCheckBox</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>prependRelativePathCheckBox</receiver>
|
||||||
|
<slot>setDisabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>70</x>
|
||||||
|
<y>79</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>70</x>
|
||||||
|
<y>79</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#define VER_LAMEXP_MAJOR 4
|
#define VER_LAMEXP_MAJOR 4
|
||||||
#define VER_LAMEXP_MINOR_HI 0
|
#define VER_LAMEXP_MINOR_HI 0
|
||||||
#define VER_LAMEXP_MINOR_LO 0
|
#define VER_LAMEXP_MINOR_LO 0
|
||||||
#define VER_LAMEXP_BUILD 149
|
#define VER_LAMEXP_BUILD 151
|
||||||
#define VER_LAMEXP_SUFFIX TechPreview
|
#define VER_LAMEXP_SUFFIX TechPreview
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -156,6 +156,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
|
|||||||
outputFolderView->setMouseTracking(false);
|
outputFolderView->setMouseTracking(false);
|
||||||
outputFolderView->setContextMenuPolicy(Qt::CustomContextMenu);
|
outputFolderView->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
while(saveToSourceFolderCheckBox->isChecked() != m_settings->outputToSourceDir()) saveToSourceFolderCheckBox->click();
|
while(saveToSourceFolderCheckBox->isChecked() != m_settings->outputToSourceDir()) saveToSourceFolderCheckBox->click();
|
||||||
|
prependRelativePathCheckBox->setChecked(m_settings->prependRelativeSourcePath());
|
||||||
connect(outputFolderView, SIGNAL(clicked(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex)));
|
connect(outputFolderView, SIGNAL(clicked(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex)));
|
||||||
connect(outputFolderView, SIGNAL(activated(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex)));
|
connect(outputFolderView, SIGNAL(activated(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex)));
|
||||||
connect(outputFolderView, SIGNAL(entered(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex)));
|
connect(outputFolderView, SIGNAL(entered(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex)));
|
||||||
@ -166,6 +167,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
|
|||||||
connect(buttonGotoDesktop, SIGNAL(clicked()), this, SLOT(gotoDesktopButtonClicked()));
|
connect(buttonGotoDesktop, SIGNAL(clicked()), this, SLOT(gotoDesktopButtonClicked()));
|
||||||
connect(buttonGotoMusic, SIGNAL(clicked()), this, SLOT(gotoMusicFolderButtonClicked()));
|
connect(buttonGotoMusic, SIGNAL(clicked()), this, SLOT(gotoMusicFolderButtonClicked()));
|
||||||
connect(saveToSourceFolderCheckBox, SIGNAL(clicked()), this, SLOT(saveToSourceFolderChanged()));
|
connect(saveToSourceFolderCheckBox, SIGNAL(clicked()), this, SLOT(saveToSourceFolderChanged()));
|
||||||
|
connect(prependRelativePathCheckBox, SIGNAL(clicked()), this, SLOT(prependRelativePathChanged()));
|
||||||
m_outputFolderContextMenu = new QMenu();
|
m_outputFolderContextMenu = new QMenu();
|
||||||
QAction *showFolderContextAction = m_outputFolderContextMenu->addAction(QIcon(":/icons/zoom.png"), "Browse Selected Folder");
|
QAction *showFolderContextAction = m_outputFolderContextMenu->addAction(QIcon(":/icons/zoom.png"), "Browse Selected Folder");
|
||||||
connect(outputFolderView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(outputFolderContextMenu(QPoint)));
|
connect(outputFolderView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(outputFolderContextMenu(QPoint)));
|
||||||
@ -1258,6 +1260,15 @@ void MainWindow::saveToSourceFolderChanged(void)
|
|||||||
m_settings->outputToSourceDir(saveToSourceFolderCheckBox->isChecked());
|
m_settings->outputToSourceDir(saveToSourceFolderCheckBox->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Prepend relative source file path to output file name changed
|
||||||
|
*/
|
||||||
|
void MainWindow::prependRelativePathChanged(void)
|
||||||
|
{
|
||||||
|
m_settings->prependRelativeSourcePath(prependRelativePathCheckBox->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Restore the override cursor
|
* Restore the override cursor
|
||||||
*/
|
*/
|
||||||
|
@ -79,6 +79,7 @@ private slots:
|
|||||||
void metaTagsEnabledChanged(void);
|
void metaTagsEnabledChanged(void);
|
||||||
void playlistEnabledChanged(void);
|
void playlistEnabledChanged(void);
|
||||||
void saveToSourceFolderChanged(void);
|
void saveToSourceFolderChanged(void);
|
||||||
|
void prependRelativePathChanged(void);
|
||||||
void restoreCursor(void);
|
void restoreCursor(void);
|
||||||
void sourceFilesContextMenu(const QPoint &pos);
|
void sourceFilesContextMenu(const QPoint &pos);
|
||||||
void previewContextActionTriggered(void);
|
void previewContextActionTriggered(void);
|
||||||
|
@ -450,7 +450,13 @@ void ProcessingDialog::startNextJob(void)
|
|||||||
throw "Unsupported encoder!";
|
throw "Unsupported encoder!";
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessThread *thread = new ProcessThread(currentFile, (m_settings->outputToSourceDir() ? QFileInfo(currentFile.filePath()).absolutePath(): m_settings->outputDir()), encoder);
|
ProcessThread *thread = new ProcessThread
|
||||||
|
(
|
||||||
|
currentFile,
|
||||||
|
(m_settings->outputToSourceDir() ? QFileInfo(currentFile.filePath()).absolutePath(): m_settings->outputDir()),
|
||||||
|
encoder,
|
||||||
|
m_settings->prependRelativeSourcePath()
|
||||||
|
);
|
||||||
|
|
||||||
m_threadList.append(thread);
|
m_threadList.append(thread);
|
||||||
m_allJobs.append(thread->getId());
|
m_allJobs.append(thread->getId());
|
||||||
@ -498,7 +504,7 @@ void ProcessingDialog::writePlayList(void)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if(!m_succeededJobs.contains(m_allJobs.at(i))) continue;
|
if(!m_succeededJobs.contains(m_allJobs.at(i))) continue;
|
||||||
playList.write(QFileInfo(m_playList.value(m_allJobs.at(i), "N/A")).fileName().toUtf8().constData());
|
playList.write(QDir::toNativeSeparators(QDir(m_settings->outputDir()).relativeFilePath(m_playList.value(m_allJobs.at(i), "N/A"))).toUtf8().constData());
|
||||||
playList.write("\r\n");
|
playList.write("\r\n");
|
||||||
}
|
}
|
||||||
playList.close();
|
playList.close();
|
||||||
|
@ -38,6 +38,7 @@ static const char *g_settingsId_compressionRCMode = "Compression/RCMode";
|
|||||||
static const char *g_settingsId_compressionBitrate = "Compression/Bitrate";
|
static const char *g_settingsId_compressionBitrate = "Compression/Bitrate";
|
||||||
static const char *g_settingsId_outputDir = "OutputDirectory/SelectedPath";
|
static const char *g_settingsId_outputDir = "OutputDirectory/SelectedPath";
|
||||||
static const char *g_settingsId_outputToSourceDir = "OutputDirectory/OutputToSourceFolder";
|
static const char *g_settingsId_outputToSourceDir = "OutputDirectory/OutputToSourceFolder";
|
||||||
|
static const char *g_settingsId_prependRelativeSourcePath = "OutputDirectory/PrependRelativeSourcePath";
|
||||||
static const char *g_settingsId_writeMetaTags = "Flags/WriteMetaTags";
|
static const char *g_settingsId_writeMetaTags = "Flags/WriteMetaTags";
|
||||||
static const char *g_settingsId_createPlaylist = "Flags/AutoCreatePlaylist";
|
static const char *g_settingsId_createPlaylist = "Flags/AutoCreatePlaylist";
|
||||||
static const char *g_settingsId_autoUpdateLastCheck = "AutoUpdate/LastCheck";
|
static const char *g_settingsId_autoUpdateLastCheck = "AutoUpdate/LastCheck";
|
||||||
@ -121,6 +122,7 @@ MAKE_OPTION1(compressionRCMode, 0)
|
|||||||
MAKE_OPTION1(compressionBitrate, 7)
|
MAKE_OPTION1(compressionBitrate, 7)
|
||||||
MAKE_OPTION2(outputDir, QString())
|
MAKE_OPTION2(outputDir, QString())
|
||||||
MAKE_OPTION3(outputToSourceDir, false)
|
MAKE_OPTION3(outputToSourceDir, false)
|
||||||
|
MAKE_OPTION3(prependRelativeSourcePath, false)
|
||||||
MAKE_OPTION3(writeMetaTags, true)
|
MAKE_OPTION3(writeMetaTags, true)
|
||||||
MAKE_OPTION3(createPlaylist, true)
|
MAKE_OPTION3(createPlaylist, true)
|
||||||
MAKE_OPTION2(autoUpdateLastCheck, "Never")
|
MAKE_OPTION2(autoUpdateLastCheck, "Never")
|
||||||
|
@ -69,6 +69,7 @@ public:
|
|||||||
MAKE_OPTION_DEC1(compressionBitrate);
|
MAKE_OPTION_DEC1(compressionBitrate);
|
||||||
MAKE_OPTION_DEC2(outputDir);
|
MAKE_OPTION_DEC2(outputDir);
|
||||||
MAKE_OPTION_DEC3(outputToSourceDir);
|
MAKE_OPTION_DEC3(outputToSourceDir);
|
||||||
|
MAKE_OPTION_DEC3(prependRelativeSourcePath);
|
||||||
MAKE_OPTION_DEC3(writeMetaTags);
|
MAKE_OPTION_DEC3(writeMetaTags);
|
||||||
MAKE_OPTION_DEC3(createPlaylist);
|
MAKE_OPTION_DEC3(createPlaylist);
|
||||||
MAKE_OPTION_DEC2(autoUpdateLastCheck);
|
MAKE_OPTION_DEC2(autoUpdateLastCheck);
|
||||||
|
@ -255,7 +255,7 @@ void InitializationThread::initNeroAac(void)
|
|||||||
|
|
||||||
if(!(neroVersion > 0))
|
if(!(neroVersion > 0))
|
||||||
{
|
{
|
||||||
qWarning("Nero AAC version could not be determined -> AAC encoding support will be disabled!", neroVersion);
|
qWarning("Nero AAC version could not be determined -> AAC encoding support will be disabled!");
|
||||||
for(int i = 0; i < 3; i++) LAMEXP_DELETE(neroBin[i]);
|
for(int i = 0; i < 3; i++) LAMEXP_DELETE(neroBin[i]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -289,15 +289,12 @@ void InitializationThread::initWmaDec(void)
|
|||||||
LockedFile *wmaFileBin = NULL;
|
LockedFile *wmaFileBin = NULL;
|
||||||
QFileInfo wmaFileInfo = QFileInfo(QString("%1/%2").arg(programFilesDir.absolutePath(), wmaDecoderComponentPath));
|
QFileInfo wmaFileInfo = QFileInfo(QString("%1/%2").arg(programFilesDir.absolutePath(), wmaDecoderComponentPath));
|
||||||
|
|
||||||
//Lock the WMA Decoder binaries
|
|
||||||
if(!wmaFileInfo.exists())
|
if(!wmaFileInfo.exists())
|
||||||
{
|
{
|
||||||
qDebug("WMA File Decoder not found -> WMA decoding support will be disabled!\n");
|
qDebug("WMA File Decoder not found -> WMA decoding support will be disabled!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("Found WMA File Decoder binary:\n%s\n", wmaFileInfo.canonicalFilePath().toUtf8().constData());
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
wmaFileBin = new LockedFile(wmaFileInfo.canonicalFilePath());
|
wmaFileBin = new LockedFile(wmaFileInfo.canonicalFilePath());
|
||||||
@ -308,6 +305,53 @@ void InitializationThread::initWmaDec(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QProcess process;
|
||||||
|
process.setProcessChannelMode(QProcess::MergedChannels);
|
||||||
|
process.setReadChannel(QProcess::StandardOutput);
|
||||||
|
process.start(wmaFileInfo.canonicalFilePath(), QStringList());
|
||||||
|
|
||||||
|
if(!process.waitForStarted())
|
||||||
|
{
|
||||||
|
qWarning("WmaWav process failed to create!");
|
||||||
|
qWarning("Error message: \"%s\"\n", process.errorString().toLatin1().constData());
|
||||||
|
process.kill();
|
||||||
|
process.waitForFinished(-1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool b_wmaWavFound = false;
|
||||||
|
|
||||||
|
while(process.state() != QProcess::NotRunning)
|
||||||
|
{
|
||||||
|
if(!process.waitForReadyRead())
|
||||||
|
{
|
||||||
|
if(process.state() == QProcess::Running)
|
||||||
|
{
|
||||||
|
qWarning("WmaWav process time out -> killing!");
|
||||||
|
process.kill();
|
||||||
|
process.waitForFinished(-1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while(process.canReadLine())
|
||||||
|
{
|
||||||
|
QString line = QString::fromUtf8(process.readLine().constData()).simplified();
|
||||||
|
if(line.contains("Usage: wmatowav.exe WMAFileSpec WAVFileSpec", Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
|
b_wmaWavFound = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!b_wmaWavFound)
|
||||||
|
{
|
||||||
|
qWarning("WmaWav could not be identified -> WMA decoding support will be disabled!\n");
|
||||||
|
LAMEXP_DELETE(wmaFileBin);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug("Found WMA File Decoder binary:\n%s\n", wmaFileInfo.canonicalFilePath().toUtf8().constData());
|
||||||
|
|
||||||
if(wmaFileBin)
|
if(wmaFileBin)
|
||||||
{
|
{
|
||||||
lamexp_register_tool(wmaFileInfo.fileName(), wmaFileBin);
|
lamexp_register_tool(wmaFileInfo.fileName(), wmaFileBin);
|
||||||
|
@ -44,12 +44,13 @@ QMutex *ProcessThread::m_mutex_genFileName = NULL;
|
|||||||
// Constructor
|
// Constructor
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ProcessThread::ProcessThread(const AudioFileModel &audioFile, const QString &outputDirectory, AbstractEncoder *encoder)
|
ProcessThread::ProcessThread(const AudioFileModel &audioFile, const QString &outputDirectory, AbstractEncoder *encoder, const bool prependRelativeSourcePath)
|
||||||
:
|
:
|
||||||
m_audioFile(audioFile),
|
m_audioFile(audioFile),
|
||||||
m_outputDirectory(outputDirectory),
|
m_outputDirectory(outputDirectory),
|
||||||
m_encoder(encoder),
|
m_encoder(encoder),
|
||||||
m_jobId(QUuid::createUuid()),
|
m_jobId(QUuid::createUuid()),
|
||||||
|
m_prependRelativeSourcePath(prependRelativeSourcePath),
|
||||||
m_aborted(false)
|
m_aborted(false)
|
||||||
{
|
{
|
||||||
if(m_mutex_genFileName)
|
if(m_mutex_genFileName)
|
||||||
@ -212,6 +213,16 @@ QString ProcessThread::generateOutFileName(void)
|
|||||||
QString baseName = sourceFile.completeBaseName();
|
QString baseName = sourceFile.completeBaseName();
|
||||||
QDir targetDir(m_outputDirectory.isEmpty() ? sourceFile.canonicalPath() : m_outputDirectory);
|
QDir targetDir(m_outputDirectory.isEmpty() ? sourceFile.canonicalPath() : m_outputDirectory);
|
||||||
|
|
||||||
|
if(m_prependRelativeSourcePath && !m_outputDirectory.isEmpty())
|
||||||
|
{
|
||||||
|
QDir rootDir = sourceFile.dir();
|
||||||
|
while(!rootDir.isRoot())
|
||||||
|
{
|
||||||
|
if(!rootDir.cdUp()) break;
|
||||||
|
}
|
||||||
|
targetDir.setPath(QString("%1/%2").arg(targetDir.absolutePath(), QFileInfo(rootDir.relativeFilePath(sourceFile.canonicalFilePath())).path()));
|
||||||
|
}
|
||||||
|
|
||||||
if(!targetDir.exists())
|
if(!targetDir.exists())
|
||||||
{
|
{
|
||||||
targetDir.mkpath(".");
|
targetDir.mkpath(".");
|
||||||
|
@ -35,7 +35,7 @@ class ProcessThread: public QThread
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ProcessThread(const AudioFileModel &audioFile, const QString &outputDirectory, AbstractEncoder *encoder);
|
ProcessThread(const AudioFileModel &audioFile, const QString &outputDirectory, AbstractEncoder *encoder, const bool prependRelativeSourcePath);
|
||||||
~ProcessThread(void);
|
~ProcessThread(void);
|
||||||
|
|
||||||
void run();
|
void run();
|
||||||
@ -73,6 +73,7 @@ private:
|
|||||||
volatile bool m_aborted;
|
volatile bool m_aborted;
|
||||||
ProcessStep m_currentStep;
|
ProcessStep m_currentStep;
|
||||||
QStringList m_tempFiles;
|
QStringList m_tempFiles;
|
||||||
|
const bool m_prependRelativeSourcePath;
|
||||||
|
|
||||||
static QMutex *m_mutex_genFileName;
|
static QMutex *m_mutex_genFileName;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user