Add icon for current connection to Main Page Header
This commit is contained in:
parent
45e4189cd3
commit
5db9006be4
@ -13,6 +13,27 @@ Page {
|
|||||||
|
|
||||||
header: FancyHeader {
|
header: FancyHeader {
|
||||||
title: swipeView.currentItem.title
|
title: swipeView.currentItem.title
|
||||||
|
leftButtonVisible: true
|
||||||
|
leftButtonImageSource: {
|
||||||
|
switch (engine.connection.currentConnection.bearerType) {
|
||||||
|
case Connection.BearerTypeLan:
|
||||||
|
case Connection.BearerTypeWan:
|
||||||
|
if (engine.connection.availableBearerTypes & NymeaConnection.BearerTypeEthernet != NymeaConnection.BearerTypeNone) {
|
||||||
|
return "../images/network-wired.svg"
|
||||||
|
}
|
||||||
|
return "../images/network-wifi.svg";
|
||||||
|
case Connection.BearerTypeBluetooth:
|
||||||
|
return "../images/network-wifi.svg";
|
||||||
|
case Connection.BearerTypeCloud:
|
||||||
|
return "../images/cloud.svg"
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
onLeftButtonClicked: {
|
||||||
|
var dialog = connectionDialogComponent.createObject(root, {headerIcon: leftButtonImageSource})
|
||||||
|
dialog.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
model: ListModel {
|
model: ListModel {
|
||||||
ListElement { iconSource: "../images/share.svg"; text: qsTr("Configure things"); page: "thingconfiguration/EditThingsPage.qml" }
|
ListElement { iconSource: "../images/share.svg"; text: qsTr("Configure things"); page: "thingconfiguration/EditThingsPage.qml" }
|
||||||
@ -249,4 +270,74 @@ Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: connectionDialogComponent
|
||||||
|
MeaDialog {
|
||||||
|
id: connectionDialog
|
||||||
|
title: engine.connection.currentHost.name
|
||||||
|
standardButtons: Dialog.NoButton
|
||||||
|
|
||||||
|
Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: qsTr("Connected to")
|
||||||
|
font.pixelSize: app.smallFont
|
||||||
|
elide: Text.ElideRight
|
||||||
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: engine.connection.currentHost.name
|
||||||
|
elide: Text.ElideRight
|
||||||
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: engine.connection.currentHost.uuid
|
||||||
|
font.pixelSize: app.smallFont
|
||||||
|
elide: Text.ElideRight
|
||||||
|
color: Material.color(Material.Grey)
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: engine.connection.currentConnection.url
|
||||||
|
font.pixelSize: app.smallFont
|
||||||
|
elide: Text.ElideRight
|
||||||
|
color: Material.color(Material.Grey)
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: app.margins
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Button {
|
||||||
|
id: cancelButton
|
||||||
|
text: qsTr("OK")
|
||||||
|
Layout.preferredWidth: Math.max(cancelButton.implicitWidth, disconnectButton.implicitWidth)
|
||||||
|
onClicked: connectionDialog.close()
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: disconnectButton
|
||||||
|
text: qsTr("Disconnect")
|
||||||
|
Layout.preferredWidth: Math.max(cancelButton.implicitWidth, disconnectButton.implicitWidth)
|
||||||
|
onClicked: {
|
||||||
|
tabSettings.lastConnectedHost = "";
|
||||||
|
engine.connection.disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,28 +11,6 @@ Page {
|
|||||||
text: qsTr("Box settings")
|
text: qsTr("Box settings")
|
||||||
backButtonVisible: true
|
backButtonVisible: true
|
||||||
onBackPressed: pageStack.pop()
|
onBackPressed: pageStack.pop()
|
||||||
|
|
||||||
HeaderButton {
|
|
||||||
imageSource: {
|
|
||||||
switch (engine.connection.currentConnection.bearerType) {
|
|
||||||
case Connection.BearerTypeLan:
|
|
||||||
case Connection.BearerTypeWan:
|
|
||||||
if (engine.connection.availableBearerTypes & NymeaConnection.BearerTypeEthernet != NymeaConnection.BearerTypeNone) {
|
|
||||||
return "../images/network-wired-offline.svg"
|
|
||||||
}
|
|
||||||
return "../images/network-wifi-offline.svg";
|
|
||||||
case Connection.BearerTypeBluetooth:
|
|
||||||
return "../images/network-wifi-offline.svg";
|
|
||||||
case Connection.BearerTypeCloud:
|
|
||||||
return "../images/cloud-offline.svg"
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
onClicked: {
|
|
||||||
tabSettings.lastConnectedHost = "";
|
|
||||||
engine.connection.disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Flickable {
|
Flickable {
|
||||||
|
|||||||
@ -338,7 +338,7 @@ Page {
|
|||||||
Button {
|
Button {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.leftMargin: app.margins; Layout.rightMargin: app.margins; Layout.topMargin: app.margins
|
Layout.leftMargin: app.margins; Layout.rightMargin: app.margins; Layout.topMargin: app.margins
|
||||||
text: qsTr("Sign Up")
|
text: qsTr("Sign up")
|
||||||
enabled: usernameTextField.acceptableInput && passwordTextField.isValidPassword
|
enabled: usernameTextField.acceptableInput && passwordTextField.isValidPassword
|
||||||
onClicked: {
|
onClicked: {
|
||||||
busyOverlay.shown = true;
|
busyOverlay.shown = true;
|
||||||
|
|||||||
@ -11,9 +11,11 @@ ToolBar {
|
|||||||
property string title
|
property string title
|
||||||
property alias model: menuRepeater.model
|
property alias model: menuRepeater.model
|
||||||
|
|
||||||
property bool showNewTabButton: false
|
property alias leftButtonVisible: leftButton.visible
|
||||||
|
property alias leftButtonImageSource: leftButton.imageSource
|
||||||
|
|
||||||
signal clicked(int index);
|
signal clicked(int index);
|
||||||
|
signal leftButtonClicked();
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
@ -27,6 +29,13 @@ ToolBar {
|
|||||||
opacity: d.menuOpen ? 0 : 1
|
opacity: d.menuOpen ? 0 : 1
|
||||||
Behavior on opacity { NumberAnimation { easing.type: Easing.InOutQuad; duration: 200 } }
|
Behavior on opacity { NumberAnimation { easing.type: Easing.InOutQuad; duration: 200 } }
|
||||||
|
|
||||||
|
HeaderButton {
|
||||||
|
id: leftButton
|
||||||
|
imageSource: "../images/navigation-menu.svg"
|
||||||
|
visible: false
|
||||||
|
onClicked: root.leftButtonClicked()
|
||||||
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
id: label
|
id: label
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|||||||
Reference in New Issue
Block a user