From 95f674c064485e8d269f16f1d93bed2b2ddea31c Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Fri, 1 Feb 2019 16:12:44 -0800 Subject: [PATCH 1/6] Bulletin --- qml/main.qml | 3 + qml/overlays/BulletinOverlay.qml | 179 ++++++++++++++++++++++++++----- qml/panes/OverlayPane.qml | 4 +- qml/widgets/ContactRow.qml | 1 + qml/widgets/jsonpath.js | 89 +++++++++++++++ 5 files changed, 248 insertions(+), 28 deletions(-) create mode 100644 qml/widgets/jsonpath.js diff --git a/qml/main.qml b/qml/main.qml index 651703d..713c532 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -138,10 +138,13 @@ Item { readonly property int groupProfilePane: 4 readonly property int addGroupPane: 5 + property string title + Item {} // empty OverlayPane { // messagePane + title: theStack.title anchors.fill: parent } diff --git a/qml/overlays/BulletinOverlay.qml b/qml/overlays/BulletinOverlay.qml index d6679a8..23cce16 100644 --- a/qml/overlays/BulletinOverlay.qml +++ b/qml/overlays/BulletinOverlay.qml @@ -2,14 +2,17 @@ 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 ColumnLayout { Layout.fillWidth: true + width:parent.width Flickable { // THE MESSAGE LIST ITSELF @@ -18,10 +21,9 @@ ColumnLayout { Layout.alignment: Qt.AlignLeft | Qt.AlignTop Layout.fillHeight: true Layout.minimumWidth: parent.width - Layout.maximumWidth: parent.width Layout.fillWidth: true - contentWidth: colMessages.width - contentHeight: colMessages.height + contentWidth: bulletin.width + contentHeight: bulletin.height boundsBehavior: Flickable.StopAtBounds maximumFlickVelocity: 800 @@ -30,11 +32,20 @@ ColumnLayout { target: gcd onClearMessages: function() { - messagesModel.clear() + //jsonModel4.clear() } onAppendMessage: function(handle, from, displayName, message, image, mid, fromMe, ts) { - messagesModel.append({ + var msg + try { + msg = JSON.parse(message) + } catch (e) { + return + } + if (msg.o != 2) return + + + /** messagesModel.append({ "_handle": handle, "_from": from, "_displayName": displayName, @@ -43,7 +54,7 @@ ColumnLayout { "_mid": mid, "_fromMe": fromMe, "_ts": ts, - }) + })*/ if (sv.contentY + sv.height >= sv.contentHeight - colMessages.height && sv.contentHeight > sv.height) { sv.contentY = sv.contentHeight - sv.height @@ -52,34 +63,148 @@ ColumnLayout { } + + ScrollBar.vertical: ScrollBar{ policy: ScrollBar.AlwaysOn } - ColumnLayout { - id: colMessages - width: sv.width - ListModel { // MESSAGE OBJECTS ARE STORED HERE ... - id: messagesModel - } - Item { height: 6 } - Repeater { // ... AND DISPLAYED HERE - model: messagesModel - delegate: Message { - handle: _handle - from: _from - displayName: _displayName - message: "bulletinbulletinbulletin" - image: _image - messageID: _mid - fromMe: _fromMe - timestamp: _ts + +ListView { + id: bulletinView + anchors.left: parent.left + + width: parent.width + height: parent.height + orientation: Qt.Vertical + spacing: 10 + model: jsonModel4 + property string filter: "" + delegate: + + Item { + width: parent.width + height: title.indexOf(bulletinView.filter) >= 0 ? (bulletinView.currentIndex == index ? texttitle.height + textbody.height + replybtn.height + 8 : texttitle.height * 2) : 0 + visible: title.indexOf(bulletinView.filter) >= 0 + Column { + width: parent.width + Text { id: texttitle + text: '' + Utils.htmlEscaped(title) + '' + MouseArea { + anchors.fill: parent + onClicked: bulletinView.currentIndex = index + } + } + Text { + id: textbody + visible: bulletinView.currentIndex == index + text: Utils.htmlEscaped(body) + wrapMode: TextEdit.Wrap + width: parent.width - 10 + } + SimpleButton { + id: replybtn + visible: bulletinView.currentIndex == index + text: "Reply" + anchors.right: parent.right + onClicked: { + console.log("REPLYING!!!") + gcd.broadcast("ResetMessagePane") + theStack.pane = theStack.messagePane + gcd.loadMessagesPane("e6c6dyzqojonomkxzm36lbme4cox4jhtiga5yln6cltusb5ujkcjb4yd") + overlayStack.overlay = overlayStack.chatOverlay + } + } + } + + } + + highlight: Rectangle { + visible: title.indexOf(bulletinView.filter) >= 0 + color: '#B09CBC' + } + focus: true + onCurrentItemChanged: console.log(model.get(bulletinView.currentIndex).title + ' selected') + + + + ListModel { + id: jsonModel4 + + } + + Component.onCompleted: { + jsonModel4.append({"title":"w4w for friends and other stuff","body":"Hi I'm a really
cool person who has just moved to Vancouver and I would really like to find some nice people to be friends with", "done":true}) + jsonModel4.append({"title":"m4mw everyone is great","body":"I would just like to say that everyone is great I would just like to say that everyone is great I would just like to say that everyone is greatI would just like to say that everyone is greatI would just like to say that everyone is great I would just like to say that everyone is great I would just like to say that everyone is great I would just like to say that everyone is great I would just like to say that everyone is great", "done":true,}) + jsonModel4.append({"title":"w4w for friends and other stuff","body":"Hi I'm a really
cool person who has just moved to Vancouver and I would really like to find some nice people to be friends with", "done":true}) + jsonModel4.append({"title":"w4w for friends and other stuff","body":"Hi I'm a really
cool person who has just moved to Vancouver and I would really like to find some nice people to be friends with", "done":true}) + jsonModel4.append({"title":"w4w for friends and other stuff","body":"Hi I'm a really
cool person who has just moved to Vancouver and I would really like to find some nice people to be friends with", "done":true}) + jsonModel4.append({"title":"w4w for friends and other stuff","body":"Hi I'm a really
cool person who has just moved to Vancouver and I would really like to find some nice people to be friends with", "done":true}) + + } + + +} + + + + + + + + } + + TextField { + id: filter + + placeholderText: "Filter.." + + + anchors.left: parent.left + anchors.right: parent.right + + anchors.margins: 10 + + onTextChanged: { + bulletinView.filter = text + if (bulletinView.model.get(bulletinView.currentIndex).title.indexOf(text) == -1) { + bulletinView.currentIndex = -1 + } + } + } + + ColumnLayout { + Layout.fillWidth: true + + + + SimpleButton { // SEND MESSAGE BUTTON + id: btnSend + icon: "regular/paper-plane" + text: "send" + anchors.right: parent.right + anchors.rightMargin: 2 + + property int nextMessageID: 1 + + + onClicked: { + if (txtMessage.text != "") { + txtHidden.text = restoreEmoji(txtMessage.text) + var msg = JSON.stringify({"o":2, "d":txtHidden.getText(0, txtHidden.text.length)}) + gcd.sendMessage(msg, nextMessageID++) + } + txtMessage.text = "" } } - } - } -} \ No newline at end of file + + } + + + + +} diff --git a/qml/panes/OverlayPane.qml b/qml/panes/OverlayPane.qml index c8b83fd..ea5f74e 100644 --- a/qml/panes/OverlayPane.qml +++ b/qml/panes/OverlayPane.qml @@ -9,10 +9,12 @@ import "../overlays" ColumnLayout { Layout.fillWidth: true + property alias title: toolbar.text StackToolbar { - text: "open privacy exec" + id: toolbar + //text: "open privacy exec" aux.onClicked: { theStack.pane = gcd.currentOpenConversation.length == 32 ? theStack.groupProfilePane : theStack.userProfilePane diff --git a/qml/widgets/ContactRow.qml b/qml/widgets/ContactRow.qml index ccd7d06..eb7f432 100644 --- a/qml/widgets/ContactRow.qml +++ b/qml/widgets/ContactRow.qml @@ -87,6 +87,7 @@ RowLayout { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY isActive = true theStack.pane = theStack.messagePane gcd.loadMessagesPane(handle) + theStack.overlaypane.toolbar.lbl.text = handle } onEntered: { diff --git a/qml/widgets/jsonpath.js b/qml/widgets/jsonpath.js new file mode 100644 index 0000000..a863ece --- /dev/null +++ b/qml/widgets/jsonpath.js @@ -0,0 +1,89 @@ + +/* JSONPath 0.8.5 - XPath for JSON + * + * Copyright (c) 2007 Stefan Goessner (goessner.net) + * Licensed under the MIT (MIT-LICENSE.txt) licence. + * + */ +function jsonPath(obj, expr, arg) { + var P = { + resultType: arg && arg.resultType || "VALUE", + result: [], + normalize: function(expr) { + var subx = []; + return expr.replace(/[\['](\??\(.*?\))[\]']|\['(.*?)'\]/g, function($0,$1,$2){return "[#"+(subx.push($1||$2)-1)+"]";}) /* http://code.google.com/p/jsonpath/issues/detail?id=4 */ + .replace(/'?\.'?|\['?/g, ";") + .replace(/;;;|;;/g, ";..;") + .replace(/;$|'?\]|'$/g, "") + .replace(/#([0-9]+)/g, function($0,$1){return subx[$1];}); + }, + asPath: function(path) { + var x = path.split(";"), p = "$"; + for (var i=1,n=x.length; i Date: Fri, 1 Feb 2019 16:17:11 -0800 Subject: [PATCH 2/6] Deleting --- qml/widgets/jsonpath.js | 89 ----------------------------------------- 1 file changed, 89 deletions(-) delete mode 100644 qml/widgets/jsonpath.js diff --git a/qml/widgets/jsonpath.js b/qml/widgets/jsonpath.js deleted file mode 100644 index a863ece..0000000 --- a/qml/widgets/jsonpath.js +++ /dev/null @@ -1,89 +0,0 @@ - -/* JSONPath 0.8.5 - XPath for JSON - * - * Copyright (c) 2007 Stefan Goessner (goessner.net) - * Licensed under the MIT (MIT-LICENSE.txt) licence. - * - */ -function jsonPath(obj, expr, arg) { - var P = { - resultType: arg && arg.resultType || "VALUE", - result: [], - normalize: function(expr) { - var subx = []; - return expr.replace(/[\['](\??\(.*?\))[\]']|\['(.*?)'\]/g, function($0,$1,$2){return "[#"+(subx.push($1||$2)-1)+"]";}) /* http://code.google.com/p/jsonpath/issues/detail?id=4 */ - .replace(/'?\.'?|\['?/g, ";") - .replace(/;;;|;;/g, ";..;") - .replace(/;$|'?\]|'$/g, "") - .replace(/#([0-9]+)/g, function($0,$1){return subx[$1];}); - }, - asPath: function(path) { - var x = path.split(";"), p = "$"; - for (var i=1,n=x.length; i Date: Fri, 1 Feb 2019 16:27:17 -0800 Subject: [PATCH 3/6] change toolbar title --- go/gothings/gcd.go | 17 ++++++++++++++++- qml/main.qml | 4 ++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/go/gothings/gcd.go b/go/gothings/gcd.go index 5a94aa8..9a965b2 100644 --- a/go/gothings/gcd.go +++ b/go/gothings/gcd.go @@ -35,6 +35,7 @@ type GrandCentralDispatcher struct { _ func() `signal:"ClearMessages"` _ func() `signal:"ResetMessagePane"` _ func(mID uint) `signal:"Acknowledged"` + _ func(title string) `signal:"SetToolbarTitle"` // profile-area stuff _ func(name, onion, image string) `signal:"UpdateMyProfile"` @@ -115,7 +116,14 @@ func (this *GrandCentralDispatcher) loadMessagesPane(handle string) { if len(handle) == 32 { // LOAD GROUP log.Debugf("LOADING GROUP %s", handle) - tl := the.Peer.GetGroup(handle).GetTimeline() + group := the.Peer.GetGroup(handle) + tl := group.GetTimeline() + nick, _ := group.GetAttribute("nick") + if nick == "" { + this.SetToolbarTitle(handle) + } else { + this.SetToolbarTitle(nick) + } log.Debugf("messages: %d", len(tl)) for i := range tl { if tl[i].PeerID == the.Peer.GetProfile().Onion { @@ -143,6 +151,13 @@ func (this *GrandCentralDispatcher) loadMessagesPane(handle string) { return } // ELSE LOAD CONTACT + nick, _ := the.Peer.GetProfile().GetAttribute(handle + "_name") + if nick == "" { + this.SetToolbarTitle(handle) + } else { + this.SetToolbarTitle(nick) + } + messages := this.UIState.GetMessages(handle) for i := range messages { from := messages[i].From diff --git a/qml/main.qml b/qml/main.qml index 713c532..6812c88 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -205,5 +205,9 @@ Item { popup.visible = true anmPopup.restart() } + + onSetToolbarTitle: function(str) { + theStack.title = str + } } } \ No newline at end of file From ef287938d9cb235cb4fee8529077ca326e77f976 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Sat, 2 Feb 2019 16:04:41 -0800 Subject: [PATCH 4/6] Fully working bulletin prototype --- go/gothings/gcd.go | 3 +- qml/main.qml | 4 + qml/overlays/BulletinOverlay.qml | 304 ++++++++++++++++------------ qml/styles/CwtchExpandingButton.qml | 20 ++ qml/styles/CwtchTextAreaStyle.qml | 8 + qml/styles/CwtchTextFieldStyle.qml | 14 ++ qml/widgets/ContactRow.qml | 1 - 7 files changed, 217 insertions(+), 137 deletions(-) create mode 100644 qml/styles/CwtchExpandingButton.qml create mode 100644 qml/styles/CwtchTextAreaStyle.qml create mode 100644 qml/styles/CwtchTextFieldStyle.qml diff --git a/go/gothings/gcd.go b/go/gothings/gcd.go index 9a965b2..66486e5 100644 --- a/go/gothings/gcd.go +++ b/go/gothings/gcd.go @@ -151,7 +151,8 @@ func (this *GrandCentralDispatcher) loadMessagesPane(handle string) { return } // ELSE LOAD CONTACT - nick, _ := the.Peer.GetProfile().GetAttribute(handle + "_name") + contact, _ := the.Peer.GetProfile().GetContact(handle) + nick,_ := contact.GetAttribute("name") if nick == "" { this.SetToolbarTitle(handle) } else { diff --git a/qml/main.qml b/qml/main.qml index 6812c88..fa962ed 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -18,6 +18,10 @@ Item { readonly property real ratio: height / width + readonly property string cwtch_background_color: '#EEEEFF' + readonly property string cwtch_color: '#B09CBC' + readonly property string cwtch_dark_color: '#4B3557' + FontAwesome { // PRETTY BUTTON ICONS id: awesome resource: "qrc:/qml/fonts/fontawesome.ttf" diff --git a/qml/overlays/BulletinOverlay.qml b/qml/overlays/BulletinOverlay.qml index 23cce16..75bfcff 100644 --- a/qml/overlays/BulletinOverlay.qml +++ b/qml/overlays/BulletinOverlay.qml @@ -5,15 +5,41 @@ 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 { Layout.fillWidth: true width:parent.width + Text { + Layout.fillWidth: true + text: parent.toolbar.text + " Bulletin Board" + } + + TextField { + id: filter + + placeholderText: "Search.." + + style: CwtchTextFieldStyle{} + + anchors.left: parent.left + anchors.right: parent.right + + anchors.margins: 10 + + onTextChanged: { + bulletinView.filter = text + if (bulletinView.model.get(bulletinView.currentIndex).title.indexOf(text) == -1) { + bulletinView.currentIndex = -1 + } + } + } Flickable { // THE MESSAGE LIST ITSELF id: sv @@ -44,17 +70,16 @@ ColumnLayout { } if (msg.o != 2) return - - /** messagesModel.append({ - "_handle": handle, - "_from": from, - "_displayName": displayName, - "_message": parse(message, 12), - "_image": image, - "_mid": mid, - "_fromMe": fromMe, - "_ts": ts, - })*/ + if (msg.t != undefined) { + jsonModel4.insert(0,{ + "title":msg.t, + "body": msg.b, + "selected":false, + "from": from, + "displayName": displayName, + "timestamp": ts + }) + } if (sv.contentY + sv.height >= sv.contentHeight - colMessages.height && sv.contentHeight > sv.height) { sv.contentY = sv.contentHeight - sv.height @@ -62,147 +87,156 @@ ColumnLayout { } } - - - ScrollBar.vertical: ScrollBar{ policy: ScrollBar.AlwaysOn } + ListView { + id: bulletinView + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.topMargin: 10 + width: parent.width - 50 + height: parent.height - 20 + orientation: Qt.Vertical + spacing: 10 + model: jsonModel4 + property string filter: "" + delegate: - - - -ListView { - id: bulletinView - anchors.left: parent.left - - width: parent.width - height: parent.height - orientation: Qt.Vertical - spacing: 10 - model: jsonModel4 - property string filter: "" - delegate: - - Item { - width: parent.width - height: title.indexOf(bulletinView.filter) >= 0 ? (bulletinView.currentIndex == index ? texttitle.height + textbody.height + replybtn.height + 8 : texttitle.height * 2) : 0 - visible: title.indexOf(bulletinView.filter) >= 0 - Column { + Item { width: parent.width - Text { id: texttitle - text: '' + Utils.htmlEscaped(title) + '' - MouseArea { - anchors.fill: parent - onClicked: bulletinView.currentIndex = index - } - } - Text { - id: textbody - visible: bulletinView.currentIndex == index - text: Utils.htmlEscaped(body) - wrapMode: TextEdit.Wrap - width: parent.width - 10 - } - SimpleButton { - id: replybtn - visible: bulletinView.currentIndex == index - text: "Reply" - anchors.right: parent.right - onClicked: { - console.log("REPLYING!!!") - gcd.broadcast("ResetMessagePane") - theStack.pane = theStack.messagePane - gcd.loadMessagesPane("e6c6dyzqojonomkxzm36lbme4cox4jhtiga5yln6cltusb5ujkcjb4yd") - overlayStack.overlay = overlayStack.chatOverlay - } - } - } + height: title.indexOf(bulletinView.filter) >= 0 ? (selected ? texttitle.height + textbody.height + replybtn.height + 8 : texttitle.height * 2) : 0 + visible: title.indexOf(bulletinView.filter) >= 0 - } + Column { + width: parent.width - highlight: Rectangle { - visible: title.indexOf(bulletinView.filter) >= 0 - color: '#B09CBC' - } - focus: true - onCurrentItemChanged: console.log(model.get(bulletinView.currentIndex).title + ' selected') + RowLayout { + Button { + text: selected ? "-" : "+" + style: CwtchExpandingButton{} + } + Text { + id: texttitle + text: '' + Utils.htmlEscaped(title) + ' by ' + from + "
" + timestamp + leftPadding: 10 + topPadding: 5 + bottomPadding:5 + color: windowItem.cwtch_dark_color + } + MouseArea { + anchors.fill: parent + onClicked: { + selected = !selected + bulletinView.currentIndex = index + } + } + } + Rectangle { + height: 1 + color: windowItem.cwtch_color + anchors { + left: parent.left + right: parent.right + } + } - ListModel { - id: jsonModel4 + Text { + id: textbody + visible: selected + text: Utils.htmlEscaped(body) + wrapMode: TextEdit.Wrap + leftPadding: 10 + topPadding: 10 + width: parent.width - 50 + } - } - - Component.onCompleted: { - jsonModel4.append({"title":"w4w for friends and other stuff","body":"Hi I'm a really
cool person who has just moved to Vancouver and I would really like to find some nice people to be friends with", "done":true}) - jsonModel4.append({"title":"m4mw everyone is great","body":"I would just like to say that everyone is great I would just like to say that everyone is great I would just like to say that everyone is greatI would just like to say that everyone is greatI would just like to say that everyone is great I would just like to say that everyone is great I would just like to say that everyone is great I would just like to say that everyone is great I would just like to say that everyone is great", "done":true,}) - jsonModel4.append({"title":"w4w for friends and other stuff","body":"Hi I'm a really
cool person who has just moved to Vancouver and I would really like to find some nice people to be friends with", "done":true}) - jsonModel4.append({"title":"w4w for friends and other stuff","body":"Hi I'm a really
cool person who has just moved to Vancouver and I would really like to find some nice people to be friends with", "done":true}) - jsonModel4.append({"title":"w4w for friends and other stuff","body":"Hi I'm a really
cool person who has just moved to Vancouver and I would really like to find some nice people to be friends with", "done":true}) - jsonModel4.append({"title":"w4w for friends and other stuff","body":"Hi I'm a really
cool person who has just moved to Vancouver and I would really like to find some nice people to be friends with", "done":true}) - - } - - -} - - - - - - - - } - - TextField { - id: filter - - placeholderText: "Filter.." - - - anchors.left: parent.left - anchors.right: parent.right - - anchors.margins: 10 - - onTextChanged: { - bulletinView.filter = text - if (bulletinView.model.get(bulletinView.currentIndex).title.indexOf(text) == -1) { - bulletinView.currentIndex = -1 - } - } - } - - ColumnLayout { - Layout.fillWidth: true - - - - SimpleButton { // SEND MESSAGE BUTTON - id: btnSend - icon: "regular/paper-plane" - text: "send" - anchors.right: parent.right - anchors.rightMargin: 2 - - property int nextMessageID: 1 - - - onClicked: { - if (txtMessage.text != "") { - txtHidden.text = restoreEmoji(txtMessage.text) - var msg = JSON.stringify({"o":2, "d":txtHidden.getText(0, txtHidden.text.length)}) - gcd.sendMessage(msg, nextMessageID++) + SimpleButton { + id: replybtn + visible: selected + text: "reply" + anchors.right: parent.right + anchors.rightMargin:10 + onClicked: { + console.log("REPLYING!!!") + gcd.broadcast("ResetMessagePane") + theStack.pane = theStack.messagePane + gcd.loadMessagesPane(from) + overlayStack.overlay = overlayStack.chatOverlay + } + } + } + + } + + focus: true + onCurrentItemChanged: console.log(model.get(bulletinView.currentIndex).title + ' selected') + + + + ListModel { + id: jsonModel4 + } + } + } + + GroupBox { + title: qsTr("New Bulletin") + Layout.fillWidth: true + + RowLayout { + Layout.fillWidth: true + width: parent.width + ColumnLayout { + Layout.fillWidth: true + + + Text { + text: "Post a new Bulletin Post" + } + + TextField { + id: newposttitle + placeholderText: "Title.." + Layout.fillWidth: true + style: CwtchTextFieldStyle{} + } + + TextArea { + id: newpostbody + Layout.fillWidth: true + style: CwtchTextAreaStyle{} + } + + + SimpleButton { // SEND MESSAGE BUTTON + id: btnSend + icon: "regular/paper-plane" + text: "post" + anchors.right: parent.right + anchors.rightMargin: 2 + + property int nextMessageID: 1 + + onClicked: { + if (newposttitle.text != "" && newpostbody.text != "") { + var msg = JSON.stringify({"o":2, "t":newposttitle.text, "b":newpostbody.text}) + gcd.sendMessage(msg, nextMessageID++) + } + newposttitle.text = "" + newpostbody.text = "" } - txtMessage.text = "" } } + } + + } + - } diff --git a/qml/styles/CwtchExpandingButton.qml b/qml/styles/CwtchExpandingButton.qml new file mode 100644 index 0000000..af6dd66 --- /dev/null +++ b/qml/styles/CwtchExpandingButton.qml @@ -0,0 +1,20 @@ +import QtQuick.Controls.Styles 1.4 +import QtQuick 2.7 + +ButtonStyle { + background: Rectangle { + width:25 + height:25 + color: windowItem.cwtch_dark_color + border.color: windowItem.cwtch_color + } + label: Text { + renderType: Text.NativeRendering + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + font.family: "Monospace" + font.pointSize: 8 + color: windowItem.cwtch_background_color + text: control.text + } +} \ No newline at end of file diff --git a/qml/styles/CwtchTextAreaStyle.qml b/qml/styles/CwtchTextAreaStyle.qml new file mode 100644 index 0000000..b65d6f4 --- /dev/null +++ b/qml/styles/CwtchTextAreaStyle.qml @@ -0,0 +1,8 @@ +import QtQuick.Controls.Styles 1.4 +import QtQuick 2.7 + + +TextAreaStyle { + textColor: "black" + backgroundColor: windowItem.cwtch_background_color +} \ No newline at end of file diff --git a/qml/styles/CwtchTextFieldStyle.qml b/qml/styles/CwtchTextFieldStyle.qml new file mode 100644 index 0000000..e2e61a0 --- /dev/null +++ b/qml/styles/CwtchTextFieldStyle.qml @@ -0,0 +1,14 @@ +import QtQuick.Controls.Styles 1.4 +import QtQuick 2.7 + + +TextFieldStyle { + textColor: "black" + background: Rectangle { + radius: 2 + implicitWidth: 100 + implicitHeight: 24 + color: windowItem.cwtch_background_color + border.color: windowItem.cwtch_color + } +} \ No newline at end of file diff --git a/qml/widgets/ContactRow.qml b/qml/widgets/ContactRow.qml index eb7f432..ccd7d06 100644 --- a/qml/widgets/ContactRow.qml +++ b/qml/widgets/ContactRow.qml @@ -87,7 +87,6 @@ RowLayout { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY isActive = true theStack.pane = theStack.messagePane gcd.loadMessagesPane(handle) - theStack.overlaypane.toolbar.lbl.text = handle } onEntered: { From 73eb5a6ef50ad3812102510dd9521909482c42ea Mon Sep 17 00:00:00 2001 From: erinn Date: Sat, 2 Feb 2019 17:19:51 -0800 Subject: [PATCH 5/6] save contacts --- go/gothings/uistate.go | 17 +---------------- main.go | 1 - 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/go/gothings/uistate.go b/go/gothings/uistate.go index 3e00ec5..c870d53 100644 --- a/go/gothings/uistate.go +++ b/go/gothings/uistate.go @@ -1,8 +1,6 @@ package gothings import ( - "cwtch.im/cwtch/event" - "cwtch.im/cwtch/model" "cwtch.im/ui/go/constants" "cwtch.im/ui/go/gobjects" "cwtch.im/ui/go/the" @@ -39,20 +37,7 @@ func (this *InterfaceState) AddContact(c *gobjects.Contact) { if the.Peer.GetContact(c.Handle) == nil { decodedPub, _ := base32.StdEncoding.DecodeString(strings.ToUpper(c.Handle)) - - pp := &model.PublicProfile{Name: c.DisplayName, Ed25519PublicKey: decodedPub[:32], Trusted: c.Trusted, Blocked: false, Onion: c.Handle, Attributes: make(map[string]string)} - pp.SetAttribute("name", c.DisplayName) - the.Peer.GetProfile().Contacts[c.Handle] = pp - if c.Trusted { - the.Peer.GetProfile().TrustPeer(c.Handle) - } - - the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetPeerAttribute, map[event.Field]string{ - event.RemotePeer: c.Handle, - event.Key: "name", - event.Data: c.DisplayName, - })) - + the.Peer.AddContact(c.DisplayName, c.Handle, decodedPub, c.Trusted) go the.Peer.PeerWithOnion(c.Handle) } diff --git a/main.go b/main.go index d325ab9..20bf570 100644 --- a/main.go +++ b/main.go @@ -165,7 +165,6 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher) { groups := the.Peer.GetGroups() for i := range groups { - log.Infof("adding saved group %v", groups[i]) group := the.Peer.GetGroup(groups[i]) group.NewMessage = make(chan model.Message) the.Peer.JoinServer(group.GroupServer) From 67bb1e2b8d599d79f6e673b8ab9200d2a27704f7 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Sat, 2 Feb 2019 17:27:13 -0800 Subject: [PATCH 6/6] Trivial Change --- qml/styles/CwtchExpandingButton.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/qml/styles/CwtchExpandingButton.qml b/qml/styles/CwtchExpandingButton.qml index af6dd66..cd19d25 100644 --- a/qml/styles/CwtchExpandingButton.qml +++ b/qml/styles/CwtchExpandingButton.qml @@ -8,6 +8,7 @@ ButtonStyle { color: windowItem.cwtch_dark_color border.color: windowItem.cwtch_color } + label: Text { renderType: Text.NativeRendering verticalAlignment: Text.AlignVCenter