mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 15:59:49 +02:00
getCPUBrand works on Mac
This commit is contained in:
parent
bb54353644
commit
9c00bdcddb
1 changed files with 14 additions and 3 deletions
|
@ -12,6 +12,8 @@
|
|||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <Windows.h>
|
||||
#elif defined Q_OS_MAC
|
||||
#include <sstream>
|
||||
#endif
|
||||
|
||||
PlatformInfoScriptingInterface* PlatformInfoScriptingInterface::getInstance() {
|
||||
|
@ -51,8 +53,17 @@ QString PlatformInfoScriptingInterface::getCPUBrand() {
|
|||
}
|
||||
|
||||
return CPUBrandString;
|
||||
#else
|
||||
return "NOT IMPLEMENTED";
|
||||
#elif defined Q_OS_MAC
|
||||
FILE* stream = popen("sysctl -n machdep.cpu.brand_string", "r");
|
||||
|
||||
std::ostringstream hostStream;
|
||||
while (!feof(stream) && !ferror(stream)) {
|
||||
char buf[128];
|
||||
int bytesRead = fread(buf, 1, 128, stream);
|
||||
hostStream.write(buf, bytesRead);
|
||||
}
|
||||
|
||||
return QString::fromStdString(hostStream.str());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -74,4 +85,4 @@ int PlatformInfoScriptingInterface::getTotalSystemMemoryMB() {
|
|||
|
||||
QString PlatformInfoScriptingInterface::getGraphicsCardType() {
|
||||
return qApp->getGraphicsCardType();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue