History

getCPUBrand works on Mac

NissimHadar committed 7 years ago

Commit 9c00bdc1 parent bb543531 file · +14 −3Browse files

Showing the changes to interface/src/scripting/PlatformInfoScriptingInterface.cpp (1 of 1 file). Show all

Unified · Split

interface/src/scripting/PlatformInfoScriptingInterface.cpp+14−3
@@ -12,6 +12,8 @@ · 11 unmodified lines
12 12
13#ifdef Q_OS_WIN13#ifdef Q_OS_WIN
14#include <Windows.h>14#include <Windows.h>
15#elif defined Q_OS_MAC
16#include <sstream>
15#endif17#endif
16 18
17PlatformInfoScriptingInterface* PlatformInfoScriptingInterface::getInstance() {19PlatformInfoScriptingInterface* PlatformInfoScriptingInterface::getInstance() {
@@ -51,8 +53,17 @@ QString PlatformInfoScriptingInterface::getCPUBrand() { · 33 unmodified lines
51 }53 }
52 54
53 return CPUBrandString;55 return CPUBrandString;
54#else56#elif defined Q_OS_MAC
55 return "NOT IMPLEMENTED";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#endif67#endif
57}68}
58 69
@@ -74,4 +85,4 @@ int PlatformInfoScriptingInterface::getTotalSystemMemoryMB() { · 15 unmodified lines
74 85
75QString PlatformInfoScriptingInterface::getGraphicsCardType() {86QString PlatformInfoScriptingInterface::getGraphicsCardType() {
76 return qApp->getGraphicsCardType();87 return qApp->getGraphicsCardType();
77}88}