</spacer>
</item>
<item>
- <widget class="QCheckBox" name="saveToSourceFolderCheckBox">
- <property name="text">
- <string>Save output files to the same location where the input file is located</string>
- </property>
- </widget>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QCheckBox" name="saveToSourceFolderCheckBox">
+ <property name="text">
+ <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>
</layout>
</item>
<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"/>
+ <include location="../res/Icons.qrc"/>
+ <include location="../res/Images.qrc"/>
</resources>
<connections>
<connection>
</hint>
</hints>
</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>
</ui>
#define VER_LAMEXP_MAJOR 4
#define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 0
-#define VER_LAMEXP_BUILD 149
+#define VER_LAMEXP_BUILD 151
#define VER_LAMEXP_SUFFIX TechPreview
/*
outputFolderView->setMouseTracking(false);
outputFolderView->setContextMenuPolicy(Qt::CustomContextMenu);
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(activated(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex)));
connect(outputFolderView, SIGNAL(entered(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex)));
connect(buttonGotoDesktop, SIGNAL(clicked()), this, SLOT(gotoDesktopButtonClicked()));
connect(buttonGotoMusic, SIGNAL(clicked()), this, SLOT(gotoMusicFolderButtonClicked()));
connect(saveToSourceFolderCheckBox, SIGNAL(clicked()), this, SLOT(saveToSourceFolderChanged()));
+ connect(prependRelativePathCheckBox, SIGNAL(clicked()), this, SLOT(prependRelativePathChanged()));
m_outputFolderContextMenu = new QMenu();
QAction *showFolderContextAction = m_outputFolderContextMenu->addAction(QIcon(":/icons/zoom.png"), "Browse Selected Folder");
connect(outputFolderView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(outputFolderContextMenu(QPoint)));
}
/*
+ * Prepend relative source file path to output file name changed
+ */
+void MainWindow::prependRelativePathChanged(void)
+{
+ m_settings->prependRelativeSourcePath(prependRelativePathCheckBox->isChecked());
+}
+
+
+/*
* Restore the override cursor
*/
void MainWindow::restoreCursor(void)
void metaTagsEnabledChanged(void);
void playlistEnabledChanged(void);
void saveToSourceFolderChanged(void);
+ void prependRelativePathChanged(void);
void restoreCursor(void);
void sourceFilesContextMenu(const QPoint &pos);
void previewContextActionTriggered(void);
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_allJobs.append(thread->getId());
{
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.close();
static const char *g_settingsId_compressionBitrate = "Compression/Bitrate";
static const char *g_settingsId_outputDir = "OutputDirectory/SelectedPath";
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_createPlaylist = "Flags/AutoCreatePlaylist";
static const char *g_settingsId_autoUpdateLastCheck = "AutoUpdate/LastCheck";
MAKE_OPTION1(compressionBitrate, 7)
MAKE_OPTION2(outputDir, QString())
MAKE_OPTION3(outputToSourceDir, false)
+MAKE_OPTION3(prependRelativeSourcePath, false)
MAKE_OPTION3(writeMetaTags, true)
MAKE_OPTION3(createPlaylist, true)
MAKE_OPTION2(autoUpdateLastCheck, "Never")
MAKE_OPTION_DEC1(compressionBitrate);
MAKE_OPTION_DEC2(outputDir);
MAKE_OPTION_DEC3(outputToSourceDir);
+ MAKE_OPTION_DEC3(prependRelativeSourcePath);
MAKE_OPTION_DEC3(writeMetaTags);
MAKE_OPTION_DEC3(createPlaylist);
MAKE_OPTION_DEC2(autoUpdateLastCheck);
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]);
return;
}
LockedFile *wmaFileBin = NULL;
QFileInfo wmaFileInfo = QFileInfo(QString("%1/%2").arg(programFilesDir.absolutePath(), wmaDecoderComponentPath));
- //Lock the WMA Decoder binaries
if(!wmaFileInfo.exists())
{
qDebug("WMA File Decoder not found -> WMA decoding support will be disabled!\n");
return;
}
- qDebug("Found WMA File Decoder binary:\n%s\n", wmaFileInfo.canonicalFilePath().toUtf8().constData());
-
try
{
wmaFileBin = new LockedFile(wmaFileInfo.canonicalFilePath());
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)
{
lamexp_register_tool(wmaFileInfo.fileName(), wmaFileBin);
// 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_outputDirectory(outputDirectory),
m_encoder(encoder),
m_jobId(QUuid::createUuid()),
+ m_prependRelativeSourcePath(prependRelativeSourcePath),
m_aborted(false)
{
if(m_mutex_genFileName)
QString baseName = sourceFile.completeBaseName();
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())
{
Q_OBJECT
public:
- ProcessThread(const AudioFileModel &audioFile, const QString &outputDirectory, AbstractEncoder *encoder);
+ ProcessThread(const AudioFileModel &audioFile, const QString &outputDirectory, AbstractEncoder *encoder, const bool prependRelativeSourcePath);
~ProcessThread(void);
void run();
volatile bool m_aborted;
ProcessStep m_currentStep;
QStringList m_tempFiles;
+ const bool m_prependRelativeSourcePath;
static QMutex *m_mutex_genFileName;
};