From 82208be49eecc07f9c6a38365876c28273529192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 11 Mar 2018 23:00:54 +0100 Subject: NOISSUE add linux distro name and release stats to analytics Hopefully this can serve as some sort of guideline for focusing effort towards the right distro packages to make. --- libraries/systeminfo/include/distroutils.h | 23 +++++++++++++++++++++++ libraries/systeminfo/include/sys.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 libraries/systeminfo/include/distroutils.h (limited to 'libraries/systeminfo/include') diff --git a/libraries/systeminfo/include/distroutils.h b/libraries/systeminfo/include/distroutils.h new file mode 100644 index 00000000..5ff8d591 --- /dev/null +++ b/libraries/systeminfo/include/distroutils.h @@ -0,0 +1,23 @@ +#include "sys.h" +#include + +namespace Sys { +struct LsbInfo +{ + QString distributor; + QString version; + QString description; + QString codename; +}; + +bool main_lsb_info(LsbInfo & out); +bool fallback_lsb_info(Sys::LsbInfo & out); +void lsb_postprocess(Sys::LsbInfo & lsb, Sys::DistributionInfo & out); +Sys::DistributionInfo read_lsb_release(); + +QString _extract_distribution(const QString & x); +QString _extract_version(const QString & x); +Sys::DistributionInfo read_legacy_release(); + +Sys::DistributionInfo read_os_release(); +} diff --git a/libraries/systeminfo/include/sys.h b/libraries/systeminfo/include/sys.h index e40d9a92..c573eb53 100644 --- a/libraries/systeminfo/include/sys.h +++ b/libraries/systeminfo/include/sys.h @@ -12,6 +12,35 @@ struct KernelInfo KernelInfo getKernelInfo(); +struct DistributionInfo +{ + DistributionInfo operator+(const DistributionInfo& rhs) const + { + DistributionInfo out; + if(!distributionName.isEmpty()) + { + out.distributionName = distributionName; + } + else + { + out.distributionName = rhs.distributionName; + } + if(!distributionVersion.isEmpty()) + { + out.distributionVersion = distributionVersion; + } + else + { + out.distributionVersion = rhs.distributionVersion; + } + return out; + } + QString distributionName; + QString distributionVersion; +}; + +DistributionInfo getDistributionInfo(); + uint64_t getSystemRam(); bool isSystem64bit(); -- cgit v1.2.3