Merge pull request #9596 from chennes/macVersionInfoHack
Gui: Mac version info hack
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
# include <QApplication>
|
||||
# include <QClipboard>
|
||||
# include <QFile>
|
||||
# include <QFileInfo>
|
||||
# include <QLocale>
|
||||
# include <QMutex>
|
||||
# include <QProcessEnvironment>
|
||||
@@ -59,6 +60,37 @@ using namespace Gui::Dialog;
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
namespace Gui {
|
||||
|
||||
QString prettyProductInfoWrapper()
|
||||
{
|
||||
auto productName = QSysInfo::prettyProductName();
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#ifdef FC_OS_MACOSX
|
||||
auto macosVersionFile = QString::fromUtf8("/System/Library/CoreServices/.SystemVersionPlatform.plist");
|
||||
auto fi = QFileInfo (macosVersionFile);
|
||||
if (fi.exists() && fi.isReadable()) {
|
||||
auto plistFile = QFile(macosVersionFile);
|
||||
plistFile.open(QIODevice::ReadOnly);
|
||||
while (!plistFile.atEnd()) {
|
||||
auto line = plistFile.readLine();
|
||||
if (line.contains("ProductUserVisibleVersion")) {
|
||||
auto nextLine = plistFile.readLine();
|
||||
if (nextLine.contains("<string>")) {
|
||||
QRegularExpression re(QString::fromUtf8("\\s*<string>(.*)</string>"));
|
||||
auto matches = re.match(QString::fromUtf8(nextLine));
|
||||
if (matches.hasMatch()) {
|
||||
productName = QString::fromUtf8("macOS ") + matches.captured(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return productName;
|
||||
}
|
||||
|
||||
/** Displays all messages at startup inside the splash screen.
|
||||
* \author Werner Mayer
|
||||
*/
|
||||
@@ -349,7 +381,7 @@ void AboutDialog::setupLabels()
|
||||
ui->labelBuildDate->setText(date);
|
||||
|
||||
QString os = ui->labelBuildOS->text();
|
||||
os.replace(QString::fromLatin1("Unknown"), QSysInfo::prettyProductName());
|
||||
os.replace(QString::fromLatin1("Unknown"), prettyProductInfoWrapper());
|
||||
ui->labelBuildOS->setText(os);
|
||||
|
||||
QString platform = ui->labelBuildPlatform->text();
|
||||
@@ -745,7 +777,7 @@ void AboutDialog::copyToClipboard()
|
||||
}
|
||||
|
||||
str << "[code]\n";
|
||||
str << "OS: " << QSysInfo::prettyProductName() << deskInfo << '\n';
|
||||
str << "OS: " << prettyProductInfoWrapper() << deskInfo << '\n';
|
||||
str << "Word size of " << exe << ": " << QSysInfo::WordSize << "-bit\n";
|
||||
str << "Version: " << major << "." << minor << "." << point << "." << build;
|
||||
char *appimage = getenv("APPIMAGE");
|
||||
|
||||
Reference in New Issue
Block a user