fixed display of amnezia dns description on main menu
This commit is contained in:
parent
a83ec10b61
commit
396b7aac18
1 changed files with 56 additions and 36 deletions
|
|
@ -26,6 +26,55 @@ PageType {
|
||||||
property string defaultServerHostName: ServersModel.defaultServerHostName
|
property string defaultServerHostName: ServersModel.defaultServerHostName
|
||||||
property string defaultContainerName: ContainersModel.defaultContainerName
|
property string defaultContainerName: ContainersModel.defaultContainerName
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: PageController
|
||||||
|
|
||||||
|
function onRestorePageHomeState(isContainerInstalled) {
|
||||||
|
buttonContent.state = "expanded"
|
||||||
|
if (isContainerInstalled) {
|
||||||
|
containersDropDown.menuVisible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function onForceCloseDrawer() {
|
||||||
|
buttonContent.state = "collapsed"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: ServersModel
|
||||||
|
|
||||||
|
function onDefaultServerIndexChanged() {
|
||||||
|
updateDescriptions()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: ContainersModel
|
||||||
|
|
||||||
|
function onDefaultContainerChanged() {
|
||||||
|
updateDescriptions()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateDescriptions() {
|
||||||
|
var description = ""
|
||||||
|
if (ServersModel.isDefaultServerHasWriteAccess()) {
|
||||||
|
if (SettingsController.isAmneziaDnsEnabled()
|
||||||
|
&& ContainersModel.isAmneziaDnsContainerInstalled(ServersModel.getDefaultServerIndex())) {
|
||||||
|
description += "Amnezia DNS | "
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (ServersModel.isDefaultServerConfigContainsAmneziaDns()) {
|
||||||
|
description += "Amnezia DNS | "
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
collapsedServerMenuDescription.text = description + root.defaultContainerName + " | " + root.defaultServerHostName
|
||||||
|
expandedServersMenuDescription.text = description + root.defaultServerHostName
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: updateDescriptions()
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
enabled: buttonContent.state === "expanded"
|
enabled: buttonContent.state === "expanded"
|
||||||
|
|
@ -43,20 +92,6 @@ PageType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: PageController
|
|
||||||
|
|
||||||
function onRestorePageHomeState(isContainerInstalled) {
|
|
||||||
buttonContent.state = "expanded"
|
|
||||||
if (isContainerInstalled) {
|
|
||||||
containersDropDown.menuVisible = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function onForceCloseDrawer() {
|
|
||||||
buttonContent.state = "collapsed"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: dragArea
|
id: dragArea
|
||||||
|
|
||||||
|
|
@ -255,26 +290,10 @@ PageType {
|
||||||
}
|
}
|
||||||
|
|
||||||
LabelTextType {
|
LabelTextType {
|
||||||
|
id: collapsedServerMenuDescription
|
||||||
Layout.bottomMargin: 44
|
Layout.bottomMargin: 44
|
||||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||||
visible: buttonContent.collapsedVisibility
|
visible: buttonContent.collapsedVisibility
|
||||||
|
|
||||||
text: {
|
|
||||||
var description = ""
|
|
||||||
if (ServersModel.isDefaultServerHasWriteAccess()) {
|
|
||||||
if (SettingsController.isAmneziaDnsEnabled()
|
|
||||||
&& ContainersModel.isAmneziaDnsContainerInstalled(ServersModel.getDefaultServerIndex())) {
|
|
||||||
description += "Amnezia DNS | "
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (ServersModel.isDefaultServerConfigContainsAmneziaDns()) {
|
|
||||||
description += "Amnezia DNS | "
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
description += root.defaultContainerName + " | " + root.defaultServerHostName
|
|
||||||
return description
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
|
@ -297,10 +316,11 @@ PageType {
|
||||||
}
|
}
|
||||||
|
|
||||||
LabelTextType {
|
LabelTextType {
|
||||||
|
id: expandedServersMenuDescription
|
||||||
Layout.bottomMargin: 24
|
Layout.bottomMargin: 24
|
||||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Qt.AlignHCenter
|
||||||
text: root.defaultServerHostName
|
verticalAlignment: Qt.AlignVCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue