From 7096eb69abca9d70bd42464e3a04aaaa8db2582d Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Mon, 23 Jan 2017 15:15:24 +0100 Subject: [PATCH] feat(app): calls in progress --- tests/resources.qrc | 2 +- tests/src/components/call/CallModel.cpp | 17 ++++--- tests/src/components/call/CallModel.hpp | 8 ++- .../modules/Linphone/Calls/CallControls.qml | 4 +- tests/ui/modules/Linphone/Calls/Calls.qml | 4 +- .../Linphone/Styles/Calls/CallsStyle.qml | 2 +- .../views/App/Calls/AbstractStartingCall.qml | 29 +++++------ tests/ui/views/App/Calls/CallsWindow.qml | 20 ++++---- tests/ui/views/App/Calls/Incall.qml | 50 ++++++++++--------- tests/ui/views/App/Calls/IncomingCall.qml | 6 +-- tests/ui/views/App/Calls/OutgoingCall.qml | 16 +++--- .../{StartingCallStyle.qml => CallStyle.qml} | 0 .../App/Styles/Calls/CallsWindowStyle.qml | 29 ++++++++--- tests/ui/views/App/Styles/qmldir | 2 +- 14 files changed, 105 insertions(+), 84 deletions(-) rename tests/ui/views/App/Styles/Calls/{StartingCallStyle.qml => CallStyle.qml} (100%) diff --git a/tests/resources.qrc b/tests/resources.qrc index 06fca156e..908f43ee4 100644 --- a/tests/resources.qrc +++ b/tests/resources.qrc @@ -260,8 +260,8 @@ ui/views/App/MainWindow/MainWindow.qml ui/views/App/ManageAccounts.qml ui/views/App/qmldir + ui/views/App/Styles/Calls/CallStyle.qml ui/views/App/Styles/Calls/CallsWindowStyle.qml - ui/views/App/Styles/Calls/StartingCallStyle.qml ui/views/App/Styles/MainWindow/ContactEditStyle.qml ui/views/App/Styles/MainWindow/ContactsStyle.qml ui/views/App/Styles/MainWindow/ConversationStyle.qml diff --git a/tests/src/components/call/CallModel.cpp b/tests/src/components/call/CallModel.cpp index 11a8e1cf5..c45450912 100644 --- a/tests/src/components/call/CallModel.cpp +++ b/tests/src/components/call/CallModel.cpp @@ -110,18 +110,23 @@ void CallModel::setPausedByUser (bool status) { bool paused = getPausedByUser(); if (status) { - if (!paused) { + if (!paused) CoreManager::getInstance()->getCore()->pauseCall(m_linphone_call); - emit pausedByUserChanged(true); - } return; } - if (paused) { + if (paused) CoreManager::getInstance()->getCore()->resumeCall(m_linphone_call); - emit pausedByUserChanged(false); - } +} + +bool CallModel::getVideoInputEnabled () const { + // TODO + return false; +} + +void CallModel::setVideoInputEnabled (bool status) { + // TODO } bool CallModel::getVideoOutputEnabled () const { diff --git a/tests/src/components/call/CallModel.hpp b/tests/src/components/call/CallModel.hpp index a5b07c5e7..53b1d8b6f 100644 --- a/tests/src/components/call/CallModel.hpp +++ b/tests/src/components/call/CallModel.hpp @@ -13,7 +13,8 @@ class CallModel : public QObject { Q_PROPERTY(CallStatus status READ getStatus NOTIFY statusChanged); Q_PROPERTY(bool isOutgoing READ isOutgoing CONSTANT); Q_PROPERTY(bool microMuted READ getMicroMuted WRITE setMicroMuted NOTIFY microMutedChanged); - Q_PROPERTY(bool pausedByUser READ getPausedByUser WRITE setPausedByUser NOTIFY pausedByUserChanged); + Q_PROPERTY(bool pausedByUser READ getPausedByUser WRITE setPausedByUser NOTIFY statusChanged); + Q_PROPERTY(bool videoInputEnabled READ getVideoInputEnabled WRITE setVideoInputEnabled NOTIFY videoInputEnabled); Q_PROPERTY(bool videoOutputEnabled READ getVideoOutputEnabled WRITE setVideoOutputEnabled NOTIFY videoOutputEnabled); public: @@ -38,8 +39,8 @@ public: signals: void statusChanged (CallStatus status); - void pausedByUserChanged (bool status); void microMutedChanged (bool status); + void videoInputEnabled (bool status); void videoOutputEnabled (bool status); private: @@ -56,6 +57,9 @@ private: bool getPausedByUser () const; void setPausedByUser (bool status); + bool getVideoInputEnabled () const; + void setVideoInputEnabled (bool status); + bool getVideoOutputEnabled () const; void setVideoOutputEnabled (bool status); diff --git a/tests/ui/modules/Linphone/Calls/CallControls.qml b/tests/ui/modules/Linphone/Calls/CallControls.qml index e7474f393..04b1eb4be 100644 --- a/tests/ui/modules/Linphone/Calls/CallControls.qml +++ b/tests/ui/modules/Linphone/Calls/CallControls.qml @@ -43,7 +43,6 @@ Rectangle { Layout.fillHeight: true Layout.fillWidth: true - anchors.fill: parent displayUnreadMessagesCount: true @@ -55,7 +54,10 @@ Rectangle { Item { id: content + Layout.fillHeight: true + + Component.onCompleted: Layout.preferredWidth = data[0].width } } diff --git a/tests/ui/modules/Linphone/Calls/Calls.qml b/tests/ui/modules/Linphone/Calls/Calls.qml index 01805226b..d318b8658 100644 --- a/tests/ui/modules/Linphone/Calls/Calls.qml +++ b/tests/ui/modules/Linphone/Calls/Calls.qml @@ -112,8 +112,6 @@ ListView { } } - // --------------------------------------------------------------------------- - Component { id: callActions @@ -187,7 +185,7 @@ ListView { id: _callControls function useColorStatus () { - return calls.currentIndex === index && $call.status !== CallModel.CallStatusEnded + return calls.currentIndex === index && $call && $call.status !== CallModel.CallStatusEnded } color: useColorStatus() diff --git a/tests/ui/modules/Linphone/Styles/Calls/CallsStyle.qml b/tests/ui/modules/Linphone/Styles/Calls/CallsStyle.qml index 9124edff4..e8eb867d3 100644 --- a/tests/ui/modules/Linphone/Styles/Calls/CallsStyle.qml +++ b/tests/ui/modules/Linphone/Styles/Calls/CallsStyle.qml @@ -7,7 +7,7 @@ import Common 1.0 QtObject { property QtObject entry: QtObject { - property int iconActionSize: 30 + property int iconActionSize: 35 property int iconMenuSize: 17 property int height: 30 property int width: 200 diff --git a/tests/ui/views/App/Calls/AbstractStartingCall.qml b/tests/ui/views/App/Calls/AbstractStartingCall.qml index 4bc52158c..ec89cb4a8 100644 --- a/tests/ui/views/App/Calls/AbstractStartingCall.qml +++ b/tests/ui/views/App/Calls/AbstractStartingCall.qml @@ -10,24 +10,19 @@ import App.Styles 1.0 // ============================================================================= Rectangle { - id: abstractCall - - // --------------------------------------------------------------------------- - property var call default property alias _actionArea: actionArea.data - property var _contactObserver: SipAddressesModel.getContactObserver(sipAddress) // --------------------------------------------------------------------------- - color: StartingCallStyle.backgroundColor + color: CallStyle.backgroundColor ColumnLayout { anchors { fill: parent - topMargin: StartingCallStyle.header.topMargin + topMargin: CallStyle.header.topMargin } spacing: 0 @@ -38,12 +33,12 @@ Rectangle { Column { Layout.fillWidth: true - spacing: StartingCallStyle.header.spacing + spacing: CallStyle.header.spacing ContactDescription { id: contactDescription - height: StartingCallStyle.contactDescriptionHeight + height: CallStyle.contactDescriptionHeight horizontalTextAlignment: Text.AlignHCenter sipAddress: call.sipAddress username: LinphoneUtils.getContactUsername(_contactObserver.contact || call.sipAddress) @@ -52,9 +47,9 @@ Rectangle { BusyIndicator { anchors.horizontalCenter: parent.horizontalCenter - color: StartingCallStyle.busyIndicator.color - height: StartingCallStyle.busyIndicator.height - width: StartingCallStyle.busyIndicator.width + color: CallStyle.busyIndicator.color + height: CallStyle.busyIndicator.height + width: CallStyle.busyIndicator.width visible: call.isOutgoing } @@ -69,7 +64,7 @@ Rectangle { Layout.fillHeight: true Layout.fillWidth: true - Layout.margins: StartingCallStyle.containerMargins + Layout.margins: CallStyle.containerMargins Avatar { id: avatar @@ -78,14 +73,14 @@ Rectangle { var height = container.height var width = container.width - var size = height < StartingCallStyle.avatar.maxSize && height > 0 + var size = height < CallStyle.avatar.maxSize && height > 0 ? height - : StartingCallStyle.avatar.maxSize + : CallStyle.avatar.maxSize return size < width ? size : width } anchors.centerIn: parent - backgroundColor: StartingCallStyle.avatar.backgroundColor + backgroundColor: CallStyle.avatar.backgroundColor image: _contactObserver.contact && _contactObserver.contact.avatar username: contactDescription.username @@ -102,7 +97,7 @@ Rectangle { id: actionArea Layout.fillWidth: true - Layout.preferredHeight: StartingCallStyle.actionAreaHeight + Layout.preferredHeight: CallStyle.actionAreaHeight } } } diff --git a/tests/ui/views/App/Calls/CallsWindow.qml b/tests/ui/views/App/Calls/CallsWindow.qml index fd53d785c..bd9590594 100644 --- a/tests/ui/views/App/Calls/CallsWindow.qml +++ b/tests/ui/views/App/Calls/CallsWindow.qml @@ -41,9 +41,9 @@ Window { Paned { anchors.fill: parent - defaultChildAWidth: 250 - maximumLeftLimit: 250 - minimumLeftLimit: 110 + defaultChildAWidth: CallsWindowStyle.callsList.defaultWidth + maximumLeftLimit: CallsWindowStyle.callsList.maximumWidth + minimumLeftLimit: CallsWindowStyle.callsList.minimumWidth // ------------------------------------------------------------------------- // Calls list. @@ -76,18 +76,20 @@ Window { ActionBar { anchors { left: parent.left - leftMargin: 10 + leftMargin: CallsWindowStyle.callsList.header.leftMargin verticalCenter: parent.verticalCenter } - iconSize: 40 + iconSize: CallsWindowStyle.callsList.header.iconSize ActionButton { icon: 'new_call' + // TODO: launch new call } ActionButton { icon: 'new_conference' + // TODO: launch new conference } } } @@ -113,8 +115,8 @@ Window { anchors.fill: parent closingEdge: Qt.RightEdge defaultClosed: true - minimumLeftLimit: 395 - minimumRightLimit: 300 + minimumLeftLimit: CallsWindowStyle.call.minimumWidth + minimumRightLimit: CallsWindowStyle.chat.minimumWidth resizeAInPriority: true // ----------------------------------------------------------------------- @@ -178,9 +180,9 @@ Window { } childB: Loader { - active: Boolean(window.call) + active: Boolean(window.sipAddress) anchors.fill: parent - sourceComponent: window.call ? chat : null + sourceComponent: window.sipAddress ? chat : null } } } diff --git a/tests/ui/views/App/Calls/Incall.qml b/tests/ui/views/App/Calls/Incall.qml index ccb42512c..b9513aeba 100644 --- a/tests/ui/views/App/Calls/Incall.qml +++ b/tests/ui/views/App/Calls/Incall.qml @@ -21,12 +21,12 @@ Rectangle { // --------------------------------------------------------------------------- - color: StartingCallStyle.backgroundColor + color: CallStyle.backgroundColor ColumnLayout { anchors { fill: parent - topMargin: StartingCallStyle.header.topMargin + topMargin: CallStyle.header.topMargin } spacing: 0 @@ -39,9 +39,9 @@ Rectangle { id: info Layout.fillWidth: true - Layout.leftMargin: 20 + Layout.leftMargin: CallStyle.info.leftMargin Layout.rightMargin: 20 - Layout.preferredHeight: StartingCallStyle.contactDescriptionHeight + Layout.preferredHeight: CallStyle.contactDescriptionHeight Icon { id: callQuality @@ -92,7 +92,7 @@ Rectangle { Layout.fillWidth: true Layout.fillHeight: true - Layout.margins: StartingCallStyle.containerMargins + Layout.margins: CallStyle.containerMargins Component { id: avatar @@ -102,13 +102,13 @@ Rectangle { var height = container.height var width = container.width - var size = height < StartingCallStyle.avatar.maxSize && height > 0 + var size = height < CallStyle.avatar.maxSize && height > 0 ? height - : StartingCallStyle.avatar.maxSize + : CallStyle.avatar.maxSize return size < width ? size : width } - backgroundColor: StartingCallStyle.avatar.backgroundColor + backgroundColor: CallStyle.avatar.backgroundColor image: _contactObserver.contact ? _contactObserver.contact.vcard.avatar : '' username: contactDescription.username @@ -128,7 +128,7 @@ Rectangle { Loader { anchors.centerIn: parent - sourceComponent: isVideoCall ? camera : avatar + sourceComponent: call.videoInputEnabled ? camera : avatar } } @@ -138,12 +138,12 @@ Rectangle { Item { Layout.fillWidth: true - Layout.preferredHeight: StartingCallStyle.actionAreaHeight + Layout.preferredHeight: CallStyle.actionAreaHeight GridLayout { anchors { left: parent.left - leftMargin: StartingCallStyle.leftButtonsGroupMargin + leftMargin: CallStyle.leftButtonsGroupMargin verticalCenter: parent.verticalCenter } @@ -152,55 +152,57 @@ Rectangle { ActionSwitch { icon: 'micro' - iconSize: StartingCallStyle.iconSize + iconSize: CallStyle.iconSize onClicked: enabled = !enabled } ActionSwitch { icon: 'speaker' - iconSize: StartingCallStyle.iconSize + iconSize: CallStyle.iconSize onClicked: enabled = !enabled } ActionSwitch { icon: 'camera' - iconSize: StartingCallStyle.iconSize + iconSize: CallStyle.iconSize onClicked: enabled = !enabled } ActionButton { - Layout.preferredHeight: StartingCallStyle.iconSize - Layout.preferredWidth: StartingCallStyle.iconSize + Layout.preferredHeight: CallStyle.iconSize + Layout.preferredWidth: CallStyle.iconSize icon: 'options' - iconSize: StartingCallStyle.iconSize + iconSize: CallStyle.iconSize } } Rectangle { anchors.centerIn: parent color: 'red' - height: StartingCallStyle.userVideo.height - visible: call.width >= 550 - width: StartingCallStyle.userVideo.width + height: CallStyle.userVideo.height + visible: incall.width >= 650 + width: CallStyle.userVideo.width } ActionBar { anchors { right: parent.right - rightMargin: StartingCallStyle.rightButtonsGroupMargin + rightMargin: CallStyle.rightButtonsGroupMargin verticalCenter: parent.verticalCenter } - iconSize: StartingCallStyle.iconSize + iconSize: CallStyle.iconSize ActionSwitch { + enabled: !call.pausedByUser icon: 'pause' - onClicked: enabled = !enabled + + onClicked: call.pausedByUser = enabled } ActionButton { icon: 'hangup' - onClicked: Call.terminate() + onClicked: call.terminate() } ActionSwitch { diff --git a/tests/ui/views/App/Calls/IncomingCall.qml b/tests/ui/views/App/Calls/IncomingCall.qml index dfa9abc95..51fecf42b 100644 --- a/tests/ui/views/App/Calls/IncomingCall.qml +++ b/tests/ui/views/App/Calls/IncomingCall.qml @@ -7,7 +7,7 @@ import App.Styles 1.0 AbstractStartingCall { ActionBar { anchors.centerIn: parent - iconSize: StartingCallStyle.iconSize + iconSize: CallStyle.iconSize ActionButton { icon: 'video_call_accept' @@ -25,10 +25,10 @@ AbstractStartingCall { ActionBar { anchors { right: parent.right - rightMargin: StartingCallStyle.rightButtonsGroupMargin + rightMargin: CallStyle.rightButtonsGroupMargin verticalCenter: parent.verticalCenter } - iconSize: StartingCallStyle.iconSize + iconSize: CallStyle.iconSize ActionButton { icon: 'hangup' diff --git a/tests/ui/views/App/Calls/OutgoingCall.qml b/tests/ui/views/App/Calls/OutgoingCall.qml index 3f8b37f8e..4de2ca212 100644 --- a/tests/ui/views/App/Calls/OutgoingCall.qml +++ b/tests/ui/views/App/Calls/OutgoingCall.qml @@ -10,26 +10,26 @@ import App.Styles 1.0 AbstractStartingCall { GridLayout { - columns: parent.width < StartingCallStyle.low && call.videoOutputEnabled ? 1 : 2 + columns: parent.width < CallStyle.lowWidth && call.videoOutputEnabled ? 1 : 2 rowSpacing: ActionBarStyle.spacing anchors { left: parent.left - leftMargin: StartingCallStyle.leftButtonsGroupMargin + leftMargin: CallStyle.leftButtonsGroupMargin verticalCenter: parent.verticalCenter } ActionSwitch { enabled: !call.microMuted icon: 'micro' - iconSize: StartingCallStyle.iconSize + iconSize: CallStyle.iconSize onClicked: call.microMuted = enabled } ActionSwitch { icon: 'speaker' - iconSize: StartingCallStyle.iconSize + iconSize: CallStyle.iconSize onClicked: enabled = !enabled } @@ -37,8 +37,8 @@ AbstractStartingCall { Item { anchors.centerIn: parent - height: StartingCallStyle.userVideo.height - width: StartingCallStyle.userVideo.width + height: CallStyle.userVideo.height + width: CallStyle.userVideo.width visible: call.videoOutputEnabled } @@ -46,10 +46,10 @@ AbstractStartingCall { ActionBar { anchors { right: parent.right - rightMargin: StartingCallStyle.rightButtonsGroupMargin + rightMargin: CallStyle.rightButtonsGroupMargin verticalCenter: parent.verticalCenter } - iconSize: StartingCallStyle.iconSize + iconSize: CallStyle.iconSize ActionButton { icon: 'hangup' diff --git a/tests/ui/views/App/Styles/Calls/StartingCallStyle.qml b/tests/ui/views/App/Styles/Calls/CallStyle.qml similarity index 100% rename from tests/ui/views/App/Styles/Calls/StartingCallStyle.qml rename to tests/ui/views/App/Styles/Calls/CallStyle.qml diff --git a/tests/ui/views/App/Styles/Calls/CallsWindowStyle.qml b/tests/ui/views/App/Styles/Calls/CallsWindowStyle.qml index 85431aa9e..21563a8f2 100644 --- a/tests/ui/views/App/Styles/Calls/CallsWindowStyle.qml +++ b/tests/ui/views/App/Styles/Calls/CallsWindowStyle.qml @@ -10,13 +10,26 @@ QtObject { property int minimumWidth: 960 property string title: 'Linphone' - property QtObject callsList: QtObject { - property color color: Colors.k + property QtObject call: QtObject { + property int minimumWidth: 395 + } - property QtObject header: QtObject { - property int height: 60 - property color color1: Colors.k - property color color2: Colors.v - } - } + property QtObject callsList: QtObject { + property color color: Colors.k + property int defaultWidth: 250 + property int maximumWidth: 250 + property int minimumWidth: 110 + + property QtObject header: QtObject { + property color color1: Colors.k + property color color2: Colors.v + property int height: 60 + property int iconSize: 40 + property int leftMargin: 10 + } + } + + property QtObject chat: QtObject { + property int minimumWidth: 300 + } } diff --git a/tests/ui/views/App/Styles/qmldir b/tests/ui/views/App/Styles/qmldir index f909ab6df..da4ddc7f1 100644 --- a/tests/ui/views/App/Styles/qmldir +++ b/tests/ui/views/App/Styles/qmldir @@ -4,8 +4,8 @@ module App.Styles # Views styles ----------------------------------------------------------------- +singleton CallStyle 1.0 Calls/CallStyle.qml singleton CallsWindowStyle 1.0 Calls/CallsWindowStyle.qml -singleton StartingCallStyle 1.0 Calls/StartingCallStyle.qml singleton ContactEditStyle 1.0 MainWindow/ContactEditStyle.qml singleton ContactsStyle 1.0 MainWindow/ContactsStyle.qml