mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-04 23:05:48 +02:00
photobooth: recover the functionality of photo taken with flash
Gitlab: #187 Change-Id: I2d6cc19a68438accff89598e5b6866649ae5a511
This commit is contained in:
parent
7bd7b2e9ee
commit
ba45e39db7
5 changed files with 68 additions and 52 deletions
|
@ -65,6 +65,7 @@ Item {
|
||||||
property alias presenceStatus: presenceIndicator.status
|
property alias presenceStatus: presenceIndicator.status
|
||||||
property bool showPresenceIndicator: true
|
property bool showPresenceIndicator: true
|
||||||
property int unreadMessagesCount: 0
|
property int unreadMessagesCount: 0
|
||||||
|
property bool enableAnimation: true
|
||||||
|
|
||||||
signal imageIsReady
|
signal imageIsReady
|
||||||
|
|
||||||
|
@ -97,8 +98,13 @@ Item {
|
||||||
|
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
if (status === Image.Ready) {
|
if (status === Image.Ready) {
|
||||||
|
if (enableAnimation) {
|
||||||
rootImageOverlay.state = ""
|
rootImageOverlay.state = ""
|
||||||
rootImageOverlay.state = "rootImageLoading"
|
rootImageOverlay.state = "rootImageLoading"
|
||||||
|
} else {
|
||||||
|
rootImageOverlay.source = rootImage.source
|
||||||
|
root.imageIsReady()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,6 +128,8 @@ Item {
|
||||||
|
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
|
|
||||||
|
opacity: enableAnimation ? 1 : 0
|
||||||
|
|
||||||
onOpacityChanged: {
|
onOpacityChanged: {
|
||||||
if (opacity === 0)
|
if (opacity === 0)
|
||||||
source = rootImage.source
|
source = rootImage.source
|
||||||
|
@ -140,7 +148,11 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
transitions: Transition {
|
transitions: Transition {
|
||||||
NumberAnimation { properties: "opacity"; easing.type: Easing.InOutQuad; duration: 400}
|
NumberAnimation {
|
||||||
|
properties: "opacity"
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
duration: 400
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,10 @@ ColumnLayout {
|
||||||
buttonsRowLayout.height +
|
buttonsRowLayout.height +
|
||||||
JamiTheme.preferredMarginSize / 2
|
JamiTheme.preferredMarginSize / 2
|
||||||
|
|
||||||
function initUI() {
|
function initUI(useDefaultAvatar = true) {
|
||||||
photoState = PhotoboothView.PhotoState.Default
|
photoState = PhotoboothView.PhotoState.Default
|
||||||
avatarSet = false
|
avatarSet = false
|
||||||
|
if (useDefaultAvatar)
|
||||||
setAvatarImage(AvatarImage.Mode.Default, "")
|
setAvatarImage(AvatarImage.Mode.Default, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +50,11 @@ ColumnLayout {
|
||||||
|
|
||||||
function setAvatarImage(mode = AvatarImage.Mode.FromAccount,
|
function setAvatarImage(mode = AvatarImage.Mode.FromAccount,
|
||||||
imageId = AccountAdapter.currentAccountId){
|
imageId = AccountAdapter.currentAccountId){
|
||||||
|
if (mode !== AvatarImage.Mode.FromUrl)
|
||||||
|
avatarImg.enableAnimation = true
|
||||||
|
else
|
||||||
|
avatarImg.enableAnimation = false
|
||||||
|
|
||||||
avatarImg.mode = mode
|
avatarImg.mode = mode
|
||||||
|
|
||||||
if (mode === AvatarImage.Mode.Default) {
|
if (mode === AvatarImage.Mode.Default) {
|
||||||
|
@ -109,7 +115,7 @@ ColumnLayout {
|
||||||
id: avatarLabelBackground
|
id: avatarLabelBackground
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: "grey"
|
color: "white"
|
||||||
radius: height / 2
|
radius: height / 2
|
||||||
|
|
||||||
AvatarImage {
|
AvatarImage {
|
||||||
|
@ -135,7 +141,14 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
onImageIsReady: {
|
onImageIsReady: {
|
||||||
// Once image is loaded (updated), save to boothImg
|
if (mode === AvatarImage.Mode.FromUrl)
|
||||||
|
photoState = PhotoboothView.PhotoState.Taken
|
||||||
|
|
||||||
|
if (photoState === PhotoboothView.PhotoState.Taken) {
|
||||||
|
avatarImg.state = ""
|
||||||
|
avatarImg.state = "flashIn"
|
||||||
|
} else {
|
||||||
|
// Once image is loaded (updated), save to boothImg (choose from file)
|
||||||
avatarImg.grabToImage(function(result) {
|
avatarImg.grabToImage(function(result) {
|
||||||
if (mode !== AvatarImage.Mode.Default)
|
if (mode !== AvatarImage.Mode.Default)
|
||||||
boothImg = result.image
|
boothImg = result.image
|
||||||
|
@ -145,6 +158,29 @@ ColumnLayout {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onOpacityChanged: {
|
||||||
|
if (avatarImg.state === "flashIn" && opacity === 0)
|
||||||
|
avatarImg.state = "flashOut"
|
||||||
|
}
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "flashIn"
|
||||||
|
PropertyChanges { target: avatarImg; opacity: 0}
|
||||||
|
}, State {
|
||||||
|
name: "flashOut"
|
||||||
|
PropertyChanges { target: avatarImg; opacity: 1}
|
||||||
|
}]
|
||||||
|
|
||||||
|
transitions: Transition {
|
||||||
|
NumberAnimation {
|
||||||
|
properties: "opacity"
|
||||||
|
easing.type: Easing.Linear
|
||||||
|
duration: 100
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,22 +208,6 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
|
||||||
id: flashOverlay
|
|
||||||
|
|
||||||
anchors.fill: previewWidget
|
|
||||||
visible: false
|
|
||||||
color: JamiTheme.whiteColor
|
|
||||||
|
|
||||||
OpacityAnimator on opacity {
|
|
||||||
id: flashAnimation
|
|
||||||
|
|
||||||
from: 1
|
|
||||||
to: 0
|
|
||||||
duration: 600
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
@ -235,15 +255,14 @@ ColumnLayout {
|
||||||
startBooth()
|
startBooth()
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
// show flash overlay
|
|
||||||
flashOverlay.visible = true
|
|
||||||
flashAnimation.restart()
|
|
||||||
|
|
||||||
previewWidget.grabToImage(function(result) {
|
previewWidget.grabToImage(function(result) {
|
||||||
|
boothImg = result.image
|
||||||
|
|
||||||
|
if (saveToConfig)
|
||||||
|
SettingsAdapter.setCurrAccAvatar(result.image)
|
||||||
|
|
||||||
setAvatarImage(AvatarImage.Mode.FromUrl, result.url)
|
setAvatarImage(AvatarImage.Mode.FromUrl, result.url)
|
||||||
|
|
||||||
photoState = PhotoboothView.PhotoState.Taken
|
|
||||||
avatarSet = true
|
avatarSet = true
|
||||||
stopBooth()
|
stopBooth()
|
||||||
})
|
})
|
||||||
|
|
|
@ -53,9 +53,6 @@ Rectangle {
|
||||||
pageIdCurrentAccountSettings.connectCurrentAccount()
|
pageIdCurrentAccountSettings.connectCurrentAccount()
|
||||||
settingsViewRect.stopPreviewing()
|
settingsViewRect.stopPreviewing()
|
||||||
selectedMenu = sel
|
selectedMenu = sel
|
||||||
if(pageIdCurrentAccountSettings.isPhotoBoothOpened()) {
|
|
||||||
settingsViewRect.setAvatar()
|
|
||||||
}
|
|
||||||
pageIdCurrentAccountSettings.updateAccountInfoDisplayed()
|
pageIdCurrentAccountSettings.updateAccountInfoDisplayed()
|
||||||
break
|
break
|
||||||
case SettingsView.General:
|
case SettingsView.General:
|
||||||
|
@ -123,7 +120,6 @@ Rectangle {
|
||||||
|
|
||||||
signal stopPreviewing
|
signal stopPreviewing
|
||||||
signal stopBooth
|
signal stopBooth
|
||||||
signal setAvatar
|
|
||||||
|
|
||||||
property bool isSIP: {
|
property bool isSIP: {
|
||||||
switch (profileType) {
|
switch (profileType) {
|
||||||
|
|
|
@ -38,21 +38,14 @@ ColumnLayout {
|
||||||
function onStopBooth() {
|
function onStopBooth() {
|
||||||
stopBooth()
|
stopBooth()
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSetAvatar() {
|
|
||||||
setAvatar()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateAccountInfo() {
|
function updateAccountInfo() {
|
||||||
displayNameLineEdit.text = SettingsAdapter.getCurrentAccount_Profile_Info_Alias()
|
displayNameLineEdit.text = SettingsAdapter.getCurrentAccount_Profile_Info_Alias()
|
||||||
}
|
}
|
||||||
|
|
||||||
function isPhotoBoothOpened() {
|
function initPhotoBooth() {
|
||||||
return currentAccountAvatar.takePhotoState
|
currentAccountAvatar.initUI(false)
|
||||||
}
|
|
||||||
|
|
||||||
function setAvatar() {
|
|
||||||
currentAccountAvatar.setAvatarImage()
|
currentAccountAvatar.setAvatarImage()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,12 +43,8 @@ Rectangle {
|
||||||
signal navigateToNewWizardView
|
signal navigateToNewWizardView
|
||||||
signal advancedSettingsToggled(bool settingsVisible)
|
signal advancedSettingsToggled(bool settingsVisible)
|
||||||
|
|
||||||
function isPhotoBoothOpened() {
|
|
||||||
return accountProfile.isPhotoBoothOpened()
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateAccountInfoDisplayed() {
|
function updateAccountInfoDisplayed() {
|
||||||
accountProfile.setAvatar()
|
accountProfile.initPhotoBooth()
|
||||||
|
|
||||||
accountEnableCheckBox.checked = SettingsAdapter.get_CurrentAccountInfo_Enabled()
|
accountEnableCheckBox.checked = SettingsAdapter.get_CurrentAccountInfo_Enabled()
|
||||||
accountProfile.updateAccountInfo()
|
accountProfile.updateAccountInfo()
|
||||||
|
|
Loading…
Add table
Reference in a new issue