mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-03 22:35:45 +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 bool showPresenceIndicator: true
|
||||
property int unreadMessagesCount: 0
|
||||
property bool enableAnimation: true
|
||||
|
||||
signal imageIsReady
|
||||
|
||||
|
@ -97,8 +98,13 @@ Item {
|
|||
|
||||
onStatusChanged: {
|
||||
if (status === Image.Ready) {
|
||||
rootImageOverlay.state = ""
|
||||
rootImageOverlay.state = "rootImageLoading"
|
||||
if (enableAnimation) {
|
||||
rootImageOverlay.state = ""
|
||||
rootImageOverlay.state = "rootImageLoading"
|
||||
} else {
|
||||
rootImageOverlay.source = rootImage.source
|
||||
root.imageIsReady()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,6 +128,8 @@ Item {
|
|||
|
||||
fillMode: Image.PreserveAspectFit
|
||||
|
||||
opacity: enableAnimation ? 1 : 0
|
||||
|
||||
onOpacityChanged: {
|
||||
if (opacity === 0)
|
||||
source = rootImage.source
|
||||
|
@ -140,7 +148,11 @@ Item {
|
|||
}
|
||||
|
||||
transitions: Transition {
|
||||
NumberAnimation { properties: "opacity"; easing.type: Easing.InOutQuad; duration: 400}
|
||||
NumberAnimation {
|
||||
properties: "opacity"
|
||||
easing.type: Easing.InOutQuad
|
||||
duration: 400
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,10 +28,11 @@ ColumnLayout {
|
|||
buttonsRowLayout.height +
|
||||
JamiTheme.preferredMarginSize / 2
|
||||
|
||||
function initUI() {
|
||||
function initUI(useDefaultAvatar = true) {
|
||||
photoState = PhotoboothView.PhotoState.Default
|
||||
avatarSet = false
|
||||
setAvatarImage(AvatarImage.Mode.Default, "")
|
||||
if (useDefaultAvatar)
|
||||
setAvatarImage(AvatarImage.Mode.Default, "")
|
||||
}
|
||||
|
||||
function startBooth(force = false) {
|
||||
|
@ -49,6 +50,11 @@ ColumnLayout {
|
|||
|
||||
function setAvatarImage(mode = AvatarImage.Mode.FromAccount,
|
||||
imageId = AccountAdapter.currentAccountId){
|
||||
if (mode !== AvatarImage.Mode.FromUrl)
|
||||
avatarImg.enableAnimation = true
|
||||
else
|
||||
avatarImg.enableAnimation = false
|
||||
|
||||
avatarImg.mode = mode
|
||||
|
||||
if (mode === AvatarImage.Mode.Default) {
|
||||
|
@ -109,7 +115,7 @@ ColumnLayout {
|
|||
id: avatarLabelBackground
|
||||
|
||||
anchors.fill: parent
|
||||
color: "grey"
|
||||
color: "white"
|
||||
radius: height / 2
|
||||
|
||||
AvatarImage {
|
||||
|
@ -135,14 +141,44 @@ ColumnLayout {
|
|||
}
|
||||
|
||||
onImageIsReady: {
|
||||
// Once image is loaded (updated), save to boothImg
|
||||
avatarImg.grabToImage(function(result) {
|
||||
if (mode !== AvatarImage.Mode.Default)
|
||||
boothImg = result.image
|
||||
if (mode === AvatarImage.Mode.FromUrl)
|
||||
photoState = PhotoboothView.PhotoState.Taken
|
||||
|
||||
if (saveToConfig)
|
||||
SettingsAdapter.setCurrAccAvatar(result.image)
|
||||
})
|
||||
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) {
|
||||
if (mode !== AvatarImage.Mode.Default)
|
||||
boothImg = result.image
|
||||
|
||||
if (saveToConfig)
|
||||
SettingsAdapter.setCurrAccAvatar(result.image)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
|
@ -235,15 +255,14 @@ ColumnLayout {
|
|||
startBooth()
|
||||
return
|
||||
} else {
|
||||
// show flash overlay
|
||||
flashOverlay.visible = true
|
||||
flashAnimation.restart()
|
||||
|
||||
previewWidget.grabToImage(function(result) {
|
||||
boothImg = result.image
|
||||
|
||||
if (saveToConfig)
|
||||
SettingsAdapter.setCurrAccAvatar(result.image)
|
||||
|
||||
setAvatarImage(AvatarImage.Mode.FromUrl, result.url)
|
||||
|
||||
photoState = PhotoboothView.PhotoState.Taken
|
||||
avatarSet = true
|
||||
stopBooth()
|
||||
})
|
||||
|
|
|
@ -53,9 +53,6 @@ Rectangle {
|
|||
pageIdCurrentAccountSettings.connectCurrentAccount()
|
||||
settingsViewRect.stopPreviewing()
|
||||
selectedMenu = sel
|
||||
if(pageIdCurrentAccountSettings.isPhotoBoothOpened()) {
|
||||
settingsViewRect.setAvatar()
|
||||
}
|
||||
pageIdCurrentAccountSettings.updateAccountInfoDisplayed()
|
||||
break
|
||||
case SettingsView.General:
|
||||
|
@ -123,7 +120,6 @@ Rectangle {
|
|||
|
||||
signal stopPreviewing
|
||||
signal stopBooth
|
||||
signal setAvatar
|
||||
|
||||
property bool isSIP: {
|
||||
switch (profileType) {
|
||||
|
|
|
@ -38,21 +38,14 @@ ColumnLayout {
|
|||
function onStopBooth() {
|
||||
stopBooth()
|
||||
}
|
||||
|
||||
function onSetAvatar() {
|
||||
setAvatar()
|
||||
}
|
||||
}
|
||||
|
||||
function updateAccountInfo() {
|
||||
displayNameLineEdit.text = SettingsAdapter.getCurrentAccount_Profile_Info_Alias()
|
||||
}
|
||||
|
||||
function isPhotoBoothOpened() {
|
||||
return currentAccountAvatar.takePhotoState
|
||||
}
|
||||
|
||||
function setAvatar() {
|
||||
function initPhotoBooth() {
|
||||
currentAccountAvatar.initUI(false)
|
||||
currentAccountAvatar.setAvatarImage()
|
||||
}
|
||||
|
||||
|
|
|
@ -43,12 +43,8 @@ Rectangle {
|
|||
signal navigateToNewWizardView
|
||||
signal advancedSettingsToggled(bool settingsVisible)
|
||||
|
||||
function isPhotoBoothOpened() {
|
||||
return accountProfile.isPhotoBoothOpened()
|
||||
}
|
||||
|
||||
function updateAccountInfoDisplayed() {
|
||||
accountProfile.setAvatar()
|
||||
accountProfile.initPhotoBooth()
|
||||
|
||||
accountEnableCheckBox.checked = SettingsAdapter.get_CurrentAccountInfo_Enabled()
|
||||
accountProfile.updateAccountInfo()
|
||||
|
|
Loading…
Add table
Reference in a new issue