Merge branch 'progress' of dan/ui into master
This commit is contained in:
commit
b6f0e7f171
|
@ -11,19 +11,21 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func IncomingListener(callback func(*gobjects.Message), groupErrorCallback func(string, string,string)) {
|
func IncomingListener(callback func(*gobjects.Message), groupErrorCallback func(string, string, string), serverStateCallback func(string, bool)) {
|
||||||
q := event.NewEventQueue(1000)
|
q := event.NewEventQueue(1000)
|
||||||
the.CwtchApp.EventBus().Subscribe(event.NewMessageFromPeer, q.EventChannel)
|
the.CwtchApp.EventBus().Subscribe(event.NewMessageFromPeer, q.EventChannel)
|
||||||
the.CwtchApp.EventBus().Subscribe(event.NewMessageFromGroup, q.EventChannel)
|
the.CwtchApp.EventBus().Subscribe(event.NewMessageFromGroup, q.EventChannel)
|
||||||
the.CwtchApp.EventBus().Subscribe(event.NewGroupInvite, q.EventChannel)
|
the.CwtchApp.EventBus().Subscribe(event.NewGroupInvite, q.EventChannel)
|
||||||
the.CwtchApp.EventBus().Subscribe(event.SendMessageToGroupError, q.EventChannel)
|
the.CwtchApp.EventBus().Subscribe(event.SendMessageToGroupError, q.EventChannel)
|
||||||
the.CwtchApp.EventBus().Subscribe(event.SendMessageToPeerError, q.EventChannel)
|
the.CwtchApp.EventBus().Subscribe(event.SendMessageToPeerError, q.EventChannel)
|
||||||
|
the.CwtchApp.EventBus().Subscribe(event.JoinServer, q.EventChannel)
|
||||||
|
the.CwtchApp.EventBus().Subscribe(event.FinishedFetch, q.EventChannel)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
e := q.Next()
|
e := q.Next()
|
||||||
|
|
||||||
switch e.EventType {
|
switch e.EventType {
|
||||||
case event.NewMessageFromPeer://event.TimestampReceived, event.RemotePeer, event.Data
|
case event.NewMessageFromPeer: //event.TimestampReceived, event.RemotePeer, event.Data
|
||||||
ts, _ := time.Parse(time.RFC3339Nano, e.Data[event.TimestampReceived])
|
ts, _ := time.Parse(time.RFC3339Nano, e.Data[event.TimestampReceived])
|
||||||
callback(&gobjects.Message{
|
callback(&gobjects.Message{
|
||||||
Handle: e.Data[event.RemotePeer],
|
Handle: e.Data[event.RemotePeer],
|
||||||
|
@ -40,7 +42,7 @@ func IncomingListener(callback func(*gobjects.Message), groupErrorCallback func(
|
||||||
if e.Data[event.Data] != "ack" {
|
if e.Data[event.Data] != "ack" {
|
||||||
the.Peer.SendMessageToPeer(e.Data[event.RemotePeer], "ack")
|
the.Peer.SendMessageToPeer(e.Data[event.RemotePeer], "ack")
|
||||||
}
|
}
|
||||||
case event.NewMessageFromGroup://event.TimestampReceived, event.TimestampSent, event.Data, event.GroupID, event.RemotePeer
|
case event.NewMessageFromGroup: //event.TimestampReceived, event.TimestampSent, event.Data, event.GroupID, event.RemotePeer
|
||||||
var name string
|
var name string
|
||||||
var exists bool
|
var exists bool
|
||||||
ctc := the.Peer.GetContact(e.Data[event.RemotePeer])
|
ctc := the.Peer.GetContact(e.Data[event.RemotePeer])
|
||||||
|
@ -55,15 +57,15 @@ func IncomingListener(callback func(*gobjects.Message), groupErrorCallback func(
|
||||||
|
|
||||||
ts, _ := time.Parse(time.RFC3339Nano, e.Data[event.TimestampSent])
|
ts, _ := time.Parse(time.RFC3339Nano, e.Data[event.TimestampSent])
|
||||||
callback(&gobjects.Message{
|
callback(&gobjects.Message{
|
||||||
MessageID: e.Data[event.Signature],
|
MessageID: e.Data[event.Signature],
|
||||||
Handle: e.Data[event.GroupID],
|
Handle: e.Data[event.GroupID],
|
||||||
From: e.Data[event.RemotePeer],
|
From: e.Data[event.RemotePeer],
|
||||||
Message: e.Data[event.Data],
|
Message: e.Data[event.Data],
|
||||||
Image: cwutil.RandomProfileImage(e.Data[event.RemotePeer]),
|
Image: cwutil.RandomProfileImage(e.Data[event.RemotePeer]),
|
||||||
FromMe: e.Data[event.RemotePeer] == the.Peer.GetProfile().Onion,
|
FromMe: e.Data[event.RemotePeer] == the.Peer.GetProfile().Onion,
|
||||||
Timestamp: ts,
|
Timestamp: ts,
|
||||||
Acknowledged: true,
|
Acknowledged: true,
|
||||||
DisplayName: name,
|
DisplayName: name,
|
||||||
})
|
})
|
||||||
case event.NewGroupInvite:
|
case event.NewGroupInvite:
|
||||||
log.Debugf("got a group invite!")
|
log.Debugf("got a group invite!")
|
||||||
|
@ -71,6 +73,10 @@ func IncomingListener(callback func(*gobjects.Message), groupErrorCallback func(
|
||||||
groupErrorCallback(e.Data[event.GroupServer], e.Data[event.Signature], e.Data[event.Error])
|
groupErrorCallback(e.Data[event.GroupServer], e.Data[event.Signature], e.Data[event.Error])
|
||||||
case event.SendMessageToPeerError:
|
case event.SendMessageToPeerError:
|
||||||
groupErrorCallback(e.Data[event.RemotePeer], e.Data[event.Signature], e.Data[event.Error])
|
groupErrorCallback(e.Data[event.RemotePeer], e.Data[event.Signature], e.Data[event.Error])
|
||||||
|
case event.JoinServer:
|
||||||
|
serverStateCallback(e.Data[event.GroupServer], true)
|
||||||
|
case event.FinishedFetch:
|
||||||
|
serverStateCallback(e.Data[event.GroupServer], false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ func PresencePoller(getContact func(string) *gobjects.Contact, addContact func(c
|
||||||
if ct == nil { // new contact has attempted to connect with us, treat it as an invite
|
if ct == nil { // new contact has attempted to connect with us, treat it as an invite
|
||||||
toc := the.Peer.GetContact(contacts[i])
|
toc := the.Peer.GetContact(contacts[i])
|
||||||
c, _ := the.Peer.GetProfile().GetContact(contacts[i])
|
c, _ := the.Peer.GetProfile().GetContact(contacts[i])
|
||||||
deleted,_ := c.GetAttribute("deleted")
|
deleted, _ := c.GetAttribute("deleted")
|
||||||
|
|
||||||
if deleted != "deleted" {
|
if deleted != "deleted" {
|
||||||
addContact(&gobjects.Contact{
|
addContact(&gobjects.Contact{
|
||||||
|
@ -28,6 +28,7 @@ func PresencePoller(getContact func(string) *gobjects.Contact, addContact func(c
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
c.Trusted,
|
c.Trusted,
|
||||||
|
false,
|
||||||
})
|
})
|
||||||
|
|
||||||
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetPeerAttribute, map[event.Field]string{
|
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetPeerAttribute, map[event.Field]string{
|
||||||
|
|
|
@ -8,4 +8,5 @@ type Contact struct {
|
||||||
Badge int
|
Badge int
|
||||||
Status int
|
Status int
|
||||||
Trusted bool
|
Trusted bool
|
||||||
|
Loading bool
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,48 +30,49 @@ type GrandCentralDispatcher struct {
|
||||||
_ string `property:"buildDate"`
|
_ string `property:"buildDate"`
|
||||||
|
|
||||||
// contact list stuff
|
// contact list stuff
|
||||||
_ func(handle, displayName, image, server string, badge, status int, trusted bool) `signal:"AddContact"`
|
_ func(handle, displayName, image, server string, badge, status int, trusted bool, loading bool) `signal:"AddContact"`
|
||||||
_ func(handle, displayName, image, server string, badge, status int, trusted bool) `signal:"UpdateContact"`
|
_ func(handle, displayName, image, server string, badge, status int, trusted bool, loading bool) `signal:"UpdateContact"`
|
||||||
_ func(handle, key, value string) `signal:"UpdateContactAttribute"`
|
_ func(handle, key, value string) `signal:"UpdateContactAttribute"`
|
||||||
|
|
||||||
// messages pane stuff
|
// messages pane stuff
|
||||||
_ func(handle, from, displayName, message, image string, mID string, fromMe bool, ts string, ackd bool, error bool) `signal:"AppendMessage"`
|
_ func(handle, from, displayName, message, image string, mID string, fromMe bool, ts string, ackd bool, error bool) `signal:"AppendMessage"`
|
||||||
_ func(handle, from, displayName, message, image string, mID string, fromMe bool, ts string, ackd bool, error bool) `signal:"PrependMessage"`
|
_ func(handle, from, displayName, message, image string, mID string, fromMe bool, ts string, ackd bool, error bool) `signal:"PrependMessage"`
|
||||||
_ func() `signal:"ClearMessages"`
|
_ func() `signal:"ClearMessages"`
|
||||||
_ func() `signal:"ResetMessagePane"`
|
_ func() `signal:"ResetMessagePane"`
|
||||||
_ func(mID string) `signal:"Acknowledged"`
|
_ func(mID string) `signal:"Acknowledged"`
|
||||||
_ func(title string) `signal:"SetToolbarTitle"`
|
_ func(title string) `signal:"SetToolbarTitle"`
|
||||||
_ func(signature string, err string) `signal:"GroupSendError"`
|
_ func(signature string, err string) `signal:"GroupSendError"`
|
||||||
|
_ func(loading bool) `signal:"SetLoadingState"`
|
||||||
|
|
||||||
// profile-area stuff
|
// profile-area stuff
|
||||||
_ func(name, onion, image string) `signal:"UpdateMyProfile"`
|
_ func(name, onion, image string) `signal:"UpdateMyProfile"`
|
||||||
_ func(status int, str string) `signal:"TorStatus"`
|
_ func(status int, str string) `signal:"TorStatus"`
|
||||||
|
|
||||||
// settings helpers
|
// settings helpers
|
||||||
_ func(str string) `signal:"InvokePopup"`
|
_ func(str string) `signal:"InvokePopup"`
|
||||||
_ func(zoom, locale string) `signal:"SupplySettings"`
|
_ func(zoom, locale string) `signal:"SupplySettings"`
|
||||||
_ func(groupID, name, server, invitation string, accepted bool, addrbooknames, addrbookaddrs []string) `signal:"SupplyGroupSettings"`
|
_ func(groupID, name, server, invitation string, accepted bool, addrbooknames, addrbookaddrs []string) `signal:"SupplyGroupSettings"`
|
||||||
_ func(onion, nick string) `signal:"SupplyPeerSettings"`
|
_ func(onion, nick string) `signal:"SupplyPeerSettings"`
|
||||||
|
|
||||||
// signals emitted from the ui (written in go, below)
|
// signals emitted from the ui (written in go, below)
|
||||||
_ func(message string, mid string) `signal:"sendMessage,auto"`
|
_ func(message string, mid string) `signal:"sendMessage,auto"`
|
||||||
_ func(onion string) `signal:"loadMessagesPane,auto"`
|
_ func(onion string) `signal:"loadMessagesPane,auto"`
|
||||||
_ func(signal string) `signal:"broadcast,auto"` // convenience relay signal
|
_ func(signal string) `signal:"broadcast,auto"` // convenience relay signal
|
||||||
_ func(str string) `signal:"importString,auto"`
|
_ func(str string) `signal:"importString,auto"`
|
||||||
_ func(str string) `signal:"popup,auto"`
|
_ func(str string) `signal:"popup,auto"`
|
||||||
_ func(nick string) `signal:"updateNick,auto"`
|
_ func(nick string) `signal:"updateNick,auto"`
|
||||||
_ func(server, groupName string) `signal:"createGroup,auto"`
|
_ func(server, groupName string) `signal:"createGroup,auto"`
|
||||||
_ func(groupID string) `signal:"leaveGroup,auto"`
|
_ func(groupID string) `signal:"leaveGroup,auto"`
|
||||||
_ func(groupID string) `signal:"acceptGroup,auto"`
|
_ func(groupID string) `signal:"acceptGroup,auto"`
|
||||||
_ func() `signal:"requestSettings,auto"`
|
_ func() `signal:"requestSettings,auto"`
|
||||||
_ func(zoom, locale string) `signal:"saveSettings,auto"`
|
_ func(zoom, locale string) `signal:"saveSettings,auto"`
|
||||||
_ func(groupID string) `signal:"requestGroupSettings,auto"`
|
_ func(groupID string) `signal:"requestGroupSettings,auto"`
|
||||||
_ func(groupID, nick string) `signal:"saveGroupSettings,auto"`
|
_ func(groupID, nick string) `signal:"saveGroupSettings,auto"`
|
||||||
_ func() `signal:"requestPeerSettings,auto"`
|
_ func() `signal:"requestPeerSettings,auto"`
|
||||||
_ func(onion, nick string) `signal:"savePeerSettings,auto"`
|
_ func(onion, nick string) `signal:"savePeerSettings,auto"`
|
||||||
_ func(onion, groupID string) `signal:"inviteToGroup,auto"`
|
_ func(onion, groupID string) `signal:"inviteToGroup,auto"`
|
||||||
_ func(onion, key, nick string) `signal:"setAttribute,auto"`
|
_ func(onion, key, nick string) `signal:"setAttribute,auto"`
|
||||||
_ func(locale string) `signal:"setLocale,auto"`
|
_ func(locale string) `signal:"setLocale,auto"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *GrandCentralDispatcher) sendMessage(message string, mID string) {
|
func (this *GrandCentralDispatcher) sendMessage(message string, mID string) {
|
||||||
|
@ -98,7 +99,7 @@ func (this *GrandCentralDispatcher) sendMessage(message string, mID string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
mID,err = the.Peer.SendMessageToGroupTracked(this.CurrentOpenConversation(), message)
|
mID, err = the.Peer.SendMessageToGroupTracked(this.CurrentOpenConversation(), message)
|
||||||
|
|
||||||
this.UIState.AddMessage(&gobjects.Message{
|
this.UIState.AddMessage(&gobjects.Message{
|
||||||
this.CurrentOpenConversation(),
|
this.CurrentOpenConversation(),
|
||||||
|
@ -114,7 +115,7 @@ func (this *GrandCentralDispatcher) sendMessage(message string, mID string) {
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.InvokePopup("failed to send message " +err.Error())
|
this.InvokePopup("failed to send message " + err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -125,7 +126,7 @@ func (this *GrandCentralDispatcher) sendMessage(message string, mID string) {
|
||||||
this.UIState.UpdateContact(this.CurrentOpenConversation())
|
this.UIState.UpdateContact(this.CurrentOpenConversation())
|
||||||
}
|
}
|
||||||
|
|
||||||
to := this.CurrentOpenConversation();
|
to := this.CurrentOpenConversation()
|
||||||
the.Peer.PeerWithOnion(to)
|
the.Peer.PeerWithOnion(to)
|
||||||
mID = the.Peer.SendMessageToPeer(to, message)
|
mID = the.Peer.SendMessageToPeer(to, message)
|
||||||
|
|
||||||
|
@ -148,7 +149,6 @@ func (this *GrandCentralDispatcher) sendMessage(message string, mID string) {
|
||||||
the.AcknowledgementIDs[to] = append(the.AcknowledgementIDs[to], ackID)
|
the.AcknowledgementIDs[to] = append(the.AcknowledgementIDs[to], ackID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *GrandCentralDispatcher) loadMessagesPane(handle string) {
|
func (this *GrandCentralDispatcher) loadMessagesPane(handle string) {
|
||||||
|
@ -169,15 +169,13 @@ func (this *GrandCentralDispatcher) loadMessagesPaneHelper(handle string) {
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
false,
|
false,
|
||||||
|
false,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
c.Badge = 0
|
c.Badge = 0
|
||||||
this.UIState.UpdateContact(handle)
|
this.UIState.UpdateContact(handle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if len(handle) == 32 { // LOAD GROUP
|
if len(handle) == 32 { // LOAD GROUP
|
||||||
group := the.Peer.GetGroup(handle)
|
group := the.Peer.GetGroup(handle)
|
||||||
tl := group.GetTimeline()
|
tl := group.GetTimeline()
|
||||||
|
@ -215,9 +213,9 @@ func (this *GrandCentralDispatcher) loadMessagesPaneHelper(handle string) {
|
||||||
string(tl[i].Signature),
|
string(tl[i].Signature),
|
||||||
tl[i].PeerID == the.Peer.GetProfile().Onion,
|
tl[i].PeerID == the.Peer.GetProfile().Onion,
|
||||||
tl[i].Timestamp.Format(constants.TIME_FORMAT),
|
tl[i].Timestamp.Format(constants.TIME_FORMAT),
|
||||||
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
|
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,
|
false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
} // ELSE LOAD CONTACT
|
} // ELSE LOAD CONTACT
|
||||||
|
@ -251,7 +249,7 @@ func (this *GrandCentralDispatcher) loadMessagesPaneHelper(handle string) {
|
||||||
false,
|
false,
|
||||||
messages[i].Error,
|
messages[i].Error,
|
||||||
)
|
)
|
||||||
for _,id := range the.AcknowledgementIDs[messages[i].Handle] {
|
for _, id := range the.AcknowledgementIDs[messages[i].Handle] {
|
||||||
if id.ID == messages[i].MessageID && id.Ack && !id.Error {
|
if id.ID == messages[i].MessageID && id.Ack && !id.Error {
|
||||||
this.Acknowledged(id.ID)
|
this.Acknowledged(id.ID)
|
||||||
}
|
}
|
||||||
|
@ -273,7 +271,7 @@ func (this *GrandCentralDispatcher) saveSettings(zoom, locale string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetAttribute, map[event.Field]string{
|
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetAttribute, map[event.Field]string{
|
||||||
event.Key: "settings.zoom",
|
event.Key: "settings.zoom",
|
||||||
event.Data: zoom,
|
event.Data: zoom,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
@ -306,8 +304,8 @@ func (this *GrandCentralDispatcher) savePeerSettings(onion, nick string) {
|
||||||
contact.SetAttribute("nick", nick)
|
contact.SetAttribute("nick", nick)
|
||||||
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetPeerAttribute, map[event.Field]string{
|
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetPeerAttribute, map[event.Field]string{
|
||||||
event.RemotePeer: onion,
|
event.RemotePeer: onion,
|
||||||
event.Key: "nick",
|
event.Key: "nick",
|
||||||
event.Data: nick,
|
event.Data: nick,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
this.UIState.contacts[onion].DisplayName = nick
|
this.UIState.contacts[onion].DisplayName = nick
|
||||||
|
@ -350,8 +348,8 @@ func (this *GrandCentralDispatcher) saveGroupSettings(groupID, nick string) {
|
||||||
group.SetAttribute("nick", nick)
|
group.SetAttribute("nick", nick)
|
||||||
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetGroupAttribute, map[event.Field]string{
|
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetGroupAttribute, map[event.Field]string{
|
||||||
event.GroupID: groupID,
|
event.GroupID: groupID,
|
||||||
event.Key: "nick",
|
event.Key: "nick",
|
||||||
event.Data: nick,
|
event.Data: nick,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
this.UIState.contacts[groupID].DisplayName = nick
|
this.UIState.contacts[groupID].DisplayName = nick
|
||||||
|
@ -423,7 +421,7 @@ func (this *GrandCentralDispatcher) importString(str string) {
|
||||||
|
|
||||||
checkc := the.Peer.GetContact(onion)
|
checkc := the.Peer.GetContact(onion)
|
||||||
if checkc != nil {
|
if checkc != nil {
|
||||||
deleted,_ := checkc.GetAttribute("deleted")
|
deleted, _ := checkc.GetAttribute("deleted")
|
||||||
if deleted != "deleted" {
|
if deleted != "deleted" {
|
||||||
this.InvokePopup("already have this contact")
|
this.InvokePopup("already have this contact")
|
||||||
return //TODO: bring them to the duplicate
|
return //TODO: bring them to the duplicate
|
||||||
|
@ -469,8 +467,8 @@ func (this *GrandCentralDispatcher) createGroup(server, groupName string) {
|
||||||
group.SetAttribute("nick", groupName)
|
group.SetAttribute("nick", groupName)
|
||||||
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetGroupAttribute, map[event.Field]string{
|
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetGroupAttribute, map[event.Field]string{
|
||||||
event.GroupID: groupID,
|
event.GroupID: groupID,
|
||||||
event.Key: "nick",
|
event.Key: "nick",
|
||||||
event.Data: groupName,
|
event.Data: groupName,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
the.Peer.JoinServer(server)
|
the.Peer.JoinServer(server)
|
||||||
|
@ -495,19 +493,18 @@ func (this *GrandCentralDispatcher) leaveGroup(groupID string) {
|
||||||
func (this *GrandCentralDispatcher) acceptGroup(groupID string) {
|
func (this *GrandCentralDispatcher) acceptGroup(groupID string) {
|
||||||
if the.Peer.GetGroup(groupID) != nil {
|
if the.Peer.GetGroup(groupID) != nil {
|
||||||
the.Peer.AcceptInvite(groupID)
|
the.Peer.AcceptInvite(groupID)
|
||||||
the.Peer.JoinServer(the.Peer.GetGroup(groupID).GroupServer)
|
|
||||||
this.UIState.UpdateContact(groupID)
|
this.UIState.UpdateContact(groupID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *GrandCentralDispatcher) setAttribute(onion, key, value string) {
|
func (this *GrandCentralDispatcher) setAttribute(onion, key, value string) {
|
||||||
pp,_ := the.Peer.GetProfile().GetContact(onion)
|
pp, _ := the.Peer.GetProfile().GetContact(onion)
|
||||||
if pp != nil {
|
if pp != nil {
|
||||||
pp.SetAttribute(key, value)
|
pp.SetAttribute(key, value)
|
||||||
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetPeerAttribute, map[event.Field]string{
|
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetPeerAttribute, map[event.Field]string{
|
||||||
event.RemotePeer: onion,
|
event.RemotePeer: onion,
|
||||||
event.Key: key,
|
event.Key: key,
|
||||||
event.Data: value,
|
event.Data: value,
|
||||||
}))
|
}))
|
||||||
this.UIState.UpdateContactAttribute(onion, key, value)
|
this.UIState.UpdateContactAttribute(onion, key, value)
|
||||||
}
|
}
|
||||||
|
@ -517,7 +514,7 @@ func (this *GrandCentralDispatcher) setLocale(locale string) {
|
||||||
this.SetLocale_helper(locale)
|
this.SetLocale_helper(locale)
|
||||||
|
|
||||||
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetAttribute, map[event.Field]string{
|
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetAttribute, map[event.Field]string{
|
||||||
event.Key: "settings.locale",
|
event.Key: "settings.locale",
|
||||||
event.Data: locale,
|
event.Data: locale,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
@ -530,4 +527,4 @@ func (this *GrandCentralDispatcher) SetLocale_helper(locale string) {
|
||||||
this.Translator.Load("translation_"+locale, ":/i18n/", "", "")
|
this.Translator.Load("translation_"+locale, ":/i18n/", "", "")
|
||||||
core.QCoreApplication_InstallTranslator(this.Translator)
|
core.QCoreApplication_InstallTranslator(this.Translator)
|
||||||
this.QMLEngine.Retranslate()
|
this.QMLEngine.Retranslate()
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ func NewUIState(gcd *GrandCentralDispatcher) (uis InterfaceState) {
|
||||||
func (this *InterfaceState) AddContact(c *gobjects.Contact) {
|
func (this *InterfaceState) AddContact(c *gobjects.Contact) {
|
||||||
if len(c.Handle) == 32 { // ADD GROUP
|
if len(c.Handle) == 32 { // ADD GROUP
|
||||||
if _, found := this.contacts[c.Handle]; !found {
|
if _, found := this.contacts[c.Handle]; !found {
|
||||||
this.parentGcd.AddContact(c.Handle, c.DisplayName, c.Image, c.Server, c.Badge, c.Status, c.Trusted)
|
this.parentGcd.AddContact(c.Handle, c.DisplayName, c.Image, c.Server, c.Badge, c.Status, c.Trusted, c.Loading)
|
||||||
this.contacts[c.Handle] = c
|
this.contacts[c.Handle] = c
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -39,7 +39,7 @@ func (this *InterfaceState) AddContact(c *gobjects.Contact) {
|
||||||
|
|
||||||
if _, found := this.contacts[c.Handle]; !found {
|
if _, found := this.contacts[c.Handle]; !found {
|
||||||
this.contacts[c.Handle] = c
|
this.contacts[c.Handle] = c
|
||||||
this.parentGcd.AddContact(c.Handle, c.DisplayName, c.Image, c.Server, c.Badge, c.Status, c.Trusted)
|
this.parentGcd.AddContact(c.Handle, c.DisplayName, c.Image, c.Server, c.Badge, c.Status, c.Trusted, false)
|
||||||
if the.Peer.GetContact(c.Handle) == nil {
|
if the.Peer.GetContact(c.Handle) == nil {
|
||||||
decodedPub, _ := base32.StdEncoding.DecodeString(strings.ToUpper(c.Handle))
|
decodedPub, _ := base32.StdEncoding.DecodeString(strings.ToUpper(c.Handle))
|
||||||
the.Peer.AddContact(c.DisplayName, c.Handle, decodedPub, c.Trusted)
|
the.Peer.AddContact(c.DisplayName, c.Handle, decodedPub, c.Trusted)
|
||||||
|
@ -61,6 +61,7 @@ func (this *InterfaceState) GetContact(handle string) *gobjects.Contact {
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
group.Accepted,
|
group.Accepted,
|
||||||
|
false,
|
||||||
})
|
})
|
||||||
|
|
||||||
go the.Peer.JoinServer(group.GroupServer)
|
go the.Peer.JoinServer(group.GroupServer)
|
||||||
|
@ -70,15 +71,16 @@ func (this *InterfaceState) GetContact(handle string) *gobjects.Contact {
|
||||||
} else {
|
} else {
|
||||||
contact := the.Peer.GetContact(handle)
|
contact := the.Peer.GetContact(handle)
|
||||||
if contact != nil && handle != contact.Onion {
|
if contact != nil && handle != contact.Onion {
|
||||||
this.AddContact(&gobjects.Contact{
|
this.AddContact(&gobjects.Contact{
|
||||||
handle,
|
handle,
|
||||||
handle,
|
handle,
|
||||||
cwutil.RandomProfileImage(handle),
|
cwutil.RandomProfileImage(handle),
|
||||||
"",
|
"",
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
false,
|
false,
|
||||||
})
|
false,
|
||||||
|
})
|
||||||
} else if contact == nil {
|
} else if contact == nil {
|
||||||
//log.Errorf("Attempting to add non existent contact to ui %v", handle)
|
//log.Errorf("Attempting to add non existent contact to ui %v", handle)
|
||||||
}
|
}
|
||||||
|
@ -90,29 +92,29 @@ func (this *InterfaceState) GetContact(handle string) *gobjects.Contact {
|
||||||
|
|
||||||
func (this *InterfaceState) AddSendMessageError(peer string, signature string, err string) {
|
func (this *InterfaceState) AddSendMessageError(peer string, signature string, err string) {
|
||||||
acklist := the.AcknowledgementIDs[peer]
|
acklist := the.AcknowledgementIDs[peer]
|
||||||
for _,ack := range acklist {
|
for _, ack := range acklist {
|
||||||
if ack.ID == signature {
|
if ack.ID == signature {
|
||||||
ack.Error = true
|
ack.Error = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
messages,_ := this.messages.Load(peer)
|
messages, _ := this.messages.Load(peer)
|
||||||
messageList,_ := messages.([]*gobjects.Message)
|
messageList, _ := messages.([]*gobjects.Message)
|
||||||
|
|
||||||
for _,message := range messageList {
|
for _, message := range messageList {
|
||||||
if message.MessageID == signature {
|
if message.MessageID == signature {
|
||||||
message.Error = true
|
message.Error = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Debugf("Received Error Sending Message: %v", err)
|
log.Debugf("Received Error Sending Message: %v", err)
|
||||||
// FIXME: Sometimes, for the first Peer message we send our error beats our message to the UI
|
// FIXME: Sometimes, for the first Peer message we send our error beats our message to the UI
|
||||||
time.Sleep(time.Second*1)
|
time.Sleep(time.Second * 1)
|
||||||
this.parentGcd.GroupSendError(signature, err)
|
this.parentGcd.GroupSendError(signature, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *InterfaceState) AddMessage(m *gobjects.Message) {
|
func (this *InterfaceState) AddMessage(m *gobjects.Message) {
|
||||||
this.GetContact(m.From)
|
this.GetContact(m.From)
|
||||||
|
|
||||||
_,found := this.messages.Load(m.Handle)
|
_, found := this.messages.Load(m.Handle)
|
||||||
if !found {
|
if !found {
|
||||||
this.messages.Store(m.Handle, make([]*gobjects.Message, 0))
|
this.messages.Store(m.Handle, make([]*gobjects.Message, 0))
|
||||||
}
|
}
|
||||||
|
@ -125,7 +127,7 @@ func (this *InterfaceState) AddMessage(m *gobjects.Message) {
|
||||||
if m.Message == "ack" {
|
if m.Message == "ack" {
|
||||||
// If an ack, swallow the message and ack from the list.
|
// If an ack, swallow the message and ack from the list.
|
||||||
acklist := the.AcknowledgementIDs[m.From]
|
acklist := the.AcknowledgementIDs[m.From]
|
||||||
for _,ack := range acklist {
|
for _, ack := range acklist {
|
||||||
if ack.Error == false {
|
if ack.Error == false {
|
||||||
ack.Ack = true
|
ack.Ack = true
|
||||||
this.parentGcd.Acknowledged(ack.ID)
|
this.parentGcd.Acknowledged(ack.ID)
|
||||||
|
@ -133,8 +135,8 @@ func (this *InterfaceState) AddMessage(m *gobjects.Message) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
messages,_ := this.messages.Load(m.Handle)
|
messages, _ := this.messages.Load(m.Handle)
|
||||||
messageList,_ := messages.([]*gobjects.Message)
|
messageList, _ := messages.([]*gobjects.Message)
|
||||||
this.messages.Store(m.Handle, append(messageList, m))
|
this.messages.Store(m.Handle, append(messageList, m))
|
||||||
|
|
||||||
// If we have this group loaded already
|
// If we have this group loaded already
|
||||||
|
@ -157,22 +159,31 @@ func (this *InterfaceState) AddMessage(m *gobjects.Message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *InterfaceState) GetMessages(handle string) []*gobjects.Message {
|
func (this *InterfaceState) GetMessages(handle string) []*gobjects.Message {
|
||||||
_,found := this.messages.Load(handle)
|
_, found := this.messages.Load(handle)
|
||||||
if !found {
|
if !found {
|
||||||
this.messages.Store(handle, make([]*gobjects.Message, 0))
|
this.messages.Store(handle, make([]*gobjects.Message, 0))
|
||||||
}
|
}
|
||||||
messages,found := this.messages.Load(handle)
|
messages, found := this.messages.Load(handle)
|
||||||
messageList,_ := messages.([]*gobjects.Message)
|
messageList, _ := messages.([]*gobjects.Message)
|
||||||
return messageList
|
return messageList
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *InterfaceState) UpdateContact(handle string) {
|
func (this *InterfaceState) UpdateContact(handle string) {
|
||||||
c, found := this.contacts[handle]
|
c, found := this.contacts[handle]
|
||||||
if found {
|
if found {
|
||||||
this.parentGcd.UpdateContact(c.Handle, c.DisplayName, c.Image, c.Server, c.Badge, c.Status, c.Trusted)
|
this.parentGcd.UpdateContact(c.Handle, c.DisplayName, c.Image, c.Server, c.Badge, c.Status, c.Trusted, c.Loading)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *InterfaceState) UpdateContactAttribute(handle, key, value string) {
|
func (this *InterfaceState) UpdateContactAttribute(handle, key, value string) {
|
||||||
this.parentGcd.UpdateContactAttribute(handle, key, value)
|
this.parentGcd.UpdateContactAttribute(handle, key, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *InterfaceState) UpdateServerStatus(server string, loading bool) {
|
||||||
|
for _, contact := range this.contacts {
|
||||||
|
if contact.Server == server {
|
||||||
|
contact.Loading = loading
|
||||||
|
this.UpdateContact(contact.Handle)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
4
main.go
4
main.go
|
@ -167,7 +167,7 @@ func loadNetworkingAndFiles(gcd *gothings.GrandCentralDispatcher) {
|
||||||
|
|
||||||
// these are long-lived pollers/listeners for incoming messages and status changes
|
// these are long-lived pollers/listeners for incoming messages and status changes
|
||||||
loadCwtchData(gcd, the.ACN)
|
loadCwtchData(gcd, the.ACN)
|
||||||
go characters.IncomingListener(gcd.UIState.AddMessage, gcd.UIState.AddSendMessageError)
|
go characters.IncomingListener(gcd.UIState.AddMessage, gcd.UIState.AddSendMessageError, gcd.UIState.UpdateServerStatus)
|
||||||
go characters.TorStatusPoller(gcd.TorStatus, the.ACN)
|
go characters.TorStatusPoller(gcd.TorStatus, the.ACN)
|
||||||
go characters.PresencePoller(gcd.UIState.GetContact, gcd.UIState.AddContact, gcd.UIState.UpdateContact)
|
go characters.PresencePoller(gcd.UIState.GetContact, gcd.UIState.AddContact, gcd.UIState.UpdateContact)
|
||||||
go characters.GroupPoller(gcd.UIState.GetContact, gcd.UIState.UpdateContact)
|
go characters.GroupPoller(gcd.UIState.GetContact, gcd.UIState.UpdateContact)
|
||||||
|
@ -227,6 +227,7 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher, acn connectivity.ACN) {
|
||||||
DisplayName: displayName,
|
DisplayName: displayName,
|
||||||
Image: cwutil.RandomProfileImage(contacts[i]),
|
Image: cwutil.RandomProfileImage(contacts[i]),
|
||||||
Trusted: contact.Trusted,
|
Trusted: contact.Trusted,
|
||||||
|
Loading: false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,6 +249,7 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher, acn connectivity.ACN) {
|
||||||
Image: cwutil.RandomGroupImage(group.GroupID),
|
Image: cwutil.RandomGroupImage(group.GroupID),
|
||||||
Server: group.GroupServer,
|
Server: group.GroupServer,
|
||||||
Trusted: group.Accepted,
|
Trusted: group.Accepted,
|
||||||
|
Loading: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
// Only send a join server packet if we haven't joined this server yet...
|
// Only send a join server packet if we haven't joined this server yet...
|
||||||
|
|
|
@ -125,7 +125,9 @@ ApplicationWindow {
|
||||||
visible: true
|
visible: true
|
||||||
|
|
||||||
SplashPane {
|
SplashPane {
|
||||||
|
id: splashPane
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
running: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,21 @@ ColumnLayout {
|
||||||
sv.contentY = sv.contentHeight - sv.height
|
sv.contentY = sv.contentHeight - sv.height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _loading) {
|
||||||
|
if (gcd.currentOpenConversation == _handle) {
|
||||||
|
if (_loading == true) {
|
||||||
|
newposttitle.enabled = false
|
||||||
|
newpostbody.enabled = false
|
||||||
|
btnSend.enabled = false
|
||||||
|
} else {
|
||||||
|
newposttitle.enabled = true
|
||||||
|
newpostbody.enabled = true
|
||||||
|
btnSend.enabled = true
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollBar.vertical: ScrollBar{
|
ScrollBar.vertical: ScrollBar{
|
||||||
|
|
|
@ -11,7 +11,7 @@ import "../utils.js" as Utils
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
property bool loading
|
||||||
|
|
||||||
ListModel { // MESSAGE OBJECTS ARE STORED HERE ...
|
ListModel { // MESSAGE OBJECTS ARE STORED HERE ...
|
||||||
id: messagesModel
|
id: messagesModel
|
||||||
|
@ -109,6 +109,19 @@ ColumnLayout {
|
||||||
|
|
||||||
messagesListView.positionViewAtEnd()
|
messagesListView.positionViewAtEnd()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _loading) {
|
||||||
|
if (gcd.currentOpenConversation == _handle) {
|
||||||
|
if (_loading == true) {
|
||||||
|
txtMessage.enabled = false
|
||||||
|
btnSend.enabled = false
|
||||||
|
} else {
|
||||||
|
txtMessage.enabled = true
|
||||||
|
btnSend.enabled = true
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,19 @@ ColumnLayout {
|
||||||
sv.contentY = sv.contentHeight - sv.height
|
sv.contentY = sv.contentHeight - sv.height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _loading) {
|
||||||
|
if (gcd.currentOpenConversation == _handle) {
|
||||||
|
if (_loading == true) {
|
||||||
|
newposttitle.enabled = false
|
||||||
|
btnSend.enabled = false
|
||||||
|
} else {
|
||||||
|
newposttitle.enabled = true
|
||||||
|
btnSend.enabled = true
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollBar.vertical: ScrollBar{
|
ScrollBar.vertical: ScrollBar{
|
||||||
|
|
|
@ -8,6 +8,9 @@ import QtQuick.Controls.Styles 1.4
|
||||||
import "../styles"
|
import "../styles"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
id: sp
|
||||||
|
property bool running
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: splashImage
|
id: splashImage
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
@ -17,14 +20,17 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
ProgressBar {
|
ProgressBar {
|
||||||
|
id: progressBar
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.top: splashImage.bottom
|
anchors.top: splashImage.bottom
|
||||||
anchors.topMargin: 10
|
anchors.topMargin: 10
|
||||||
|
width: splashImage.width
|
||||||
|
|
||||||
indeterminate: true
|
indeterminate: true
|
||||||
|
|
||||||
style: ProgressBarStyle {
|
style: ProgressBarStyle {
|
||||||
progress: CwtchProgress {}
|
progress: CwtchProgress { running: sp.running }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,12 @@ import QtQuick.Controls.Styles 1.4
|
||||||
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
border.color: "#D2C0DD"
|
id: pb
|
||||||
color: "red"
|
border.color: "#FFFFFF"
|
||||||
|
border.width: 1
|
||||||
|
|
||||||
|
color: "#D2C0DD"
|
||||||
|
property bool running
|
||||||
|
|
||||||
// Indeterminate animation by animating alternating stripes:
|
// Indeterminate animation by animating alternating stripes:
|
||||||
Item {
|
Item {
|
||||||
|
@ -28,7 +32,7 @@ Rectangle {
|
||||||
XAnimator on x {
|
XAnimator on x {
|
||||||
from: 0 ; to: -40
|
from: 0 ; to: -40
|
||||||
loops: Animation.Infinite
|
loops: Animation.Infinite
|
||||||
running: parentStack.currentIndex == 0
|
running: pb.running
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ ColumnLayout {
|
||||||
Connections { // ADD/REMOVE CONTACT ENTRIES
|
Connections { // ADD/REMOVE CONTACT ENTRIES
|
||||||
target: gcd
|
target: gcd
|
||||||
|
|
||||||
onAddContact: function(handle, displayName, image, server, badge, status, trusted) {
|
onAddContact: function(handle, displayName, image, server, badge, status, trusted, loading) {
|
||||||
contactsModel.append({
|
contactsModel.append({
|
||||||
"_handle": handle,
|
"_handle": handle,
|
||||||
"_displayName": displayName,
|
"_displayName": displayName,
|
||||||
|
@ -56,7 +56,8 @@ ColumnLayout {
|
||||||
"_badge": badge,
|
"_badge": badge,
|
||||||
"_status": status,
|
"_status": status,
|
||||||
"_trusted": trusted,
|
"_trusted": trusted,
|
||||||
"_deleted": false
|
"_deleted": false,
|
||||||
|
"_loading": loading
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,8 +89,9 @@ ColumnLayout {
|
||||||
status: _status
|
status: _status
|
||||||
trusted: _trusted
|
trusted: _trusted
|
||||||
deleted: _deleted
|
deleted: _deleted
|
||||||
|
loading: _loading
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,10 @@ import QtQuick.Controls 2.4
|
||||||
import QtQuick.Controls.Material 2.0
|
import QtQuick.Controls.Material 2.0
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import CustomQmlTypes 1.0
|
import CustomQmlTypes 1.0
|
||||||
|
import "../styles"
|
||||||
|
import QtQuick.Controls 1.4
|
||||||
|
import QtQuick.Controls.Styles 1.4
|
||||||
|
|
||||||
|
|
||||||
Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
|
Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
@ -21,6 +25,7 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
|
||||||
property bool isHover
|
property bool isHover
|
||||||
property bool trusted
|
property bool trusted
|
||||||
property bool deleted
|
property bool deleted
|
||||||
|
property bool loading
|
||||||
property alias status: imgProfile.status
|
property alias status: imgProfile.status
|
||||||
property string server
|
property string server
|
||||||
property bool background: true
|
property bool background: true
|
||||||
|
@ -45,7 +50,7 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
|
||||||
rightPadding: 10
|
rightPadding: 10
|
||||||
//wrapMode: Text.WordWrap
|
//wrapMode: Text.WordWrap
|
||||||
anchors.left: imgProfile.right
|
anchors.left: imgProfile.right
|
||||||
anchors.right: rectUnread.left
|
anchors.right: loadingProgress.left
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
font.pixelSize: 16 * gcd.themeScale
|
font.pixelSize: 16 * gcd.themeScale
|
||||||
font.italic: !trusted
|
font.italic: !trusted
|
||||||
|
@ -81,6 +86,31 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
|
||||||
font: lblUnread.font
|
font: lblUnread.font
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProgressBar { // LOADING ?
|
||||||
|
id: loadingProgress
|
||||||
|
property bool running
|
||||||
|
running: loading
|
||||||
|
|
||||||
|
anchors.right: rectUnread.left
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.leftMargin: 1 * gcd.themeScale
|
||||||
|
anchors.rightMargin: 1 * gcd.themeScale
|
||||||
|
|
||||||
|
|
||||||
|
height: cn.height/2
|
||||||
|
width: 100 * gcd.themeScale
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
indeterminate: true
|
||||||
|
visible: loading
|
||||||
|
|
||||||
|
style: ProgressBarStyle {
|
||||||
|
progress: CwtchProgress { running: loadingProgress.running}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea { // ONCLICK: LOAD CONVERSATION WITH THIS CONTACT
|
MouseArea { // ONCLICK: LOAD CONVERSATION WITH THIS CONTACT
|
||||||
|
@ -113,7 +143,7 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
|
||||||
isActive = false
|
isActive = false
|
||||||
}
|
}
|
||||||
|
|
||||||
onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted) {
|
onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _loading) {
|
||||||
if (handle == _handle) {
|
if (handle == _handle) {
|
||||||
displayName = _displayName
|
displayName = _displayName
|
||||||
image = _image
|
image = _image
|
||||||
|
@ -121,7 +151,17 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
|
||||||
badge = _badge
|
badge = _badge
|
||||||
status = _status
|
status = _status
|
||||||
trusted = _trusted
|
trusted = _trusted
|
||||||
|
loading = _loading
|
||||||
|
|
||||||
|
if (loading == true) {
|
||||||
|
loadingProgress.visible = true
|
||||||
|
loadingProgress.running = true
|
||||||
|
} else {
|
||||||
|
loadingProgress.visible = false
|
||||||
|
loadingProgress.running = false
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,6 +230,7 @@ ColumnLayout {
|
||||||
onion = _onion
|
onion = _onion
|
||||||
image = _image
|
image = _image
|
||||||
parentStack.currentIndex = 1
|
parentStack.currentIndex = 1
|
||||||
|
splashPane.running = false
|
||||||
}
|
}
|
||||||
|
|
||||||
onTorStatus: function(code, str) {
|
onTorStatus: function(code, str) {
|
||||||
|
|
Reference in New Issue