Make xxxBuildInfo functions to create and return build information.

This commit is contained in:
Seeker4 2019-06-01 15:12:38 -07:00
parent 86d0c11ddd
commit 9561e56ad9
3 changed files with 30 additions and 8 deletions

View File

@ -122,7 +122,7 @@ QString getOpenGLVersionString()
QOpenGLFunctions f; QOpenGLFunctions f;
f.initializeOpenGLFunctions(); f.initializeOpenGLFunctions();
glversion = QString(QLatin1String(reinterpret_cast<const char*>(f.glGetString(GL_VERSION)))); glversion = QString(QLatin1String(reinterpret_cast<const char*>(f.glGetString(GL_VERSION))));
qDebug() << "Graphics Engine:" << glversion; // qDebug() << "Graphics Engine:" << glversion;
#endif #endif
} }
return glversion; return glversion;
@ -193,6 +193,27 @@ QString getBranchVersion()
return version; 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() QString appResourcePath()
{ {
#ifdef Q_OS_MAC #ifdef Q_OS_MAC

View File

@ -45,6 +45,8 @@ float getOpenGLVersion();
const QString & gitRevision(); const QString & gitRevision();
const QString & gitBranch(); const QString & gitBranch();
QStringList makeBuildInfo(QString relinfo, QString forcedEngine);
QStringList getBuildInfo();
QByteArray gCompress(const QByteArray& data); QByteArray gCompress(const QByteArray& data);
QByteArray gUncompress(const QByteArray &data); QByteArray gUncompress(const QByteArray &data);

View File

@ -22,7 +22,8 @@
#include <QProgressDialog> #include <QProgressDialog>
#include "version.h" #include "version.h"
#include "git_info.h" //#include "git_info.h"
//#include "SleepLib/common.h"
#include "logger.h" #include "logger.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "SleepLib/profiles.h" #include "SleepLib/profiles.h"
@ -348,12 +349,10 @@ int main(int argc, char *argv[]) {
QString relinfo = ""; QString relinfo = "";
#endif #endif
relinfo = "("+QSysInfo::kernelType()+" "+QSysInfo::currentCpuArchitecture()+relinfo+")"; 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(); QStringList info = makeBuildInfo(relinfo, forcedEngine);
qDebug() << "Built on" << QSysInfo::machineHostName().toLocal8Bit().data() << "running" << QSysInfo::prettyProductName().toLocal8Bit().data(); for (int i = 0; i < info.size(); ++i)
qDebug() << "Graphics Engine:" << getGraphicsEngine().toLocal8Bit().data(); qDebug().noquote() << info.at(i);
if (forcedEngine != "")
qDebug() << forcedEngine;
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
// Language Selection // Language Selection