mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 12:09:57 +00:00
Print the GUI version on application startup
This commit is contained in:
parent
7adeb694c1
commit
3481acbe3c
1 changed files with 18 additions and 3 deletions
21
main.cpp
21
main.cpp
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue