This repository has been archived on 2021-06-24. You can view files and clone it, but cannot push or open issues or pull requests.
ui/qml/panes/GroupSettingsPane.qml

147 lines
2.9 KiB
QML
Raw Permalink Normal View History

2018-11-22 00:01:17 +00:00
import QtGraphicalEffects 1.0
import QtQuick 2.7
import QtQuick.Controls 2.4
import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.3
import QtQuick.Window 2.11
2019-02-12 22:47:23 +00:00
import QtQuick.Controls 1.4
2018-11-22 00:01:17 +00:00
import "../widgets"
2019-02-12 22:47:23 +00:00
import "../styles"
2019-02-13 05:08:43 +00:00
import "../utils.js" as Utils
2018-11-22 00:01:17 +00:00
ColumnLayout { // groupSettingsPane
id: gsp
2018-11-22 00:01:17 +00:00
anchors.fill: parent
property string groupID
2019-02-11 20:23:31 +00:00
property variant addrbook
2018-11-22 00:01:17 +00:00
StackToolbar {
id: toolbar
aux.visible: false
2019-02-13 04:25:20 +00:00
back.onClicked: theStack.pane = theStack.messagePane
2018-11-22 00:01:17 +00:00
}
2019-04-16 19:40:19 +00:00
Flickable {
anchors.top: toolbar.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
boundsBehavior: Flickable.StopAtBounds
clip:true
contentWidth: tehcol.width
contentHeight: tehcol.height
2019-02-12 22:47:23 +00:00
Column {
2019-04-16 19:40:19 +00:00
id: tehcol
width: gsp.width
2019-02-12 22:47:23 +00:00
leftPadding: 10
spacing: 5
2018-11-22 00:01:17 +00:00
ScalingLabel {
text: qsTr("server-label") + ":"
2018-11-22 00:01:17 +00:00
}
2019-02-12 22:47:23 +00:00
TextField {
2018-11-22 00:01:17 +00:00
id: txtServer
2019-04-16 19:40:19 +00:00
style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 }
readOnly: true
2018-11-22 00:01:17 +00:00
}
2019-02-12 22:47:23 +00:00
SimpleButton {
icon: "regular/clipboard"
text: qsTr("copy-btn")
2019-02-12 22:47:23 +00:00
onClicked: {
gcd.popup("copied-clipboard-notification")
2019-02-12 22:47:23 +00:00
txtServer.selectAll()
txtServer.copy()
}
}
2018-11-22 00:01:17 +00:00
ScalingLabel {
text: qsTr("invitation-label") + ":"
2018-11-22 00:01:17 +00:00
}
2019-02-12 22:47:23 +00:00
TextField {
2018-11-22 00:01:17 +00:00
id: txtInvitation
2019-04-16 19:40:19 +00:00
style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 }
readOnly: true
2018-11-22 00:01:17 +00:00
}
SimpleButton {
icon: "regular/clipboard"
text: qsTr("copy-btn")
2018-11-22 00:01:17 +00:00
onClicked: {
gcd.popup("copied-clipboard-notification")
2018-11-22 00:01:17 +00:00
txtInvitation.selectAll()
txtInvitation.copy()
}
}
ScalingLabel{
text: qsTr("group-name-label") + ":"
}
2019-02-12 22:47:23 +00:00
TextField {
id: txtGroupName
2019-04-16 19:40:19 +00:00
style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 }
}
SimpleButton {
text: qsTr("save-btn")
onClicked: {
gcd.saveGroupSettings(groupID, txtGroupName.text)
theStack.title = txtGroupName.text
theStack.pane = theStack.messagePane
}
}
//: Invite someone to the group
ScalingLabel { text: qsTr("invite-to-group-label") }
ComboBox {
id: cbInvite
2019-02-12 22:47:23 +00:00
//popup.font.pixelSize: 12
width: 200
2019-02-12 22:47:23 +00:00
//font.pixelSize: 20
2019-02-13 05:08:43 +00:00
style: CwtchComboBoxStyle{}
2019-02-05 20:22:33 +00:00
}
SimpleButton {
text: qsTr("invite-btn")
2019-02-05 20:22:33 +00:00
onClicked: {
2019-02-11 20:23:31 +00:00
gcd.inviteToGroup(addrbook[cbInvite.currentIndex], groupID)
}
}
SimpleButton {
icon: "regular/trash-alt"
text: qsTr("delete-btn")
onClicked: {
gcd.leaveGroup(groupID)
theStack.pane = theStack.emptyPane
}
}
2019-02-12 22:47:23 +00:00
}//end of column with padding
2019-04-16 19:40:19 +00:00
}//end of flickable
2018-11-22 00:01:17 +00:00
Connections {
target: gcd
onSupplyGroupSettings: function(gid, name, server, invite, accepted, addrbooknames, addrbookaddrs) {
gsp.groupID = gid
2018-11-22 00:01:17 +00:00
toolbar.text = name
txtGroupName.text = name
txtServer.text = server
txtInvitation.text = invite
2019-02-13 05:08:43 +00:00
cbInvite.model = addrbooknames.map(function(e){return Utils.htmlEscaped(e)})
2019-02-11 20:23:31 +00:00
addrbook = addrbookaddrs
2018-11-22 00:01:17 +00:00
}
}
}