qml: fix autoconnect/single server selection, tapping server selects.
This commit is contained in:
@@ -1,17 +1,23 @@
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Layouts 1.0
|
||||
import QtQuick.Controls 2.1
|
||||
import QtQuick.Controls.Material 2.0
|
||||
|
||||
import org.electrum 1.0
|
||||
|
||||
Item {
|
||||
property alias auto_server: auto_server_cb.checked
|
||||
id: root
|
||||
|
||||
property alias auto_connect: auto_server_cb.checked
|
||||
property alias address: address_tf.text
|
||||
|
||||
height: rootLayout.height
|
||||
implicitHeight: rootLayout.height
|
||||
|
||||
ColumnLayout {
|
||||
id: rootLayout
|
||||
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
spacing: constants.paddingLarge
|
||||
|
||||
CheckBox {
|
||||
@@ -35,5 +41,67 @@ Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ColumnLayout {
|
||||
Label {
|
||||
text: qsTr('Servers')
|
||||
font.pixelSize: constants.fontSizeLarge
|
||||
color: Material.accentColor
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
height: 1
|
||||
color: Material.accentColor
|
||||
}
|
||||
|
||||
Frame {
|
||||
background: PaneInsetBackground { baseColor: Material.dialogColor }
|
||||
clip: true
|
||||
verticalPadding: 0
|
||||
horizontalPadding: 0
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
Layout.bottomMargin: constants.paddingLarge
|
||||
|
||||
ListView {
|
||||
id: serversListView
|
||||
anchors.fill: parent
|
||||
model: Network.serverListModel
|
||||
delegate: ServerDelegate {
|
||||
onClicked: {
|
||||
address_tf.text = model.name
|
||||
}
|
||||
}
|
||||
|
||||
section.property: 'chain'
|
||||
section.criteria: ViewSection.FullString
|
||||
section.delegate: RowLayout {
|
||||
width: ListView.view.width
|
||||
required property string section
|
||||
Label {
|
||||
text: section
|
||||
? serversListView.model.chaintips > 1
|
||||
? qsTr('Connected @%1').arg(section)
|
||||
: qsTr('Connected')
|
||||
: qsTr('Other known servers')
|
||||
Layout.alignment: Qt.AlignLeft
|
||||
Layout.topMargin: constants.paddingXSmall
|
||||
Layout.leftMargin: constants.paddingSmall
|
||||
font.pixelSize: constants.fontSizeMedium
|
||||
color: Material.accentColor
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
root.auto_connect = Config.autoConnectDefined ? Config.autoConnect : false
|
||||
root.address = Config.serverString ? Config.serverString : Network.server
|
||||
// TODO: initial setup should not connect already, is Network.server defined?
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user