Filename filter for supported types in "Add file(s)" dialog.
This commit is contained in:
parent
6c139ab640
commit
658efda273
@ -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"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -1660,10 +1660,6 @@
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\res\sounds\uuaarrgh.wav"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Dialogs"
|
||||
|
BIN
res/sounds/whammy.wav
Normal file
BIN
res/sounds/whammy.wav
Normal file
Binary file not shown.
@ -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 171
|
||||
#define VER_LAMEXP_BUILD 174
|
||||
#define VER_LAMEXP_SUFFIX TechPreview
|
||||
|
||||
/*
|
||||
|
@ -117,9 +117,10 @@ bool AACDecoder::isFormatSupported(const QString &containerType, const QString &
|
||||
{
|
||||
if(formatType.compare("AAC", Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
if(formatProfile.compare("LC", Qt::CaseInsensitive) == 0 || formatProfile.compare("HE", Qt::CaseInsensitive) == 0)
|
||||
QStringList profileParts = formatProfile.split(" ", QString::SkipEmptyParts);
|
||||
if(profileParts.contains("LC", Qt::CaseInsensitive) || profileParts.contains("HE-AAC", Qt::CaseInsensitive) || profileParts.contains("HE-AACv2", Qt::CaseInsensitive))
|
||||
{
|
||||
if(formatVersion.compare("Version 2", Qt::CaseInsensitive) == 0 || formatVersion.compare("Version 4", Qt::CaseInsensitive) == 0)
|
||||
if(formatVersion.compare("Version 2", Qt::CaseInsensitive) == 0 || formatVersion.compare("Version 4", Qt::CaseInsensitive) == 0 || formatVersion.isEmpty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -130,3 +131,7 @@ bool AACDecoder::isFormatSupported(const QString &containerType, const QString &
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList AACDecoder::supportedTypes(void)
|
||||
{
|
||||
return QStringList() << "Advanced Audio Coding (*.aac *.mp4)";
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -138,3 +138,8 @@ bool AC3Decoder::isFormatSupported(const QString &containerType, const QString &
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList AC3Decoder::supportedTypes(void)
|
||||
{
|
||||
return QStringList() << "AC-3 aka ATSC A/52 (*.ac3)" << "Digital Theater System (*.dts)";
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
#include "Decoder_Abstract.h"
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
AbstractDecoder::AbstractDecoder(void)
|
||||
{
|
||||
}
|
||||
@ -42,3 +44,8 @@ bool AbstractDecoder::isDecoderAvailable(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
QStringList AbstractDecoder::supportedTypes(void)
|
||||
{
|
||||
return QStringList();
|
||||
}
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
|
@ -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)";
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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)";
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -124,3 +124,7 @@ bool VorbisDecoder::isFormatSupported(const QString &containerType, const QStrin
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList VorbisDecoder::supportedTypes(void)
|
||||
{
|
||||
return QStringList() << "Ogg Vorbis (*.ogg *.ogm)";
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -137,3 +137,8 @@ bool WMADecoder::isDecoderAvailable(void)
|
||||
{
|
||||
return lamexp_check_tool("wmawav.exe");
|
||||
}
|
||||
|
||||
QStringList WMADecoder::supportedTypes(void)
|
||||
{
|
||||
return QStringList() << "Windows Media Audio (*.wma)";
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -86,3 +86,7 @@ bool WaveDecoder::isFormatSupported(const QString &containerType, const QString
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList WaveDecoder::supportedTypes(void)
|
||||
{
|
||||
return QStringList() << "Waveform Audio File (*.wav)";
|
||||
}
|
||||
|
@ -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);
|
||||
};
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "Model_FileList.h"
|
||||
#include "Model_FileSystem.h"
|
||||
#include "WinSevenTaskbar.h"
|
||||
#include "Registry_Decoder.h"
|
||||
|
||||
//Qt includes
|
||||
#include <QMessageBox>
|
||||
@ -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 += "<nobr>The Nero AAC encoder could not be found. AAC encoding support will be disabled.<br>";
|
||||
messageText += "Please put 'neroAacEnc.exe', 'neroAacDec.exe' and 'neroAacTag.exe' into the LameXP directory!<br><br>";
|
||||
messageText += "Your LameXP directory is as follows:<br>";
|
||||
messageText += "<i><nobr>" + QDir::toNativeSeparators(QCoreApplication::applicationDirPath()) + "</nobr></i><br><br>";
|
||||
messageText += "Your LameXP directory is located here:<br>";
|
||||
messageText += QString("<i><nobr><a href=\"file:///%1\">%1</a></nobr></i><br><br>").arg(QDir::toNativeSeparators(QCoreApplication::applicationDirPath()));
|
||||
messageText += "You can download the Nero AAC encoder for free from the official Nero website at:<br>";
|
||||
messageText += "<b>" + LINK(AboutDialog::neroAacUrl) + "</b><br></nobr>";
|
||||
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("<nobr>There are less than %1 GB of free diskspace available on your system's TEMP folder.</nobr><br><nobr>It is highly recommend to free up more diskspace before proceeding with the encode!.</nobr><br><br>Your TEMP folder is located at:<br><nobr><i><a href=\"file:///%3\">%3</a></i></nobr><br>").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);
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,11 @@
|
||||
#include "Decoder_Wave.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QRegExp>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
@ -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);
|
||||
};
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user