diff --git a/tests/imgs/collapse.svg b/tests/imgs/collapse.svg new file mode 100644 index 000000000..661bb0bf7 --- /dev/null +++ b/tests/imgs/collapse.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/tests/imgs/start_conference.svg b/tests/imgs/start_conference.svg new file mode 100644 index 000000000..15423b983 --- /dev/null +++ b/tests/imgs/start_conference.svg @@ -0,0 +1,15 @@ + + + + options_start_conference + Rectangle 250 Copy 4 + Created with Sketch. + + + + + + + + + + \ No newline at end of file diff --git a/tests/languages/en.ts b/tests/languages/en.ts index 2000ad233..a00601d8c 100644 --- a/tests/languages/en.ts +++ b/tests/languages/en.ts @@ -2,10 +2,10 @@ - SearchBar + main_window - helloWorld - Hello World + mainSearchBarPlaceholder + Search contact, start call, start chat... diff --git a/tests/languages/fr.ts b/tests/languages/fr.ts index f11961a9c..5036bc10a 100644 --- a/tests/languages/fr.ts +++ b/tests/languages/fr.ts @@ -2,10 +2,10 @@ - SearchBar + main_window - helloWorld - Bonjour le monde + mainSearchBarPlaceholder + Chercher contact, commencer appel ou chat... diff --git a/tests/linphone.pro b/tests/linphone.pro index f56b5657d..1a413f72e 100644 --- a/tests/linphone.pro +++ b/tests/linphone.pro @@ -19,7 +19,7 @@ TRANSLATIONS = \ lupdate_only{ # Each component folder must be added explicitly. SOURCES = \ - ui/components/SearchBar/*.qml \ + ui/components/Form/*.qml \ ui/views/*.qml } diff --git a/tests/resources.qrc b/tests/resources.qrc index 8b6e72210..dbbd8d67d 100644 --- a/tests/resources.qrc +++ b/tests/resources.qrc @@ -5,7 +5,13 @@ languages/fr.qm - ui/components/SearchBar/SearchBar.qml + ui/components/Form/Collapse.qml + ui/components/Form/RoundButton.qml + ui/components/Form/ToolBarButton.qml ui/views/main_window.qml + + + imgs/collapse.svg + imgs/start_conference.svg diff --git a/tests/src/app.cpp b/tests/src/app.cpp index e05a0ab99..275c45ff0 100644 --- a/tests/src/app.cpp +++ b/tests/src/app.cpp @@ -4,6 +4,7 @@ #include "app.hpp" +#define APPLICATION_NAME "Linphone" #define LANGUAGES_PATH ":/languages/" // =================================================================== @@ -16,4 +17,7 @@ App::App(int &argc, char **argv) : QGuiApplication(argc, argv) { } else { qWarning() << "No translation found."; } + + // Set application name. + QCoreApplication::setApplicationName(APPLICATION_NAME); } diff --git a/tests/src/app.hpp b/tests/src/app.hpp index bf03a3fa5..731520f22 100644 --- a/tests/src/app.hpp +++ b/tests/src/app.hpp @@ -4,6 +4,7 @@ #include #include +// TODO: Make it Singleton. class App : public QGuiApplication { public: App (int &argc, char **argv); diff --git a/tests/ui/components/Form/Collapse.qml b/tests/ui/components/Form/Collapse.qml new file mode 100644 index 000000000..eb3025aeb --- /dev/null +++ b/tests/ui/components/Form/Collapse.qml @@ -0,0 +1,42 @@ +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) + rotate.start() + } + + Image { + anchors.fill: parent + fillMode: Image.PreserveAspectFit + id: backgroundImage + + MouseArea { + anchors.fill: parent + onClicked: updateCollapse() + } + } + + RotationAnimation { + direction: RotationAnimation.Clockwise + duration: 200 + from: enabled ? 0 : 180 + id: rotate + property: 'rotation' + target: backgroundImage + to: enabled ? 180 : 0 + } +} diff --git a/tests/ui/components/Form/RoundButton.qml b/tests/ui/components/Form/RoundButton.qml new file mode 100644 index 000000000..47db8b234 --- /dev/null +++ b/tests/ui/components/Form/RoundButton.qml @@ -0,0 +1,11 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 + +Button { + property alias image: backgroundImage.source + + Image { + anchors.fill: parent + id: backgroundImage + } +} diff --git a/tests/ui/components/Form/ToolBarButton.qml b/tests/ui/components/Form/ToolBarButton.qml new file mode 100644 index 000000000..951877a9b --- /dev/null +++ b/tests/ui/components/Form/ToolBarButton.qml @@ -0,0 +1,11 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 + +ToolButton { + property alias image: backgroundImage.source + + Image { + anchors.fill: parent + id: backgroundImage + } +} diff --git a/tests/ui/components/SearchBar/SearchBar.qml b/tests/ui/components/SearchBar/SearchBar.qml deleted file mode 100644 index af34600c6..000000000 --- a/tests/ui/components/SearchBar/SearchBar.qml +++ /dev/null @@ -1,6 +0,0 @@ -import QtQuick 2.5 - -Text { - anchors.centerIn: parent - text: qsTr('helloWorld') -} diff --git a/tests/ui/views/main_window.qml b/tests/ui/views/main_window.qml index 05a625b67..176bf68ce 100644 --- a/tests/ui/views/main_window.qml +++ b/tests/ui/views/main_window.qml @@ -2,21 +2,52 @@ import QtQuick 2.5 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.3 -import "qrc:/ui/components/SearchBar" +import 'qrc:/ui/components/Form' ApplicationWindow { - id: mainWindow - visible: true - header: ToolBar { + background: Rectangle { + color: '#EAEAEA' + } + height: 70 + RowLayout { anchors.fill: parent + anchors.rightMargin: 10 + + // Collapse. + Collapse { + image: '/imgs/collapse.svg' + onCollapsed: { + mainWindow.height = collapsed ? 480 : 70 + } + } + + // User info. + // TODO + + // 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: '/imgs/start_conference.svg' + } } } - - footer: TabBar { - - } - - SearchBar {} + id: mainWindow + minimumHeight: 70 + minimumWidth: 640 + visible: true }