Showing the changes to interface/src/scripting/PlatformInfoScriptingInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -95,5 +95,27 @@ int PlatformInfoScriptingInterface::getTotalSystemMemoryMB() { · 94 unmodified lines | ||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | QString PlatformInfoScriptingInterface::getGraphicsCardType() { |
| 98 | +#ifdef Q_OS_WIN | |
| 98 | 99 | return qApp->getGraphicsCardType(); |
| 100 | +#elif defined Q_OS_MAC | |
| 101 | + FILE* stream = popen("system_profiler SPDisplaysDataType | grep Chipset", "r"); | |
| 102 | + | |
| 103 | + std::ostringstream hostStream; | |
| 104 | + while (!feof(stream) && !ferror(stream)) { | |
| 105 | + char buf[128]; | |
| 106 | + int bytesRead = fread(buf, 1, 128, stream); | |
| 107 | + hostStream.write(buf, bytesRead); | |
| 108 | + } | |
| 109 | + | |
| 110 | + QString result = QString::fromStdString(hostStream.str()); | |
| 111 | + QStringList parts = result.split('\n'); | |
| 112 | + for (int i = 0; i < parts.size(); ++i) { | |
| 113 | + if (parts[i].toLower().contains("radeon") || parts[i].toLower().contains("nvidia")) { | |
| 114 | + return parts[i]; | |
| 115 | + } | |
| 116 | + } | |
| 117 | + | |
| 118 | + return "UNKNOWN"; | |
| 119 | +#endif | |
| 120 | + | |
| 99 | 121 | } |