mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 03:59:38 +00:00
move screen defs earlier in main function & fix width and height
This commit is contained in:
parent
ffeecb6234
commit
1b07cdad1c
1 changed files with 14 additions and 14 deletions
28
main.cpp
28
main.cpp
|
@ -124,6 +124,20 @@ int main(int argc, char *argv[])
|
|||
|
||||
qDebug() << "app startd";
|
||||
|
||||
// screen settings
|
||||
// Mobile is designed on 128dpi
|
||||
qreal ref_dpi = 128;
|
||||
QRect geo = QApplication::desktop()->availableGeometry();
|
||||
QRect rect = QGuiApplication::primaryScreen()->geometry();
|
||||
qreal dpi = QGuiApplication::primaryScreen()->logicalDotsPerInch();
|
||||
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;
|
||||
|
||||
|
||||
// registering types for QML
|
||||
qmlRegisterType<clipboardAdapter>("moneroComponents.Clipboard", 1, 0, "Clipboard");
|
||||
|
||||
|
@ -221,17 +235,6 @@ int main(int argc, char *argv[])
|
|||
engine.rootContext()->setContextProperty("isIOS", isIOS);
|
||||
engine.rootContext()->setContextProperty("isAndroid", isAndroid);
|
||||
|
||||
// screen settings
|
||||
// Mobile is designed on 128dpi
|
||||
qreal ref_dpi = 128;
|
||||
QRect geo = QApplication::desktop()->availableGeometry();
|
||||
QRect rect = QGuiApplication::primaryScreen()->geometry();
|
||||
qreal height = qMax(rect.width(), rect.height());
|
||||
qreal width = qMin(rect.width(), rect.height());
|
||||
qreal dpi = QGuiApplication::primaryScreen()->logicalDotsPerInch();
|
||||
qreal physicalDpi = QGuiApplication::primaryScreen()->physicalDotsPerInch();
|
||||
qreal calculated_ratio = physicalDpi/ref_dpi;
|
||||
|
||||
engine.rootContext()->setContextProperty("screenWidth", geo.width());
|
||||
engine.rootContext()->setContextProperty("screenHeight", geo.height());
|
||||
#ifdef Q_OS_ANDROID
|
||||
|
@ -240,9 +243,6 @@ int main(int argc, char *argv[])
|
|||
engine.rootContext()->setContextProperty("scaleRatio", 1);
|
||||
#endif
|
||||
|
||||
qWarning().nospace() << "Qt:" << QT_VERSION_STR << " | screen: " << width
|
||||
<< "x" << height << " - dpi: " << dpi << " - ratio:"
|
||||
<< calculated_ratio;
|
||||
|
||||
if (!moneroAccountsRootDir.empty()) {
|
||||
QString moneroAccountsDir = moneroAccountsRootDir.at(0) + "/Monero/wallets";
|
||||
|
|
Loading…
Reference in a new issue