OSDN Git Service

Force column resize, after an item in the source file list has been edited.
[lamexp/LameXP.git] / src / Dialog_MainWindow.cpp
index 2cb2f36..d20bd26 100644 (file)
 
 //System includes
 #include <MMSystem.h>
+#include <ShellAPI.h>
 
 //Helper macros
 #define ABORT_IF_BUSY if(m_banner->isVisible() || m_delayedFileTimer->isActive()) { MessageBeep(MB_ICONEXCLAMATION); return; }
 #define SET_TEXT_COLOR(WIDGET,COLOR) { QPalette _palette = WIDGET->palette(); _palette.setColor(QPalette::WindowText, (COLOR)); _palette.setColor(QPalette::Text, (COLOR)); WIDGET->setPalette(_palette); }
 #define SET_FONT_BOLD(WIDGET,BOLD) { QFont _font = WIDGET->font(); _font.setBold(BOLD); WIDGET->setFont(_font); }
-#define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(URL)
+#define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(QString(URL).replace("-", "&minus;"))
+#define FSLINK(PATH) QString("<a href=\"file:///%1\">%2</a>").arg(PATH).arg(QString(PATH).replace("-", "&minus;"))
 #define TEMP_HIDE_DROPBOX(CMD) { bool __dropBoxVisible = m_dropBox->isVisible(); if(__dropBoxVisible) m_dropBox->hide(); {CMD}; if(__dropBoxVisible) m_dropBox->show(); }
 #define USE_NATIVE_FILE_DIALOG (lamexp_themes_enabled() || ((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) < QSysInfo::WV_XP))
-#define NOBR(STR) QString("<nobr>%1</nobr>").arg(STR).replace("-", "&minus;")
 
 ////////////////////////////////////////////////////////////
 // Constructor
@@ -89,6 +90,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
        m_settings(settingsModel),
        m_neroEncoderAvailable(lamexp_check_tool("neroAacEnc.exe") && lamexp_check_tool("neroAacDec.exe") && lamexp_check_tool("neroAacTag.exe")),
        m_fhgEncoderAvailable(lamexp_check_tool("fhgaacenc.exe") && lamexp_check_tool("enc_fhgaac.dll") && lamexp_check_tool("nsutil.dll") && lamexp_check_tool("libmp4v2.dll")),
+       m_qaacEncoderAvailable(lamexp_check_tool("qaac.exe") && lamexp_check_tool("libsoxrate.dll")),
        m_accepted(false),
        m_firstTimeShown(true),
        m_OutputFolderViewInitialized(false)
@@ -206,10 +208,10 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
        m_modeButtonGroup->addButton(radioButtonModeQuality, SettingsModel::VBRMode);
        m_modeButtonGroup->addButton(radioButtonModeAverageBitrate, SettingsModel::ABRMode);
        m_modeButtonGroup->addButton(radioButtonConstBitrate, SettingsModel::CBRMode);
-       radioButtonEncoderAAC->setEnabled(m_neroEncoderAvailable || m_fhgEncoderAvailable);
+       radioButtonEncoderAAC->setEnabled(m_neroEncoderAvailable || m_fhgEncoderAvailable || m_qaacEncoderAvailable);
        radioButtonEncoderMP3->setChecked(m_settings->compressionEncoder() == SettingsModel::MP3Encoder);
        radioButtonEncoderVorbis->setChecked(m_settings->compressionEncoder() == SettingsModel::VorbisEncoder);
-       radioButtonEncoderAAC->setChecked((m_settings->compressionEncoder() == SettingsModel::AACEncoder) && (m_neroEncoderAvailable || m_fhgEncoderAvailable));
+       radioButtonEncoderAAC->setChecked((m_settings->compressionEncoder() == SettingsModel::AACEncoder) && (m_neroEncoderAvailable || m_fhgEncoderAvailable || m_qaacEncoderAvailable));
        radioButtonEncoderAC3->setChecked(m_settings->compressionEncoder() == SettingsModel::AC3Encoder);
        radioButtonEncoderFLAC->setChecked(m_settings->compressionEncoder() == SettingsModel::FLACEncoder);
        radioButtonEncoderPCM->setChecked(m_settings->compressionEncoder() == SettingsModel::PCMEncoder);
@@ -236,6 +238,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
        comboBoxAACProfile->setCurrentIndex(m_settings->aacEncProfile());
        comboBoxAftenCodingMode->setCurrentIndex(m_settings->aftenAudioCodingMode());
        comboBoxAftenDRCMode->setCurrentIndex(m_settings->aftenDynamicRangeCompression());
+       comboBoxNormalizationMode->setCurrentIndex(m_settings->normalizationFilterEqualizationMode());
        while(checkBoxBitrateManagement->isChecked() != m_settings->bitrateManagementEnabled()) checkBoxBitrateManagement->click();
        while(checkBoxNeroAAC2PassMode->isChecked() != m_settings->neroAACEnable2Pass()) checkBoxNeroAAC2PassMode->click();
        while(checkBoxAftenFastAllocation->isChecked() != m_settings->aftenFastBitAllocation()) checkBoxAftenFastAllocation->click();
@@ -244,7 +247,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
        while(checkBoxUseSystemTempFolder->isChecked() == m_settings->customTempPathEnabled()) checkBoxUseSystemTempFolder->click();
        while(checkBoxRenameOutput->isChecked() != m_settings->renameOutputFilesEnabled()) checkBoxRenameOutput->click();
        while(checkBoxForceStereoDownmix->isChecked() != m_settings->forceStereoDownmix()) checkBoxForceStereoDownmix->click();
-       checkBoxNeroAAC2PassMode->setEnabled(!m_fhgEncoderAvailable);
+       checkBoxNeroAAC2PassMode->setEnabled(!(m_fhgEncoderAvailable || m_qaacEncoderAvailable));
        lineEditCustomParamLAME->setText(m_settings->customParametersLAME());
        lineEditCustomParamOggEnc->setText(m_settings->customParametersOggEnc());
        lineEditCustomParamNeroAAC->setText(m_settings->customParametersAacEnc());
@@ -266,6 +269,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
        connect(spinBoxAftenSearchSize, SIGNAL(valueChanged(int)), this, SLOT(aftenSearchSizeChanged(int)));
        connect(checkBoxAftenFastAllocation, SIGNAL(clicked(bool)), this, SLOT(aftenFastAllocationChanged(bool)));
        connect(spinBoxNormalizationFilter, SIGNAL(valueChanged(double)), this, SLOT(normalizationMaxVolumeChanged(double)));
+       connect(comboBoxNormalizationMode, SIGNAL(currentIndexChanged(int)), this, SLOT(normalizationModeChanged(int)));
        connect(spinBoxToneAdjustBass, SIGNAL(valueChanged(double)), this, SLOT(toneAdjustBassChanged(double)));
        connect(spinBoxToneAdjustTreble, SIGNAL(valueChanged(double)), this, SLOT(toneAdjustTrebleChanged(double)));
        connect(buttonToneAdjustReset, SIGNAL(clicked()), this, SLOT(toneAdjustTrebleReset()));
@@ -357,12 +361,15 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
        actionDisableShellIntegration->setDisabled(lamexp_portable_mode() && actionDisableShellIntegration->isChecked());
        actionCheckForBetaUpdates->setChecked(m_settings->autoUpdateCheckBeta() || lamexp_version_demo());
        actionCheckForBetaUpdates->setEnabled(!lamexp_version_demo());
+       actionHibernateComputer->setChecked(m_settings->hibernateComputer());
+       actionHibernateComputer->setEnabled(lamexp_is_hibernation_supported());
        connect(actionDisableUpdateReminder, SIGNAL(triggered(bool)), this, SLOT(disableUpdateReminderActionTriggered(bool)));
        connect(actionDisableSounds, SIGNAL(triggered(bool)), this, SLOT(disableSoundsActionTriggered(bool)));
        connect(actionDisableNeroAacNotifications, SIGNAL(triggered(bool)), this, SLOT(disableNeroAacNotificationsActionTriggered(bool)));
        connect(actionDisableSlowStartupNotifications, SIGNAL(triggered(bool)), this, SLOT(disableSlowStartupNotificationsActionTriggered(bool)));
        connect(actionDisableShellIntegration, SIGNAL(triggered(bool)), this, SLOT(disableShellIntegrationActionTriggered(bool)));
        connect(actionShowDropBoxWidget, SIGNAL(triggered(bool)), this, SLOT(showDropBoxWidgetActionTriggered(bool)));
+       connect(actionHibernateComputer, SIGNAL(triggered(bool)), this, SLOT(hibernateComputerActionTriggered(bool)));
        connect(actionCheckForBetaUpdates, SIGNAL(triggered(bool)), this, SLOT(checkForBetaUpdatesActionTriggered(bool)));
        connect(actionImportCueSheet, SIGNAL(triggered(bool)), this, SLOT(importCueSheetActionTriggered(bool)));
                
@@ -490,19 +497,19 @@ void MainWindow::addFiles(const QStringList &files)
 
        if(analyzer->filesDenied())
        {
-               QMessageBox::warning(this, tr("Access Denied"), QString("<nobr>%1<br>%2</nobr>").arg(tr("%1 file(s) have been rejected, because read access was not granted!").arg(analyzer->filesDenied()), tr("This usually means the file is locked by another process.")));
+               QMessageBox::warning(this, tr("Access Denied"), QString("%1<br>%2").arg(NOBR(tr("%1 file(s) have been rejected, because read access was not granted!").arg(analyzer->filesDenied())), NOBR(tr("This usually means the file is locked by another process."))));
        }
        if(analyzer->filesDummyCDDA())
        {
-               QMessageBox::warning(this, tr("CDDA Files"), QString("<nobr>%1<br><br>%2<br>%3</nobr>").arg(tr("%1 file(s) have been rejected, because they are dummy CDDA files!").arg(analyzer->filesDummyCDDA()), tr("Sorry, LameXP cannot extract audio tracks from an Audio&minus;CD at present."), tr("We recommend using %1 for that purpose.").arg("<a href=\"http://www.exactaudiocopy.de/\">Exact Audio Copy</a>")));
+               QMessageBox::warning(this, tr("CDDA Files"), QString("%1<br><br>%2<br>%3").arg(NOBR(tr("%1 file(s) have been rejected, because they are dummy CDDA files!").arg(analyzer->filesDummyCDDA())), NOBR(tr("Sorry, LameXP cannot extract audio tracks from an Audio-CD at present.")), NOBR(tr("We recommend using %1 for that purpose.").arg("<a href=\"http://www.exactaudiocopy.de/\">Exact Audio Copy</a>"))));
        }
        if(analyzer->filesCueSheet())
        {
-               QMessageBox::warning(this, tr("Cue Sheet"), QString("<nobr>%1<br>%2</nobr>").arg(tr("%1 file(s) have been rejected, because they appear to be Cue Sheet images!").arg(analyzer->filesCueSheet()), tr("Please use LameXP's Cue Sheet wizard for importing Cue Sheet files.")));
+               QMessageBox::warning(this, tr("Cue Sheet"), QString("%1<br>%2").arg(NOBR(tr("%1 file(s) have been rejected, because they appear to be Cue Sheet images!").arg(analyzer->filesCueSheet())), NOBR(tr("Please use LameXP's Cue Sheet wizard for importing Cue Sheet files."))));
        }
        if(analyzer->filesRejected())
        {
-               QMessageBox::warning(this, tr("Files Rejected"), QString("<nobr>%1<br>%2</nobr>").arg(tr("%1 file(s) have been rejected, because the file format could not be recognized!").arg(analyzer->filesRejected()), tr("This usually means the file is damaged or the file format is not supported.")));
+               QMessageBox::warning(this, tr("Files Rejected"), QString("%1<br>%2").arg(NOBR(tr("%1 file(s) have been rejected, because the file format could not be recognized!").arg(analyzer->filesRejected())), NOBR(tr("This usually means the file is damaged or the file format is not supported."))));
        }
 
        LAMEXP_DELETE(analyzer);
@@ -656,7 +663,7 @@ void MainWindow::changeEvent(QEvent *e)
 {
        if(e->type() == QEvent::LanguageChange)
        {
-               int comboBoxIndex[5];
+               int comboBoxIndex[6];
                
                //Backup combobox indices, as retranslateUi() resets
                comboBoxIndex[0] = comboBoxMP3ChannelMode->currentIndex();
@@ -664,6 +671,7 @@ void MainWindow::changeEvent(QEvent *e)
                comboBoxIndex[2] = comboBoxAACProfile->currentIndex();
                comboBoxIndex[3] = comboBoxAftenCodingMode->currentIndex();
                comboBoxIndex[4] = comboBoxAftenDRCMode->currentIndex();
+               comboBoxIndex[5] = comboBoxNormalizationMode->currentIndex();
                
                //Re-translate from UIC
                Ui::MainWindow::retranslateUi(this);
@@ -674,6 +682,7 @@ void MainWindow::changeEvent(QEvent *e)
                comboBoxAACProfile->setCurrentIndex(comboBoxIndex[2]);
                comboBoxAftenCodingMode->setCurrentIndex(comboBoxIndex[3]);
                comboBoxAftenDRCMode->setCurrentIndex(comboBoxIndex[4]);
+               comboBoxNormalizationMode->setCurrentIndex(comboBoxIndex[5]);
 
                //Update the window title
                if(LAMEXP_DEBUG)
@@ -883,6 +892,11 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event)
        return false;
 }
 
+bool MainWindow::winEvent(MSG *message, long *result)
+{
+       return WinSevenTaskbar::handleWinEvent(message, result);
+}
+
 ////////////////////////////////////////////////////////////
 // Slots
 ////////////////////////////////////////////////////////////
@@ -923,7 +937,18 @@ void MainWindow::windowShown(void)
                        QApplication::processEvents();
                        PlaySound(MAKEINTRESOURCE(IDR_WAVE_WHAMMY), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC);
                        QMessageBox::critical(this, tr("License Declined"), tr("You have declined the license. Consequently the application will exit now!"), tr("Goodbye!"));
-                       if(!QProcess::startDetached(QString("%1/Uninstall.exe").arg(QApplication::applicationDirPath()), QStringList()))
+                       QFileInfo uninstallerInfo = QFileInfo(QString("%1/Uninstall.exe").arg(QApplication::applicationDirPath()));
+                       if(uninstallerInfo.exists())
+                       {
+                               QString uninstallerDir = uninstallerInfo.canonicalPath();
+                               QString uninstallerPath = uninstallerInfo.canonicalFilePath();
+                               for(int i = 0; i < 3; i++)
+                               {
+                                       HINSTANCE res = ShellExecuteW(this->winId(), L"open", QWCHAR(QDir::toNativeSeparators(uninstallerPath)), L"/Force", QWCHAR(QDir::toNativeSeparators(uninstallerDir)), SW_SHOWNORMAL);
+                                       if(reinterpret_cast<int>(res) > 32) break;
+                               }
+                       }
+                       else
                        {
                                MoveFileEx(QWCHAR(QDir::toNativeSeparators(QFileInfo(QApplication::applicationFilePath()).canonicalFilePath())), NULL, MOVEFILE_DELAY_UNTIL_REBOOT | MOVEFILE_REPLACE_EXISTING);
                        }
