From ac0f224e2e913056006cee362bb27b753014f61d Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Mon, 5 Dec 2016 10:50:07 +0100 Subject: [PATCH] feat(ui/views/App/MainWindow/ContactEdit): view in progress --- tests/assets/images/history_hovered.svg | 13 ++ tests/assets/images/history_normal.svg | 13 ++ tests/assets/images/history_pressed.svg | 13 ++ tests/assets/languages/en.ts | 63 +++++-- tests/assets/languages/fr.ts | 63 +++++-- tests/resources.qrc | 6 +- tests/ui/views/App/MainWindow/Contact.qml | 119 ------------- tests/ui/views/App/MainWindow/ContactEdit.qml | 157 ++++++++++++++++++ tests/ui/views/App/MainWindow/Contacts.qml | 6 +- .../ui/views/App/MainWindow/Conversation.qml | 4 +- .../Styles/MainWindow/ContactEditStyle.qml | 27 +++ tests/ui/views/App/Styles/qmldir | 1 + 12 files changed, 342 insertions(+), 143 deletions(-) create mode 100644 tests/assets/images/history_hovered.svg create mode 100644 tests/assets/images/history_normal.svg create mode 100644 tests/assets/images/history_pressed.svg delete mode 100644 tests/ui/views/App/MainWindow/Contact.qml create mode 100644 tests/ui/views/App/MainWindow/ContactEdit.qml create mode 100644 tests/ui/views/App/Styles/MainWindow/ContactEditStyle.qml diff --git a/tests/assets/images/history_hovered.svg b/tests/assets/images/history_hovered.svg new file mode 100644 index 000000000..0bb02b704 --- /dev/null +++ b/tests/assets/images/history_hovered.svg @@ -0,0 +1,13 @@ + + + + history_over + Created with Sketch. + + + + + + + + \ No newline at end of file diff --git a/tests/assets/images/history_normal.svg b/tests/assets/images/history_normal.svg new file mode 100644 index 000000000..b516f9608 --- /dev/null +++ b/tests/assets/images/history_normal.svg @@ -0,0 +1,13 @@ + + + + history_default + Created with Sketch. + + + + + + + + \ No newline at end of file diff --git a/tests/assets/images/history_pressed.svg b/tests/assets/images/history_pressed.svg new file mode 100644 index 000000000..743bb947c --- /dev/null +++ b/tests/assets/images/history_pressed.svg @@ -0,0 +1,13 @@ + + + + history_clic + Created with Sketch. + + + + + + + + \ No newline at end of file diff --git a/tests/assets/languages/en.ts b/tests/assets/languages/en.ts index 79f18ccc2..29797c752 100644 --- a/tests/assets/languages/en.ts +++ b/tests/assets/languages/en.ts @@ -57,43 +57,86 @@ Contact sipAccounts - SIP ACCOUNT(S) + SIP ACCOUNT(S) address - ADDRESS + ADDRESS emails - E-MAIL(S) + E-MAIL(S) webSites - WEB SITE(S) + WEB SITE(S) sipAccountsInput - SIP Address + SIP Address emailsInput - E-mail address + E-mail address addressInput - Address + Address webSitesInput - URL + URL removeContactDescription - Do you really want remove this contact from your book? + Do you really want remove this contact from your book? removeContactTitle - Delete confirmation + Delete confirmation + + + + ContactEdit + + removeContactDescription + Do you really want remove this contact from your book? + + + removeContactTitle + Delete confirmation + + + sipAccounts + SIP ACCOUNT(S) + + + sipAccountsInput + SIP Address + + + address + ADDRESS + + + addressInput + Address + + + emails + E-MAIL(S) + + + emailsInput + E-mail address + + + webSites + WEB SITE(S) + + + webSitesInput + URL diff --git a/tests/assets/languages/fr.ts b/tests/assets/languages/fr.ts index 50174c7ae..70069efa0 100644 --- a/tests/assets/languages/fr.ts +++ b/tests/assets/languages/fr.ts @@ -49,43 +49,86 @@ Contact sipAccounts - COMPTE(S) SIP + COMPTE(S) SIP address - ADRESSE(S) + ADRESSE(S) emails - EMAIL(S) + EMAIL(S) webSites - SITE(S) WEB + SITE(S) WEB sipAccountsInput - Adresse SIP + Adresse SIP emailsInput - Adresse e-mail + Adresse e-mail addressInput - Adresse + Adresse webSitesInput - URL + URL removeContactDescription - Voulez-vous vraiment supprimer ce contact de votre carnet ? + Voulez-vous vraiment supprimer ce contact de votre carnet ? removeContactTitle - Confirmation de la suppression + Confirmation de la suppression + + + + ContactEdit + + removeContactDescription + Voulez-vous vraiment supprimer ce contact de votre carnet ? + + + removeContactTitle + Confirmation de la suppression + + + sipAccounts + COMPTE(S) SIP + + + sipAccountsInput + Adresse SIP + + + address + ADRESSE(S) + + + addressInput + Adresse + + + emails + EMAIL(S) + + + emailsInput + Adresse e-mail + + + webSites + SITE(S) WEB + + + webSitesInput + URL diff --git a/tests/resources.qrc b/tests/resources.qrc index c293c6a01..34df0af51 100644 --- a/tests/resources.qrc +++ b/tests/resources.qrc @@ -54,6 +54,9 @@ assets/images/hangup_hovered.svg assets/images/hangup_normal.svg assets/images/hangup_pressed.svg + assets/images/history_hovered.svg + assets/images/history_normal.svg + assets/images/history_pressed.svg assets/images/history.svg assets/images/home_normal.svg assets/images/home_selected.svg @@ -206,7 +209,7 @@ ui/views/App/Calls/Incall.qml ui/views/App/Calls/IncomingCall.qml ui/views/App/Calls/OutgoingCall.qml - ui/views/App/MainWindow/Contact.qml + ui/views/App/MainWindow/ContactEdit.qml ui/views/App/MainWindow/Contacts.qml ui/views/App/MainWindow/Conversation.qml ui/views/App/MainWindow/Home.qml @@ -215,6 +218,7 @@ ui/views/App/NewCall.qml ui/views/App/qmldir 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 ui/views/App/Styles/MainWindow/MainWindowStyle.qml diff --git a/tests/ui/views/App/MainWindow/Contact.qml b/tests/ui/views/App/MainWindow/Contact.qml deleted file mode 100644 index fc82f0e91..000000000 --- a/tests/ui/views/App/MainWindow/Contact.qml +++ /dev/null @@ -1,119 +0,0 @@ -import QtQuick 2.7 -import QtQuick.Controls 2.0 -import QtQuick.Layouts 1.3 - -import Common 1.0 -import Linphone 1.0 -import Utils 1.0 - -ColumnLayout { - spacing: 0 - - Rectangle { - Layout.fillWidth: true - Layout.preferredHeight: 102 - color: '#D1D1D1' - - RowLayout { - anchors.left: parent.left - anchors.leftMargin: 40 - anchors.right: parent.right - anchors.rightMargin: 10 - anchors.verticalCenter: parent.verticalCenter - height: 80 - spacing: 0 - width: parent.width - - Avatar { - Layout.fillHeight: true - Layout.preferredWidth: 80 - Layout.rightMargin: 30 - presenceLevel: Presence.Online // TODO: Use C++. - username: 'Cameron Andrews' // TODO: Use C++. - } - - // TODO: Replace by text edit. - // Component: EditableContactDescription. - ContactDescription { - Layout.fillHeight: true - Layout.fillWidth: true - username: 'Cameron Andrews' // TODO: Use C++. - } - - ActionBar { - iconSize: 32 - Layout.alignment: Qt.AlignBottom | Qt.AlignRight - - ActionButton { - icon: 'history' - onClicked: window.setView('Conversation') - } - - ActionButton { - icon: 'delete' - onClicked: Utils.openConfirmDialog(this, { - descriptionText: qsTr('removeContactDescription'), - exitHandler: function (status) { - if (status) { - window.setView('Home') - } - }, - title: qsTr('removeContactTitle') - }) - } - } - } - } - - Flickable { - Layout.fillHeight: true - Layout.fillWidth: true - ScrollBar.vertical: ForceScrollBar {} - boundsBehavior: Flickable.StopAtBounds - clip: true - contentHeight: content.height - flickableDirection: Flickable.VerticalFlick - - ColumnLayout { - anchors.left: parent.left - anchors.margins: 20 - anchors.right: parent.right - id: content - - ListForm { - title: qsTr('sipAccounts') - model: ListModel { - ListElement { $value: 'merinos@sip.linphone.org' } - ListElement { $value: 'elisabeth.pro@sip.linphone.org' } - } - placeholder: qsTr('sipAccountsInput') - } - - ListForm { - title: qsTr('address') - model: ListModel { - ListElement { $value: '312 East 10th Street - New York, NY 1009' } - } - placeholder: qsTr('addressInput') - } - - ListForm { - title: qsTr('emails') - model: ListModel { - ListElement { $value: 'e.meri@gmail.com' } - ListElement { $value: 'toto@truc.machin' } - } - placeholder: qsTr('emailsInput') - } - - ListForm { - title: qsTr('webSites') - model: ListModel { - ListElement { $value: 'www.totogro.com' } - ListElement { $value: 'www.404.unknown' } - } - placeholder: qsTr('webSitesInput') - } - } - } -} diff --git a/tests/ui/views/App/MainWindow/ContactEdit.qml b/tests/ui/views/App/MainWindow/ContactEdit.qml new file mode 100644 index 000000000..c512a1614 --- /dev/null +++ b/tests/ui/views/App/MainWindow/ContactEdit.qml @@ -0,0 +1,157 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 + +import Common 1.0 +import Linphone 1.0 +import LinphoneUtils 1.0 +import Utils 1.0 + +import App.Styles 1.0 + +// =================================================================== + +ColumnLayout { + id: contactEdit + + property string sipAddress: '' + + property var _contact: ContactsListModel.mapSipAddressToContact( + sipAddress + ) || sipAddress + + // ----------------------------------------------------------------- + + function _removeContact () { + Utils.openConfirmDialog(this, { + descriptionText: qsTr('removeContactDescription'), + exitHandler: function (status) { + if (status) { + ContactsListModel.removeContact(_contact) + window.setView('Home') + } + }, + title: qsTr('removeContactTitle') + }) + } + + // ----------------------------------------------------------------- + + spacing: 0 + + // ----------------------------------------------------------------- + // Info bar. + // ----------------------------------------------------------------- + + Rectangle { + Layout.fillWidth: true + Layout.preferredHeight: ContactEditStyle.infoBar.height + color: ContactEditStyle.infoBar.color + + RowLayout { + anchors { + fill: parent + leftMargin: ContactEditStyle.infoBar.leftMargin + rightMargin: ContactEditStyle.infoBar.rightMargin + } + + spacing: ContactEditStyle.infoBar.spacing + + Avatar { + id: avatar + + height: ContactEditStyle.infoBar.avatarSize + width: ContactEditStyle.infoBar.avatarSize + + username: LinphoneUtils.getContactUsername(_contact) + } + + Text { + Layout.fillWidth: true + color: ContactEditStyle.infoBar.username.color + elide: Text.ElideRight + + font { + bold: true + pointSize: ContactEditStyle.infoBar.username.fontSize + } + + text: avatar.username + } + + ActionBar { + Layout.alignment: Qt.AlignRight + iconSize: ContactEditStyle.infoBar.buttons.size + spacing: ContactEditStyle.infoBar.buttons.spacing + + ActionButton { + icon: 'history' + onClicked: window.setView('Conversation', { + sipAddress: contactEdit.sipAddress + }) + } + + ActionButton { + icon: 'delete' + onClicked: _removeContact() + } + } + } + } + + // ----------------------------------------------------------------- + // Info list. + // ----------------------------------------------------------------- + + Flickable { + Layout.fillHeight: true + Layout.fillWidth: true + ScrollBar.vertical: ForceScrollBar {} + boundsBehavior: Flickable.StopAtBounds + clip: true + contentHeight: content.height + flickableDirection: Flickable.VerticalFlick + + ColumnLayout { + anchors.left: parent.left + anchors.margins: 20 + anchors.right: parent.right + id: content + + ListForm { + title: qsTr('sipAccounts') + model: ListModel { + ListElement { $value: 'merinos@sip.linphone.org' } + ListElement { $value: 'elisabeth.pro@sip.linphone.org' } + } + placeholder: qsTr('sipAccountsInput') + } + + ListForm { + title: qsTr('address') + model: ListModel { + ListElement { $value: '312 East 10th Street - New York, NY 1009' } + } + placeholder: qsTr('addressInput') + } + + ListForm { + title: qsTr('emails') + model: ListModel { + ListElement { $value: 'e.meri@gmail.com' } + ListElement { $value: 'toto@truc.machin' } + } + placeholder: qsTr('emailsInput') + } + + ListForm { + title: qsTr('webSites') + model: ListModel { + ListElement { $value: 'www.totogro.com' } + ListElement { $value: 'www.404.unknown' } + } + placeholder: qsTr('webSitesInput') + } + } + } +} diff --git a/tests/ui/views/App/MainWindow/Contacts.qml b/tests/ui/views/App/MainWindow/Contacts.qml index 0f5b1fc8c..bf8c61d67 100644 --- a/tests/ui/views/App/MainWindow/Contacts.qml +++ b/tests/ui/views/App/MainWindow/Contacts.qml @@ -61,7 +61,7 @@ ColumnLayout { TextButtonB { text: qsTr('addContact') - onClicked: window.setView('Contact') + onClicked: window.setView('ContactEdit') } } } @@ -208,7 +208,9 @@ ColumnLayout { : Qt.ArrowCursor hoverEnabled: true - onClicked: window.setView('Contact') + onClicked: window.setView('ContactEdit', { + sipAddress: $contact.sipAddress + }) } } diff --git a/tests/ui/views/App/MainWindow/Conversation.qml b/tests/ui/views/App/MainWindow/Conversation.qml index 8c46f0601..c51fb144f 100644 --- a/tests/ui/views/App/MainWindow/Conversation.qml +++ b/tests/ui/views/App/MainWindow/Conversation.qml @@ -96,7 +96,9 @@ ColumnLayout { icon: 'contact_edit' iconSize: ConversationStyle.bar.actions.edit.iconSize - onClicked: window.setView('Contact') + onClicked: window.setView('ContactEdit', { + sipAddress: conversation.sipAddress + }) } ActionButton { diff --git a/tests/ui/views/App/Styles/MainWindow/ContactEditStyle.qml b/tests/ui/views/App/Styles/MainWindow/ContactEditStyle.qml new file mode 100644 index 000000000..3c80d9eea --- /dev/null +++ b/tests/ui/views/App/Styles/MainWindow/ContactEditStyle.qml @@ -0,0 +1,27 @@ +pragma Singleton +import QtQuick 2.7 + +import Common 1.0 + +// =================================================================== + +QtObject { + property QtObject infoBar: QtObject { + property color color: '#F4F4F4' + property int avatarSize: 60 + property int height: 80 + property int leftMargin: 40 + property int rightMargin: 20 + property int spacing: 20 + + property QtObject buttons: QtObject { + property int size: 40 + property int spacing: 20 + } + + property QtObject username: QtObject { + property color color: '#4B5964' + property int fontSize: 13 + } + } +} diff --git a/tests/ui/views/App/Styles/qmldir b/tests/ui/views/App/Styles/qmldir index 8e08ee53a..ed402eb70 100644 --- a/tests/ui/views/App/Styles/qmldir +++ b/tests/ui/views/App/Styles/qmldir @@ -6,6 +6,7 @@ module App.Styles singleton StartingCallStyle 1.0 Calls/StartingCallStyle.qml +singleton ContactEditStyle 1.0 MainWindow/ContactEditStyle.qml singleton ContactsStyle 1.0 MainWindow/ContactsStyle.qml singleton ConversationStyle 1.0 MainWindow/ConversationStyle.qml singleton MainWindowStyle 1.0 MainWindow/MainWindowStyle.qml