diff --git a/CMakeLists.txt b/CMakeLists.txt index d21fb8bd6c17737fff82e5828b74a58436886198..976d49cd6c0b854ea6f3a5d38df37e87b2bb7eb7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,9 +4,9 @@ project(qtuiviewer LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_AUTOUIC ON) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) +#set(CMAKE_AUTOUIC ON) +#set(CMAKE_AUTOMOC ON) +#set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -30,6 +30,8 @@ if(QT_VERSION VERSION_LESS QT_MINIMUM_VERSION) message(FATAL_ERROR "Minimum supported Qt version: ${QT_MINIMUM_VERSION}") endif() +qt_standard_project_setup(REQUIRES ${QT_MINIMUM_VERSION}) + set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_INSTALL_PREFIX}) execute_process(COMMAND git describe --always --tags OUTPUT_VARIABLE CMAKE_VAR_GIT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 558b1d963015e50e0bd2bcd7f41a201bd50147d0..e1c917ddeaa4e4caf75cf2bd428f328118f60252 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,29 +18,34 @@ qt_add_executable(${PROJECT_NAME} backend/dsconnector/dsdiscovery.cpp backend/dsconnector/dsdiscovery.h backend/dsconnector/dsmanager.cpp backend/dsconnector/dsmanager.h backend/qrscanner.cpp backend/qrscanner.h - ui/main.qml ../3rdparty/zxing-cpp/example/ZXingQtReader.h ) -qt_add_resources(${PROJECT_NAME} "images" - PREFIX "/" - FILES - ui/content/images/appicon.png - ui/content/images/closed_eye.png - ui/content/images/open_eye.png - ui/content/images/container.png +set_source_files_properties(Constants.qml PROPERTIES + QT_QML_SINGLETON_TYPE TRUE ) -qt_add_resources(${PROJECT_NAME} "qml" - PREFIX "/" - FILES - ui/main.qml - ui/HomePage.qml - ui/Logs.qml - ui/DSManagement.qml - ui/ExamplesPage.qml - ui/AboutHeader.qml - ui/SettingsPage.qml +qt_add_qml_module(${PROJECT_NAME} + URI AndroidUI + VERSION 1.0 + QML_FILES + Constants.qml + HomePage.qml + Main.qml + NavigationBar.qml + NavigationButton.qml + QrButton.qml + SettingsItem.qml + SettingsPage.qml + SwitchSettingsItem.qml +) + +qt_target_qml_sources(${PROJECT_NAME} + PREFIX + "/" + RESOURCES + fonts/QtOneIconFont.ttf + images/appicon.png ) target_link_libraries(${PROJECT_NAME} PRIVATE @@ -90,4 +95,4 @@ set_property(TARGET ${PROJECT_NAME} PROPERTY QT_ANDROID_EXTRA_LIBS # this needs to be increased with every new release set(GOOGLE_PLAY_APP_VERSION 31) # CMAKE_VAR_GIT_VERSION (coming from the top-level CMakeLists.txt) and GOOGLE_PLAY_APP_VERSION replaced in the following file -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/android/AndroidManifest.xml.in ${CMAKE_CURRENT_SOURCE_DIR}/android/AndroidManifest.xml) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/android/AndroidManifest.xml.in ${CMAKE_CURRENT_SOURCE_DIR}/android/AndroidManifest.xml) diff --git a/src/Constants.qml b/src/Constants.qml new file mode 100644 index 0000000000000000000000000000000000000000..661e8e2048d7d137172849612edb8e970d9c2b12 --- /dev/null +++ b/src/Constants.qml @@ -0,0 +1,36 @@ +pragma Singleton +import QtQuick + +QtObject { + id: root + + property FontLoader iconFont: FontLoader { + source: "/fonts/QtOneIconFont.ttf" + } + + property QtObject icons: QtObject { + readonly property string home: "\u0021" + readonly property string link: "\u0022" + readonly property string qrCode: "\u0023" + readonly property string settings: "\u0024" + readonly property string unlink: "\u0025" + } + + readonly property int smTextSize: 12 + readonly property int mdTextSize: 14 + readonly property int lgTextSize: 20 + readonly property int xlTextSize: 30 + + readonly property int iconSize: 18 + + readonly property color statusBarDisconnected: "#eb991f" + readonly property color statusBarConnected: "#23b26a" + + readonly property int statusBarHeight: 24 + readonly property int tabBarHeight: 69 + + readonly property bool dark: Application.styleHints.colorScheme === Qt.Dark + + readonly property color boxBackgroundColor: root.dark ? "#262626" : "#f2f2f2" + readonly property color boxBorderColor: root.dark ? "#2e2e2e" : "#e7e7e7" +} diff --git a/src/HomePage.qml b/src/HomePage.qml new file mode 100644 index 0000000000000000000000000000000000000000..2f2177144325f3c428185866c80ebb2572c0fb97 --- /dev/null +++ b/src/HomePage.qml @@ -0,0 +1,253 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +import QtQuick +import QtQuick.Controls.Material +import QtQuick.Layouts + +Flickable { + id: root + interactive: true + contentHeight: mainLayout.height + boundsMovement: Flickable.StopAtBounds + boundsBehavior: Flickable.DragAndOvershootBounds + + property bool landscape: root.width > root.height + + Connections { + target: Qt.inputMethod + + function onKeyboardRectangleChanged() { + let mapPositon = optionLayout2.mapToItem(root, ipAddress.x, ipAddress.y) + root.contentY = mapPositon.y + } + } + + RowLayout { + id: dummy + anchors.left: parent.left + anchors.right: parent.right + + GridLayout { + id: mainLayout + + Layout.fillWidth: true + Layout.alignment: Qt.AlignHCenter + + columns: root.landscape ? 2 : 1 + rowSpacing: 20 + columnSpacing: 20 + + RowLayout { + id: headerLayout + + Layout.columnSpan: root.landscape ? 2 : 1 + Layout.alignment: Qt.AlignLeft + Layout.fillWidth: true + Layout.topMargin: 10 + Layout.bottomMargin: 0 + Layout.leftMargin: 20 + Layout.rightMargin: 20 + + spacing: 20 + + Image { + id: qdsLogo + source: "/images/appicon.png" + fillMode: Image.PreserveAspectFit + Layout.preferredWidth: 64 + Layout.preferredHeight: 64 + } + + Label { + id: qdvLabel + text: qsTr("Qt UI Viewer") + font.pixelSize: Constants.xlTextSize + font.bold: true + } + } + + ColumnLayout { + id: infoLayout + + Layout.leftMargin: 20 + Layout.rightMargin: 20 + Layout.fillWidth: true + Layout.preferredWidth: 300 + Layout.maximumWidth: 400 + Layout.alignment: Qt.AlignTop + + spacing: 10 + + Label { + id: title + Layout.fillWidth: true + text: qsTr("Connect with Qt Design Studio in your local network.") + font.pixelSize: Constants.lgTextSize + font.bold: true + wrapMode: Text.WordWrap + } + + ColumnLayout { + Layout.fillWidth: true + spacing: 0 + + Label { + Layout.fillWidth: true + text: qsTr("How to:") + font.pixelSize: Constants.mdTextSize + font.bold: true + wrapMode: Text.WordWrap + } + + Repeater { + model: [ + qsTr("Open Qt Design Studio"), + qsTr("Click Play > Manage Run Targets"), + qsTr("In Manage Run Targets window click Add run target button.") + ] + + delegate: RowLayout { + Layout.fillWidth: true + spacing: 6 + + Label { + Layout.alignment: Qt.AlignTop + text: (index + 1) + "." + font.pixelSize: Constants.mdTextSize + } + + Label { + Layout.fillWidth: true + text: modelData + font.pixelSize: Constants.mdTextSize + wrapMode: Text.WordWrap + } + } + } + } + } + + ColumnLayout { + id: optionLayout + + Layout.leftMargin: 20 + Layout.rightMargin: 20 + Layout.bottomMargin: 20 + Layout.fillWidth: true + Layout.preferredWidth: 300 + Layout.maximumWidth: 400 + Layout.alignment: Qt.AlignTop + + spacing: 10 + + Rectangle { + Layout.fillWidth: true + Layout.preferredHeight: optionLayout1.height + + color: Constants.boxBackgroundColor + radius: Material.MediumScale + border { + width: 1 + color: Constants.boxBorderColor + } + + ColumnLayout { + id: optionLayout1 + width: parent.width + spacing: 20 + + Label { + Layout.fillWidth: true + Layout.topMargin: 20 + + horizontalAlignment: Qt.AlignHCenter + text: qsTr("Option 1") + font.pixelSize: Constants.lgTextSize + font.bold: true + wrapMode: Text.WordWrap + } + + Label { + Layout.fillWidth: true + Layout.leftMargin: 20 + Layout.rightMargin: 20 + + horizontalAlignment: Qt.AlignHCenter + text: qsTr("Click to scan the QR code in Qt Design Studio") + font.pixelSize: Constants.mdTextSize + wrapMode: Text.WordWrap + } + + QrButton { + Layout.alignment: Qt.AlignHCenter + Layout.bottomMargin: 20 + + onClicked: backend.scanQrCode() + } + } + } + + Rectangle { + Layout.fillWidth: true + Layout.preferredHeight: optionLayout2.height + + color: Constants.boxBackgroundColor + radius: Material.MediumScale + border { + width: 1 + color: Constants.boxBorderColor + } + + ColumnLayout { + id: optionLayout2 + width: parent.width + spacing: 20 + + Label { + Layout.fillWidth: true + Layout.topMargin: 20 + + horizontalAlignment: Qt.AlignHCenter + text: qsTr("Option 2") + font.pixelSize: Constants.lgTextSize + font.bold: true + + wrapMode: Text.WordWrap + } + + TextField { + id: ipAddress + + Layout.fillWidth: true + Layout.leftMargin: 20 + Layout.rightMargin: 20 + Layout.alignment: Qt.AlignHCenter + + placeholderText: qsTr("IP Address") + text: "10.0.2.2" + validator: RegularExpressionValidator { + regularExpression: /^(\d{1,3}\.){3}\d{1,3}$/ + } + } + + Button { + id: downloadUserProject + + Layout.fillWidth: true + Layout.leftMargin: 20 + Layout.rightMargin: 20 + Layout.bottomMargin: 20 + Layout.alignment: Qt.AlignHCenter + + text: qsTr("Connect Design Studio") + enabled: true + + onClicked: backend.connectDesignStudio(ipAddress.text) + } + } + } + } + } + } +} diff --git a/src/Main.qml b/src/Main.qml new file mode 100644 index 0000000000000000000000000000000000000000..0baf1ffe79bbff98593f7ed8ad7e185b36feea46 --- /dev/null +++ b/src/Main.qml @@ -0,0 +1,110 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +import QtQuick +import QtQuick.Controls.Material +import QtQuick.Layouts + +Rectangle { + id: root + + property bool connected: false + property string ip: "0.0.0.0" + + width: 400 + height: 800 + color: Material.backgroundColor + + Material.theme: Application.styleHints.colorScheme === Qt.Dark ? Material.Dark : Material.Light + Material.accent: Material.Blue + Material.primary: Material.Blue + + Column { + id: column + anchors.fill: parent + + Rectangle { + id: statusBar + width: column.width + height: Constants.statusBarHeight + color: root.connected ? Constants.statusBarConnected : Constants.statusBarDisconnected + + Row { + anchors.horizontalCenter: parent.horizontalCenter + height: statusBar.height + spacing: 6 + + Text { + height: parent.height + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + + font.family: Constants.iconFont.font.family + font.pixelSize: Constants.iconSize + text: root.connected ? Constants.icons.link : Constants.icons.unlink + } + + Text { + id: statusText + height: parent.height + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + + font.pixelSize: Constants.smTextSize + wrapMode: Text.WordWrap + + text: root.connected ? qsTr("Qt Design Studio is connected to " + root.ip) + : qsTr("Qt Design Studio is disconnected.") + } + } + + Connections { + target: backend + function onConnectedChanged(isConnected, ip) { + root.connected = isConnected + root.ip = ip + } + } + } + + StackLayout { + id: stackLayout + + width: column.width + height: column.height - statusBar.height - tabBar.height + clip: true + + HomePage { id: homePage } + SettingsPage { id: settingsPage } + } + + NavigationBar { + id: tabBar + width: column.width + height: Constants.tabBarHeight + + NavigationButton { + id: home + myIcon: Constants.icons.home + text: qsTr("Home") + checked: true + checkable: true + autoExclusive: true + onClicked: stackLayout.currentIndex = 0 + + height: Constants.tabBarHeight // TODO + } + + NavigationButton { + id: settings + myIcon: Constants.icons.settings + text: qsTr("Settings") + checkable: true + autoExclusive: true + onClicked: stackLayout.currentIndex = 1 + + height: Constants.tabBarHeight // TODO + } + } + } +} diff --git a/src/NavigationBar.qml b/src/NavigationBar.qml new file mode 100644 index 0000000000000000000000000000000000000000..83647219f109938f75d92b7e3086ebfe57889d35 --- /dev/null +++ b/src/NavigationBar.qml @@ -0,0 +1,50 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +import QtQuick +import QtQuick.Templates as T +import QtQuick.Controls.Material +import QtQuick.Controls.Material.impl + +T.TabBar { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + contentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding) + + spacing: 1 + + contentItem: ListView { + model: control.contentModel + currentIndex: control.currentIndex + + spacing: control.spacing + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickableDirection: Flickable.AutoFlickIfNeeded + snapMode: ListView.SnapToItem + + highlightMoveDuration: 250 + highlightResizeDuration: 0 + highlightFollowsCurrentItem: true + highlightRangeMode: ListView.ApplyRange + preferredHighlightBegin: 48 + preferredHighlightEnd: width - 48 + + highlight: Item { + z: 2 + Rectangle { + height: 2 + width: parent.width + y: control.position === T.TabBar.Footer ? 0 : parent.height - height + color: control.Material.accentColor + } + } + } + + background: Rectangle { + color: control.Material.dialogColor + } +} diff --git a/src/NavigationButton.qml b/src/NavigationButton.qml new file mode 100644 index 0000000000000000000000000000000000000000..b3862759a67dc5952aee96da921b61db682cb3e2 --- /dev/null +++ b/src/NavigationButton.qml @@ -0,0 +1,59 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +import QtQuick +import QtQuick.Templates as T +import QtQuick.Controls.impl +import QtQuick.Controls.Material +import QtQuick.Controls.Material.impl + +T.TabButton { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding) + + padding: 12 + spacing: 6 + + property alias myIcon: icon.text + + contentItem: Column { + Label { + id: icon + width: 24 + height: 24 + horizontalAlignment: Qt.AlignHCenter + anchors.horizontalCenter: parent.horizontalCenter + font.family: Constants.iconFont.font.family + font.pixelSize: Constants.iconSize + color: !control.enabled ? control.Material.hintTextColor + : control.down || control.checked ? control.Material.accentColor + : control.Material.foreground + } + + Label { + id: text + horizontalAlignment: Qt.AlignHCenter + width: parent.width + text: control.text + font: control.font + color: !control.enabled ? control.Material.hintTextColor + : control.down || control.checked ? control.Material.accentColor + : control.Material.foreground + } + } + + background: Ripple { + implicitHeight: control.Material.touchTarget + + clip: true + pressed: control.pressed + anchor: control + active: enabled && (control.down || control.visualFocus || control.hovered) + color: control.Material.rippleColor + //clipRadius: 0 + } +} diff --git a/src/QrButton.qml b/src/QrButton.qml new file mode 100644 index 0000000000000000000000000000000000000000..33a3916ffbd07926a3eaa6b81148117676dd3fe7 --- /dev/null +++ b/src/QrButton.qml @@ -0,0 +1,63 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +import QtQuick +import QtQuick.Templates as T +import QtQuick.Controls.impl +import QtQuick.Controls.Material +import QtQuick.Controls.Material.impl + +T.AbstractButton { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding) + + padding: 20 + spacing: 6 + + contentItem: Label { + id: icon + width: 24 + height: 24 + horizontalAlignment: Qt.AlignHCenter + anchors.horizontalCenter: parent.horizontalCenter + font.family: Constants.iconFont.font.family + font.pixelSize: 40 + text: Constants.icons.qrCode + color: !control.enabled ? control.Material.hintTextColor + : control.down || control.checked ? control.Material.accentColor + : control.Material.foreground + } + + background: Rectangle { + implicitWidth: 64 + implicitHeight: control.Material.buttonHeight + + radius: height / 2 + color: control.Material.buttonColor(control.Material.theme, control.Material.background, + control.Material.accent, control.enabled, control.flat, control.highlighted, control.checked) + + // The layer is disabled when the button color is transparent so you can do + // Material.background: "transparent" and get a proper flat button without needing + // to set Material.elevation as well + layer.enabled: control.enabled && color.a > 0 && !control.flat + layer.effect: RoundedElevationEffect { + elevation: control.Material.elevation + roundedScale: control.background.radius + } + + Ripple { + clip: true + clipRadius: parent.radius + width: parent.width + height: parent.height + pressed: control.pressed + anchor: control + active: enabled && (control.down || control.visualFocus || control.hovered) + color: control.flat && control.highlighted ? control.Material.highlightedRippleColor : control.Material.rippleColor + } + } +} diff --git a/src/SettingsItem.qml b/src/SettingsItem.qml new file mode 100644 index 0000000000000000000000000000000000000000..ba1227b68898741c1f31d747cbf78557dd4f74de --- /dev/null +++ b/src/SettingsItem.qml @@ -0,0 +1,64 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +import QtQuick +import QtQuick.Templates as T +import QtQuick.Controls.impl +import QtQuick.Controls.Material +import QtQuick.Controls.Material.impl + +T.AbstractButton { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding, + implicitIndicatorHeight + topPadding + bottomPadding) + + padding: 16 + verticalPadding: Material.menuItemVerticalPadding + spacing: 16 + + property string subText: "" + + contentItem: Column { + id: column + + property int labelWidth: control.width - control.leftPadding - control.rightPadding + + Label { + width: column.labelWidth + text: control.text + font.family: control.font.family + font.pixelSize: Constants.lgTextSize + color: control.enabled ? Material.primaryTextColor : Material.secondaryTextColor + } + + Label { + visible: control.subText !== "" + width: column.labelWidth + text: control.subText + font.family: control.font.family + font.pixelSize: Constants.mdTextSize + wrapMode: Text.WordWrap + color: Material.secondaryTextColor + } + } + + background: Rectangle { + implicitWidth: 200 + implicitHeight: control.Material.menuItemHeight + color: "transparent" + + Ripple { + width: parent.width + height: parent.height + clip: visible + pressed: control.pressed + anchor: control + active: control.down + color: control.Material.rippleColor + } + } +} diff --git a/src/SettingsPage.qml b/src/SettingsPage.qml new file mode 100644 index 0000000000000000000000000000000000000000..c05c13172d017cbc317073327b6d3a918bffd4b7 --- /dev/null +++ b/src/SettingsPage.qml @@ -0,0 +1,50 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +Flickable { + id: root + interactive: true + contentHeight: mainLayout.height + boundsMovement: Flickable.StopAtBounds + boundsBehavior: Flickable.DragAndOvershootBounds + + ColumnLayout { + id: mainLayout + anchors.left: parent.left + anchors.right: parent.right + spacing: 0 + + Label { + id: title + Layout.margins: 20 + text: qsTr("Settings") + font.pixelSize: Constants.xlTextSize + } + + SwitchSettingsItem { + Layout.fillWidth: true + horizontalPadding: 20 + text: qsTr("Auto-scale") + subText: qsTr("Scales the project to fit to current display and orientation") + checked: backend.autoScaleProject() ? Qt.Checked : Qt.Unchecked + } + + SettingsItem { + Layout.fillWidth: true + horizontalPadding: 20 + text: qsTr("Send feedback") + } + + SettingsItem { + Layout.fillWidth: true + horizontalPadding: 20 + text: qsTr("About") + subText: backend.buildInfo() + enabled: false + } + } +} diff --git a/src/SwitchSettingsItem.qml b/src/SwitchSettingsItem.qml new file mode 100644 index 0000000000000000000000000000000000000000..b5c3c530eba2886cb07a1a8a2bbe5a1e3c3b24ba --- /dev/null +++ b/src/SwitchSettingsItem.qml @@ -0,0 +1,74 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +import QtQuick +import QtQuick.Templates as T +import QtQuick.Controls.impl +import QtQuick.Controls.Material +import QtQuick.Controls.Material.impl + +T.AbstractButton { + id: control + + checkable: true + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding, + implicitIndicatorHeight + topPadding + bottomPadding) + + padding: 16 + verticalPadding: Material.menuItemVerticalPadding + spacing: 16 + + property string subText: "" + + indicator: Switch { + id: switchIndicator + x: control.width - switchIndicator.indicator.width - control.rightPadding + y: control.topPadding + (control.availableHeight - height) / 2 + visible: control.checkable + checked: control.checked + padding: 0 + z: -1 // Otherwise Switch can be clicked independently instead of the button itself + } + + contentItem: Column { + id: column + + property int labelWidth: control.width - control.leftPadding - control.rightPadding - switchIndicator.indicator.width - 6 + + Label { + width: column.labelWidth + text: control.text + font.family: control.font.family + font.pixelSize: Constants.lgTextSize + } + + Label { + width: column.labelWidth + text: control.subText + font.family: control.font.family + font.pixelSize: Constants.mdTextSize + wrapMode: Text.WordWrap + color: Material.secondaryTextColor + } + } + + background: Item { + implicitWidth: 200 + implicitHeight: control.Material.menuItemHeight + + Ripple { + width: parent.width + height: parent.height + + clip: visible + pressed: control.pressed + anchor: control + active: control.down + color: control.Material.rippleColor + } + } +} diff --git a/src/android/AndroidManifest.xml.in b/src/android/AndroidManifest.xml.in index 1736aebbf2b33fefe8b9dd1d9a52140fba8ee5ef..8c1eec4df743ac2619ddddba838cb7355e8f0c4d 100644 --- a/src/android/AndroidManifest.xml.in +++ b/src/android/AndroidManifest.xml.in @@ -15,7 +15,8 @@ <activity android:name="org.qtproject.qt.android.bindings.QtActivity" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:label="Qt UI Viewer" android:launchMode="singleTask" - android:screenOrientation="unspecified" android:exported="true"> + android:screenOrientation="unspecified" android:exported="true" + android:windowSoftInputMode="adjustResize"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> diff --git a/src/backend/main.cpp b/src/backend/main.cpp index 1ea995334438c772c0a3d0a1c4bfbf3cfe0163d1..734d47148673a8830c1b135828ed282fe74318bf 100644 --- a/src/backend/main.cpp +++ b/src/backend/main.cpp @@ -47,7 +47,7 @@ int main(int argc, char *argv[]) QQuickView view; view.engine()->rootContext()->setContextProperty("backend", &backend); - view.setSource(QUrl(QStringLiteral("qrc:/ui/main.qml"))); + view.setSource(QUrl(QStringLiteral("qrc:/qt/qml/AndroidUI/Main.qml"))); view.setResizeMode(QQuickView::SizeRootObjectToView); view.showMaximized(); diff --git a/src/fonts/QtOneIconFont.ttf b/src/fonts/QtOneIconFont.ttf new file mode 100644 index 0000000000000000000000000000000000000000..9740e9ecb1ef7a99d68151c539d7031e810d7df8 Binary files /dev/null and b/src/fonts/QtOneIconFont.ttf differ diff --git a/src/images/appicon.png b/src/images/appicon.png new file mode 100644 index 0000000000000000000000000000000000000000..7d3104bb76c4fdcad3d9028b044318100806f5be Binary files /dev/null and b/src/images/appicon.png differ diff --git a/src/ui/AboutHeader.qml b/src/ui/AboutHeader.qml deleted file mode 100644 index 1a18df5971d59357c47f76fe6a9823fe24453c42..0000000000000000000000000000000000000000 --- a/src/ui/AboutHeader.qml +++ /dev/null @@ -1,32 +0,0 @@ -import QtQuick -import QtQuick.Controls 6.4 -import QtQuick.Layouts - - -Item { - id: headerPage - - ColumnLayout { - anchors.fill: parent - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - - Item { - width: 200 - height: 200 - Layout.preferredHeight: 10 - Layout.fillWidth: true - } - - Label { - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - horizontalAlignment: "AlignHCenter" - text: backend.buildInfo() - } - - - Item { - Layout.fillHeight: true - Layout.fillWidth: true - } - } -} diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt deleted file mode 100644 index 5630ce6641c1d640673ed8cc9c56ba4c5fa9b6ab..0000000000000000000000000000000000000000 --- a/src/ui/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -cmake_minimum_required(VERSION 3.21.1) - -option(LINK_INSIGHT "Link Qt Insight Tracker library" ON) -option(BUILD_QDS_COMPONENTS "Build design studio components" ON) - -project(DesignViewerApp LANGUAGES CXX) - -set(CMAKE_AUTOMOC ON) - -find_package(Qt6 6.2 REQUIRED COMPONENTS Core Gui Qml Quick) - -if (Qt6_VERSION VERSION_GREATER_EQUAL 6.3) - qt_standard_project_setup() -endif() - -qt_add_executable(DesignViewerApp src/main.cpp) - -qt_add_resources(DesignViewerApp "configuration" - PREFIX "/" - FILES - qtquickcontrols2.conf -) - -target_link_libraries(DesignViewerApp PRIVATE - Qt6::Core - Qt6::Gui - Qt6::Qml - Qt6::Quick -) - -if (BUILD_QDS_COMPONENTS) - include(${CMAKE_CURRENT_SOURCE_DIR}/qmlcomponents) -endif() - -include(${CMAKE_CURRENT_SOURCE_DIR}/qmlmodules) - -if (LINK_INSIGHT) - include(${CMAKE_CURRENT_SOURCE_DIR}/insight) -endif () - -install(TARGETS DesignViewerApp - BUNDLE DESTINATION . - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -) diff --git a/src/ui/DSManagement.qml b/src/ui/DSManagement.qml deleted file mode 100644 index a73578e28797d01cde6c9469d8f3163554ab77de..0000000000000000000000000000000000000000 --- a/src/ui/DSManagement.qml +++ /dev/null @@ -1,35 +0,0 @@ -import QtQuick -import QtQuick.Controls 6.4 -import QtQuick.Layouts - - -Item { - id: header - - ColumnLayout { - spacing: 10 - anchors.fill: parent - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - - Text { - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - Layout.preferredWidth: parent.width - horizontalAlignment: "AlignHCenter" - wrapMode: Text.WordWrap - textFormat: Text.StyledText - text: "<p> - Use Design Studio (File -> Device Management) to register you phone. - <br> - - <p> - If your phone is not discovered by Design Studio, or if it has been registered before but doesn't show up as online, you can scan the QR code shown on Design Studio. - " - } - - Button { - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - text: "Scan QR Code" - onClicked: backend.scanQrCode() - } - } -} diff --git a/src/ui/DesignViewer.qmlproject b/src/ui/DesignViewer.qmlproject deleted file mode 100644 index a3b6f77d092d30f6ce8ffaa995610c45260bc66f..0000000000000000000000000000000000000000 --- a/src/ui/DesignViewer.qmlproject +++ /dev/null @@ -1,119 +0,0 @@ -import QmlProject - -Project { - mainFile: "main.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - - QmlFiles { - directory: "content" - } - - QmlFiles { - directory: "imports" - } - - JavaScriptFiles { - directory: "content" - } - - JavaScriptFiles { - directory: "imports" - } - - ImageFiles { - directory: "content" - } - - ImageFiles { - directory: "asset_imports" - } - - Files { - filter: "*.conf" - files: ["qtquickcontrols2.conf"] - } - - Files { - filter: "qmldir" - directory: "." - } - - Files { - filter: "*.ttf;*.otf" - } - - Files { - filter: "*.wav;*.mp3" - } - - Files { - filter: "*.mp4" - } - - Files { - filter: "*.glsl;*.glslv;*.glslf;*.vsh;*.fsh;*.vert;*.frag" - } - - Files { - filter: "*.qsb" - } - - Files { - filter: "*.mesh" - directory: "asset_imports" - } - - Files { - filter: "*.qml" - directory: "asset_imports" - } - - Environment { - QT_QUICK_CONTROLS_CONF: "qtquickcontrols2.conf" - QT_AUTO_SCREEN_SCALE_FACTOR: "1" - QML_COMPAT_RESOLVE_URLS_ON_ASSIGNMENT: "1" - QT_LOGGING_RULES: "qt.qml.connections=false" - QT_ENABLE_HIGHDPI_SCALING: "0" - /* Useful for debugging - QSG_VISUALIZE=batches - QSG_VISUALIZE=clip - QSG_VISUALIZE=changes - QSG_VISUALIZE=overdraw - */ - } - - qt6Project: true - - /* List of plugin directories passed to QML runtime */ - importPaths: [ "imports", "asset_imports" ] - - /* Required for deployment */ - targetDirectory: "/opt/DesignViewer" - - qdsVersion: "4.2" - - quickVersion: "6.5" - - /* If any modules the project imports require widgets (e.g. QtCharts), widgetApp must be true */ - widgetApp: true - - /* args: Specifies command line arguments for qsb tool to generate shaders. - files: Specifies target files for qsb tool. If path is included, it must be relative to this file. - Wildcard '*' can be used in the file name part of the path. - e.g. files: [ "content/shaders/*.vert", "*.frag" ] */ - ShaderTool { - args: "-s --glsl \"100 es,120,150\" --hlsl 50 --msl 12" - files: [ "content/shaders/*" ] - } - - multilanguageSupport: true - supportedLanguages: ["en"] - primaryLanguage: "en" - - - mainUiFile: "main.qml" -} diff --git a/src/ui/ExamplesPage.qml b/src/ui/ExamplesPage.qml deleted file mode 100644 index fb8b1f6064d4b19fe7f348823c79f84dd89fe296..0000000000000000000000000000000000000000 --- a/src/ui/ExamplesPage.qml +++ /dev/null @@ -1,49 +0,0 @@ -import QtQuick -import QtQuick.Window 2.2 -import QtQuick.Controls 6.5 -import QtQuick.Layouts - -Item { - id: examplesPage - - ColumnLayout { - anchors.fill: parent - - Button { - id: button3 - text: qsTr("Cluster Tutorial") - Layout.fillWidth: true - onClicked: backend.runDemoProject("ClusterTutorial") - } - - - Button { - id: button - text: qsTr("E-Bike Design") - Layout.fillWidth: true - onClicked: backend.runDemoProject("EBikeDesign") - } - - Button { - id: button4 - text: qsTr("Material Bundle") - Layout.fillWidth: true - onClicked: backend.runDemoProject("MaterialBundle") - } - - Item { - id: item1 - width: 200 - height: 200 - Layout.fillHeight: true - Layout.fillWidth: true - } - - Button { - id: button5 - text: qsTr("Clear demo caches") - Layout.fillWidth: true - onClicked: backend.clearDemoCaches() - } - } -} diff --git a/src/ui/HomePage.qml b/src/ui/HomePage.qml deleted file mode 100644 index c7c8e88f382c1a57ff381f6b0f5c3779c460e42a..0000000000000000000000000000000000000000 --- a/src/ui/HomePage.qml +++ /dev/null @@ -1,175 +0,0 @@ -import QtQuick -import QtQuick.Controls 6.4 -import QtQuick.Layouts - - -Item { - id: homePage - - ColumnLayout { - anchors.fill: parent - - Item { - id: item2 - Layout.preferredWidth: 10 - Layout.preferredHeight: 3 - Layout.fillWidth: true - Layout.fillHeight: true - } - - Text { - id: qrCodeStatus - text: qsTr("Scan the QR code to start pairing with Qt Design Studio") - font.pixelSize: 12 - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - wrapMode: Text.WordWrap - Layout.fillWidth: true - } - - Item { - Layout.preferredWidth: 10 - Layout.preferredHeight: 10 - Layout.fillWidth: true - Layout.fillHeight: true - } - - Rectangle { - id: sep1 - height: 2 - color: 'black' - Layout.fillWidth: true - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - } - - - Button { - id: scanQrCode - implicitHeight: 122 - implicitWidth: 120 - topInset: 0 - bottomInset: 0 - text: qsTr("Scan QR code") - leftPadding: 0 - rightPadding: 0 - icon.color: "#00a31d1d" - icon.width: scanQrCode.implicitHeight - icon.height: scanQrCode.implicitWidth - icon.cache: false - icon.source: "content/images/container.png" - display: AbstractButton.IconOnly - onClicked: backend.scanQrCode() - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - } - - - Rectangle { - id: sep2 - height: 2 - color: 'black' - Layout.fillWidth: true - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - } - - Item { - id: item4 - Layout.preferredWidth: 10 - Layout.preferredHeight: 10 - Layout.fillWidth: true - Layout.fillHeight: true - } - - - ColumnLayout { - Layout.fillWidth: true - - Text { - text: qsTr("Or enter the Qt Design Studio IP address manually") - font.pixelSize: 12 - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - wrapMode: Text.WordWrap - Layout.fillWidth: true - } - - TextField { - id: ipAddress - Layout.fillWidth: true - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - placeholderText: qsTr("IP Address") - text: "10.0.2.2" - validator: RegularExpressionValidator { regularExpression: /^(\d{1,3}\.){3}\d{1,3}$/ } - } - - Button { - id: downloadUserProject - text: qsTr("Connect Design Studio") - onClicked: { - backend.connectDesignStudio(ipAddress.text) - } - enabled: true - Layout.fillWidth: true - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - } - } - - Item { - Layout.fillHeight: true - Layout.fillWidth: true - Layout.preferredHeight: 10 - Layout.preferredWidth: 10 - } - - } - states: [ - State { - name: "State1" - when: homePage.height >= 400 - - PropertyChanges { - target: gridLayout - columns: 1 - } - - PropertyChanges { - target: sep1 - visible: false - } - - PropertyChanges { - target: sep2 - visible: false - } - }, - State { - name: "State2" - when: homePage.height <= 400 - - PropertyChanges { - target: item2 - visible: false - } - - PropertyChanges { - target: item4 - visible: false - } - - PropertyChanges { - target: sep1 - visible: true - } - - PropertyChanges { - target: sep2 - visible: true - } - - PropertyChanges { - target: gridLayout - columns: 2 - } - - } - ] -} diff --git a/src/ui/Logs.qml b/src/ui/Logs.qml deleted file mode 100644 index 44527d5c8a254e83d7a2294414331b190d054e54..0000000000000000000000000000000000000000 --- a/src/ui/Logs.qml +++ /dev/null @@ -1,37 +0,0 @@ -import QtQuick -import QtQuick.Controls 6.4 -import QtQuick.Window 2.2 - -Rectangle { - id: log - width: 348 - height: 501 - visible: true - color: "#EAEAEA" - - ScrollView { - id: scrollArea - visible: true - anchors.fill: parent - topPadding: 13.1 - ScrollBar.vertical.policy: ScrollBar.AlwaysOn - - TextArea { - clip: false - id: logTextArea - wrapMode: TextEdit.Wrap - rightInset: 20 - readOnly: true - anchors.topMargin: 5 - placeholderText: qsTr("Application Logs") - } - - Connections { - target: backend - function onLogsChanged(logs) { - logTextArea.text = logs - scrollArea.ScrollBar.vertical.position = 1.0 - scrollArea.ScrollBar.vertical.size - } - } - } -} diff --git a/src/ui/SettingsPage.qml b/src/ui/SettingsPage.qml deleted file mode 100644 index 3c40707240c0732fc604360e1a767583766dd041..0000000000000000000000000000000000000000 --- a/src/ui/SettingsPage.qml +++ /dev/null @@ -1,73 +0,0 @@ -import QtQuick -import QtQuick.Controls 6.4 -import QtQuick.Layouts - -Item { - id: settingsPage - - ColumnLayout { - anchors.fill: parent - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - - Item { - width: 200 - height: 200 - Layout.preferredHeight: 10 - Layout.fillWidth: true - } - - Label { - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - horizontalAlignment: "AlignHCenter" - text: backend.buildInfo() - } - - - Item { - Layout.fillHeight: true - Layout.fillWidth: true - } - } - - ColumnLayout { - anchors.fill: parent - - Item { - id: item2 - Layout.preferredWidth: 10 - Layout.preferredHeight: 10 - Layout.fillWidth: true - Layout.fillHeight: true - } - - ColumnLayout { - id: column2 - Layout.fillWidth: true - - CheckBox { - id: checkBox2 - text: qsTr("Auto scale the project") - font.pointSize: 15 - onCheckStateChanged: backend.setAutoScaleProject(checkState) - checkState: backend.autoScaleProject() ? Qt.Checked : Qt.Unchecked - } - - Text{ - leftPadding: 45 - text: qsTr("Scales the project to fit it to the current\ndisplay and orientation") - font.pointSize: 12 - wrapMode: Text.WordWrap - } - } - - Item { - id: item3 - Layout.fillHeight: true - Layout.fillWidth: true - Layout.preferredHeight: 10 - Layout.preferredWidth: 10 - } - - - } -} diff --git a/src/ui/asset_imports/asset_imports.txt b/src/ui/asset_imports/asset_imports.txt deleted file mode 100644 index 84c843f100d41b805bc1dab082525ad2228526b7..0000000000000000000000000000000000000000 --- a/src/ui/asset_imports/asset_imports.txt +++ /dev/null @@ -1 +0,0 @@ -Imported 3D assets and components imported from bundles will be created in this folder. diff --git a/src/ui/content/CMakeLists.txt b/src/ui/content/CMakeLists.txt deleted file mode 100644 index 6811415f249fc4b4bbf3693ab27e1ec17d60f21e..0000000000000000000000000000000000000000 --- a/src/ui/content/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -### This file is automatically generated by Qt Design Studio. -### Do not change - -qt_add_library(content STATIC) -qt6_add_qml_module(content - URI "content" - VERSION 1.0 - QML_FILES - App.qml - Screen01.ui.qml - RESOURCES - fonts/fonts.txt -) diff --git a/src/ui/content/fonts/fonts.txt b/src/ui/content/fonts/fonts.txt deleted file mode 100644 index ab96122067450783de407d6200171a97ab3849be..0000000000000000000000000000000000000000 --- a/src/ui/content/fonts/fonts.txt +++ /dev/null @@ -1 +0,0 @@ -Fonts in this folder are loaded automatically. diff --git a/src/ui/content/images/appicon.png b/src/ui/content/images/appicon.png deleted file mode 100644 index 28f2da2dd0782be2e6e2a5e79b6e7f9ff44fa9d7..0000000000000000000000000000000000000000 Binary files a/src/ui/content/images/appicon.png and /dev/null differ diff --git a/src/ui/content/images/closed_eye.png b/src/ui/content/images/closed_eye.png deleted file mode 100644 index c8c2b4abf8f24b6aefda1c87bb55f16efb3bddd6..0000000000000000000000000000000000000000 Binary files a/src/ui/content/images/closed_eye.png and /dev/null differ diff --git a/src/ui/content/images/container.png b/src/ui/content/images/container.png deleted file mode 100644 index a650d4461ee5151f7ba9d4cd99573de071046496..0000000000000000000000000000000000000000 Binary files a/src/ui/content/images/container.png and /dev/null differ diff --git a/src/ui/content/images/ds_icon.png b/src/ui/content/images/ds_icon.png deleted file mode 100644 index d565981cdae7b075f7565da7325e893950f75799..0000000000000000000000000000000000000000 Binary files a/src/ui/content/images/ds_icon.png and /dev/null differ diff --git a/src/ui/content/images/open_eye.png b/src/ui/content/images/open_eye.png deleted file mode 100644 index 2050748b2d1571a086f66d6429ac66fdb81c0d73..0000000000000000000000000000000000000000 Binary files a/src/ui/content/images/open_eye.png and /dev/null differ diff --git a/src/ui/i18n/qml_en.qm b/src/ui/i18n/qml_en.qm deleted file mode 100644 index ce6afd21067436b699a9d6d6df69a625b068facd..0000000000000000000000000000000000000000 Binary files a/src/ui/i18n/qml_en.qm and /dev/null differ diff --git a/src/ui/imports/CMakeLists.txt b/src/ui/imports/CMakeLists.txt deleted file mode 100644 index ce806bcb08920e0b5a1e6d77b1ce1ad92086116e..0000000000000000000000000000000000000000 --- a/src/ui/imports/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -### This file is automatically generated by Qt Design Studio. -### Do not change - -add_subdirectory(DesignViewer) diff --git a/src/ui/imports/DesignViewer/CMakeLists.txt b/src/ui/imports/DesignViewer/CMakeLists.txt deleted file mode 100644 index dae8551aa360dd75dfad455e3134c90593c5e228..0000000000000000000000000000000000000000 --- a/src/ui/imports/DesignViewer/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -### This file is automatically generated by Qt Design Studio. -### Do not change - -qt_add_library(DesignViewer STATIC) -set_source_files_properties(Constants.qml - PROPERTIES - QT_QML_SINGLETON_TYPE true - ) - -qt6_add_qml_module(DesignViewer - URI "DesignViewer" - VERSION 1.0 - QML_FILES - Constants.qml - DirectoryFontLoader.qml - EventListModel.qml - EventListSimulator.qml -) diff --git a/src/ui/imports/DesignViewer/Constants.qml b/src/ui/imports/DesignViewer/Constants.qml deleted file mode 100644 index 94d3ef2710aec3f0da053a8a45794e7a73892e34..0000000000000000000000000000000000000000 --- a/src/ui/imports/DesignViewer/Constants.qml +++ /dev/null @@ -1,27 +0,0 @@ -pragma Singleton -import QtQuick 6.5 -import QtQuick.Studio.Application - -QtObject { - readonly property int width: 1920 - readonly property int height: 1080 - - property string relativeFontDirectory: "fonts" - - /* Edit this comment to add your custom font */ - readonly property font font: Qt.font({ - family: Qt.application.font.family, - pixelSize: Qt.application.font.pixelSize - }) - readonly property font largeFont: Qt.font({ - family: Qt.application.font.family, - pixelSize: Qt.application.font.pixelSize * 1.6 - }) - - readonly property color backgroundColor: "#c2c2c2" - - - property StudioApplication application: StudioApplication { - fontPath: Qt.resolvedUrl("../../content/" + relativeFontDirectory) - } -} diff --git a/src/ui/imports/DesignViewer/DirectoryFontLoader.qml b/src/ui/imports/DesignViewer/DirectoryFontLoader.qml deleted file mode 100644 index a9900795c6ddf80c9c210f44212ccfcebb8155eb..0000000000000000000000000000000000000000 --- a/src/ui/imports/DesignViewer/DirectoryFontLoader.qml +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2019 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only - -import QtQuick 6.5 -import Qt.labs.folderlistmodel 6.5 - -QtObject { - id: loader - - property url fontDirectory: Qt.resolvedUrl("../../content/" + relativeFontDirectory) - property string relativeFontDirectory: "fonts" - - function loadFont(url) { - var fontLoader = Qt.createQmlObject('import QtQuick 2.15; FontLoader { source: "' + url + '"; }', - loader, - "dynamicFontLoader"); - } - - property FolderListModel folderModel: FolderListModel { - id: folderModel - folder: loader.fontDirectory - nameFilters: [ "*.ttf", "*.otf" ] - showDirs: false - - onStatusChanged: { - if (folderModel.status == FolderListModel.Ready) { - var i - for (i = 0; i < count; i++) { - loadFont(folderModel.get(i, "fileURL")) - } - } - } - } -} diff --git a/src/ui/imports/DesignViewer/EventListModel.qml b/src/ui/imports/DesignViewer/EventListModel.qml deleted file mode 100644 index 630d54361fd3470ee8b4ddb32b0f74b9eec5d361..0000000000000000000000000000000000000000 --- a/src/ui/imports/DesignViewer/EventListModel.qml +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only - -import QtQuick 6.5 - -ListModel { - id: eventListModel - - ListElement { - eventId: "enterPressed" - eventDescription: "Emitted when pressing the enter button" - shortcut: "Return" - parameters: "Enter" - } -} diff --git a/src/ui/imports/DesignViewer/EventListSimulator.qml b/src/ui/imports/DesignViewer/EventListSimulator.qml deleted file mode 100644 index 8c96292df05dfc28eeb7d281110160a2ff0ece11..0000000000000000000000000000000000000000 --- a/src/ui/imports/DesignViewer/EventListSimulator.qml +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only - -import QtQuick 6.5 -import QtQuick.Studio.EventSimulator 1.0 -import QtQuick.Studio.EventSystem 1.0 - -QtObject { - id: simulator - property bool active: true - - property Timer __timer: Timer { - id: timer - interval: 100 - onTriggered: { - EventSimulator.show() - } - } - - Component.onCompleted: { - EventSystem.init(Qt.resolvedUrl("EventListModel.qml")) - if (simulator.active) - timer.start() - } -} diff --git a/src/ui/imports/DesignViewer/designer/plugin.metainfo b/src/ui/imports/DesignViewer/designer/plugin.metainfo deleted file mode 100644 index 652db90605bad009283c672062f3d54adac87150..0000000000000000000000000000000000000000 --- a/src/ui/imports/DesignViewer/designer/plugin.metainfo +++ /dev/null @@ -1,13 +0,0 @@ -MetaInfo { - Type { - name: "DesignViewer.EventListSimulator" - icon: ":/qtquickplugin/images/item-icon16.png" - - Hints { - visibleInNavigator: true - canBeDroppedInNavigator: true - canBeDroppedInFormEditor: false - canBeDroppedInView3D: false - } - } -} diff --git a/src/ui/imports/DesignViewer/qmldir b/src/ui/imports/DesignViewer/qmldir deleted file mode 100644 index 84d76be04ef4fee7ba9232333666a9569253ca5d..0000000000000000000000000000000000000000 --- a/src/ui/imports/DesignViewer/qmldir +++ /dev/null @@ -1,6 +0,0 @@ -Module DesignViewer -singleton Constants 1.0 Constants.qml -EventListSimulator 1.0 EventListSimulator.qml -EventListModel 1.0 EventListModel.qml -DirectoryFontLoader 1.0 DirectoryFontLoader.qml - diff --git a/src/ui/insight b/src/ui/insight deleted file mode 100644 index 8245e31f0d95d728cdda8851023bfad8bb9267c1..0000000000000000000000000000000000000000 --- a/src/ui/insight +++ /dev/null @@ -1,19 +0,0 @@ -### This file is automatically generated by Qt Design Studio. -### Do not change - -if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/qtinsight.conf) - if (QT_VERSION GREATER_EQUAL 6.5.0) - find_package(Qt6 REQUIRED COMPONENTS InsightTracker) - - qt_add_resources(${CMAKE_PROJECT_NAME} "configuration" - PREFIX "/" - FILES - qtinsight.conf - ) - target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE - Qt6::InsightTracker - ) - else() - message(WARNING "You need Qt 6.5.0 or newer to build the application.") - endif() -endif() diff --git a/src/ui/main.qml b/src/ui/main.qml deleted file mode 100644 index e847d0a50ea07b5cb3346d4aea12f5826c6410d2..0000000000000000000000000000000000000000 --- a/src/ui/main.qml +++ /dev/null @@ -1,286 +0,0 @@ -import QtQuick 6.4 -import QtQuick.Controls 6.4 -import QtQuick.Controls.Material as M -import QtQuick.Layouts - -Rectangle { - id: root - width: 400 - height: 800 - color: "#EAEAEA" - state: "vertical" - - - M.Material.theme: M.Material.Light - M.Material.accent: M.Material.Blue - M.Material.primary: M.Material.Blue - - ColumnLayout{ - anchors.fill: parent - spacing: 4 - Layout.alignment: Qt.AlignCenter - - Rectangle{ - id: statusBar - Layout.fillWidth: true - height: 20 - color: "#f4a71d" - property bool connected: false - Text { - id: statusText - text: qsTr("Qt Design Studio is disconnected.") - font.pixelSize: 12 - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - wrapMode: Text.WordWrap - anchors.fill: parent - height: 20 - } - Connections{ - target: backend - function onConnectedChanged(isConnected, ip){ - if(!isConnected){ - statusBar.color = "#f4a71d" - statusText.text = "Qt Design Studio is disconnected."; - } else { - statusBar.color = "#05c940" - statusText.text = "Qt Design Studio is connected to " + ip; - } - } - } - } - - Image { - id: qdsicon1 - source: "content/images/appicon.png" - Layout.fillWidth: true - Layout.preferredHeight: 173 - fillMode: Image.PreserveAspectFit - - Text { - id: qdvLabel - text: qsTr("Qt UI Viewer") - anchors.top: parent.bottom - font.pixelSize: 12 - anchors.topMargin: -22 - anchors.horizontalCenter: parent.horizontalCenter - } - } - - StackLayout { - id: stackLayout - Layout.margins: 15 - - HomePage { - id: homePage - Layout.fillWidth: true - } - - ExamplesPage { - id: examplesPage - Layout.fillWidth: true - } - - Logs { - id: logsPage - Layout.fillWidth: true - } - - DSManagement { - id: dsManagementPage - Layout.fillWidth: true - } - - SettingsPage { - id: settingsPage - Layout.fillWidth: true - } - - AboutHeader { - id: headerPage - Layout.fillWidth: true - } - } - - TabBar { - id: tabBar - Layout.fillWidth: true - - TabButton { - id: home - text: qsTr("Home") - Layout.fillWidth: true - checked: true - checkable: true - autoExclusive: true - onClicked: { - stackLayout.currentIndex = 0 - drawer.close() - } - } - - TabButton { - id: settings - text: qsTr("Settings") - Layout.fillWidth: true - checkable: true - autoExclusive: true - onClicked: { - stackLayout.currentIndex = 4 - drawer.close() - } - } - } - } - - states: [ - State { - name: "vertical" - when: root.height >= 600 - }, - State { - name: "horizontal" - when: root.height < 600 - - PropertyChanges { - target: qdsicon1 - width: 0 - height: 0 - visible: false - } - - PropertyChanges { - target: qdvLabel - anchors.topMargin: -8 - } - - PropertyChanges { - target: stackLayout - anchors.topMargin: 20 - } - } - ] - - Popup { - property bool popupCloseReceived : false - id: popup - anchors.centerIn: parent - width: 300 - height: 100 - modal: true - focus: true - closePolicy: Popup.CloseOnEscape - - onClosed: { - if (!popupCloseReceived) { - backend.popupInterrupted(); - } - } - - ColumnLayout { - anchors.fill: parent - Text { - id: popupText - wrapMode: Text.WordWrap - } - Item { - id: name - } - ProgressBar { - id: popupProgressBar - Layout.fillWidth: true - to: 100 - } - } - - Timer { - id: closeTimer - interval: 500 - running: false - repeat: false - onTriggered: { - popup.close() - } - } - - Connections { - target: backend - function onPopupOpen(text, timeout) { - popup.open() - popupText.text = text - popupProgressBar.value = 0 - closeTimer.interval = timeout - if (timeout > 0) { - closeTimer.start() - } - popup.popupCloseReceived = false - } - function onPopupClose() { - popup.popupCloseReceived = true - popup.close() - } - function onPopupTextChanged(text) { - popupText.text = text - } - function onPopupProgressIndeterminateChanged(status) { - popupProgressBar.indeterminate = status - } - function onDownloadProgress(progress) { - popupProgressBar.value = progress - } - } - } - - Popup { - property string deviceId: "" - id: pinPopup - anchors.centerIn: parent - width: 250 - height: 250 - visible: false - modal: true - focus: true - contentItem: Rectangle { - color: "lightgrey" - border.color: "black" - border.width: 2 - radius: 10 - Text { - text: "Enter 4 digit pin\nthat you see on Design Studio" - anchors.centerIn: parent - horizontalAlignment: Qt.AlignHCenter - } - TextField { - id: pinField - anchors.top: parent.top - anchors.topMargin: 20 - anchors.horizontalCenter: parent.horizontalCenter - width: 100 - height: 50 - font.pixelSize: 20 - inputMethodHints: Qt.ImhDigitsOnly - validator: IntValidator { bottom: 0; top: 9999 } - } - - Button { - text: "Send PIN" - anchors.bottom: parent.bottom - anchors.bottomMargin: 20 - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - backend.enterPin(pinPopup.deviceId, pinField.text); - pinPopup.close(); - } - } - } - - Connections { - target: backend - function onPinRequested(deviceId) { - console.log("Pin requested for device: " + deviceId) - pinPopup.visible = true - pinPopup.deviceId = deviceId - } - } - } -} diff --git a/src/ui/qmlcomponents b/src/ui/qmlcomponents deleted file mode 100644 index 5e2d5923b1e0c13d2caa46c3f589217692a9698c..0000000000000000000000000000000000000000 --- a/src/ui/qmlcomponents +++ /dev/null @@ -1,33 +0,0 @@ -### This file is automatically generated by Qt Design Studio. -### Do not change - -message("Building designer components.") - -set(QT_QML_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/qml") - -include(FetchContent) -FetchContent_Declare( - ds - GIT_TAG qds-4.1 - GIT_REPOSITORY https://code.qt.io/qt-labs/qtquickdesigner-components.git -) - -FetchContent_GetProperties(ds) -FetchContent_Populate(ds) - -target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE - QuickStudioComponentsplugin - QuickStudioEffectsplugin - QuickStudioApplicationplugin - FlowViewplugin - QuickStudioLogicHelperplugin - QuickStudioMultiTextplugin - QuickStudioEventSimulatorplugin - QuickStudioEventSystemplugin -) - -add_subdirectory(${ds_SOURCE_DIR} ${ds_BINARY_DIR}) - -target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE - BULD_QDS_COMPONENTS=true -) diff --git a/src/ui/qmlmodules b/src/ui/qmlmodules deleted file mode 100644 index b295765802a7472af5ff7b70795225b487fa5b6c..0000000000000000000000000000000000000000 --- a/src/ui/qmlmodules +++ /dev/null @@ -1,17 +0,0 @@ -### This file is automatically generated by Qt Design Studio. -### Do not change - -qt6_add_qml_module(${CMAKE_PROJECT_NAME} - URI "Main" - VERSION 1.0 - NO_PLUGIN - QML_FILES main.qml -) - -add_subdirectory(content) -add_subdirectory(imports) - -target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE - contentplugin - DesignViewerplugin -) diff --git a/src/ui/qtquickcontrols2.conf b/src/ui/qtquickcontrols2.conf deleted file mode 100644 index b6c7c87ea13e055f11cebc15f4d6dd4578870250..0000000000000000000000000000000000000000 --- a/src/ui/qtquickcontrols2.conf +++ /dev/null @@ -1,2 +0,0 @@ -[Controls] -Style=Material diff --git a/src/ui/src/app_environment.h b/src/ui/src/app_environment.h deleted file mode 100644 index 6b42bff0d810c5120f63b20485b7a81240d8a321..0000000000000000000000000000000000000000 --- a/src/ui/src/app_environment.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * This file is automatically generated by Qt Design Studio. - * Do not change. -*/ - -#include <QGuiApplication> - -void set_qt_environment() -{ - qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "1"); - qputenv("QT_ENABLE_HIGHDPI_SCALING", "0"); - qputenv("QT_LOGGING_RULES", "qt.qml.connections=false"); - qputenv("QT_QUICK_CONTROLS_CONF", ":/qtquickcontrols2.conf"); - qputenv("QML_COMPAT_RESOLVE_URLS_ON_ASSIGNMENT", "1"); -} diff --git a/src/ui/src/import_qml_components_plugins.h b/src/ui/src/import_qml_components_plugins.h deleted file mode 100644 index 0ecaef918cce4a5517becfeafd1d550f28958608..0000000000000000000000000000000000000000 --- a/src/ui/src/import_qml_components_plugins.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * This file is automatically generated by Qt Design Studio. - * Do not change. -*/ - -#include "qqmlextensionplugin.h" - -#ifdef BULD_QDS_COMPONENTS - -Q_IMPORT_QML_PLUGIN(QtQuick_Studio_ComponentsPlugin) -Q_IMPORT_QML_PLUGIN(QtQuick_Studio_EffectsPlugin) -Q_IMPORT_QML_PLUGIN(QtQuick_Studio_ApplicationPlugin) -Q_IMPORT_QML_PLUGIN(FlowViewPlugin) -Q_IMPORT_QML_PLUGIN(QtQuick_Studio_LogicHelperPlugin) -Q_IMPORT_QML_PLUGIN(QtQuick_Studio_MultiTextPlugin) -Q_IMPORT_QML_PLUGIN(QtQuick_Studio_EventSimulatorPlugin) -Q_IMPORT_QML_PLUGIN(QtQuick_Studio_EventSystemPlugin) -Q_IMPORT_QML_PLUGIN(QtQuick_Studio_EffectsPlugin) - -#endif diff --git a/src/ui/src/import_qml_plugins.h b/src/ui/src/import_qml_plugins.h deleted file mode 100644 index 6f2a161bd373f354517075c46e70e7a5df5aa4c8..0000000000000000000000000000000000000000 --- a/src/ui/src/import_qml_plugins.h +++ /dev/null @@ -1,9 +0,0 @@ -/* - * This file is automatically generated by Qt Design Studio. - * Do not change. -*/ - -#include <QtQml/qqmlextensionplugin.h> - -Q_IMPORT_QML_PLUGIN(contentPlugin) -Q_IMPORT_QML_PLUGIN(DesignViewerPlugin) diff --git a/src/ui/src/main.cpp b/src/ui/src/main.cpp deleted file mode 100644 index b335b3317d0241ab3d9dd462f6f2930f22a5047e..0000000000000000000000000000000000000000 --- a/src/ui/src/main.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only - -#include <QGuiApplication> -#include <QQmlApplicationEngine> - -#include "app_environment.h" -#include "import_qml_components_plugins.h" -#include "import_qml_plugins.h" - -int main(int argc, char *argv[]) -{ - set_qt_environment(); - - QGuiApplication app(argc, argv); - - QQmlApplicationEngine engine; - const QUrl url(u"qrc:Main/main.qml"_qs); - QObject::connect( - &engine, &QQmlApplicationEngine::objectCreated, &app, - [url](QObject *obj, const QUrl &objUrl) { - if (!obj && url == objUrl) - QCoreApplication::exit(-1); - }, - Qt::QueuedConnection); - - engine.addImportPath(QCoreApplication::applicationDirPath() + "/qml"); - engine.addImportPath(":/"); - - engine.load(url); - - if (engine.rootObjects().isEmpty()) { - return -1; - } - - return app.exec(); -} diff --git a/src/ui/translations.db b/src/ui/translations.db deleted file mode 100644 index c8306d07379f4b62c1a2ff52a3c57553e68bd10e..0000000000000000000000000000000000000000 Binary files a/src/ui/translations.db and /dev/null differ