| 58 | } |
| 59 | |
| 60 | std::string ProgramInformation::prettyProductInfoWrapper() |
| 61 | { |
| 62 | auto productName = QSysInfo::prettyProductName(); |
| 63 | #ifdef FC_OS_MACOSX |
| 64 | auto macosVersionFile = QStringLiteral( |
| 65 | "/System/Library/CoreServices/.SystemVersionPlatform.plist" |
| 66 | ); |
| 67 | auto fi = QFileInfo(macosVersionFile); |
| 68 | if (fi.exists() && fi.isReadable()) { |
| 69 | auto plistFile = QFile(macosVersionFile); |
| 70 | plistFile.open(QIODevice::ReadOnly); |
| 71 | while (!plistFile.atEnd()) { |
| 72 | auto line = plistFile.readLine(); |
| 73 | if (line.contains("ProductUserVisibleVersion")) { |
| 74 | auto nextLine = plistFile.readLine(); |
| 75 | if (nextLine.contains("<string>")) { |
| 76 | QRegularExpression re(QStringLiteral("\\s*<string>(.*)</string>")); |
| 77 | auto matches = re.match(QString::fromUtf8(nextLine)); |
| 78 | if (matches.hasMatch()) { |
| 79 | productName = QStringLiteral("macOS ") + matches.captured(1); |
| 80 | break; |
| 81 | } |
| 82 | } |
| 83 | } |
| 84 | } |
| 85 | } |
| 86 | #endif |
| 87 | #ifdef FC_OS_WIN64 |
| 88 | QSettings regKey { |
| 89 | QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"), |
| 90 | QSettings::NativeFormat |
| 91 | }; |
| 92 | if (regKey.contains(QStringLiteral("CurrentBuildNumber"))) { |
| 93 | auto buildNumber = regKey.value(QStringLiteral("CurrentBuildNumber")).toInt(); |
| 94 | if (buildNumber > 0) { |
| 95 | if (buildNumber < 9200) { |
| 96 | productName = QStringLiteral("Windows 7 build %1").arg(buildNumber); |
| 97 | } |
| 98 | else if (buildNumber < 10240) { |
| 99 | productName = QStringLiteral("Windows 8 build %1").arg(buildNumber); |
| 100 | } |
| 101 | else if (buildNumber < 22000) { |
| 102 | productName = QStringLiteral("Windows 10 build %1").arg(buildNumber); |
| 103 | } |
| 104 | else { |
| 105 | productName = QStringLiteral("Windows 11 build %1").arg(buildNumber); |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | #endif |
| 110 | return productName.toStdString(); |
| 111 | } |
| 112 | |
| 113 | static std::string getModuleInfoString(const std::string& path) |
| 114 | { |
nothing calls this directly
no test coverage detected