Add Help/System Information to display full build information, active graphics engine, and data directory.

This commit is contained in:
Seeker4 2019-06-01 19:51:18 -07:00
parent 9561e56ad9
commit 59270e00c6
6 changed files with 149 additions and 19 deletions

View File

@ -180,15 +180,9 @@ QString getBranchVersion()
if (GIT_BRANCH != "master") { if (GIT_BRANCH != "master") {
version += " [Branch: " + GIT_BRANCH + "]"; version += " [Branch: " + GIT_BRANCH + "]";
} }
// version += GIT_REVISION;
#ifndef UNITTEST_MODE
// There is no graphics engine on the console.
// version += QString(" ") + getGraphicsEngine();
#endif
// version += "]";
#ifdef BROKEN_OPENGL_BUILD #ifdef BROKEN_OPENGL_BUILD
version += "[ "+CSTR_GFX_BrokenGL+"]"; version += " ["+CSTR_GFX_BrokenGL+"]";
#endif #endif
return version; return version;
} }
@ -196,10 +190,9 @@ QString getBranchVersion()
QStringList buildInfo; QStringList buildInfo;
QStringList makeBuildInfo (QString relinfo, QString forcedEngine){ QStringList makeBuildInfo (QString relinfo, QString forcedEngine){
buildInfo << (STR_AppName + " " + VersionString + (relinfo!="" ? " " : "") + relinfo); buildInfo << (STR_AppName + " " + VersionString + " " + relinfo);
buildInfo << (QObject::tr("Built with Qt") + " " + QT_VERSION_STR + " on " + __DATE__ + " " + __TIME__); buildInfo << (QObject::tr("Built with Qt") + " " + QT_VERSION_STR + " on " + __DATE__ + " " + __TIME__);
buildInfo << (QObject::tr("Branch") + " " + GIT_BRANCH + ", " buildInfo << (getBranchVersion() + ", " + QObject::tr("Revision") + " " + GIT_REVISION);
+ QObject::tr("Revision") + " " + GIT_REVISION);
buildInfo << (QObject::tr("Built on") + " " + QSysInfo::machineHostName() + " " buildInfo << (QObject::tr("Built on") + " " + QSysInfo::machineHostName() + " "
+ QObject::tr("running") + " " + QSysInfo::prettyProductName()); + QObject::tr("running") + " " + QSysInfo::prettyProductName());
buildInfo << (QObject::tr("Graphics Engine:") + " " + getOpenGLVersionString()); buildInfo << (QObject::tr("Graphics Engine:") + " " + getOpenGLVersionString());
@ -210,6 +203,11 @@ QStringList makeBuildInfo (QString relinfo, QString forcedEngine){
return buildInfo; return buildInfo;
} }
QStringList addBuildInfo (QString value) {
buildInfo << (value);
return buildInfo;
}
QStringList getBuildInfo() { QStringList getBuildInfo() {
return buildInfo; return buildInfo;
} }

View File

@ -47,6 +47,7 @@ const QString & gitBranch();
QStringList makeBuildInfo(QString relinfo, QString forcedEngine); QStringList makeBuildInfo(QString relinfo, QString forcedEngine);
QStringList getBuildInfo(); QStringList getBuildInfo();
QStringList addBuildInfo (QString value);
QByteArray gCompress(const QByteArray& data); QByteArray gCompress(const QByteArray& data);
QByteArray gUncompress(const QByteArray &data); QByteArray gUncompress(const QByteArray &data);

View File

@ -22,8 +22,6 @@
#include <QProgressDialog> #include <QProgressDialog>
#include "version.h" #include "version.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"
@ -343,16 +341,14 @@ int main(int argc, char *argv[]) {
initializeLogger(); initializeLogger();
QThread::msleep(50); // Logger takes a little bit to catch up QThread::msleep(50); // Logger takes a little bit to catch up
#ifdef QT_DEBUG #ifdef QT_DEBUG
QString relinfo = " debug"; QString relinfo = " debug";
#else #else
QString relinfo = ""; QString relinfo = "";
#endif #endif
relinfo = "("+QSysInfo::kernelType()+" "+QSysInfo::currentCpuArchitecture()+relinfo+")"; relinfo = "("+QSysInfo::kernelType()+" "+QSysInfo::currentCpuArchitecture()+relinfo+")";
qDebug().noquote() << STR_AppName << VersionString << relinfo << "Built with Qt" << QT_VERSION_STR << __DATE__ << __TIME__;
QStringList info = makeBuildInfo(relinfo, forcedEngine);
for (int i = 0; i < info.size(); ++i)
qDebug().noquote() << info.at(i);
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
// Language Selection // Language Selection
@ -366,6 +362,12 @@ int main(int argc, char *argv[]) {
mainwin = new MainWindow; mainwin = new MainWindow;
// Moved buildInfo calls to after translation is available as makeBuildInfo includes tr() calls
QStringList info = makeBuildInfo(relinfo, forcedEngine);
for (int i = 0; i < info.size(); ++i)
qDebug().noquote() << info.at(i);
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Detection // OpenGL Detection
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
@ -475,6 +477,10 @@ int main(int argc, char *argv[]) {
qDebug() << "AppData folder already exists, so ..."; qDebug() << "AppData folder already exists, so ...";
qDebug() << "Using " + GetAppData() + " as OSCAR data folder"; qDebug() << "Using " + GetAppData() + " as OSCAR data folder";
addBuildInfo("");
addBuildInfo(QObject::tr("Data directory:") + " " + GetAppData());
QDir newDir(GetAppData()); QDir newDir(GetAppData());
#if QT_VERSION < QT_VERSION_CHECK(5,9,0) #if QT_VERSION < QT_VERSION_CHECK(5,9,0)
if ( ! newDir.exists() || newDir.count() == 0 ) { // directoy doesn't exist yet or is empty, try to migrate old data if ( ! newDir.exists() || newDir.count() == 0 ) { // directoy doesn't exist yet or is empty, try to migrate old data

View File

@ -2549,6 +2549,15 @@ void MainWindow::on_actionReport_a_Bug_triggered()
QMessageBox::information(nullptr, STR_MessageBox_Error, tr("Reporting issues is not yet implemented")); QMessageBox::information(nullptr, STR_MessageBox_Error, tr("Reporting issues is not yet implemented"));
} }
void MainWindow::on_actionSystem_Information_triggered()
{
QString text = ""; // tr("OSCAR version:") + "<br/>";
QStringList info = getBuildInfo();
for (int i = 0; i < info.size(); ++i)
text += info.at(i) + "<br/>";
QMessageBox::information(nullptr, tr("OSCAR Information"), text);
}
void MainWindow::on_profilesButton_clicked() void MainWindow::on_profilesButton_clicked()
{ {
ui->tabWidget->setCurrentWidget(profileSelector); ui->tabWidget->setCurrentWidget(profileSelector);

View File

@ -320,6 +320,8 @@ class MainWindow : public QMainWindow
void on_actionReport_a_Bug_triggered(); void on_actionReport_a_Bug_triggered();
void on_actionSystem_Information_triggered();
void on_profilesButton_clicked(); void on_profilesButton_clicked();
void reloadProfile(); void reloadProfile();

View File

@ -160,6 +160,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@ -297,6 +306,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@ -434,6 +452,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@ -636,6 +663,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@ -773,6 +809,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@ -910,6 +955,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@ -1211,7 +1265,7 @@ QToolBox::tab:selected {
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>327</width> <width>175</width>
<height>687</height> <height>687</height>
</rect> </rect>
</property> </property>
@ -1669,7 +1723,7 @@ border: 2px solid #56789a; border-radius: 30px;
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>327</width> <width>175</width>
<height>687</height> <height>687</height>
</rect> </rect>
</property> </property>
@ -1948,6 +2002,15 @@ border: 2px solid #56789a; border-radius: 30px;
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@ -2118,6 +2181,15 @@ border: 2px solid #56789a; border-radius: 30px;
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@ -2288,6 +2360,15 @@ border: 2px solid #56789a; border-radius: 30px;
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@ -2390,6 +2471,15 @@ border: 2px solid #56789a; border-radius: 30px;
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@ -2455,6 +2545,15 @@ border: 2px solid #56789a; border-radius: 30px;
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@ -2520,6 +2619,15 @@ border: 2px solid #56789a; border-radius: 30px;
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@ -2728,7 +2836,7 @@ p, li { white-space: pre-wrap; }
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>327</width> <width>175</width>
<height>687</height> <height>687</height>
</rect> </rect>
</property> </property>
@ -2856,6 +2964,7 @@ p, li { white-space: pre-wrap; }
<addaction name="actionDebug"/> <addaction name="actionDebug"/>
<addaction name="actionShow_Performance_Counters"/> <addaction name="actionShow_Performance_Counters"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionSystem_Information"/>
<addaction name="actionReport_a_Bug"/> <addaction name="actionReport_a_Bug"/>
<addaction name="action_About"/> <addaction name="action_About"/>
</widget> </widget>
@ -3185,6 +3294,11 @@ p, li { white-space: pre-wrap; }
<string>Report an Issue</string> <string>Report an Issue</string>
</property> </property>
</action> </action>
<action name="actionSystem_Information">
<property name="text">
<string>System Information</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>