From 63d6708fc11524bf010461add319fdb809839695 Mon Sep 17 00:00:00 2001 From: lordmulder Date: Mon, 28 Feb 2011 01:28:27 +0100 Subject: [PATCH] Refactored a few constants. --- src/Config.h | 2 +- src/Dialog_About.cpp | 2 +- src/Dialog_MainWindow.cpp | 2 +- src/Dialog_Processing.cpp | 14 +++++++++++--- src/Global.cpp | 4 ++++ src/Global.h | 1 + 6 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/Config.h b/src/Config.h index c22db500..9b77d1de 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 1 -#define VER_LAMEXP_BUILD 341 +#define VER_LAMEXP_BUILD 342 #define VER_LAMEXP_SUFFIX Beta-3 /* diff --git a/src/Dialog_About.cpp b/src/Dialog_About.cpp index ea0e96d8..3fad8ce8 100644 --- a/src/Dialog_About.cpp +++ b/src/Dialog_About.cpp @@ -79,7 +79,7 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta aboutText += QString("

%1

").arg(tr("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 += QString("%1
").arg(tr("Please visit %1 for news and updates!").arg(LINK("http://forum.doom9.org/showthread.php?t=157726"))); + aboutText += QString("%1
").arg(tr("Please visit %1 for news and updates!").arg(LINK(lamexp_website_url()))); 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 eea60c4f..4f563203 100644 --- a/src/Dialog_MainWindow.cpp +++ b/src/Dialog_MainWindow.cpp @@ -1505,7 +1505,7 @@ void MainWindow::clearMetaButtonClicked(void) */ void MainWindow::visitHomepageActionActivated(void) { - QDesktopServices::openUrl(QUrl("http://mulder.dummwiedeutsch.de/")); + QDesktopServices::openUrl(QUrl(lamexp_website_url())); } /* diff --git a/src/Dialog_Processing.cpp b/src/Dialog_Processing.cpp index 1a3b6b0f..9524dd67 100644 --- a/src/Dialog_Processing.cpp +++ b/src/Dialog_Processing.cpp @@ -58,6 +58,14 @@ //////////////////////////////////////////////////////////// +//Maximum number of parallel instances +#define MAX_INSTANCES 16 + +//Maximum number of CPU cores for auto-detection +#define MAX_CPU_COUNT 4 + +//////////////////////////////////////////////////////////// + #define CHANGE_BACKGROUND_COLOR(WIDGET, COLOR) \ { \ QPalette palette = WIDGET->palette(); \ @@ -232,7 +240,7 @@ bool ProcessingDialog::eventFilter(QObject *obj, QEvent *event) } else if(event->type() == QEvent::MouseButtonPress) { - QUrl url("http://mulder.dummwiedeutsch.de/"); + QUrl url(lamexp_website_url()); QDesktopServices::openUrl(url); } } @@ -267,11 +275,11 @@ void ProcessingDialog::initEncoding(void) WinSevenTaskbar::setTaskbarProgress(this, 0, m_pendingJobs.count()); WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/control_play_blue.png")); - int maximumInstances = max(min(m_settings->maximumInstances(), 16), 0); + int maximumInstances = max(min(m_settings->maximumInstances(), MAX_INSTANCES), 0); if(maximumInstances < 1) { lamexp_cpu_t cpuFeatures = lamexp_detect_cpu_features(); - maximumInstances = max(min(cpuFeatures.count, 4), 1); + maximumInstances = max(min(cpuFeatures.count, MAX_CPU_COUNT), 1); } int parallelThreadCount = max(min(maximumInstances, m_pendingJobs.count()), 1); diff --git a/src/Global.cpp b/src/Global.cpp index e1fa692b..94d292bb 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -127,6 +127,9 @@ static const char *g_lamexp_version_raw_date = __DATE__; #endif #endif +//Official web-site URL +static const char *g_lamexp_website_url = "http://mulder.dummwiedeutsch.de/"; + //Tool versions (expected) static const unsigned int g_lamexp_toolver_neroaac = VER_LAMEXP_TOOL_NEROAAC; @@ -192,6 +195,7 @@ unsigned int lamexp_version_build(void) { return g_lamexp_version.ver_build; } const char *lamexp_version_release(void) { return g_lamexp_version.ver_release_name; } const char *lamexp_version_compiler(void) {return g_lamexp_version_compiler; } unsigned int lamexp_toolver_neroaac(void) { return g_lamexp_toolver_neroaac; } +const char *lamexp_website_url(void) { return g_lamexp_website_url; } bool lamexp_version_demo(void) { diff --git a/src/Global.h b/src/Global.h index 173296a9..00a863bb 100644 --- a/src/Global.h +++ b/src/Global.h @@ -76,6 +76,7 @@ bool lamexp_version_demo(void); const char *lamexp_version_compiler(void); QDate lamexp_version_expires(void); unsigned int lamexp_toolver_neroaac(void); +const char *lamexp_website_url(void); //Public functions void lamexp_init_console(int argc, char* argv[]);