history warning, overlay model fixes, new zoom system beginnings #445

Merged
sarah merged 6 commits from historywarning into master 2020-12-09 01:13:19 +00:00
20 changed files with 434 additions and 134 deletions

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{fill:none;}
</style>
<g>
<path d="M8.9,12.9c-0.3,0-0.6,0-0.9,0c-2.1,0-6.3,1-6.3,3.1v2.2h5.4V16C7.1,14.7,7.8,13.7,8.9,12.9z"/>
<path d="M8,11.1c1.5,0,2.7-1.2,2.7-2.7c0-1.5-1.2-2.7-2.7-2.7c-1.5,0-2.7,1.2-2.7,2.7C5.3,9.9,6.5,11.1,8,11.1z"/>
<path d="M14.3,11.1c1.5,0,2.7-1.2,2.7-2.7c0-1.5-1.2-2.7-2.7-2.7s-2.7,1.2-2.7,2.7C11.7,9.9,12.8,11.1,14.3,11.1z"/>
<path d="M15.4,13c-0.4,0-0.7-0.1-1.1-0.1c-2.1,0-6-0.4-6.3,3.1v2.2h4.8c0-0.2,0-0.3,0-0.5C12.8,15.8,13.8,14,15.4,13z"/>
</g>
<path class="st0" d="M0,0h24v24H0V0z"/>
<path d="M22.1,18.3c0-0.1,0-0.3,0-0.4c0-0.2,0-0.3,0-0.4l1-0.7c0.1-0.1,0.1-0.2,0.1-0.3l-0.9-1.6c-0.1-0.1-0.2-0.1-0.3-0.1l-1.1,0.5
c-0.2-0.2-0.5-0.3-0.8-0.4l-0.2-1.2c0-0.1-0.1-0.2-0.2-0.2h-1.8c-0.1,0-0.2,0.1-0.2,0.2l-0.2,1.2c-0.3,0.1-0.5,0.3-0.8,0.4l-1.1-0.5
c-0.1,0-0.2,0-0.3,0.1l-0.9,1.6c-0.1,0.1,0,0.2,0.1,0.3l1,0.7c0,0.1,0,0.3,0,0.4s0,0.3,0,0.4l-1,0.7c-0.1,0.1-0.1,0.2-0.1,0.3
l0.9,1.6c0.1,0.1,0.2,0.1,0.3,0.1l1.1-0.5c0.2,0.2,0.5,0.3,0.8,0.4l0.2,1.2c0,0.1,0.1,0.2,0.2,0.2h1.8c0.1,0,0.2-0.1,0.2-0.2L20,21
c0.3-0.1,0.5-0.3,0.8-0.4l1.1,0.5c0.1,0,0.2,0,0.3-0.1l0.9-1.6c0.1-0.1,0-0.2-0.1-0.3L22.1,18.3z M18.7,19.5c-0.9,0-1.7-0.8-1.7-1.7
c0-0.9,0.8-1.7,1.7-1.7c0.9,0,1.7,0.8,1.7,1.7C20.5,18.8,19.7,19.5,18.7,19.5z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{fill:none;}
</style>
<path class="st0" d="M0,0h24v24H0V0z"/>
<g>
<path d="M13.6,13.8c-1-0.2-2-0.3-2.8-0.3c-2.7,0-8,1.3-8,4v2h9.8c-0.3-0.6-0.4-1.3-0.4-2.1C12.2,15.9,12.7,14.7,13.6,13.8z"/>
<circle cx="10.8" cy="7.4" r="4"/>
</g>
<path d="M21.1,17.9c0-0.1,0-0.3,0-0.4c0-0.2,0-0.3,0-0.4l1-0.7c0.1-0.1,0.1-0.2,0.1-0.3l-0.9-1.6c-0.1-0.1-0.2-0.1-0.3-0.1l-1.1,0.5
c-0.2-0.2-0.5-0.3-0.8-0.4l-0.2-1.2c0-0.1-0.1-0.2-0.2-0.2h-1.8c-0.1,0-0.2,0.1-0.2,0.2l-0.2,1.2c-0.3,0.1-0.5,0.3-0.8,0.4l-1.1-0.5
c-0.1,0-0.2,0-0.3,0.1L13.4,16c-0.1,0.1,0,0.2,0.1,0.3l1,0.7c0,0.1,0,0.3,0,0.4c0,0.1,0,0.3,0,0.4l-1,0.7c-0.1,0.1-0.1,0.2-0.1,0.3
l0.9,1.6c0.1,0.1,0.2,0.1,0.3,0.1l1.1-0.5c0.2,0.2,0.5,0.3,0.8,0.4l0.2,1.2c0,0.1,0.1,0.2,0.2,0.2h1.8c0.1,0,0.2-0.1,0.2-0.2
l0.2-1.2c0.3-0.1,0.5-0.3,0.8-0.4l1.1,0.5c0.1,0,0.2,0,0.3-0.1l0.9-1.6c0.1-0.1,0-0.2-0.1-0.3L21.1,17.9z M17.7,19.2
c-0.9,0-1.7-0.8-1.7-1.7c0-0.9,0.8-1.7,1.7-1.7c0.9,0,1.7,0.8,1.7,1.7C19.4,18.4,18.7,19.2,17.7,19.2z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 678 B

