OSDN Git Service

Added an option to select a user-defined TEMP directory.
authorlordmulder <mulder2@gmx.de>
Fri, 25 Feb 2011 21:03:39 +0000 (22:03 +0100)
committerlordmulder <mulder2@gmx.de>
Fri, 25 Feb 2011 21:03:39 +0000 (22:03 +0100)
29 files changed:
doc/Changelog.html
etc/Translation/Blank.ts
etc/Translation/LameXP_DE.ts
etc/Translation/LameXP_ES.ts
etc/Translation/LameXP_FR.ts
etc/Translation/LameXP_IT.ts
etc/Translation/LameXP_RU.ts
etc/Translation/LameXP_UK.ts
gui/MainWindow.ui
res/Icons.qrc
res/localization/LameXP_DE.qm
src/Config.h
src/Decoder_ADPCM.cpp
src/Dialog_MainWindow.cpp
src/Dialog_MainWindow.h
src/Dialog_Processing.cpp
src/Dialog_Update.cpp
src/Encoder_Wave.cpp
src/Filter_Downmix.cpp
src/Filter_Normalize.cpp
src/Filter_Resample.cpp
src/Filter_ToneAdjust.cpp
src/Global.cpp
src/Global.h
src/Model_Settings.cpp
src/Model_Settings.h
src/Thread_Initialization.cpp
src/Thread_Process.cpp
src/Thread_Process.h

index 9df5c04..6dd46ea 100644 (file)
@@ -5,6 +5,7 @@
 
 Changes between v4.00 and v4.01:<br><ul>
 <li>Added an option to manually specify the number of parallel instances
+<li>Added an option to select a user-defined TEMP directory
 <li>Updated LAME encoder to v3.99.0.12 (2011-02-13), compiled with ICL 12.0.2
 <li>Updated Vorbis encoder to v2.87 using aoTuV Beta-6.01 (2011-02-22), compiled with ICL 11.1 and MSVC 9.0
 <li>Updated language files (big "thank you" to all contributors !!!)
index 8299ea3..33a102c 100644 (file)
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <source> Temp Directory </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Browse...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Store temporary files in your system&apos;s default TEMP directory (Recommended)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source>Reset Advanced Options </source>
         <translation type="unfinished"></translation>
     </message>
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <source>Not Found</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Your currently selected TEMP folder does not exist anymore:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Restore Default</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source>Low Diskspace Warning</source>
         <translation type="unfinished"></translation>
     </message>
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <source>Cannot write to the selected directory. Please choose another directory!</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source>Do you really want to disable the update reminder?</source>
         <translation type="unfinished"></translation>
     </message>
index 767b2a9..517268e 100644 (file)
         <source>%1 Instance(s)</source>
         <translation>%1 Instanz(en)</translation>
     </message>
+    <message>
+        <source> Temp Directory </source>
+        <translation> Temp Verzeichnis </translation>
+    </message>
+    <message>
+        <source>Browse...</source>
+        <translation>Durchsuchen...</translation>
+    </message>
+    <message>
+        <source>Store temporary files in your system&apos;s default TEMP directory (Recommended)</source>
+        <translation>Temporäre Dateien im standard TEMP Verzeichnis des Systems speichern (Empfohlen)</translation>
+    </message>
+    <message>
+        <source>Not Found</source>
+        <translation>Nicht Gefunden</translation>
+    </message>
+    <message>
+        <source>Your currently selected TEMP folder does not exist anymore:</source>
+        <translation>Das derzeit ausgewählte TEMP Verzeichnis existiert nicht mehr:</translation>
+    </message>
+    <message>
+        <source>Restore Default</source>
+        <translation>Standard Wiederherstellen</translation>
+    </message>
+    <message>
+        <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>
 </context>
 <context>
     <name>MetaInfo</name>
index 78ffb6e..997830e 100644 (file)
         <source>%1 Instance(s)</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source> Temp Directory </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Browse...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Store temporary files in your system&apos;s default TEMP directory (Recommended)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Not Found</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Your currently selected TEMP folder does not exist anymore:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Restore Default</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Cannot write to the selected directory. Please choose another directory!</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>MetaInfo</name>
index 6d3a6cd..024ca40 100644 (file)
@@ -1174,6 +1174,34 @@ Sélection automatique (par défaut)</translation>
         <source>%1 Instance(s)</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source> Temp Directory </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Browse...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Store temporary files in your system&apos;s default TEMP directory (Recommended)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Not Found</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Your currently selected TEMP folder does not exist anymore:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Restore Default</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Cannot write to the selected directory. Please choose another directory!</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>MetaInfo</name>
index bceed85..54fe75e 100644 (file)
         <source>%1 Instance(s)</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source> Temp Directory </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Browse...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Store temporary files in your system&apos;s default TEMP directory (Recommended)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Not Found</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Your currently selected TEMP folder does not exist anymore:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Restore Default</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Cannot write to the selected directory. Please choose another directory!</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>MetaInfo</name>
index c65d5b6..8d17b64 100644 (file)
         <source>%1 Instance(s)</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source> Temp Directory </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Browse...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Store temporary files in your system&apos;s default TEMP directory (Recommended)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Not Found</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Your currently selected TEMP folder does not exist anymore:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Restore Default</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Cannot write to the selected directory. Please choose another directory!</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>MetaInfo</name>
index c9b4341..2f35735 100644 (file)
         <source>%1 Instance(s)</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source> Temp Directory </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Browse...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Store temporary files in your system&apos;s default TEMP directory (Recommended)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Not Found</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Your currently selected TEMP folder does not exist anymore:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Restore Default</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Cannot write to the selected directory. Please choose another directory!</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>MetaInfo</name>
index 8e6a8cb..cfb0924 100644 (file)
                <x>0</x>
                <y>0</y>
                <width>604</width>
-               <height>965</height>
+               <height>1091</height>
               </rect>
              </property>
              <layout class="QGridLayout" name="gridLayout_22">
                   </layout>
                  </widget>
                 </item>
+                <item row="8" column="0">
+                 <widget class="QGroupBox" name="groupBox_13">
+                  <property name="font">
+                   <font>
+                    <weight>50</weight>
+                    <bold>false</bold>
+                   </font>
+                  </property>
+                  <property name="title">
+                   <string> Temp Directory </string>
+                  </property>
+                  <layout class="QGridLayout" name="gridLayout_34">
+                   <item row="0" column="1">
+                    <layout class="QGridLayout" name="gridLayout_33">
+                     <item row="1" column="1">
+                      <widget class="QLineEdit" name="lineEditCustomTempFolder">
+                       <property name="readOnly">
+                        <bool>true</bool>
+                       </property>
+                      </widget>
+                     </item>
+                     <item row="1" column="2">
+                      <widget class="QPushButton" name="buttonBrowseCustomTempFolder">
+                       <property name="text">
+                        <string>Browse...</string>
+                       </property>
+                       <property name="icon">
+                        <iconset resource="../res/Icons.qrc">
+                         <normaloff>:/icons/folder_explore.png</normaloff>:/icons/folder_explore.png</iconset>
+                       </property>
+                       <property name="iconSize">
+                        <size>
+                         <width>16</width>
+                         <height>16</height>
+                        </size>
+                       </property>
+                      </widget>
+                     </item>
+                     <item row="3" column="1" colspan="2">
+                      <widget class="QCheckBox" name="checkBoxUseSystemTempFolder">
+                       <property name="text">
+                        <string>Store temporary files in your system's default TEMP directory (Recommended)</string>
+                       </property>
+                      </widget>
+                     </item>
+                     <item row="0" column="1" colspan="2">
+                      <spacer name="verticalSpacer_20">
+                       <property name="orientation">
+                        <enum>Qt::Vertical</enum>
+                       </property>
+                       <property name="sizeType">
+                        <enum>QSizePolicy::Fixed</enum>
+                       </property>
+                       <property name="sizeHint" stdset="0">
+                        <size>
+                         <width>20</width>
+                         <height>8</height>
+                        </size>
+                       </property>
+                      </spacer>
+                     </item>
+                     <item row="4" column="1" colspan="2">
+                      <spacer name="verticalSpacer_21">
+                       <property name="orientation">
+                        <enum>Qt::Vertical</enum>
+                       </property>
+                       <property name="sizeType">
+                        <enum>QSizePolicy::Fixed</enum>
+                       </property>
+                       <property name="sizeHint" stdset="0">
+                        <size>
+                         <width>20</width>
+                         <height>8</height>
+                        </size>
+                       </property>
+                      </spacer>
+                     </item>
+                     <item row="1" column="0">
+                      <spacer name="horizontalSpacer_37">
+                       <property name="orientation">
+                        <enum>Qt::Horizontal</enum>
+                       </property>
+                       <property name="sizeType">
+                        <enum>QSizePolicy::Fixed</enum>
+                       </property>
+                       <property name="sizeHint" stdset="0">
+                        <size>
+                         <width>10</width>
+                         <height>20</height>
+                        </size>
+                       </property>
+                      </spacer>
+                     </item>
+                     <item row="1" column="3">
+                      <spacer name="horizontalSpacer_38">
+                       <property name="orientation">
+                        <enum>Qt::Horizontal</enum>
+                       </property>
+                       <property name="sizeType">
+                        <enum>QSizePolicy::Fixed</enum>
+                       </property>
+                       <property name="sizeHint" stdset="0">
+                        <size>
+                         <width>10</width>
+                         <height>20</height>
+                        </size>
+                       </property>
+                      </spacer>
+                     </item>
+                     <item row="2" column="1" colspan="2">
+                      <spacer name="verticalSpacer_22">
+                       <property name="orientation">
+                        <enum>Qt::Vertical</enum>
+                       </property>
+                       <property name="sizeType">
+                        <enum>QSizePolicy::Fixed</enum>
+                       </property>
+                       <property name="sizeHint" stdset="0">
+                        <size>
+                         <width>20</width>
+                         <height>4</height>
+                        </size>
+                       </property>
+                      </spacer>
+                     </item>
+                    </layout>
+                   </item>
+                  </layout>
+                 </widget>
+                </item>
                </layout>
               </item>
               <item row="6" column="0">
   <include location="../res/Icons.qrc"/>
   <include location="../res/Icons.qrc"/>
   <include location="../res/Icons.qrc"/>
+  <include location="../res/Icons.qrc"/>
+  <include location="../res/Icons.qrc"/>
+  <include location="../res/Icons.qrc"/>
+  <include location="../res/Icons.qrc"/>
  </resources>
  <connections>
   <connection>
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>checkBoxUseSystemTempFolder</sender>
+   <signal>clicked(bool)</signal>
+   <receiver>lineEditCustomTempFolder</receiver>
+   <slot>setDisabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>323</x>
+     <y>302</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>283</x>
+     <y>265</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>checkBoxUseSystemTempFolder</sender>
+   <signal>clicked(bool)</signal>
+   <receiver>buttonBrowseCustomTempFolder</receiver>
+   <slot>setDisabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>323</x>
+     <y>302</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>551</x>
+     <y>265</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
 </ui>
index d41a4f7..ffa71e4 100644 (file)
@@ -44,6 +44,7 @@
     <file>icons/folder_add.png</file>
     <file>icons/folder_go.png</file>
     <file>icons/folder_image.png</file>
+    <file>icons/folder_explore.png</file>
     <file>icons/folder_page.png</file>
     <file>icons/font.png</file>
     <file>icons/house.png</file>
index 167a10c..642f2d9 100644 (file)
Binary files a/res/localization/LameXP_DE.qm and b/res/localization/LameXP_DE.qm differ
index b1b948d..0c9f2af 100644 (file)
@@ -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
 
 /*
index db4ba49..9a515aa 100644 (file)
@@ -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);
index 8090495..eea60c4 100644 (file)
@@ -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("<nobr>%1</nobr><br><nobr>%2</nobr>").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("<nobr>%1</nobr><br><nobr>%2</nobr><br><br>%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("<br><nobr><i><a href=\"file:///%3\">%3</a></i></nobr><br>").arg(tempFolderParts.join("\\")), tr("Abort Encoding Process"), tr("Clean Disk Now"), tr("Ignore")))
@@ -1951,6 +1965,44 @@ void MainWindow::autoDetectInstancesChanged(bool checked)
 }
 
 /*
+ * 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
  */
 void MainWindow::resetAdvancedOptionsButtonClicked(void)
@@ -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);
 }
index f1693ad..e3f91b3 100644 (file)
@@ -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);
index 228edab..1a3b6b0 100644 (file)
@@ -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()
        );
index 1fc0c47..ab4fa7d 100644 (file)
@@ -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);
index 8c77114..859986a 100644 (file)
@@ -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<const wchar_t*>(sourceFile.utf16())) + 3;
        wchar_t *srcBuffer = new wchar_t[srcLen];
index 8902399..a7bfd20 100644 (file)
@@ -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" << ".";
index ccc9a14..d9fec1f 100644 (file)
@@ -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" << ".";
index 4caaecc..7855cc7 100644 (file)
@@ -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" << ".";
index 6d125da..b9f98b5 100644 (file)
@@ -26,6 +26,7 @@
 #include <QDir>
 #include <QProcess>
 #include <QRegExp>
+#include <QFileInfo>
 
 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" << ".";
index 03240a5..e1fa692 100644 (file)
@@ -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<const wchar_t*>(filename.utf16()));
-                       SetFileAttributesW(reinterpret_cast<const wchar_t*>(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());
index 03e58e5..173296a 100644 (file)
@@ -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);
index f6b9179..c191460 100644 (file)
@@ -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);
index 032a92f..48e1a87 100644 (file)
@@ -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);
index af8c1e8..2b98fb3 100644 (file)
@@ -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)
index 3da1738..3746c45 100644 (file)
@@ -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);
index d1fac69..c10e8c7 100644 (file)
@@ -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;