From 4bcb9e88da379776c80ed3f36572a7f058229bf6 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Mon, 16 Apr 2018 14:08:23 +0200 Subject: [PATCH] feat(app): disable camera icons when video is not enabled at compile time --- assets/images/video_call_accept_disabled.svg | 15 +++++++++++++ resources.qrc | 1 + .../NotificationReceivedCall.qml | 3 +-- .../SmartSearchBar/SmartSearchBar.qml | 1 + ui/modules/Linphone/View/SipAddressesView.qml | 8 +++++++ ui/views/App/Calls/Dialogs/CallSipAddress.qml | 1 + ui/views/App/Calls/Incall.qml | 21 +++++++++++-------- ui/views/App/Calls/IncomingCall.qml | 3 ++- 8 files changed, 41 insertions(+), 12 deletions(-) create mode 100644 assets/images/video_call_accept_disabled.svg diff --git a/assets/images/video_call_accept_disabled.svg b/assets/images/video_call_accept_disabled.svg new file mode 100644 index 000000000..aa08ecbe6 --- /dev/null +++ b/assets/images/video_call_accept_disabled.svg @@ -0,0 +1,15 @@ + + + + video_call_default + Created with Sketch. + + + + + + + + + + diff --git a/resources.qrc b/resources.qrc index a6767c3d8..490613444 100644 --- a/resources.qrc +++ b/resources.qrc @@ -193,6 +193,7 @@ assets/images/transfer_normal.svg assets/images/transfer_pressed.svg assets/images/update_sign.svg + assets/images/video_call_accept_disabled.svg assets/images/video_call_accept_hovered.svg assets/images/video_call_accept_normal.svg assets/images/video_call_accept_pressed.svg diff --git a/ui/modules/Linphone/Notifications/NotificationReceivedCall.qml b/ui/modules/Linphone/Notifications/NotificationReceivedCall.qml index 2b66fcad8..c79e1d989 100644 --- a/ui/modules/Linphone/Notifications/NotificationReceivedCall.qml +++ b/ui/modules/Linphone/Notifications/NotificationReceivedCall.qml @@ -53,14 +53,13 @@ Notification { iconSize: NotificationReceivedCallStyle.actionArea.iconSize ActionButton { + enabled: SettingsModel.videoSupported icon: 'video_call_accept' - onClicked: notification._close(notification.call.acceptWithVideo) } ActionButton { icon: 'call_accept' - onClicked: notification._close(notification.call.accept) } } diff --git a/ui/modules/Linphone/SmartSearchBar/SmartSearchBar.qml b/ui/modules/Linphone/SmartSearchBar/SmartSearchBar.qml index 8746f87bd..c808e7ba0 100644 --- a/ui/modules/Linphone/SmartSearchBar/SmartSearchBar.qml +++ b/ui/modules/Linphone/SmartSearchBar/SmartSearchBar.qml @@ -38,6 +38,7 @@ SearchBox { id: view actions: [{ + enabled: SettingsModel.videoSupported, icon: 'video_call', handler: function (entry) { searchBox.closeMenu() diff --git a/ui/modules/Linphone/View/SipAddressesView.qml b/ui/modules/Linphone/View/SipAddressesView.qml index f16b38072..20e541543 100644 --- a/ui/modules/Linphone/View/SipAddressesView.qml +++ b/ui/modules/Linphone/View/SipAddressesView.qml @@ -97,6 +97,10 @@ ScrollableListView { model: sipAddressesView.actions ActionButton { + enabled: { + var status = sipAddressesView.actions[index].enabled + return status === undefined || status + } icon: modelData.icon onClicked: sipAddressesView.actions[index].handler({ sipAddress: sipAddressesView.interpretableSipAddress @@ -229,6 +233,10 @@ ScrollableListView { model: sipAddressesView.actions ActionButton { + enabled: { + var status = sipAddressesView.actions[index].enabled + return status === undefined || status + } icon: modelData.icon onClicked: sipAddressesView.actions[index].handler($sipAddress) } diff --git a/ui/views/App/Calls/Dialogs/CallSipAddress.qml b/ui/views/App/Calls/Dialogs/CallSipAddress.qml index b20d931b5..d3224fc2b 100644 --- a/ui/views/App/Calls/Dialogs/CallSipAddress.qml +++ b/ui/views/App/Calls/Dialogs/CallSipAddress.qml @@ -59,6 +59,7 @@ DialogPlus { anchors.fill: parent actions: [{ + enabled: SettingsModel.videoSupported, icon: 'video_call', handler: function (entry) { CallsListModel.launchVideoCall(entry.sipAddress) diff --git a/ui/views/App/Calls/Incall.qml b/ui/views/App/Calls/Incall.qml index f60bd94ca..1a36dda98 100644 --- a/ui/views/App/Calls/Incall.qml +++ b/ui/views/App/Calls/Incall.qml @@ -336,17 +336,20 @@ Rectangle { } } - ActionSwitch { - enabled: incall.call.videoEnabled - icon: 'camera' - iconSize: CallStyle.actionArea.iconSize - updating: incall.call.updating + Loader { + active: SettingsModel.videoSupported + sourceComponent: ActionSwitch { + enabled: incall.call.videoEnabled + icon: 'camera' + iconSize: CallStyle.actionArea.iconSize + updating: incall.call.updating - onClicked: incall.call.videoEnabled = !enabled + onClicked: incall.call.videoEnabled = !enabled - TooltipArea { - text: qsTr('pendingRequestLabel') - visible: parent.updating + TooltipArea { + text: qsTr('pendingRequestLabel') + visible: parent.updating + } } } diff --git a/ui/views/App/Calls/IncomingCall.qml b/ui/views/App/Calls/IncomingCall.qml index 299862282..540f3fd9f 100644 --- a/ui/views/App/Calls/IncomingCall.qml +++ b/ui/views/App/Calls/IncomingCall.qml @@ -1,4 +1,5 @@ import Common 1.0 +import Linphone 1.0 import App.Styles 1.0 @@ -10,8 +11,8 @@ AbstractStartingCall { iconSize: CallStyle.actionArea.iconSize ActionButton { + enabled: SettingsModel.videoSupported icon: 'video_call_accept' - onClicked: call.acceptWithVideo() }