Showing the changes to interface/src/scripting/PlatformInfoScriptingInterface.cpp (1 of 20 files). Show all
Unified · Split
| @@ -10,6 +10,9 @@ · 9 unmodified lines | ||
| 10 | 10 | #include <shared/GlobalAppProperties.h> |
| 11 | 11 | #include <thread> |
| 12 | 12 | |
| 13 | +#include <platform/Platform.h> | |
| 14 | +#include <platform/Profiler.h> | |
| 15 | + | |
| 13 | 16 | #ifdef Q_OS_WIN |
| 14 | 17 | #include <Windows.h> |
| 15 | 18 | #elif defined Q_OS_MAC |
| @@ -21,6 +24,17 @@ PlatformInfoScriptingInterface* PlatformInfoScriptingInterface::getInstance() { · 5 unmodified lines | ||
| 21 | 24 | return &sharedInstance; |
| 22 | 25 | } |
| 23 | 26 | |
| 27 | + | |
| 28 | +PlatformInfoScriptingInterface::PlatformInfoScriptingInterface() { | |
| 29 | + platform::create(); | |
| 30 | + if (!platform::enumeratePlatform()) { | |
| 31 | + } | |
| 32 | +} | |
| 33 | + | |
| 34 | +PlatformInfoScriptingInterface::~PlatformInfoScriptingInterface() { | |
| 35 | + platform::destroy(); | |
| 36 | +} | |
| 37 | + | |
| 24 | 38 | QString PlatformInfoScriptingInterface::getOperatingSystemType() { |
| 25 | 39 | #ifdef Q_OS_WIN |
| 26 | 40 | return "WINDOWS"; |
| @@ -149,3 +163,52 @@ bool PlatformInfoScriptingInterface::isStandalone() { · 122 unmodified lines | ||
| 149 | 163 | return qApp->property(hifi::properties::STANDALONE).toBool(); |
| 150 | 164 | #endif |
| 151 | 165 | } |
| 166 | + | |
| 167 | +int PlatformInfoScriptingInterface::getNumCPUs() { | |
| 168 | + return platform::getNumCPUs(); | |
| 169 | +} | |
| 170 | + | |
| 171 | +QString PlatformInfoScriptingInterface::getCPU(int index) { | |
| 172 | + auto desc = platform::getCPU(index); | |
| 173 | + return QString(desc.dump().c_str()); | |
| 174 | +} | |
| 175 | + | |
| 176 | +int PlatformInfoScriptingInterface::getNumGPUs() { | |
| 177 | + return platform::getNumGPUs(); | |
| 178 | +} | |
| 179 | + | |
| 180 | +QString PlatformInfoScriptingInterface::getGPU(int index) { | |
| 181 | + auto desc = platform::getGPU(index); | |
| 182 | + return QString(desc.dump().c_str()); | |
| 183 | +} | |
| 184 | + | |
| 185 | +int PlatformInfoScriptingInterface::getNumDisplays() { | |
| 186 | + return platform::getNumDisplays(); | |
| 187 | +} | |
| 188 | + | |
| 189 | +QString PlatformInfoScriptingInterface::getDisplay(int index) { | |
| 190 | + auto desc = platform::getDisplay(index); | |
| 191 | + return QString(desc.dump().c_str()); | |
| 192 | +} | |
| 193 | + | |
| 194 | +QString PlatformInfoScriptingInterface::getMemory() { | |
| 195 | + auto desc = platform::getMemory(0); | |
| 196 | + return QString(desc.dump().c_str()); | |
| 197 | +} | |
| 198 | + | |
| 199 | +QString PlatformInfoScriptingInterface::getComputer() { | |
| 200 | + auto desc = platform::getComputer(); | |
| 201 | + return QString(desc.dump().c_str()); | |
| 202 | +} | |
| 203 | + | |
| 204 | + | |
| 205 | +PlatformInfoScriptingInterface::PlatformTier PlatformInfoScriptingInterface::getTierProfiled() { | |
| 206 | + return (PlatformInfoScriptingInterface::PlatformTier) platform::Profiler::profilePlatform(); | |
| 207 | +} | |
| 208 | + | |
| 209 | +QStringList PlatformInfoScriptingInterface::getPlatformTierNames() { | |
| 210 | + static const QStringList platformTierNames = { "UNKNWON", "LOW", "MID", "HIGH" }; | |
| 211 | + return platformTierNames; | |
| 212 | +} | |
| 213 | + | |
| 214 | + | |