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

134 lines
2.5 KiB
QML

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
import QtQuick.Controls 1.4
import "../widgets"
import "../styles"
import "../utils.js" as Utils
ColumnLayout { // groupSettingsPane
id: gsp
anchors.fill: parent
property string groupID
property variant addrbook
StackToolbar {
id: toolbar
aux.visible: false
back.onClicked: theStack.pane = theStack.messagePane
}
Column {
leftPadding: 10
spacing: 5
ScalingLabel {
text: "Server:"
}
TextField {
id: txtServer
style: CwtchTextFieldStyle{ width: 400 }
readOnly: true
}
SimpleButton {
icon: "regular/clipboard"
text: "copy"
onClicked: {
gcd.popup("copied to clipboard!")
txtServer.selectAll()
txtServer.copy()
}
}
ScalingLabel {
text: "Invitation:"
}
TextField {
id: txtInvitation
style: CwtchTextFieldStyle{ width: 400 }
readOnly: true
}
SimpleButton {
icon: "regular/clipboard"
text: "copy"
onClicked: {
gcd.popup("copied to clipboard!")
txtInvitation.selectAll()
txtInvitation.copy()
}
}
ScalingLabel{
text: "Group name:"
}
TextField {
id: txtGroupName
style: CwtchTextFieldStyle{ width: 400 }
}
SimpleButton {
text: "Save"
onClicked: {
gcd.saveGroupSettings(groupID, txtGroupName.text)
theStack.title = txtGroupName.text
theStack.pane = theStack.messagePane
}
}
ScalingLabel { text: "Invite someone to the group:" }
ComboBox {
id: cbInvite
//popup.font.pixelSize: 12
width: 200
//font.pixelSize: 20
style: CwtchComboBoxStyle{}
}
SimpleButton {
text: "Invite"
onClicked: {
gcd.inviteToGroup(addrbook[cbInvite.currentIndex], groupID)
}
}
SimpleButton {
icon: "regular/trash-alt"
text: "delete"
onClicked: {
gcd.leaveGroup(groupID)
theStack.pane = theStack.emptyPane
}
}
}//end of column with padding
Connections {
target: gcd
onSupplyGroupSettings: function(gid, name, server, invite, accepted, addrbooknames, addrbookaddrs) {
console.log("Supplied " + gid + " " + name)
gsp.groupID = gid
toolbar.text = name
txtGroupName.text = name
txtServer.text = server
txtInvitation.text = invite
cbInvite.model = addrbooknames.map(function(e){return Utils.htmlEscaped(e)})
addrbook = addrbookaddrs
}
}
}