mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Get graphics card type works on Mac laptop
This commit is contained in:
parent
a3dde612d1
commit
c0a784fa94
1 changed files with 22 additions and 0 deletions
|
@ -95,5 +95,27 @@ int PlatformInfoScriptingInterface::getTotalSystemMemoryMB() {
|
|||
}
|
||||
|
||||
QString PlatformInfoScriptingInterface::getGraphicsCardType() {
|
||||
#ifdef Q_OS_WIN
|
||||
return qApp->getGraphicsCardType();
|
||||
#elif defined Q_OS_MAC
|
||||
FILE* stream = popen("system_profiler SPDisplaysDataType | grep Chipset", "r");
|
||||
|
||||
std::ostringstream hostStream;
|
||||
while (!feof(stream) && !ferror(stream)) {
|
||||
char buf[128];
|
||||
int bytesRead = fread(buf, 1, 128, stream);
|
||||
hostStream.write(buf, bytesRead);
|
||||
}
|
||||
|
||||
QString result = QString::fromStdString(hostStream.str());
|
||||
QStringList parts = result.split('\n');
|
||||
for (int i = 0; i < parts.size(); ++i) {
|
||||
if (parts[i].toLower().contains("radeon") || parts[i].toLower().contains("nvidia")) {
|
||||
return parts[i];
|
||||
}
|
||||
}
|
||||
|
||||
return "UNKNOWN";
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue