Merge branch 'profileImageAssets' of dan/ui into master
the build was successful
Details
the build was successful
Details
This commit is contained in:
commit
ccf6df326e
1
go.sum
1
go.sum
|
@ -79,6 +79,7 @@ golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ=
|
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ=
|
||||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/tools v0.0.0-20190420181800-aa740d480789 h1:FF0rjo15h51+N6642mf5S3QuplmKo2aCrJUYkHTx85s=
|
||||||
golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||||
|
|
|
@ -602,7 +602,7 @@ func (this *GrandCentralDispatcher) loadProfile(onion string) {
|
||||||
pic = RandomProfileImage(the.Peer.GetProfile().Onion)
|
pic = RandomProfileImage(the.Peer.GetProfile().Onion)
|
||||||
the.Peer.SetAttribute(constants.Picture, pic)
|
the.Peer.SetAttribute(constants.Picture, pic)
|
||||||
}
|
}
|
||||||
this.UpdateMyProfile(the.Peer.GetProfile().Name, the.Peer.GetProfile().Onion, pic)
|
this.UpdateMyProfile(the.Peer.GetProfile().Name, the.Peer.GetProfile().Onion, profilePicRelativize(pic))
|
||||||
|
|
||||||
contacts := the.Peer.GetContacts()
|
contacts := the.Peer.GetContacts()
|
||||||
for i := range contacts {
|
for i := range contacts {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"cwtch.im/ui/go/the"
|
"cwtch.im/ui/go/the"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -62,11 +63,18 @@ func initLastReadTime(id string) time.Time {
|
||||||
return lastRead
|
return lastRead
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// a lot of pics were stored full path + uri. remove all this to the relative path in images/
|
||||||
|
// fix for storing full paths introduced 2019.12
|
||||||
|
func profilePicRelativize(filename string) string {
|
||||||
|
parts := strings.Split(filename, "qml/images")
|
||||||
|
return parts[len(parts)-1]
|
||||||
|
}
|
||||||
|
|
||||||
func initProfilePicture(id string) string {
|
func initProfilePicture(id string) string {
|
||||||
if isGroup(id) {
|
if isGroup(id) {
|
||||||
return getWithSetDefault(id, constants.Picture, RandomGroupImage(id))
|
return profilePicRelativize(getWithSetDefault(id, constants.Picture, RandomGroupImage(id)))
|
||||||
} else {
|
} else {
|
||||||
return getWithSetDefault(id, constants.Picture, RandomProfileImage(id))
|
return profilePicRelativize(getWithSetDefault(id, constants.Picture, RandomProfileImage(id)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,11 +84,11 @@ func getProfilePic(id string) string {
|
||||||
if pic, exists := the.Peer.GetGroupAttribute(id, constants.Picture); !exists {
|
if pic, exists := the.Peer.GetGroupAttribute(id, constants.Picture); !exists {
|
||||||
return RandomGroupImage(id)
|
return RandomGroupImage(id)
|
||||||
} else {
|
} else {
|
||||||
return pic
|
return profilePicRelativize(pic)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if pic, exists := the.Peer.GetContactAttribute(id, constants.Picture); !exists {
|
if pic, exists := the.Peer.GetContactAttribute(id, constants.Picture); !exists {
|
||||||
return RandomProfileImage(id)
|
return profilePicRelativize(RandomProfileImage(id))
|
||||||
} else {
|
} else {
|
||||||
return pic
|
return pic
|
||||||
}
|
}
|
||||||
|
@ -125,8 +133,8 @@ func AddProfile(gcd *GrandCentralDispatcher, handle string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
tag, _ := peer.GetAttribute(app.AttributeTag)
|
tag, _ := peer.GetAttribute(app.AttributeTag)
|
||||||
log.Infof("AddProfile %v %v %v %v\n", handle, nick, pic, tag)
|
log.Infof("AddProfile %v %v %v %v\n", handle, nick, profilePicRelativize(pic), tag)
|
||||||
gcd.AddProfile(handle, nick, pic, tag)
|
gcd.AddProfile(handle, nick, profilePicRelativize(pic), tag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ func RandomProfileImage(onion string) string {
|
||||||
barr, err := base32.StdEncoding.DecodeString(strings.ToUpper(onion))
|
barr, err := base32.StdEncoding.DecodeString(strings.ToUpper(onion))
|
||||||
if err != nil || len(barr) != 35 {
|
if err != nil || len(barr) != 35 {
|
||||||
log.Errorf("error: %v %v %v\n", onion, err, barr)
|
log.Errorf("error: %v %v %v\n", onion, err, barr)
|
||||||
return "qrc:/qml/images/extra/openprivacy.png"
|
return "extra/openprivacy.png"
|
||||||
}
|
}
|
||||||
return "profiles/" + choices[int(barr[33])%len(choices)] + ".png"
|
return "profiles/" + choices[int(barr[33])%len(choices)] + ".png"
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ func RandomGroupImage(handle string) string {
|
||||||
barr, err := hex.DecodeString(handle)
|
barr, err := hex.DecodeString(handle)
|
||||||
if err != nil || len(barr) == 0 {
|
if err != nil || len(barr) == 0 {
|
||||||
log.Errorf("error: %v %v %v\n", handle, err, barr)
|
log.Errorf("error: %v %v %v\n", handle, err, barr)
|
||||||
return "qrc:/qml/images/extra/openprivacy.png"
|
return "extra/openprivacy.png"
|
||||||
}
|
}
|
||||||
return "servers/" + choices[int(barr[0])%len(choices)] + ".png"
|
return "servers/" + choices[int(barr[0])%len(choices)] + ".png"
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
|
||||||
Image {// Profle Type
|
Image {// Profle Type
|
||||||
id: profiletype
|
id: profiletype
|
||||||
|
|
||||||
source: tag == "v1-userPassword" ? "qrc:/qml/images/fontawesome/solid/lock.svg" : "qrc:/qml/images/fontawesome/solid/lock-open.svg"
|
source: tag == "v1-userPassword" ? gcd.assetPath + "/fontawesome/solid/lock.svg" : gcd.assetPath + "/fontawesome/solid/lock-open.svg"
|
||||||
|
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ ColumnLayout {
|
||||||
profilesModel.append({
|
profilesModel.append({
|
||||||
_handle: "",
|
_handle: "",
|
||||||
_displayName: qsTr("add-new-profile-btn"),
|
_displayName: qsTr("add-new-profile-btn"),
|
||||||
_image: "qrc:/qml/images/fontawesome/solid/user-plus.svg",
|
_image: "/fontawesome/solid/user-plus.svg",
|
||||||
_type: "button",
|
_type: "button",
|
||||||
_tag: ","
|
_tag: ","
|
||||||
})
|
})
|
||||||
|
@ -99,7 +99,7 @@ ColumnLayout {
|
||||||
ListElement {
|
ListElement {
|
||||||
_handle: ""
|
_handle: ""
|
||||||
_displayName: qsTr("add-new-profile-btn")
|
_displayName: qsTr("add-new-profile-btn")
|
||||||
_image: "qrc:/qml/images/fontawesome/solid/user-plus.svg"
|
_image: "/fontawesome/solid/user-plus.svg"
|
||||||
_type: "button"
|
_type: "button"
|
||||||
_tag: ""
|
_tag: ""
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue