From a8554a2d5c8ba3fd3e1e964c938f7ddda1cc6b12 Mon Sep 17 00:00:00 2001 From: lordmulder Date: Wed, 15 Dec 2010 22:39:18 +0100 Subject: [PATCH] Show tool versions in third-party about screen. --- src/Config.h | 2 +- src/Dialog_About.cpp | 18 ++++++---- src/Global.cpp | 9 +++-- src/Thread_Initialization.cpp | 63 +++++++++++++++++++---------------- 4 files changed, 54 insertions(+), 38 deletions(-) diff --git a/src/Config.h b/src/Config.h index cb5cf03e..72c4783b 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 156 +#define VER_LAMEXP_BUILD 157 #define VER_LAMEXP_SUFFIX TechPreview /* diff --git a/src/Dialog_About.cpp b/src/Dialog_About.cpp index bea5d8cb..b1cb99de 100644 --- a/src/Dialog_About.cpp +++ b/src/Dialog_About.cpp @@ -40,6 +40,7 @@ //Helper macros #define LINK(URL) QString("%2").arg(URL).arg(URL) #define CONTRIBUTOR(LANG, CNTR, ICON) QString("  %2  %3").arg(ICON, LANG, CNTR); +#define VSTR(BASE,TOOL,FORMAT) QString(BASE).arg(lamexp_version2string(FORMAT, lamexp_tool_version(TOOL))) //Constants const char *AboutDialog::neroAacUrl = "http://www.nero.com/eng/technologies-aac-codec.html"; @@ -215,24 +216,29 @@ void AboutDialog::showMoreAbout(void) QString moreAboutText; moreAboutText += "

The following third-party software is used in LameXP:

