diff --git a/LameXP.rc b/LameXP.rc
index 717933c6..46b7c7b4 100644
--- a/LameXP.rc
+++ b/LameXP.rc
@@ -109,6 +109,7 @@ IDR_WAVE_ABOUT WAVE "res\\sounds\\uuaarrgh.wav"
IDR_WAVE_SUCCESS WAVE "res\\sounds\\success.wav"
IDR_WAVE_ERROR WAVE "res\\sounds\\error.wav"
IDR_WAVE_ABORTED WAVE "res\\sounds\\aborted.wav"
+IDR_WAVE_WHAMMY WAVE "res\\sounds\\whammy.wav"
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/LameXP.vcproj b/LameXP.vcproj
index c94e5285..cbc53f41 100644
--- a/LameXP.vcproj
+++ b/LameXP.vcproj
@@ -1660,10 +1660,6 @@
/>
-
-
+
AbstractDecoder::AbstractDecoder(void)
{
}
@@ -42,3 +44,8 @@ bool AbstractDecoder::isDecoderAvailable(void)
{
return true;
}
+
+QStringList AbstractDecoder::supportedTypes(void)
+{
+ return QStringList();
+}
diff --git a/src/Decoder_Abstract.h b/src/Decoder_Abstract.h
index 0726972b..c525295e 100644
--- a/src/Decoder_Abstract.h
+++ b/src/Decoder_Abstract.h
@@ -35,5 +35,6 @@ public:
virtual bool decode(const QString &sourceFile, const QString &outputFile, volatile bool *abortFlag) = 0;
static bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion);
static bool isDecoderAvailable(void);
+ static QStringList supportedTypes(void);
};
diff --git a/src/Decoder_FLAC.cpp b/src/Decoder_FLAC.cpp
index c5297b72..5bd43c55 100644
--- a/src/Decoder_FLAC.cpp
+++ b/src/Decoder_FLAC.cpp
@@ -114,7 +114,7 @@ bool FLACDecoder::decode(const QString &sourceFile, const QString &outputFile, v
bool FLACDecoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion)
{
- if(containerType.compare("FLAC", Qt::CaseInsensitive) == 0)
+ if(containerType.compare("FLAC", Qt::CaseInsensitive) == 0 || containerType.compare("OGG", Qt::CaseInsensitive) == 0)
{
if(formatType.compare("FLAC", Qt::CaseInsensitive) == 0)
{
@@ -125,3 +125,7 @@ bool FLACDecoder::isFormatSupported(const QString &containerType, const QString
return false;
}
+QStringList FLACDecoder::supportedTypes(void)
+{
+ return QStringList() << "Free Lossless Audio Codec (*.flac *.fla)";
+}
diff --git a/src/Decoder_FLAC.h b/src/Decoder_FLAC.h
index ec111845..2728038b 100644
--- a/src/Decoder_FLAC.h
+++ b/src/Decoder_FLAC.h
@@ -31,6 +31,7 @@ public:
virtual bool decode(const QString &sourceFile, const QString &outputFile, volatile bool *abortFlag);
static bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion);
+ static QStringList supportedTypes(void);
private:
const QString m_binary;
diff --git a/src/Decoder_MP3.cpp b/src/Decoder_MP3.cpp
index 72451855..f9ea3916 100644
--- a/src/Decoder_MP3.cpp
+++ b/src/Decoder_MP3.cpp
@@ -140,3 +140,8 @@ bool MP3Decoder::isFormatSupported(const QString &containerType, const QString &
return false;
}
+QStringList MP3Decoder::supportedTypes(void)
+{
+ return QStringList() << "MPEG Audio Layer III (*.mp3 *.mpa)" << "MPEG Audio Layer II (*.mp2 *.mpa)" << "MPEG Audio Layer I ( *.mp1 *.mpa)";
+}
+
diff --git a/src/Decoder_MP3.h b/src/Decoder_MP3.h
index 6ebb7637..044298ab 100644
--- a/src/Decoder_MP3.h
+++ b/src/Decoder_MP3.h
@@ -31,6 +31,7 @@ public:
virtual bool decode(const QString &sourceFile, const QString &outputFile, volatile bool *abortFlag);
static bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion);
+ static QStringList supportedTypes(void);
private:
const QString m_binary;
diff --git a/src/Decoder_Vorbis.cpp b/src/Decoder_Vorbis.cpp
index b1cb23bf..4834728b 100644
--- a/src/Decoder_Vorbis.cpp
+++ b/src/Decoder_Vorbis.cpp
@@ -124,3 +124,7 @@ bool VorbisDecoder::isFormatSupported(const QString &containerType, const QStrin
return false;
}
+QStringList VorbisDecoder::supportedTypes(void)
+{
+ return QStringList() << "Ogg Vorbis (*.ogg *.ogm)";
+}
diff --git a/src/Decoder_Vorbis.h b/src/Decoder_Vorbis.h
index c856450e..77764126 100644
--- a/src/Decoder_Vorbis.h
+++ b/src/Decoder_Vorbis.h
@@ -31,6 +31,7 @@ public:
virtual bool decode(const QString &sourceFile, const QString &outputFile, volatile bool *abortFlag);
static bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion);
+ static QStringList supportedTypes(void);
private:
const QString m_binary;
diff --git a/src/Decoder_WMA.cpp b/src/Decoder_WMA.cpp
index b2fc93f0..ce7b10cb 100644
--- a/src/Decoder_WMA.cpp
+++ b/src/Decoder_WMA.cpp
@@ -137,3 +137,8 @@ bool WMADecoder::isDecoderAvailable(void)
{
return lamexp_check_tool("wmawav.exe");
}
+
+QStringList WMADecoder::supportedTypes(void)
+{
+ return QStringList() << "Windows Media Audio (*.wma)";
+}
diff --git a/src/Decoder_WMA.h b/src/Decoder_WMA.h
index 475dae1d..9d75ab22 100644
--- a/src/Decoder_WMA.h
+++ b/src/Decoder_WMA.h
@@ -34,6 +34,7 @@ public:
virtual bool decode(const QString &sourceFile, const QString &outputFile, volatile bool *abortFlag);
static bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion);
static bool isDecoderAvailable(void);
+ static QStringList supportedTypes(void);
private:
const QString m_binary;
diff --git a/src/Decoder_Wave.cpp b/src/Decoder_Wave.cpp
index 8a38f134..a40d9e24 100644
--- a/src/Decoder_Wave.cpp
+++ b/src/Decoder_Wave.cpp
@@ -86,3 +86,7 @@ bool WaveDecoder::isFormatSupported(const QString &containerType, const QString
return false;
}
+QStringList WaveDecoder::supportedTypes(void)
+{
+ return QStringList() << "Waveform Audio File (*.wav)";
+}
diff --git a/src/Decoder_Wave.h b/src/Decoder_Wave.h
index 53cfc893..b421f3ca 100644
--- a/src/Decoder_Wave.h
+++ b/src/Decoder_Wave.h
@@ -31,4 +31,5 @@ public:
virtual bool decode(const QString &sourceFile, const QString &outputFile, volatile bool *abortFlag);
static bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion);
+ static QStringList supportedTypes(void);
};
diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp
index 2b0c0d4b..5b4ccd02 100644
--- a/src/Dialog_MainWindow.cpp
+++ b/src/Dialog_MainWindow.cpp
@@ -35,6 +35,7 @@
#include "Model_FileList.h"
#include "Model_FileSystem.h"
#include "WinSevenTaskbar.h"
+#include "Registry_Decoder.h"
//Qt includes
#include
@@ -469,6 +470,7 @@ void MainWindow::windowShown(void)
if(iAccepted <= 0)
{
m_settings->licenseAccepted(-1);
+ PlaySound(MAKEINTRESOURCE(IDR_WAVE_WHAMMY), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC);
QMessageBox::critical(this, "License Declined", "You have declined the license. Consequently the application will exit now!");
QApplication::quit();
return;
@@ -484,6 +486,7 @@ void MainWindow::windowShown(void)
if(QDate::currentDate() >= expireDate)
{
qWarning("Binary has expired !!!");
+ PlaySound(MAKEINTRESOURCE(IDR_WAVE_WHAMMY), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC);
if(QMessageBox::warning(this, "LameXP - Expired", QString("This demo (pre-release) version of LameXP has expired at %1.\nLameXP is free software and release versions won't expire.").arg(expireDate.toString(Qt::ISODate)), "Check for Updates", "Exit Program") == 0)
{
checkUpdatesActionActivated();
@@ -540,8 +543,8 @@ void MainWindow::windowShown(void)
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 += "Your LameXP directory is located here:
";
+ messageText += QString("%1
").arg(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);
@@ -612,6 +615,7 @@ void MainWindow::encodeButtonClicked(void)
{
QStringList tempFolderParts = lamexp_temp_folder().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, "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:
@@ -674,7 +678,8 @@ void MainWindow::closeButtonClicked(void)
void MainWindow::addFilesButtonClicked(void)
{
ABORT_IF_BUSY;
- QStringList selectedFiles = QFileDialog::getOpenFileNames(this, "Add file(s)", QString(), "All supported files (*.*)");
+ QStringList fileTypeFilters = DecoderRegistry::getSupportedTypes();
+ QStringList selectedFiles = QFileDialog::getOpenFileNames(this, "Add file(s)", QString(), fileTypeFilters.join(";;"));
addFiles(selectedFiles);
}
diff --git a/src/Registry_Decoder.cpp b/src/Registry_Decoder.cpp
index 4255034d..fb353d18 100644
--- a/src/Registry_Decoder.cpp
+++ b/src/Registry_Decoder.cpp
@@ -30,8 +30,11 @@
#include "Decoder_Wave.h"
#include
+#include
+#include
#define PROBE_DECODER(DEC) if(DEC::isDecoderAvailable() && DEC::isFormatSupported(containerType, containerProfile, formatType, formatProfile, formatVersion)) { return new DEC(); }
+#define GET_FILETYPES(DEC) (DEC::isDecoderAvailable() ? DEC::supportedTypes() : QStringList())
AbstractDecoder *DecoderRegistry::lookup(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion)
{
@@ -45,3 +48,36 @@ AbstractDecoder *DecoderRegistry::lookup(const QString &containerType, const QSt
return NULL;
}
+QStringList DecoderRegistry::getSupportedTypes(void)
+{
+ QStringList types;
+
+ types << GET_FILETYPES(WaveDecoder);
+ types << GET_FILETYPES(MP3Decoder);
+ types << GET_FILETYPES(VorbisDecoder);
+ types << GET_FILETYPES(AACDecoder);
+ types << GET_FILETYPES(AC3Decoder);
+ types << GET_FILETYPES(FLACDecoder);
+ types << GET_FILETYPES(WMADecoder);
+
+ QStringList extensions;
+ QRegExp regExp("\\((.+)\\)", Qt::CaseInsensitive);
+
+ for(int i = 0; i < types.count(); i++)
+ {
+ if(regExp.lastIndexIn(types.at(i)) >= 0)
+ {
+ extensions << regExp.cap(1).split(" ", QString::SkipEmptyParts);
+ }
+ }
+
+ if(!extensions.empty())
+ {
+ extensions.removeDuplicates();
+ extensions.sort();
+ types.prepend(QString("All supported types (%1)").arg(extensions.join(" ")));
+ }
+
+ types << "All files (*.*)";
+ return types;
+}
diff --git a/src/Registry_Decoder.h b/src/Registry_Decoder.h
index d7572e4f..75cca4e0 100644
--- a/src/Registry_Decoder.h
+++ b/src/Registry_Decoder.h
@@ -22,10 +22,12 @@
#pragma once
class QString;
+class QStringList;
class AbstractDecoder;
class DecoderRegistry
{
public:
static AbstractDecoder *lookup(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion);
+ static QStringList DecoderRegistry::getSupportedTypes(void);
};
diff --git a/src/Resource.h b/src/Resource.h
index 9aeb6bf2..d99ab915 100644
--- a/src/Resource.h
+++ b/src/Resource.h
@@ -29,6 +29,7 @@
#define IDR_WAVE_SUCCESS 667
#define IDR_WAVE_ERROR 668
#define IDR_WAVE_ABORTED 669
+#define IDR_WAVE_WHAMMY 670
/*
* Next default values for new objects