Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jami-client-macos
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
savoirfairelinux
jami-client-macos
Commits
14b8aa77
Commit
14b8aa77
authored
4 years ago
by
Kateryna Kostiuk
Browse files
Options
Downloads
Patches
Plain Diff
profile: save account avatar in PNG
Change-Id: I4b83d669e337af60052040cf9f275c8fbf2e35f6
parent
9e8565b9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/AccRingGeneralVC.mm
+7
-3
7 additions, 3 deletions
src/AccRingGeneralVC.mm
src/AccSipGeneralVC.mm
+6
-2
6 additions, 2 deletions
src/AccSipGeneralVC.mm
src/AddSIPAccountVC.mm
+6
-2
6 additions, 2 deletions
src/AddSIPAccountVC.mm
src/RingWizardNewAccountVC.mm
+6
-2
6 additions, 2 deletions
src/RingWizardNewAccountVC.mm
with
25 additions
and
9 deletions
src/AccRingGeneralVC.mm
+
7
−
3
View file @
14b8aa77
...
...
@@ -253,7 +253,7 @@ typedef NS_ENUM(NSInteger, TagViews) {
returnCode
:
(
NSInteger
)
code
contextInfo
:
(
void
*
)
contextInfo
{
//do nothing when editing canceled
//do nothing when editing canceled
if
(
code
==
0
)
{
return
;
}
...
...
@@ -264,8 +264,12 @@ typedef NS_ENUM(NSInteger, TagViews) {
[
photoView
setImage
:
[
outputImage
roundCorners
:
outputImage
.
size
.
height
*
0.5
]];
[
photoView
setBordered
:
NO
];
[
addProfilePhotoImage
setHidden
:
YES
];
auto
imageToBytes
=
QByteArray
::
fromNSData
([
outputImage
TIFFRepresentation
]).
toBase64
();
self
.
accountModel
->
setAvatar
(
self
.
selectedAccountID
,
QString
(
imageToBytes
));
NSData
*
imageData
=
[
outputImage
TIFFRepresentation
];
NSBitmapImageRep
*
imageRep
=
[
NSBitmapImageRep
imageRepWithData
:
imageData
];
NSDictionary
*
properties
=
[[
NSDictionary
alloc
]
init
];
imageData
=
[
imageRep
representationUsingType
:
NSPNGFileType
properties
:
properties
];
NSString
*
dataString
=
[
imageData
base64EncodedStringWithOptions
:
0
];
self
.
accountModel
->
setAvatar
(
self
.
selectedAccountID
,
QString
::
fromNSString
(
dataString
));
}
else
if
(
!
photoView
.
image
)
{
[
photoView
setBordered
:
YES
];
[
addProfilePhotoImage
setHidden
:
NO
];
...
...
This diff is collapsed.
Click to expand it.
src/AccSipGeneralVC.mm
+
6
−
2
View file @
14b8aa77
...
...
@@ -98,8 +98,12 @@ typedef NS_ENUM(NSInteger, TagViews) {
outputImage
=
[
outputImage
imageResizeInsideMax
:
newSize
];
[
photoView
setImage
:
[
outputImage
roundCorners
:
outputImage
.
size
.
height
*
0.5
]];
[
addProfilePhotoImage
setHidden
:
YES
];
auto
imageToBytes
=
QByteArray
::
fromNSData
([
outputImage
TIFFRepresentation
]).
toBase64
();
self
.
accountModel
->
setAvatar
(
self
.
selectedAccountID
,
QString
(
imageToBytes
));
NSData
*
imageData
=
[
outputImage
TIFFRepresentation
];
NSBitmapImageRep
*
imageRep
=
[
NSBitmapImageRep
imageRepWithData
:
imageData
];
NSDictionary
*
properties
=
[[
NSDictionary
alloc
]
init
];
imageData
=
[
imageRep
representationUsingType
:
NSPNGFileType
properties
:
properties
];
NSString
*
dataString
=
[
imageData
base64EncodedStringWithOptions
:
0
];
self
.
accountModel
->
setAvatar
(
self
.
selectedAccountID
,
QString
::
fromNSString
(
dataString
));
}
else
if
(
!
photoView
.
image
)
{
[
photoView
setBordered
:
YES
];
[
addProfilePhotoImage
setHidden
:
NO
];
...
...
This diff is collapsed.
Click to expand it.
src/AddSIPAccountVC.mm
+
6
−
2
View file @
14b8aa77
...
...
@@ -85,8 +85,12 @@ NSTimer* timeoutTimer;
[
self
]
(
const
QString
&
accountID
)
{
if
([
photoView
image
])
{
NSImage
*
avatarImage
=
[
photoView
image
];
auto
imageToBytes
=
QByteArray
::
fromNSData
([
avatarImage
TIFFRepresentation
]).
toBase64
();
self
.
accountModel
->
setAvatar
(
accountID
,
QString
(
imageToBytes
));
NSData
*
imageData
=
[
avatarImage
TIFFRepresentation
];
NSBitmapImageRep
*
imageRep
=
[
NSBitmapImageRep
imageRepWithData
:
imageData
];
NSDictionary
*
properties
=
[[
NSDictionary
alloc
]
init
];
imageData
=
[
imageRep
representationUsingType
:
NSPNGFileType
properties
:
properties
];
NSString
*
dataString
=
[
imageData
base64EncodedStringWithOptions
:
0
];
self
.
accountModel
->
setAvatar
(
accountID
,
QString
::
fromNSString
(
dataString
));
}
lrc
::
api
::
account
::
ConfProperties_t
accountProperties
=
self
.
accountModel
->
getAccountConfig
(
accountID
);
if
(
!
[
serverField
.
stringValue
isEqualToString
:
@""
])
{
...
...
This diff is collapsed.
Click to expand it.
src/RingWizardNewAccountVC.mm
+
6
−
2
View file @
14b8aa77
...
...
@@ -269,8 +269,12 @@ BOOL isRendevous = false;
//set account avatar
if
([
photoView
image
])
{
NSImage
*
avatarImage
=
[
photoView
image
];
auto
imageToBytes
=
QByteArray
::
fromNSData
([
avatarImage
TIFFRepresentation
]).
toBase64
();
self
.
accountModel
->
setAvatar
(
accountID
,
QString
(
imageToBytes
));
NSData
*
imageData
=
[
avatarImage
TIFFRepresentation
];
NSBitmapImageRep
*
imageRep
=
[
NSBitmapImageRep
imageRepWithData
:
imageData
];
NSDictionary
*
properties
=
[[
NSDictionary
alloc
]
init
];
imageData
=
[
imageRep
representationUsingType
:
NSPNGFileType
properties
:
properties
];
NSString
*
dataString
=
[
imageData
base64EncodedStringWithOptions
:
0
];
self
.
accountModel
->
setAvatar
(
accountID
,
QString
::
fromNSString
(
dataString
));
}
//register username
if
(
self
.
registeredName
&&
!
[
self
.
registeredName
isEqualToString
:
@""
])
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment