diff --git a/tests/linphone.pro b/tests/linphone.pro index 1b3a035cb..c9e1a22b8 100644 --- a/tests/linphone.pro +++ b/tests/linphone.pro @@ -47,6 +47,7 @@ lupdate_only{ ui/modules/Linphone/Styles/Form/*.qml \ ui/modules/Linphone/View/*.qml \ ui/views/*.qml \ + ui/views/Calls/*.qml \ ui/views/MainWindow/*.qml \ } diff --git a/tests/resources.qrc b/tests/resources.qrc index 7f99d9664..1eb7b1d15 100644 --- a/tests/resources.qrc +++ b/tests/resources.qrc @@ -55,6 +55,7 @@ ui/modules/Linphone/Image/Icon.qml ui/modules/Linphone/InvertedMouseArea.qml ui/modules/Linphone/Menu.qml + ui/modules/Linphone/Paned.qml ui/modules/Linphone/Popup/DropDownMenu.qml ui/modules/Linphone/Popup/PopupShadow.qml ui/modules/Linphone/qmldir @@ -84,6 +85,7 @@ ui/modules/Linphone/View/ScrollableListView.qml ui/scripts/Utils/qmldir ui/scripts/Utils/utils.js + ui/views/Calls/Calls.qml ui/views/MainWindow/Contact.qml ui/views/MainWindow/Contacts.qml ui/views/MainWindow/Conversation.qml diff --git a/tests/src/components/notification/Notification.hpp b/tests/src/components/notification/Notification.hpp index 8ce571154..152c1f977 100644 --- a/tests/src/components/notification/Notification.hpp +++ b/tests/src/components/notification/Notification.hpp @@ -6,7 +6,7 @@ // =================================================================== class Notification : public QObject { - Q_OBJECT + Q_OBJECT; public: Notification (QObject *parent = Q_NULLPTR); diff --git a/tests/src/main.cpp b/tests/src/main.cpp index d93250642..3382a2e50 100644 --- a/tests/src/main.cpp +++ b/tests/src/main.cpp @@ -6,7 +6,7 @@ #include #include #include - + #include #include "app.hpp" #include "components/contacts/ContactsListProxyModel.hpp" #include "components/notification/Notification.hpp" @@ -57,8 +57,10 @@ void registerTypes () { void addContextProperties (QQmlApplicationEngine &engine) { QQmlContext *context = engine.rootContext(); + QQmlComponent component(&engine, QUrl("qrc:/ui/views/Calls/Calls.qml")); context->setContextProperty("Notification", new Notification()); + context->setContextProperty("CallsWindow", component.create()); } int main (int argc, char *argv[]) { @@ -77,8 +79,10 @@ int main (int argc, char *argv[]) { engine.addImportPath(":/ui/scripts"); engine.load(QUrl("qrc:/ui/views/MainWindow/MainWindow.qml")); - if (engine.rootObjects().isEmpty()) + if (engine.rootObjects().isEmpty()) { + qWarning() << "Unable to open main window."; return EXIT_FAILURE; + } // Enable TrayIconSystem. if (!QSystemTrayIcon::isSystemTrayAvailable()) diff --git a/tests/ui/modules/Linphone/Paned.qml b/tests/ui/modules/Linphone/Paned.qml new file mode 100644 index 000000000..312dbdba3 --- /dev/null +++ b/tests/ui/modules/Linphone/Paned.qml @@ -0,0 +1,86 @@ +import QtQuick 2.7 + +Item { + id: container + + property int handleLimitLeft: 0 + property int handleLimitRight: 0 + property alias childA: contentA.data + property alias childB: contentB.data + + onWidthChanged: { + console.log('RESIZE', width, handleLimitRight) + if (contentB.width < handleLimitRight) { + console.log('lala', width, handleLimitRight, width - handle.width - handleLimitRight) + contentA.width = width - handle.width - handleLimitRight + } else if (contentA.width < handleLimitLeft) { + console.log('zaza', width, handleLimitLeft) + + contentA.width = handleLimitLeft + } else if (contentA.width >= width - handleLimitRight - 20) { + console.log('FUCK', contentA.width , width - handleLimitRight - 20) + contentA.width - handle.width - handleLimitRight + } + } + + Rectangle { + id: contentA + + color: '#FFFFFF' + height: parent.height + } + + MouseArea { + id: handle + + property int _mouseStart + + anchors.left: contentA.right + cursorShape: Qt.SplitHCursor + height: parent.height + hoverEnabled: true + width: 8 + + onMouseXChanged: { + // Necessary because `hoverEnabled` is used. + if (!pressed) { + return + } + + var offset = mouseX - _mouseStart + + if (container.width - offset - contentA.width - width < handleLimitRight) { + contentA.width = container.width - width - handleLimitRight + } else if (contentA.width + offset < handleLimitLeft) { + contentA.width = handleLimitLeft + } else { + contentA.width = contentA.width + offset + } + } + + onPressed: _mouseStart = mouseX + + Rectangle { + anchors.fill: parent + color: parent.pressed + ? '#5E5E5E' + : (parent.containsMouse + ? '#707070' + : '#C5C5C5' + ) + } + } + + Rectangle { + id: contentB + + anchors.left: handle.right + color: '#EAEAEA' + height: parent.height + width: { + + console.log('toto', container.width, contentA.width, container.width - contentA.width - handle.width) + return container.width - contentA.width - handle.width + } + } +} diff --git a/tests/ui/modules/Linphone/qmldir b/tests/ui/modules/Linphone/qmldir index 42c0147ed..d8d274e40 100644 --- a/tests/ui/modules/Linphone/qmldir +++ b/tests/ui/modules/Linphone/qmldir @@ -52,6 +52,9 @@ InvertedMouseArea 1.0 InvertedMouseArea.qml # Menu Menu 1.0 Menu.qml +# Paned +Paned 1.0 Paned.qml + # Popup DropDownMenu 1.0 Popup/DropDownMenu.qml PopupShadow 1.0 Popup/PopupShadow.qml diff --git a/tests/ui/views/Calls/Calls.qml b/tests/ui/views/Calls/Calls.qml new file mode 100644 index 000000000..96d2504d1 --- /dev/null +++ b/tests/ui/views/Calls/Calls.qml @@ -0,0 +1,27 @@ +import QtQuick 2.7 +import QtQuick.Layouts 1.3 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.0 + +import Linphone 1.0 + +Window { + minimumHeight: 480 + minimumWidth: 640 + + id: window + + Paned { + anchors.fill: parent + handleLimitLeft: parent.width *0.66 + handleLimitRight: 50 + + childA: Text { + text: 'hello' + } + + childB: Text { + text: 'hello2' + } + } +} diff --git a/tests/ui/views/MainWindow/MainWindow.qml b/tests/ui/views/MainWindow/MainWindow.qml index 30b61c959..1804ac2e4 100644 --- a/tests/ui/views/MainWindow/MainWindow.qml +++ b/tests/ui/views/MainWindow/MainWindow.qml @@ -98,7 +98,8 @@ ApplicationWindow { actions: [ ActionButton { icon: 'call' - onClicked: console.log('clicked') + onClicked: CallsWindow.show() + }, ActionButton { diff --git a/tests/ui/views/NewCall.qml b/tests/ui/views/NewCall.qml index c58bfd7fc..830ba76fb 100644 --- a/tests/ui/views/NewCall.qml +++ b/tests/ui/views/NewCall.qml @@ -4,22 +4,22 @@ import QtQuick.Controls 2.0 import Linphone 1.0 DialogPlus { - centeredButtons: true - minimumHeight: 300 - minimumWidth: 420 - title: qsTr('newCallTitle') + centeredButtons: true + minimumHeight: 300 + minimumWidth: 420 + title: qsTr('newCallTitle') - buttons: TextButtonA { - text: qsTr('cancel') - } - - Item { - anchors.fill: parent - anchors.leftMargin: 25 - anchors.rightMargin: 25 - - SelectContact { - anchors.fill: parent - } + buttons: TextButtonA { + text: qsTr('cancel') + } + + Item { + anchors.fill: parent + anchors.leftMargin: 25 + anchors.rightMargin: 25 + + SelectContact { + anchors.fill: parent } + } }