diff --git a/doc/Changelog.html b/doc/Changelog.html
index 9df5c04b..6dd46ea9 100644
--- a/doc/Changelog.html
+++ b/doc/Changelog.html
@@ -5,6 +5,7 @@
Changes between v4.00 and v4.01:
- Added an option to manually specify the number of parallel instances
+
- Added an option to select a user-defined TEMP directory
- Updated LAME encoder to v3.99.0.12 (2011-02-13), compiled with ICL 12.0.2
- Updated Vorbis encoder to v2.87 using aoTuV Beta-6.01 (2011-02-22), compiled with ICL 11.1 and MSVC 9.0
- Updated language files (big "thank you" to all contributors !!!)
diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts
index 8299ea30..33a102c7 100644
--- a/etc/Translation/Blank.ts
+++ b/etc/Translation/Blank.ts
@@ -621,6 +621,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -949,6 +961,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1077,6 +1101,10 @@
+
+
+
+
diff --git a/etc/Translation/LameXP_DE.ts b/etc/Translation/LameXP_DE.ts
index 767b2a9c..517268e3 100644
--- a/etc/Translation/LameXP_DE.ts
+++ b/etc/Translation/LameXP_DE.ts
@@ -1166,6 +1166,34 @@
%1 Instanz(en)
+
+
+ Temp Verzeichnis
+
+
+
+ Durchsuchen...
+
+
+
+ Temporäre Dateien im standard TEMP Verzeichnis des Systems speichern (Empfohlen)
+
+
+
+ Nicht Gefunden
+
+
+
+ Das derzeit ausgewählte TEMP Verzeichnis existiert nicht mehr:
+
+
+
+ Standard Wiederherstellen
+
+
+
+ In das ausgewählte Verzeichnis kann nicht geschrieben werden. Bitte ein anderes Verzeichnis auswählen!
+
MetaInfo
diff --git a/etc/Translation/LameXP_ES.ts b/etc/Translation/LameXP_ES.ts
index 78ffb6e5..997830e4 100644
--- a/etc/Translation/LameXP_ES.ts
+++ b/etc/Translation/LameXP_ES.ts
@@ -1165,6 +1165,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
MetaInfo
diff --git a/etc/Translation/LameXP_FR.ts b/etc/Translation/LameXP_FR.ts
index 6d3a6cd0..024ca40a 100644
--- a/etc/Translation/LameXP_FR.ts
+++ b/etc/Translation/LameXP_FR.ts
@@ -1174,6 +1174,34 @@ Sélection automatique (par défaut)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
MetaInfo
diff --git a/etc/Translation/LameXP_IT.ts b/etc/Translation/LameXP_IT.ts
index bceed85b..54fe75e0 100644
--- a/etc/Translation/LameXP_IT.ts
+++ b/etc/Translation/LameXP_IT.ts
@@ -1166,6 +1166,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
MetaInfo
diff --git a/etc/Translation/LameXP_RU.ts b/etc/Translation/LameXP_RU.ts
index c65d5b68..8d17b648 100644
--- a/etc/Translation/LameXP_RU.ts
+++ b/etc/Translation/LameXP_RU.ts
@@ -1168,6 +1168,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
MetaInfo
diff --git a/etc/Translation/LameXP_UK.ts b/etc/Translation/LameXP_UK.ts
index c9b4341a..2f35735a 100644
--- a/etc/Translation/LameXP_UK.ts
+++ b/etc/Translation/LameXP_UK.ts
@@ -1165,6 +1165,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
MetaInfo
diff --git a/gui/MainWindow.ui b/gui/MainWindow.ui
index 8e6a8cbb..cfb09249 100644
--- a/gui/MainWindow.ui
+++ b/gui/MainWindow.ui
@@ -1058,7 +1058,7 @@
0
0
604
- 965
+ 1091
@@ -2375,6 +2375,136 @@
+
-
+
+
+
+ 50
+ false
+
+
+
+ Temp Directory
+
+
+
-
+
+
-
+
+
+ true
+
+
+
+ -
+
+
+ Browse...
+
+
+
+ :/icons/folder_explore.png:/icons/folder_explore.png
+
+
+
+ 16
+ 16
+
+
+
+
+ -
+
+
+ Store temporary files in your system's default TEMP directory (Recommended)
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Fixed
+
+
+
+ 20
+ 8
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Fixed
+
+
+
+ 20
+ 8
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 10
+ 20
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 10
+ 20
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Fixed
+
+
+
+ 20
+ 4
+
+
+
+
+
+
+
+
+
-
@@ -2960,6 +3090,10 @@
+
+
+
+
@@ -3426,5 +3560,37 @@
+
+ checkBoxUseSystemTempFolder
+ clicked(bool)
+ lineEditCustomTempFolder
+ setDisabled(bool)
+
+
+ 323
+ 302
+
+
+ 283
+ 265
+
+
+
+
+ checkBoxUseSystemTempFolder
+ clicked(bool)
+ buttonBrowseCustomTempFolder
+ setDisabled(bool)
+
+
+ 323
+ 302
+
+
+ 551
+ 265
+
+
+
diff --git a/res/Icons.qrc b/res/Icons.qrc
index d41a4f75..ffa71e41 100644
--- a/res/Icons.qrc
+++ b/res/Icons.qrc
@@ -44,6 +44,7 @@
icons/folder_add.png
icons/folder_go.png
icons/folder_image.png
+ icons/folder_explore.png
icons/folder_page.png
icons/font.png
icons/house.png
diff --git a/res/localization/LameXP_DE.qm b/res/localization/LameXP_DE.qm
index 167a10c2..642f2d98 100644
Binary files a/res/localization/LameXP_DE.qm and b/res/localization/LameXP_DE.qm differ
diff --git a/src/Config.h b/src/Config.h
index b1b948d3..0c9f2af3 100644
--- a/src/Config.h
+++ b/src/Config.h
@@ -25,7 +25,7 @@
#define VER_LAMEXP_MAJOR 4
#define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 1
-#define VER_LAMEXP_BUILD 336
+#define VER_LAMEXP_BUILD 338
#define VER_LAMEXP_SUFFIX Beta-3
/*
diff --git a/src/Decoder_ADPCM.cpp b/src/Decoder_ADPCM.cpp
index db4ba498..9a515aa2 100644
--- a/src/Decoder_ADPCM.cpp
+++ b/src/Decoder_ADPCM.cpp
@@ -46,7 +46,7 @@ bool ADPCMDecoder::decode(const QString &sourceFile, const QString &outputFile,
QProcess process;
QStringList args;
- process.setWorkingDirectory(lamexp_temp_folder());
+ process.setWorkingDirectory(QFileInfo(outputFile).canonicalPath());
args << "-V3" << "-S" << "--temp" << ".";
args << QDir::toNativeSeparators(sourceFile);
diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp
index 8090495b..eea60c4f 100644
--- a/src/Dialog_MainWindow.cpp
+++ b/src/Dialog_MainWindow.cpp
@@ -220,10 +220,12 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
while(checkBoxNeroAAC2PassMode->isChecked() != m_settings->neroAACEnable2Pass()) checkBoxNeroAAC2PassMode->click();
while(checkBoxNormalizationFilter->isChecked() != m_settings->normalizationFilterEnabled()) checkBoxNormalizationFilter->click();
while(checkBoxAutoDetectInstances->isChecked() != (m_settings->maximumInstances() < 1)) checkBoxAutoDetectInstances->click();
+ while(checkBoxUseSystemTempFolder->isChecked() == m_settings->customTempPathEnabled()) checkBoxUseSystemTempFolder->click();
lineEditCustomParamLAME->setText(m_settings->customParametersLAME());
lineEditCustomParamOggEnc->setText(m_settings->customParametersOggEnc());
lineEditCustomParamNeroAAC->setText(m_settings->customParametersNeroAAC());
lineEditCustomParamFLAC->setText(m_settings->customParametersFLAC());
+ lineEditCustomTempFolder->setText(QDir::toNativeSeparators(m_settings->customTempPath()));
connect(sliderLameAlgoQuality, SIGNAL(valueChanged(int)), this, SLOT(updateLameAlgoQuality(int)));
connect(checkBoxBitrateManagement, SIGNAL(clicked(bool)), this, SLOT(bitrateManagementEnabledChanged(bool)));
connect(spinBoxBitrateManagementMin, SIGNAL(valueChanged(int)), this, SLOT(bitrateManagementMinChanged(int)));
@@ -243,6 +245,9 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
connect(lineEditCustomParamFLAC, SIGNAL(editingFinished()), this, SLOT(customParamsChanged()));
connect(sliderMaxInstances, SIGNAL(valueChanged(int)), this, SLOT(updateMaximumInstances(int)));
connect(checkBoxAutoDetectInstances, SIGNAL(clicked(bool)), this, SLOT(autoDetectInstancesChanged(bool)));
+ connect(buttonBrowseCustomTempFolder, SIGNAL(clicked()), this, SLOT(browseCustomTempFolderButtonClicked()));
+ connect(lineEditCustomTempFolder, SIGNAL(textChanged(QString)), this, SLOT(customTempFolderChanged(QString)));
+ connect(checkBoxUseSystemTempFolder, SIGNAL(clicked(bool)), this, SLOT(useCustomTempFolderChanged(bool)));
connect(buttonResetAdvancedOptions, SIGNAL(clicked()), this, SLOT(resetAdvancedOptionsButtonClicked()));
updateLameAlgoQuality(sliderLameAlgoQuality->value());
updateMaximumInstances(sliderMaxInstances->value());
@@ -461,7 +466,7 @@ bool MainWindow::installWMADecoder(void)
while(true)
{
- QString setupFile = QString("%1/%2.exe").arg(lamexp_temp_folder(), lamexp_rand_str());
+ QString setupFile = QString("%1/%2.exe").arg(lamexp_temp_folder2(), lamexp_rand_str());
QProcess process;
process.setWorkingDirectory(QFileInfo(setupFile).absolutePath());
@@ -931,11 +936,20 @@ void MainWindow::encodeButtonClicked(void)
return;
}
- __int64 currentFreeDiskspace = lamexp_free_diskspace(lamexp_temp_folder());
+ QString tempFolder = m_settings->customTempPathEnabled() ? m_settings->customTempPath() : lamexp_temp_folder2();
+ if(!QFileInfo(tempFolder).exists() || !QFileInfo(tempFolder).isDir())
+ {
+ if(QMessageBox::warning(this, tr("Not Found"), QString("%1
%2").arg(tr("Your currently selected TEMP folder does not exist anymore:"), QDir::toNativeSeparators(tempFolder)), tr("Restore Default"), tr("Cancel")) == 0)
+ {
+ while(checkBoxUseSystemTempFolder->isChecked() == m_settings->customTempPathEnabledDefault()) checkBoxUseSystemTempFolder->click();
+ }
+ return;
+ }
+ qint64 currentFreeDiskspace = lamexp_free_diskspace(tempFolder);
if(currentFreeDiskspace < (oneGigabyte * minimumFreeDiskspaceMultiplier))
{
- QStringList tempFolderParts = lamexp_temp_folder().split("/", QString::SkipEmptyParts, Qt::CaseInsensitive);
+ QStringList tempFolderParts = tempFolder.split("/", QString::SkipEmptyParts, Qt::CaseInsensitive);
tempFolderParts.takeLast();
if(m_settings->soundsEnabled()) PlaySound(MAKEINTRESOURCE(IDR_WAVE_WHAMMY), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC);
switch(QMessageBox::warning(this, tr("Low Diskspace Warning"), QString("%1
%2
%3").arg(tr("There are less than %1 GB of free diskspace available on your system's TEMP folder.").arg(QString::number(minimumFreeDiskspaceMultiplier)), tr("It is highly recommend to free up more diskspace before proceeding with the encode!"), tr("Your TEMP folder is located at:")).append("
%3
").arg(tempFolderParts.join("\\")), tr("Abort Encoding Process"), tr("Clean Disk Now"), tr("Ignore")))
@@ -1950,6 +1964,44 @@ void MainWindow::autoDetectInstancesChanged(bool checked)
m_settings->maximumInstances(checked ? NULL : sliderMaxInstances->value());
}
+/*
+ * Browse for custom TEMP folder button clicked
+ */
+void MainWindow::browseCustomTempFolderButtonClicked(void)
+{
+ QString newTempFolder = QFileDialog::getExistingDirectory(this);
+
+ if(!newTempFolder.isEmpty())
+ {
+ QFile writeTest(QString("%1/~%2.tmp").arg(newTempFolder, lamexp_rand_str()));
+ if(writeTest.open(QIODevice::ReadWrite))
+ {
+ writeTest.remove();
+ lineEditCustomTempFolder->setText(QDir::toNativeSeparators(newTempFolder));
+ }
+ else
+ {
+ QMessageBox::warning(this, tr("Access Denied"), tr("Cannot write to the selected directory. Please choose another directory!"));
+ }
+ }
+}
+
+/*
+ * Custom TEMP folder changed
+ */
+void MainWindow::customTempFolderChanged(const QString &text)
+{
+ m_settings->customTempPath(QDir::fromNativeSeparators(text));
+}
+
+/*
+ * Use custom TEMP folder option changed
+ */
+void MainWindow::useCustomTempFolderChanged(bool checked)
+{
+ m_settings->customTempPathEnabled(!checked);
+}
+
/*
* Reset all advanced options to their defaults
*/
@@ -1968,10 +2020,12 @@ void MainWindow::resetAdvancedOptionsButtonClicked(void)
while(checkBoxNeroAAC2PassMode->isChecked() != m_settings->neroAACEnable2PassDefault()) checkBoxNeroAAC2PassMode->click();
while(checkBoxNormalizationFilter->isChecked() != m_settings->normalizationFilterEnabledDefault()) checkBoxNormalizationFilter->click();
while(checkBoxAutoDetectInstances->isChecked() != (m_settings->maximumInstancesDefault() < 1)) checkBoxAutoDetectInstances->click();
+ while(checkBoxUseSystemTempFolder->isChecked() == m_settings->customTempPathEnabledDefault()) checkBoxUseSystemTempFolder->click();
lineEditCustomParamLAME->setText(m_settings->customParametersLAMEDefault());
lineEditCustomParamOggEnc->setText(m_settings->customParametersOggEncDefault());
lineEditCustomParamNeroAAC->setText(m_settings->customParametersNeroAACDefault());
lineEditCustomParamFLAC->setText(m_settings->customParametersFLACDefault());
+ lineEditCustomTempFolder->setText(QDir::toNativeSeparators(m_settings->customTempPathDefault()));
customParamsChanged();
scrollArea->verticalScrollBar()->setValue(0);
}
diff --git a/src/Dialog_MainWindow.h b/src/Dialog_MainWindow.h
index f1693adc..e3f91b37 100644
--- a/src/Dialog_MainWindow.h
+++ b/src/Dialog_MainWindow.h
@@ -95,6 +95,9 @@ private slots:
void customParamsChanged(void);
void updateMaximumInstances(int value);
void autoDetectInstancesChanged(bool checked);
+ void browseCustomTempFolderButtonClicked(void);
+ void customTempFolderChanged(const QString &text);
+ void useCustomTempFolderChanged(bool checked);
void resetAdvancedOptionsButtonClicked(void);
void sourceModelChanged(void);
void metaTagsEnabledChanged(void);
diff --git a/src/Dialog_Processing.cpp b/src/Dialog_Processing.cpp
index 228edab1..1a3b6b0f 100644
--- a/src/Dialog_Processing.cpp
+++ b/src/Dialog_Processing.cpp
@@ -581,7 +581,8 @@ void ProcessingDialog::startNextJob(void)
ProcessThread *thread = new ProcessThread
(
currentFile,
- (m_settings->outputToSourceDir() ? QFileInfo(currentFile.filePath()).absolutePath(): m_settings->outputDir()),
+ (m_settings->outputToSourceDir() ? QFileInfo(currentFile.filePath()).absolutePath() : m_settings->outputDir()),
+ (m_settings->customTempPathEnabled() ? m_settings->customTempPath() : lamexp_temp_folder2()),
encoder,
m_settings->prependRelativeSourcePath()
);
diff --git a/src/Dialog_Update.cpp b/src/Dialog_Update.cpp
index 1fc0c471..ab4fa7df 100644
--- a/src/Dialog_Update.cpp
+++ b/src/Dialog_Update.cpp
@@ -238,7 +238,7 @@ void UpdateDialog::checkForUpdates(void)
if(connectionScore < MIN_CONNSCORE)
{
m_logFile->append(QStringList() << "" << "Testing host:" << known_hosts[i] << "");
- QString outFile = QString("%1/%2.htm").arg(lamexp_temp_folder(), lamexp_rand_str());
+ QString outFile = QString("%1/%2.htm").arg(lamexp_temp_folder2(), lamexp_rand_str());
if(getFile(known_hosts[i], outFile))
{
connectionScore++;
@@ -357,8 +357,8 @@ bool UpdateDialog::tryUpdateMirror(UpdateInfo *updateInfo, const QString &url)
m_logFile->append(QStringList() << "" << "Trying mirror:" << url);
QString randPart = lamexp_rand_str();
- QString outFileVersionInfo = QString("%1/%2.ver").arg(lamexp_temp_folder(), randPart);
- QString outFileSignature = QString("%1/%2.sig").arg(lamexp_temp_folder(), randPart);
+ QString outFileVersionInfo = QString("%1/%2.ver").arg(lamexp_temp_folder2(), randPart);
+ QString outFileSignature = QString("%1/%2.sig").arg(lamexp_temp_folder2(), randPart);
m_logFile->append(QStringList() << "" << "Downloading update info:");
bool ok1 = getFile(QString("%1%2").arg(url, mirror_url_postfix[lamexp_version_demo() ? 1 : 0]), outFileVersionInfo);
diff --git a/src/Encoder_Wave.cpp b/src/Encoder_Wave.cpp
index 8c771143..859986a5 100644
--- a/src/Encoder_Wave.cpp
+++ b/src/Encoder_Wave.cpp
@@ -45,6 +45,10 @@ bool WaveEncoder::encode(const QString &sourceFile, const AudioFileModel &metaIn
memset(&fileOperation, 0, sizeof(SHFILEOPSTRUCTW));
fileOperation.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR | FOF_NOERRORUI | FOF_FILESONLY;
+ emit messageLogged(QString("Copy file \"%1\" to \"%2\"").arg(sourceFile, outputFile));
+ fileOperation.wFunc = FO_COPY;
+
+ /*
if(lamexp_temp_folder().compare(QFileInfo(sourceFile).canonicalPath(), Qt::CaseInsensitive) == 0)
{
//If the source is in the TEMP folder take shortcut and move the file
@@ -57,6 +61,7 @@ bool WaveEncoder::encode(const QString &sourceFile, const AudioFileModel &metaIn
emit messageLogged(QString("Copy file \"%1\" to \"%2\"").arg(sourceFile, outputFile));
fileOperation.wFunc = FO_COPY;
}
+ */
size_t srcLen = wcslen(reinterpret_cast(sourceFile.utf16())) + 3;
wchar_t *srcBuffer = new wchar_t[srcLen];
diff --git a/src/Filter_Downmix.cpp b/src/Filter_Downmix.cpp
index 89023993..a7bfd207 100644
--- a/src/Filter_Downmix.cpp
+++ b/src/Filter_Downmix.cpp
@@ -46,7 +46,7 @@ bool DownmixFilter::apply(const QString &sourceFile, const QString &outputFile,
QProcess process;
QStringList args;
- process.setWorkingDirectory(lamexp_temp_folder());
+ process.setWorkingDirectory(QFileInfo(outputFile).canonicalPath());
args << "-V3";
args << "--guard" << "--temp" << ".";
diff --git a/src/Filter_Normalize.cpp b/src/Filter_Normalize.cpp
index ccc9a142..d9fec1f9 100644
--- a/src/Filter_Normalize.cpp
+++ b/src/Filter_Normalize.cpp
@@ -48,7 +48,7 @@ bool NormalizeFilter::apply(const QString &sourceFile, const QString &outputFile
QProcess process;
QStringList args;
- process.setWorkingDirectory(lamexp_temp_folder());
+ process.setWorkingDirectory(QFileInfo(outputFile).canonicalPath());
args << "-V3";
args << "--temp" << ".";
diff --git a/src/Filter_Resample.cpp b/src/Filter_Resample.cpp
index 4caaecc9..7855cc7c 100644
--- a/src/Filter_Resample.cpp
+++ b/src/Filter_Resample.cpp
@@ -48,7 +48,7 @@ bool ResampleFilter::apply(const QString &sourceFile, const QString &outputFile,
QProcess process;
QStringList args;
- process.setWorkingDirectory(lamexp_temp_folder());
+ process.setWorkingDirectory(QFileInfo(outputFile).canonicalPath());
args << "-V3";
args << "--guard" << "--temp" << ".";
diff --git a/src/Filter_ToneAdjust.cpp b/src/Filter_ToneAdjust.cpp
index 6d125da3..b9f98b55 100644
--- a/src/Filter_ToneAdjust.cpp
+++ b/src/Filter_ToneAdjust.cpp
@@ -26,6 +26,7 @@
#include
#include
#include
+#include
ToneAdjustFilter::ToneAdjustFilter(int bass, int treble)
:
@@ -49,7 +50,7 @@ bool ToneAdjustFilter::apply(const QString &sourceFile, const QString &outputFil
QProcess process;
QStringList args;
- process.setWorkingDirectory(lamexp_temp_folder());
+ process.setWorkingDirectory(QFileInfo(outputFile).canonicalPath());
args << "-V3";
args << "--guard" << "--temp" << ".";
diff --git a/src/Global.cpp b/src/Global.cpp
index 03240a5a..e1fa692b 100644
--- a/src/Global.cpp
+++ b/src/Global.cpp
@@ -779,7 +779,7 @@ QString lamexp_rand_str(void)
/*
* Get LameXP temp folder
*/
-const QString &lamexp_temp_folder(void)
+const QString &lamexp_temp_folder2(void)
{
static const char *TEMP_STR = "Temp";
@@ -1155,8 +1155,8 @@ bool lamexp_remove_file(const QString &filename)
{
if(!QFile::remove(filename))
{
- DWORD attributes = GetFileAttributesW(reinterpret_cast(filename.utf16()));
- SetFileAttributesW(reinterpret_cast(filename.utf16()), (attributes & (~FILE_ATTRIBUTE_READONLY)));
+ DWORD attributes = GetFileAttributesW(QWCHAR(filename));
+ SetFileAttributesW(QWCHAR(filename), (attributes & (~FILE_ATTRIBUTE_READONLY)));
if(!QFile::remove(filename))
{
qWarning("Could not delete \"%s\"", filename.toLatin1().constData());
diff --git a/src/Global.h b/src/Global.h
index 03e58e57..173296a9 100644
--- a/src/Global.h
+++ b/src/Global.h
@@ -88,7 +88,7 @@ const QString lamexp_lookup_tool(const QString &toolName);
unsigned int lamexp_tool_version(const QString &toolName);
void lamexp_finalization(void);
QString lamexp_rand_str(void);
-const QString &lamexp_temp_folder(void);
+const QString &lamexp_temp_folder2(void);
void lamexp_ipc_read(unsigned int *command, char* message, size_t buffSize);
void lamexp_ipc_send(unsigned int command, const char* message);
lamexp_cpu_t lamexp_detect_cpu_features(void);
diff --git a/src/Model_Settings.cpp b/src/Model_Settings.cpp
index f6b91798..c1914605 100644
--- a/src/Model_Settings.cpp
+++ b/src/Model_Settings.cpp
@@ -101,6 +101,8 @@ MAKE_ID(customParametersNeroAAC, "AdvancedOptions/CustomParameters/NeroAAC");
MAKE_ID(customParametersFLAC, "AdvancedOptions/CustomParameters/FLAC");
MAKE_ID(metaInfoPosition, "MetaInformation/PlaylistPosition");
MAKE_ID(maximumInstances, "AdvancedOptions/Threading/MaximumInstances");
+MAKE_ID(customTempPath, "AdvancedOptions/TempDirectory/CustomPath");
+MAKE_ID(customTempPathEnabled, "AdvancedOptions/TempDirectory/UseCustomPath");
//LUT
const int SettingsModel::mp3Bitrates[15] = {32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1};
@@ -260,3 +262,5 @@ MAKE_OPTION2(customParametersNeroAAC, QString());
MAKE_OPTION2(customParametersFLAC, QString());
MAKE_OPTION4(metaInfoPosition, UINT_MAX);
MAKE_OPTION4(maximumInstances, 0);
+MAKE_OPTION2(customTempPath, QDesktopServices::storageLocation(QDesktopServices::TempLocation));
+MAKE_OPTION3(customTempPathEnabled, false);
diff --git a/src/Model_Settings.h b/src/Model_Settings.h
index 032a92f0..48e1a875 100644
--- a/src/Model_Settings.h
+++ b/src/Model_Settings.h
@@ -111,6 +111,8 @@ public:
MAKE_OPTION_DEC2(customParametersFLAC);
MAKE_OPTION_DEC4(metaInfoPosition);
MAKE_OPTION_DEC4(maximumInstances);
+ MAKE_OPTION_DEC2(customTempPath);
+ MAKE_OPTION_DEC3(customTempPathEnabled);
//Misc
void validate(void);
diff --git a/src/Thread_Initialization.cpp b/src/Thread_Initialization.cpp
index af8c1e86..2b98fb34 100644
--- a/src/Thread_Initialization.cpp
+++ b/src/Thread_Initialization.cpp
@@ -133,7 +133,7 @@ void InitializationThread::run()
{
throw "The required checksum is missing, take care!";
}
- LockedFile *lockedFile = new LockedFile(QString(":/tools/%1").arg(toolName), QString(lamexp_temp_folder()).append(QString("/tool_%1").arg(toolName)), toolHash);
+ LockedFile *lockedFile = new LockedFile(QString(":/tools/%1").arg(toolName), QString(lamexp_temp_folder2()).append(QString("/tool_%1").arg(toolName)), toolHash);
lamexp_register_tool(toolName, lockedFile, toolVersion);
}
catch(char *errorMsg)
diff --git a/src/Thread_Process.cpp b/src/Thread_Process.cpp
index 3da17381..3746c455 100644
--- a/src/Thread_Process.cpp
+++ b/src/Thread_Process.cpp
@@ -46,10 +46,11 @@ QMutex *ProcessThread::m_mutex_genFileName = NULL;
// Constructor
////////////////////////////////////////////////////////////
-ProcessThread::ProcessThread(const AudioFileModel &audioFile, const QString &outputDirectory, AbstractEncoder *encoder, const bool prependRelativeSourcePath)
+ProcessThread::ProcessThread(const AudioFileModel &audioFile, const QString &outputDirectory, const QString &tempDirectory, AbstractEncoder *encoder, const bool prependRelativeSourcePath)
:
m_audioFile(audioFile),
m_outputDirectory(outputDirectory),
+ m_tempDirectory(tempDirectory),
m_encoder(encoder),
m_jobId(QUuid::createUuid()),
m_prependRelativeSourcePath(prependRelativeSourcePath),
@@ -303,11 +304,11 @@ QString ProcessThread::generateOutFileName(void)
QString ProcessThread::generateTempFileName(void)
{
QMutexLocker lock(m_mutex_genFileName);
- QString tempFileName = QString("%1/%2.wav").arg(lamexp_temp_folder(), lamexp_rand_str());
+ QString tempFileName = QString("%1/%2.wav").arg(m_tempDirectory, lamexp_rand_str());
while(QFileInfo(tempFileName).exists())
{
- tempFileName = QString("%1/%2.wav").arg(lamexp_temp_folder(), lamexp_rand_str());
+ tempFileName = QString("%1/%2.wav").arg(m_tempDirectory, lamexp_rand_str());
}
QFile file(tempFileName);
diff --git a/src/Thread_Process.h b/src/Thread_Process.h
index d1fac69c..c10e8c72 100644
--- a/src/Thread_Process.h
+++ b/src/Thread_Process.h
@@ -36,7 +36,7 @@ class ProcessThread: public QThread
Q_OBJECT
public:
- ProcessThread(const AudioFileModel &audioFile, const QString &outputDirectory, AbstractEncoder *encoder, const bool prependRelativeSourcePath);
+ ProcessThread(const AudioFileModel &audioFile, const QString &outputDirectory, const QString &tempDirectory, AbstractEncoder *encoder, const bool prependRelativeSourcePath);
~ProcessThread(void);
void run();
@@ -72,6 +72,7 @@ private:
AudioFileModel m_audioFile;
AbstractEncoder *m_encoder;
const QString m_outputDirectory;
+ const QString m_tempDirectory;
volatile bool m_aborted;
ProcessStep m_currentStep;
QStringList m_tempFiles;