1
mirror of https://github.com/monero-project/monero-gui synced 2025-01-04 20:26:23 +01:00

Merge pull request #1657

3481acb Print the GUI version on application startup (skftn)
This commit is contained in:
luigi1111 2018-11-17 23:58:35 -06:00
commit 3e57bb344e
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010

View File

@ -35,6 +35,7 @@
#include <QObject>
#include <QDesktopWidget>
#include <QScreen>
#include <QRegExp>
#include "clipboardAdapter.h"
#include "filter.h"
#include "oscursor.h"
@ -140,10 +141,24 @@ int main(int argc, char *argv[])
qreal physicalDpi = QGuiApplication::primaryScreen()->physicalDotsPerInch();
qreal calculated_ratio = physicalDpi/ref_dpi;
qWarning().nospace() << "Qt:" << QT_VERSION_STR << " | screen: " << rect.width()
<< "x" << rect.height() << " - dpi: " << dpi << " - ratio:"
<< calculated_ratio;
QString GUI_VERSION = "-";
QFile f(":/version.js");
if(!f.open(QFile::ReadOnly)) {
qWarning() << "Could not read qrc:///version.js";
} else {
QByteArray contents = f.readAll();
f.close();
QRegularExpression re("var GUI_VERSION = \"(.*)\"");
QRegularExpressionMatch version_match = re.match(contents);
if (version_match.hasMatch()) {
GUI_VERSION = version_match.captured(1); // "v0.13.0.3"
}
}
qWarning().nospace().noquote() << "Qt:" << QT_VERSION_STR << " GUI:" << GUI_VERSION
<< " | screen: " << rect.width() << "x" << rect.height()
<< " - dpi: " << dpi << " - ratio:" << calculated_ratio;
// registering types for QML
qmlRegisterType<clipboardAdapter>("moneroComponents.Clipboard", 1, 0, "Clipboard");