Browse Source

Adding Basic Group Membership Pane

pull/136/head
Sarah Jamie Lewis 9 months ago
parent
commit
153651478a

+ 1
- 0
.gitignore View File

@@ -5,3 +5,4 @@ rcc*
*.qmlc
*.jsc
vendor/
.directory

+ 0
- 1
go/cwutil/utils.go View File

@@ -14,7 +14,6 @@ func RandomProfileImage(onion string) string {
barr, err := base32.StdEncoding.DecodeString(strings.ToUpper(onion))
if err != nil || len(barr) != 35 {
log.Errorf("error: %v %v %v\n", onion, err, barr)
panic("lol")
return "qrc:/qml/images/extra/openprivacy.png"
}
return "qrc:/qml/images/profiles/" + choices[int(barr[33])%len(choices)] + ".png"

+ 101
- 0
qml/overlays/MembershipOverlay.qml View File

@@ -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
}
}
}
}
}

+ 12
- 0
qml/panes/OverlayPane.qml View File

@@ -18,6 +18,9 @@ ColumnLayout {
StackToolbar {
id: toolbar

membership.visible: gcd.currentOpenConversation.length == 32

membership.onClicked: overlayStack.overlay = overlayStack.membershipOverlay

aux.onClicked: {
if (gcd.currentOpenConversation.length == 32) {
@@ -106,6 +109,7 @@ ColumnLayout {
readonly property int listOverlay: 1
readonly property int bulletinOverlay: 2
readonly property int game1Overlay: 3
readonly property int membershipOverlay: 4


ChatOverlay { //0
@@ -127,11 +131,19 @@ ColumnLayout {
Layout.maximumHeight: overlayStack.height
Layout.maximumWidth: overlayStack.width
}

MembershipOverlay { //4
Layout.maximumHeight: overlayStack.height
Layout.maximumWidth: overlayStack.width
}
}

Connections {
target: gcd

onResetMessagePane: function() {
overlayStack.overlay = overlayStack.chatOverlay
}

onSupplyGroupSettings: function(gid, name, server, invite, accepted, addrbooknames, addrbookaddrs) {
console.log("Supplied " + gid + " " + name + "Accepted " + accepted)

+ 2
- 1
qml/widgets/ContactRow.qml View File

@@ -20,6 +20,7 @@ RowLayout { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
property bool deleted
property alias status: imgProfile.status
property string server
property bool background: true


Rectangle { // CONTACT ENTRY BACKGROUND COLOR
@@ -28,7 +29,7 @@ RowLayout { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
anchors.right: parent.right
height: childrenRect.height + 3
width: parent.width
color: isHover ? "#D2D2F3" : (isActive ? "#D2D2F3" : "#D2C0DD")
color: background ? (isHover ? "#D2D2F3" : (isActive ? "#D2D2F3" : "#D2C0DD")) : windowItem.cwtch_background_color


RowLayout {

+ 6
- 0
qml/widgets/SimpleButton.qml View File

@@ -26,6 +26,7 @@ Rectangle {
property alias font: buttonText.font.family
property string icon
property bool mousedown
property string tooltip
signal clicked


@@ -48,6 +49,9 @@ Rectangle {
anchors.leftMargin: 6
visible: button.text != "" && button.text != undefined
}

ToolTip.visible: tooltip != "" && mouseArea.containsMouse
ToolTip.text: qsTr(tooltip)
}


@@ -63,6 +67,8 @@ Rectangle {
onPressed: mousedown = true

onReleased: mousedown = false

hoverEnabled: true
}

Keys.onSpacePressed: clicked()

+ 15
- 4
qml/widgets/StackToolbar.qml View File

@@ -20,6 +20,7 @@ Rectangle { // OVERHEAD BAR ON STACK PANE
property alias text: lbl.text
property alias aux: btnAux
property alias back: btnBack
property alias membership: btnMembership


SimpleButton {// BACK BUTTON
@@ -38,11 +39,21 @@ Rectangle { // OVERHEAD BAR ON STACK PANE
anchors.verticalCenter: parent.verticalCenter
}

SimpleButton { // COG BUTTON
id: btnAux
anchors.verticalCenter: parent.verticalCenter
RowLayout {

anchors.right: parent.right
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"
}
}
}

Loading…
Cancel
Save