Merge pull request #712 from amnezia-vpn/bugfix/page-home-recursive-rearrange
fixed recursive rearrange on PageHome
This commit is contained in:
commit
f6acec53c0
2 changed files with 88 additions and 106 deletions
|
@ -89,12 +89,12 @@ RadioButton {
|
||||||
}
|
}
|
||||||
|
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
implicitWidth: content.implicitWidth
|
anchors.left: parent.left
|
||||||
implicitHeight: content.implicitHeight
|
anchors.right: parent.right
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.leftMargin: 8 + background.width
|
anchors.leftMargin: 8 + background.width
|
||||||
|
|
||||||
|
implicitHeight: content.implicitHeight
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: content
|
id: content
|
||||||
|
|
||||||
|
|
|
@ -299,129 +299,111 @@ PageType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Flickable {
|
|
||||||
id: serversContainer
|
ButtonGroup {
|
||||||
|
id: serversRadioButtonGroup
|
||||||
|
}
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
id: serversMenuContent
|
||||||
|
|
||||||
anchors.top: serversMenuHeader.bottom
|
anchors.top: serversMenuHeader.bottom
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
anchors.topMargin: 16
|
anchors.topMargin: 16
|
||||||
|
|
||||||
contentHeight: col.height + col.anchors.bottomMargin
|
model: ServersModel
|
||||||
implicitHeight: parent.height - serversMenuHeader.implicitHeight
|
currentIndex: ServersModel.defaultIndex
|
||||||
clip: true
|
|
||||||
|
|
||||||
ScrollBar.vertical: ScrollBar {
|
ScrollBar.vertical: ScrollBar {
|
||||||
id: scrollBar
|
id: scrollBar
|
||||||
policy: serversContainer.height >= serversContainer.contentHeight ? ScrollBar.AlwaysOff : ScrollBar.AlwaysOn
|
policy: serversMenuContent.height >= serversMenuContent.contentHeight ? ScrollBar.AlwaysOff : ScrollBar.AlwaysOn
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onUpPressed: scrollBar.decrease()
|
Keys.onUpPressed: scrollBar.decrease()
|
||||||
Keys.onDownPressed: scrollBar.increase()
|
Keys.onDownPressed: scrollBar.increase()
|
||||||
|
|
||||||
Column {
|
Connections {
|
||||||
id: col
|
target: ServersModel
|
||||||
anchors.top: parent.top
|
function onDefaultServerIndexChanged(serverIndex) {
|
||||||
anchors.left: parent.left
|
serversMenuContent.currentIndex = serverIndex
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.bottomMargin: 32
|
|
||||||
|
|
||||||
spacing: 16
|
|
||||||
|
|
||||||
ButtonGroup {
|
|
||||||
id: serversRadioButtonGroup
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ListView {
|
clip: true
|
||||||
id: serversMenuContent
|
|
||||||
width: parent.width
|
|
||||||
height: serversMenuContent.contentItem.height
|
|
||||||
|
|
||||||
model: ServersModel
|
delegate: Item {
|
||||||
currentIndex: ServersModel.defaultIndex
|
id: menuContentDelegate
|
||||||
|
|
||||||
Connections {
|
property variant delegateData: model
|
||||||
target: ServersModel
|
|
||||||
function onDefaultServerIndexChanged(serverIndex) {
|
implicitWidth: serversMenuContent.width
|
||||||
serversMenuContent.currentIndex = serverIndex
|
implicitHeight: serverRadioButtonContent.implicitHeight
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: serverRadioButtonContent
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.rightMargin: 16
|
||||||
|
anchors.leftMargin: 16
|
||||||
|
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
VerticalRadioButton {
|
||||||
|
id: serverRadioButton
|
||||||
|
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
text: name
|
||||||
|
descriptionText: serverDescription
|
||||||
|
|
||||||
|
checked: index === serversMenuContent.currentIndex
|
||||||
|
checkable: !ConnectionController.isConnected
|
||||||
|
|
||||||
|
ButtonGroup.group: serversRadioButtonGroup
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (ConnectionController.isConnected) {
|
||||||
|
PageController.showNotificationMessage(qsTr("Unable change server while there is an active connection"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
serversMenuContent.currentIndex = index
|
||||||
|
|
||||||
|
ServersModel.defaultIndex = index
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: serverRadioButton
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
enabled: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ImageButtonType {
|
||||||
|
image: "qrc:/images/controls/settings.svg"
|
||||||
|
imageColor: "#D7D8DB"
|
||||||
|
|
||||||
|
implicitWidth: 56
|
||||||
|
implicitHeight: 56
|
||||||
|
|
||||||
|
z: 1
|
||||||
|
|
||||||
|
onClicked: function() {
|
||||||
|
ServersModel.processedIndex = index
|
||||||
|
PageController.goToPage(PageEnum.PageSettingsServerInfo)
|
||||||
|
drawer.close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clip: true
|
DividerType {
|
||||||
interactive: false
|
Layout.fillWidth: true
|
||||||
|
Layout.leftMargin: 0
|
||||||
delegate: Item {
|
Layout.rightMargin: 0
|
||||||
id: menuContentDelegate
|
|
||||||
|
|
||||||
property variant delegateData: model
|
|
||||||
|
|
||||||
implicitWidth: serversMenuContent.width
|
|
||||||
implicitHeight: serverRadioButtonContent.implicitHeight
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
id: serverRadioButtonContent
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.rightMargin: 16
|
|
||||||
anchors.leftMargin: 16
|
|
||||||
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
VerticalRadioButton {
|
|
||||||
id: serverRadioButton
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
text: name
|
|
||||||
descriptionText: serverDescription
|
|
||||||
|
|
||||||
checked: index === serversMenuContent.currentIndex
|
|
||||||
checkable: !ConnectionController.isConnected
|
|
||||||
|
|
||||||
ButtonGroup.group: serversRadioButtonGroup
|
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
if (ConnectionController.isConnected) {
|
|
||||||
PageController.showNotificationMessage(qsTr("Unable change server while there is an active connection"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
serversMenuContent.currentIndex = index
|
|
||||||
|
|
||||||
ServersModel.defaultIndex = index
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: serverRadioButton
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
enabled: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageButtonType {
|
|
||||||
image: "qrc:/images/controls/settings.svg"
|
|
||||||
imageColor: "#D7D8DB"
|
|
||||||
|
|
||||||
implicitWidth: 56
|
|
||||||
implicitHeight: 56
|
|
||||||
|
|
||||||
z: 1
|
|
||||||
|
|
||||||
onClicked: function() {
|
|
||||||
ServersModel.processedIndex = index
|
|
||||||
PageController.goToPage(PageEnum.PageSettingsServerInfo)
|
|
||||||
drawer.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DividerType {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.leftMargin: 0
|
|
||||||
Layout.rightMargin: 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue