From c821e797247700f6d088d35512b90b05fa3b2eea Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Thu, 15 Sep 2016 11:32:17 +0200 Subject: [PATCH] feat(mainWindow): use Timeline component --- tests/resources.qrc | 1 + tests/ui/components/select/SelectContact.qml | 4 +- tests/ui/components/timeline/Timeline.qml | 94 ++++++++++++++++++++ tests/ui/views/mainWindow/contacts.qml | 1 + tests/ui/views/mainWindow/mainWindow.qml | 8 +- 5 files changed, 103 insertions(+), 5 deletions(-) create mode 100644 tests/ui/components/timeline/Timeline.qml diff --git a/tests/resources.qrc b/tests/resources.qrc index 3a54ab526..e717cb695 100644 --- a/tests/resources.qrc +++ b/tests/resources.qrc @@ -4,6 +4,7 @@ languages/en.qm ui/components/scrollBar/ForceScrollBar.qml ui/components/misc/MenuEntry.qml + ui/components/timeline/Timeline.qml ui/components/select/SelectContact.qml ui/components/collapse/Collapse.qml ui/components/contact/Contact.qml diff --git a/tests/ui/components/select/SelectContact.qml b/tests/ui/components/select/SelectContact.qml index 7a469607f..b2a2cadc1 100644 --- a/tests/ui/components/select/SelectContact.qml +++ b/tests/ui/components/select/SelectContact.qml @@ -71,12 +71,12 @@ Item { $username: 'Toto' } ListElement { - $presence: 'do$not$disturb' + $presence: 'do_not_disturb' $sipAddress: 'valentin.cognito.sip.linphone.org' $username: 'Toto' } ListElement { - $presence: 'do$not$disturb' + $presence: 'do_not_disturb' $sipAddress: 'charles.henri.sip.linphone.org' $username: 'Toto' } diff --git a/tests/ui/components/timeline/Timeline.qml b/tests/ui/components/timeline/Timeline.qml new file mode 100644 index 000000000..77b205c08 --- /dev/null +++ b/tests/ui/components/timeline/Timeline.qml @@ -0,0 +1,94 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 + +import 'qrc:/ui/components/contact' +import 'qrc:/ui/components/scrollBar' + +ColumnLayout { + Row { + Layout.preferredHeight: 35 + spacing: 30 + + Image { + fillMode: Image.PreserveAspectFit + height: parent.height + width: 30 + } + + Text { + color: '#5A585B' + font.pointSize: 13 + height: parent.height + text: qsTr('timelineTitle') + verticalAlignment: Text.AlignVCenter + } + } + + Rectangle { + color: '#DEDEDE' + Layout.fillWidth: true + Layout.preferredHeight: 1 + } + + ListView { + Layout.fillHeight: true + Layout.fillWidth: true + ScrollBar.vertical: ForceScrollBar { } + boundsBehavior: Flickable.StopAtBounds + clip: true + highlightRangeMode: ListView.ApplyRange + spacing: 0 + + // Replace by C++ class. + model: ListModel { + ListElement { + $presence: 'connected' + $sipAddress: 'jim.williams.zzzz.yyyy.kkkk.sip.linphone.org' + $username: 'Toto' + } + ListElement { + $presence: 'connected' + $sipAddress: 'toto.lala.sip.linphone.org' + $username: 'Toto' + } + ListElement { + $presence: 'disconnected' + $sipAddress: 'machin.truc.sip.linphone.org' + $username: 'Toto' + } + ListElement { + $presence: 'absent' + $sipAddress: 'hey.listen.sip.linphone.org' + $username: 'Toto' + } + ListElement { + $presence: 'do_not_disturb' + $sipAddress: 'valentin.cognito.sip.linphone.org' + $username: 'Toto' + } + ListElement { + $presence: 'do_not_disturb' + $sipAddress: 'charles.henri.sip.linphone.org' + $username: 'Toto' + } + ListElement { + $presence: 'disconnected' + $sipAddress: 'yesyes.nono.sip.linphone.org' + $username: 'Toto' + } + ListElement { + $presence: 'connected' + $sipAddress: 'nsa.sip.linphone.org' + $username: 'Toto' + } + } + + delegate: Contact { + presence: $presence + sipAddress: $sipAddress + username: $username + width: parent.width + } + } +} diff --git a/tests/ui/views/mainWindow/contacts.qml b/tests/ui/views/mainWindow/contacts.qml index 632f40485..f7ea7af78 100644 --- a/tests/ui/views/mainWindow/contacts.qml +++ b/tests/ui/views/mainWindow/contacts.qml @@ -26,6 +26,7 @@ ColumnLayout { spacing: 20 width: parent.width + // TODO: Replace by top-level component. TextField { Layout.fillWidth: true background: Rectangle { diff --git a/tests/ui/views/mainWindow/mainWindow.qml b/tests/ui/views/mainWindow/mainWindow.qml index 7a8823115..24f05f30b 100644 --- a/tests/ui/views/mainWindow/mainWindow.qml +++ b/tests/ui/views/mainWindow/mainWindow.qml @@ -6,6 +6,7 @@ import 'qrc:/ui/components/collapse' import 'qrc:/ui/components/contact' import 'qrc:/ui/components/form' import 'qrc:/ui/components/misc' +import 'qrc:/ui/components/timeline' import 'qrc:/ui/scripts/utils.js' as Utils @@ -85,6 +86,7 @@ ApplicationWindow { ColumnLayout { Layout.fillHeight: true Layout.preferredWidth: 250 + Layout.maximumWidth: 250 spacing: 0 MenuEntry { @@ -102,14 +104,14 @@ ApplicationWindow { } // History. - Item { + Timeline { Layout.fillHeight: true Layout.preferredWidth: parent.width } // Logo. Rectangle { - Layout.preferredWidth: 250 + Layout.preferredWidth: parent.width Layout.preferredHeight: 70 color: '#EAEAEA' } @@ -119,7 +121,7 @@ ApplicationWindow { Loader { Layout.fillHeight: true Layout.fillWidth: true - source: 'qrc:/ui/views/mainWindow/contacts.qml' + source: 'qrc:/ui/views/mainWindow/conversation.qml' } } }