diff --git a/Linphone/core/App.cpp b/Linphone/core/App.cpp index e37f0b8a4..867c6fdb0 100644 --- a/Linphone/core/App.cpp +++ b/Linphone/core/App.cpp @@ -108,6 +108,12 @@ void App::initCppInterfaces() { LinphoneEnums::registerMetaTypes(); } +void App::registerToolTypes() { + qmlRegisterSingletonType( + "ConstantsCpp", 1, 0, "ConstantsCpp", + [](QQmlEngine *engine, QJSEngine *) -> QObject * { return new Constants(engine); }); +} + //------------------------------------------------------------ void App::clean() { diff --git a/Linphone/data/CMakeLists.txt b/Linphone/data/CMakeLists.txt index 75f3feb86..333e4d4d2 100644 --- a/Linphone/data/CMakeLists.txt +++ b/Linphone/data/CMakeLists.txt @@ -15,4 +15,4 @@ list(APPEND _LINPHONEAPP_RC_FILES data/assistant/use-app-sip-account.rc "data/image/return-arrow.svg" ) -set(_LINPHONEAPP_RC_FILES ${_LINPHONEAPP_RC_FILES} PARENT_SCOPE) \ No newline at end of file +set(_LINPHONEAPP_RC_FILES ${_LINPHONEAPP_RC_FILES} PARENT_SCOPE) diff --git a/Linphone/tool/providers/ImageProvider.cpp b/Linphone/tool/providers/ImageProvider.cpp index 4eb0ef153..4fcba6668 100644 --- a/Linphone/tool/providers/ImageProvider.cpp +++ b/Linphone/tool/providers/ImageProvider.cpp @@ -82,4 +82,4 @@ QQuickTextureFactory *ImageAsyncImageResponse::textureFactory() const { QQuickImageResponse *ImageProvider::requestImageResponse(const QString &id, const QSize &requestedSize) { ImageAsyncImageResponse *response = new ImageAsyncImageResponse(id, requestedSize); return response; -} \ No newline at end of file +} diff --git a/Linphone/view/App/Main.qml b/Linphone/view/App/Main.qml index 1558ab05b..d6db0bb45 100644 --- a/Linphone/view/App/Main.qml +++ b/Linphone/view/App/Main.qml @@ -37,4 +37,4 @@ Window { } } } - \ No newline at end of file + diff --git a/Linphone/view/Item/FormComboBoxCell.qml b/Linphone/view/Item/FormComboBoxCell.qml new file mode 100644 index 000000000..bcf9b94ea --- /dev/null +++ b/Linphone/view/Item/FormComboBoxCell.qml @@ -0,0 +1,77 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts 1.0 +import Linphone + +ColumnLayout { + id: cellLayout + property string label: "" + property int backgroundWidth: 200 + property variant modelList: [] + + Layout.bottomMargin: 8 + Text { + verticalAlignment: Text.AlignVCenter + text: cellLayout.label + color: DefaultStyle.formItemLabelColor + font { + pointSize: DefaultStyle.formItemLabelSize + bold: true + } + } + + ComboBox { + id: combobox + model: cellLayout.modelList + background: Loader { + sourceComponent: backgroundRectangle + } + contentItem: Text { + leftPadding: 10 + text: combobox.displayText + font.family: DefaultStyle.defaultFont + font.pointSize: DefaultStyle.formItemLabelSize + color: DefaultStyle.formItemLabelColor + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } + + indicator: Image { + x: combobox.width - width - combobox.rightPadding + y: combobox.topPadding + (combobox.availableHeight - height) / 2 + source: AppIcons.downArrow + // width: 12 + // height: 8 + } + + popup: Popup { + y: combobox.height - 1 + width: combobox.width + implicitHeight: contentItem.implicitHeight + padding: 1 + + contentItem: ListView { + clip: true + implicitHeight: contentHeight + model: combobox.popup.visible ? combobox.delegateModel : null + currentIndex: combobox.highlightedIndex + + ScrollIndicator.vertical: ScrollIndicator { } + } + + background: Loader { + sourceComponent: backgroundRectangle + } + } + Component { + id: backgroundRectangle + Rectangle { + implicitWidth: cellLayout.backgroundWidth + implicitHeight: 30 + radius: 20 + color: DefaultStyle.formItemBackgroundColor + opacity: 0.7 + } + } + } +} \ No newline at end of file diff --git a/Linphone/view/Item/FormTextInputCell.qml b/Linphone/view/Item/FormTextInputCell.qml new file mode 100644 index 000000000..9a117a339 --- /dev/null +++ b/Linphone/view/Item/FormTextInputCell.qml @@ -0,0 +1,62 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts 1.0 +import Linphone + +ColumnLayout { + id: cellLayout + Layout.bottomMargin: 8 + + property string label: "" + property string defaultText : "" + property bool mandatory: false + property bool hidden: false + property int textInputWidth: 200 + readonly property string inputText: textField.text + + Text { + verticalAlignment: Text.AlignVCenter + text: cellLayout.label + (cellLayout.mandatory ? "*" : "") + color: DefaultStyle.formItemLabelColor + font { + pointSize: DefaultStyle.formItemLabelSize + bold: true + } + } + + Rectangle { + implicitWidth: cellLayout.textInputWidth + implicitHeight: 30 + // anchors.fill: parent + radius: 20 + color: DefaultStyle.formItemBackgroundColor + opacity: 0.7 + TextField { + id: textField + anchors.left: parent.left + anchors.right: eyeButton.visible ? eyeButton.left : parent.right + anchors.verticalCenter: parent.verticalCenter + placeholderText: cellLayout.defaultText + echoMode: (cellLayout.hidden && !eyeButton.checked) ? TextInput.Password : TextInput.Normal + font.family: DefaultStyle.defaultFont + font.pointSize: DefaultStyle.formTextInputSize + color: DefaultStyle.formItemLabelColor + background: Item { + opacity: 0. + } + } + Button { + id: eyeButton + visible: cellLayout.hidden + checkable: true + background: Rectangle { + color: "transparent" + } + anchors.right: parent.right + contentItem: Image { + fillMode: Image.PreserveAspectFit + source: eyeButton.checked ? AppIcons.eyeHide : AppIcons.eyeShow + } + } + } +} \ No newline at end of file diff --git a/Linphone/view/Page/Login/LoginLayout.qml b/Linphone/view/Page/Login/LoginLayout.qml new file mode 100644 index 000000000..6f89c9b1e --- /dev/null +++ b/Linphone/view/Page/Login/LoginLayout.qml @@ -0,0 +1,70 @@ +/** +* Qml template used for welcome and login/register pages +**/ + +import QtQuick 2.15 +import QtQuick.Layouts 1.3 +import QtQuick.Controls 2.2 as Control + +import Linphone + +Item { + id: mainItem + property alias titleContent : titleLayout.children + property alias centerContent : centerLayout.children + + ColumnLayout { + anchors.fill: parent + Layout.fillHeight: true + ColumnLayout { + Layout.rightMargin: 25 + RowLayout { + Layout.fillWidth: true + Layout.preferredHeight: 50 + Layout.topMargin: 20 + Layout.bottomMargin: 20 + Layout.alignment: Qt.AlignRight | Qt.AlignTop + Control.Button { + background: Rectangle { + color: "transparent" + } + contentItem: Image { + fillMode: Image.PreserveAspectFit + source: AppIcons.info + } + onClicked: console.debug("[LoginLayout] open about popup") + } + + Text { + Layout.alignment: Qt.AlignRight |Qt.AlignVCenter + text: "About" + font.pixelSize: 12 + color: DefaultStyle.grayColor + } + } + RowLayout { + id: titleLayout + Layout.leftMargin: 40 + Layout.bottomMargin: 20 + } + ColumnLayout { + id: centerLayout + Layout.leftMargin: 40 + Layout.fillHeight: true + Layout.topMargin: 20 + } + } + + RowLayout { + Layout.alignment: Qt.AlignBottom + Image { + Layout.minimumHeight: 80 + Layout.fillWidth: true + source: AppIcons.belldonne + fillMode: Image.Stretch + } + + } + } +} + diff --git a/Linphone/view/Style/AppIcons.qml b/Linphone/view/Style/AppIcons.qml index bbc0ef7dd..ed0d5ae56 100644 --- a/Linphone/view/Style/AppIcons.qml +++ b/Linphone/view/Style/AppIcons.qml @@ -13,4 +13,4 @@ QtObject { property string loginImage: "image://internal/login-image.svg" property string belledonne: "image://internal/belledonne.svg" property string profile: "image://internal/profil.svg" -} \ No newline at end of file +} diff --git a/Linphone/view/Style/DefaultStyle.qml b/Linphone/view/Style/DefaultStyle.qml index adc5b05ba..a4e3cf24e 100644 --- a/Linphone/view/Style/DefaultStyle.qml +++ b/Linphone/view/Style/DefaultStyle.qml @@ -25,4 +25,4 @@ QtObject { property int defaultFontPointSize: 10 property int title1FontPointSize: 40 property int title2FontPointSize: 20 -} \ No newline at end of file +}