diff --git a/tests/languages/en.ts b/tests/languages/en.ts index fba37750c..cf2a189a8 100644 --- a/tests/languages/en.ts +++ b/tests/languages/en.ts @@ -9,11 +9,19 @@ - mainWindow + home mainSearchBarPlaceholder Search contact, start call, start chat... + + homeEntry + Home + + + contactsEntry + Contacts + manageAccounts diff --git a/tests/languages/fr.ts b/tests/languages/fr.ts index 3cc175a8c..adc0a0c2c 100644 --- a/tests/languages/fr.ts +++ b/tests/languages/fr.ts @@ -9,11 +9,19 @@ - mainWindow + home mainSearchBarPlaceholder Chercher contact, commencer appel ou chat... + + homeEntry + Accueil + + + contactsEntry + Contacts + manageAccounts diff --git a/tests/linphone.pro b/tests/linphone.pro index b912b7512..c1fe385f5 100644 --- a/tests/linphone.pro +++ b/tests/linphone.pro @@ -25,7 +25,8 @@ lupdate_only{ ui/components/form/*.qml \ ui/components/misc/*.qml \ ui/components/select/*.qml \ - ui/views/*.qml + ui/views/*.qml \ + ui/views/home/*.qml } RESOURCES += \ diff --git a/tests/resources.qrc b/tests/resources.qrc index 6d20c1bd5..1807c2c95 100644 --- a/tests/resources.qrc +++ b/tests/resources.qrc @@ -9,14 +9,14 @@ ui/components/dialog/DialogPlus.qml ui/components/form/Collapse.qml ui/components/form/DialogButton.qml - ui/components/form/RoundButton.qml ui/components/form/ToolBarButton.qml ui/components/form/TransparentComboBox.qml ui/components/misc/Contact.qml + ui/components/misc/MenuEntry.qml ui/components/select/SelectContact.qml - ui/views/mainWindow.qml + ui/views/home/home.qml ui/views/manageAccounts.qml ui/views/newCall.qml diff --git a/tests/src/main.cpp b/tests/src/main.cpp index 71a2c6359..86506d3d1 100644 --- a/tests/src/main.cpp +++ b/tests/src/main.cpp @@ -8,7 +8,7 @@ int main (int argc, char *argv[]) { App app(argc, argv); - QQmlApplicationEngine engine(QUrl("qrc:/ui/views/mainWindow.qml")); + QQmlApplicationEngine engine(QUrl("qrc:/ui/views/home/home.qml")); if (engine.rootObjects().isEmpty()) return EXIT_FAILURE; diff --git a/tests/ui/components/dialog/DialogDescription.qml b/tests/ui/components/dialog/DialogDescription.qml index 69650bb74..bd459aafd 100644 --- a/tests/ui/components/dialog/DialogDescription.qml +++ b/tests/ui/components/dialog/DialogDescription.qml @@ -3,8 +3,8 @@ import QtQuick 2.7 // =================================================================== Item { - property alias text: description.text property alias fontSize: description.font.pointSize + property alias text: description.text height: text ? 90 : 25 diff --git a/tests/ui/components/dialog/DialogPlus.qml b/tests/ui/components/dialog/DialogPlus.qml index 4d6fe5204..e68d51062 100644 --- a/tests/ui/components/dialog/DialogPlus.qml +++ b/tests/ui/components/dialog/DialogPlus.qml @@ -6,8 +6,8 @@ import QtQuick.Window 2.2 Window { default property alias contents: content.data // Required. - property alias descriptionText: description.text // Optionnal. property alias buttons: buttons.data // Required. + property alias descriptionText: description.text // Optionnal. property bool centeredButtons // Optionnal. modality: Qt.WindowModal diff --git a/tests/ui/components/form/Collapse.qml b/tests/ui/components/form/Collapse.qml index eb3025aeb..69e471ed9 100644 --- a/tests/ui/components/form/Collapse.qml +++ b/tests/ui/components/form/Collapse.qml @@ -1,18 +1,14 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 +// =================================================================== + Item { property bool enabled: false property alias image: backgroundImage.source signal collapsed (bool collapsed) - id: collapse - - // Default. - height: 50 - width: 50 - function updateCollapse () { enabled = !enabled collapsed(enabled) diff --git a/tests/ui/components/form/DialogButton.qml b/tests/ui/components/form/DialogButton.qml index cfa199665..c11eeb16b 100644 --- a/tests/ui/components/form/DialogButton.qml +++ b/tests/ui/components/form/DialogButton.qml @@ -1,6 +1,8 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 +// =================================================================== + Button { background: Rectangle { color: button.down ? '#FE5E00' : '#434343' diff --git a/tests/ui/components/form/RoundButton.qml b/tests/ui/components/form/RoundButton.qml deleted file mode 100644 index b42d3909d..000000000 --- a/tests/ui/components/form/RoundButton.qml +++ /dev/null @@ -1,12 +0,0 @@ -import QtQuick 2.7 -import QtQuick.Controls 2.0 - -Button { - property alias image: backgroundImage.source - - Image { - anchors.fill: parent - id: backgroundImage - fillMode: Image.PreserveAspectFit - } -} diff --git a/tests/ui/components/form/ToolBarButton.qml b/tests/ui/components/form/ToolBarButton.qml index 951877a9b..8e0cd07a4 100644 --- a/tests/ui/components/form/ToolBarButton.qml +++ b/tests/ui/components/form/ToolBarButton.qml @@ -1,11 +1,14 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 +// =================================================================== + ToolButton { property alias image: backgroundImage.source Image { anchors.fill: parent + fillMode: Image.PreserveAspectFit id: backgroundImage } } diff --git a/tests/ui/components/misc/MenuEntry.qml b/tests/ui/components/misc/MenuEntry.qml new file mode 100644 index 000000000..f6ace3ae8 --- /dev/null +++ b/tests/ui/components/misc/MenuEntry.qml @@ -0,0 +1,37 @@ +import QtQuick 2.7 + +Rectangle { + property alias entryName: text.text + property bool isSelected + + color: isSelected ? '#434343' : '#8E8E8E' + + Row { + anchors.fill: parent + anchors.leftMargin: 10 + anchors.rightMargin: 10 + spacing: 10 + + Image { + height: parent.height + width: 30 + } + + Text { + color: '#FFFFFF' + font.pointSize: 13 + height: parent.height + id: text + verticalAlignment: Text.AlignVCenter + } + + Image { + height: parent.height + } + } + + MouseArea { + anchors.fill: parent + onClicked: { } // TODO. + } +} diff --git a/tests/ui/components/select/SelectContact.qml b/tests/ui/components/select/SelectContact.qml index 12d154a7e..65bec4e4a 100644 --- a/tests/ui/components/select/SelectContact.qml +++ b/tests/ui/components/select/SelectContact.qml @@ -50,50 +50,50 @@ Item { // TODO: Remove, use C++ model instead. model: ListModel { ListElement { - _presence: 'connected' - _sipAddress: 'jim.williams.zzzz.yyyy.kkkk.sip.linphone.org' - _username: 'Toto' + $presence: 'connected' + $sipAddress: 'jim.williams.zzzz.yyyy.kkkk.sip.linphone.org' + $username: 'Toto' } ListElement { - _presence: 'connected' - _sipAddress: 'toto.lala.sip.linphone.org' - _username: 'Toto' + $presence: 'connected' + $sipAddress: 'toto.lala.sip.linphone.org' + $username: 'Toto' } ListElement { - _presence: 'disconnected' - _sipAddress: 'machin.truc.sip.linphone.org' - _username: 'Toto' + $presence: 'disconnected' + $sipAddress: 'machin.truc.sip.linphone.org' + $username: 'Toto' } ListElement { - _presence: 'absent' - _sipAddress: 'hey.listen.sip.linphone.org' - _username: 'Toto' + $presence: 'absent' + $sipAddress: 'hey.listen.sip.linphone.org' + $username: 'Toto' } ListElement { - _presence: 'do_not_disturb' - _sipAddress: 'valentin.cognito.sip.linphone.org' - _username: 'Toto' + $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' + $presence: 'do$not$disturb' + $sipAddress: 'charles.henri.sip.linphone.org' + $username: 'Toto' } ListElement { - _presence: 'disconnected' - _sipAddress: 'yesyes.nono.sip.linphone.org' - _username: 'Toto' + $presence: 'disconnected' + $sipAddress: 'yesyes.nono.sip.linphone.org' + $username: 'Toto' } ListElement { - _presence: 'connected' - _sipAddress: 'nsa.sip.linphone.org' - _username: 'Toto' + $presence: 'connected' + $sipAddress: 'nsa.sip.linphone.org' + $username: 'Toto' } } delegate: Contact { - sipAddress: _sipAddress - username: _username + sipAddress: $sipAddress + username: $username width: parent.width } } diff --git a/tests/ui/views/home/home.qml b/tests/ui/views/home/home.qml new file mode 100644 index 000000000..880395e1c --- /dev/null +++ b/tests/ui/views/home/home.qml @@ -0,0 +1,145 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 + +import 'qrc:/ui/components/form' +import 'qrc:/ui/components/misc' + +ApplicationWindow { + header: ToolBar { + background: Rectangle { + color: '#EAEAEA' + } + height: 70 + + RowLayout { + anchors.fill: parent + anchors.leftMargin: 20 + anchors.rightMargin: 20 + spacing: 20 + + // Collapse. + Collapse { + Layout.preferredWidth: 25 + Layout.fillHeight: parent.height + image: 'qrc:/imgs/collapse.svg' + onCollapsed: { + mainWindow.height = collapsed ? 480 : 70 + } + } + + // User info. + Column { + Layout.preferredWidth: 200 + Layout.fillHeight: parent.height + + // Username. + Text { + clip: true + color: '#5A585B' + font.weight: Font.DemiBold + height: parent.height / 2 + font.pointSize: 11 + text: 'Edward Miller' + verticalAlignment: Text.AlignBottom + width: parent.width + } + + // Sip address. + Text { + clip: true + color: '#5A585B' + height: parent.height / 2 + text: 'e.miller@sip-linphone.org' + verticalAlignment: Text.AlignTop + width: parent.width + } + } + + // User actions. + ToolBarButton { + onClicked: { + var component = Qt.createComponent('qrc:/ui/views/newCall.qml'); + if (component.status !== Component.Ready) { + console.debug('Window not ready.') + if(component.status === Component.Error) { + console.debug('Error:' + component.errorString()) + } + } else { + component.createObject(mainWindow).show() + } + } + } + + // Search. + TextField { + signal searchTextChanged (string text) + + background: Rectangle { + color: '#FFFFFF' + implicitHeight: 30 + } + id: searchText + Layout.fillWidth: true + onTextChanged: searchTextChanged(text) + placeholderText: qsTr('mainSearchBarPlaceholder') + } + + // Start conference. + ToolBarButton { + Layout.fillHeight: parent.height + Layout.preferredWidth: 32 + image: 'qrc:/imgs/start_conference.svg' + } + } + } + id: mainWindow + minimumHeight: 70 + minimumWidth: 640 + title: 'Linphone' + visible: true + + RowLayout { + anchors.fill: parent + spacing: 0 + + // Main menu. + ColumnLayout { + Layout.fillHeight: true + Layout.preferredWidth: 250 + spacing: 0 + + MenuEntry { + Layout.preferredHeight: 50 + Layout.preferredWidth: parent.width + entryName: qsTr('homeEntry') + } + + Item { Layout.preferredHeight: 2 } + + MenuEntry { + Layout.preferredHeight: 50 + Layout.preferredWidth: parent.width + entryName: qsTr('contactsEntry') + } + + Rectangle { + Layout.fillHeight: true + Layout.preferredWidth: parent.width + } + + Rectangle { + Layout.preferredWidth: 250 + Layout.preferredHeight: 70 + color: '#EAEAEA' + } + } + + // Main content. + Rectangle { + Layout.fillHeight: true + Layout.fillWidth: true + color: 'blue' + } + } +} diff --git a/tests/ui/views/mainWindow.qml b/tests/ui/views/mainWindow.qml deleted file mode 100644 index c0d89c04e..000000000 --- a/tests/ui/views/mainWindow.qml +++ /dev/null @@ -1,69 +0,0 @@ -import QtQuick 2.7 -import QtQuick.Controls 2.0 -import QtQuick.Layouts 1.3 - -import 'qrc:/ui/components/form' - -ApplicationWindow { - header: ToolBar { - background: Rectangle { - color: '#EAEAEA' - } - height: 70 - - RowLayout { - anchors.fill: parent - anchors.rightMargin: 10 - - // Collapse. - Collapse { - image: 'qrc:/imgs/collapse.svg' - onCollapsed: { - mainWindow.height = collapsed ? 480 : 70 - } - } - - // User info. - // TODO - - // User actions. - ToolBarButton { - onClicked: { - var component = Qt.createComponent('qrc:/ui/views/newCall.qml'); - if (component.status !== Component.Ready) { - console.debug('Window not ready.') - if(component.status === Component.Error) { - console.debug('Error:' + component.errorString()) - } - } else { - component.createObject(mainWindow).show() - } - } - } - - // Search. - TextField { - signal searchTextChanged (string text) - - background: Rectangle { - color: '#FFFFFF' - implicitHeight: 30 - } - id: searchText - Layout.fillWidth: true - onTextChanged: searchTextChanged(text) - placeholderText: qsTr('mainSearchBarPlaceholder') - } - - // Start conference. - ToolBarButton { - image: 'qrc:/imgs/start_conference.svg' - } - } - } - id: mainWindow - minimumHeight: 70 - minimumWidth: 640 - title: 'Linphone' - visible: true -}