diff options
author | Grigorii Zimin <gzimin@luxoft.com> | 2019-10-08 14:05:06 +0300 |
---|---|---|
committer | Egor Nemtsev <enemtsev@luxoft.com> | 2019-10-08 15:05:59 +0000 |
commit | 5f350d0a75ccfc05905ed918f7fa7febe71931de (patch) | |
tree | 6c641b0098ff8ae6525b8cce54b2a2d62c518c4c /src/remotesettings | |
parent | ca17aa0664de421a8a0275f8c7a39de54b88c1d0 (diff) |
[companion-app] fix adjustment for android devices
Companion app is launched by default in Qt::Windowed mode (on desktop)
and in Qt::Maximized mode on android devices, hence we check
and change size according to the window mode.
Task-number: AUTOSUITE-1277
Fixes: AUTOSUITE-1294
Change-Id: I553efe932f642e9f67286ef51625f8525b9d750e
Reviewed-by: Bramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com>
Reviewed-by: Egor Nemtsev <enemtsev@luxoft.com>
Diffstat (limited to 'src/remotesettings')
-rw-r--r-- | src/remotesettings/app/main.qml | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/remotesettings/app/main.qml b/src/remotesettings/app/main.qml index ebb8ee6e..95d0b80f 100644 --- a/src/remotesettings/app/main.qml +++ b/src/remotesettings/app/main.qml @@ -37,7 +37,7 @@ import QtIvi.Media 1.0 import shared.com.pelagicore.remotesettings 1.0 import shared.com.pelagicore.drivedata 1.0 -import QtQuick.Window 2.3 +import QtQuick.Window 2.13 ApplicationWindow { id: root @@ -58,20 +58,29 @@ ApplicationWindow { } Component.onCompleted: { - var screens = Qt.application.screens; - var minH = 1080; - var minW = 1920; - for (var scr in screens) { - minH = Math.min(minH, screens[scr].height); - minW = Math.min(minW, screens[scr].width); - } + // android launches app in maximized mode + // desktop launches in windowed mode + if (visibility === 2 /*Qt.Windowed*/) { + var screens = Qt.application.screens; + var minH = 1080; + var minW = 1920; + for (var scr in screens) { + minH = Math.min(minH, screens[scr].height); + minW = Math.min(minW, screens[scr].width); + } - // if FHD shrink to min - if (minH <= 1080 || minW <= 1920) { - root.width = minimumWidth; - root.height = minimumHeight; + // if FHD shrink to min + if (minH <= 1080 || minW <= 1920) { + root.width = minimumWidth; + root.height = minimumHeight; + } + } else if (visibility === 4 /*Qt.Maximized*/&& Qt.application.screens.length === 1 + || visibility === 5 /*Qt.FullScreen */&& Qt.application.screens.length === 1) { + root.width = Screen.desktopAvailableWidth; + root.height = Screen.desktopAvailableHeight; } + connectionDialog.open(); } |