High cpu usage fix
This commit is contained in:
parent
97f0a0435d
commit
c1b47f1c9c
|
@ -80,6 +80,7 @@ QtObject:
|
|||
proc setNewProfile*(self: ProfileView, profile: Profile) =
|
||||
self.profile.setProfile(profile)
|
||||
self.profileSettings.removeUnknownAccountSettings()
|
||||
self.profileChanged()
|
||||
|
||||
QtProperty[QVariant] profile:
|
||||
read = getProfile
|
||||
|
|
|
@ -35,9 +35,10 @@ QtObject:
|
|||
result.sendUserStatus = false
|
||||
result.setup
|
||||
|
||||
proc profileChanged*(self: ProfileInfoView) {.signal.}
|
||||
|
||||
proc identityImageChanged*(self: ProfileInfoView) {.signal.}
|
||||
proc sendUserStatusChanged*(self: ProfileInfoView) {.signal.}
|
||||
proc appearanceChanged*(self: ProfileInfoView) {.signal.}
|
||||
proc messagesFromContactsOnlyChanged*(self: ProfileInfoView) {.signal.}
|
||||
|
||||
proc setProfile*(self: ProfileInfoView, profile: Profile) =
|
||||
self.username = profile.username
|
||||
|
@ -49,7 +50,55 @@ QtObject:
|
|||
self.identityImage = profile.identityImage
|
||||
self.messagesFromContactsOnly = profile.messagesFromContactsOnly
|
||||
self.sendUserStatus = profile.sendUserStatus
|
||||
self.profileChanged()
|
||||
|
||||
proc username*(self: ProfileInfoView): string {.slot.} = result = self.username
|
||||
|
||||
QtProperty[string] username:
|
||||
read = username
|
||||
|
||||
proc identicon*(self: ProfileInfoView): string {.slot.} = result = self.identicon
|
||||
|
||||
QtProperty[string] identicon:
|
||||
read = identicon
|
||||
|
||||
proc pubKey*(self: ProfileInfoView): string {.slot.} = self.pubKey
|
||||
|
||||
QtProperty[string] pubKey:
|
||||
read = pubKey
|
||||
|
||||
proc address*(self: ProfileInfoView): string {.slot.} = self.address
|
||||
|
||||
QtProperty[string] address:
|
||||
read = address
|
||||
|
||||
proc ensVerified*(self: ProfileInfoView): bool {.slot.} = self.ensVerified
|
||||
|
||||
QtProperty[bool] ensVerified:
|
||||
read = ensVerified
|
||||
|
||||
proc appearance*(self: ProfileInfoView): int {.slot.} = result = self.appearance
|
||||
proc setAppearance*(self: ProfileInfoView, appearance: int) {.slot.} =
|
||||
if self.appearance == appearance:
|
||||
return
|
||||
self.appearance = appearance
|
||||
self.appearanceChanged()
|
||||
|
||||
QtProperty[int] appearance:
|
||||
read = appearance
|
||||
write = setAppearance
|
||||
notify = appearanceChanged
|
||||
|
||||
proc messagesFromContactsOnly*(self: ProfileInfoView): bool {.slot.} = result = self.messagesFromContactsOnly
|
||||
proc setMessagesFromContactsOnly*(self: ProfileInfoView, messagesFromContactsOnly: bool) {.slot.} =
|
||||
if self.messagesFromContactsOnly == messagesFromContactsOnly:
|
||||
return
|
||||
self.messagesFromContactsOnly = messagesFromContactsOnly
|
||||
self.messagesFromContactsOnlyChanged()
|
||||
|
||||
QtProperty[bool] messagesFromContactsOnly:
|
||||
read = messagesFromContactsOnly
|
||||
write = setMessagesFromContactsOnly
|
||||
notify = messagesFromContactsOnlyChanged
|
||||
|
||||
proc setIdentityImage*(self: ProfileInfoView, identityImage: IdentityImage) =
|
||||
self.identityImage = identityImage
|
||||
|
@ -59,44 +108,12 @@ QtObject:
|
|||
self.identityImage = IdentityImage()
|
||||
self.identityImageChanged()
|
||||
|
||||
proc username*(self: ProfileInfoView): string {.slot.} = result = self.username
|
||||
QtProperty[string] username:
|
||||
read = username
|
||||
notify = profileChanged
|
||||
|
||||
proc appearance*(self: ProfileInfoView): int {.slot.} = result = self.appearance
|
||||
proc setAppearance*(self: ProfileInfoView, appearance: int) {.slot.} =
|
||||
if self.appearance == appearance:
|
||||
return
|
||||
self.appearance = appearance
|
||||
self.profileChanged()
|
||||
QtProperty[int] appearance:
|
||||
read = appearance
|
||||
write = setAppearance
|
||||
notify = profileChanged
|
||||
|
||||
proc messagesFromContactsOnly*(self: ProfileInfoView): bool {.slot.} = result = self.messagesFromContactsOnly
|
||||
proc setMessagesFromContactsOnly*(self: ProfileInfoView, messagesFromContactsOnly: bool) {.slot.} =
|
||||
if self.messagesFromContactsOnly == messagesFromContactsOnly:
|
||||
return
|
||||
self.messagesFromContactsOnly = messagesFromContactsOnly
|
||||
self.profileChanged()
|
||||
QtProperty[bool] messagesFromContactsOnly:
|
||||
read = messagesFromContactsOnly
|
||||
write = setMessagesFromContactsOnly
|
||||
notify = profileChanged
|
||||
|
||||
|
||||
proc identicon*(self: ProfileInfoView): string {.slot.} = result = self.identicon
|
||||
QtProperty[string] identicon:
|
||||
read = identicon
|
||||
notify = profileChanged
|
||||
|
||||
proc thumbnailImage*(self: ProfileInfoView): string {.slot.} =
|
||||
if (?.self.identityImage.thumbnail != ""):
|
||||
result = self.identityImage.thumbnail
|
||||
else:
|
||||
result = self.identicon
|
||||
|
||||
QtProperty[string] thumbnailImage:
|
||||
read = thumbnailImage
|
||||
notify = identityImageChanged
|
||||
|
@ -106,41 +123,26 @@ QtObject:
|
|||
result = self.identityImage.large
|
||||
else:
|
||||
result = self.identicon
|
||||
|
||||
QtProperty[string] largeImage:
|
||||
read = largeImage
|
||||
notify = identityImageChanged
|
||||
|
||||
proc hasIdentityImage*(self: ProfileInfoView): bool {.slot.} =
|
||||
result = (?.self.identityImage.thumbnail != "")
|
||||
|
||||
QtProperty[bool] hasIdentityImage:
|
||||
read = hasIdentityImage
|
||||
notify = identityImageChanged
|
||||
|
||||
proc pubKey*(self: ProfileInfoView): string {.slot.} = self.pubKey
|
||||
|
||||
QtProperty[string] pubKey:
|
||||
read = pubKey
|
||||
notify = profileChanged
|
||||
|
||||
proc address*(self: ProfileInfoView): string {.slot.} = self.address
|
||||
|
||||
QtProperty[string] address:
|
||||
read = address
|
||||
notify = profileChanged
|
||||
|
||||
proc ensVerified*(self: ProfileInfoView): bool {.slot.} = self.ensVerified
|
||||
|
||||
QtProperty[bool] ensVerified:
|
||||
read = ensVerified
|
||||
notify = profileChanged
|
||||
|
||||
proc sendUserStatus*(self: ProfileInfoView): bool {.slot.} = result = self.sendUserStatus
|
||||
proc setSendUserStatus*(self: ProfileInfoView, sendUserStatus: bool) {.slot.} =
|
||||
if self.sendUserStatus == sendUserStatus:
|
||||
return
|
||||
self.sendUserStatus = sendUserStatus
|
||||
self.profileChanged()
|
||||
self.sendUserStatusChanged()
|
||||
|
||||
QtProperty[bool] sendUserStatus:
|
||||
read = sendUserStatus
|
||||
write = setSendUserStatus
|
||||
notify = profileChanged
|
||||
notify = sendUserStatusChanged
|
Loading…
Reference in New Issue