mirror of
https://github.com/lubosz/overte.git
synced 2025-04-08 04:42:20 +02:00
Implement Qt WebEngine and Chromium versions
This adds them in the About object, as well as in the About dialog
This commit is contained in:
parent
95ebe6bab0
commit
5a7aba1fc6
4 changed files with 74 additions and 5 deletions
|
@ -21,7 +21,7 @@ set(CUSTOM_INTERFACE_QRC_PATHS "")
|
|||
|
||||
find_package(
|
||||
Qt5 COMPONENTS
|
||||
Gui Widgets Multimedia Network Qml Quick Script Svg
|
||||
Gui Widgets Multimedia Network Qml Quick Script Svg WebEngineCore WebEngineWidgets
|
||||
${PLATFORM_QT_COMPONENTS}
|
||||
WebChannel WebSockets
|
||||
)
|
||||
|
@ -292,7 +292,7 @@ target_link_libraries(
|
|||
${TARGET_NAME}
|
||||
Qt5::Gui Qt5::Network Qt5::Multimedia Qt5::Widgets
|
||||
Qt5::Qml Qt5::Quick Qt5::Script Qt5::Svg
|
||||
Qt5::WebChannel
|
||||
Qt5::WebChannel Qt5::WebEngineCore Qt5::WebEngineWidgets
|
||||
${PLATFORM_QT_LIBRARIES}
|
||||
)
|
||||
|
||||
|
|
|
@ -98,6 +98,47 @@ Rectangle {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
Item { height: 1; width: 15 }
|
||||
Image {
|
||||
sourceSize.width: 34
|
||||
sourceSize.height: 25
|
||||
source: "../../../images/about-qt.png"
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
About.openUrl("https://www.qt.io/");
|
||||
}
|
||||
}
|
||||
}
|
||||
RalewayRegular {
|
||||
color: "white"
|
||||
text: "Qt WebEngine " + About.qtWebEngineVersion
|
||||
size: 12
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
Row {
|
||||
spacing: 5
|
||||
Image {
|
||||
sourceSize.width: 25
|
||||
sourceSize.height: 25
|
||||
source: "../../../images/about-chromium.svg"
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
About.openUrl("https://www.chromium.org/");
|
||||
}
|
||||
}
|
||||
}
|
||||
RalewayRegular {
|
||||
color: "white"
|
||||
text: "Chromium " + About.qtChromiumVersion
|
||||
size: 12
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
Row {
|
||||
spacing: 5
|
||||
|
||||
Image {
|
||||
sourceSize.width: 70
|
||||
sourceSize.height: 26
|
||||
|
@ -109,9 +150,7 @@ Rectangle {
|
|||
size: 12
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
Row {
|
||||
spacing: 5
|
||||
|
||||
Image {
|
||||
sourceSize.width: 34
|
||||
sourceSize.height: 25
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
#include <ui/TabletScriptingInterface.h>
|
||||
#include <OffscreenQmlDialog.h>
|
||||
#include <qtwebenginecoreversion.h>
|
||||
#include <QWebEngineProfile>
|
||||
|
||||
#include "BuildInfo.h"
|
||||
#include "DependencyManager.h"
|
||||
|
@ -49,6 +51,26 @@ QString AboutUtil::getQtVersion() const {
|
|||
return qVersion();
|
||||
}
|
||||
|
||||
QString AboutUtil::getQtWebEngineVersion() const {
|
||||
return QTWEBENGINECORE_VERSION_STR;
|
||||
}
|
||||
|
||||
QString AboutUtil::getQtChromiumVersion() const {
|
||||
// Qt unfortunately doesn't provide a conventient way of getting the Chromium version,
|
||||
// and it seems internally it gets it from a constant specified on the compiler's command-line.
|
||||
//
|
||||
// It does include this constant into the default user agent though, so we can extract it from there.
|
||||
QString version;
|
||||
QString user_agent = QWebEngineProfile::defaultProfile()->httpUserAgent();
|
||||
for(const QString & text : user_agent.split(" ")){
|
||||
if(text.startsWith(QStringLiteral("Chrome/"))){
|
||||
version = text.mid(QStringLiteral("Chrome/").length());
|
||||
}
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
void AboutUtil::openUrl(const QString& url) const {
|
||||
auto abboutUtilInstance = AboutUtil::getInstance();
|
||||
if (!abboutUtilInstance) {
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
* @property {string} buildVersion - The build version of Interface that is currently running. <em>Read-only.</em>
|
||||
* @property {string} releaseName - The release codename of the version that Interface is currently running. <em>Read-only.</em>
|
||||
* @property {string} qtVersion - The Qt version used in Interface that is currently running. <em>Read-only.</em>
|
||||
* @property {string} qtWebEngineVersion - The Qt WebEngine version used in Interface that is currently running. <em>Read-only.</em>
|
||||
* @property {string} qtChromiumVersion - The Qt Chromium version used in Interface that is currently running. <em>Read-only.</em>
|
||||
*
|
||||
*
|
||||
* @example <caption>Report information on the version of Interface currently running.</caption>
|
||||
* print("Interface platform: " + About.platform);
|
||||
|
@ -70,6 +73,9 @@ class AboutUtil : public QObject {
|
|||
Q_PROPERTY(QString buildVersion READ getBuildVersion CONSTANT)
|
||||
Q_PROPERTY(QString releaseName READ getReleaseName CONSTANT)
|
||||
Q_PROPERTY(QString qtVersion READ getQtVersion CONSTANT)
|
||||
Q_PROPERTY(QString qtWebEngineVersion READ getQtWebEngineVersion CONSTANT)
|
||||
Q_PROPERTY(QString qtChromiumVersion READ getQtChromiumVersion CONSTANT)
|
||||
|
||||
public:
|
||||
static AboutUtil* getInstance();
|
||||
~AboutUtil() {}
|
||||
|
@ -79,6 +85,8 @@ public:
|
|||
QString getBuildVersion() const;
|
||||
QString getReleaseName() const;
|
||||
QString getQtVersion() const;
|
||||
QString getQtWebEngineVersion() const;
|
||||
QString getQtChromiumVersion() const;
|
||||
|
||||
public slots:
|
||||
|
||||
|
|
Loading…
Reference in a new issue