View File

@ -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() {

View File

@ -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))
Review

I beleive this disinguishes outbound messages that have been acked with inbound messages that we have acked.

I beleive this disinguishes outbound messages that have been acked with inbound messages that we have acked.
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})

View File

@ -76,11 +76,8 @@
</message>
<message>
<location filename="../qml/panes/AddPeerGroupPane.qml" line="140"/>
<location filename="../qml/panes/AddPeerGroupPane.qml" line="196"/>
<source>group-name</source>
<extracomment>Group Name
----------
Name</extracomment>
<extracomment>Group Name</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
@ -105,23 +102,44 @@ Name</extracomment>
<context>
<name>BulletinOverlay</name>
<message>
<location filename="../qml/overlays/BulletinOverlay.qml" line="202"/>
<location filename="../qml/overlays/BulletinOverlay.qml" line="215"/>
<source>new-bulletin-label</source>
<translation>Neue Meldung</translation>
</message>
<message>
<location filename="../qml/overlays/BulletinOverlay.qml" line="214"/>
<location filename="../qml/overlays/BulletinOverlay.qml" line="227"/>
<source>post-new-bulletin-label</source>
<extracomment>Post a new Bulletin Post</extracomment>
<translation>Neue Meldung veröffentlichen</translation>
</message>
<message>
<location filename="../qml/overlays/BulletinOverlay.qml" line="220"/>
<location filename="../qml/overlays/BulletinOverlay.qml" line="234"/>
<source>title-placeholder</source>
<extracomment>title place holder text</extracomment>
<translation>Titel...</translation>
</message>
</context>
<context>
<name>ChatOverlay</name>
<message>
<location filename="../qml/overlays/ChatOverlay.qml" line="83"/>
<source>chat-history-default</source>
<extracomment>This conversation will be deleted when Cwtch is closed! Message history can be enabled per-conversation via the Settings menu in the upper right.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/overlays/ChatOverlay.qml" line="85"/>
<source>chat-history-disabled</source>
<extracomment>Message history is disabled.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/overlays/ChatOverlay.qml" line="87"/>
<source>chat-history-enabled</source>
<extracomment>Message history is enabled.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ContactList</name>
<message>
@ -233,18 +251,18 @@ Name</extracomment>
<translation type="vanished">noch zu erledigen</translation>
</message>
<message>
<location filename="../qml/overlays/ListOverlay.qml" line="32"/>
<location filename="../qml/overlays/ListOverlay.qml" line="33"/>
<source>search-list</source>
<extracomment>ex: &quot;... paste an address here to add a contact ...&quot;</extracomment>
<extracomment>ex: &quot;Find...&quot;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/overlays/ListOverlay.qml" line="62"/>
<location filename="../qml/overlays/ListOverlay.qml" line="63"/>
<source>peer-not-online</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/overlays/ListOverlay.qml" line="200"/>
<location filename="../qml/overlays/ListOverlay.qml" line="212"/>
<source>add-list-item-btn</source>
<translation type="unfinished"></translation>
</message>
@ -261,24 +279,24 @@ Name</extracomment>
<context>
<name>Message</name>
<message>
<location filename="../qml/widgets/Message.qml" line="66"/>
<location filename="../qml/widgets/Message.qml" line="67"/>
<source>dm-tooltip</source>
<extracomment>Click to DM</extracomment>
<translation>Klicken, um DM zu senden</translation>
</message>
<message>
<location filename="../qml/widgets/Message.qml" line="188"/>
<location filename="../qml/widgets/Message.qml" line="189"/>
<source>could-not-send-msg-error</source>
<extracomment>Could not send this message</extracomment>
<translation>Nachricht konnte nicht gesendet werden</translation>
</message>
<message>
<location filename="../qml/widgets/Message.qml" line="188"/>
<location filename="../qml/widgets/Message.qml" line="189"/>
<source>acknowledged-label</source>
<translation>bestätigt</translation>
</message>
<message>
<location filename="../qml/widgets/Message.qml" line="188"/>
<location filename="../qml/widgets/Message.qml" line="189"/>
<source>pending-label</source>
<translation>Bestätigung ausstehend</translation>
</message>
@ -387,24 +405,24 @@ Name</extracomment>
<translation>speichern</translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="102"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="112"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="99"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="109"/>
<source>save-peer-history</source>
<extracomment>Save Peer History</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="103"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="100"/>
<source>save-peer-history-description</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="111"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="108"/>
<source>dont-save-peer-history</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="133"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="130"/>
<source>delete-btn</source>
<translation>löschen</translation>
</message>

Binary file not shown.

View File

@ -76,11 +76,8 @@
</message>
<message>
<location filename="../qml/panes/AddPeerGroupPane.qml" line="140"/>
<location filename="../qml/panes/AddPeerGroupPane.qml" line="196"/>
<source>group-name</source>
<extracomment>Group Name
----------
Name</extracomment>
<extracomment>Group Name</extracomment>
<translation>Group name</translation>
</message>
<message>
@ -118,23 +115,44 @@ Name</extracomment>
<context>
<name>BulletinOverlay</name>
<message>
<location filename="../qml/overlays/BulletinOverlay.qml" line="202"/>
<location filename="../qml/overlays/BulletinOverlay.qml" line="215"/>
<source>new-bulletin-label</source>
<translation>New Bulletin</translation>
</message>
<message>
<location filename="../qml/overlays/BulletinOverlay.qml" line="214"/>
<location filename="../qml/overlays/BulletinOverlay.qml" line="227"/>
<source>post-new-bulletin-label</source>
<extracomment>Post a new Bulletin Post</extracomment>
<translation>Post new bulletin</translation>
</message>
<message>
<location filename="../qml/overlays/BulletinOverlay.qml" line="220"/>
<location filename="../qml/overlays/BulletinOverlay.qml" line="234"/>
<source>title-placeholder</source>
<extracomment>title place holder text</extracomment>
<translation>title...</translation>
</message>
</context>
<context>
<name>ChatOverlay</name>
<message>
<location filename="../qml/overlays/ChatOverlay.qml" line="83"/>
<source>chat-history-default</source>
<extracomment>This conversation will be deleted when Cwtch is closed! Message history can be enabled per-conversation via the Settings menu in the upper right.</extracomment>
<translation>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.</translation>
</message>
<message>
<location filename="../qml/overlays/ChatOverlay.qml" line="85"/>
<source>chat-history-disabled</source>
<extracomment>Message history is disabled.</extracomment>
<translation>Message history is disabled.</translation>
</message>
<message>
<location filename="../qml/overlays/ChatOverlay.qml" line="87"/>
<source>chat-history-enabled</source>
<extracomment>Message history is enabled.</extracomment>
<translation>Message history is enabled.</translation>
</message>
</context>
<context>
<name>ContactList</name>
<message>
@ -326,18 +344,18 @@ Right-click to reset.</translation>
<context>
<name>ListOverlay</name>
<message>
<location filename="../qml/overlays/ListOverlay.qml" line="32"/>
<location filename="../qml/overlays/ListOverlay.qml" line="33"/>
<source>search-list</source>
<extracomment>ex: &quot;... paste an address here to add a contact ...&quot;</extracomment>
<extracomment>ex: &quot;Find...&quot;</extracomment>
<translation>Search List</translation>
</message>
<message>
<location filename="../qml/overlays/ListOverlay.qml" line="62"/>
<location filename="../qml/overlays/ListOverlay.qml" line="63"/>
<source>peer-not-online</source>
<translation>Peer is Offline. Applications cannot be used right now.</translation>
</message>
<message>
<location filename="../qml/overlays/ListOverlay.qml" line="200"/>
<location filename="../qml/overlays/ListOverlay.qml" line="212"/>
<source>add-list-item-btn</source>
<translation>Add Item</translation>
</message>
@ -354,24 +372,24 @@ Right-click to reset.</translation>
<context>
<name>Message</name>
<message>
<location filename="../qml/widgets/Message.qml" line="66"/>
<location filename="../qml/widgets/Message.qml" line="67"/>
<source>dm-tooltip</source>
<extracomment>Click to DM</extracomment>
<translation>Click to DM</translation>
</message>
<message>
<location filename="../qml/widgets/Message.qml" line="188"/>
<location filename="../qml/widgets/Message.qml" line="189"/>
<source>could-not-send-msg-error</source>
<extracomment>Could not send this message</extracomment>
<translation>Could not send this message</translation>
</message>
<message>
<location filename="../qml/widgets/Message.qml" line="188"/>
<location filename="../qml/widgets/Message.qml" line="189"/>
<source>acknowledged-label</source>
<translation>Acknowledged</translation>
</message>
<message>
<location filename="../qml/widgets/Message.qml" line="188"/>
<location filename="../qml/widgets/Message.qml" line="189"/>
<source>pending-label</source>
<translation>Pending</translation>
</message>
@ -485,19 +503,19 @@ Right-click to reset.</translation>
<translation>Block Peer</translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="102"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="112"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="99"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="109"/>
<source>save-peer-history</source>
<extracomment>Save Peer History</extracomment>
<translation>Save Peer History</translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="103"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="100"/>
<source>save-peer-history-description</source>
<translation>Determines whether or not to delete any history associated with the peer.</translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="111"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="108"/>
<source>dont-save-peer-history</source>
<translation>Delete Peer History</translation>
</message>
@ -506,7 +524,7 @@ Right-click to reset.</translation>
<translation type="vanished">Unblock Peer</translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="133"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="130"/>
<source>delete-btn</source>
<translation>Delete</translation>
</message>

View File

@ -76,11 +76,8 @@
</message>
<message>
<location filename="../qml/panes/AddPeerGroupPane.qml" line="140"/>
<location filename="../qml/panes/AddPeerGroupPane.qml" line="196"/>
<source>group-name</source>
<extracomment>Group Name
----------
Name</extracomment>
<extracomment>Group Name</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
@ -105,23 +102,44 @@ Name</extracomment>
<context>
<name>BulletinOverlay</name>
<message>
<location filename="../qml/overlays/BulletinOverlay.qml" line="202"/>
<location filename="../qml/overlays/BulletinOverlay.qml" line="215"/>
<source>new-bulletin-label</source>
<translation>Nouveau bulletin</translation>
</message>
<message>
<location filename="../qml/overlays/BulletinOverlay.qml" line="214"/>
<location filename="../qml/overlays/BulletinOverlay.qml" line="227"/>
<source>post-new-bulletin-label</source>
<extracomment>Post a new Bulletin Post</extracomment>
<translation>Envoyer un nouveau bulletin</translation>
</message>
<message>
<location filename="../qml/overlays/BulletinOverlay.qml" line="220"/>
<location filename="../qml/overlays/BulletinOverlay.qml" line="234"/>
<source>title-placeholder</source>
<extracomment>title place holder text</extracomment>
<translation>titre...</translation>
</message>
</context>
<context>
<name>ChatOverlay</name>
<message>
<location filename="../qml/overlays/ChatOverlay.qml" line="83"/>
<source>chat-history-default</source>
<extracomment>This conversation will be deleted when Cwtch is closed! Message history can be enabled per-conversation via the Settings menu in the upper right.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/overlays/ChatOverlay.qml" line="85"/>
<source>chat-history-disabled</source>
<extracomment>Message history is disabled.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/overlays/ChatOverlay.qml" line="87"/>
<source>chat-history-enabled</source>
<extracomment>Message history is enabled.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ContactList</name>
<message>
@ -233,18 +251,18 @@ Name</extracomment>
<translation type="vanished">A faire...</translation>
</message>
<message>
<location filename="../qml/overlays/ListOverlay.qml" line="32"/>
<location filename="../qml/overlays/ListOverlay.qml" line="33"/>
<source>search-list</source>
<extracomment>ex: &quot;... paste an address here to add a contact ...&quot;</extracomment>
<extracomment>ex: &quot;Find...&quot;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/overlays/ListOverlay.qml" line="62"/>
<location filename="../qml/overlays/ListOverlay.qml" line="63"/>
<source>peer-not-online</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/overlays/ListOverlay.qml" line="200"/>
<location filename="../qml/overlays/ListOverlay.qml" line="212"/>
<source>add-list-item-btn</source>
<translation type="unfinished"></translation>
</message>
@ -261,24 +279,24 @@ Name</extracomment>
<context>
<name>Message</name>
<message>
<location filename="../qml/widgets/Message.qml" line="66"/>
<location filename="../qml/widgets/Message.qml" line="67"/>
<source>dm-tooltip</source>
<extracomment>Click to DM</extracomment>
<translation>Envoyer un message privé</translation>
</message>
<message>
<location filename="../qml/widgets/Message.qml" line="188"/>
<location filename="../qml/widgets/Message.qml" line="189"/>
<source>could-not-send-msg-error</source>
<extracomment>Could not send this message</extracomment>
<translation>Impossible d&apos;envoyer ce message</translation>
</message>
<message>
<location filename="../qml/widgets/Message.qml" line="188"/>
<location filename="../qml/widgets/Message.qml" line="189"/>
<source>acknowledged-label</source>
<translation>Confirmé</translation>
</message>
<message>
<location filename="../qml/widgets/Message.qml" line="188"/>
<location filename="../qml/widgets/Message.qml" line="189"/>
<source>pending-label</source>
<translation>En attente</translation>
</message>
@ -387,24 +405,24 @@ Name</extracomment>
<translation>Sauvegarder</translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="102"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="112"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="99"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="109"/>
<source>save-peer-history</source>
<extracomment>Save Peer History</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="103"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="100"/>
<source>save-peer-history-description</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="111"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="108"/>
<source>dont-save-peer-history</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="133"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="130"/>
<source>delete-btn</source>
<translation>Effacer</translation>
</message>

View File

@ -76,11 +76,8 @@
</message>
<message>
<location filename="../qml/panes/AddPeerGroupPane.qml" line="140"/>
<location filename="../qml/panes/AddPeerGroupPane.qml" line="196"/>
<source>group-name</source>
<extracomment>Group Name
----------
Name</extracomment>
<extracomment>Group Name</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
@ -105,23 +102,44 @@ Name</extracomment>
<context>
<name>BulletinOverlay</name>
<message>
<location filename="../qml/overlays/BulletinOverlay.qml" line="202"/>
<location filename="../qml/overlays/BulletinOverlay.qml" line="215"/>
<source>new-bulletin-label</source>
<translation>Novo Boletim</translation>
</message>
<message>
<location filename="../qml/overlays/BulletinOverlay.qml" line="214"/>
<location filename="../qml/overlays/BulletinOverlay.qml" line="227"/>
<source>post-new-bulletin-label</source>
<extracomment>Post a new Bulletin Post</extracomment>
<translation>Postar novo boletim</translation>
</message>
<message>
<location filename="../qml/overlays/BulletinOverlay.qml" line="220"/>
<location filename="../qml/overlays/BulletinOverlay.qml" line="234"/>
<source>title-placeholder</source>
<extracomment>title place holder text</extracomment>
<translation>título</translation>
</message>
</context>
<context>
<name>ChatOverlay</name>
<message>
<location filename="../qml/overlays/ChatOverlay.qml" line="83"/>
<source>chat-history-default</source>
<extracomment>This conversation will be deleted when Cwtch is closed! Message history can be enabled per-conversation via the Settings menu in the upper right.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/overlays/ChatOverlay.qml" line="85"/>
<source>chat-history-disabled</source>
<extracomment>Message history is disabled.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/overlays/ChatOverlay.qml" line="87"/>
<source>chat-history-enabled</source>
<extracomment>Message history is enabled.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ContactList</name>
<message>
@ -233,18 +251,18 @@ Name</extracomment>
<translation type="vanished">Afazer</translation>
</message>
<message>
<location filename="../qml/overlays/ListOverlay.qml" line="32"/>
<location filename="../qml/overlays/ListOverlay.qml" line="33"/>
<source>search-list</source>
<extracomment>ex: &quot;... paste an address here to add a contact ...&quot;</extracomment>
<extracomment>ex: &quot;Find...&quot;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/overlays/ListOverlay.qml" line="62"/>
<location filename="../qml/overlays/ListOverlay.qml" line="63"/>
<source>peer-not-online</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/overlays/ListOverlay.qml" line="200"/>
<location filename="../qml/overlays/ListOverlay.qml" line="212"/>
<source>add-list-item-btn</source>
<translation type="unfinished"></translation>
</message>
@ -261,24 +279,24 @@ Name</extracomment>
<context>
<name>Message</name>
<message>
<location filename="../qml/widgets/Message.qml" line="66"/>
<location filename="../qml/widgets/Message.qml" line="67"/>
<source>dm-tooltip</source>
<extracomment>Click to DM</extracomment>
<translation>Clique para DM</translation>
</message>
<message>
<location filename="../qml/widgets/Message.qml" line="188"/>
<location filename="../qml/widgets/Message.qml" line="189"/>
<source>could-not-send-msg-error</source>
<extracomment>Could not send this message</extracomment>
<translation>Não deu para enviar esta mensagem</translation>
</message>
<message>
<location filename="../qml/widgets/Message.qml" line="188"/>
<location filename="../qml/widgets/Message.qml" line="189"/>
<source>acknowledged-label</source>
<translation>Confirmada</translation>
</message>
<message>
<location filename="../qml/widgets/Message.qml" line="188"/>
<location filename="../qml/widgets/Message.qml" line="189"/>
<source>pending-label</source>
<translation>Pendente</translation>
</message>
@ -387,24 +405,24 @@ Name</extracomment>
<translation>Salvar</translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="102"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="112"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="99"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="109"/>
<source>save-peer-history</source>
<extracomment>Save Peer History</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="103"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="100"/>
<source>save-peer-history-description</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="111"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="108"/>
<source>dont-save-peer-history</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="133"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="130"/>
<source>delete-btn</source>
<translation>Deletar</translation>
</message>

