diff --git a/assets/core/group_settings-24px.svg b/assets/core/group_settings-24px.svg new file mode 100644 index 00000000..bc8e0f60 --- /dev/null +++ b/assets/core/group_settings-24px.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + diff --git a/assets/core/peer_settings-24px.svg b/assets/core/peer_settings-24px.svg new file mode 100644 index 00000000..86d1c94f --- /dev/null +++ b/assets/core/peer_settings-24px.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + diff --git a/assets/core/peer_settings-24px.webp b/assets/core/peer_settings-24px.webp new file mode 100644 index 00000000..33dfadec Binary files /dev/null and b/assets/core/peer_settings-24px.webp differ diff --git a/go/ui/gcd.go b/go/ui/gcd.go index 5986d8a8..7754febd 100644 --- a/go/ui/gcd.go +++ b/go/ui/gcd.go @@ -9,6 +9,7 @@ import ( "cwtch.im/ui/go/constants" "cwtch.im/ui/go/features/groups" "cwtch.im/ui/go/ui/android" + "encoding/json" "github.com/therecipe/qt/qml" "strconv" "sync" @@ -73,7 +74,7 @@ type GrandCentralDispatcher struct { _ func(server string) `signal:"startServer,auto"` _ func(server string) `signal:"stopServer,auto"` _ func(server string) `signal:"checkServer,auto"` - _ func(server string, enabled bool) `signal:"autostartServer",auto` + _ func(server string, enabled bool) `signal:"autostartServer,auto"` // contact list stuff _ func(handle, displayName, image string, badge, status int, authorization string, loading bool, lastMsgTime int) `signal:"AddContact"` @@ -145,6 +146,11 @@ type GrandCentralDispatcher struct { _ func(handle string) `signal:"requestServerSettings,auto"` _ func() `constructor:"init"` + + // legacy overlay model support + _ func(onion string) `signal:"legacyLoadOverlay,auto"` + _ func(handle, from, displayName, message, image string, mID string, fromMe bool, ts int64, ackd bool, error bool) `signal:"AppendMessage"` + _ func(handle, from, displayName, message, image string, mID string, fromMe bool, ts int64, ackd bool, error bool) `signal:"PrependMessage"` } func (this *GrandCentralDispatcher) init() { @@ -360,6 +366,89 @@ func (this *GrandCentralDispatcher) loadMessagesPaneHelper(handle string) { } updateLastReadTime(contact.Onion) this.SetToolbarTitle(nick) + + this.legacyLoadOverlay(handle) +} + +func (this *GrandCentralDispatcher) legacyLoadOverlay(handle string) { + // only do this for overlays 2 (bulletin) and 4 (lists) + go this.legacyLoadOverlay_helper(handle, []int{2,4}) +} + +func contains(arr []int, x int) bool { + for _, v := range arr { + if v == x { + return true + } + } + + return false +} + +func (this *GrandCentralDispatcher) legacyLoadOverlay_helper(handle string, overlays []int) { + if isGroup(handle) { + group := the.CwtchApp.GetPeer(this.selectedProfile()).GetGroup(handle) + tl := group.GetTimeline() + + for i := len(tl) - 1; i >= 0; i-- { + if tl[i].PeerID == this.selectedProfile() { + handle = "me" + } else { + handle = tl[i].PeerID + } + + name := GetNick(tl[i].PeerID) + image := GetProfilePic(tl[i].PeerID) + + obj := &OverlayJSONObject{} + err := json.Unmarshal([]byte(tl[i].Message), obj) + if err == nil && contains(overlays, obj.Overlay) { + this.PrependMessage( + handle, + tl[i].PeerID, + name, + tl[i].Message, + image, + string(tl[i].Signature), + tl[i].PeerID == this.selectedProfile(), + tl[i].Timestamp.Unix(), + tl[i].Received.Equal(time.Unix(0, 0)) == false, // If the received timestamp is epoch, we have not yet received this message through an active server + false, + ) + } + } + + } else {// !isGroup + messages := the.CwtchApp.GetPeer(this.selectedProfile()).GetContact(handle).Timeline.GetMessages() + for i := len(messages) - 1; i >= 0; i-- { + from := messages[i].PeerID + fromMe := messages[i].PeerID == the.Peer.GetOnion() + if fromMe { + from = "me" + } + + displayname := GetNick(messages[i].PeerID) + image := GetProfilePic(messages[i].PeerID) + + obj := &OverlayJSONObject{} + err := json.Unmarshal([]byte(messages[i].Message), obj) + if err == nil && contains(overlays, obj.Overlay) { + this.PrependMessage( + from, + messages[i].PeerID, + displayname, + messages[i].Message, + image, + string(messages[i].Signature), + fromMe, + messages[i].Timestamp.Unix(), + messages[i].Acknowledged, + messages[i].Error != "", + ) + } + } + + } } func (this *GrandCentralDispatcher) requestSettings() { diff --git a/go/ui/messagemodel.go b/go/ui/messagemodel.go index 6b360726..3c0ad573 100644 --- a/go/ui/messagemodel.go +++ b/go/ui/messagemodel.go @@ -20,6 +20,7 @@ type MessageModel struct { _ map[int]*core.QByteArray `property:"roles"` _ func() `constructor:"init"` + _ func(int) *MessageWrapper `slot:"getMessage,auto"` _ func(int) `signal:"addMessage,auto"` _ func(int) `signal:"editMessage,auto"` _ func() `signal:"requestEIR,auto"` @@ -29,17 +30,22 @@ type MessageModel struct { } type MessageWrapper struct { - model.Message core.QObject + model.Message - Timestamp int64 - PeerID string - Acknowledged bool - RawMessage string - Error string - Day string - Signature string - _ bool `property:"ackd"` + _ int64 `property:"timestamp"` + _ string `property:"peerID"` + _ bool `property:"acknowledged"` + _ string `property:"rawMessage"` + _ string `property:"error"` + _ string `property:"day"` + _ string `property:"signature"` + _ bool `property:"ackd"` +} + +type OverlayJSONObject struct { + Overlay int `json:"o"` + Data string `json:"d"` } func (this *MessageModel) Handle() string { @@ -51,13 +57,19 @@ func (this *MessageModel) setHandle(handle string) { } func (this *MessageModel) init() { - mdt := reflect.TypeOf([]MessageWrapper{}).Elem() + sacrificialObject := NewMessageWrapper(nil) + mdt := reflect.TypeOf(*sacrificialObject) roles := make(map[int]*core.QByteArray) for i := 0; i < mdt.NumField(); i++ { - if mdt.Field(i).Name == "Acknowledged" { + fieldName := mdt.Field(i).Name + if fieldName == "_" { + fieldName = mdt.Field(i).Tag.Get("property") + } + + if fieldName == "acknowledged" { this.ackIdx = int(core.Qt__UserRole) + 1 + i } - roles[int(core.Qt__UserRole)+1+i] = core.NewQByteArray2(mdt.Field(i).Name, -1) + roles[int(core.Qt__UserRole)+1+i] = core.NewQByteArray2(fieldName, -1) } roles[int(core.Qt__DisplayRole)] = core.NewQByteArray2("display", -1) this.SetRoles(roles) @@ -133,16 +145,17 @@ func (this *MessageModel) getMessage(idx int) *MessageWrapper { } } - return &MessageWrapper{ - Message: modelmsg, - Timestamp: modelmsg.Timestamp.Unix(), - RawMessage: modelmsg.Message, - PeerID: modelmsg.PeerID, - Error: modelmsg.Error, - Acknowledged: ackd, - Day: modelmsg.Timestamp.Format("January 2, 2006"), - Signature: hex.EncodeToString(modelmsg.Signature), - } + mw := NewMessageWrapper(nil) + mw.Message = modelmsg + mw.SetTimestamp(modelmsg.Timestamp.Unix()) + mw.SetPeerID(modelmsg.PeerID) + mw.SetError(modelmsg.Error) + mw.SetAcknowledged(ackd) + mw.SetAckd(ackd)//??why both?? + mw.SetDay(modelmsg.Timestamp.Format("January 2, 2006")) + mw.SetSignature(hex.EncodeToString(modelmsg.Signature)) + mw.SetRawMessage(modelmsg.Message) + return mw } func (this *MessageModel) data(index *core.QModelIndex, role int) *core.QVariant { @@ -207,11 +220,10 @@ func (this *MessageModel) requestEIR() { // notify the gui that the message acknowledgement at index idx has been modified func (this *MessageModel) editMessage(idx int) { if idx < 0 || idx >= this.num() { - log.Errorf("cant edit message %v. probably fine", idx) + log.Debugf("cant edit message %v. probably fine", idx) return } - log.Debugf("editMessage(%v, %v)", idx, this.ackIdx) indexObject := this.Index(idx, 0, core.NewQModelIndex()) // replace third param with []int{} to update all attributes instead this.DataChanged(indexObject, indexObject, []int{this.ackIdx}) diff --git a/i18n/translation_de.ts b/i18n/translation_de.ts index dba7912c..4106f6e4 100644 --- a/i18n/translation_de.ts +++ b/i18n/translation_de.ts @@ -76,11 +76,8 @@ - group-name - Group Name ----------- -Name + Group Name @@ -105,23 +102,44 @@ Name BulletinOverlay - + new-bulletin-label Neue Meldung - + post-new-bulletin-label Post a new Bulletin Post Neue Meldung veröffentlichen - + title-placeholder title place holder text Titel... + + ChatOverlay + + + chat-history-default + This conversation will be deleted when Cwtch is closed! Message history can be enabled per-conversation via the Settings menu in the upper right. + + + + + chat-history-disabled + Message history is disabled. + + + + + chat-history-enabled + Message history is enabled. + + + ContactList @@ -233,18 +251,18 @@ Name noch zu erledigen - + search-list - ex: "... paste an address here to add a contact ..." + ex: "Find..." - + peer-not-online - + add-list-item-btn @@ -261,24 +279,24 @@ Name Message - + dm-tooltip Click to DM Klicken, um DM zu senden - + could-not-send-msg-error Could not send this message Nachricht konnte nicht gesendet werden - + acknowledged-label bestätigt - + pending-label Bestätigung ausstehend @@ -387,24 +405,24 @@ Name speichern - - + + save-peer-history Save Peer History - + save-peer-history-description - + dont-save-peer-history - + delete-btn löschen diff --git a/i18n/translation_en.qm b/i18n/translation_en.qm index f9ca9f9a..183a82fc 100644 Binary files a/i18n/translation_en.qm and b/i18n/translation_en.qm differ diff --git a/i18n/translation_en.ts b/i18n/translation_en.ts index 4f845ddf..9a0ae436 100644 --- a/i18n/translation_en.ts +++ b/i18n/translation_en.ts @@ -76,11 +76,8 @@ - group-name - Group Name ----------- -Name + Group Name Group name @@ -118,23 +115,44 @@ Name BulletinOverlay - + new-bulletin-label New Bulletin - + post-new-bulletin-label Post a new Bulletin Post Post new bulletin - + title-placeholder title place holder text title... + + ChatOverlay + + + chat-history-default + This conversation will be deleted when Cwtch is closed! Message history can be enabled per-conversation via the Settings menu in the upper right. + Your history with this peer is ephemeral and will not be saved. If you would like to save history, please go to settings and turn it on. + + + + chat-history-disabled + Message history is disabled. + Message history is disabled. + + + + chat-history-enabled + Message history is enabled. + Message history is enabled. + + ContactList @@ -326,18 +344,18 @@ Right-click to reset. ListOverlay - + search-list - ex: "... paste an address here to add a contact ..." + ex: "Find..." Search List - + peer-not-online Peer is Offline. Applications cannot be used right now. - + add-list-item-btn Add Item @@ -354,24 +372,24 @@ Right-click to reset. Message - + dm-tooltip Click to DM Click to DM - + could-not-send-msg-error Could not send this message Could not send this message - + acknowledged-label Acknowledged - + pending-label Pending @@ -485,19 +503,19 @@ Right-click to reset. Block Peer - - + + save-peer-history Save Peer History Save Peer History - + save-peer-history-description Determines whether or not to delete any history associated with the peer. - + dont-save-peer-history Delete Peer History @@ -506,7 +524,7 @@ Right-click to reset. Unblock Peer - + delete-btn Delete diff --git a/i18n/translation_fr.ts b/i18n/translation_fr.ts index 79b53bb9..845397ac 100644 --- a/i18n/translation_fr.ts +++ b/i18n/translation_fr.ts @@ -76,11 +76,8 @@ - group-name - Group Name ----------- -Name + Group Name @@ -105,23 +102,44 @@ Name BulletinOverlay - + new-bulletin-label Nouveau bulletin - + post-new-bulletin-label Post a new Bulletin Post Envoyer un nouveau bulletin - + title-placeholder title place holder text titre... + + ChatOverlay + + + chat-history-default + This conversation will be deleted when Cwtch is closed! Message history can be enabled per-conversation via the Settings menu in the upper right. + + + + + chat-history-disabled + Message history is disabled. + + + + + chat-history-enabled + Message history is enabled. + + + ContactList @@ -233,18 +251,18 @@ Name A faire... - + search-list - ex: "... paste an address here to add a contact ..." + ex: "Find..." - + peer-not-online - + add-list-item-btn @@ -261,24 +279,24 @@ Name Message - + dm-tooltip Click to DM Envoyer un message privé - + could-not-send-msg-error Could not send this message Impossible d'envoyer ce message - + acknowledged-label Confirmé - + pending-label En attente @@ -387,24 +405,24 @@ Name Sauvegarder - - + + save-peer-history Save Peer History - + save-peer-history-description - + dont-save-peer-history - + delete-btn Effacer diff --git a/i18n/translation_pt.ts b/i18n/translation_pt.ts index 96d83873..c5988b10 100644 --- a/i18n/translation_pt.ts +++ b/i18n/translation_pt.ts @@ -76,11 +76,8 @@ - group-name - Group Name ----------- -Name + Group Name @@ -105,23 +102,44 @@ Name BulletinOverlay - + new-bulletin-label Novo Boletim - + post-new-bulletin-label Post a new Bulletin Post Postar novo boletim - + title-placeholder title place holder text título… + + ChatOverlay + + + chat-history-default + This conversation will be deleted when Cwtch is closed! Message history can be enabled per-conversation via the Settings menu in the upper right. + + + + + chat-history-disabled + Message history is disabled. + + + + + chat-history-enabled + Message history is enabled. + + + ContactList @@ -233,18 +251,18 @@ Name Afazer… - + search-list - ex: "... paste an address here to add a contact ..." + ex: "Find..." - + peer-not-online - + add-list-item-btn @@ -261,24 +279,24 @@ Name Message - + dm-tooltip Click to DM Clique para DM - + could-not-send-msg-error Could not send this message Não deu para enviar esta mensagem - + acknowledged-label Confirmada - + pending-label Pendente @@ -387,24 +405,24 @@ Name Salvar - - + + save-peer-history Save Peer History - + save-peer-history-description - + dont-save-peer-history - + delete-btn Deletar diff --git a/main.go b/main.go index 89bb253b..7bbe771c 100644 --- a/main.go +++ b/main.go @@ -40,6 +40,7 @@ var ( func init() { // make go-defined types available in qml ui.GrandCentralDispatcher_QmlRegisterType2("CustomQmlTypes", 1, 0, "GrandCentralDispatcher") + ui.MessageWrapper_QmlRegisterType2("CustomQmlTypes", 1, 0, "MessageWrapper") } func main() { diff --git a/qml/main.qml b/qml/main.qml index fa20cc77..5cde6080 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -238,7 +238,7 @@ ApplicationWindow { Layout.fillHeight: true OverlayPane { // messagePane anchors.fill: parent - anchors.topMargin: 10 * gcd.themeScale + anchors.topMargin: 10// * gcd.themeScale } } diff --git a/qml/opaque b/qml/opaque index 365eedbd..dd8dde1f 160000 --- a/qml/opaque +++ b/qml/opaque @@ -1 +1 @@ -Subproject commit 365eedbd90eb936043e42f632355862d2a34c77a +Subproject commit dd8dde1fb38e296530570d31e95780ff707e2895 diff --git a/qml/overlays/BulletinOverlay.qml b/qml/overlays/BulletinOverlay.qml index 20737d6c..a1230854 100644 --- a/qml/overlays/BulletinOverlay.qml +++ b/qml/overlays/BulletinOverlay.qml @@ -8,6 +8,7 @@ import QtQuick.Layouts 1.3 import "../opaque" as Opaque import "../opaque/styles" +import "../opaque/theme" import "../utils.js" as Utils ColumnLayout { @@ -50,7 +51,18 @@ ColumnLayout { maximumFlickVelocity: 800 + Connections { + id: cnxns1 + target: mm + onRowsInserted: { + var msg = mm.getMessage(first); + var name = msg.peerID == gcd.selectedProfile ? "me" : mm.getNick(msg.peerID); + cnxns2.handler(msg.peerID, msg.peerID, name, msg.rawMessage, mm.getImage(msg.peerID), msg.signature, msg.peerID == gcd.selectedProfile, msg.timestamp, msg.ack, msg.error) + } + } + Connections { + id: cnxns2 target: gcd onClearMessages: function() { @@ -139,11 +151,11 @@ ColumnLayout { } Text { id: texttitle - text: '' + Utils.htmlEscaped(title) + ' by ' + from + "
" + Qt.formatDateTime(new Date(timestamp*1000), "MMMM d, h:mm ap") + text: '' + Utils.htmlEscaped(title) + ' by ' + displayName + "
" + Qt.formatDateTime(new Date(timestamp*1000), "MMMM d, h:mm ap") leftPadding: 10 topPadding: 5 bottomPadding:5 - color: windowItem.cwtch_dark_color + color: Theme.mainTextColor } MouseArea { anchors.fill: parent @@ -172,6 +184,7 @@ ColumnLayout { leftPadding: 10 topPadding: 10 width: parent.width - 50 + color: Theme.mainTextColor } Opaque.Button { @@ -212,6 +225,7 @@ ColumnLayout { Text { //: Post a new Bulletin Post text: qsTr("post-new-bulletin-label") + color: Theme.mainTextColor } TextField { diff --git a/qml/overlays/ChatOverlay.qml b/qml/overlays/ChatOverlay.qml index e30a0d17..7cdc90e2 100644 --- a/qml/overlays/ChatOverlay.qml +++ b/qml/overlays/ChatOverlay.qml @@ -3,6 +3,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.4 import QtQuick.Controls.Material 2.0 import QtQuick.Layouts 1.3 +import CustomQmlTypes 1.0 import "../opaque" as Opaque import "../opaque/controls" as Awesome @@ -11,7 +12,9 @@ import "../widgets" as W import "../opaque/theme" W.Overlay { + id: overlayRoot property bool loading + property string historyState: "DefaultDeleteHistory" //horizontalPadding: 15 * gcd.themeScale @@ -50,29 +53,80 @@ W.Overlay { spacing: 6 clip: true - ScrollBar.vertical: Opaque.ScrollBar {} + ScrollBar.vertical: Opaque.ScrollBar {id:scrollbar} maximumFlickVelocity: 1250 section.delegate: sectionHeading section.property: "Day" + header: Component { + Column { + width: messagesListView.width + Label { + width: messagesListView.width + font.pointSize: Theme.textSmallPt + font.weight: Font.Bold + color: Theme.chatOverlayWarningTextColor + horizontalAlignment: Text.AlignHCenter + text: overlayRoot.historyState + } + + Label { + id: historyWarning + wrapMode: Text.WordWrap + width: messagesListView.width + font.pointSize: Theme.textSmallPt + font.weight: Font.Bold + color: Theme.chatOverlayWarningTextColor + horizontalAlignment: Text.AlignHCenter + //: This conversation will be deleted when Cwtch is closed! Message history can be enabled per-conversation via the Settings menu in the upper right. + text: overlayRoot.historyState == "DefaultDeleteHistory" ? qsTr("chat-history-default") : ( + //: Message history is disabled. + overlayRoot.historyState == "DeleteHistoryConfirmed" ? qsTr("chat-history-disabled") : + //: Message history is enabled. + qsTr("chat-history-enabled") + ) + } + + Opaque.Icon { + anchors.horizontalCenter: parent.horizontalCenter + backgroundColor: Theme.backgroundMainColor + iconColor: Theme.chatOverlayWarningTextColor + source: gcd.assetPath + "core/peer_settings-24px.webp" + size: Theme.uiIconSizeM + sourceWidth: 72 + sourceHeight: 72 + width: Theme.uiIconSizeM + height: Theme.uiIconSizeM + } + + Opaque.HLine {} + } + } delegate: W.Message { - handle: PeerID - from: PeerID - displayName: mm.getNick(PeerID) - message: JSON.parse(RawMessage).d - rawMessage: RawMessage - image: mm.getImage(PeerID) - messageID: Signature - fromMe: PeerID == gcd.selectedProfile - timestamp: parseInt(Timestamp) - ackd: Acknowledged - error: Error - calendarEvent: PeerID == "calendar" + // unusual msg... syntax is due to qt stack weirdnesses + // model injection doesn't work properly because MessageWrapper uses tagged QML properties + // but reverting to struct properties prevents us from using mm.getMessage() in onRowsInserted sooooo + property variant msg: mm.getMessage(index) + property variant obj: JSON.parse(msg.rawMessage) + visible: obj.o == 1 + height: visible ? implicitHeight : -messagesListView.spacing + handle: msg.peerID + from: msg.peerID + displayName: mm.getNick(msg.peerID) + message: obj.o == 1 ? obj.d : "" + //rawMessage: msg.rawMessage + image: mm.getImage(msg.peerID) + messageID: msg.signature + fromMe: msg.peerID == gcd.selectedProfile + timestamp: parseInt(msg.timestamp) + //ackd: acknowledged + //error: msg.error + calendarEvent: msg.peerID == "calendar" // listview doesnt do anchors right // https://stackoverflow.com/questions/31381997/why-does-anchors-fill-does-not-work-in-a-qml-listviews-delegates-subviews-and/31382307 - width: messagesListView.width + width: messagesListView.width - scrollbar.width } Component { @@ -83,7 +137,7 @@ W.Overlay { property string txt: section color: Theme.backgroundMainColor width: parent.width - height: texmet.height + 6 + 12 * gcd.themeScale + height: texmet.height + 6 + 12// * gcd.themeScale anchors.horizontalCenter: parent.horizontalCenter @@ -126,6 +180,10 @@ W.Overlay { messagesListView.positionViewAtEnd() thymer.running = true } + + onSupplyPeerSettings: function(onion, nick, authorization, saveHistory) { + overlayRoot.historyState = saveHistory + } } } diff --git a/qml/overlays/ListOverlay.qml b/qml/overlays/ListOverlay.qml index 875051ce..47334736 100644 --- a/qml/overlays/ListOverlay.qml +++ b/qml/overlays/ListOverlay.qml @@ -4,6 +4,7 @@ import QtQuick.Controls 2.4 import QtQuick.Controls.Material 2.0 import QtQuick.Controls 1.4 import QtQuick.Layouts 1.3 +import CustomQmlTypes 1.0 import "../opaque" as Opaque import "../opaque/controls" as Awesome @@ -28,7 +29,7 @@ ColumnLayout { anchors.right: parent.right anchors.margins: 10 - //: ex: "... paste an address here to add a contact ..." + //: ex: "Find..." placeholderText: qsTr("search-list") horizontalAlignment: TextInput.AlignHCenter icon: gcd.assetPath + "core/search-24px.webp" @@ -78,7 +79,18 @@ ColumnLayout { maximumFlickVelocity: 800 + Connections { + id: cnxns1 + target: mm + onRowsInserted: { + var msg = mm.getMessage(first); + var name = msg.peerID == gcd.selectedProfile ? "me" : mm.getNick(msg.peerID); + cnxns2.handler(msg.peerID, msg.peerID, name, msg.rawMessage, mm.getImage(msg.peerID), msg.signature, msg.peerID == gcd.selectedProfile, msg.timestamp, msg.ack, msg.error) + } + } + Connections { + id: cnxns2 target: gcd onClearMessages: function() { diff --git a/qml/panes/PeerSettingsPane.qml b/qml/panes/PeerSettingsPane.qml index d83260d5..a2aaaf34 100644 --- a/qml/panes/PeerSettingsPane.qml +++ b/qml/panes/PeerSettingsPane.qml @@ -82,14 +82,11 @@ Opaque.SettingsList { // settingsPane isToggled: root.authorization == Const.auth_blocked onToggled: function() { - console.log("peer block toddle for " + txtOnion.text + " currently: " + root.authorization) if (root.authorization == Const.auth_blocked) { root.authorization = Const.auth_unknown - console.log("setPeerAuthorization to " + Const.auth_unknown + " for " + txtOnion.text) gcd.setPeerAuthorization(txtOnion.text, Const.auth_unknown) } else { root.authorization = Const.auth_blocked - console.log("setPeerAuthorization to " + Const.auth_blocked + " for " + txtOnion.text) gcd.setPeerAuthorization(txtOnion.text, Const.auth_blocked) } isToggled = root.authorization == Const.auth_blocked diff --git a/qml/widgets/Message.qml b/qml/widgets/Message.qml index 5b1ebe87..030fb13c 100644 --- a/qml/widgets/Message.qml +++ b/qml/widgets/Message.qml @@ -12,7 +12,8 @@ import "../opaque/fonts" Rectangle { id: root - height: Math.max(imgProfile.height, rectMessageBubble.height) + implicitHeight: Math.max(imgProfile.height, rectMessageBubble.height) + height: implicitHeight color: Theme.backgroundMainColor property string message diff --git a/qml/widgets/MessageEditor.qml b/qml/widgets/MessageEditor.qml index e2ccd536..305b30be 100644 --- a/qml/widgets/MessageEditor.qml +++ b/qml/widgets/MessageEditor.qml @@ -79,6 +79,10 @@ ColumnLayout { id: statusText anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter + width: parent.width - 2 * Theme.paddingMinimal + horizontalAlignment: Text.AlignHCenter + elide: Text.ElideRight + wrapMode: Text.NoWrap text: "" visible: text != "" size: Theme.chatMetaTextSize diff --git a/qml/widgets/Overlay.qml b/qml/widgets/Overlay.qml index b3c811a4..43567a0f 100644 --- a/qml/widgets/Overlay.qml +++ b/qml/widgets/Overlay.qml @@ -28,12 +28,12 @@ Item { id: control width: parent.width anchors.top: parent.top - anchors.topMargin: 10 * gcd.themeScale + anchors.topMargin: 10 anchors.bottom: msgEd.top - anchors.bottomMargin: 10 * gcd.themeScale + anchors.bottomMargin: 10 - horizontalPadding: 15 * gcd.themeScale + horizontalPadding: 15 } @@ -44,8 +44,8 @@ Item { anchors.bottom: parent.bottom anchors.right: parent.right anchors.left: parent.left - anchors.rightMargin: 15 * gcd.themeScale - anchors.leftMargin: 15 * gcd.themeScale + anchors.rightMargin: 15 + anchors.leftMargin: 15 onSendClicked: function(messageText) { root.sendClicked(messageText)