From 9561e56ad917de3217d7296ab5beaee7500584a7 Mon Sep 17 00:00:00 2001 From: Seeker4 Date: Sat, 1 Jun 2019 15:12:38 -0700 Subject: [PATCH] Make xxxBuildInfo functions to create and return build information. --- oscar/SleepLib/common.cpp | 23 ++++++++++++++++++++++- oscar/SleepLib/common.h | 2 ++ oscar/main.cpp | 13 ++++++------- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/oscar/SleepLib/common.cpp b/oscar/SleepLib/common.cpp index f96ad175..a296d8af 100644 --- a/oscar/SleepLib/common.cpp +++ b/oscar/SleepLib/common.cpp @@ -122,7 +122,7 @@ QString getOpenGLVersionString() QOpenGLFunctions f; f.initializeOpenGLFunctions(); glversion = QString(QLatin1String(reinterpret_cast(f.glGetString(GL_VERSION)))); - qDebug() << "Graphics Engine:" << glversion; +// qDebug() << "Graphics Engine:" << glversion; #endif } return glversion; @@ -193,6 +193,27 @@ QString getBranchVersion() return version; } +QStringList buildInfo; + +QStringList makeBuildInfo (QString relinfo, QString forcedEngine){ + buildInfo << (STR_AppName + " " + VersionString + (relinfo!="" ? " " : "") + relinfo); + buildInfo << (QObject::tr("Built with Qt") + " " + QT_VERSION_STR + " on " + __DATE__ + " " + __TIME__); + buildInfo << (QObject::tr("Branch") + " " + GIT_BRANCH + ", " + + QObject::tr("Revision") + " " + GIT_REVISION); + buildInfo << (QObject::tr("Built on") + " " + QSysInfo::machineHostName() + " " + + QObject::tr("running") + " " + QSysInfo::prettyProductName()); + buildInfo << (QObject::tr("Graphics Engine:") + " " + getOpenGLVersionString()); + buildInfo << (QObject::tr("Graphics Engine type:") + " " + getGraphicsEngine()); + if (forcedEngine != "") + buildInfo << forcedEngine; + + return buildInfo; +} + +QStringList getBuildInfo() { + return buildInfo; +} + QString appResourcePath() { #ifdef Q_OS_MAC diff --git a/oscar/SleepLib/common.h b/oscar/SleepLib/common.h index 35ec57bb..dedfc66f 100644 --- a/oscar/SleepLib/common.h +++ b/oscar/SleepLib/common.h @@ -45,6 +45,8 @@ float getOpenGLVersion(); const QString & gitRevision(); const QString & gitBranch(); +QStringList makeBuildInfo(QString relinfo, QString forcedEngine); +QStringList getBuildInfo(); QByteArray gCompress(const QByteArray& data); QByteArray gUncompress(const QByteArray &data); diff --git a/oscar/main.cpp b/oscar/main.cpp index 66fc52fd..250ca120 100644 --- a/oscar/main.cpp +++ b/oscar/main.cpp @@ -22,7 +22,8 @@ #include #include "version.h" -#include "git_info.h" +//#include "git_info.h" +//#include "SleepLib/common.h" #include "logger.h" #include "mainwindow.h" #include "SleepLib/profiles.h" @@ -348,12 +349,10 @@ int main(int argc, char *argv[]) { QString relinfo = ""; #endif relinfo = "("+QSysInfo::kernelType()+" "+QSysInfo::currentCpuArchitecture()+relinfo+")"; - qDebug() << STR_AppName.toLocal8Bit().data() << VersionString.toLocal8Bit().data() << relinfo.toLocal8Bit().data() << "built with Qt" << QT_VERSION_STR << "on" << __DATE__ << __TIME__; - qDebug() << "Branch" << GIT_BRANCH.toLocal8Bit().data() << "Revision" << GIT_REVISION.toLocal8Bit().data(); - qDebug() << "Built on" << QSysInfo::machineHostName().toLocal8Bit().data() << "running" << QSysInfo::prettyProductName().toLocal8Bit().data(); - qDebug() << "Graphics Engine:" << getGraphicsEngine().toLocal8Bit().data(); - if (forcedEngine != "") - qDebug() << forcedEngine; + + QStringList info = makeBuildInfo(relinfo, forcedEngine); + for (int i = 0; i < info.size(); ++i) + qDebug().noquote() << info.at(i); //////////////////////////////////////////////////////////////////////////////////////////// // Language Selection