"; moreAboutText += "
"; diff --git a/src/Global.cpp b/src/Global.cpp index fad493ff..194e241d 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -762,7 +762,7 @@ bool lamexp_check_tool(const QString &toolName) } /* - * Lookup tool + * Lookup tool path */ const QString lamexp_lookup_tool(const QString &toolName) { @@ -777,7 +777,7 @@ const QString lamexp_lookup_tool(const QString &toolName) } /* - * Lookup tool + * Lookup tool version */ unsigned int lamexp_tool_version(const QString &toolName) { @@ -796,6 +796,11 @@ unsigned int lamexp_tool_version(const QString &toolName) */ const QString lamexp_version2string(const QString &pattern, unsigned int version) { + if(version == UINT_MAX) + { + return "n/a"; + } + QString result = pattern; int digits = result.count("?", Qt::CaseInsensitive); diff --git a/src/Thread_Initialization.cpp b/src/Thread_Initialization.cpp index 20ba2b6a..5d3f2fdf 100644 --- a/src/Thread_Initialization.cpp +++ b/src/Thread_Initialization.cpp @@ -41,36 +41,37 @@ struct lamexp_tool_t { char *pcHash; char *pcName; + unsigned int uiVersion; }; static const struct lamexp_tool_t g_lamexp_tools[] = { - {"153f4274702f3629093b561a31dbf50e2c146305", "alac.exe"}, - {"4ecc017a66fe43092110f11494f384e57d99280d", "elevator.exe"}, - {"097dd004f44dbda57dbaeb5f15b34a220724ad60", "faad.exe"}, - {"133171ac21f083d565ee9c33ef9cd92fc966811e", "flac.exe"}, - {"cf379081035ae6bfb6f7bc22f13bfb7ac6302ac5", "gpgv.exe"}, - {"d837bf6ee4dab557d8b02d46c75a24e58980fffa", "gpgv.gpg"}, - {"143fc001a2f6c56fe1b9e6f8a2eb2b53b9e1e504", "lame.exe"}, - {"775b260b3f64101beaeb317b74746f9bccdab842", "MAC.exe"}, - {"e8719fbfd7b690b3e518489f7aae3915305711c2", "mediainfo_icl11.exe"}, - {"55c293a80475f7aeccf449ac9487a4626e5139cb", "mpcdec.exe"}, - {"8bbf4a3fffe2ff143eb5ba2cf82ca16d676e865d", "mpg123.exe"}, - {"380c734e3c3948a844b9fae213d53a93ab20beba", "oggdec.exe"}, - {"ecd15abe103184aca96e406f5f1c82c6fb2e665d", "oggenc2_i386.exe"}, - {"ffe0fbd73352396dc3752ac9d484dbfc754a226d", "oggenc2_sse2.exe"}, - {"a8c50872e544a55495a824426e9378984f2ae01d", "oggenc2_x64.exe"}, - {"cd95369051f96b9ca3a997658771c5ea52bc874d", "selfdelete.exe"}, - {"ffeaa70bd6321185eafcb067ab2dc441650038bf", "shorten.exe"}, - {"346ce516281c97e92e1b8957ddeca52edcf2d056", "speexdec.exe"}, - {"8a74b767cfe88bf88c068fdae0de02d65589d25e", "takc.exe"}, - {"1c5cedb56358a0e8c4590a863a97c94d7d7e98b2", "ttaenc.exe"}, - {"7dcf6517aa90ed15737ee8ea50ea00a6dece2d27", "valdec.exe"}, - {"8159f4e824b3e343ece95ba6dbb5e16da9c4866e", "volumax.exe"}, - {"62e2805d1b2eb2a4d86a5ca6e6ea58010d05d2a7", "wget.exe"}, - {"a17011961aa8696bc935e097b3242d33c38a9842", "wupdate.exe"}, - {"4d018ac7f6a42abd53faacfae5055c2a3c176430", "wvunpack.exe"}, - {NULL, NULL} + {"153f4274702f3629093b561a31dbf50e2c146305", "alac.exe", UINT_MAX}, + {"4ecc017a66fe43092110f11494f384e57d99280d", "elevator.exe", UINT_MAX}, + {"097dd004f44dbda57dbaeb5f15b34a220724ad60", "faad.exe", UINT_MAX}, + {"133171ac21f083d565ee9c33ef9cd92fc966811e", "flac.exe", 121}, + {"cf379081035ae6bfb6f7bc22f13bfb7ac6302ac5", "gpgv.exe", UINT_MAX}, + {"d837bf6ee4dab557d8b02d46c75a24e58980fffa", "gpgv.gpg", UINT_MAX}, + {"143fc001a2f6c56fe1b9e6f8a2eb2b53b9e1e504", "lame.exe", 39910}, + {"775b260b3f64101beaeb317b74746f9bccdab842", "MAC.exe", UINT_MAX}, + {"e8719fbfd7b690b3e518489f7aae3915305711c2", "mediainfo_icl11.exe", 737}, + {"55c293a80475f7aeccf449ac9487a4626e5139cb", "mpcdec.exe", UINT_MAX}, + {"8bbf4a3fffe2ff143eb5ba2cf82ca16d676e865d", "mpg123.exe", UINT_MAX}, + {"380c734e3c3948a844b9fae213d53a93ab20beba", "oggdec.exe", UINT_MAX}, + {"ecd15abe103184aca96e406f5f1c82c6fb2e665d", "oggenc2_i386.exe", 287}, + {"ffe0fbd73352396dc3752ac9d484dbfc754a226d", "oggenc2_sse2.exe", 287}, + {"a8c50872e544a55495a824426e9378984f2ae01d", "oggenc2_x64.exe", 287}, + {"cd95369051f96b9ca3a997658771c5ea52bc874d", "selfdelete.exe", UINT_MAX}, + {"ffeaa70bd6321185eafcb067ab2dc441650038bf", "shorten.exe", UINT_MAX}, + {"346ce516281c97e92e1b8957ddeca52edcf2d056", "speexdec.exe", UINT_MAX}, + {"8a74b767cfe88bf88c068fdae0de02d65589d25e", "takc.exe", UINT_MAX}, + {"1c5cedb56358a0e8c4590a863a97c94d7d7e98b2", "ttaenc.exe", UINT_MAX}, + {"7dcf6517aa90ed15737ee8ea50ea00a6dece2d27", "valdec.exe", UINT_MAX}, + {"8159f4e824b3e343ece95ba6dbb5e16da9c4866e", "volumax.exe", UINT_MAX}, + {"62e2805d1b2eb2a4d86a5ca6e6ea58010d05d2a7", "wget.exe", UINT_MAX}, + {"a17011961aa8696bc935e097b3242d33c38a9842", "wupdate.exe", UINT_MAX}, + {"4d018ac7f6a42abd53faacfae5055c2a3c176430", "wvunpack.exe", UINT_MAX}, + {NULL, NULL, NULL} }; //////////////////////////////////////////////////////////// @@ -91,14 +92,17 @@ void InitializationThread::run() m_bSuccess = false; delay(); - QMap checksum; + QMap checksum; + QMap version; //Init checksums for(int i = 0; i < INT_MAX; i++) { if(g_lamexp_tools[i].pcName && g_lamexp_tools[i].pcHash) { - checksum.insert(QString::fromLatin1(g_lamexp_tools[i].pcName), QString::fromLatin1(g_lamexp_tools[i].pcHash)); + const QString currentTool = QString::fromLatin1(g_lamexp_tools[i].pcName); + checksum.insert(currentTool, QString::fromLatin1(g_lamexp_tools[i].pcHash)); + version.insert(currentTool, g_lamexp_tools[i].uiVersion); continue; } break; @@ -115,12 +119,13 @@ void InitializationThread::run() qDebug("Extracting file: %s", g_lamexp_tools[i].pcName); QString toolName = toolsList.at(i).fileName(); QByteArray toolHash = checksum.take(toolName).toLatin1(); + unsigned int toolVersion = version.take(toolName); if(toolHash.size() != 40) { throw "The required checksum is missing, take care!"; } LockedFile *lockedFile = new LockedFile(QString(":/tools/%1").arg(toolName), QString(lamexp_temp_folder()).append(QString("/tool_%1").arg(toolName)), toolHash); - lamexp_register_tool(toolName, lockedFile); + lamexp_register_tool(toolName, lockedFile, toolVersion); } catch(char *errorMsg) {