diff --git a/tests/languages/en.ts b/tests/languages/en.ts index 466cc7d5b..dca2d144d 100644 --- a/tests/languages/en.ts +++ b/tests/languages/en.ts @@ -52,6 +52,25 @@ Previously + + contact + + sipAccounts + SIP ACCOUNT(S) + + + address + ADDRESS + + + emails + E-MAIL(S) + + + webSites + WEB SITE(S) + + contacts diff --git a/tests/languages/fr.ts b/tests/languages/fr.ts index 811a32ae7..08863c7cc 100644 --- a/tests/languages/fr.ts +++ b/tests/languages/fr.ts @@ -52,6 +52,25 @@ Précédemment + + contact + + sipAccounts + COMPTE(S) SIP + + + address + ADRESSE(S) + + + emails + EMAIL(S) + + + webSites + SITE(S) WEB + + contacts diff --git a/tests/resources.qrc b/tests/resources.qrc index 1e9677ab3..8361da54d 100644 --- a/tests/resources.qrc +++ b/tests/resources.qrc @@ -22,6 +22,7 @@ ui/components/form/CheckBoxText.qml ui/components/form/DropZone.qml ui/components/form/LightButton.qml + ui/components/form/ListForm.qml ui/components/form/ExclusiveButtons.qml ui/components/form/ActionBar.qml ui/components/form/ActionButton.qml diff --git a/tests/ui/components/collapse/Collapse.qml b/tests/ui/components/collapse/Collapse.qml index c059552fc..c514ce280 100644 --- a/tests/ui/components/collapse/Collapse.qml +++ b/tests/ui/components/collapse/Collapse.qml @@ -5,13 +5,13 @@ import 'qrc:/ui/components/image' // =================================================================== Item { - property bool enabled: false + property bool isCollapsed: false signal collapsed (bool collapsed) function updateCollapse () { - enabled = !enabled - collapsed(enabled) + isCollapsed = !isCollapsed + collapsed(isCollapsed) rotate.start() } @@ -29,10 +29,10 @@ Item { RotationAnimation { direction: RotationAnimation.Clockwise duration: 200 - from: enabled ? 0 : 180 + from: isCollapsed ? 0 : 180 id: rotate property: 'rotation' target: backgroundImage - to: enabled ? 180 : 0 + to: isCollapsed ? 180 : 0 } } diff --git a/tests/ui/components/form/ListForm.qml b/tests/ui/components/form/ListForm.qml new file mode 100644 index 000000000..3aec038e9 --- /dev/null +++ b/tests/ui/components/form/ListForm.qml @@ -0,0 +1,104 @@ +import QtQuick 2.7 +import QtQuick.Layouts 1.3 + +RowLayout { + readonly property int lineHeight: 30 + + property alias title: text.text + + spacing: 0 + + RowLayout { + Layout.alignment: Qt.AlignTop + Layout.preferredHeight: lineHeight + spacing: 20 + + // Add item in list. + ActionButton { + Layout.preferredHeight: 16 + Layout.preferredWidth: 16 + onClicked: { + console.log(valuesModel.get(valuesModel.count - 1).$value.length) + + if (valuesModel.count === 0 || + valuesModel.get(valuesModel.count - 1).$value.length !== 0 + ) { + valuesModel.append({ $value: '' }) + } + } + } + + // List title. + Text { + Layout.preferredWidth: 130 + id: text + } + } + + // Content list. + ListView { + Layout.fillWidth: true + Layout.preferredHeight: values.count * lineHeight + id: values + interactive: false + + model: ListModel { + id: valuesModel + + ListElement { $value: 'toto' } + ListElement { $value: 'abc' } + ListElement { $value: 'machin' } + ListElement { $value: 'bidule' } + ListElement { $value: 'truc' } + } + + delegate: Item { + implicitHeight: textEdit.height + width: parent.width + + Rectangle { + color: textEdit.focus ? '#E6E6E6' : 'transparent' + id: background + implicitHeight: textEdit.height + implicitWidth: textEdit.contentWidth + textEdit.padding * 2 + } + + Text { + anchors.fill: textEdit + color: '#5A585B' + font.italic: true + padding: textEdit.padding + text: textEdit.text.length === 0 && !textEdit.focus + ? qsTr('fillPlaceholder') + : '' + verticalAlignment: Text.AlignVCenter + } + + TextEdit { + color: focus ? '#000000' : '#5A585B' + font.bold: !focus + height: lineHeight + id: textEdit + padding: 10 + selectByMouse: true + text: $value + verticalAlignment: TextEdit.AlignVCenter + width: parent.width + + // To handle editingFinished, it's necessary to set + // focus on another component. + Keys.onReturnPressed: parent.forceActiveFocus() + + onEditingFinished: { + if (text.length === 0) { + valuesModel.remove(index) + } + + // Hack: The edition is finished but the focus + // can be set. + focus = false + } + } + } + } +} diff --git a/tests/ui/components/timeline/Timeline.qml b/tests/ui/components/timeline/Timeline.qml index 77b205c08..c340cb5b5 100644 --- a/tests/ui/components/timeline/Timeline.qml +++ b/tests/ui/components/timeline/Timeline.qml @@ -13,7 +13,7 @@ ColumnLayout { Image { fillMode: Image.PreserveAspectFit height: parent.height - width: 30 + width: 20 } Text { diff --git a/tests/ui/views/mainWindow/contact.qml b/tests/ui/views/mainWindow/contact.qml new file mode 100644 index 000000000..a687d4860 --- /dev/null +++ b/tests/ui/views/mainWindow/contact.qml @@ -0,0 +1,49 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 + +import 'qrc:/ui/components/form' +import 'qrc:/ui/components/scrollBar' + +ColumnLayout { + spacing: 0 + + Rectangle { + Layout.fillWidth: true + Layout.preferredHeight: 102 + color: '#D1D1D1' + } + + 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') + } + + ListForm { + title: qsTr('address') + } + + ListForm { + title: qsTr('emails') + } + + ListForm { + title: qsTr('webSites') + } + } + } +} diff --git a/tests/ui/views/mainWindow/conversation.qml b/tests/ui/views/mainWindow/conversation.qml index 68d8cd89a..d29910db9 100644 --- a/tests/ui/views/mainWindow/conversation.qml +++ b/tests/ui/views/mainWindow/conversation.qml @@ -10,6 +10,7 @@ import 'qrc:/ui/components/chat' ColumnLayout { spacing: 0 + // Contact bar. Rectangle { Layout.fillWidth: true Layout.preferredHeight: 102 @@ -84,6 +85,7 @@ ColumnLayout { } } + // Messages/Calls filter. Rectangle { Layout.fillWidth: true Layout.preferredHeight: 40 diff --git a/tests/ui/views/mainWindow/mainWindow.qml b/tests/ui/views/mainWindow/mainWindow.qml index 272cca599..419bbee74 100644 --- a/tests/ui/views/mainWindow/mainWindow.qml +++ b/tests/ui/views/mainWindow/mainWindow.qml @@ -12,8 +12,9 @@ import 'qrc:/ui/scripts/utils.js' as Utils ApplicationWindow { id: mainWindow + maximumHeight: 70 minimumHeight: 70 - minimumWidth: 780 + minimumWidth: 700 title: 'Linphone' visible: true @@ -33,9 +34,11 @@ ApplicationWindow { Collapse { Layout.preferredWidth: 25 Layout.fillHeight: parent.height - onCollapsed: { - mainWindow.height = collapsed ? 500 : 70 - } + id: collapse + + onCollapsed: mainWindowStates.state = collapsed + ? 'collapsed' + : '' } // User info. @@ -85,33 +88,33 @@ ApplicationWindow { // Main menu. ColumnLayout { Layout.fillHeight: true - Layout.preferredWidth: 250 Layout.maximumWidth: 250 + Layout.preferredWidth: 250 spacing: 0 MenuEntry { + Layout.fillWidth: true Layout.preferredHeight: 50 - Layout.preferredWidth: parent.width entryName: qsTr('homeEntry') } Item { Layout.preferredHeight: 2 } MenuEntry { + Layout.fillWidth: true Layout.preferredHeight: 50 - Layout.preferredWidth: parent.width entryName: qsTr('contactsEntry') } // History. Timeline { Layout.fillHeight: true - Layout.preferredWidth: parent.width + Layout.fillWidth: true } // Logo. Rectangle { - Layout.preferredWidth: parent.width + Layout.fillWidth: true Layout.preferredHeight: 70 color: '#EAEAEA' } @@ -121,7 +124,23 @@ ApplicationWindow { Loader { Layout.fillHeight: true Layout.fillWidth: true - source: 'qrc:/ui/views/mainWindow/home.qml' + source: 'qrc:/ui/views/mainWindow/contact.qml' + } + } + + StateGroup { + id: mainWindowStates + + states: State { + name: 'collapsed' + + PropertyChanges { + height: 480 + maximumHeight: 99999 + maximumWidth: 99999 + minimumHeight: 480 + target: mainWindow + } } } }