Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-client-uwp
Commits
f3ad2c07
Commit
f3ad2c07
authored
Oct 26, 2016
by
Nicolas Jager
Browse files
profil : allows to take a picture by clicking on the avatar
Change-Id: I8da2ece803a90981a1ccea352df9f6f2ed084535 Tuleap: #1250
parent
0a7b77df
Changes
4
Hide whitespace changes
Inline
Side-by-side
SmartPanel.xaml
View file @
f3ad2c07
...
...
@@ -379,6 +379,11 @@
Height="80"
Width="80"
Grid.Column="0"
Stroke="White"
StrokeThickness="3"
PointerEntered="_selectedAccountAvatarContainer__PointerEntered"
PointerExited="_selectedAccountAvatarContainer__PointerExited"
PointerReleased="_selectedAccountAvatarContainer__PointerReleased"
Margin="5">
<Ellipse.Fill>
<ImageBrush
...
...
@@ -386,6 +391,24 @@
ImageSource="Assets\TESTS\contactAvatar.png"/>
</Ellipse.Fill>
</Ellipse>
<Ellipse
x:Name="_shaderPhotoboothIcon_"
Visibility="Collapsed"
Height="80"
Width="80"
Grid.Column="0"
IsHitTestVisible="False"
Fill="Black"
Opacity="0.3"
Margin="5">
</Ellipse>
<TextBlock x:Name="_photoboothIcon_"
Grid.Column="0"
Visibility="Collapsed"
IsHitTestVisible="False"
Style="{StaticResource TextSegoeStyle-Centered-40pt-white}"
Text="">
</TextBlock>
<StackPanel Grid.Column="1"
VerticalAlignment="Bottom">
<TextBlock x:Name="_selectedAccountName_"
...
...
SmartPanel.xaml.cpp
View file @
f3ad2c07
...
...
@@ -206,17 +206,20 @@ void RingClientUWP::Views::SmartPanel::setMode(RingClientUWP::Views::SmartPanel:
if
(
mode
==
RingClientUWP
::
Views
::
SmartPanel
::
Mode
::
Normal
)
{
_rowRingTxtBx_
->
Height
=
40
;
_selectedAccountAvatarContainer_
->
Height
=
80
;
_shaderPhotoboothIcon_
->
Height
=
80
;
_selectedAccountAvatarColumn_
->
Width
=
90
;
_selectedAccountRow_
->
Height
=
90
;
}
else
{
_rowRingTxtBx_
->
Height
=
0
;
_selectedAccountAvatarContainer_
->
Height
=
50
;
_shaderPhotoboothIcon_
->
Height
=
50
;
_selectedAccountAvatarColumn_
->
Width
=
60
;
_selectedAccountRow_
->
Height
=
60
;
}
_selectedAccountAvatarContainer_
->
Width
=
_selectedAccountAvatarContainer_
->
Height
;
_shaderPhotoboothIcon_
->
Width
=
_shaderPhotoboothIcon_
->
Height
;
_settingsTBtn_
->
IsChecked
=
false
;
_accountsMenuButton_
->
IsChecked
=
false
;
_shareMenuButton_
->
IsChecked
=
false
;
...
...
@@ -858,3 +861,66 @@ Object ^ RingClientUWP::Views::CollapseEmptyString::ConvertBack(Object ^ value,
RingClientUWP
::
Views
::
CollapseEmptyString
::
CollapseEmptyString
()
{}
void
RingClientUWP
::
Views
::
SmartPanel
::
_selectedAccountAvatarContainer__PointerEntered
(
Platform
::
Object
^
sender
,
Windows
::
UI
::
Xaml
::
Input
::
PointerRoutedEventArgs
^
e
)
{
_photoboothIcon_
->
Visibility
=
Windows
::
UI
::
Xaml
::
Visibility
::
Visible
;
_shaderPhotoboothIcon_
->
Visibility
=
Windows
::
UI
::
Xaml
::
Visibility
::
Visible
;
}
void
RingClientUWP
::
Views
::
SmartPanel
::
_selectedAccountAvatarContainer__PointerReleased
(
Platform
::
Object
^
sender
,
Windows
::
UI
::
Xaml
::
Input
::
PointerRoutedEventArgs
^
e
)
{
CameraCaptureUI
^
cameraCaptureUI
=
ref
new
CameraCaptureUI
();
cameraCaptureUI
->
PhotoSettings
->
Format
=
CameraCaptureUIPhotoFormat
::
Png
;
cameraCaptureUI
->
PhotoSettings
->
CroppedSizeInPixels
=
Size
(
100
,
100
);
create_task
(
cameraCaptureUI
->
CaptureFileAsync
(
CameraCaptureUIMode
::
Photo
))
.
then
([
this
](
StorageFile
^
photoFile
)
{
if
(
photoFile
!=
nullptr
)
{
// maybe it would be possible to move some logics to the style sheet
auto
brush
=
ref
new
ImageBrush
();
auto
circle
=
ref
new
Ellipse
();
circle
->
Height
=
80
;
// TODO : use some global constant when ready
circle
->
Width
=
80
;
auto
path
=
photoFile
->
Path
;
auto
uri
=
ref
new
Windows
::
Foundation
::
Uri
(
path
);
auto
bitmapImage
=
ref
new
Windows
::
UI
::
Xaml
::
Media
::
Imaging
::
BitmapImage
();
bitmapImage
->
UriSource
=
uri
;
StorageFolder
^
localfolder
=
ApplicationData
::
Current
->
LocalFolder
;
String
^
profilefolder
=
".profile"
;
create_task
(
localfolder
->
CreateFolderAsync
(
profilefolder
,
Windows
::
Storage
::
CreationCollisionOption
::
OpenIfExists
))
.
then
([
=
](
StorageFolder
^
copytofolder
)
{
try
{
create_task
(
photoFile
->
CopyAsync
(
copytofolder
))
.
then
([
=
](
StorageFile
^
copiedfile
)
{
copiedfile
->
RenameAsync
(
"profile_image.png"
,
Windows
::
Storage
::
NameCollisionOption
::
ReplaceExisting
);
});
}
catch
(
Exception
^
e
)
{
RingDebug
::
instance
->
print
(
"Exception while saving profile image"
);
}
});
Configuration
::
UserPreferences
::
instance
->
PREF_PROFILE_PHOTO
=
true
;
Configuration
::
UserPreferences
::
instance
->
save
();
brush
->
ImageSource
=
bitmapImage
;
_selectedAccountAvatar_
->
ImageSource
=
bitmapImage
;
}
});
}
void
RingClientUWP
::
Views
::
SmartPanel
::
_selectedAccountAvatarContainer__PointerExited
(
Platform
::
Object
^
sender
,
Windows
::
UI
::
Xaml
::
Input
::
PointerRoutedEventArgs
^
e
)
{
_photoboothIcon_
->
Visibility
=
Windows
::
UI
::
Xaml
::
Visibility
::
Collapsed
;
_shaderPhotoboothIcon_
->
Visibility
=
Windows
::
UI
::
Xaml
::
Visibility
::
Collapsed
;
}
SmartPanel.xaml.h
View file @
f3ad2c07
...
...
@@ -133,6 +133,9 @@ private:
void
_passwordBoxAccountCreationCheck__PasswordChanged
(
Platform
::
Object
^
sender
,
Windows
::
UI
::
Xaml
::
RoutedEventArgs
^
e
);
void
_accountTypeComboBox__SelectionChanged
(
Platform
::
Object
^
sender
,
Windows
::
UI
::
Xaml
::
Controls
::
SelectionChangedEventArgs
^
e
);
void
_ringAliasTextBox__TextChanged
(
Platform
::
Object
^
sender
,
Windows
::
UI
::
Xaml
::
Controls
::
TextChangedEventArgs
^
e
);
void
_selectedAccountAvatarContainer__PointerEntered
(
Platform
::
Object
^
sender
,
Windows
::
UI
::
Xaml
::
Input
::
PointerRoutedEventArgs
^
e
);
void
_selectedAccountAvatarContainer__PointerReleased
(
Platform
::
Object
^
sender
,
Windows
::
UI
::
Xaml
::
Input
::
PointerRoutedEventArgs
^
e
);
void
_selectedAccountAvatarContainer__PointerExited
(
Platform
::
Object
^
sender
,
Windows
::
UI
::
Xaml
::
Input
::
PointerRoutedEventArgs
^
e
);
};
}
}
\ No newline at end of file
Styles.xaml
View file @
f3ad2c07
...
...
@@ -117,6 +117,19 @@
<Setter Property="Foreground"
Value="Black"/>
</Style>
<Style x:Key="TextSegoeStyle-Centered-40pt-white"
TargetType="TextBlock">
<Setter Property="FontFamily"
Value="Segoe MDL2 Assets"/>
<Setter Property="FontSize"
Value="40"/>
<Setter Property="HorizontalAlignment"
Value="Center"/>
<Setter Property="VerticalAlignment"
Value="Center"/>
<Setter Property="Foreground"
Value="White"/>
</Style>
<Style x:Key="ButtonStyle1"
TargetType="Button">
<Setter Property="Width"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment