Showing the changes to interface/src/scripting/PlatformInfoScriptingInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -12,6 +12,8 @@ · 11 unmodified lines | ||
| 12 | 12 | |
| 13 | 13 | #ifdef Q_OS_WIN |
| 14 | 14 | #include <Windows.h> |
| 15 | +#elif defined Q_OS_MAC | |
| 16 | +#include <sstream> | |
| 15 | 17 | #endif |
| 16 | 18 | |
| 17 | 19 | PlatformInfoScriptingInterface* PlatformInfoScriptingInterface::getInstance() { |
| @@ -51,8 +53,17 @@ QString PlatformInfoScriptingInterface::getCPUBrand() { · 33 unmodified lines | ||
| 51 | 53 | } |
| 52 | 54 | |
| 53 | 55 | return CPUBrandString; |
| 54 | −#else | |
| 55 | − return "NOT IMPLEMENTED"; | |
| 56 | +#elif defined Q_OS_MAC | |
| 57 | + FILE* stream = popen("sysctl -n machdep.cpu.brand_string", "r"); | |
| 58 | + | |
| 59 | + std::ostringstream hostStream; | |
| 60 | + while (!feof(stream) && !ferror(stream)) { | |
| 61 | + char buf[128]; | |
| 62 | + int bytesRead = fread(buf, 1, 128, stream); | |
| 63 | + hostStream.write(buf, bytesRead); | |
| 64 | + } | |
| 65 | + | |
| 66 | + return QString::fromStdString(hostStream.str()); | |
| 56 | 67 | #endif |
| 57 | 68 | } |
| 58 | 69 | |
| @@ -74,4 +85,4 @@ int PlatformInfoScriptingInterface::getTotalSystemMemoryMB() { · 15 unmodified lines | ||
| 74 | 85 | |
| 75 | 86 | QString PlatformInfoScriptingInterface::getGraphicsCardType() { |
| 76 | 87 | return qApp->getGraphicsCardType(); |
| 77 | −} | |
| 88 | +} | |