Adding Basic Group Membership Pane
This commit is contained in:
parent
eaa700ba57
commit
153651478a
|
@ -5,3 +5,4 @@ rcc*
|
||||||
*.qmlc
|
*.qmlc
|
||||||
*.jsc
|
*.jsc
|
||||||
vendor/
|
vendor/
|
||||||
|
.directory
|
||||||
|
|
|
@ -14,7 +14,6 @@ func RandomProfileImage(onion string) string {
|
||||||
barr, err := base32.StdEncoding.DecodeString(strings.ToUpper(onion))
|
barr, err := base32.StdEncoding.DecodeString(strings.ToUpper(onion))
|
||||||
if err != nil || len(barr) != 35 {
|
if err != nil || len(barr) != 35 {
|
||||||
log.Errorf("error: %v %v %v\n", onion, err, barr)
|
log.Errorf("error: %v %v %v\n", onion, err, barr)
|
||||||
panic("lol")
|
|
||||||
return "qrc:/qml/images/extra/openprivacy.png"
|
return "qrc:/qml/images/extra/openprivacy.png"
|
||||||
}
|
}
|
||||||
return "qrc:/qml/images/profiles/" + choices[int(barr[33])%len(choices)] + ".png"
|
return "qrc:/qml/images/profiles/" + choices[int(barr[33])%len(choices)] + ".png"
|
||||||
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
import QtGraphicalEffects 1.0
|
||||||
|
import QtQuick 2.7
|
||||||
|
import QtQuick.Controls 2.4
|
||||||
|
import QtQuick.Controls.Material 2.0
|
||||||
|
import QtQuick.Controls 1.4
|
||||||
|
import QtQuick.Layouts 1.3
|
||||||
|
|
||||||
|
import "../widgets"
|
||||||
|
import "../widgets/controls" as Awesome
|
||||||
|
import "../fonts/Twemoji.js" as T
|
||||||
|
import "../utils.js" as Utils
|
||||||
|
import "../styles"
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
Text {
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
Layout.maximumWidth: parent.width
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
padding: 1
|
||||||
|
text: qsTr("Below is a list of users who have sent messages to the group. This list may not reflect all users who have access to the group.")
|
||||||
|
}
|
||||||
|
|
||||||
|
Flickable { // THE ACTUAL CONTACT LIST
|
||||||
|
id: sv
|
||||||
|
//Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
||||||
|
clip: true
|
||||||
|
Layout.minimumHeight: 100
|
||||||
|
//Layout.maximumHeight: parent.height - 30
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.minimumWidth: parent.width
|
||||||
|
Layout.maximumWidth: parent.width
|
||||||
|
contentWidth: colContacts.width
|
||||||
|
contentHeight: colContacts.height
|
||||||
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
|
maximumFlickVelocity: 400
|
||||||
|
|
||||||
|
|
||||||
|
ScrollBar.vertical: ScrollBar {
|
||||||
|
policy: ScrollBar.AlwaysOn
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: colContacts
|
||||||
|
width: sv.width
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
Connections { // ADD/REMOVE CONTACT ENTRIES
|
||||||
|
target: gcd
|
||||||
|
|
||||||
|
onClearMessages: function() {
|
||||||
|
contactsModel.clear()
|
||||||
|
}
|
||||||
|
|
||||||
|
onAppendMessage: function(handle, from, displayName, message, image, mid, fromMe, ts, ack, error) {
|
||||||
|
var msg
|
||||||
|
try {
|
||||||
|
msg = JSON.parse(message)
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for(var i = 0; i<contactsModel.count;i++){
|
||||||
|
if(contactsModel.get(i)["_handle"] == handle) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fromMe) {
|
||||||
|
contactsModel.append({
|
||||||
|
"_handle": handle,
|
||||||
|
"_displayName": "me",
|
||||||
|
"_image": image,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
contactsModel.append({
|
||||||
|
"_handle": handle,
|
||||||
|
"_displayName": displayName == "" ? handle : displayName,
|
||||||
|
"_image": image,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ListModel { // CONTACT OBJECTS ARE STORED HERE ...
|
||||||
|
id: contactsModel
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: contactsModel // ... AND DISPLAYED HERE
|
||||||
|
delegate: ContactRow {
|
||||||
|
handle: _handle
|
||||||
|
displayName: _displayName
|
||||||
|
image: _image
|
||||||
|
trusted: true
|
||||||
|
background: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,6 +18,9 @@ ColumnLayout {
|
||||||
StackToolbar {
|
StackToolbar {
|
||||||
id: toolbar
|
id: toolbar
|
||||||
|
|
||||||
|
membership.visible: gcd.currentOpenConversation.length == 32
|
||||||
|
|
||||||
|
membership.onClicked: overlayStack.overlay = overlayStack.membershipOverlay
|
||||||
|
|
||||||
aux.onClicked: {
|
aux.onClicked: {
|
||||||
if (gcd.currentOpenConversation.length == 32) {
|
if (gcd.currentOpenConversation.length == 32) {
|
||||||
|
@ -106,6 +109,7 @@ ColumnLayout {
|
||||||
readonly property int listOverlay: 1
|
readonly property int listOverlay: 1
|
||||||
readonly property int bulletinOverlay: 2
|
readonly property int bulletinOverlay: 2
|
||||||
readonly property int game1Overlay: 3
|
readonly property int game1Overlay: 3
|
||||||
|
readonly property int membershipOverlay: 4
|
||||||
|
|
||||||
|
|
||||||
ChatOverlay { //0
|
ChatOverlay { //0
|
||||||
|
@ -127,11 +131,19 @@ ColumnLayout {
|
||||||
Layout.maximumHeight: overlayStack.height
|
Layout.maximumHeight: overlayStack.height
|
||||||
Layout.maximumWidth: overlayStack.width
|
Layout.maximumWidth: overlayStack.width
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MembershipOverlay { //4
|
||||||
|
Layout.maximumHeight: overlayStack.height
|
||||||
|
Layout.maximumWidth: overlayStack.width
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: gcd
|
target: gcd
|
||||||
|
|
||||||
|
onResetMessagePane: function() {
|
||||||
|
overlayStack.overlay = overlayStack.chatOverlay
|
||||||
|
}
|
||||||
|
|
||||||
onSupplyGroupSettings: function(gid, name, server, invite, accepted, addrbooknames, addrbookaddrs) {
|
onSupplyGroupSettings: function(gid, name, server, invite, accepted, addrbooknames, addrbookaddrs) {
|
||||||
console.log("Supplied " + gid + " " + name + "Accepted " + accepted)
|
console.log("Supplied " + gid + " " + name + "Accepted " + accepted)
|
||||||
|
|
|
@ -20,6 +20,7 @@ RowLayout { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
|
||||||
property bool deleted
|
property bool deleted
|
||||||
property alias status: imgProfile.status
|
property alias status: imgProfile.status
|
||||||
property string server
|
property string server
|
||||||
|
property bool background: true
|
||||||
|
|
||||||
|
|
||||||
Rectangle { // CONTACT ENTRY BACKGROUND COLOR
|
Rectangle { // CONTACT ENTRY BACKGROUND COLOR
|
||||||
|
@ -28,7 +29,7 @@ RowLayout { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
height: childrenRect.height + 3
|
height: childrenRect.height + 3
|
||||||
width: parent.width
|
width: parent.width
|
||||||
color: isHover ? "#D2D2F3" : (isActive ? "#D2D2F3" : "#D2C0DD")
|
color: background ? (isHover ? "#D2D2F3" : (isActive ? "#D2D2F3" : "#D2C0DD")) : windowItem.cwtch_background_color
|
||||||
|
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
|
|
@ -26,6 +26,7 @@ Rectangle {
|
||||||
property alias font: buttonText.font.family
|
property alias font: buttonText.font.family
|
||||||
property string icon
|
property string icon
|
||||||
property bool mousedown
|
property bool mousedown
|
||||||
|
property string tooltip
|
||||||
signal clicked
|
signal clicked
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,6 +49,9 @@ Rectangle {
|
||||||
anchors.leftMargin: 6
|
anchors.leftMargin: 6
|
||||||
visible: button.text != "" && button.text != undefined
|
visible: button.text != "" && button.text != undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ToolTip.visible: tooltip != "" && mouseArea.containsMouse
|
||||||
|
ToolTip.text: qsTr(tooltip)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,6 +67,8 @@ Rectangle {
|
||||||
onPressed: mousedown = true
|
onPressed: mousedown = true
|
||||||
|
|
||||||
onReleased: mousedown = false
|
onReleased: mousedown = false
|
||||||
|
|
||||||
|
hoverEnabled: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onSpacePressed: clicked()
|
Keys.onSpacePressed: clicked()
|
||||||
|
|
|
@ -20,6 +20,7 @@ Rectangle { // OVERHEAD BAR ON STACK PANE
|
||||||
property alias text: lbl.text
|
property alias text: lbl.text
|
||||||
property alias aux: btnAux
|
property alias aux: btnAux
|
||||||
property alias back: btnBack
|
property alias back: btnBack
|
||||||
|
property alias membership: btnMembership
|
||||||
|
|
||||||
|
|
||||||
SimpleButton {// BACK BUTTON
|
SimpleButton {// BACK BUTTON
|
||||||
|
@ -38,11 +39,21 @@ Rectangle { // OVERHEAD BAR ON STACK PANE
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleButton { // COG BUTTON
|
RowLayout {
|
||||||
id: btnAux
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: 6
|
anchors.rightMargin: 6
|
||||||
icon: "solid/cog"
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
SimpleButton { // Membership Button
|
||||||
|
id: btnMembership
|
||||||
|
icon: "solid/users"
|
||||||
|
tooltip: "View Group Membership"
|
||||||
|
}
|
||||||
|
|
||||||
|
SimpleButton { // COG BUTTON
|
||||||
|
id: btnAux
|
||||||
|
icon: "solid/cog"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue