From d8d2f5d0f47cc40d810ed9cb4dc0a10255d5fa8c Mon Sep 17 00:00:00 2001 From: hogliux Date: Tue, 6 Feb 2018 12:17:16 +0000 Subject: [PATCH] Added new SystemStats::getDeviceManufacturer() --- examples/Demo/Source/Demos/SystemInfoDemo.cpp | 1 + modules/juce_core/native/juce_android_SystemStats.cpp | 5 +++++ modules/juce_core/native/juce_linux_SystemStats.cpp | 5 +++++ modules/juce_core/native/juce_mac_SystemStats.mm | 5 +++++ modules/juce_core/native/juce_win32_SystemStats.cpp | 5 +++++ modules/juce_core/system/juce_SystemStats.h | 5 +++++ 6 files changed, 26 insertions(+) diff --git a/examples/Demo/Source/Demos/SystemInfoDemo.cpp b/examples/Demo/Source/Demos/SystemInfoDemo.cpp index c310943913..79836392e8 100644 --- a/examples/Demo/Source/Demos/SystemInfoDemo.cpp +++ b/examples/Demo/Source/Demos/SystemInfoDemo.cpp @@ -116,6 +116,7 @@ static String getAllSystemInfo() << "Operating system: " << SystemStats::getOperatingSystemName() << newLine << "Host name: " << SystemStats::getComputerName() << newLine << "Device type: " << SystemStats::getDeviceDescription() << newLine + << "Manufacturer: " << SystemStats::getDeviceManufacturer() << newLine << "User logon name: " << SystemStats::getLogonName() << newLine << "Full user name: " << SystemStats::getFullUserName() << newLine << "User region: " << SystemStats::getUserRegion() << newLine diff --git a/modules/juce_core/native/juce_android_SystemStats.cpp b/modules/juce_core/native/juce_android_SystemStats.cpp index c43114e887..6089fd7a28 100644 --- a/modules/juce_core/native/juce_android_SystemStats.cpp +++ b/modules/juce_core/native/juce_android_SystemStats.cpp @@ -380,6 +380,11 @@ String SystemStats::getDeviceDescription() + "-" + AndroidStatsHelpers::getAndroidOsBuildValue ("SERIAL"); } +String SystemStats::getDeviceManufacturer() +{ + return AndroidStatsHelpers::getAndroidOsBuildValue ("MANUFACTURER"); +} + bool SystemStats::isOperatingSystem64Bit() { #if JUCE_64BIT diff --git a/modules/juce_core/native/juce_linux_SystemStats.cpp b/modules/juce_core/native/juce_linux_SystemStats.cpp index 40f19187fc..6b27719693 100644 --- a/modules/juce_core/native/juce_linux_SystemStats.cpp +++ b/modules/juce_core/native/juce_linux_SystemStats.cpp @@ -60,6 +60,11 @@ String SystemStats::getDeviceDescription() return getCpuInfo ("Hardware"); } +String SystemStats::getDeviceManufacturer() +{ + return {}; +} + String SystemStats::getCpuVendor() { auto v = getCpuInfo ("vendor_id"); diff --git a/modules/juce_core/native/juce_mac_SystemStats.mm b/modules/juce_core/native/juce_mac_SystemStats.mm index 81f62192ec..993d0a0139 100644 --- a/modules/juce_core/native/juce_mac_SystemStats.mm +++ b/modules/juce_core/native/juce_mac_SystemStats.mm @@ -153,6 +153,11 @@ String SystemStats::getDeviceDescription() #endif } +String SystemStats::getDeviceManufacturer() +{ + return "Apple"; +} + bool SystemStats::isOperatingSystem64Bit() { #if JUCE_IOS diff --git a/modules/juce_core/native/juce_win32_SystemStats.cpp b/modules/juce_core/native/juce_win32_SystemStats.cpp index e2b4409350..d1c11423a9 100644 --- a/modules/juce_core/native/juce_win32_SystemStats.cpp +++ b/modules/juce_core/native/juce_win32_SystemStats.cpp @@ -253,6 +253,11 @@ String SystemStats::getDeviceDescription() #endif } +String SystemStats::getDeviceManufacturer() +{ + return {}; +} + bool SystemStats::isOperatingSystem64Bit() { #if JUCE_64BIT diff --git a/modules/juce_core/system/juce_SystemStats.h b/modules/juce_core/system/juce_SystemStats.h index 2bd1d9be5a..041807a518 100644 --- a/modules/juce_core/system/juce_SystemStats.h +++ b/modules/juce_core/system/juce_SystemStats.h @@ -129,6 +129,11 @@ public: */ static String getDeviceDescription(); + /** This will attempt to return the manufacturer of the device. + If no description is available, it'll just return an empty string. + */ + static String getDeviceManufacturer(); + /** This method calculates some IDs to uniquely identify the device. The first choice for an ID is a filesystem ID for the user's home folder or