1#include "Information.h"
2#include "ui_Information.h"
3#include "RabbitCommonTools.h"
9#ifdef HAVE_WebEngineWidgets
10#include <QWebEngineView>
13#include <QStandardPaths>
15static Q_LOGGING_CATEGORY(log,
"RabbitCommon.DlgAbout.Information")
22 ui->tabWidget->removeTab(0);
24 SetContext(tr(
"Application"), szApp + szInfo);
26 QString szRabbitCommon;
27 szRabbitCommon =
"\n" + tr(
"### RabbitCommon") +
"\n";
30 SetContext(tr(
"RabbitCommon"), szRabbitCommon);
33 szQt = tr(
"### Qt") +
"\n";
34 szQt +=
"- " + tr(
"Qt runtime version: ") + QString(qVersion()) +
"\n";
35 szQt +=
"- " + tr(
"Qt compile version: ") + QString(QT_VERSION_STR) +
"\n";
36#if QT_VERSION > QT_VERSION_CHECK(5, 8, 0)
37 szQt +=
"- " + tr(
"Qt library version: ") + QLibraryInfo::version().toString() +
"\n";
39 szQt +=
"- " + tr(
"Locale: ") + QLocale::system().name() +
"\n";
41 szQt += tr(
"- OpenSSL:") +
"\n";
42 if(QSslSocket::supportsSsl())
44#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 3))
45 szQt +=
" - " + tr(
"Build Version: ") + QSslSocket::sslLibraryBuildVersionString() +
"\n";
47 szQt +=
" - " + tr(
"Installed Version: ") + QSslSocket::sslLibraryVersionString() +
"\n";
49#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 3))
50 szQt +=
" - " + tr(
"Build Version: ") + QSslSocket::sslLibraryBuildVersionString() +
"\n";
52 szQt +=
" - " + tr(
"Don't install OPENSSL dynamic library. Please install it") +
"\n";
54 szQt +=
"- " + tr(
"Standard paths:") +
"\n";
55 for(
int i = 0; i < 19; i++)
57 QStandardPaths::StandardLocation type = (QStandardPaths::StandardLocation)i;
58 szQt +=
" - " + QStandardPaths::displayName(type) +
": ";
59 QStringList lstPath = QStandardPaths::standardLocations(type);
60 if(lstPath.size() == 1)
61 szQt += lstPath.at(0);
63 foreach (
auto p, lstPath) {
64 szQt += QString(
"\n") +
" - " + p;
69 SetContext(tr(
"Qt"), szQt);
72#if QT_VERSION > QT_VERSION_CHECK(5, 4, 0)
73 szOS = tr(
"### OS") +
"\n";
74 szOS +=
"- " + tr(
"OS: ") + QSysInfo::prettyProductName() +
"\n";
75 szOS +=
" - " + tr(
"product type: ") + QSysInfo::productType() +
"\n";
76 szOS +=
" - " + tr(
"product version: ") + QSysInfo::productVersion() +
"\n";
77 szOS +=
"- " + tr(
"Kernel type: ") + QSysInfo::kernelType() +
"\n";
78 szOS +=
"- " + tr(
"Kernel version: ") + QSysInfo::kernelVersion() +
"\n";
79#if QT_VERSION > QT_VERSION_CHECK(5, 11, 0)
80 if(!QSysInfo::bootUniqueId().isEmpty())
81 szOS +=
"- " + tr(
"Boot Id: ") + QSysInfo::bootUniqueId() +
"\n";
83 szOS +=
"- " + tr(
"Build ABI: ") + QSysInfo::buildAbi() +
"\n";
84 szOS +=
"- " + tr(
"CPU: ") +
"\n";
85 szOS +=
" - " + tr(
"Architecture: ") + QSysInfo::currentCpuArchitecture() +
"\n";
86 szOS +=
" - " + tr(
"Build architecture: ") + QSysInfo::buildCpuArchitecture() +
"\n";
88 SetContext(tr(
"OS"), szOS);
91 szHost = tr(
"### Host") +
"\n";
92#if QT_VERSION > QT_VERSION_CHECK(5, 6, 0)
93 szHost +=
"- " + tr(
"Host name: ") + QSysInfo::machineHostName() +
"\n";
95 szHost +=
"- " + tr(
"Domain name: ") + QHostInfo::localDomainName();
98 SetContext(tr(
"Host"), szHost);
103CInformation::~CInformation()
108void CInformation::SetContext(
const QString& szTitle,
const QString& szContext)
110 if(szTitle.isEmpty() || szContext.isEmpty())
112 qCritical(log) <<
"Title or context is empty";
116#if (defined(HAVE_CMARK) || defined (HAVE_CMARK_GFM)) && defined(HAVE_WebEngineWidgets)
117 QWebEngineView* pEdit =
new QWebEngineView(ui->tabWidget);
119 pEdit->setHtml(CDlgAbout::MarkDownToHtml(szContext));
121 ui->tabWidget->addTab(pEdit, szTitle);
123 QTextEdit* pEdit =
new QTextEdit(ui->tabWidget);
125 pEdit->setReadOnly(
true);
126 pEdit->setWordWrapMode(QTextOption::NoWrap);
127 ui->tabWidget->addTab(pEdit, szTitle);
128 pEdit->append(szContext);
130 QTextCursor cursor = pEdit->textCursor();
131 cursor.movePosition(QTextCursor::Start);
132 pEdit->setTextCursor(cursor);