@@ -943,7 +968,7 @@ void MainWindow::windowShown(void)
                {
                        qWarning("Binary has expired !!!");
                        PlaySound(MAKEINTRESOURCE(IDR_WAVE_WHAMMY), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC);
-                       if(QMessageBox::warning(this, tr("LameXP - Expired"), QString("<nobr>%1<br>%2</nobr>").arg(tr("This demo (pre-release) version of LameXP has expired at %1.").arg(lamexp_version_expires().toString(Qt::ISODate)), tr("LameXP is free software and release versions won't expire.")), tr("Check for Updates"), tr("Exit Program")) == 0)
+                       if(QMessageBox::warning(this, tr("LameXP - Expired"), QString("%1<br>%2").arg(NOBR(tr("This demo (pre-release) version of LameXP has expired at %1.").arg(lamexp_version_expires().toString(Qt::ISODate))), NOBR(tr("LameXP is free software and release versions won't expire."))), tr("Check for Updates"), tr("Exit Program")) == 0)
                        {
                                checkForUpdates();
                        }
@@ -988,7 +1013,7 @@ void MainWindow::windowShown(void)
                QDate lastUpdateCheck = QDate::fromString(m_settings->autoUpdateLastCheck(), Qt::ISODate);
                if(!firstRun && (!lastUpdateCheck.isValid() || QDate::currentDate() >= lastUpdateCheck.addDays(14)))
                {
-                       if(QMessageBox::information(this, tr("Update Reminder"), QString("<nobr>%1</nobr>").arg(lastUpdateCheck.isValid() ? tr("Your last update check was more than 14 days ago. Check for updates now?") : tr("Your did not check for LameXP updates yet. Check for updates now?")).replace("-", "&minus;"), tr("Check for Updates"), tr("Postpone")) == 0)
+                       if(QMessageBox::information(this, tr("Update Reminder"), NOBR(lastUpdateCheck.isValid() ? tr("Your last update check was more than 14 days ago. Check for updates now?") : tr("Your did not check for LameXP updates yet. Check for updates now?")), tr("Check for Updates"), tr("Postpone")) == 0)
                        {
                                if(checkForUpdates())
                                {
@@ -1010,14 +1035,15 @@ void MainWindow::windowShown(void)
                                messageText += NOBR(tr("LameXP detected that your version of the Nero AAC encoder is outdated!")).append("<br>");
                                messageText += NOBR(tr("The current version available is %1 (or later), but you still have version %2 installed.").arg(lamexp_version2string("?.?.?.?", lamexp_toolver_neroaac(), tr("n/a")), lamexp_version2string("?.?.?.?", lamexp_tool_version("neroAacEnc.exe"), tr("n/a")))).append("<br><br>");
                                messageText += NOBR(tr("You can download the latest version of the Nero AAC encoder from the Nero website at:")).append("<br>");
-                               messageText += "<nobr><tt>" + LINK(AboutDialog::neroAacUrl) + "</tt></nobr><br>";
+                               messageText += "<nobr><tt>" + LINK(AboutDialog::neroAacUrl) + "</tt></nobr><br><br>";
+                               messageText += NOBR(tr("(Hint: Please ignore the name of the downloaded ZIP file and check the included 'changelog.txt' instead!)")).append("<br>");
                                QMessageBox::information(this, tr("AAC Encoder Outdated"), messageText);
                        }
                }
        }
        else
        {
-               if(m_settings->neroAacNotificationsEnabled() && (!m_fhgEncoderAvailable))
+               if(m_settings->neroAacNotificationsEnabled() && (!(m_fhgEncoderAvailable || m_qaacEncoderAvailable)))
                {
                        QString appPath = QDir(QCoreApplication::applicationDirPath()).canonicalPath();
                        if(appPath.isEmpty()) appPath = QCoreApplication::applicationDirPath();
@@ -1025,7 +1051,7 @@ void MainWindow::windowShown(void)
                        messageText += NOBR(tr("The Nero AAC encoder could not be found. AAC encoding support will be disabled.")).append("<br>");
                        messageText += NOBR(tr("Please put 'neroAacEnc.exe', 'neroAacDec.exe' and 'neroAacTag.exe' into the LameXP directory!")).append("<br><br>");
                        messageText += NOBR(tr("Your LameXP directory is located here:")).append("<br>");
-                       messageText += QString("<nobr><tt><a href=\"file:///%1\">%2</a></tt></nobr><br><br>").arg(QDir::toNativeSeparators(appPath), QDir::toNativeSeparators(appPath).replace("-", "&minus;"));
+                       messageText += QString("<nobr><tt>%1</tt></nobr><br><br>").arg(FSLINK(QDir::toNativeSeparators(appPath)));
                        messageText += NOBR(tr("You can download the Nero AAC encoder for free from the official Nero website at:")).append("<br>");
                        messageText += "<nobr><tt>" + LINK(AboutDialog::neroAacUrl) + "</tt></nobr><br>";
                        if(QMessageBox::information(this, tr("AAC Support Disabled"), messageText, tr("Discard"), tr("Don't Show Again")) == 1)
@@ -1087,9 +1113,12 @@ void MainWindow::windowShown(void)
  */
 void MainWindow::showAnnounceBox(void)
 {
-       QString announceText("<nobr>We are still looking for LameXP translators!<br><br>");
-       announceText.append("If you are willing to translate LameXP to your language or to complete an existing translation, please refer to:<br>");
-       announceText.append("<tt>" + LINK("http://mulder.brhack.net/public/doc/lamexp_translate.html") + "</tt></nobr><br>");
+       const QString announceText = QString("%1<br><br>%2<br><nobr><tt>%3</tt></nobr><br>").arg
+       (
+               NOBR("We are still looking for LameXP translators!"),
+               NOBR("If you are willing to translate LameXP to your language or to complete an existing translation, please refer to:"),
+               LINK("http://mulder.brhack.net/public/doc/lamexp_translate.html")
+       );
        
        QMessageBox *announceBox = new QMessageBox(QMessageBox::Warning, "We want you!", announceText, QMessageBox::NoButton, this);
        announceBox->setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
@@ -1106,7 +1135,7 @@ void MainWindow::showAnnounceBox(void)
        connect(announceTimer, SIGNAL(timeout()), button2, SLOT(hide()));
        
        announceTimer->start();
-       announceBox->exec();
+       while(announceTimer->isActive()) announceBox->exec();
        announceTimer->stop();
 
        LAMEXP_DELETE(announceTimer);
@@ -1122,15 +1151,15 @@ void MainWindow::showAnnounceBox(void)
  */
 void MainWindow::encodeButtonClicked(void)
 {
-       static const __int64 oneGigabyte = 1073741824i64; 
-       static const __int64 minimumFreeDiskspaceMultiplier = 2i64;
+       static const unsigned __int64 oneGigabyte = 1073741824ui64; 
+       static const unsigned __int64 minimumFreeDiskspaceMultiplier = 2ui64;
        static const char *writeTestBuffer = "LAMEXP_WRITE_TEST";
        
        ABORT_IF_BUSY;
 
        if(m_fileListModel->rowCount() < 1)
        {
-               QMessageBox::warning(this, tr("LameXP"), QString("<nobr>%1</nobr>").arg(tr("You must add at least one file to the list before proceeding!")));
+               QMessageBox::warning(this, tr("LameXP"), NOBR(tr("You must add at least one file to the list before proceeding!")));
                tabWidget->setCurrentIndex(0);
                return;
        }
@@ -1138,20 +1167,29 @@ void MainWindow::encodeButtonClicked(void)
        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)
+               if(QMessageBox::warning(this, tr("Not Found"), QString("%1<br><tt>%2</tt>").arg(NOBR(tr("Your currently selected TEMP folder does not exist anymore:")), NOBR(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))
+       bool ok = false;
+       unsigned __int64 currentFreeDiskspace = lamexp_free_diskspace(tempFolder, &ok);
+
+       if(ok && (currentFreeDiskspace < (oneGigabyte * minimumFreeDiskspaceMultiplier)))
        {
                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")))
+               QString lowDiskspaceMsg = QString("%1<br>%2<br><br>%3<br>%4<br>").arg
+               (
+                       NOBR(tr("There are less than %1 GB of free diskspace available on your system's TEMP folder.").arg(QString::number(minimumFreeDiskspaceMultiplier))),
+                       NOBR(tr("It is highly recommend to free up more diskspace before proceeding with the encode!")),
+                       NOBR(tr("Your TEMP folder is located at:")),
+                       QString("<nobr><tt>%1</tt></nobr>").arg(FSLINK(tempFolderParts.join("\\")))
+               );
+               switch(QMessageBox::warning(this, tr("Low Diskspace Warning"), lowDiskspaceMsg, tr("Abort Encoding Process"), tr("Clean Disk Now"), tr("Ignore")))
                {
                case 1:
                        QProcess::startDetached(QString("%1/cleanmgr.exe").arg(lamexp_known_folder(lamexp_folder_systemfolder)), QStringList() << "/D" << tempFolderParts.first());
@@ -1423,9 +1461,9 @@ void MainWindow::disableUpdateReminderActionTriggered(bool checked)
 {
        if(checked)
        {
-               if(0 == QMessageBox::question(this, tr("Disable Update Reminder"), tr("Do you really want to disable the update reminder?"), tr("Yes"), tr("No"), QString(), 1))
+               if(0 == QMessageBox::question(this, tr("Disable Update Reminder"), NOBR(tr("Do you really want to disable the update reminder?")), tr("Yes"), tr("No"), QString(), 1))
                {
-                       QMessageBox::information(this, tr("Update Reminder"), QString("%1<br>%2").arg(tr("The update reminder has been disabled."), tr("Please remember to check for updates at regular intervals!")));
+                       QMessageBox::information(this, tr("Update Reminder"), QString("%1<br>%2").arg(NOBR(tr("The update reminder has been disabled.")), NOBR(tr("Please remember to check for updates at regular intervals!"))));
                        m_settings->autoUpdateEnabled(false);
                }
                else
@@ -1435,7 +1473,7 @@ void MainWindow::disableUpdateReminderActionTriggered(bool checked)
        }
        else
        {
-                       QMessageBox::information(this, tr("Update Reminder"), tr("The update reminder has been re-enabled."));
+                       QMessageBox::information(this, tr("Update Reminder"), NOBR(tr("The update reminder has been re-enabled.")));
                        m_settings->autoUpdateEnabled(true);
        }
 
@@ -1449,9 +1487,9 @@ void MainWindow::disableSoundsActionTriggered(bool checked)
 {
        if(checked)
        {
-               if(0 == QMessageBox::question(this, tr("Disable Sound Effects"), tr("Do you really want to disable all sound effects?"), tr("Yes"), tr("No"), QString(), 1))
+               if(0 == QMessageBox::question(this, tr("Disable Sound Effects"), NOBR(tr("Do you really want to disable all sound effects?")), tr("Yes"), tr("No"), QString(), 1))
                {
-                       QMessageBox::information(this, tr("Sound Effects"), tr("All sound effects have been disabled."));
+                       QMessageBox::information(this, tr("Sound Effects"), NOBR(tr("All sound effects have been disabled.")));
                        m_settings->soundsEnabled(false);
                }
                else
@@ -1461,7 +1499,7 @@ void MainWindow::disableSoundsActionTriggered(bool checked)
        }
        else
        {
-                       QMessageBox::information(this, tr("Sound Effects"), tr("The sound effects have been re-enabled."));
+                       QMessageBox::information(this, tr("Sound Effects"), NOBR(tr("The sound effects have been re-enabled.")));
                        m_settings->soundsEnabled(true);
        }
 
@@ -1475,9 +1513,9 @@ void MainWindow::disableNeroAacNotificationsActionTriggered(bool checked)
 {
        if(checked)
        {
-               if(0 == QMessageBox::question(this, tr("Nero AAC Notifications"), tr("Do you really want to disable all Nero AAC Encoder notifications?"), tr("Yes"), tr("No"), QString(), 1))
+               if(0 == QMessageBox::question(this, tr("Nero AAC Notifications"), NOBR(tr("Do you really want to disable all Nero AAC Encoder notifications?")), tr("Yes"), tr("No"), QString(), 1))
                {
-                       QMessageBox::information(this, tr("Nero AAC Notifications"), tr("All Nero AAC Encoder notifications have been disabled."));
+                       QMessageBox::information(this, tr("Nero AAC Notifications"), NOBR(tr("All Nero AAC Encoder notifications have been disabled.")));
                        m_settings->neroAacNotificationsEnabled(false);
                }
                else
@@ -1487,7 +1525,7 @@ void MainWindow::disableNeroAacNotificationsActionTriggered(bool checked)
        }
        else
        {
-                       QMessageBox::information(this, tr("Nero AAC Notifications"), tr("The Nero AAC Encoder notifications have been re-enabled."));
+                       QMessageBox::information(this, tr("Nero AAC Notifications"), NOBR(tr("The Nero AAC Encoder notifications have been re-enabled.")));
                        m_settings->neroAacNotificationsEnabled(true);
        }
 
@@ -1495,41 +1533,15 @@ void MainWindow::disableNeroAacNotificationsActionTriggered(bool checked)
 }
 
 /*
- * Disable WMA Decoder component action
- */
-//void MainWindow::disableWmaDecoderNotificationsActionTriggered(bool checked)
-//{
-//     if(checked)
-//     {
-//             if(0 == QMessageBox::question(this, tr("WMA Decoder Notifications"), tr("Do you really want to disable all WMA Decoder notifications?"), tr("Yes"), tr("No"), QString(), 1))
-//             {
-//                     QMessageBox::information(this, tr("WMA Decoder Notifications"), tr("All WMA Decoder notifications have been disabled."));
-//                     m_settings->wmaDecoderNotificationsEnabled(false);
-//             }
-//             else
-//             {
-//                     m_settings->wmaDecoderNotificationsEnabled(true);
-//             }
-//     }
-//     else
-//     {
-//                     QMessageBox::information(this, tr("WMA Decoder Notifications"), tr("The WMA Decoder notifications have been re-enabled."));
-//                     m_settings->wmaDecoderNotificationsEnabled(true);
-//     }
-//
-//     actionDisableWmaDecoderNotifications->setChecked(!m_settings->wmaDecoderNotificationsEnabled());
-//}
-
-/*
  * Disable slow startup action
  */
 void MainWindow::disableSlowStartupNotificationsActionTriggered(bool checked)
 {
        if(checked)
        {
-               if(0 == QMessageBox::question(this, tr("Slow Startup Notifications"), tr("Do you really want to disable the slow startup notifications?"), tr("Yes"), tr("No"), QString(), 1))
+               if(0 == QMessageBox::question(this, tr("Slow Startup Notifications"), NOBR(tr("Do you really want to disable the slow startup notifications?")), tr("Yes"), tr("No"), QString(), 1))
                {
-                       QMessageBox::information(this, tr("Slow Startup Notifications"), tr("The slow startup notifications have been disabled."));
+                       QMessageBox::information(this, tr("Slow Startup Notifications"), NOBR(tr("The slow startup notifications have been disabled.")));
                        m_settings->antivirNotificationsEnabled(false);
                }
                else
@@ -1539,7 +1551,7 @@ void MainWindow::disableSlowStartupNotificationsActionTriggered(bool checked)
        }
        else
        {
-                       QMessageBox::information(this, tr("Slow Startup Notifications"), tr("The slow startup notifications have been re-enabled."));
+                       QMessageBox::information(this, tr("Slow Startup Notifications"), NOBR(tr("The slow startup notifications have been re-enabled.")));
                        m_settings->antivirNotificationsEnabled(true);
        }
 
@@ -1547,21 +1559,6 @@ void MainWindow::disableSlowStartupNotificationsActionTriggered(bool checked)
 }
 
 /*
- * Download and install WMA Decoder component
- */
-//void MainWindow::installWMADecoderActionTriggered(bool checked)
-//{
-//     if(QMessageBox::question(this, tr("Install WMA Decoder"), tr("Do you want to download and install the WMA File Decoder component now?"), tr("Download && Install"), tr("Cancel")) == 0)
-//     {
-//             if(installWMADecoder())
-//             {
-//                     QApplication::quit();
-//                     return;
-//             }
-//     }
-//}
-
-/*
  * Import a Cue Sheet file
  */
 void MainWindow::importCueSheetActionTriggered(bool checked)
@@ -1570,30 +1567,36 @@ void MainWindow::importCueSheetActionTriggered(bool checked)
        
        TEMP_HIDE_DROPBOX
        (
-               QString selectedCueFile;
-
-               if(USE_NATIVE_FILE_DIALOG)
+               while(true)
                {
-                       selectedCueFile = QFileDialog::getOpenFileName(this, tr("Open Cue Sheet"), m_settings->mostRecentInputPath(), QString("%1 (*.cue)").arg(tr("Cue Sheet File")));
-               }
-               else
-               {
-                       QFileDialog dialog(this, tr("Open Cue Sheet"));
-                       dialog.setFileMode(QFileDialog::ExistingFile);
-                       dialog.setNameFilter(QString("%1 (*.cue)").arg(tr("Cue Sheet File")));
-                       dialog.setDirectory(m_settings->mostRecentInputPath());
-                       if(dialog.exec())
+                       int result = 0;
+                       QString selectedCueFile;
+
+                       if(USE_NATIVE_FILE_DIALOG)
                        {
-                               selectedCueFile = dialog.selectedFiles().first();
+                               selectedCueFile = QFileDialog::getOpenFileName(this, tr("Open Cue Sheet"), m_settings->mostRecentInputPath(), QString("%1 (*.cue)").arg(tr("Cue Sheet File")));
+                       }
+                       else
+                       {
+                               QFileDialog dialog(this, tr("Open Cue Sheet"));
+                               dialog.setFileMode(QFileDialog::ExistingFile);
+                               dialog.setNameFilter(QString("%1 (*.cue)").arg(tr("Cue Sheet File")));
+                               dialog.setDirectory(m_settings->mostRecentInputPath());
+                               if(dialog.exec())
+                               {
+                                       selectedCueFile = dialog.selectedFiles().first();
+                               }
                        }
-               }
 
-               if(!selectedCueFile.isEmpty())
-               {
-                       m_settings->mostRecentInputPath(QFileInfo(selectedCueFile).canonicalPath());
-                       CueImportDialog *cueImporter  = new CueImportDialog(this, m_fileListModel, selectedCueFile);
-                       cueImporter->exec();
-                       LAMEXP_DELETE(cueImporter);
+                       if(!selectedCueFile.isEmpty())
+                       {
+                               m_settings->mostRecentInputPath(QFileInfo(selectedCueFile).canonicalPath());
+                               CueImportDialog *cueImporter  = new CueImportDialog(this, m_fileListModel, selectedCueFile);
+                               result = cueImporter->exec();
+                               LAMEXP_DELETE(cueImporter);
+                       }
+
+                       if(result != (-1)) break;
                }
        )
 }
@@ -1622,9 +1625,9 @@ void MainWindow::checkForBetaUpdatesActionTriggered(bool checked)
        
        if(checked)
        {
-               if(0 == QMessageBox::question(this, tr("Beta Updates"), tr("Do you really want LameXP to check for Beta (pre-release) updates?"), tr("Yes"), tr("No"), QString(), 1))
+               if(0 == QMessageBox::question(this, tr("Beta Updates"), NOBR(tr("Do you really want LameXP to check for Beta (pre-release) updates?")), tr("Yes"), tr("No"), QString(), 1))
                {
-                       if(0 == QMessageBox::information(this, tr("Beta Updates"), tr("LameXP will check for Beta (pre-release) updates from now on."), tr("Check Now"), tr("Discard")))
+                       if(0 == QMessageBox::information(this, tr("Beta Updates"), NOBR(tr("LameXP will check for Beta (pre-release) updates from now on.")), tr("Check Now"), tr("Discard")))
                        {
                                checkUpdatesNow = true;
                        }
@@ -1637,7 +1640,7 @@ void MainWindow::checkForBetaUpdatesActionTriggered(bool checked)
        }
        else
        {
-                       QMessageBox::information(this, tr("Beta Updates"), tr("LameXP will <i>not</i> check for Beta (pre-release) updates from now on."));
+                       QMessageBox::information(this, tr("Beta Updates"), NOBR(tr("LameXP will <i>not</i> check for Beta (pre-release) updates from now on.")));
                        m_settings->autoUpdateCheckBeta(false);
        }
 
@@ -1653,16 +1656,42 @@ void MainWindow::checkForBetaUpdatesActionTriggered(bool checked)
 }
 
 /*
+ * Hibernate computer action
+ */
+void MainWindow::hibernateComputerActionTriggered(bool checked)
+{
+       if(checked)
+       {
+               if(0 == QMessageBox::question(this, tr("Hibernate Computer"), NOBR(tr("Do you really want the computer to be hibernated on shutdown?")), tr("Yes"), tr("No"), QString(), 1))
+               {
+                       QMessageBox::information(this, tr("Hibernate Computer"), NOBR(tr("LameXP will hibernate the computer on shutdown from now on.")));
+                       m_settings->hibernateComputer(true);
+               }
+               else
+               {
+                       m_settings->hibernateComputer(false);
+               }
+       }
+       else
+       {
+                       QMessageBox::information(this, tr("Hibernate Computer"), NOBR(tr("LameXP will <i>not</i> hibernate the computer on shutdown from now on.")));
+                       m_settings->hibernateComputer(false);
+       }
+
+       actionHibernateComputer->setChecked(m_settings->hibernateComputer());
+}
+
+/*
  * Disable shell integration action
  */
 void MainWindow::disableShellIntegrationActionTriggered(bool checked)
 {
        if(checked)
        {
-               if(0 == QMessageBox::question(this, tr("Shell Integration"), tr("Do you really want to disable the LameXP shell integration?"), tr("Yes"), tr("No"), QString(), 1))
+               if(0 == QMessageBox::question(this, tr("Shell Integration"), NOBR(tr("Do you really want to disable the LameXP shell integration?")), tr("Yes"), tr("No"), QString(), 1))
                {
                        ShellIntegration::remove();
-                       QMessageBox::information(this, tr("Shell Integration"), tr("The LameXP shell integration has been disabled."));
+                       QMessageBox::information(this, tr("Shell Integration"), NOBR(tr("The LameXP shell integration has been disabled.")));
                        m_settings->shellIntegrationEnabled(false);
                }
                else
@@ -1673,7 +1702,7 @@ void MainWindow::disableShellIntegrationActionTriggered(bool checked)
        else
        {
                        ShellIntegration::install();
-                       QMessageBox::information(this, tr("Shell Integration"), tr("The LameXP shell integration has been re-enabled."));
+                       QMessageBox::information(this, tr("Shell Integration"), NOBR(tr("The LameXP shell integration has been re-enabled.")));
                        m_settings->shellIntegrationEnabled(true);
        }
 
@@ -1921,6 +1950,8 @@ void MainWindow::showDetailsButtonClicked(void)
        }
 
        LAMEXP_DELETE(metaInfoDialog);
+       QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
+       sourceFilesScrollbarMoved(0);
 }
 
 /*
@@ -2555,7 +2586,7 @@ void MainWindow::updateBitrate(int value)
                        labelBitrate->setText(tr("Compression %1").arg(value));
                        break;
                case SettingsModel::AC3Encoder:
-                       labelBitrate->setText(tr("Quality Level %1").arg(min(1024, max(0, value * 64))));
+                       labelBitrate->setText(tr("Quality Level %1").arg(qMin(1024, qMax(0, value * 64))));
                        break;
                case SettingsModel::PCMEncoder:
                        labelBitrate->setText(tr("Uncompressed"));
@@ -2581,7 +2612,7 @@ void MainWindow::updateBitrate(int value)
                        labelBitrate->setText(tr("Uncompressed"));
                        break;
                default:
-                       labelBitrate->setText(QString("&asymp; %1 kbps").arg(min(500, value * 8)));
+                       labelBitrate->setText(QString("&asymp; %1 kbps").arg(qMin(500, value * 8)));
                        break;
                }
                break;
@@ -2601,7 +2632,7 @@ void MainWindow::updateBitrate(int value)
                        labelBitrate->setText(tr("Uncompressed"));
                        break;
                default:
-                       labelBitrate->setText(QString("%1 kbps").arg(min(500, value * 8)));
+                       labelBitrate->setText(QString("%1 kbps").arg(qMin(500, value * 8)));
                        break;
                }
                break;
@@ -2773,6 +2804,14 @@ void MainWindow::normalizationMaxVolumeChanged(double value)
 }
 
 /*
+ * Normalization equalization mode changed
+ */
+void MainWindow::normalizationModeChanged(int mode)
+{
+       m_settings->normalizationFilterEqualizationMode(mode);
+}
+
+/*
  * Tone adjustment has changed (Bass)
  */
 void MainWindow::toneAdjustBassChanged(double value)
@@ -3004,6 +3043,7 @@ void MainWindow::resetAdvancedOptionsButtonClicked(void)
        comboBoxAACProfile->setCurrentIndex(m_settings->aacEncProfileDefault());
        comboBoxAftenCodingMode->setCurrentIndex(m_settings->aftenAudioCodingModeDefault());
        comboBoxAftenDRCMode->setCurrentIndex(m_settings->aftenDynamicRangeCompressionDefault());
+       comboBoxNormalizationMode->setCurrentIndex(m_settings->normalizationFilterEqualizationModeDefault());
        while(checkBoxBitrateManagement->isChecked() != m_settings->bitrateManagementEnabledDefault()) checkBoxBitrateManagement->click();
        while(checkBoxNeroAAC2PassMode->isChecked() != m_settings->neroAACEnable2PassDefault()) checkBoxNeroAAC2PassMode->click();
        while(checkBoxNormalizationFilter->isChecked() != m_settings->normalizationFilterEnabledDefault()) checkBoxNormalizationFilter->click();