From: lordmulder Date: Sun, 19 Dec 2010 20:23:43 +0000 (+0100) Subject: Added options to disable the notifications for the Nero AAC encoder and the WMA Decod... X-Git-Tag: Release_400~136 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=10cffb46e55d62e86e155375a359c4e53d893b7a;p=lamexp%2FLameXP.git Added options to disable the notifications for the Nero AAC encoder and the WMA Decoder component, as some users may want to use LameXP without AAC and/or WMA support permanently. --- diff --git a/gui/MainWindow.ui b/gui/MainWindow.ui index fa2e5f31..bc53f5bb 100644 --- a/gui/MainWindow.ui +++ b/gui/MainWindow.ui @@ -1196,6 +1196,8 @@ + + @@ -1379,6 +1381,22 @@ Install WMA Decoder + + + true + + + Disable Nero AAC Notifications + + + + + true + + + Disable WMA Decoder Notifications + + @@ -1478,6 +1496,10 @@ + + + + diff --git a/src/Config.h b/src/Config.h index 5fa117f8..2194f0e9 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 0 -#define VER_LAMEXP_BUILD 167 +#define VER_LAMEXP_BUILD 170 #define VER_LAMEXP_SUFFIX TechPreview /* diff --git a/src/Dialog_About.cpp b/src/Dialog_About.cpp index 6f812d0b..7ddd00c9 100644 --- a/src/Dialog_About.cpp +++ b/src/Dialog_About.cpp @@ -61,8 +61,8 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta aboutText += "

LameXP - Audio Encoder Front-end

"; aboutText += QString("Copyright (C) 2004-%1 LoRd_MuldeR <MuldeR2@GMX.de>. Some rights reserved.
").arg(max(lamexp_version_date().year(),QDate::currentDate().year())); aboutText += QString().sprintf("Version %d.%02d %s, Build %d [%s]

", lamexp_version_major(), lamexp_version_minor(), lamexp_version_release(), lamexp_version_build(), lamexp_version_date().toString(Qt::ISODate).toLatin1().constData()); - aboutText += "Please visit the official web-site at "; - aboutText += LINK("http://mulder.dummwiedeutsch.de/") += " for news and updates!
"; + aboutText += "Please visit "; //the official web-site at + aboutText += LINK("http://forum.doom9.org/showthread.php?t=157726") += " for news and updates!
"; //LINK("http://mulder.dummwiedeutsch.de/") aboutText += "

"; aboutText += "This program is free software; you can redistribute it and/or
"; aboutText += "modify it under the terms of the GNU General Public License
"; diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp index 12ab4572..2b0c0d4b 100644 --- a/src/Dialog_MainWindow.cpp +++ b/src/Dialog_MainWindow.cpp @@ -251,9 +251,13 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S //Activate tools menu actions actionDisableUpdateReminder->setChecked(!m_settings->autoUpdateEnabled()); actionDisableSounds->setChecked(!m_settings->soundsEnabled()); + actionDisableNeroAacNotifications->setChecked(!m_settings->neroAacNotificationsEnabled()); + actionDisableWmaDecoderNotifications->setChecked(!m_settings->wmaDecoderNotificationsEnabled()); connect(actionDisableUpdateReminder, SIGNAL(triggered(bool)), this, SLOT(disableUpdateReminderActionTriggered(bool))); connect(actionDisableSounds, SIGNAL(triggered(bool)), this, SLOT(disableSoundsActionTriggered(bool))); connect(actionInstallWMADecoder, SIGNAL(triggered(bool)), this, SLOT(installWMADecoderActionTriggered(bool))); + connect(actionDisableNeroAacNotifications, SIGNAL(triggered(bool)), this, SLOT(disableNeroAacNotificationsActionTriggered(bool))); + connect(actionDisableWmaDecoderNotifications, SIGNAL(triggered(bool)), this, SLOT(disableWmaDecoderNotificationsActionTriggered(bool))); //Activate help menu actions connect(actionCheckUpdates, SIGNAL(triggered()), this, SLOT(checkUpdatesActionActivated())); @@ -516,39 +520,45 @@ void MainWindow::windowShown(void) } //Check for AAC support - if(lamexp_check_tool("neroAacEnc.exe") && lamexp_check_tool("neroAacDec.exe") && lamexp_check_tool("neroAacTag.exe")) + if(m_settings->neroAacNotificationsEnabled()) { - if(lamexp_tool_version("neroAacEnc.exe") < lamexp_toolver_neroaac()) + if(lamexp_check_tool("neroAacEnc.exe") && lamexp_check_tool("neroAacDec.exe") && lamexp_check_tool("neroAacTag.exe")) { + if(lamexp_tool_version("neroAacEnc.exe") < lamexp_toolver_neroaac()) + { + QString messageText; + messageText += "
LameXP detected that your version of the Nero AAC encoder is outdated!
"; + messageText += "The current version available is " + lamexp_version2string("?.?.?.?", lamexp_toolver_neroaac()) + " (or later), but you still have version " + lamexp_version2string("?.?.?.?", lamexp_tool_version("neroAacEnc.exe")) + " installed.

"; + messageText += "You can download the latest version of the Nero AAC encoder from the Nero website at:
"; + messageText += "" + LINK(AboutDialog::neroAacUrl) + "
"; + QMessageBox::information(this, "AAC Encoder Outdated", messageText); + } + } + else + { + radioButtonEncoderAAC->setEnabled(false); QString messageText; - messageText += "LameXP detected that your version of the Nero AAC encoder is outdated!
"; - messageText += "The current version available is " + lamexp_version2string("?.?.?.?", lamexp_toolver_neroaac()) + " (or later), but you still have version " + lamexp_version2string("?.?.?.?", lamexp_tool_version("neroAacEnc.exe")) + " installed.

"; - messageText += "You can download the latest version of the Nero AAC encoder from the Nero website at:
"; + messageText += "
The Nero AAC encoder could not be found. AAC encoding support will be disabled.
"; + messageText += "Please put 'neroAacEnc.exe', 'neroAacDec.exe' and 'neroAacTag.exe' into the LameXP directory!

"; + messageText += "Your LameXP directory is as follows:
"; + messageText += "
" + QDir::toNativeSeparators(QCoreApplication::applicationDirPath()) + "

"; + messageText += "You can download the Nero AAC encoder for free from the official Nero website at:
"; messageText += "" + LINK(AboutDialog::neroAacUrl) + "
"; - QMessageBox::information(this, "AAC Encoder Outdated", messageText); + QMessageBox::information(this, "AAC Support Disabled", messageText); } } - else - { - radioButtonEncoderAAC->setEnabled(false); - QString messageText; - messageText += "The Nero AAC encoder could not be found. AAC encoding support will be disabled.
"; - messageText += "Please put 'neroAacEnc.exe', 'neroAacDec.exe' and 'neroAacTag.exe' into the LameXP directory!

"; - messageText += "Your LameXP directory is as follows:
"; - messageText += "
" + QDir::toNativeSeparators(QCoreApplication::applicationDirPath()) + "

"; - messageText += "You can download the Nero AAC encoder for free from the official Nero website at:
"; - messageText += "" + LINK(AboutDialog::neroAacUrl) + "
"; - QMessageBox::information(this, "AAC Support Disabled", messageText); - } //Check for WMA support - if(!lamexp_check_tool("wmawav.exe")) + if(m_settings->wmaDecoderNotificationsEnabled()) { - QString messageText; - messageText += "LameXP has detected that the WMA File Decoder component is not currently installed on your system.
"; - messageText += "You won't be able to process WMA files as input unless the WMA File Decoder component is installed!
"; - QMessageBox::information(this, "WMA Decoder Missing", messageText); - installWMADecoderActionTriggered(rand() % 2); + if(!lamexp_check_tool("wmawav.exe")) + { + QString messageText; + messageText += "LameXP has detected that the WMA File Decoder component is not currently installed on your system.
"; + messageText += "You won't be able to process WMA files as input unless the WMA File Decoder component is installed!
"; + QMessageBox::information(this, "WMA Decoder Missing", messageText); + installWMADecoderActionTriggered(rand() % 2); + } } //Add files from the command-line @@ -585,7 +595,7 @@ void MainWindow::aboutButtonClicked(void) void MainWindow::encodeButtonClicked(void) { static const __int64 oneGigabyte = 1073741824; - static const __int64 minimumFreeDiskspaceMultiplier = 222; + static const __int64 minimumFreeDiskspaceMultiplier = 2; ABORT_IF_BUSY; @@ -596,13 +606,22 @@ void MainWindow::encodeButtonClicked(void) return; } - if(lamexp_free_diskspace(lamexp_temp_folder()) < (oneGigabyte * minimumFreeDiskspaceMultiplier)) + __int64 currentFreeDiskspace = lamexp_free_diskspace(lamexp_temp_folder()); + + if(currentFreeDiskspace < (oneGigabyte * minimumFreeDiskspaceMultiplier)) { - QDir tempFolder(lamexp_temp_folder()); - tempFolder.cdUp(); - if(QMessageBox::warning(this, "Low Diskspace Warning", QString("Warning: There are less than %1 GB of free diskspace available on your system's TEMP folder!

Your TEMP folder is located at:
%2").arg(QString::number(minimumFreeDiskspaceMultiplier), tempFolder.path()), "Abort Process (Recommended)", "Ignore") != 1) + QStringList tempFolderParts = lamexp_temp_folder().split("/", QString::SkipEmptyParts, Qt::CaseInsensitive); + tempFolderParts.takeLast(); + switch(QMessageBox::warning(this, "Low Diskspace Warning", QString("There are less than %1 GB of free diskspace available on your system's TEMP folder.
It is highly recommend to free up more diskspace before proceeding with the encode!.

Your TEMP folder is located at:
%3
").arg(QString::number(minimumFreeDiskspaceMultiplier), tempFolderParts.join("\\")), "Abort Encoding Process", "Clean Disk Now", "Ignore")) { + case 1: + QProcess::startDetached(QString("%1/cleanmgr.exe").arg(lamexp_known_folder(lamexp_folder_systemfolder)), QStringList() << "/D" << tempFolderParts.first()); + case 0: return; + break; + default: + QMessageBox::warning(this, "Low Diskspace", "You are proceeding with low diskspace. Problems might occur!"); + break; } } @@ -1454,6 +1473,61 @@ void MainWindow::disableSoundsActionTriggered(bool checked) actionDisableSounds->setChecked(!m_settings->soundsEnabled()); } +/* + * Disable Nero AAC encoder action + */ +void MainWindow::disableNeroAacNotificationsActionTriggered(bool checked) +{ + if(checked) + { + if(QMessageBox::Yes == QMessageBox::question(this, "Nero AAC Notifications", "Do you really want to disable all Nero AAC Encoder notifications?", QMessageBox::Yes | QMessageBox::No, QMessageBox::No)) + { + QMessageBox::information(this, "Nero AAC Notifications", "All Nero AAC Encoder notifications have been disabled."); + m_settings->neroAacNotificationsEnabled(false); + } + else + { + m_settings->neroAacNotificationsEnabled(true); + } + } + else + { + QMessageBox::information(this, "Nero AAC Notifications", "The Nero AAC Encoder notifications have been re-enabled."); + m_settings->neroAacNotificationsEnabled(true); + } + + actionDisableNeroAacNotifications->setChecked(!m_settings->neroAacNotificationsEnabled()); +} + +/* + * Disable WMA Decoder component action + */ +void MainWindow::disableWmaDecoderNotificationsActionTriggered(bool checked) +{ + if(checked) + { + if(QMessageBox::Yes == QMessageBox::question(this, "WMA Decoder Notifications", "Do you really want to disable all WMA Decoder notifications?", QMessageBox::Yes | QMessageBox::No, QMessageBox::No)) + { + QMessageBox::information(this, "WMA Decoder Notifications", "All WMA Decoder notifications have been disabled."); + m_settings->wmaDecoderNotificationsEnabled(false); + } + else + { + m_settings->wmaDecoderNotificationsEnabled(true); + } + } + else + { + QMessageBox::information(this, "WMA Decoder Notifications", "The WMA Decoder notifications have been re-enabled."); + m_settings->wmaDecoderNotificationsEnabled(true); + } + + actionDisableWmaDecoderNotifications->setChecked(!m_settings->wmaDecoderNotificationsEnabled()); +} + +/* + * Download and install WMA Decoder component + */ void MainWindow::installWMADecoderActionTriggered(bool checked) { static const char *download_url = "http://www.nch.com.au/components/wmawav.exe"; diff --git a/src/Dialog_MainWindow.h b/src/Dialog_MainWindow.h index 58cb71b9..bdb684af 100644 --- a/src/Dialog_MainWindow.h +++ b/src/Dialog_MainWindow.h @@ -89,6 +89,8 @@ private slots: void outputFolderContextMenu(const QPoint &pos); void showFolderContextActionTriggered(void); void installWMADecoderActionTriggered(bool checked); + void disableNeroAacNotificationsActionTriggered(bool checked); + void disableWmaDecoderNotificationsActionTriggered(bool checked); protected: void showEvent(QShowEvent *event); diff --git a/src/Encoder_Wave.cpp b/src/Encoder_Wave.cpp index f4d834c9..ea9ee657 100644 --- a/src/Encoder_Wave.cpp +++ b/src/Encoder_Wave.cpp @@ -42,13 +42,23 @@ WaveEncoder::~WaveEncoder(void) bool WaveEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag) { - emit messageLogged(QString("Moving file \"%1\" to \"%2\"").arg(sourceFile, outputFile)); - SHFILEOPSTRUCTW fileOperation; memset(&fileOperation, 0, sizeof(SHFILEOPSTRUCTW)); - fileOperation.wFunc = FO_MOVE; fileOperation.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR | FOF_NOERRORUI | FOF_FILESONLY; + 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 + emit messageLogged(QString("Moving file \"%1\" to \"%2\"").arg(sourceFile, outputFile)); + fileOperation.wFunc = FO_MOVE; + } + else + { + //...otherwise we actually copy the file in order to keep the source + 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]; memset(srcBuffer, 0, srcLen * sizeof(wchar_t)); diff --git a/src/Global.cpp b/src/Global.cpp index efcefc75..6e8b6958 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -832,9 +832,11 @@ QString lamexp_known_folder(lamexp_known_folder_t folder_id) static const int CSIDL_LOCAL_APPDATA = 0x001c; static const int CSIDL_PROGRAM_FILES = 0x0026; + static const int CSIDL_SYSTEM_FOLDER = 0x0025; static const GUID GUID_LOCAL_APPDATA = {0xF1B32785,0x6FBA,0x4FCF,{0x9D,0x55,0x7B,0x8E,0x7F,0x15,0x70,0x91}}; static const GUID GUID_LOCAL_APPDATA_LOW = {0xA520A1A4,0x1780,0x4FF6,{0xBD,0x18,0x16,0x73,0x43,0xC5,0xAF,0x16}}; static const GUID GUID_PROGRAM_FILES = {0x905e63b6,0xc1bf,0x494e,{0xb2,0x9c,0x65,0xb7,0x32,0xd3,0xd2,0x1a}}; + static const GUID GUID_SYSTEM_FOLDER = {0x1AC14E77,0x02E7,0x4E5D,{0xB7,0x44,0x2E,0xB1,0xAE,0x51,0x98,0xB7}}; static QLibrary *Kernel32Lib = NULL; static SHGetKnownFolderPathFun SHGetKnownFolderPathPtr = NULL; @@ -860,6 +862,10 @@ QString lamexp_known_folder(lamexp_known_folder_t folder_id) folderCSIDL = CSIDL_PROGRAM_FILES; folderGUID = GUID_PROGRAM_FILES; break; + case lamexp_folder_systemfolder: + folderCSIDL = CSIDL_SYSTEM_FOLDER; + folderGUID = GUID_SYSTEM_FOLDER; + break; default: return QString(); break; diff --git a/src/Global.h b/src/Global.h index 6241bebf..81849019 100644 --- a/src/Global.h +++ b/src/Global.h @@ -60,7 +60,8 @@ lamexp_cpu_t; typedef enum { lamexp_folder_localappdata = 0, - lamexp_folder_programfiles = 1 + lamexp_folder_programfiles = 2, + lamexp_folder_systemfolder = 3 } lamexp_known_folder_t; diff --git a/src/Model_Settings.cpp b/src/Model_Settings.cpp index deebff9a..4e70b5d6 100644 --- a/src/Model_Settings.cpp +++ b/src/Model_Settings.cpp @@ -44,6 +44,8 @@ static const char *g_settingsId_createPlaylist = "Flags/AutoCreatePlaylist"; static const char *g_settingsId_autoUpdateLastCheck = "AutoUpdate/LastCheck"; static const char *g_settingsId_autoUpdateEnabled = "AutoUpdate/Enabled"; static const char *g_settingsId_soundsEnabled = "Flags/EnableSounds"; +static const char *g_settingsId_neroAacNotificationsEnabled = "Flags/EnableNeroAacNotifications"; +static const char *g_settingsId_wmaDecoderNotificationsEnabled = "Flags/EnableWmaDecoderNotifications"; //Macros #define MAKE_OPTION1(OPT,DEF) \ @@ -128,3 +130,5 @@ MAKE_OPTION3(createPlaylist, true) MAKE_OPTION2(autoUpdateLastCheck, "Never") MAKE_OPTION3(autoUpdateEnabled, true) MAKE_OPTION3(soundsEnabled, true) +MAKE_OPTION3(neroAacNotificationsEnabled, true) +MAKE_OPTION3(wmaDecoderNotificationsEnabled, true) diff --git a/src/Model_Settings.h b/src/Model_Settings.h index 51c1caf2..962a85d9 100644 --- a/src/Model_Settings.h +++ b/src/Model_Settings.h @@ -75,6 +75,8 @@ public: MAKE_OPTION_DEC2(autoUpdateLastCheck); MAKE_OPTION_DEC3(autoUpdateEnabled); MAKE_OPTION_DEC3(soundsEnabled); + MAKE_OPTION_DEC3(neroAacNotificationsEnabled) + MAKE_OPTION_DEC3(wmaDecoderNotificationsEnabled) //Misc void validate(void);