#define VER_LAMEXP_MINOR_LO 1
#define VER_LAMEXP_TYPE Beta
#define VER_LAMEXP_PATCH 9
-#define VER_LAMEXP_BUILD 1636
+#define VER_LAMEXP_BUILD 1638
#define VER_LAMEXP_CONFG 1558
///////////////////////////////////////////////////////////////////////////////
AACDecoder::AACDecoder(void)
:
- m_binary(lamexp_lookup_tool("faad.exe"))
+ m_binary(lamexp_tool_lookup("faad.exe"))
{
if(m_binary.isEmpty())
{
AC3Decoder::AC3Decoder(void)
:
- m_binary(lamexp_lookup_tool("valdec.exe"))
+ m_binary(lamexp_tool_lookup("valdec.exe"))
{
if(m_binary.isEmpty())
{
ADPCMDecoder::ADPCMDecoder(void)
:
- m_binary(lamexp_lookup_tool("sox.exe"))
+ m_binary(lamexp_tool_lookup("sox.exe"))
{
if(m_binary.isEmpty())
{
ALACDecoder::ALACDecoder(void)
:
- m_binary(lamexp_lookup_tool("refalac.exe"))
+ m_binary(lamexp_tool_lookup("refalac.exe"))
{
if(m_binary.isEmpty())
{
AvisynthDecoder::AvisynthDecoder(void)
:
- m_binary(lamexp_lookup_tool("avs2wav.exe"))
+ m_binary(lamexp_tool_lookup("avs2wav.exe"))
{
if(m_binary.isEmpty())
{
FLACDecoder::FLACDecoder(void)
:
- m_binary(lamexp_lookup_tool("flac.exe"))
+ m_binary(lamexp_tool_lookup("flac.exe"))
{
if(m_binary.isEmpty())
{
MACDecoder::MACDecoder(void)
:
- m_binary(lamexp_lookup_tool("mac.exe"))
+ m_binary(lamexp_tool_lookup("mac.exe"))
{
if(m_binary.isEmpty())
{
MP3Decoder::MP3Decoder(void)
:
- m_binary(lamexp_lookup_tool("mpg123.exe"))
+ m_binary(lamexp_tool_lookup("mpg123.exe"))
{
if(m_binary.isEmpty())
{
MusepackDecoder::MusepackDecoder(void)
:
- m_binary(lamexp_lookup_tool("mpcdec.exe"))
+ m_binary(lamexp_tool_lookup("mpcdec.exe"))
{
if(m_binary.isEmpty())
{
OpusDecoder::OpusDecoder(void)
:
- m_binary(lamexp_lookup_tool("opusdec.exe"))
+ m_binary(lamexp_tool_lookup("opusdec.exe"))
{
if(m_binary.isEmpty())
{
ShortenDecoder::ShortenDecoder(void)
:
- m_binary(lamexp_lookup_tool("shorten.exe"))
+ m_binary(lamexp_tool_lookup("shorten.exe"))
{
if(m_binary.isEmpty())
{
SpeexDecoder::SpeexDecoder(void)
:
- m_binary(lamexp_lookup_tool("speexdec.exe"))
+ m_binary(lamexp_tool_lookup("speexdec.exe"))
{
if(m_binary.isEmpty())
{
TTADecoder::TTADecoder(void)
:
- m_binary(lamexp_lookup_tool("tta.exe"))
+ m_binary(lamexp_tool_lookup("tta.exe"))
{
if(m_binary.isEmpty())
{
VorbisDecoder::VorbisDecoder(void)
:
- m_binary(lamexp_lookup_tool("oggdec.exe"))
+ m_binary(lamexp_tool_lookup("oggdec.exe"))
{
if(m_binary.isEmpty())
{
WMADecoder::WMADecoder(void)
:
- m_binary(lamexp_lookup_tool("wma2wav.exe"))
+ m_binary(lamexp_tool_lookup("wma2wav.exe"))
{
if(m_binary.isEmpty())
{
WavPackDecoder::WavPackDecoder(void)
:
- m_binary(lamexp_lookup_tool("wvunpack.exe"))
+ m_binary(lamexp_tool_lookup("wvunpack.exe"))
{
if(m_binary.isEmpty())
{
QStringList codecList;
codecList.append(systemDefault);
- codecList.append(lamexp_available_codepages());
+ codecList.append(MUtils::available_codepages());
QInputDialog *input = new QInputDialog(progress);
input->setLabelText(EXPAND(tr("Select ANSI Codepage for Cue Sheet file:")));
ui->actionDisableNeroAacNotifications->setChecked(!m_settings->neroAacNotificationsEnabled());
ui->actionDisableSlowStartupNotifications->setChecked(!m_settings->antivirNotificationsEnabled());
ui->actionDisableShellIntegration->setChecked(!m_settings->shellIntegrationEnabled());
- ui->actionDisableShellIntegration->setDisabled(lamexp_portable_mode() && ui->actionDisableShellIntegration->isChecked());
+ ui->actionDisableShellIntegration->setDisabled(lamexp_version_portable() && ui->actionDisableShellIntegration->isChecked());
ui->actionCheckForBetaUpdates->setChecked(m_settings->autoUpdateCheckBeta() || lamexp_version_demo());
ui->actionCheckForBetaUpdates->setEnabled(!lamexp_version_demo());
ui->actionHibernateComputer->setChecked(m_settings->hibernateComputer());
ui->actionDisableShellIntegration->setChecked(!m_settings->shellIntegrationEnabled());
- if(lamexp_portable_mode() && ui->actionDisableShellIntegration->isChecked())
+ if(lamexp_version_portable() && ui->actionDisableShellIntegration->isChecked())
{
ui->actionDisableShellIntegration->setEnabled(false);
}
*/
void MainWindow::showCustomParamsHelpScreen(const QString &toolName, const QString &command)
{
- const QString binary = lamexp_lookup_tool(toolName);
+ const QString binary = lamexp_tool_lookup(toolName);
if(binary.isEmpty())
{
MUtils::Sound::beep(MUtils::Sound::BEEP_ERR);
m_firstShow(true),
m_updateReadyToInstall(false),
m_updaterProcess(NULL),
- m_binaryUpdater(lamexp_lookup_tool("wupdate.exe")),
- m_binaryWGet(lamexp_lookup_tool("wget.exe")),
- m_binaryGnuPG(lamexp_lookup_tool("gpgv.exe")),
- m_binaryKeys(lamexp_lookup_tool("gpgv.gpg"))
+ m_binaryUpdater(lamexp_tool_lookup("wupdate.exe")),
+ m_binaryWGet(lamexp_tool_lookup("wget.exe")),
+ m_binaryGnuPG(lamexp_tool_lookup("gpgv.exe")),
+ m_binaryKeys(lamexp_tool_lookup("gpgv.gpg"))
{
if(m_binaryUpdater.isEmpty())
{
AACEncoder::AACEncoder(void)
:
- m_binary_enc(lamexp_lookup_tool("neroAacEnc.exe")),
- m_binary_tag(lamexp_lookup_tool("neroAacTag.exe")),
- m_binary_sox(lamexp_lookup_tool("sox.exe"))
+ m_binary_enc(lamexp_tool_lookup("neroAacEnc.exe")),
+ m_binary_tag(lamexp_tool_lookup("neroAacTag.exe")),
+ m_binary_sox(lamexp_tool_lookup("sox.exe"))
{
if(m_binary_enc.isEmpty() || m_binary_tag.isEmpty() || m_binary_sox.isEmpty())
{
FHGAACEncoder::FHGAACEncoder(void)
:
- m_binary_enc(lamexp_lookup_tool("fhgaacenc.exe")),
- m_binary_dll(lamexp_lookup_tool("enc_fhgaac.dll"))
+ m_binary_enc(lamexp_tool_lookup("fhgaacenc.exe")),
+ m_binary_dll(lamexp_tool_lookup("enc_fhgaac.dll"))
{
if(m_binary_enc.isEmpty() || m_binary_dll.isEmpty())
{
QAACEncoder::QAACEncoder(void)
:
- m_binary_qaac(lamexp_lookup_tool("qaac.exe")),
- m_binary_soxr(lamexp_lookup_tool("libsoxr.dll")),
- m_binary_soxc(lamexp_lookup_tool("libsoxconvolver.dll"))
+ m_binary_qaac(lamexp_tool_lookup("qaac.exe")),
+ m_binary_soxr(lamexp_tool_lookup("libsoxr.dll")),
+ m_binary_soxc(lamexp_tool_lookup("libsoxconvolver.dll"))
{
if(m_binary_qaac.isEmpty() || m_binary_soxr.isEmpty() || m_binary_soxc.isEmpty())
{
AC3Encoder::AC3Encoder(void)
:
- m_binary(lamexp_lookup_tool("aften.exe"))
+ m_binary(lamexp_tool_lookup("aften.exe"))
{
if(m_binary.isEmpty())
{
DCAEncoder::DCAEncoder(void)
:
- m_binary(lamexp_lookup_tool("dcaenc.exe"))
+ m_binary(lamexp_tool_lookup("dcaenc.exe"))
{
if(m_binary.isEmpty())
{
FLACEncoder::FLACEncoder(void)
:
- m_binary(lamexp_lookup_tool("flac.exe"))
+ m_binary(lamexp_tool_lookup("flac.exe"))
{
if(m_binary.isEmpty())
{
MACEncoder::MACEncoder(void)
:
- m_binary_enc(lamexp_lookup_tool("mac.exe")),
- m_binary_tag(lamexp_lookup_tool("tag.exe"))
+ m_binary_enc(lamexp_tool_lookup("mac.exe")),
+ m_binary_tag(lamexp_tool_lookup("tag.exe"))
{
if(m_binary_enc.isEmpty() || m_binary_tag.isEmpty())
{
MP3Encoder::MP3Encoder(void)
:
- m_binary(lamexp_lookup_tool("lame.exe"))
+ m_binary(lamexp_tool_lookup("lame.exe"))
{
if(m_binary.isEmpty())
{
OpusEncoder::OpusEncoder(void)
:
- m_binary(lamexp_lookup_tool("opusenc.exe"))
+ m_binary(lamexp_tool_lookup("opusenc.exe"))
{
if(m_binary.isEmpty())
{
VorbisEncoder::VorbisEncoder(void)
:
- m_binary(lamexp_lookup_tool("oggenc2.exe"))
+ m_binary(lamexp_tool_lookup("oggenc2.exe"))
{
if(m_binary.isEmpty())
{
DownmixFilter::DownmixFilter(void)
:
- m_binary(lamexp_lookup_tool("sox.exe"))
+ m_binary(lamexp_tool_lookup("sox.exe"))
{
if(m_binary.isEmpty())
{
NormalizeFilter::NormalizeFilter(int peakVolume, int equalizationMode)
:
- m_binary(lamexp_lookup_tool("sox.exe"))
+ m_binary(lamexp_tool_lookup("sox.exe"))
{
if(m_binary.isEmpty())
{
ResampleFilter::ResampleFilter(int samplingRate, int bitDepth)
:
- m_binary(lamexp_lookup_tool("sox.exe"))
+ m_binary(lamexp_tool_lookup("sox.exe"))
{
if(m_binary.isEmpty())
{
ToneAdjustFilter::ToneAdjustFilter(int bass, int treble)
:
- m_binary(lamexp_lookup_tool("sox.exe"))
+ m_binary(lamexp_tool_lookup("sox.exe"))
{
if(m_binary.isEmpty())
{
#pragma once
+#ifdef _MSC_VER
#define _CRT_RAND_S
+#endif
+
#include <cstdlib>
+#include <QtGlobal>
//Forward declarations
-class QString;
-class QStringList;
class QDate;
-class QTime;
+class QStringList;
class QIcon;
-class QWidget;
-class QProcess;
-class QColor;
class LockedFile;
-enum QtMsgType;
-//Variables
+///////////////////////////////////////////////////////////////////////////////
+// GLOBAL CONSTANTS
+///////////////////////////////////////////////////////////////////////////////
+
extern const char* LAMEXP_DEFAULT_LANGID;
extern const char* LAMEXP_DEFAULT_TRANSLATION;
// GLOBAL FUNCTIONS
///////////////////////////////////////////////////////////////////////////////
-const QIcon &lamexp_app_icon(void);
-QStringList lamexp_available_codepages(bool noAliases = true);
-bool lamexp_check_tool(const QString &toolName);
-void lamexp_finalization(void);
-bool lamexp_install_translator(const QString &language);
-bool lamexp_install_translator_from_file(const QString &qmFile);
-const QString lamexp_lookup_tool(const QString &toolName);
-const char *lamexp_mulders_url(void);
-bool lamexp_portable_mode(void);
+/*
+ * Translation Support
+ */
QStringList lamexp_query_translations(void);
-void lamexp_register_tool(const QString &toolName, LockedFile *file, unsigned int version = 0, const QString *tag = NULL);
-const char *lamexp_support_url(void);
-unsigned int lamexp_tool_version(const QString &toolName, QString *tag = NULL);
-unsigned int lamexp_toolver_coreaudio(void);
-unsigned int lamexp_toolver_fhgaacenc(void);
-unsigned int lamexp_toolver_neroaac(void);
-unsigned int lamexp_toolver_qaacenc(void);
-const char *lamexp_tracker_url(void);
unsigned int lamexp_translation_country(const QString &langId);
bool lamexp_translation_init(void);
QString lamexp_translation_name(const QString &language);
bool lamexp_translation_register(const QString &langId, const QString &qmFile, const QString &langName, unsigned int &systemId, unsigned int &country);
unsigned int lamexp_translation_sysid(const QString &langId);
-const QString lamexp_version2string(const QString &pattern, unsigned int version, const QString &defaultText, const QString *tag = NULL);
-unsigned int lamexp_version_build(void);
-unsigned int lamexp_version_confg(void);
-bool lamexp_version_demo(void);
-QDate lamexp_version_expires(void);
-unsigned int lamexp_version_major(void);
-unsigned int lamexp_version_minor(void);
-const char *lamexp_version_release(void);
+bool lamexp_install_translator(const QString &language);
+bool lamexp_install_translator_from_file(const QString &qmFile);
+
+/*
+ * Tools Support
+ */
+bool lamexp_tool_check (const QString &toolName);
+const QString& lamexp_tool_lookup (const QString &toolName);
+void lamexp_tool_register(const QString &toolName, LockedFile *file, unsigned int version = 0, const QString *tag = NULL);
+unsigned int lamexp_tool_version (const QString &toolName, QString *tag = NULL);
+
+/*
+ * Version getters
+ */
+unsigned int lamexp_version_major (void);
+unsigned int lamexp_version_minor (void);
+unsigned int lamexp_version_build (void);
+unsigned int lamexp_version_confg (void);
+const char* lamexp_version_release (void);
+bool lamexp_version_portable (void);
+bool lamexp_version_demo (void);
+QDate& lamexp_version_expires (void);
+unsigned int lamexp_toolver_neroaac (void);
+unsigned int lamexp_toolver_fhgaacenc(void);
+unsigned int lamexp_toolver_qaacenc (void);
+unsigned int lamexp_toolver_coreaudio(void);
+
+
+/*
+ * URL getters
+ */
const char *lamexp_website_url(void);
+const char *lamexp_mulders_url(void);
+const char *lamexp_support_url(void);
+const char *lamexp_tracker_url(void);
+
+/*
+ * Misc Functions
+ */
+const QIcon& lamexp_app_icon(void);
+const QString lamexp_version2string(const QString &pattern, unsigned int version, const QString &defaultText, const QString *tag = NULL);
+
+/*
+ * Finalization
+ */
+void lamexp_finalization(void);
///////////////////////////////////////////////////////////////////////////////
// HELPER MACROS
}
g_lamexp_currentTranslator;
+//Null String
+static const QString g_null;
+
///////////////////////////////////////////////////////////////////////////////
// GLOBAL FUNCTIONS
///////////////////////////////////////////////////////////////////////////////
/*
* Register tool
*/
-void lamexp_register_tool(const QString &toolName, LockedFile *file, unsigned int version, const QString *tag)
+void lamexp_tool_register(const QString &toolName, LockedFile *file, unsigned int version, const QString *tag)
{
QWriteLocker writeLock(&g_lamexp_tools.lock);
/*
* Check for tool
*/
-bool lamexp_check_tool(const QString &toolName)
+bool lamexp_tool_check(const QString &toolName)
{
QReadLocker readLock(&g_lamexp_tools.lock);
return (g_lamexp_tools.registry) ? g_lamexp_tools.registry->contains(toolName.toLower()) : false;
/*
* Lookup tool path
*/
-const QString lamexp_lookup_tool(const QString &toolName)
+const QString &lamexp_tool_lookup(const QString &toolName)
{
QReadLocker readLock(&g_lamexp_tools.lock);
}
else
{
- return QString();
+ return g_null;
}
}
else
{
- return QString();
+ return g_null;
}
}
// GLOBAL VARS
///////////////////////////////////////////////////////////////////////////////
-static struct
-{
- QIcon *appIcon;
- QReadWriteLock lock;
-}
-g_lamexp_app_icon;
+static QScopedPointer<QIcon> g_lamexp_icon_data;
+static QReadWriteLock g_lamexp_icon_lock;
///////////////////////////////////////////////////////////////////////////////
// GLOBAL FUNCTIONS
///////////////////////////////////////////////////////////////////////////////
/*
- * Get a list of all available Qt Text Codecs
- */
-QStringList lamexp_available_codepages(bool noAliases)
-{
- QStringList codecList;
-
- QList<QByteArray> availableCodecs = QTextCodec::availableCodecs();
- while(!availableCodecs.isEmpty())
- {
- QByteArray current = availableCodecs.takeFirst();
- if(!(current.startsWith("system") || current.startsWith("System")))
- {
- codecList << QString::fromLatin1(current.constData(), current.size());
- if(noAliases)
- {
- if(QTextCodec *currentCodec = QTextCodec::codecForName(current.constData()))
- {
-
- QList<QByteArray> aliases = currentCodec->aliases();
- while(!aliases.isEmpty()) availableCodecs.removeAll(aliases.takeFirst());
- }
- }
- }
- }
-
- return codecList;
-}
-
-/*
* Computus according to H. Lichtenberg
*/
static bool lamexp_computus(const QDate &date)
*/
const QIcon &lamexp_app_icon(void)
{
- QReadLocker readLock(&g_lamexp_app_icon.lock);
+ QReadLocker readLock(&g_lamexp_icon_lock);
//Already initialized?
- if(g_lamexp_app_icon.appIcon)
+ if(!g_lamexp_icon_data.isNull())
{
- return *g_lamexp_app_icon.appIcon;
+ return *g_lamexp_icon_data;
}
readLock.unlock();
- QWriteLocker writeLock(&g_lamexp_app_icon.lock);
+ QWriteLocker writeLock(&g_lamexp_icon_lock);
- while(!g_lamexp_app_icon.appIcon)
+ while(g_lamexp_icon_data.isNull())
{
QDate currentDate = QDate::currentDate();
QTime currentTime = QTime::currentTime();
if(lamexp_thanksgiving(currentDate))
{
- g_lamexp_app_icon.appIcon = new QIcon(":/MainIcon6.png");
+ g_lamexp_icon_data.reset(new QIcon(":/MainIcon6.png"));
}
else if(((currentDate.month() == 12) && (currentDate.day() == 31) && (currentTime.hour() >= 20)) || ((currentDate.month() == 1) && (currentDate.day() == 1) && (currentTime.hour() <= 19)))
{
- g_lamexp_app_icon.appIcon = new QIcon(":/MainIcon5.png");
+ g_lamexp_icon_data.reset(new QIcon(":/MainIcon5.png"));
}
else if(((currentDate.month() == 10) && (currentDate.day() == 31) && (currentTime.hour() >= 12)) || ((currentDate.month() == 11) && (currentDate.day() == 1) && (currentTime.hour() <= 11)))
{
- g_lamexp_app_icon.appIcon = new QIcon(":/MainIcon4.png");
+ g_lamexp_icon_data.reset(new QIcon(":/MainIcon4.png"));
}
else if((currentDate.month() == 12) && (currentDate.day() >= 24) && (currentDate.day() <= 26))
{
- g_lamexp_app_icon.appIcon = new QIcon(":/MainIcon3.png");
+ g_lamexp_icon_data.reset(new QIcon(":/MainIcon3.png"));
}
else if(lamexp_computus(currentDate))
{
- g_lamexp_app_icon.appIcon = new QIcon(":/MainIcon2.png");
+ g_lamexp_icon_data.reset(new QIcon(":/MainIcon2.png"));
}
else
{
- g_lamexp_app_icon.appIcon = new QIcon(":/MainIcon1.png");
+ g_lamexp_icon_data.reset(new QIcon(":/MainIcon1.png"));
}
}
- return *g_lamexp_app_icon.appIcon;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// INITIALIZATION
-///////////////////////////////////////////////////////////////////////////////
-
-extern "C" void _lamexp_global_init_utils(void)
-{
- MUTILS_ZERO_MEMORY(g_lamexp_app_icon);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// FINALIZATION
-///////////////////////////////////////////////////////////////////////////////
-
-extern "C" void _lamexp_global_free_utils(void)
-{
- //Free memory
- MUTILS_DELETE(g_lamexp_app_icon.appIcon);
+ return *g_lamexp_icon_data;
}
// GLOBAL VARS
///////////////////////////////////////////////////////////////////////////////
+static QReadWriteLock g_lamexp_version_lock;
+
//Build version
-static const struct
-{
- unsigned int ver_major;
- unsigned int ver_minor;
- unsigned int ver_build;
- unsigned int ver_confg;
- char *ver_release_name;
-}
-g_lamexp_version =
-{
- VER_LAMEXP_MAJOR,
- (10 * VER_LAMEXP_MINOR_HI) + VER_LAMEXP_MINOR_LO,
- VER_LAMEXP_BUILD,
- VER_LAMEXP_CONFG,
- VER_LAMEXP_RNAME,
-};
+static const unsigned int g_lamexp_version_major = VER_LAMEXP_MAJOR;
+static const unsigned int g_lamexp_version_minor = (10 * VER_LAMEXP_MINOR_HI) + VER_LAMEXP_MINOR_LO;
+static const unsigned int g_lamexp_version_build = VER_LAMEXP_BUILD;
+static const unsigned int g_lamexp_version_confg = VER_LAMEXP_CONFG;
+static const char* g_lamexp_version_rname = VER_LAMEXP_RNAME;
+
+//Demo Version
+static int g_lamexp_demo = -1;
//Portable Mode
-static struct
-{
- bool bInitialized;
- bool bPortableModeEnabled;
- QReadWriteLock lock;
-}
-g_lamexp_portable;
+static int g_lamexp_portable = -1;
+
+//Expiration date
+static QScopedPointer<QDate> g_lamexp_expiration_date;
//Official web-site URL
static const char *g_lamexp_website_url = "http://lamexp.sourceforge.net/";
/*
* Version getters
*/
-unsigned int lamexp_version_major(void) { return g_lamexp_version.ver_major; }
-unsigned int lamexp_version_minor(void) { return g_lamexp_version.ver_minor; }
-unsigned int lamexp_version_build(void) { return g_lamexp_version.ver_build; }
-unsigned int lamexp_version_confg(void) { return g_lamexp_version.ver_confg; }
-const char* lamexp_version_release(void) { return g_lamexp_version.ver_release_name; }
-unsigned int lamexp_toolver_neroaac(void) { return g_lamexp_toolver_neroaac; }
+unsigned int lamexp_version_major(void) { return g_lamexp_version_major; }
+unsigned int lamexp_version_minor(void) { return g_lamexp_version_minor; }
+unsigned int lamexp_version_build(void) { return g_lamexp_version_build; }
+unsigned int lamexp_version_confg(void) { return g_lamexp_version_confg; }
+const char* lamexp_version_release(void) { return g_lamexp_version_rname; }
+unsigned int lamexp_toolver_neroaac(void) { return g_lamexp_toolver_neroaac; }
unsigned int lamexp_toolver_fhgaacenc(void) { return g_lamexp_toolver_fhgaacenc; }
-unsigned int lamexp_toolver_qaacenc(void) { return g_lamexp_toolver_qaacenc; }
+unsigned int lamexp_toolver_qaacenc(void) { return g_lamexp_toolver_qaacenc; }
unsigned int lamexp_toolver_coreaudio(void) { return g_lamexp_toolver_coreaudio; }
/*
*/
bool lamexp_version_demo(void)
{
- return _strnicmp(g_lamexp_version.ver_release_name, "Final", 5) && _strnicmp(g_lamexp_version.ver_release_name, "Hotfix", 6);
+ QReadLocker readLock(&g_lamexp_version_lock);
+
+ if(g_lamexp_demo >= 0)
+ {
+ return (g_lamexp_demo > 0);
+ }
+
+ readLock.unlock();
+ QWriteLocker writeLock(&g_lamexp_version_lock);
+
+ if(g_lamexp_demo < 0)
+ {
+ g_lamexp_demo = (_strnicmp(g_lamexp_version_rname, "Final", 5) && _strnicmp(g_lamexp_version_rname, "Hotfix", 6)) ? (1) : (0);
+ }
+
+ return (g_lamexp_demo > 0);
}
/*
* Calculate expiration date
*/
-QDate lamexp_version_expires(void)
+QDate &lamexp_version_expires(void)
{
- return MUtils::Version::app_build_date().addDays(MUTILS_DEBUG ? 7 : 30);
+ QReadLocker readLock(&g_lamexp_version_lock);
+
+ if(!g_lamexp_expiration_date.isNull())
+ {
+ return *g_lamexp_expiration_date;
+ }
+
+ readLock.unlock();
+ QWriteLocker writeLock(&g_lamexp_version_lock);
+
+ if(g_lamexp_expiration_date.isNull())
+ {
+ g_lamexp_expiration_date.reset(new QDate(MUtils::Version::app_build_date().addDays(MUTILS_DEBUG ? 7 : 30)));
+ }
+
+ return *g_lamexp_expiration_date;
}
/*
* Check for LameXP "portable" mode
*/
-bool lamexp_portable_mode(void)
+bool lamexp_version_portable(void)
{
- QReadLocker readLock(&g_lamexp_portable.lock);
+ QReadLocker readLock(&g_lamexp_version_lock);
- if(g_lamexp_portable.bInitialized)
+ if(g_lamexp_portable >= 0)
{
- return g_lamexp_portable.bPortableModeEnabled;
+ return (g_lamexp_portable > 0);
}
readLock.unlock();
- QWriteLocker writeLock(&g_lamexp_portable.lock);
+ QWriteLocker writeLock(&g_lamexp_version_lock);
- if(!g_lamexp_portable.bInitialized)
+ if(g_lamexp_portable < 0)
{
if(VER_LAMEXP_PORTABLE_EDITION)
{
qWarning("LameXP portable edition!\n");
- g_lamexp_portable.bPortableModeEnabled = true;
+ g_lamexp_portable = 1;
}
else
{
- QString baseName = QFileInfo(QApplication::applicationFilePath()).completeBaseName();
- int idx1 = baseName.indexOf("lamexp", 0, Qt::CaseInsensitive);
- int idx2 = baseName.lastIndexOf("portable", -1, Qt::CaseInsensitive);
- g_lamexp_portable.bPortableModeEnabled = ((idx1 >= 0) && (idx2 >= 0) && (idx1 < idx2));
+ const QString baseName = QFileInfo(QApplication::applicationFilePath()).completeBaseName();
+ const int idx1 = baseName.indexOf("lamexp", 0, Qt::CaseInsensitive);
+ const int idx2 = baseName.lastIndexOf("portable", -1, Qt::CaseInsensitive);
+ g_lamexp_portable = ((idx1 >= 0) && (idx2 >= 0) && (idx1 < idx2)) ? (1) : (0);
}
- g_lamexp_portable.bInitialized = true;
}
- return g_lamexp_portable.bPortableModeEnabled;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// INITIALIZATION
-///////////////////////////////////////////////////////////////////////////////
-
-extern "C" void _lamexp_global_init_versn(void)
-{
- MUTILS_ZERO_MEMORY(g_lamexp_portable);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// FINALIZATION
-///////////////////////////////////////////////////////////////////////////////
-
-extern "C" void _lamexp_global_free_versn(void)
-{
- /*nothing to do here*/
+ return (g_lamexp_portable > 0);
}
extern "C"
{
int mainCRTStartup(void);
-
- void _lamexp_global_init_versn(void);
void _lamexp_global_init_tools(void);
- void _lamexp_global_init_utils(void);
-
- void _lamexp_global_free_versn(void);
void _lamexp_global_free_tools(void);
- void _lamexp_global_free_utils(void);
}
/*
}
//Call global initialization functions
- _lamexp_global_init_versn();
_lamexp_global_init_tools();
- _lamexp_global_init_utils();
//Make sure we will pass the check
g_lamexp_entry_check_flag = (~g_lamexp_entry_check_flag);
qDebug("lamexp_finalization()");
//Call global finalization functions, in proper order
- _lamexp_global_free_versn();
_lamexp_global_free_tools();
- _lamexp_global_free_utils();
}
QStringList codecList;
codecList.append(systemDefault);
- codecList.append(lamexp_available_codepages());
+ codecList.append(MUtils::available_codepages());
QInputDialog *input = new QInputDialog(parent);
input->setLabelText(EXPAND(tr("Select ANSI Codepage for CSV file:")));
{
QString configPath = "LameXP.ini";
- if(!lamexp_portable_mode())
+ if(!lamexp_version_portable())
{
QString dataPath = initDirectory(QDesktopServices::storageLocation(QDesktopServices::DataLocation));
if(!dataPath.isEmpty())
LAMEXP_MAKE_OPTION_B(aftenFastBitAllocation, false)
LAMEXP_MAKE_OPTION_B(antivirNotificationsEnabled, true)
LAMEXP_MAKE_OPTION_B(autoUpdateCheckBeta, false)
-LAMEXP_MAKE_OPTION_B(autoUpdateEnabled, (!lamexp_portable_mode()));
+LAMEXP_MAKE_OPTION_B(autoUpdateEnabled, (!lamexp_version_portable()));
LAMEXP_MAKE_OPTION_S(autoUpdateLastCheck, "Never")
LAMEXP_MAKE_OPTION_B(bitrateManagementEnabled, false)
LAMEXP_MAKE_OPTION_I(bitrateManagementMaxRate, 500)
LAMEXP_MAKE_OPTION_B(renameOutputFilesEnabled, false)
LAMEXP_MAKE_OPTION_S(renameOutputFilesPattern, "[<TrackNo>] <Artist> - <Title>")
LAMEXP_MAKE_OPTION_I(samplingRate, 0)
-LAMEXP_MAKE_OPTION_B(shellIntegrationEnabled, !lamexp_portable_mode())
+LAMEXP_MAKE_OPTION_B(shellIntegrationEnabled, !lamexp_version_portable())
LAMEXP_MAKE_OPTION_B(slowStartup, false)
LAMEXP_MAKE_OPTION_B(soundsEnabled, true)
LAMEXP_MAKE_OPTION_I(toneAdjustBass, 0)
int EncoderRegistry::getAacEncoder(void)
{
- if(lamexp_check_tool("qaac.exe") && lamexp_check_tool("libsoxr.dll") && lamexp_check_tool("libsoxconvolver.dll"))
+ if(lamexp_tool_check("qaac.exe") && lamexp_tool_check("libsoxr.dll") && lamexp_tool_check("libsoxconvolver.dll"))
{
return SettingsModel::AAC_ENCODER_QAAC;
}
- else if(lamexp_check_tool("fhgaacenc.exe") && lamexp_check_tool("enc_fhgaac.dll") && lamexp_check_tool("nsutil.dll") && lamexp_check_tool("libmp4v2.dll"))
+ else if(lamexp_tool_check("fhgaacenc.exe") && lamexp_tool_check("enc_fhgaac.dll") && lamexp_tool_check("nsutil.dll") && lamexp_tool_check("libmp4v2.dll"))
{
return SettingsModel::AAC_ENCODER_FHG;
}
- else if(lamexp_check_tool("neroAacEnc.exe") && lamexp_check_tool("neroAacDec.exe") && lamexp_check_tool("neroAacTag.exe"))
+ else if(lamexp_tool_check("neroAacEnc.exe") && lamexp_tool_check("neroAacDec.exe") && lamexp_tool_check("neroAacTag.exe"))
{
return SettingsModel::AAC_ENCODER_NERO;
}
m_model(model),
m_outputDir(outputDir),
m_baseName(baseName),
- m_soxBin(lamexp_lookup_tool("sox.exe"))
+ m_soxBin(lamexp_tool_lookup("sox.exe"))
{
if(m_soxBin.isEmpty())
{
m_taskId(taskId),
m_inputFile(inputFile),
m_templateFile(templateFile),
- m_mediaInfoBin(lamexp_lookup_tool("mediainfo.exe")),
- m_avs2wavBin(lamexp_lookup_tool("avs2wav.exe")),
+ m_mediaInfoBin(lamexp_tool_lookup("mediainfo.exe")),
+ m_avs2wavBin(lamexp_tool_lookup("avs2wav.exe")),
m_abortFlag(abortFlag)
{
if(m_mediaInfoBin.isEmpty() || m_avs2wavBin.isEmpty())
if(lockedFile)
{
- lamexp_register_tool(toolShortName, lockedFile, version, &m_toolTag);
+ lamexp_tool_register(toolShortName, lockedFile, version, &m_toolTag);
}
}
for(int i = 0; i < 3; i++)
{
- lamexp_register_tool(neroFileInfo[i].fileName(), neroBin[i], neroVersion);
+ lamexp_tool_register(neroFileInfo[i].fileName(), neroBin[i], neroVersion);
}
}
for(int i = 0; i < 5; i++)
{
- lamexp_register_tool(fhgFileInfo[i].fileName(), fhgBin[i], fhgVersion);
+ lamexp_tool_register(fhgFileInfo[i].fileName(), fhgBin[i], fhgVersion);
}
}
return;
}
- lamexp_register_tool(qaacFileInfo[0].fileName(), qaacBin[0], qaacVersion);
- lamexp_register_tool(qaacFileInfo[1].fileName(), qaacBin[1], qaacVersion);
- lamexp_register_tool(qaacFileInfo[2].fileName(), qaacBin[2], qaacVersion);
- lamexp_register_tool(qaacFileInfo[3].fileName(), qaacBin[3], qaacVersion);
+ lamexp_tool_register(qaacFileInfo[0].fileName(), qaacBin[0], qaacVersion);
+ lamexp_tool_register(qaacFileInfo[1].fileName(), qaacBin[1], qaacVersion);
+ lamexp_tool_register(qaacFileInfo[2].fileName(), qaacBin[2], qaacVersion);
+ lamexp_tool_register(qaacFileInfo[3].fileName(), qaacBin[3], qaacVersion);
}
void InitializationThread::selfTest(void)
WaveProperties::WaveProperties(void)
:
- m_binary(lamexp_lookup_tool("sox.exe"))
+ m_binary(lamexp_tool_lookup("sox.exe"))
{
if(m_binary.isEmpty())
{