View File

@ -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() {

View File

@ -238,7 +238,7 @@ ApplicationWindow {
Layout.fillHeight: true
OverlayPane { // messagePane
anchors.fill: parent
anchors.topMargin: 10 * gcd.themeScale
anchors.topMargin: 10// * gcd.themeScale
}
}

@ -1 +1 @@
Subproject commit 365eedbd90eb936043e42f632355862d2a34c77a
Subproject commit dd8dde1fb38e296530570d31e95780ff707e2895

View File

@ -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: '<b>' + Utils.htmlEscaped(title) + '</b> by ' + from + "<br/>" + Qt.formatDateTime(new Date(timestamp*1000), "MMMM d, h:mm ap")
text: '<b>' + Utils.htmlEscaped(title) + '</b> by ' + displayName + "<br/>" + 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 {

View File

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

does this need to scale?

does this need to scale?
Review

technically but this fixes image scaling for now... i'm planning to 'grep -r themeScale' for the new zoom system so we'll fix it then

technically but this fixes image scaling for now... i'm planning to 'grep -r themeScale' for the new zoom system so we'll fix it then
anchors.horizontalCenter: parent.horizontalCenter
@ -126,6 +180,10 @@ W.Overlay {
messagesListView.positionViewAtEnd()
thymer.running = true
}
onSupplyPeerSettings: function(onion, nick, authorization, saveHistory) {
overlayRoot.historyState = saveHistory
erinn marked this conversation as resolved
Review

I'd like to see a qml check on onion == handle here even if the logic is also being handled by the gcd

I'd like to see a qml check on onion == handle here even if the logic is also being handled by the gcd
}
}
}

View File

@ -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() {

View File

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

View File

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

View File

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

View File

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