Index: sources/gui/qml/components/HeaderBar.qml =================================================================== diff -u -ra2f4636c3ecf98ec1e38f812f4602e0d67d4b7bf -r51c91d35b3d0d1acac4dfccf6057d3949f302448 --- sources/gui/qml/components/HeaderBar.qml (.../HeaderBar.qml) (revision a2f4636c3ecf98ec1e38f812f4602e0d67d4b7bf) +++ sources/gui/qml/components/HeaderBar.qml (.../HeaderBar.qml) (revision 51c91d35b3d0d1acac4dfccf6057d3949f302448) @@ -1,7 +1,6 @@ import QtQuick 2.12 import "qrc:/components" -import "qrc:/dialogs/headerbar" import "qrc:/globals" Rectangle { id: _root @@ -18,8 +17,18 @@ GradientStop { position: 0.8; color: Qt.darker (Colors.backgroundMain, 1.2) } } - function positionDialog ( button, dialog ) { return button.mapToItem(null, button.width, 0).x - dialog.width } + ListModel { id: _buttonModel + ListElement { image : "qrc:/images/iPrescription"; func : function() { print("Prescription button pressed!")} } + ListElement { image : "qrc:/images/iWifi"; func : function() { _wifiDialog.open() } } + ListElement { image : "qrc:/images/iBluetooth"; func : function() { print("Bluetooth button pressed!")} } + ListElement { image : "qrc:/images/iCloudSync"; func : function() { print("CloudSync button pressed!")} } + ListElement { image : "qrc:/images/iStorage"; func : function() { print("Storage button pressed!")} } + ListElement { image : "qrc:/images/iSettings"; func : function() { print("Storage button Settings!")} } + ListElement { image : "qrc:/images/iInformation"; func : function() { print("Information button pressed!")} } + } + function setXPos ( button, dialog ) { dialog.x = button.mapToItem(null, button.width, 0).x - dialog.width } + Item { id: _dateTimeItem width : Variables.headerBarDateTimeWidth anchors { @@ -114,62 +123,20 @@ rightMargin : _headerButtonRow.spacing } - IconButton { id : _prescriptionButton - iconSize : Variables.headerIconDiameter - iconImageSource : "qrc:/images/iPrescription" - extraSpace : _headerButtonRow.spacing + Repeater { id: _repeater + model: _buttonModel - onPressed: print("Prescription button pressed!") - } + delegate: IconButton { id : _button + iconSize : Variables.headerIconDiameter + iconImageSource : image + extraSpace : _headerButtonRow.spacing - IconButton { id : _wifiButton - iconSize : Variables.headerIconDiameter - iconImageSource : "qrc:/images/iWifi" - extraSpace : _headerButtonRow.spacing - - onPressed : _wifiDialog.open() + onPressed : func() + } } - - IconButton { id : _bluetoothButton - iconSize : Variables.headerIconDiameter - iconImageSource : "qrc:/images/iBluetooth" - extraSpace : _headerButtonRow.spacing - - onPressed: print("Bluetooth button pressed!") - } - - IconButton { id : _cloudSyncButton - iconSize : Variables.headerIconDiameter - iconImageSource : "qrc:/images/iCloudSync" - extraSpace : _headerButtonRow.spacing - - onPressed: print("CloudSync button pressed!") - } - - IconButton { id : _storageButton - iconSize : Variables.headerIconDiameter - iconImageSource : "qrc:/images/iStorage" - extraSpace : _headerButtonRow.spacing - - onPressed: print("Storage button pressed!") - } - - IconButton { id : _settingsButton - iconSize : Variables.headerIconDiameter - iconImageSource : "qrc:/images/iSettings" - extraSpace : _headerButtonRow.spacing - - onPressed: print("Settings button pressed!") - } - - IconButton { id : _informationButton - iconSize : Variables.headerIconDiameter - iconImageSource : "qrc:/images/iInformation" - extraSpace : _headerButtonRow.spacing - - onPressed: print("Information button pressed!") - } } - WiFiDialog { id: _wifiDialog; x: positionDialog(_wifiButton, _wifiDialog) } + Connections { target: _wifiDialog + function onAdjustPosition(type) { setXPos(_repeater.itemAt(type), _wifiDialog) } + } } Index: sources/gui/qml/components/HeaderBarPopup.qml =================================================================== diff -u -ra2f4636c3ecf98ec1e38f812f4602e0d67d4b7bf -r51c91d35b3d0d1acac4dfccf6057d3949f302448 --- sources/gui/qml/components/HeaderBarPopup.qml (.../HeaderBarPopup.qml) (revision a2f4636c3ecf98ec1e38f812f4602e0d67d4b7bf) +++ sources/gui/qml/components/HeaderBarPopup.qml (.../HeaderBarPopup.qml) (revision 51c91d35b3d0d1acac4dfccf6057d3949f302448) @@ -5,6 +5,18 @@ import "qrc:/components" ModalDialog { id: _root + property int type: -1 + + signal adjustPosition (var type) + + enum Button { Prescription, + WiFi, + BlueTooth, + CloudSync, + Storage, + Settings, + Information } + implicitWidth : contentItem.implicitWidth + padding * 2 // Auto-size to content implicitHeight : contentItem.implicitHeight + padding * 2 width : implicitWidth @@ -15,4 +27,6 @@ y : Variables.headerHeight + 5 backgroundColor : "#D2D6DB" showDropShadow : true + + onImplicitWidthChanged: Qt.callLater(function() { adjustPosition(type) }) } Index: sources/gui/qml/dialogs/headerbar/WiFiDialog.qml =================================================================== diff -u -ra2f4636c3ecf98ec1e38f812f4602e0d67d4b7bf -r51c91d35b3d0d1acac4dfccf6057d3949f302448 --- sources/gui/qml/dialogs/headerbar/WiFiDialog.qml (.../WiFiDialog.qml) (revision a2f4636c3ecf98ec1e38f812f4602e0d67d4b7bf) +++ sources/gui/qml/dialogs/headerbar/WiFiDialog.qml (.../WiFiDialog.qml) (revision 51c91d35b3d0d1acac4dfccf6057d3949f302448) @@ -7,6 +7,8 @@ readonly property int pixelSize : Fonts.fontPixelDialogText readonly property bool isConnected : vDevice.ssid !== "" + type : HeaderBarPopup.Button.WiFi + // TODO: Later add Securty type and signal strength if needed contentItem: Column { id : _dialogColumn anchors.centerIn : parent Index: sources/gui/qml/main.qml =================================================================== diff -u -rea51c0546c7061d225e7b9d8b754554c65f0d1b1 -r51c91d35b3d0d1acac4dfccf6057d3949f302448 --- sources/gui/qml/main.qml (.../main.qml) (revision ea51c0546c7061d225e7b9d8b754554c65f0d1b1) +++ sources/gui/qml/main.qml (.../main.qml) (revision 51c91d35b3d0d1acac4dfccf6057d3949f302448) @@ -133,6 +133,7 @@ import "qrc:/components" import "qrc:/dialogs" import "qrc:/dialogs/diagnostics" +import "qrc:/dialogs/headerbar" /*! * \brief Initialization and start point of the QML @@ -334,6 +335,8 @@ // keyboard should always be before AlarmItem to not to covet it. KeyboardItem { id: _keyboard } + WiFiDialog { id: _wifiDialog } + LockDialog { id: _lockDialog } AlarmItem { id: _alarmItem ; z: 996 } PowerItem { id: _powerItem ; z: 997 }