From 6a730dd6c28b806a2c956a4b6c0f90a7b41dfc1c Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Mon, 12 Sep 2016 14:52:59 +0200 Subject: [PATCH] feat(mainWindow): home view implemented --- tests/languages/en.ts | 23 ++++++ tests/languages/fr.ts | 23 ++++++ tests/linphone.pro | 2 +- tests/resources.qrc | 4 +- tests/src/main.cpp | 2 +- tests/ui/components/form/DialogButton.qml | 15 +++- tests/ui/components/form/DialogCheckBox.qml | 34 +++++++++ tests/ui/views/mainWindow/home.qml | 75 +++++++++++++++++++ .../home.qml => mainWindow/mainWindow.qml} | 12 +-- 9 files changed, 178 insertions(+), 12 deletions(-) create mode 100644 tests/ui/components/form/DialogCheckBox.qml create mode 100644 tests/ui/views/mainWindow/home.qml rename tests/ui/views/{home/home.qml => mainWindow/mainWindow.qml} (94%) diff --git a/tests/languages/en.ts b/tests/languages/en.ts index cf2a189a8..bff3b1a10 100644 --- a/tests/languages/en.ts +++ b/tests/languages/en.ts @@ -10,6 +10,29 @@ home + + displayTooltip + Display tooltips to discover Linphone Desktop + + + invitContactQuestion + Are your friends already know Linphone? + + + invitContact + INVIT YOUR FRIENDS + + + addContactQuestion + Quickly add your contacts in your notebook. + + + addContact + ADD CONTACTS + + + + mainWindow mainSearchBarPlaceholder Search contact, start call, start chat... diff --git a/tests/languages/fr.ts b/tests/languages/fr.ts index adc0a0c2c..b8e00eb17 100644 --- a/tests/languages/fr.ts +++ b/tests/languages/fr.ts @@ -10,6 +10,29 @@ home + + displayTooltip + Afficher les tooltips pour découvrir Linphone Desktop + + + invitContactQuestion + Vos amis connaissent-ils déjà Linphone ? + + + invitContact + INVITER VOS AMIS + + + addContactQuestion + Ajouter vos contacts dans votre carnet d'adresses. + + + addContact + AJOUTER CONTACTS + + + + mainWindow mainSearchBarPlaceholder Chercher contact, commencer appel ou chat... diff --git a/tests/linphone.pro b/tests/linphone.pro index c1fe385f5..927c46f77 100644 --- a/tests/linphone.pro +++ b/tests/linphone.pro @@ -26,7 +26,7 @@ lupdate_only{ ui/components/misc/*.qml \ ui/components/select/*.qml \ ui/views/*.qml \ - ui/views/home/*.qml + ui/views/mainWindow/*.qml } RESOURCES += \ diff --git a/tests/resources.qrc b/tests/resources.qrc index 1807c2c95..b24185f1a 100644 --- a/tests/resources.qrc +++ b/tests/resources.qrc @@ -9,6 +9,7 @@ ui/components/dialog/DialogPlus.qml ui/components/form/Collapse.qml ui/components/form/DialogButton.qml + ui/components/form/DialogCheckBox.qml ui/components/form/ToolBarButton.qml ui/components/form/TransparentComboBox.qml ui/components/misc/Contact.qml @@ -16,7 +17,8 @@ ui/components/select/SelectContact.qml - ui/views/home/home.qml + ui/views/mainWindow/home.qml + ui/views/mainWindow/mainWindow.qml ui/views/manageAccounts.qml ui/views/newCall.qml diff --git a/tests/src/main.cpp b/tests/src/main.cpp index 86506d3d1..02a01ceab 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/home/home.qml")); + QQmlApplicationEngine engine(QUrl("qrc:/ui/views/mainWindow/mainWindow.qml")); if (engine.rootObjects().isEmpty()) return EXIT_FAILURE; diff --git a/tests/ui/components/form/DialogButton.qml b/tests/ui/components/form/DialogButton.qml index c11eeb16b..839b9847a 100644 --- a/tests/ui/components/form/DialogButton.qml +++ b/tests/ui/components/form/DialogButton.qml @@ -4,15 +4,22 @@ import QtQuick.Controls 2.0 // =================================================================== Button { + property string backgroundColor: '#434343' + property string textColor: '#FFFFFF' + background: Rectangle { - color: button.down ? '#FE5E00' : '#434343' - implicitWidth: 120 + color: button.down ? '#FE5E00' : backgroundColor + implicitHeight: 30 + implicitWidth: 160 radius: 4 } contentItem: Text { - color: '#FFFFFF' - text: button.text + color: button.down ? '#FFFFFF' : textColor + font.pointSize: 8 + font.weight: Font.DemiBold horizontalAlignment: Text.AlignHCenter + id: text + text: button.text verticalAlignment: Text.AlignVCenter } id: button diff --git a/tests/ui/components/form/DialogCheckBox.qml b/tests/ui/components/form/DialogCheckBox.qml new file mode 100644 index 000000000..58c06f759 --- /dev/null +++ b/tests/ui/components/form/DialogCheckBox.qml @@ -0,0 +1,34 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 + +// =================================================================== + +CheckBox { + id: checkBox + indicator: Rectangle { + border.color: checkBox.down ? '#FE5E00' : '#8E8E8E' + implicitHeight: 18 + implicitWidth: 18 + radius: 3 + x: checkBox.leftPadding + y: parent.height / 2 - height / 2 + + Rectangle { + color: checkBox.down ? '#FE5E00' : '#8E8E8E' + height: 10 + radius: 2 + visible: checkBox.checked + width: 10 + x: 4 + y: 4 + } + } + contentItem: Text { + color: checkBox.down ? '#FE5E00' : '#8E8E8E' + font: checkBox.font + horizontalAlignment: Text.AlignHCenter + leftPadding: checkBox.indicator.width + checkBox.spacing + text: checkBox.text + verticalAlignment: Text.AlignVCenter + } +} diff --git a/tests/ui/views/mainWindow/home.qml b/tests/ui/views/mainWindow/home.qml new file mode 100644 index 000000000..303612033 --- /dev/null +++ b/tests/ui/views/mainWindow/home.qml @@ -0,0 +1,75 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 + +import 'qrc:/ui/components/form' + +// =================================================================== + +ColumnLayout { + spacing: 0 + + Item { + Layout.fillWidth: true + Layout.fillHeight: true + + Item { + anchors.fill: parent + anchors.leftMargin: 50 + anchors.topMargin: 50 + + Column { + spacing: 30 + + // Invit friends. + Column { + spacing: 8 + + Text { + text: qsTr('invitContactQuestion') + font.weight: Font.DemiBold + color: '#5A585B' + font.pointSize: 11 + } + + DialogButton { + backgroundColor: '#D1D1D1' + text: qsTr('invitContact') + textColor: '#5A585B' + } + } + + // Add contacts. + Column { + spacing: 8 + + Text { + text: qsTr('addContactQuestion') + font.weight: Font.DemiBold + color: '#5A585B' + font.pointSize: 11 + } + + DialogButton { + backgroundColor: '#D1D1D1' + text: qsTr('addContact') + textColor: '#5A585B' + } + } + } + } + } + + // Tooltip checkbox area. + Item { + Layout.fillWidth: true + Layout.preferredHeight: 70 + + DialogCheckBox { + anchors.left: parent.left + anchors.leftMargin: 50 + anchors.verticalCenter: parent.verticalCenter + text: qsTr('displayTooltip') + } + } +} diff --git a/tests/ui/views/home/home.qml b/tests/ui/views/mainWindow/mainWindow.qml similarity index 94% rename from tests/ui/views/home/home.qml rename to tests/ui/views/mainWindow/mainWindow.qml index 880395e1c..0eac26d30 100644 --- a/tests/ui/views/home/home.qml +++ b/tests/ui/views/mainWindow/mainWindow.qml @@ -24,7 +24,7 @@ ApplicationWindow { Layout.fillHeight: parent.height image: 'qrc:/imgs/collapse.svg' onCollapsed: { - mainWindow.height = collapsed ? 480 : 70 + mainWindow.height = collapsed ? 500 : 70 } } @@ -95,7 +95,7 @@ ApplicationWindow { } id: mainWindow minimumHeight: 70 - minimumWidth: 640 + minimumWidth: 780 title: 'Linphone' visible: true @@ -123,11 +123,13 @@ ApplicationWindow { entryName: qsTr('contactsEntry') } - Rectangle { + // History. + Item { Layout.fillHeight: true Layout.preferredWidth: parent.width } + // Logo. Rectangle { Layout.preferredWidth: 250 Layout.preferredHeight: 70 @@ -136,10 +138,10 @@ ApplicationWindow { } // Main content. - Rectangle { + Loader { Layout.fillHeight: true Layout.fillWidth: true - color: 'blue' + source: 'qrc:/ui/views/mainWindow/home.qml' } } }