summaryrefslogtreecommitdiffstats
path: root/libraries/ganalytics
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ganalytics')
-rw-r--r--libraries/ganalytics/include/sys.h12
-rw-r--r--libraries/ganalytics/src/ganalytics_worker.cpp4
-rw-r--r--libraries/ganalytics/src/sys_apple.cpp125
-rw-r--r--libraries/ganalytics/src/sys_unix.cpp10
-rw-r--r--libraries/ganalytics/src/sys_win32.cpp22
5 files changed, 31 insertions, 142 deletions
diff --git a/libraries/ganalytics/include/sys.h b/libraries/ganalytics/include/sys.h
index 40e4e513..36f7d9cd 100644
--- a/libraries/ganalytics/include/sys.h
+++ b/libraries/ganalytics/include/sys.h
@@ -3,11 +3,13 @@
namespace Sys
{
-/**
- * Get operation system name and version.
- * @return os A QString with the name and version of the operating system.
- */
-QString getSystemInfo();
+struct KernelInfo
+{
+ QString kernelName;
+ QString kernelVersion;
+};
+
+KernelInfo getKernelInfo();
uint64_t getSystemRam();
diff --git a/libraries/ganalytics/src/ganalytics_worker.cpp b/libraries/ganalytics/src/ganalytics_worker.cpp
index 435306a4..f55a4d09 100644
--- a/libraries/ganalytics/src/ganalytics_worker.cpp
+++ b/libraries/ganalytics/src/ganalytics_worker.cpp
@@ -106,9 +106,7 @@ QString GAnalyticsWorker::getScreenResolution()
*/
QString GAnalyticsWorker::getUserAgent()
{
- QString system = Sys::getSystemInfo();
-
- return QString("%1/%2 (%3)").arg(m_appName).arg(m_appVersion).arg(system);
+ return QString("%1/%2").arg(m_appName).arg(m_appVersion);
}
/**
diff --git a/libraries/ganalytics/src/sys_apple.cpp b/libraries/ganalytics/src/sys_apple.cpp
index f221a527..7e04dd4e 100644
--- a/libraries/ganalytics/src/sys_apple.cpp
+++ b/libraries/ganalytics/src/sys_apple.cpp
@@ -1,121 +1,16 @@
#include "sys.h"
-// FIXME: replace with our version...
-QString Sys::getSystemInfo()
+#include <sys/utsname.h>
+
+Sys::KernelInfo Sys::getKernelInfo()
{
- QSysInfo::MacVersion version = QSysInfo::macVersion();
- QString os;
- switch (version)
- {
- case QSysInfo::MV_9:
- os = "Macintosh; Mac OS 9";
- break;
- case QSysInfo::MV_10_0:
- os = "Macintosh; Mac OS 10.0";
- break;
- case QSysInfo::MV_10_1:
- os = "Macintosh; Mac OS 10.1";
- break;
- case QSysInfo::MV_10_2:
- os = "Macintosh; Mac OS 10.2";
- break;
- case QSysInfo::MV_10_3:
- os = "Macintosh; Mac OS 10.3";
- break;
- case QSysInfo::MV_10_4:
- os = "Macintosh; Mac OS 10.4";
- break;
- case QSysInfo::MV_10_5:
- os = "Macintosh; Mac OS 10.5";
- break;
- case QSysInfo::MV_10_6:
- os = "Macintosh; Mac OS 10.6";
- break;
- case QSysInfo::MV_10_7:
- os = "Macintosh; Mac OS 10.7";
- break;
- case QSysInfo::MV_10_8:
- os = "Macintosh; Mac OS 10.8";
- break;
- case QSysInfo::MV_10_9:
- os = "Macintosh; Mac OS 10.9";
- break;
- case QSysInfo::MV_10_10:
- os = "Macintosh; Mac OS 10.10";
- break;
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
- case QSysInfo::MV_10_11:
- os = "Macintosh; Mac OS 10.11";
- break;
-#endif
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
- case QSysInfo::MV_10_12:
- os = "Macintosh; Mac OS 10.12";
- break;
-#endif
- case QSysInfo::MV_Unknown:
- os = "Macintosh; Mac OS unknown";
- break;
- case QSysInfo::MV_IOS_5_0:
- os = "iPhone; iOS 5.0";
- break;
- case QSysInfo::MV_IOS_5_1:
- os = "iPhone; iOS 5.1";
- break;
- case QSysInfo::MV_IOS_6_0:
- os = "iPhone; iOS 6.0";
- break;
- case QSysInfo::MV_IOS_6_1:
- os = "iPhone; iOS 6.1";
- break;
- case QSysInfo::MV_IOS_7_0:
- os = "iPhone; iOS 7.0";
- break;
- case QSysInfo::MV_IOS_7_1:
- os = "iPhone; iOS 7.1";
- break;
- case QSysInfo::MV_IOS_8_0:
- os = "iPhone; iOS 8.0";
- break;
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
- case QSysInfo::MV_IOS_8_1:
- os = "iPhone; iOS 8.1";
- break;
- case QSysInfo::MV_IOS_8_2:
- os = "iPhone; iOS 8.2";
- break;
- case QSysInfo::MV_IOS_8_3:
- os = "iPhone; iOS 8.3";
- break;
- case QSysInfo::MV_IOS_8_4:
- os = "iPhone; iOS 8.4";
- break;
- case QSysInfo::MV_IOS_9_0:
- os = "iPhone; iOS 9.0";
- break;
-#endif
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
- case QSysInfo::MV_IOS_9_1:
- os = "iPhone; iOS 9.1";
- break;
- case QSysInfo::MV_IOS_9_2:
- os = "iPhone; iOS 9.2";
- break;
- case QSysInfo::MV_IOS_9_3:
- os = "iPhone; iOS 9.3";
- break;
- case QSysInfo::MV_IOS_10_0:
- os = "iPhone; iOS 10.0";
- break;
-#endif
- case QSysInfo::MV_IOS:
- os = "iPhone; iOS unknown";
- break;
- default:
- os = "Macintosh";
- break;
- }
- return os;
+ Sys::KernelInfo out;
+ struct utsname buf;
+ uname(&buf);
+ out.kernelName = buf.sysname;
+ out.kernelVersion = buf.release;
+ out.kernelBuild = buf.version;
+ return out;
}
#include <sys/sysctl.h>
diff --git a/libraries/ganalytics/src/sys_unix.cpp b/libraries/ganalytics/src/sys_unix.cpp
index 9569fbb6..866c9fdb 100644
--- a/libraries/ganalytics/src/sys_unix.cpp
+++ b/libraries/ganalytics/src/sys_unix.cpp
@@ -3,14 +3,14 @@
#include <sys/utsname.h>
#include <fstream>
-QString Sys::getSystemInfo()
+Sys::KernelInfo Sys::getKernelInfo()
{
+ Sys::KernelInfo out;
struct utsname buf;
uname(&buf);
- QString system(buf.sysname);
- QString release(buf.release);
-
- return system + "; " + release;
+ out.kernelName = buf.sysname;
+ out.kernelVersion = buf.release;
+ return out;
}
uint64_t Sys::getSystemRam()
diff --git a/libraries/ganalytics/src/sys_win32.cpp b/libraries/ganalytics/src/sys_win32.cpp
index c2c913ef..4d43169b 100644
--- a/libraries/ganalytics/src/sys_win32.cpp
+++ b/libraries/ganalytics/src/sys_win32.cpp
@@ -2,21 +2,15 @@
#include <windows.h>
-QString Sys::getSystemInfo()
+Sys::KernelInfo Sys::getKernelInfo()
{
- static QString cached;
- if(!cached.isNull())
- {
- return cached;
- }
- else
- {
- OSVERSIONINFOW osvi;
- ZeroMemory(&osvi, sizeof(OSVERSIONINFOW));
- GetVersionExW(&osvi);
- cached = QString("Windows %1.%2").arg(osvi.dwMajorVersion).arg(osvi.dwMinorVersion);
- return cached;
- }
+ Sys::KernelInfo out;
+ out.kernelName = "Windows";
+ OSVERSIONINFOW osvi;
+ ZeroMemory(&osvi, sizeof(OSVERSIONINFOW));
+ GetVersionExW(&osvi);
+ out.kernelVersion = QString("%1.%2").arg(osvi.dwMajorVersion).arg(osvi.dwMinorVersion);
+ return out;
}
uint64_t Sys::getSystemRam()