summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-11-22 02:02:49 +0100
committerPetr Mrázek <peterix@gmail.com>2016-11-22 02:46:18 +0100
commit7a14b639574fb7139761c7ca4986fa03e99b7366 (patch)
tree12ff5f68e729352676ba642f3943a601362cac14
parent44805145dc385ba9ffe0d78f2e723cef42984537 (diff)
downloadMultiMC-7a14b639574fb7139761c7ca4986fa03e99b7366.tar
MultiMC-7a14b639574fb7139761c7ca4986fa03e99b7366.tar.gz
MultiMC-7a14b639574fb7139761c7ca4986fa03e99b7366.tar.lz
MultiMC-7a14b639574fb7139761c7ca4986fa03e99b7366.tar.xz
MultiMC-7a14b639574fb7139761c7ca4986fa03e99b7366.zip
NOISSUE send custom analytics values
* System, Java and CPU architecture (either 32 or 64). * Java version. * System memory size in MB. * Java min/max heap size in MB.
-rw-r--r--application/MultiMC.cpp31
-rw-r--r--libraries/ganalytics/CMakeLists.txt2
-rw-r--r--libraries/ganalytics/include/sys.h (renamed from libraries/ganalytics/src/sys.h)0
3 files changed, 31 insertions, 2 deletions
diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp
index 49e45c41..6c7deca1 100644
--- a/application/MultiMC.cpp
+++ b/application/MultiMC.cpp
@@ -64,7 +64,9 @@
#include <FileSystem.h>
#include <DesktopServices.h>
#include <LocalPeer.h>
+
#include <ganalytics.h>
+#include <sys.h>
#if defined Q_OS_WIN32
#ifndef WIN32_LEAN_AND_MEAN
@@ -962,9 +964,36 @@ MainWindow* MultiMC::showMainWindow(bool minimized)
m_mainWindow->checkInstancePathForProblems();
m_openWindows++;
}
+ // FIXME: move this somewhere else...
if(m_analytics)
{
- m_analytics->sendScreenView("Main Window");
+ auto windowSize = m_mainWindow->size();
+ auto sizeString = QString("%1x%2").arg(windowSize.width()).arg(windowSize.height());
+ qDebug() << "Viewport size" << sizeString;
+ m_analytics->setViewportSize(sizeString);
+ /*
+ * cm1 = java min heap [MB]
+ * cm2 = java max heap [MB]
+ * cm3 = system RAM [MB]
+ *
+ * cd1 = java version
+ * cd2 = java architecture
+ * cd3 = system architecture
+ * cd4 = CPU architecture
+ */
+ QVariantMap customValues;
+ customValues["cm1"] = m_settings->get("MinMemAlloc");
+ customValues["cm2"] = m_settings->get("MaxMemAlloc");
+ constexpr uint64_t Mega = 1024ull * 1024ull;
+ int ramSize = int(Sys::getSystemRam() / Mega);
+ qDebug() << "RAM size is" << ramSize << "MB";
+ customValues["cm3"] = ramSize;
+
+ customValues["cd1"] = m_settings->get("JavaVersion");
+ customValues["cd2"] = m_settings->get("JavaArchitecture");
+ customValues["cd3"] = Sys::isSystem64bit() ? "64":"32";
+ customValues["cd4"] = Sys::isCPU64bit() ? "64":"32";
+ m_analytics->sendScreenView("Main Window", customValues);
}
return m_mainWindow;
}
diff --git a/libraries/ganalytics/CMakeLists.txt b/libraries/ganalytics/CMakeLists.txt
index 4b9a0cee..1f2ff4e2 100644
--- a/libraries/ganalytics/CMakeLists.txt
+++ b/libraries/ganalytics/CMakeLists.txt
@@ -8,7 +8,7 @@ set(ganalytics_SOURCES
src/ganalytics.cpp
src/ganalytics_worker.cpp
src/ganalytics_worker.h
-src/sys.h
+include/sys.h
include/ganalytics.h
)
diff --git a/libraries/ganalytics/src/sys.h b/libraries/ganalytics/include/sys.h
index 40e4e513..40e4e513 100644
--- a/libraries/ganalytics/src/sys.h
+++ b/libraries/ganalytics/include/sys.h