diff --git a/MUtilities_VS2013.vcxproj b/MUtilities_VS2013.vcxproj
index c2c70a0..5cd4d5a 100644
--- a/MUtilities_VS2013.vcxproj
+++ b/MUtilities_VS2013.vcxproj
@@ -18,6 +18,7 @@
+
@@ -35,6 +36,7 @@
MOC "$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp"
$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)
+
diff --git a/MUtilities_VS2013.vcxproj.filters b/MUtilities_VS2013.vcxproj.filters
index ce3d92f..fea27eb 100644
--- a/MUtilities_VS2013.vcxproj.filters
+++ b/MUtilities_VS2013.vcxproj.filters
@@ -33,6 +33,9 @@
Source Files\Generated
+
+ Source Files
+
@@ -47,6 +50,9 @@
Public Headers
+
+ Public Headers
+
diff --git a/include/MUtils/Global.h b/include/MUtils/Global.h
index fe30b4e..4b41eee 100644
--- a/include/MUtils/Global.h
+++ b/include/MUtils/Global.h
@@ -36,11 +36,14 @@ namespace MUtils
//Process Utils
void init_process(QProcess &process, const QString &wokringDir, const bool bReplaceTempDir = true);
- //Random
+ //Random
void seed_rand(void);
QString rand_str(const bool &bLong = false);
quint32 next_rand32(void);
quint64 next_rand64(void);
+
+ //Version
+ const char* buildDate(void);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/include/MUtils/UpdateChecker.h b/include/MUtils/UpdateChecker.h
index 7b1445e..9b582aa 100644
--- a/include/MUtils/UpdateChecker.h
+++ b/include/MUtils/UpdateChecker.h
@@ -73,7 +73,7 @@ namespace MUtils
}
update_status_t;
- UpdateChecker(const QString &binWGet, const QString &binGnuPG, const QString &binKeys, const quint32 &installedBuildNo, const bool betaUpdates, const bool testMode = false);
+ UpdateChecker(const QString &binWGet, const QString &binGnuPG, const QString &binKeys, const QString &applicationId, const quint32 &installedBuildNo, const bool betaUpdates, const bool testMode = false);
~UpdateChecker(void);
const int getUpdateStatus(void) const { return m_status; }
@@ -99,6 +99,7 @@ namespace MUtils
const bool m_betaUpdates;
const bool m_testMode;
+ const QString m_applicationId;
const quint32 m_installedBuildNo;
const QString m_binaryWGet;
diff --git a/include/MUtils/Version.h b/include/MUtils/Version.h
new file mode 100644
index 0000000..86e149b
--- /dev/null
+++ b/include/MUtils/Version.h
@@ -0,0 +1,126 @@
+///////////////////////////////////////////////////////////////////////////////
+// MuldeR's Utilities for Qt
+// Copyright (C) 2004-2014 LoRd_MuldeR
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+// http://www.gnu.org/licenses/lgpl-2.1.txt
+//////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include
+#include
+
+///////////////////////////////////////////////////////////////////////////////
+
+#define MUTILS_MAKE_STRING_HELPER(X) #X
+#define MUTILS_MAKE_STRING(X) MUTILS_MAKE_STRING_HELPER(X)
+#define MUTILS_COMPILER_WARNING(TXT) __pragma(message(__FILE__ "(" MUTILS_MAKE_STRING(__LINE__) ") : warning: " TXT))
+
+namespace MUtils
+{
+ namespace Version
+ {
+ //Raw Build date
+ const char *const BUILD_DATE = __DATE__;
+
+ //Get Build Data
+ const QDate build_date(const char *const raw_date = BUILD_DATE);
+
+ //Compiler detection
+ #if defined(__INTEL_COMPILER)
+ #if (__INTEL_COMPILER >= 1500)
+ static const char *COMPILER_VERS = "ICL 15." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
+ #elif (__INTEL_COMPILER >= 1400)
+ static const char *COMPILER_VERS = "ICL 14." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
+ #elif (__INTEL_COMPILER >= 1300)
+ static const char *COMPILER_VERS = "ICL 13." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
+ #elif (__INTEL_COMPILER >= 1200)
+ static const char *COMPILER_VERS = "ICL 12." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
+ #elif (__INTEL_COMPILER >= 1100)
+ static const char *COMPILER_VERS = "ICL 11.x";
+ #elif (__INTEL_COMPILER >= 1000)
+ static const char *COMPILER_VERS = "ICL 10.x";
+ #else
+ #error Compiler is not supported!
+ #endif
+ #elif defined(_MSC_VER)
+ #if (_MSC_VER == 1800)
+ #if (_MSC_FULL_VER == 180021005)
+ static const char *COMPILER_VERS = "MSVC 2013";
+ #elif (_MSC_FULL_VER == 180030501)
+ static const char *COMPILER_VERS = "MSVC 2013.2";
+ #elif (_MSC_FULL_VER == 180030723)
+ static const char *COMPILER_VERS = "MSVC 2013.3";
+ #elif (_MSC_FULL_VER == 180031101)
+ static const char *COMPILER_VERS = "MSVC 2013.4";
+ #else
+ #error Compiler version is not supported yet!
+ #endif
+ #elif (_MSC_VER == 1700)
+ #if (_MSC_FULL_VER == 170050727)
+ static const char *COMPILER_VERS = "MSVC 2012";
+ #elif (_MSC_FULL_VER == 170051106)
+ static const char *COMPILER_VERS = "MSVC 2012.1";
+ #elif (_MSC_FULL_VER == 170060315)
+ static const char *COMPILER_VERS = "MSVC 2012.2";
+ #elif (_MSC_FULL_VER == 170060610)
+ static const char *COMPILER_VERS = "MSVC 2012.3";
+ #elif (_MSC_FULL_VER == 170061030)
+ static const char *COMPILER_VERS = "MSVC 2012.4";
+ #else
+ #error Compiler version is not supported yet!
+ #endif
+ #elif (_MSC_VER == 1600)
+ #if (_MSC_FULL_VER >= 160040219)
+ static const char *COMPILER_VERS = "MSVC 2010-SP1";
+ #else
+ static const char *COMPILER_VERS = "MSVC 2010";
+ #endif
+ #elif (_MSC_VER == 1500)
+ #if (_MSC_FULL_VER >= 150030729)
+ static const char *COMPILER_VERS = "MSVC 2008-SP1";
+ #else
+ static const char *COMPILER_VERS = "MSVC 2008";
+ #endif
+ #else
+ #error Compiler is not supported!
+ #endif
+
+ // Note: /arch:SSE and /arch:SSE2 are only available for the x86 platform
+ #if !defined(_M_X64) && defined(_M_IX86_FP)
+ #if (_M_IX86_FP == 1)
+ MUTILS_COMPILER_WARNING("SSE instruction set is enabled!")
+ #elif (_M_IX86_FP == 2)
+ MUTILS_COMPILER_WARNING("SSE2 (or higher) instruction set is enabled!")
+ #endif
+ #endif
+ #else
+ #error Compiler is not supported!
+ #endif
+
+ //Architecture detection
+ #if defined(_M_X64)
+ static const char *COMPILER_ARCH = "x64";
+ #elif defined(_M_IX86)
+ static const char *COMPILER_ARCH = "x86";
+ #else
+ #error Architecture is not supported!
+ #endif
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
diff --git a/src/OSSupport_Win32.cpp b/src/OSSupport_Win32.cpp
index 265a1d5..37b2fbd 100644
--- a/src/OSSupport_Win32.cpp
+++ b/src/OSSupport_Win32.cpp
@@ -244,7 +244,7 @@ static volatile bool g_fatal_exit_flag = true;
static DWORD WINAPI fatal_exit_helper(LPVOID lpParameter)
{
- MessageBoxA(NULL, ((LPCSTR) lpParameter), "LameXP - Guru Meditation", MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_TOPMOST | MB_SETFOREGROUND);
+ MessageBoxA(NULL, ((LPCSTR) lpParameter), "Guru Meditation", MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_TOPMOST | MB_SETFOREGROUND);
return 0;
}
diff --git a/src/UpdateChecker.cpp b/src/UpdateChecker.cpp
index 2616361..1f0502e 100644
--- a/src/UpdateChecker.cpp
+++ b/src/UpdateChecker.cpp
@@ -39,7 +39,6 @@ using namespace MUtils;
///////////////////////////////////////////////////////////////////////////////
static const char *header_id = "!Update";
-static const char *section_id = "LameXP";
static const char *mirror_url_postfix[] =
{
@@ -199,12 +198,13 @@ void UpdateCheckerInfo::resetInfo(void)
// Constructor & Destructor
////////////////////////////////////////////////////////////
-UpdateChecker::UpdateChecker(const QString &binWGet, const QString &binGnuPG, const QString &binKeys, const quint32 &installedBuildNo, const bool betaUpdates, const bool testMode)
+UpdateChecker::UpdateChecker(const QString &binWGet, const QString &binGnuPG, const QString &binKeys, const QString &applicationId, const quint32 &installedBuildNo, const bool betaUpdates, const bool testMode)
:
m_updateInfo(new UpdateCheckerInfo()),
m_binaryWGet(binWGet),
m_binaryGnuPG(binGnuPG),
m_binaryKeys(binKeys),
+ m_applicationId(applicationId),
m_installedBuildNo(installedBuildNo),
m_betaUpdates(betaUpdates),
m_testMode(testMode),
@@ -634,8 +634,8 @@ bool UpdateChecker::parseVersionInfo(const QString &file, UpdateCheckerInfo *upd
return false;
}
- bool inHeader = false;
- bool inSection = false;
+ bool inHdr = false;
+ bool inSec = false;
while(!data.atEnd())
{
@@ -643,11 +643,11 @@ bool UpdateChecker::parseVersionInfo(const QString &file, UpdateCheckerInfo *upd
if(section.indexIn(line) >= 0)
{
log(QString("Sec: [%1]").arg(section.cap(1)));
- inSection = (section.cap(1).compare(section_id, Qt::CaseInsensitive) == 0);
- inHeader = (section.cap(1).compare(header_id, Qt::CaseInsensitive) == 0);
+ inSec = (section.cap(1).compare(m_applicationId, Qt::CaseInsensitive) == 0);
+ inHdr = (section.cap(1).compare(QString::fromLatin1(header_id), Qt::CaseInsensitive) == 0);
continue;
}
- if(inSection && (value.indexIn(line) >= 0))
+ if(inSec && (value.indexIn(line) >= 0))
{
log(QString("Val: '%1' ==> '%2").arg(value.cap(1), value.cap(2)));
if(value.cap(1).compare("BuildNo", Qt::CaseInsensitive) == 0)
@@ -678,7 +678,7 @@ bool UpdateChecker::parseVersionInfo(const QString &file, UpdateCheckerInfo *upd
updateInfo->m_downloadFilecode = value.cap(2).trimmed();
}
}
- if(inHeader && (value.indexIn(line) >= 0))
+ if(inHdr && (value.indexIn(line) >= 0))
{
log(QString("Val: '%1' ==> '%2").arg(value.cap(1), value.cap(2)));
if(value.cap(1).compare("TimestampCreated", Qt::CaseInsensitive) == 0)
diff --git a/src/Version.cpp b/src/Version.cpp
new file mode 100644
index 0000000..b55e528
--- /dev/null
+++ b/src/Version.cpp
@@ -0,0 +1,81 @@
+///////////////////////////////////////////////////////////////////////////////
+// MuldeR's Utilities for Qt
+// Copyright (C) 2004-2014 LoRd_MuldeR
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+// http://www.gnu.org/licenses/lgpl-2.1.txt
+//////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include
+
+#include
+#include
+
+///////////////////////////////////////////////////////////////////////////////
+
+static const char *g_months_lut[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
+
+static int month2int(const char *str)
+{
+ int ret = 0;
+
+ for(int j = 0; j < 12; j++)
+ {
+ if(!_strcmpi(str, g_months_lut[j]))
+ {
+ ret = j+1;
+ break;
+ }
+ }
+
+ return ret;
+}
+
+const QDate MUtils::Version::build_date(const char *const raw_date)
+{
+ int date[3] = {0, 0, 0};
+ char temp_m[4], temp_d[3], temp_y[5];
+
+ temp_m[0] = raw_date[0x0];
+ temp_m[1] = raw_date[0x1];
+ temp_m[2] = raw_date[0x2];
+ temp_m[3] = 0x00;
+
+ temp_d[0] = raw_date[0x4];
+ temp_d[1] = raw_date[0x5];
+ temp_d[2] = 0x00;
+
+ temp_y[0] = raw_date[0x7];
+ temp_y[1] = raw_date[0x8];
+ temp_y[2] = raw_date[0x9];
+ temp_y[3] = raw_date[0xA];
+ temp_y[4] = 0x00;
+
+ date[0] = atoi(temp_y);
+ date[1] = month2int(temp_m);
+ date[2] = atoi(temp_d);
+
+ if(!((date[0] > 0) && (date[1] > 0) && (date[2] > 0)))
+ {
+ MUTILS_THROW("Internal error: Date format could not be recognized!");
+ }
+
+ return QDate(date[0], date[1], date[2]);
+}
+
+///////////////////////////////////////////////////////////////////////////////