From 2af89a712358461bfea60e7c2906406f521011dd Mon Sep 17 00:00:00 2001 From: Kimmo Ollila Date: Fri, 2 Dec 2022 12:16:07 +0200 Subject: New Boot2Qt Demo Launcher app for Qt 6 Task-number: QTBUG-106373 Change-Id: I4867d60b351a92f363e4c1891cb3e0280325e0fd Reviewed-by: Samuli Piippo --- CMakeLists.txt | 38 +++ QtLauncher/ApplicationIcon.qml | 53 +++ QtLauncher/Background.qml | 21 ++ QtLauncher/BootScreen.qml | 37 ++ QtLauncher/BusyIndicator.qml | 62 ++++ QtLauncher/CMakeLists.txt | 94 ++++++ QtLauncher/CornerFrameImage.qml | 87 +++++ QtLauncher/DemoHeader.qml | 139 ++++++++ QtLauncher/DemoInfoPopup.qml | 99 ++++++ QtLauncher/DemoSurface.qml | 59 ++++ QtLauncher/DetailView.qml | 138 ++++++++ QtLauncher/DetailViewIcon.qml | 42 +++ QtLauncher/FlickSlider.qml | 18 + QtLauncher/GridViewIcon.qml | 37 ++ QtLauncher/Header.qml | 158 +++++++++ QtLauncher/Keyboard.qml | 11 + QtLauncher/LaunchScreen.qml | 35 ++ QtLauncher/LauncherCompositor.qml | 37 ++ QtLauncher/Main.qml | 54 +++ QtLauncher/MainWindow.qml | 131 ++++++++ QtLauncher/QtImageProviders/CMakeLists.txt | 31 ++ QtLauncher/QtImageProviders/imageproviders.cpp | 214 ++++++++++++ QtLauncher/QtImageProviders/imageproviders.h | 37 ++ QtLauncher/QtImageProviders/plugin.cpp | 25 ++ QtLauncher/QtImageProviders/thumbnail.png | Bin 0 -> 9517 bytes QtLauncher/SettingsButton.qml | 20 ++ QtLauncher/ViewSettings.qml | 22 ++ QtLauncher/applicationsmodel.cpp | 202 +++++++++++ QtLauncher/applicationsmodel.h | 66 ++++ QtLauncher/applicationsmodel_p.h | 29 ++ QtLauncher/circularindicator.cpp | 137 ++++++++ QtLauncher/circularindicator.h | 59 ++++ QtLauncher/engine.cpp | 76 +++++ QtLauncher/engine.h | 37 ++ QtLauncher/icons/Built_with_Qt_RGB_logo_white.svg | 32 ++ QtLauncher/icons/close_icon.svg | 1 + QtLauncher/icons/detail_icon.svg | 91 +++++ QtLauncher/icons/grid_icon.svg | 63 ++++ QtLauncher/icons/header_toggle_icon.svg | 1 + QtLauncher/icons/info_icon.svg | 1 + QtLauncher/icons/mouse_icon.svg | 91 +++++ QtLauncher/icons/qt_logo_green_rgb.svg | 20 ++ QtLauncher/icons/settings_icon.svg | 1 + QtLauncher/icons/stop_icon.svg | 1 + QtLauncher/icons/touch_icon.svg | 68 ++++ QtLauncher/images/QtCorner.png | Bin 0 -> 3242 bytes QtLauncher/images/backImg.jpg | Bin 0 -> 58447 bytes QtLauncher/images/glow.png | Bin 0 -> 14711 bytes QtLauncher/settingsmanager.cpp | 54 +++ QtLauncher/settingsmanager.h | 39 +++ README | 23 +- fonts.qrc | 24 -- icons.qrc | 24 -- images.qrc | 5 - main.cpp | 71 ++++ qml.qrc | 29 -- qml/AboutQt.qml | 105 ------ qml/ApplicationIcon.qml | 74 ---- qml/AutoScroller.qml | 75 ----- qml/Background.qml | 45 --- qml/BootScreen.qml | 61 ---- qml/BusyIndicator.qml | 84 ----- qml/DemoHeader.qml | 158 --------- qml/DemoInfoPopup.qml | 130 ------- qml/DemoMode.qml | 393 ---------------------- qml/DetailView.qml | 166 --------- qml/DetailViewIcon.qml | 60 ---- qml/FlickSlider.qml | 56 --- qml/GlobalIndicator.qml | 55 --- qml/GridViewIcon.qml | 47 --- qml/HandwritingModeButton.qml | 164 --------- qml/Header.qml | 62 ---- qml/HighlightShader.qml | 62 ---- qml/ImageTextDelegate.qml | 73 ---- qml/LaunchScreen.qml | 61 ---- qml/LauncherCheckBox.qml | 74 ---- qml/LayoutSettings.qml | 198 ----------- qml/Main.qml | 84 ----- qml/MainWindow.qml | 378 --------------------- qml/ViewSettings.qml | 49 --- qml/fonts/Montserrat-Bold.ttf | Bin 191648 -> 0 bytes qml/fonts/Montserrat-Light.ttf | Bin 192116 -> 0 bytes qml/fonts/Montserrat-Medium.ttf | Bin 192488 -> 0 bytes qml/fonts/Montserrat-Regular.ttf | Bin 190648 -> 0 bytes qml/fonts/Teko-Bold.ttf | Bin 305800 -> 0 bytes qml/fonts/Teko-Light.ttf | Bin 301528 -> 0 bytes qml/fonts/Teko-Medium.ttf | Bin 310028 -> 0 bytes qml/fonts/Teko-Regular.ttf | Bin 311780 -> 0 bytes qml/fonts/TitilliumWeb-Black.ttf | Bin 49356 -> 0 bytes qml/fonts/TitilliumWeb-Bold.ttf | Bin 59908 -> 0 bytes qml/fonts/TitilliumWeb-BoldItalic.ttf | Bin 69796 -> 0 bytes qml/fonts/TitilliumWeb-ExtraLight.ttf | Bin 63124 -> 0 bytes qml/fonts/TitilliumWeb-ExtraLightItalic.ttf | Bin 67788 -> 0 bytes qml/fonts/TitilliumWeb-Italic.ttf | Bin 72416 -> 0 bytes qml/fonts/TitilliumWeb-Light.ttf | Bin 64032 -> 0 bytes qml/fonts/TitilliumWeb-LightItalic.ttf | Bin 71720 -> 0 bytes qml/fonts/TitilliumWeb-Regular.ttf | Bin 63752 -> 0 bytes qml/fonts/TitilliumWeb-SemiBold.ttf | Bin 63044 -> 0 bytes qml/fonts/TitilliumWeb-SemiBoldItalic.ttf | Bin 71812 -> 0 bytes qml/fonts/fontawesome-webfont.ttf | Bin 165548 -> 0 bytes qml/icons/Built_with_Qt_RGB_logo_white.svg | 32 -- qml/icons/FloatingButton_Active.svg | 41 --- qml/icons/FloatingButton_Available.svg | 41 --- qml/icons/FloatingButton_Unavailable.svg | 39 --- qml/icons/back_icon.svg | 1 - qml/icons/bluetooth_icon.svg | 1 - qml/icons/checkmark.svg | 10 - qml/icons/close_icon.svg | 1 - qml/icons/date-time_icon.svg | 1 - qml/icons/detail.svg | 1 - qml/icons/detail_icon.svg | 91 ----- qml/icons/detail_icon_disabled.svg | 91 ----- qml/icons/display_icon.svg | 1 - qml/icons/grid_icon.svg | 63 ---- qml/icons/grid_icon_disabled.svg | 63 ---- qml/icons/header_toggle.png | Bin 675 -> 0 bytes qml/icons/header_toggle_icon.svg | 1 - qml/icons/info_icon.svg | 1 - qml/icons/language_icon.svg | 1 - qml/icons/mouse_icon.svg | 91 ----- qml/icons/mouse_icon_disabled.svg | 92 ----- qml/icons/mute_icon.svg | 1 - qml/icons/network_icon.svg | 1 - qml/icons/pause_icon.svg | 1 - qml/icons/play_icon.svg | 1 - qml/icons/power_icon.svg | 1 - qml/icons/qt_logo_green_rgb.svg | 20 -- qml/icons/settings_icon.svg | 1 - qml/icons/settingsmenu_launcher_icon.svg | 95 ------ qml/icons/spinner.png | Bin 11738 -> 0 bytes qml/icons/stop_icon.svg | 1 - qml/icons/touch_icon.svg | 68 ---- qml/icons/touch_icon_disabled.svg | 68 ---- qml/icons/volume_icon.svg | 1 - qml/images/backImg.jpg | Bin 127975 -> 0 bytes qml/settings.xml | 53 --- screenshot/Button.qml | 65 ---- screenshot/Main.qml | 191 ----------- screenshot/plugin/plugin.cpp | 77 ----- screenshot/plugin/qmldir | 3 - screenshot/plugin/screenshot.pro | 17 - src/applicationsettings.cpp | 81 ----- src/applicationsettings.h | 63 ---- src/applicationsmodel.cpp | 210 ------------ src/applicationsmodel.h | 90 ----- src/applicationsmodel_p.h | 54 --- src/automationhelper.cpp | 91 ----- src/automationhelper.h | 47 --- src/circularindicator.cpp | 162 --------- src/circularindicator.h | 84 ----- src/engine.cpp | 176 ---------- src/engine.h | 126 ------- src/fpscounter.cpp | 46 --- src/fpscounter.h | 56 --- src/imageproviders.cpp | 167 --------- src/imageproviders.h | 55 --- src/main.cpp | 167 --------- src/settingsmanager.cpp | 121 ------- src/settingsmanager.h | 77 ----- startup.pro | 45 --- 160 files changed, 2851 insertions(+), 6053 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 QtLauncher/ApplicationIcon.qml create mode 100644 QtLauncher/Background.qml create mode 100644 QtLauncher/BootScreen.qml create mode 100644 QtLauncher/BusyIndicator.qml create mode 100644 QtLauncher/CMakeLists.txt create mode 100644 QtLauncher/CornerFrameImage.qml create mode 100644 QtLauncher/DemoHeader.qml create mode 100644 QtLauncher/DemoInfoPopup.qml create mode 100644 QtLauncher/DemoSurface.qml create mode 100644 QtLauncher/DetailView.qml create mode 100644 QtLauncher/DetailViewIcon.qml create mode 100644 QtLauncher/FlickSlider.qml create mode 100644 QtLauncher/GridViewIcon.qml create mode 100644 QtLauncher/Header.qml create mode 100644 QtLauncher/Keyboard.qml create mode 100644 QtLauncher/LaunchScreen.qml create mode 100644 QtLauncher/LauncherCompositor.qml create mode 100644 QtLauncher/Main.qml create mode 100644 QtLauncher/MainWindow.qml create mode 100644 QtLauncher/QtImageProviders/CMakeLists.txt create mode 100644 QtLauncher/QtImageProviders/imageproviders.cpp create mode 100644 QtLauncher/QtImageProviders/imageproviders.h create mode 100644 QtLauncher/QtImageProviders/plugin.cpp create mode 100644 QtLauncher/QtImageProviders/thumbnail.png create mode 100644 QtLauncher/SettingsButton.qml create mode 100644 QtLauncher/ViewSettings.qml create mode 100644 QtLauncher/applicationsmodel.cpp create mode 100644 QtLauncher/applicationsmodel.h create mode 100644 QtLauncher/applicationsmodel_p.h create mode 100644 QtLauncher/circularindicator.cpp create mode 100644 QtLauncher/circularindicator.h create mode 100644 QtLauncher/engine.cpp create mode 100644 QtLauncher/engine.h create mode 100644 QtLauncher/icons/Built_with_Qt_RGB_logo_white.svg create mode 100644 QtLauncher/icons/close_icon.svg create mode 100644 QtLauncher/icons/detail_icon.svg create mode 100644 QtLauncher/icons/grid_icon.svg create mode 100644 QtLauncher/icons/header_toggle_icon.svg create mode 100644 QtLauncher/icons/info_icon.svg create mode 100644 QtLauncher/icons/mouse_icon.svg create mode 100644 QtLauncher/icons/qt_logo_green_rgb.svg create mode 100644 QtLauncher/icons/settings_icon.svg create mode 100644 QtLauncher/icons/stop_icon.svg create mode 100644 QtLauncher/icons/touch_icon.svg create mode 100644 QtLauncher/images/QtCorner.png create mode 100644 QtLauncher/images/backImg.jpg create mode 100644 QtLauncher/images/glow.png create mode 100644 QtLauncher/settingsmanager.cpp create mode 100644 QtLauncher/settingsmanager.h delete mode 100644 fonts.qrc delete mode 100644 icons.qrc delete mode 100644 images.qrc create mode 100644 main.cpp delete mode 100644 qml.qrc delete mode 100644 qml/AboutQt.qml delete mode 100644 qml/ApplicationIcon.qml delete mode 100644 qml/AutoScroller.qml delete mode 100644 qml/Background.qml delete mode 100644 qml/BootScreen.qml delete mode 100644 qml/BusyIndicator.qml delete mode 100644 qml/DemoHeader.qml delete mode 100644 qml/DemoInfoPopup.qml delete mode 100644 qml/DemoMode.qml delete mode 100644 qml/DetailView.qml delete mode 100644 qml/DetailViewIcon.qml delete mode 100644 qml/FlickSlider.qml delete mode 100644 qml/GlobalIndicator.qml delete mode 100644 qml/GridViewIcon.qml delete mode 100644 qml/HandwritingModeButton.qml delete mode 100644 qml/Header.qml delete mode 100644 qml/HighlightShader.qml delete mode 100644 qml/ImageTextDelegate.qml delete mode 100644 qml/LaunchScreen.qml delete mode 100644 qml/LauncherCheckBox.qml delete mode 100644 qml/LayoutSettings.qml delete mode 100644 qml/Main.qml delete mode 100644 qml/MainWindow.qml delete mode 100644 qml/ViewSettings.qml delete mode 100644 qml/fonts/Montserrat-Bold.ttf delete mode 100644 qml/fonts/Montserrat-Light.ttf delete mode 100644 qml/fonts/Montserrat-Medium.ttf delete mode 100644 qml/fonts/Montserrat-Regular.ttf delete mode 100644 qml/fonts/Teko-Bold.ttf delete mode 100644 qml/fonts/Teko-Light.ttf delete mode 100644 qml/fonts/Teko-Medium.ttf delete mode 100644 qml/fonts/Teko-Regular.ttf delete mode 100644 qml/fonts/TitilliumWeb-Black.ttf delete mode 100644 qml/fonts/TitilliumWeb-Bold.ttf delete mode 100644 qml/fonts/TitilliumWeb-BoldItalic.ttf delete mode 100644 qml/fonts/TitilliumWeb-ExtraLight.ttf delete mode 100644 qml/fonts/TitilliumWeb-ExtraLightItalic.ttf delete mode 100644 qml/fonts/TitilliumWeb-Italic.ttf delete mode 100644 qml/fonts/TitilliumWeb-Light.ttf delete mode 100644 qml/fonts/TitilliumWeb-LightItalic.ttf delete mode 100644 qml/fonts/TitilliumWeb-Regular.ttf delete mode 100644 qml/fonts/TitilliumWeb-SemiBold.ttf delete mode 100644 qml/fonts/TitilliumWeb-SemiBoldItalic.ttf delete mode 100644 qml/fonts/fontawesome-webfont.ttf delete mode 100644 qml/icons/Built_with_Qt_RGB_logo_white.svg delete mode 100644 qml/icons/FloatingButton_Active.svg delete mode 100644 qml/icons/FloatingButton_Available.svg delete mode 100644 qml/icons/FloatingButton_Unavailable.svg delete mode 100644 qml/icons/back_icon.svg delete mode 100644 qml/icons/bluetooth_icon.svg delete mode 100644 qml/icons/checkmark.svg delete mode 100644 qml/icons/close_icon.svg delete mode 100644 qml/icons/date-time_icon.svg delete mode 100644 qml/icons/detail.svg delete mode 100644 qml/icons/detail_icon.svg delete mode 100644 qml/icons/detail_icon_disabled.svg delete mode 100644 qml/icons/display_icon.svg delete mode 100644 qml/icons/grid_icon.svg delete mode 100644 qml/icons/grid_icon_disabled.svg delete mode 100644 qml/icons/header_toggle.png delete mode 100644 qml/icons/header_toggle_icon.svg delete mode 100644 qml/icons/info_icon.svg delete mode 100644 qml/icons/language_icon.svg delete mode 100644 qml/icons/mouse_icon.svg delete mode 100644 qml/icons/mouse_icon_disabled.svg delete mode 100644 qml/icons/mute_icon.svg delete mode 100644 qml/icons/network_icon.svg delete mode 100644 qml/icons/pause_icon.svg delete mode 100644 qml/icons/play_icon.svg delete mode 100644 qml/icons/power_icon.svg delete mode 100644 qml/icons/qt_logo_green_rgb.svg delete mode 100644 qml/icons/settings_icon.svg delete mode 100644 qml/icons/settingsmenu_launcher_icon.svg delete mode 100644 qml/icons/spinner.png delete mode 100644 qml/icons/stop_icon.svg delete mode 100644 qml/icons/touch_icon.svg delete mode 100644 qml/icons/touch_icon_disabled.svg delete mode 100644 qml/icons/volume_icon.svg delete mode 100644 qml/images/backImg.jpg delete mode 100644 qml/settings.xml delete mode 100644 screenshot/Button.qml delete mode 100644 screenshot/Main.qml delete mode 100644 screenshot/plugin/plugin.cpp delete mode 100644 screenshot/plugin/qmldir delete mode 100644 screenshot/plugin/screenshot.pro delete mode 100644 src/applicationsettings.cpp delete mode 100644 src/applicationsettings.h delete mode 100644 src/applicationsmodel.cpp delete mode 100644 src/applicationsmodel.h delete mode 100644 src/applicationsmodel_p.h delete mode 100644 src/automationhelper.cpp delete mode 100644 src/automationhelper.h delete mode 100644 src/circularindicator.cpp delete mode 100644 src/circularindicator.h delete mode 100644 src/engine.cpp delete mode 100644 src/engine.h delete mode 100644 src/fpscounter.cpp delete mode 100644 src/fpscounter.h delete mode 100644 src/imageproviders.cpp delete mode 100644 src/imageproviders.h delete mode 100644 src/main.cpp delete mode 100644 src/settingsmanager.cpp delete mode 100644 src/settingsmanager.h delete mode 100644 startup.pro diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..5ea404a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,38 @@ +cmake_minimum_required(VERSION 3.16) + +project(qtlauncher VERSION 1.0 LANGUAGES CXX) + +find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick QuickControls2 WaylandCompositor) +qt_standard_project_setup(REQUIRES 6.5) + +if(NOT DEFINED USE_SHARED_BUILD) + message("Doing STATIC build") + set(USE_STATIC_BUILD_FLAG TRUE) + set(BUILD_TYPE_FLAG "STATIC") +else() + message("Doing SHARED build") + set(USE_STATIC_BUILD_FLAG FALSE) + set(BUILD_TYPE_FLAG "SHARED") +endif() + +qt_add_executable(${PROJECT_NAME} + main.cpp +) + +if(NOT DEFINED USE_SHARED_BUILD) + target_compile_definitions(${PROJECT_NAME} PRIVATE USE_STATIC_BUILD_FLAG) +endif() + +target_link_libraries(${PROJECT_NAME} PRIVATE + Qt6::Gui + Qt6::Qml + $<$:QtLauncherplugin> + $<$:QtImageProvidersPlugin> +) + +add_subdirectory(QtLauncher) + +install(TARGETS ${PROJECT_NAME} + BUNDLE DESTINATION . + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/QtLauncher/ApplicationIcon.qml b/QtLauncher/ApplicationIcon.qml new file mode 100644 index 0000000..824b69e --- /dev/null +++ b/QtLauncher/ApplicationIcon.qml @@ -0,0 +1,53 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +pragma ComponentBehavior: Bound + +import QtQuick + +Item { + id: appIcon + required property string name + required property string icon + required property real pageMargin + + property bool highlight: false + property bool isSelected: false + property alias preview: previewImage + property alias hoverSource: hoverItem.source + + signal clicked() + + Image { + id: previewImage; + anchors.fill: parent + anchors.margins: appIcon.pageMargin * 0.5 + source: appIcon.highlight ? "image://QtSquareImage/%1".arg(appIcon.icon) : + "image://QtSquareImage/gradient/%1".arg(appIcon.icon) + sourceSize: Qt.size(width, height) + + Image { + id: hoverItem + anchors.fill: parent + source: "image://QtImageMask/hover" + sourceSize: Qt.size(width, height) + opacity: appIcon.highlight ? 1.0 : 0.0 + visible: !appIcon.isSelected && appIcon.highlight + } + } + + MouseArea { + anchors.fill: parent + hoverEnabled: SettingsManager.mouseSelected + + onClicked: appIcon.clicked() + + onEntered: { + if (hoverEnabled) + appIcon.highlight = true; + } + onExited: { + if (hoverEnabled) + appIcon.highlight = false + } + } +} diff --git a/QtLauncher/Background.qml b/QtLauncher/Background.qml new file mode 100644 index 0000000..189d122 --- /dev/null +++ b/QtLauncher/Background.qml @@ -0,0 +1,21 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick + +Image { + required property Engine engine + anchors.fill: parent + source: "images/backImg.jpg" + fillMode: Image.PreserveAspectCrop + + // QTBUG-63585, background image causes poor performance of flickable items + // on low-end gpu devices + visible: engine.state !== "running" + + Rectangle { + anchors.fill: parent + color: ViewSettings.backgroundColor + opacity: 0.9 + } +} diff --git a/QtLauncher/BootScreen.qml b/QtLauncher/BootScreen.qml new file mode 100644 index 0000000..d706a69 --- /dev/null +++ b/QtLauncher/BootScreen.qml @@ -0,0 +1,37 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick +import QtLauncher + +Item { + id: bootScreen + opacity: 0.95 + property alias applicationName: applicationNameText.text + + Column { + anchors.centerIn: parent + + BusyIndicator { + anchors.horizontalCenter: parent.horizontalCenter + width: bootScreen.width * 0.1 + } + + Text { + anchors.horizontalCenter: parent.horizontalCenter + font.family: ViewSettings.appFont + font.pixelSize: bootScreen.height * 0.05 + color: "white" + text: qsTr("Loading") + } + + Text { + id: applicationNameText + anchors.horizontalCenter: parent.horizontalCenter + font.family: ViewSettings.appFont + font.pixelSize: bootScreen.height * 0.05 + font.styleName: "Bold" + color: "white" + } + } +} diff --git a/QtLauncher/BusyIndicator.qml b/QtLauncher/BusyIndicator.qml new file mode 100644 index 0000000..a581708 --- /dev/null +++ b/QtLauncher/BusyIndicator.qml @@ -0,0 +1,62 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick +import QtLauncher + +CircularIndicator { + id: circularIndicator + height: width + padding: width * 0.1 + lineWidth: width * 0.05 + backgroundColor: ViewSettings.loaderBackgroundColor + progressColor: ViewSettings.loaderForegroundColor + + SequentialAnimation { + running: circularIndicator.visible + + // Fill 20 degrees of the circle before starting looping + NumberAnimation { + target: circularIndicator + property: "spanAngle" + from: 0 + to: 20 + duration: 200 + } + + SequentialAnimation { + loops: Animation.Infinite + + // Fill the circle, except have both caps still visible + NumberAnimation { + target: circularIndicator + property: "spanAngle" + from: 20 + to: 345 + duration: 800 + } + + // Clear the circle, except for a 20 degree head start. The head start is to + // avoid an abrupt change in the cap of the indicator arc from an end to a beginning. + ParallelAnimation { + + NumberAnimation { + target: circularIndicator + property: "startAngle" + from: 0 + to: 360 + duration: 800 + onStopped: circularIndicator.startAngle = 0 + } + + NumberAnimation { + target: circularIndicator + property: "spanAngle" + from: 345 + to: 20 + duration: 800 + } + } + } + } +} diff --git a/QtLauncher/CMakeLists.txt b/QtLauncher/CMakeLists.txt new file mode 100644 index 0000000..b0a40a2 --- /dev/null +++ b/QtLauncher/CMakeLists.txt @@ -0,0 +1,94 @@ +cmake_minimum_required(VERSION 3.16) + +project(QtLauncher VERSION 1.0 LANGUAGES CXX) + +find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick QuickControls2 WaylandCompositor) +qt_standard_project_setup(REQUIRES 6.5) + +set_source_files_properties("ViewSettings.qml" PROPERTIES + QT_QML_SINGLETON_TYPE TRUE +) + +set(qml_files + "Main.qml" + "BootScreen.qml" + "BusyIndicator.qml" + "Keyboard.qml" + "MainWindow.qml" + "DemoHeader.qml" + "DetailView.qml" + "Header.qml" + "LaunchScreen.qml" + "LauncherCompositor.qml" + "Background.qml" + "DemoInfoPopup.qml" + "DemoSurface.qml" + "GridViewIcon.qml" + "FlickSlider.qml" + "ApplicationIcon.qml" + "DetailViewIcon.qml" + "SettingsButton.qml" + "ViewSettings.qml" + "CornerFrameImage.qml" +) + +set(images + "images/backImg.jpg" + "images/QtCorner.png" + "images/glow.png" +) + +set(icons + "icons/close_icon.svg" + "icons/Built_with_Qt_RGB_logo_white.svg" + "icons/header_toggle_icon.svg" + "icons/info_icon.svg" + "icons/qt_logo_green_rgb.svg" + "icons/mouse_icon.svg" + "icons/detail_icon.svg" + "icons/settings_icon.svg" + "icons/grid_icon.svg" + "icons/touch_icon.svg" +) + +add_subdirectory(QtImageProviders) + +qt_add_qml_module(${PROJECT_NAME} + URI QtLauncher + VERSION 1.0 + ${BUILD_TYPE_FLAG} + DEPENDENCIES + QtQml + QtQuick + QML_FILES + ${qml_files} + RESOURCES + ${images} + ${icons} + SOURCES + engine.cpp engine.h + applicationsmodel.cpp applicationsmodel.h + settingsmanager.cpp settingsmanager.h + circularindicator.cpp circularindicator.h +) + +target_link_libraries(${PROJECT_NAME} PRIVATE + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Gui + Qt${QT_VERSION_MAJOR}::Quick +) + +if(NOT ${USE_STATIC_BUILD_FLAG}) + install(TARGETS ${PROJECT_NAME} + BUNDLE DESTINATION . + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + + install(TARGETS ${PROJECT_NAME}plugin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/qml/${PROJECT_NAME}" + ) + + install(FILES $/qmldir + DESTINATION "${CMAKE_INSTALL_LIBDIR}/qml/${PROJECT_NAME}" + ) +endif() diff --git a/QtLauncher/CornerFrameImage.qml b/QtLauncher/CornerFrameImage.qml new file mode 100644 index 0000000..31b2d8f --- /dev/null +++ b/QtLauncher/CornerFrameImage.qml @@ -0,0 +1,87 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick + +Item { + id: root + property alias source: contentRect.newImageSource + + onWidthChanged: contentRect.openChanged() + onHeightChanged: contentRect.openChanged() + + Image { + id: contentRect + width: -root.width * .006 + height: -root.width * .006 + anchors.centerIn: parent + smooth: !imageAnimation.running + property bool open: false + property string newImageSource: "" + + onNewImageSourceChanged: { + if (contentRect.open && contentRect.newImageSource) { + changeImageAnimation.restart() + } else if (!contentRect.newImageSource.endsWith("_missing")) { + contentRect.source = contentRect.newImageSource + } + } + + onStatusChanged: { + if (status == Image.Ready) + contentRect.open = true + else if (status == Image.Error) + contentRect.open = false + } + + onOpenChanged: { + if (open) { + var scaleFactor = Math.min(root.width / sourceSize.width, root.height / sourceSize.height) + contentRect.width = sourceSize.width * scaleFactor + contentRect.height = sourceSize.height * scaleFactor + } else { + contentRect.width = -root.width * .006 + contentRect.height = -root.width * .006 + } + } + + Behavior on width { NumberAnimation { id: imageAnimation; duration: 500; easing.type: Easing.InOutSine }} + Behavior on height { NumberAnimation { duration: 500; easing.type: Easing.InOutSine }} + + SequentialAnimation { + id: changeImageAnimation + + PropertyAction { target: contentRect; property: "open"; value: false} + PauseAnimation { duration: 500 } + + ScriptAction { + script: { + if (contentRect.newImageSource.endsWith("_missing")) contentRect.newImageSource = "" + contentRect.source = contentRect.newImageSource + } + } + } + + Image { + id: topCorner + width: contentRect.open && contentRect.status == Image.Ready ? root.width * .2: root.width * .25 + height: width + x: -width*.124 + y: x + source: "images/QtCorner.png" + + Behavior on width { NumberAnimation { duration: 500; easing.type: Easing.InOutSine }} + } + + Image { + id: bottomCorner + width: topCorner.width + height: width + x: parent.width - width + width * .124 + y: parent.height - height + width * .124 + source: "images/QtCorner.png" + mirror: true + mirrorVertically: true + } + } +} diff --git a/QtLauncher/DemoHeader.qml b/QtLauncher/DemoHeader.qml new file mode 100644 index 0000000..ad4a625 --- /dev/null +++ b/QtLauncher/DemoHeader.qml @@ -0,0 +1,139 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +pragma ComponentBehavior: Bound + +import QtQuick + +Rectangle { + id: demoHeaderBar + required property Engine engine + required property real pageMargin + width: parent.width + height: demoHeaderBar.pageMargin * 2.5 + color: ViewSettings.backgroundColor + opacity: 0.9 + y: 0 + z: 1 + visible: engine.state === "app-running" || engine.state === "app-launching" + + Behavior on y { YAnimator { duration: 100 } } + + property alias title: demoName.text + property bool open: y > -height/2 + + signal infoClicked() + signal closeClicked() + + Row { + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.margins: demoHeaderBar.pageMargin * 0.3 + spacing: demoHeaderBar.pageMargin + + Image { + id: headerLogo + source: "icons/qt_logo_green_rgb.svg" + height: parent.height + width: height / sourceSize.height * sourceSize.width + } + + Text { + id: demoName + height: parent.height + verticalAlignment: Text.AlignVCenter + font.pixelSize: parent.height * 0.5 + font.family: ViewSettings.appFont + font.styleName: "SemiBold" + color: "white" + } + } + + Row { + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.right: parent.right + anchors.margins: demoHeaderBar.pageMargin * 0.3 + spacing: demoHeaderBar.pageMargin + + Image { + id: infoImg + height: parent.height + width: height + source: "icons/info_icon.svg" + + MouseArea { + anchors.fill: parent + anchors.margins: -parent.height * 0.5 + onClicked: demoHeaderBar.infoClicked() + } + } + + Image { + id: applicationCloseButton + height: parent.height + width: height + source: "icons/close_icon.svg" + + MouseArea { + anchors.fill: parent + anchors.margins: -parent.height * 0.5 + onClicked: demoHeaderBar.closeClicked() + } + } + } + + Image { + id: headerToggleButton + source: "icons/header_toggle_icon.svg" + height: parent.height * 0.5 + width: height / sourceSize.height * sourceSize.width + anchors.horizontalCenter: parent.horizontalCenter + y: demoHeaderBar.open ? parent.height - height/2 : parent.height + rotation: demoHeaderBar.open ? 180 : 0 + Drag.active: headerToggleMouseArea.drag.active + + Behavior on rotation { RotationAnimator { duration: 100 } } + Behavior on y { YAnimator { duration: 100 } } + + MouseArea { + id: headerToggleMouseArea + anchors.fill: parent + anchors.margins: -parent.height * 0.5 + drag.target: demoHeaderBar + drag.axis: Drag.YAxis + drag.minimumX: -demoHeaderBar.height + drag.maximumY: 0 + + DropArea { + anchors.fill: parent + onDropped: demoHeaderVisibilityDelay.restart() + } + + onClicked: { + if (demoHeaderBar.y < -demoHeaderBar.height / 2) { + demoHeaderBar.y = 0 + demoHeaderVisibilityDelay.restart() + } else { + demoHeaderBar.y = -demoHeaderBar.height + } + } + + onReleased: { + demoHeaderBar.y = demoHeaderBar.y > -demoHeaderBar.height / 4 ? 0 : -demoHeaderBar.height + parent.Drag.drop() + } + } + } + + Component.onCompleted: demoHeaderVisibilityDelay.start() + + Timer { + id: demoHeaderVisibilityDelay + interval: 3000 + onTriggered: { + if (!demoHeaderVisibilityDelay.running) + demoHeaderBar.y = -demoHeaderBar.height + } + } +} diff --git a/QtLauncher/DemoInfoPopup.qml b/QtLauncher/DemoInfoPopup.qml new file mode 100644 index 0000000..cc6c899 --- /dev/null +++ b/QtLauncher/DemoInfoPopup.qml @@ -0,0 +1,99 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +pragma ComponentBehavior: Bound + +import QtQuick + +Item { + id: demoInfoPopup + required property real pageMargin + property alias description: tt.text + + function open() + { + visible = true; + } + + function close() + { + visible = false; + } + + Rectangle { + anchors.fill: parent + color: ViewSettings.backgroundColor + opacity: 0.3 + } + + // Prevent user from interacting with the transparent demo on the background + MouseArea { + anchors.fill: parent + } + + Image { + id: frame + source : "image://QtButtonImage/20/%1/%1".arg(ViewSettings.pine) + anchors.centerIn: parent + width: parent.width * 0.5 + height: parent.height * 0.8 + sourceSize: Qt.size(width, height) + + Image { + id: builtWithQtIcon + anchors.left: parent.left + anchors.top: parent.top + anchors.margins: demoInfoPopup.pageMargin + source: "icons/Built_with_Qt_RGB_logo_white.svg" + height: parent.height * 0.1 + width: height / sourceSize.height * sourceSize.width + } + + Image { + anchors.right: parent.right + anchors.verticalCenter: builtWithQtIcon.verticalCenter + anchors.margins: demoInfoPopup.pageMargin + source: "icons/close_icon.svg" + height: parent.height * 0.1 + width: height / sourceSize.height * sourceSize.width + + MouseArea { + anchors.fill: parent + anchors.margins: -demoInfoPopup.pageMargin * 0.5 + + onClicked: demoInfoPopup.close() + } + } + + Text { + id: infoTitle + anchors.top: builtWithQtIcon.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: demoInfoPopup.pageMargin + verticalAlignment: Text.AlignVCenter + height: builtWithQtIcon.height + font.pixelSize: height * 0.8 + color: "white" + font.family: ViewSettings.appFont + font.styleName: "SemiBold" + text: qsTr("About Current Demo") + wrapMode: Text.WordWrap + } + + Text { + id: tt + anchors.top: infoTitle.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.margins: demoInfoPopup.pageMargin + font.family: ViewSettings.appFont + font.styleName: "SemiBold" + font.pixelSize: infoTitle.font.pixelSize * 0.5 + color: "white" + text: "" + wrapMode: Text.WordWrap + elide: Text.ElideRight + } + } +} diff --git a/QtLauncher/DemoSurface.qml b/QtLauncher/DemoSurface.qml new file mode 100644 index 0000000..938b887 --- /dev/null +++ b/QtLauncher/DemoSurface.qml @@ -0,0 +1,59 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +pragma ComponentBehavior: Bound + +import QtQuick +import QtWayland.Compositor + +Repeater { + id: root + property string filename: "" + anchors.fill: parent + + signal surfaceVisible(visible: bool) + signal surfaceDestroyed(index: int) + + function scheduleScreenshot(filename: string) { + root.filename = filename + } + + delegate: ShellSurfaceItem { + id: chrome + required property var modelData + required property int index + anchors.centerIn: parent + shellSurface: modelData + + onWidthChanged: downscaleIfNeeded() + onHeightChanged: downscaleIfNeeded() + + function downscaleIfNeeded() { + if (width <= root.width && height <= root.height) { + scale = 1.0 + return; + } + scale = Math.min(root.width / width, root.height / height) + } + + onSurfaceChanged: { + if (root.filename) ssTimer.start() + root.surfaceVisible(false) + } + + onSurfaceDestroyed: root.surfaceDestroyed(index) + + Timer { + id: ssTimer + interval: 5000 + running: false + + onTriggered: { + chrome.grabToImage(function(result) { + result.saveToFile(root.filename); + root.filename = "" + demoHeader.title = qsTr("Screenshot taken. Thumbnail for this demo will be updated on next startup.") + }) + } + } + } +} diff --git a/QtLauncher/DetailView.qml b/QtLauncher/DetailView.qml new file mode 100644 index 0000000..7a1ddf0 --- /dev/null +++ b/QtLauncher/DetailView.qml @@ -0,0 +1,138 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +pragma ComponentBehavior: Bound + +import QtQuick +import QtQuick.Controls.Basic +import QtLauncher + +Item { + id: detailRoot + anchors.fill: parent + property alias appsModel: thumbList.model + required property real pageMargin + + Item { + id: detailInformation + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: listHolder.top + anchors.margins: detailRoot.pageMargin + + CornerFrameImage { + id: largeImg + anchors.right: parent.right + height: parent.height + width: parent.width * 0.5 + } + + Flickable { + id: detailFlickable + anchors.left: parent.left + anchors.right: largeImg.left + anchors.top: parent.top + anchors.bottom: startButton.top + anchors.bottomMargin: detailRoot.pageMargin * 0.5 + anchors.rightMargin: detailRoot.pageMargin + contentHeight: descriptionHolder.height + contentWidth: width + clip: true + + ScrollBar.vertical: FlickSlider { pageMargin: detailRoot.pageMargin } + + Column { + id: descriptionHolder + anchors.left: parent.left + anchors.right: parent.right + anchors.rightMargin: detailRoot.pageMargin * 0.5 + spacing: detailRoot.pageMargin * 0.5 + + Text { + id: descriptionTitle + font.pixelSize: detailInformation.height * 0.11 + width: descriptionHolder.width + text: qsTr("Demo Title") + color: ViewSettings.neon + font.family: ViewSettings.appFont + font.styleName: "SemiBold" + wrapMode: Text.WordWrap + } + + Rectangle { + id: btmLine + width: descriptionTitle.paintedWidth + height: 2 + } + + Text { + id: descriptionText + anchors.margins: detailRoot.pageMargin * 0.5 + font.pixelSize: detailInformation.height * 0.05 + font.family: ViewSettings.appFont + width: descriptionHolder.width + wrapMode: Text.WordWrap + color: "white" + elide: Text.ElideRight + } + } + } + + Image { + id: startButton + height: detailInformation.height * 0.14 + width: height * 3 + sourceSize: Qt.size(width,height) + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.margins: detailRoot.pageMargin * 0.5 + source : "image://QtButtonImage/10/%1/%1".arg(ViewSettings.buttonGreenColor) + + Text { + anchors.centerIn: parent + text: qsTr("Start") + color: "white" + font.pixelSize: parent.height * .5 + } + + MouseArea { + anchors.fill: parent + onClicked: detailRoot.appsModel.launchFromIndex(thumbList.currentIndex) + } + } + } + + Rectangle { + id: listHolder + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + height: parent.height * 0.35 + color: ViewSettings.demolistBackgroundColor + + ListView { + id: thumbList + anchors.fill: parent + anchors.margins: detailRoot.pageMargin * 0.5 + orientation: ListView.Horizontal + onCurrentIndexChanged: { + descriptionTitle.text = model.query(currentIndex, "name") + descriptionText.text = model.query(currentIndex, "description") + largeImg.source = model.query(currentIndex, "icon") + } + + delegate: DetailViewIcon { + required property var model + required property int index + pageMargin: detailRoot.pageMargin + height: thumbList.height + width: height + isSelected: thumbList.currentIndex === index + + onClicked: thumbList.currentIndex = index + } + + ScrollBar.horizontal: FlickSlider { pageMargin: detailRoot.pageMargin } + } + } +} diff --git a/QtLauncher/DetailViewIcon.qml b/QtLauncher/DetailViewIcon.qml new file mode 100644 index 0000000..39f8e8c --- /dev/null +++ b/QtLauncher/DetailViewIcon.qml @@ -0,0 +1,42 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +pragma ComponentBehavior: Bound + +import QtQuick + +ApplicationIcon { + id: root + + Image { + id: selectedItem + anchors.fill: root.preview + source: "image://QtImageMask/" + sourceSize: Qt.size(width, height) + visible: root.isSelected + } + + Image { + id: glow + anchors.centerIn: root.preview + width: root.preview.width * 2.1 + height: root.preview.height * 2.1 + source: "images/glow.png" + opacity: root.isSelected + z: -1 + + Behavior on opacity { OpacityAnimator { duration: 200; easing.type: Easing.InOutSine }} + } + + Text { + anchors.fill: parent + anchors.margins: root.pageMargin + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + font.pixelSize: parent.height * 0.1 + text: root.name + font.family: ViewSettings.appFont + color: ViewSettings.pine + wrapMode: Text.WordWrap + visible: root.highlight && !root.isSelected + } +} diff --git a/QtLauncher/FlickSlider.qml b/QtLauncher/FlickSlider.qml new file mode 100644 index 0000000..d8e45d6 --- /dev/null +++ b/QtLauncher/FlickSlider.qml @@ -0,0 +1,18 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick +import QtQuick.Controls.Basic + +ScrollBar { + id: root + required property real pageMargin + contentItem: Rectangle { + color: ViewSettings.scrollBarColor + implicitWidth: root.orientation === Qt.Horizontal ? root.availableWidth : root.pageMargin * 0.25 + implicitHeight: root.orientation === Qt.Vertical ? root.availableHeight : root.pageMargin * 0.25 + opacity: (root.active && root.size < 1.0) ? 1.0 : 0 + + Behavior on opacity { OpacityAnimator { duration: 500 } } + } +} diff --git a/QtLauncher/GridViewIcon.qml b/QtLauncher/GridViewIcon.qml new file mode 100644 index 0000000..d8c5317 --- /dev/null +++ b/QtLauncher/GridViewIcon.qml @@ -0,0 +1,37 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +pragma ComponentBehavior: Bound + +import QtQuick + +ApplicationIcon { + id: root + hoverSource: "image://QtImageMask/hover" + + Image { + id: glow + anchors.centerIn: root.preview + width: root.preview.width * 2.1 + height: root.preview.height * 2.1 + source: "images/glow.png" + sourceSize: Qt.size(width, height) + opacity: root.highlight ? 1 : 0 + z: -100 + + Behavior on opacity { OpacityAnimator { duration: 200; easing.type: Easing.InOutSine }} + } + + Text { + anchors.fill: parent + anchors.margins: root.pageMargin * 2 + font.pixelSize: parent.height * 0.08 + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + text: root.name + font.family: ViewSettings.appFont + font.styleName: "SemiBold" + color: ViewSettings.pine + wrapMode: Text.WordWrap + visible: root.highlight + } +} diff --git a/QtLauncher/Header.qml b/QtLauncher/Header.qml new file mode 100644 index 0000000..64150df --- /dev/null +++ b/QtLauncher/Header.qml @@ -0,0 +1,158 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick + +Item { + id: root + required property real pageMargin + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + height: root.pageMargin * 5 + + Rectangle { + anchors.fill: parent + visible: SettingsManager.gridSelected + gradient: Gradient { + GradientStop { position: 0.0; color: ViewSettings.backgroundColor } + GradientStop { position: 1.0; color: "transparent" } + } + } + + Item { + anchors.fill: parent + anchors.margins: root.pageMargin + + Item { + id: settingsMenu + anchors.left: parent.left + anchors.top: parent.top + height: parent.height + width: opened ? parent.width - qtLogo.width : height + clip: true + + property bool opened: false + + Behavior on width {NumberAnimation { duration: 500 } } + + function close() { + closeTimer.stop() + settingsMenu.opened = false + gearAnimation.direction = RotationAnimator.Counterclockwise + gearAnimation.restart() + } + + function open() { + settingsMenu.opened = true + gearAnimation.direction = RotationAnimator.Clockwise + gearAnimation.restart() + closeTimer.restart() + } + + Timer { + id: closeTimer + interval: 10000 + onTriggered: settingsMenu.close() + } + + MouseArea { + id: hoverMouseArea + anchors.fill: parent + hoverEnabled: true + enabled: SettingsManager.mouseSelected + onEntered: if (!settingsMenu.opened) settingsMenu.open() + onExited: if (settingsMenu.opened) settingsMenu.close() + } + + MouseArea { + anchors.left: parent.left + anchors.top: parent.top + height: parent.height + width: height + + onClicked: { + if (settingsMenu.opened) + settingsMenu.close() + else + settingsMenu.open() + } + } + + Image { + id: menuIcon + anchors.left: parent.left + anchors.top: parent.top + source: "icons/settings_icon.svg" + height: parent.height + width: height + sourceSize: Qt.size(width, height) + + RotationAnimator { + id: gearAnimation + target: menuIcon + duration: 500 + from: 0 + to: 180 + } + } + + Row { + id: settingsRow + anchors.top: parent.top + anchors.left: menuIcon.right + anchors.bottom: parent.bottom + anchors.right: parent.right + anchors.leftMargin: height * .5 + spacing: height + + Rectangle { + width: 2 + height: parent.height + color: "white" + } + + SettingsButton { + id: layoutIcon + source: SettingsManager.gridSelected ? "icons/grid_icon.svg" : "icons/detail_icon.svg" + + onClicked: { + closeTimer.restart() + SettingsManager.gridSelected = !SettingsManager.gridSelected + } + } + + Rectangle { + width: 2 + height: parent.height + color: "white" + } + + SettingsButton { + id: mouseIcon + source: SettingsManager.mouseSelected ? "icons/mouse_icon.svg" : "icons/touch_icon.svg" + + onClicked: { + closeTimer.restart() + SettingsManager.mouseSelected = !SettingsManager.mouseSelected + } + } + + Rectangle { + width: 2 + height: parent.height + color: "white" + } + } + } + + Image { + id: qtLogo + anchors.right: parent.right + anchors.top: parent.top + source: "icons/qt_logo_green_rgb.svg" + height: parent.height + width: height / sourceSize.height * sourceSize.width + } + } +} diff --git a/QtLauncher/Keyboard.qml b/QtLauncher/Keyboard.qml new file mode 100644 index 0000000..6252deb --- /dev/null +++ b/QtLauncher/Keyboard.qml @@ -0,0 +1,11 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick.VirtualKeyboard + +InputPanel { + visible: active + y: active ? parent.height - height : parent.height + anchors.left: parent.left + anchors.right: parent.right +} diff --git a/QtLauncher/LaunchScreen.qml b/QtLauncher/LaunchScreen.qml new file mode 100644 index 0000000..817bf06 --- /dev/null +++ b/QtLauncher/LaunchScreen.qml @@ -0,0 +1,35 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +pragma ComponentBehavior: Bound + +import QtQuick +import QtQuick.Controls.Basic + +Item { + id: gridroot + anchors.fill: parent + property alias appsModel: grid.model + required property real pageMargin + + GridView { + id: grid + anchors.fill: parent + anchors.leftMargin: gridroot.pageMargin * 1.5 + anchors.rightMargin: gridroot.pageMargin * 0.5 + cacheBuffer: 10000 + cellWidth: width / 3 + cellHeight: cellWidth + + ScrollBar.vertical: FlickSlider { pageMargin: gridroot.pageMargin } + + delegate: GridViewIcon { + required property var model + required property int index + + pageMargin: gridroot.pageMargin + height: grid.cellHeight *.9 + width: grid.cellWidth *.9 + onClicked: gridroot.appsModel.launchFromIndex(index) + } + } +} diff --git a/QtLauncher/LauncherCompositor.qml b/QtLauncher/LauncherCompositor.qml new file mode 100644 index 0000000..fc7ca15 --- /dev/null +++ b/QtLauncher/LauncherCompositor.qml @@ -0,0 +1,37 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick +import QtWayland.Compositor +import QtWayland.Compositor.IviApplication + +WaylandCompositor { + id: waylandCompositor + property bool scalableDemo: false + property string appsRoot: "" + property ListModel shellSurfaces: ListModel {} + property alias waylandOutput: output + + IviApplication { + + onIviSurfaceCreated: function(iviSurface) { + if (waylandCompositor.scalableDemo) iviSurface.sendConfigure(Qt.size(output.window.width, output.window.height)) + waylandCompositor.shellSurfaces.append({shellSurface: iviSurface}); + } + } + + extensions: [ + TextInputManager {}, + QtTextInputMethodManager {} + ] + WaylandOutput { + id: output + + + function handleShellSurface(shellSurface) { + waylandCompositor.shellSurfaces.append({shellSurface: shellSurface}); + } + + sizeFollowsWindow: false + } +} diff --git a/QtLauncher/Main.qml b/QtLauncher/Main.qml new file mode 100644 index 0000000..f2c6c2c --- /dev/null +++ b/QtLauncher/Main.qml @@ -0,0 +1,54 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick +import QtQuick.Window +import QtWayland.Compositor + +LauncherCompositor { + id: compositor + + waylandOutput.window: Window { + id: window + visible: true + width: Screen.desktopAvailableWidth + height: Screen.desktopAvailableHeight + color: ViewSettings.backgroundColor + + property real pageMargin: ViewSettings.margin * Math.min(window.width, window.height) + + Loader { + id: mainWindowLoader + anchors.fill: parent + active: false + asynchronous: true + + onLoaded: { + splashScreenLoader.item.visible = false; + splashScreenLoader.source = ""; + } + } + + Loader { + id: splashScreenLoader + anchors.fill: parent + sourceComponent: Item { + anchors.fill: parent + + BootScreen { + anchors.fill: parent + applicationName: qsTr("Qt Launcher") + } + } + onLoaded: { + mainWindowLoader.setSource("qrc:/qt/qml/QtLauncher/MainWindow.qml", {"compositor" : compositor, "shellSurfaces" : compositor.shellSurfaces, "window" : window, "pageMargin" : window.pageMargin}) + mainWindowLoader.active = true; + } + } + + Loader { + anchors.fill: parent + source: "qrc:/qt/qml/QtLauncher/Keyboard.qml" + } + } +} diff --git a/QtLauncher/MainWindow.qml b/QtLauncher/MainWindow.qml new file mode 100644 index 0000000..8502605 --- /dev/null +++ b/QtLauncher/MainWindow.qml @@ -0,0 +1,131 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +pragma ComponentBehavior: Bound + +import QtQuick +import QtQuick.Window +import QtLauncher +import QtLauncher.QtImageProviders + +Item { + id: mainWindow + anchors.fill: parent + required property LauncherCompositor compositor + required property ListModel shellSurfaces + required property Window window + required property real pageMargin + + ApplicationsModel { + id: applicationsModel + + onReady: { + engine.markApplicationsModelReady(); + contentLoader.active = true + } + + Component.onCompleted: { + //Set the directory to parse for apps + initialize(mainWindow.compositor.appsRoot); + } + + function launchFromIndex(index: int) { + demoInfoPopup.description = applicationsModel.query(index, "description") + demoHeader.title = applicationsModel.query(index, "name") + mainWindow.compositor.scalableDemo = applicationsModel.query(index, "scalable") + + var iconFile = "" + applicationsModel.query(index, "icon") + + //We don't have thumbnail image for this demo, let's schedule a screenshot + if (iconFile.endsWith("_missing")) { + demoSurface.scheduleScreenshot(iconFile.replace("_missing", "")) + } + + appLoadScreen.applicationName = applicationsModel.query(index, "name") + appLoadScreen.visible = true + + engine.launchApplication(applicationsModel.query(index, "binary"), + applicationsModel.query(index, "arguments"), + applicationsModel.query(index, "environment") + ) + } + } + + Background { + engine: engine + BootScreen { + id: appLoadScreen + visible: false + anchors.fill: parent + } + } + + Component { + id: gridComponent + + LaunchScreen { + id: launchScreen + appsModel: applicationsModel + pageMargin: mainWindow.pageMargin + } + } + + Component { + id: detailComponent + + DetailView { + id: detailView + appsModel: applicationsModel + pageMargin: mainWindow.pageMargin + } + } + + Engine { + id: engine + } + + Item { + id: root + anchors.fill: parent + + Loader { + id: contentLoader + visible: engine.state === "running" + anchors.fill: parent + anchors.topMargin: header.height + mainWindow.pageMargin + sourceComponent: SettingsManager.gridSelected ? gridComponent : detailComponent + active: false + } + + Header { + id: header + pageMargin: mainWindow.pageMargin + visible: engine.state === "running" + } + + DemoSurface { + id: demoSurface + model: mainWindow.shellSurfaces + anchors.fill: parent + onSurfaceVisible: (visible)=> { appLoadScreen.visible = visible; } + onSurfaceDestroyed: (index)=> { mainWindow.shellSurfaces.remove(index); } + } + + DemoHeader { + id: demoHeader + engine: engine + pageMargin: mainWindow.pageMargin + visible: engine.state === "app-running" + onInfoClicked: demoInfoPopup.open() + onCloseClicked: engine.closeApplication(); + } + + DemoInfoPopup { + id: demoInfoPopup + pageMargin: mainWindow.pageMargin + visible: false + height: mainWindow.height + width: mainWindow.width + z: demoHeader.z + 1 + } + } +} diff --git a/QtLauncher/QtImageProviders/CMakeLists.txt b/QtLauncher/QtImageProviders/CMakeLists.txt new file mode 100644 index 0000000..d095dc3 --- /dev/null +++ b/QtLauncher/QtImageProviders/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.16) +project(QtImageProviders LANGUAGES CXX) + +find_package(Qt6 REQUIRED COMPONENTS Core Qml Quick) +qt_standard_project_setup(REQUIRES 6.5) + +qt_add_qml_module(${PROJECT_NAME}Plugin + URI QtLauncher.QtImageProviders + VERSION 1.0 + ${BUILD_TYPE_FLAG} + PLUGIN_TARGET ${PROJECT_NAME}Plugin + NO_PLUGIN_OPTIONAL + NO_GENERATE_PLUGIN_SOURCE + CLASS_NAME ${PROJECT_NAME}Plugin + SOURCES + imageproviders.cpp imageproviders.h + plugin.cpp + RESOURCES + thumbnail.png +) + +target_link_libraries(${PROJECT_NAME}Plugin PRIVATE Qt::Quick) + +if(NOT ${USE_STATIC_BUILD_FLAG}) + install(TARGETS ${PROJECT_NAME}Plugin + DESTINATION "${CMAKE_INSTALL_LIBDIR}/qml/QtLauncher/${PROJECT_NAME}" + ) + install(FILES $/qmldir + DESTINATION "${CMAKE_INSTALL_LIBDIR}/qml/QtLauncher/${PROJECT_NAME}" + ) +endif() diff --git a/QtLauncher/QtImageProviders/imageproviders.cpp b/QtLauncher/QtImageProviders/imageproviders.cpp new file mode 100644 index 0000000..6dcd038 --- /dev/null +++ b/QtLauncher/QtImageProviders/imageproviders.cpp @@ -0,0 +1,214 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include "imageproviders.h" + +#include +#include +#include +#include +#include +#include +#include + +static const int CORNER_CUTSIZE = 20; +static const int BORDERSIZE = 3; + +void cutEdges(QImage &image, int cutSize) +{ + if (!image.isNull()) { + const int w = image.width()-1; + const int h = image.height()-1; + if (w >= cutSize && h >= cutSize) { + for (int y=0; y <= cutSize; y++) { + for (int x=0; x <= (cutSize - y); x++) { + image.setPixelColor(x, y, QColor(Qt::transparent)); + image.setPixelColor(w - x, h - y, QColor(Qt::transparent)); + } + } + } + } +} + +void drawBorders(QPainter& painter, int w, int h, int cutSize, const QColor &color) +{ + QPen pen; + pen.setCosmetic(true); + pen.setWidth(3); + pen.setColor(color); + + painter.setPen(pen); + painter.setBrush(Qt::NoBrush); + + QPainterPath path; + path.moveTo(cutSize + 1, 1); + path.lineTo(w - 1, 1); + path.lineTo(w - 1, h - cutSize - 1); + path.lineTo(w - cutSize - 1, h - 1); + path.lineTo(1, h - 1); + path.lineTo(1, cutSize + 1); + path.lineTo(cutSize + 1, 1); + path.closeSubpath(); + painter.drawPath(path); +} + +QtImageProvider::QtImageProvider() : QQuickImageProvider(QQuickImageProvider::Pixmap) +{ +} + +QPixmap QtImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) +{ + Q_UNUSED(size); + Q_UNUSED(requestedSize); + + QString idd = id; + idd.remove("file://"); + + if (idd.endsWith("_missing")) + idd = ":/qt/qml/QtLauncher/QtImageProviders/thumbnail.png"; + + QImage image(idd); + + if (!image.isNull()) { + image = image.copy(BORDERSIZE, BORDERSIZE, image.width() - BORDERSIZE * 2, image.height() - BORDERSIZE * 2) + .convertToFormat(QImage::Format_ARGB32); + cutEdges(image, CORNER_CUTSIZE); + } + + return QPixmap::fromImage(image); +} + +QtSquareImageProvider::QtSquareImageProvider() : QQuickImageProvider(QQuickImageProvider::Pixmap) +{ +} + +QPixmap QtSquareImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) +{ + Q_UNUSED(size); + Q_UNUSED(requestedSize); + + QString idd = id; + + idd.remove("file://"); + idd.remove("gradient/"); + + if (idd.endsWith("_missing")) + idd = ":/qt/qml/QtLauncher/QtImageProviders/thumbnail.png"; + + QImage image(idd); + + if (!image.isNull()) { + const int min = qMin(image.width(), image.height()); + + image = image.copy(image.width() / 2 + BORDERSIZE - min / 2, image.height() / 2 + BORDERSIZE - min / 2, min - BORDERSIZE * 2, min - BORDERSIZE * 2) + .scaled(requestedSize.width(), requestedSize.height()) + .convertToFormat(QImage::Format_ARGB32); + + if (id.contains("gradient")) { + QPainter p(&image); + QRect r = image.rect(); + QLinearGradient gradient(r.topLeft(), r.bottomLeft()); + gradient.setColorAt(0, QColor(0xff, 0xff, 0xff, 0x99)); + gradient.setColorAt(0.5, Qt::transparent); + gradient.setColorAt(1, QColor(0x0, 0x41, 0x4a, 0x88)); + p.fillRect(r, gradient); + } + + cutEdges(image, CORNER_CUTSIZE); + } + + return QPixmap::fromImage(image); +} + +QtImageMaskProvider::QtImageMaskProvider() : QQuickImageProvider(QQuickImageProvider::Pixmap) +{ +} + +QPixmap QtImageMaskProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) +{ + Q_UNUSED(size); + + if (requestedSize.width() <= 0) + return QPixmap(1, 1); + + QImage image(requestedSize.width(), requestedSize.height(), QImage::Format_ARGB32); + image.fill(Qt::transparent); + + QPainter p(&image); + + if (id.contains("hover")) { + QRect r = image.rect().adjusted(1, 1, -1, -1); + QColor color(44,222,133, 200); + p.fillRect(r, color); + } + + cutEdges(image, CORNER_CUTSIZE); + drawBorders(p, image.width(), image.height(), CORNER_CUTSIZE, QColor(0x2c, 0xde, 0x85)); + return QPixmap::fromImage(image); +} + +QtButtonImageProvider::QtButtonImageProvider() : QQuickImageProvider(QQuickImageProvider::Pixmap) +{ +} + +QPixmap QtButtonImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) +{ + bool ok = false; + + QStringList params = id.split("/"); + + int cutSize = params.at(0).toInt(&ok); + + if (!ok) + cutSize = 10; + + QColor fillColor; + QColor borderColor; + + if (params.length() > 1) { + fillColor = QColor(params.at(1)); + } + + if (params.length() > 2) + borderColor = QColor(params.at(2)); + + if (!fillColor.isValid()) + fillColor = QColor(0x41, 0xcd, 0x52); + + if (!borderColor.isValid()) + borderColor ="white"; + + int width = 100; + int height = 50; + + if (size) + *size = QSize(requestedSize.width(), requestedSize.height()); + + QPixmap pixmap(requestedSize.width() > 0 ? requestedSize.width() : width, + requestedSize.height() > 0 ? requestedSize.height() : height); + pixmap.fill(Qt::transparent); + + QPainter painter(&pixmap); + const qreal borderPenWidth = 2; + QPen borderPen(QBrush(borderColor), borderPenWidth); + borderPen.setJoinStyle(Qt::MiterJoin); + painter.setRenderHint(QPainter::Antialiasing, true); + painter.setPen(borderPen); + painter.setBrush(fillColor); + + QPainterPath path; + qreal top = borderPenWidth - 1; + qreal left = borderPenWidth - 1; + qreal bottom = pixmap.height() - borderPenWidth; + qreal right = pixmap.width() - borderPenWidth; + path.moveTo(left + cutSize, top); + path.lineTo(right, top); + path.lineTo(right, bottom - cutSize); + path.lineTo(right - cutSize, bottom); + path.lineTo(left, bottom); + path.lineTo(left, top + cutSize); + path.lineTo(left + cutSize, top); + painter.drawPath(path); + + return pixmap; +} diff --git a/QtLauncher/QtImageProviders/imageproviders.h b/QtLauncher/QtImageProviders/imageproviders.h new file mode 100644 index 0000000..efb91fd --- /dev/null +++ b/QtLauncher/QtImageProviders/imageproviders.h @@ -0,0 +1,37 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#ifndef IMAGEPROVIDERS_H +#define IMAGEPROVIDERS_H + +#include + +class QtImageProvider : public QQuickImageProvider +{ +public: + QtImageProvider(); + QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize); +}; + +class QtSquareImageProvider : public QQuickImageProvider +{ +public: + QtSquareImageProvider(); + QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize); +}; + +class QtImageMaskProvider : public QQuickImageProvider +{ +public: + QtImageMaskProvider(); + QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize); +}; + +class QtButtonImageProvider : public QQuickImageProvider +{ +public: + QtButtonImageProvider(); + QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize); +}; + +#endif // IMAGEPROVIDERS_H diff --git a/QtLauncher/QtImageProviders/plugin.cpp b/QtLauncher/QtImageProviders/plugin.cpp new file mode 100644 index 0000000..e17732d --- /dev/null +++ b/QtLauncher/QtImageProviders/plugin.cpp @@ -0,0 +1,25 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include +#include + +void qml_register_types_QtLauncher_QtImageProviders(); + +class QtImageProvidersPlugin : public QQmlEngineExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) +public: + void initializeEngine(QQmlEngine *engine, const char *uri) final + { + volatile auto registration = &qml_register_types_QtLauncher_QtImageProviders; + Q_UNUSED(registration); + Q_UNUSED(uri); + + engine->addImageProvider("QtSquareImage", new QtSquareImageProvider); + engine->addImageProvider("QtImageMask", new QtImageMaskProvider); + engine->addImageProvider("QtButtonImage", new QtButtonImageProvider); + } +}; +#include "plugin.moc" diff --git a/QtLauncher/QtImageProviders/thumbnail.png b/QtLauncher/QtImageProviders/thumbnail.png new file mode 100644 index 0000000..5353f85 Binary files /dev/null and b/QtLauncher/QtImageProviders/thumbnail.png differ diff --git a/QtLauncher/SettingsButton.qml b/QtLauncher/SettingsButton.qml new file mode 100644 index 0000000..74a7492 --- /dev/null +++ b/QtLauncher/SettingsButton.qml @@ -0,0 +1,20 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick + +Image { + id: root + height: parent.height + width: height + sourceSize: Qt.size(width, height) + + signal clicked() + + MouseArea { + anchors.fill: parent + anchors.margins: - width * 0.3 + + onClicked: root.clicked() + } +} diff --git a/QtLauncher/ViewSettings.qml b/QtLauncher/ViewSettings.qml new file mode 100644 index 0000000..bd6d2b4 --- /dev/null +++ b/QtLauncher/ViewSettings.qml @@ -0,0 +1,22 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +pragma Singleton + +import QtQuick + +QtObject { + readonly property real margin: 0.03 + readonly property string appFont: "TitilliumWeb" + readonly property color backgroundColor: "#00414a" + readonly property color demolistBackgroundColor: "#002e34" + readonly property color borderColor: "#9d9faa" + readonly property color buttonGreenColor: "#2cde85" + readonly property color buttonGrayColor: "#9d9faa" + readonly property color buttonActiveColor: "#216729" + readonly property color loaderBackgroundColor: "#0a8550" + readonly property color loaderForegroundColor: "#2cde85" + readonly property color scrollBarColor: "#2cde85" + readonly property color neon: "#2cde85" + readonly property color pine: "#00414a" +} diff --git a/QtLauncher/applicationsmodel.cpp b/QtLauncher/applicationsmodel.cpp new file mode 100644 index 0000000..a706255 --- /dev/null +++ b/QtLauncher/applicationsmodel.cpp @@ -0,0 +1,202 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include "applicationsmodel.h" +#include "applicationsmodel_p.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +static bool appOrder(const AppData& a, const AppData& b) +{ + if (a.priority != b.priority) + return a.priority > b.priority; + return a.name < b.name; +} + +void IndexingThread::run() +{ + QList results; + QList roots = root.split(":"); + foreach (const QString &root, roots) { + QDirIterator it(root, QDir::Dirs | QDir::NoDotDot); + while (it.hasNext()) { + QString path = it.next(); + if (QFile::exists(path + "/demo.xml")) + parseDemo(path, results); + } + } + + std::sort(results.begin(), results.end(), appOrder); + + qDebug() << "Indexer: all done... total:" << results.size(); + emit indexingFinished(results); +} + +void IndexingThread::parseDemo(QString path, QList &results) { + + QFile file(path + "/demo.xml"); + + if (!file.open(QIODevice::ReadOnly)) + return; + + QXmlStreamReader xml(&file); + + AppData data; + while (!xml.atEnd()) { + switch (xml.readNext()) { + + case QXmlStreamReader::StartElement: + if (xml.name().toString().toLower() == "application") { + data.location = QUrl::fromLocalFile(path); + data.name = xml.attributes().value("title").toString().trimmed(); + + QString fileName = xml.attributes().value("icon").toString(); + if (fileName.isEmpty()) + fileName = "screenshot.png"; + + QString imageName = QString("%1/%2") + .arg(path, fileName); + + data.icon = QFile::exists(imageName) + ? QUrl::fromLocalFile(imageName) + : QUrl::fromLocalFile(imageName.append("_missing")); + + data.priority = xml.attributes().value("priority").toInt(); + + data.binary = xml.attributes().value("binary").toString(); + data.arguments = xml.attributes().value("arguments").toString(); + data.scalable = xml.attributes().value("scalable").toInt(); + + } else if (xml.name().toString().toLower() == "environment") { + + while (xml.readNextStartElement()) { + if (xml.name().toString().toLower() == "variable" && + xml.attributes().hasAttribute("name") && + xml.attributes().hasAttribute("value")) { + data.environment.insert(xml.attributes().value("name").toString(), xml.attributes().value("value").toString()); + xml.skipCurrentElement(); + } else { + xml.skipCurrentElement(); + } + } + + } else if (xml.name().toString().toLower() == "description") { + data.description = xml.readElementText().trimmed(); + } + break; + + case QXmlStreamReader::EndElement: + if (xml.name().toString().toLower() == "application") + results << data; + break; + + default: + break; + } + } + + if (xml.error() != QXmlStreamReader::NoError) + qWarning("XML Parser error: %s", qPrintable(xml.errorString())); +} + +ApplicationsModel::ApplicationsModel(QObject *parent) : + QAbstractItemModel(parent) +{ +} + +QHash ApplicationsModel::roleNames() const +{ + QHash names; + names[NameRole] = "name"; + names[DescriptionRole] = "description"; + names[LocationRole] = "location"; + names[IconRole] = "icon"; + names[PriorityRole] = "priority"; + names[BinaryRole] = "binary"; + names[ArgumentsRole] = "arguments"; + names[EnvironmentRole] = "environment"; + names[ScalableRole] = "scalable"; + return names; +} + +void ApplicationsModel::initialize(const QString &appsRoot) +{ + auto *thread = new IndexingThread; + thread->root = appsRoot; + thread->model = this; + qRegisterMetaType>("QList"); + connect(thread, &IndexingThread::indexingFinished, + this, &ApplicationsModel::handleIndexingResult); + connect(thread, &QThread::finished, thread, &QObject::deleteLater); + thread->start(); +} + +QVariant ApplicationsModel::data(const QModelIndex &index, int role) const +{ + Q_ASSERT(index.row() >= 0 && index.row() < m_data.size()); + Q_ASSERT(index.column() == 0); + + const AppData &ad = m_data.at(index.row()); + + switch (role) { + case NameRole: return ad.name; + case DescriptionRole: return ad.description; + case LocationRole: return ad.location; + case IconRole: return ad.icon; + case PriorityRole: return ad.priority; + case BinaryRole: return ad.binary; + case ArgumentsRole: return ad.arguments; + case EnvironmentRole: return ad.environment; + case ScalableRole: return ad.scalable; + + default: qDebug() << "ApplicationsModel::data: unhandled role" << role; + } + + return QVariant(); +} + +QVariant ApplicationsModel::query(int i, const QString &name) const +{ + if (i < 0 || i >= m_data.size()) { + return QVariant(); + } + + const AppData &ad = m_data.at(i); + if (name == QStringLiteral("description")) + return ad.description; + if (name == QStringLiteral("name")) + return ad.name; + if (name == QStringLiteral("location")) + return ad.location; + if (name == QStringLiteral("icon")) + return ad.icon; + if (name == QStringLiteral("priority")) + return ad.priority; + if (name == QStringLiteral("binary")) + return ad.binary; + if (name == QStringLiteral("arguments")) + return ad.arguments; + if (name == QStringLiteral("environment")) + return ad.environment; + if (name == QStringLiteral("scalable")) + return ad.scalable; + + qWarning("ApplicationsModel::query: Asking for bad name %s", qPrintable(name)); + + return QVariant(); +} + +void ApplicationsModel::handleIndexingResult(QList results) +{ + beginResetModel(); + m_data = results; + endResetModel(); + emit ready(); +} diff --git a/QtLauncher/applicationsmodel.h b/QtLauncher/applicationsmodel.h new file mode 100644 index 0000000..e1ea24b --- /dev/null +++ b/QtLauncher/applicationsmodel.h @@ -0,0 +1,66 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#ifndef APPLICATIONSMODEL_H +#define APPLICATIONSMODEL_H + +#include "qqmlintegration.h" +#include +#include + +struct AppData { + QString name; + QString description; + QUrl location; + QUrl icon; + int priority; + QString binary; + QString arguments; + QMap environment; + bool scalable; +}; + +class ApplicationsModel : public QAbstractItemModel +{ + Q_OBJECT + QML_ELEMENT + +public: + enum { + NameRole = Qt::UserRole + 1, + DescriptionRole, + LocationRole, + IconRole, + PriorityRole, + BinaryRole, + ArgumentsRole, + EnvironmentRole, + ScalableRole + }; + + explicit ApplicationsModel(QObject *parent = 0); + + Q_INVOKABLE void initialize(const QString &appsRoot); + + QModelIndex index(int r, int c, const QModelIndex &) const { return createIndex(r, c); } + QModelIndex parent(const QModelIndex&) const { return QModelIndex(); } + int rowCount(const QModelIndex&) const { return m_data.size(); } + int columnCount(const QModelIndex&) const { return 1; } + QVariant data(const QModelIndex &index, int role) const; + + QHash roleNames() const; + + Q_INVOKABLE QVariant query(int i, const QString &name) const; + +signals: + void ready(); + +private slots: + void handleIndexingResult(QList results); + +private: + + QList m_data; +}; + +#endif // APPLICATIONSMODEL_H diff --git a/QtLauncher/applicationsmodel_p.h b/QtLauncher/applicationsmodel_p.h new file mode 100644 index 0000000..f462034 --- /dev/null +++ b/QtLauncher/applicationsmodel_p.h @@ -0,0 +1,29 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#ifndef APPLICATIONSMODEL_P_H +#define APPLICATIONSMODEL_P_H + +#include "applicationsmodel.h" + +#include + +class IndexingThread : public QThread +{ + Q_OBJECT +public: + virtual ~IndexingThread() = default; + void run() final; + +private: + void parseDemo(QString path, QList &results); + +signals: + void indexingFinished(QList results); + +public: + QString root; + ApplicationsModel *model = nullptr; +}; + +#endif // APPLICATIONSMODEL_P_H diff --git a/QtLauncher/circularindicator.cpp b/QtLauncher/circularindicator.cpp new file mode 100644 index 0000000..b32b14c --- /dev/null +++ b/QtLauncher/circularindicator.cpp @@ -0,0 +1,137 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include "circularindicator.h" + +CircularIndicator::CircularIndicator(QQuickItem *parent) + : QQuickPaintedItem(parent) + , m_startAngle(0) + , m_spanAngle(360) + , m_lineWidth(10) + , m_progressColor(QColor(255, 0, 0)) + , m_backgroundColor(QColor(240, 240, 240)) + , m_padding(1) +{ +} + +int CircularIndicator::startAngle() const +{ + return m_startAngle; +} + +void CircularIndicator::setStartAngle(int angle) +{ + if (angle == m_startAngle) + return; + + m_startAngle = angle; + emit startAngleChanged(m_startAngle); + update(); +} + +int CircularIndicator::spanAngle() const +{ + return m_spanAngle; +} + +void CircularIndicator::setSpanAngle(int angle) +{ + if (angle == m_spanAngle) + return; + + m_spanAngle = angle; + emit spanAngleChanged(m_spanAngle); + update(); +} + +int CircularIndicator::lineWidth() const +{ + return m_lineWidth; +} + +void CircularIndicator::setLineWidth(int width) +{ + if (width == m_lineWidth) + return; + + m_lineWidth = width; + emit lineWidthChanged(m_lineWidth); + update(); +} + +QColor CircularIndicator::progressColor() const +{ + return m_progressColor; +} + +void CircularIndicator::setProgressColor(const QColor &color) +{ + if (color == m_progressColor) + return; + + m_progressColor = color; + emit progressColorChanged(m_progressColor); + update(); +} + +QColor CircularIndicator::backgroundColor() const +{ + return m_backgroundColor; +} + +void CircularIndicator::setBackgroundColor(const QColor &color) +{ + if (color == m_backgroundColor) + return; + + m_backgroundColor = color; + emit backgroundColorChanged(m_backgroundColor); + update(); +} + +int CircularIndicator::padding() const +{ + return m_padding; +} + +void CircularIndicator::setPadding(int padding) +{ + if (padding == m_padding) + return; + + m_padding = padding; + emit paddingChanged(m_padding); + update(); +} + +void CircularIndicator::paint(QPainter *painter) +{ + painter->setRenderHint(QPainter::Antialiasing); + + const int indicatorSize = qMin(width(), height()) - m_padding * 2 - m_lineWidth; + + if (indicatorSize <= 0) + return; + + QRect indicatorRect(width() / 2 - indicatorSize / 2, + height() / 2 - indicatorSize / 2, + indicatorSize, + indicatorSize); + + QPen pen; + pen.setCapStyle(Qt::RoundCap); + pen.setWidth(m_lineWidth); + + // Draw the background + pen.setColor(m_backgroundColor); + painter->setPen(pen); + painter->drawArc(indicatorRect, 0, 360 * 16); + + if (m_startAngle == m_spanAngle) + return; + + // Draw the foreground + pen.setColor(m_progressColor); + painter->setPen(pen); + painter->drawArc(indicatorRect, (90 - m_startAngle) * 16, -m_spanAngle * 16); +} diff --git a/QtLauncher/circularindicator.h b/QtLauncher/circularindicator.h new file mode 100644 index 0000000..dfe02c8 --- /dev/null +++ b/QtLauncher/circularindicator.h @@ -0,0 +1,59 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#ifndef CIRCULARINDICATOR_H +#define CIRCULARINDICATOR_H + +#include +#include + +class CircularIndicator : public QQuickPaintedItem +{ + Q_OBJECT + Q_PROPERTY(int startAngle READ startAngle WRITE setStartAngle NOTIFY startAngleChanged) + Q_PROPERTY(int spanAngle READ spanAngle WRITE setSpanAngle NOTIFY spanAngleChanged) + Q_PROPERTY(int lineWidth READ lineWidth WRITE setLineWidth NOTIFY lineWidthChanged) + Q_PROPERTY(QColor progressColor READ progressColor WRITE setProgressColor NOTIFY progressColorChanged) + Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged) + Q_PROPERTY(int padding READ padding WRITE setPadding NOTIFY paddingChanged) + QML_ELEMENT + +public: + CircularIndicator(QQuickItem *parent = 0); + ~CircularIndicator() = default; + + int startAngle() const; + int spanAngle() const; + int lineWidth() const; + QColor progressColor() const; + QColor backgroundColor() const; + int padding() const; + + void setStartAngle(int angle); + void setSpanAngle(int angle); + void setLineWidth(int width); + void setProgressColor(const QColor &color); + void setBackgroundColor(const QColor &color); + void setPadding(int padding); + +signals: + void startAngleChanged(int); + void spanAngleChanged(int); + void lineWidthChanged(int); + void progressColorChanged(QColor); + void backgroundColorChanged(QColor); + void paddingChanged(int); + +protected: + void paint(QPainter *painter); + +private: + int m_startAngle; + int m_spanAngle; + int m_lineWidth; + QColor m_progressColor; + QColor m_backgroundColor; + int m_padding; +}; + +#endif // CIRCULARINDICATOR_H diff --git a/QtLauncher/engine.cpp b/QtLauncher/engine.cpp new file mode 100644 index 0000000..1aadfa0 --- /dev/null +++ b/QtLauncher/engine.cpp @@ -0,0 +1,76 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include "engine.h" + +#include +#include + +#define ENGINE_STATE_RUNNING QStringLiteral("running") +#define ENGINE_STATE_APPLAUNCHING QStringLiteral("app-launching") +#define ENGINE_STATE_APPRUNNING QStringLiteral("app-running") +#define ENGINE_STATE_APPCLOSING QStringLiteral("app-closing") + +Engine::Engine(QQuickItem *parent) + : QQuickItem(parent) +{ + m_state = ENGINE_STATE_RUNNING; + + connect(&m_process, &QProcess::stateChanged, this, + [=](QProcess::ProcessState newState) { + if (newState == QProcess::Starting) setState(ENGINE_STATE_APPLAUNCHING); + if (newState == QProcess::Running) setState(ENGINE_STATE_APPRUNNING); + if (newState == QProcess::NotRunning) setState(ENGINE_STATE_RUNNING); + } + ); + + connect(&m_process, &QProcess::errorOccurred, this, + [=](QProcess::ProcessError error) { + qWarning() << m_process.readAllStandardError(); + m_process.close(); + setState(ENGINE_STATE_RUNNING); + } + ); +} + +void Engine::setState(const QString &state) +{ + if (state == m_state) + return; + m_state = state; + emit engineStateChanged(m_state); +} + +void Engine::markApplicationsModelReady() +{ + m_state = ENGINE_STATE_RUNNING; + emit engineStateChanged(m_state); +} + +void Engine::launchApplication(const QString &binary, const QString &arguments, const QVariantMap &env) +{ + if (m_state != ENGINE_STATE_RUNNING) + return; + + setState(ENGINE_STATE_APPLAUNCHING); + + QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); + environment.insert("QT_IM_MODULE", ""); + environment.insert("QT_QPA_PLATFORM", "wayland-egl"); + + for (QVariantMap::const_iterator i = env.begin(); i !=env.end(); ++i) { + environment.insert(i.key(), i.value().toString()); + } + + QFileInfo info(binary); + m_process.setProcessEnvironment(environment); + m_process.setProgram(info.absoluteFilePath()); + m_process.setWorkingDirectory(info.dir().path()); + m_process.setArguments(arguments.split(" ")); + m_process.start(); +} + +void Engine::closeApplication() +{ + m_process.close(); +} diff --git a/QtLauncher/engine.h b/QtLauncher/engine.h new file mode 100644 index 0000000..4410644 --- /dev/null +++ b/QtLauncher/engine.h @@ -0,0 +1,37 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#ifndef ENGINE_H +#define ENGINE_H + +#include +#include + +class Engine : public QQuickItem +{ + Q_OBJECT + Q_PROPERTY(QString state READ state WRITE setState NOTIFY engineStateChanged) + Q_PROPERTY(const QString qtVersion READ qtVersion CONSTANT) + QML_ELEMENT + +public: + explicit Engine(QQuickItem *parent = nullptr); + + QString state() const { return m_state; } + void setState(const QString &state); + QString qtVersion() const { return QT_VERSION_STR; } + +signals: + void engineStateChanged(const QString &state); + +public slots: + void markApplicationsModelReady(); + void launchApplication(const QString &binary, const QString &arguments = "", const QVariantMap &env = QVariantMap()); + void closeApplication(); + +private: + QString m_state; + QProcess m_process; +}; + +#endif // ENGINE_H diff --git a/QtLauncher/icons/Built_with_Qt_RGB_logo_white.svg b/QtLauncher/icons/Built_with_Qt_RGB_logo_white.svg new file mode 100644 index 0000000..cd972bd --- /dev/null +++ b/QtLauncher/icons/Built_with_Qt_RGB_logo_white.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + diff --git a/QtLauncher/icons/close_icon.svg b/QtLauncher/icons/close_icon.svg new file mode 100644 index 0000000..311721e --- /dev/null +++ b/QtLauncher/icons/close_icon.svg @@ -0,0 +1 @@ +close \ No newline at end of file diff --git a/QtLauncher/icons/detail_icon.svg b/QtLauncher/icons/detail_icon.svg new file mode 100644 index 0000000..f62ec81 --- /dev/null +++ b/QtLauncher/icons/detail_icon.svg @@ -0,0 +1,91 @@ + + + + + + image/svg+xml + + detail + + + + + + detail + + + + + + diff --git a/QtLauncher/icons/grid_icon.svg b/QtLauncher/icons/grid_icon.svg new file mode 100644 index 0000000..fe08f0c --- /dev/null +++ b/QtLauncher/icons/grid_icon.svg @@ -0,0 +1,63 @@ + + + + + + image/svg+xml + + grid_icon + + + + + + grid_icon + + diff --git a/QtLauncher/icons/header_toggle_icon.svg b/QtLauncher/icons/header_toggle_icon.svg new file mode 100644 index 0000000..18f71c5 --- /dev/null +++ b/QtLauncher/icons/header_toggle_icon.svg @@ -0,0 +1 @@ +header_toggle \ No newline at end of file diff --git a/QtLauncher/icons/info_icon.svg b/QtLauncher/icons/info_icon.svg new file mode 100644 index 0000000..8a7d960 --- /dev/null +++ b/QtLauncher/icons/info_icon.svg @@ -0,0 +1 @@ +info \ No newline at end of file diff --git a/QtLauncher/icons/mouse_icon.svg b/QtLauncher/icons/mouse_icon.svg new file mode 100644 index 0000000..8d5d088 --- /dev/null +++ b/QtLauncher/icons/mouse_icon.svg @@ -0,0 +1,91 @@ + + + + + + image/svg+xml + + mouse_icon + + + + + + + + + + mouse_icon + + + + + + + diff --git a/QtLauncher/icons/qt_logo_green_rgb.svg b/QtLauncher/icons/qt_logo_green_rgb.svg new file mode 100644 index 0000000..06ba1ff --- /dev/null +++ b/QtLauncher/icons/qt_logo_green_rgb.svg @@ -0,0 +1,20 @@ + + + + + + + + + + diff --git a/QtLauncher/icons/settings_icon.svg b/QtLauncher/icons/settings_icon.svg new file mode 100644 index 0000000..7862920 --- /dev/null +++ b/QtLauncher/icons/settings_icon.svg @@ -0,0 +1 @@ +settings \ No newline at end of file diff --git a/QtLauncher/icons/stop_icon.svg b/QtLauncher/icons/stop_icon.svg new file mode 100644 index 0000000..c694e55 --- /dev/null +++ b/QtLauncher/icons/stop_icon.svg @@ -0,0 +1 @@ +stop \ No newline at end of file diff --git a/QtLauncher/icons/touch_icon.svg b/QtLauncher/icons/touch_icon.svg new file mode 100644 index 0000000..0237b64 --- /dev/null +++ b/QtLauncher/icons/touch_icon.svg @@ -0,0 +1,68 @@ + + + + + + image/svg+xml + + touch_icon + + + + + + touch_icon + + + diff --git a/QtLauncher/images/QtCorner.png b/QtLauncher/images/QtCorner.png new file mode 100644 index 0000000..ea361fa Binary files /dev/null and b/QtLauncher/images/QtCorner.png differ diff --git a/QtLauncher/images/backImg.jpg b/QtLauncher/images/backImg.jpg new file mode 100644 index 0000000..877afe7 Binary files /dev/null and b/QtLauncher/images/backImg.jpg differ diff --git a/QtLauncher/images/glow.png b/QtLauncher/images/glow.png new file mode 100644 index 0000000..0ed878f Binary files /dev/null and b/QtLauncher/images/glow.png differ diff --git a/QtLauncher/settingsmanager.cpp b/QtLauncher/settingsmanager.cpp new file mode 100644 index 0000000..9d9c52e --- /dev/null +++ b/QtLauncher/settingsmanager.cpp @@ -0,0 +1,54 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include "settingsmanager.h" + +SettingsManager::SettingsManager(QObject *parent) : + QObject(parent), + m_settings("The Qt Company", "Qt Demo Launcher") +{ +} + +SettingsManager::~SettingsManager() +{ + m_settings.sync(); +} + +QVariant SettingsManager::getValue(const QString &key, const QVariant &defaultValue) +{ + return m_settings.value(key, defaultValue); +} + +void SettingsManager::setValue(const QString &key, const QVariant &value) +{ + m_settings.setValue(key, value); + m_settings.sync(); +} + +bool SettingsManager::gridSelected() +{ + return getValue("gridSelected", false).toBool(); +} + +void SettingsManager::setGridSelected(bool enabled) +{ + if (gridSelected() == enabled) + return; + + setValue("gridSelected", enabled); + emit gridSelectedChanged(enabled); +} + +bool SettingsManager::mouseSelected() +{ + return getValue("mouseSelected", false).toBool(); +} + +void SettingsManager::setMouseSelected(bool enabled) +{ + if (mouseSelected() == enabled) + return; + + setValue("mouseSelected", enabled); + emit mouseSelectedChanged(enabled); +} diff --git a/QtLauncher/settingsmanager.h b/QtLauncher/settingsmanager.h new file mode 100644 index 0000000..f65a707 --- /dev/null +++ b/QtLauncher/settingsmanager.h @@ -0,0 +1,39 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#ifndef SETTINGSMANAGER_H +#define SETTINGSMANAGER_H + +#include "qqmlintegration.h" +#include +#include + +class SettingsManager : public QObject +{ + Q_OBJECT + Q_PROPERTY(bool gridSelected READ gridSelected WRITE setGridSelected NOTIFY gridSelectedChanged) + Q_PROPERTY (bool mouseSelected READ mouseSelected WRITE setMouseSelected NOTIFY mouseSelectedChanged) + + QML_ELEMENT + QML_SINGLETON +public: + explicit SettingsManager(QObject *parent = nullptr); + ~SettingsManager(); + + bool gridSelected(); + void setGridSelected(bool enabled); + bool mouseSelected(); + void setMouseSelected(bool enabled); + + Q_INVOKABLE QVariant getValue(const QString& key, const QVariant &defaultValue); + Q_INVOKABLE void setValue(const QString& key, const QVariant &value); + +signals: + void gridSelectedChanged(bool enabled); + void mouseSelectedChanged(bool enabled); + +private: + QSettings m_settings; +}; + +#endif // SETTINGSMANAGER_H diff --git a/README b/README index 98d097c..d414b5b 100644 --- a/README +++ b/README @@ -1,20 +1,21 @@ -This is the Boot to Qt launcher, it can launch in-process QML applications +This is the Boot to Qt 6 Demo Launcher, it's a Wayland compositor that can launch Qt demo applications as Wayland clients. Command line options: --main-file [.qml file] Specify an optional qml file --applications-root [dir] The root of your directories, multiple can be given, separated by ':' - --no-boot-animation If you think it is boring, disable it +Each demo added to the launcher uses the following XML format named as demo.xml and located in -Generating new screenshots: ---------------------------- +--------------------------------------------------------------------------------------------------------------------------- + -First, cd into screenshot/plugin and compile/make install that plugin, then -run the launcher with the command line options: + + + + +SHORT DESCRIPTION OF THE DEMO APPEARING ON LAUNCHER + +--------------------------------------------------------------------------------------------------------------------------- -> qtlauncher --main-file screenshot/Main.qml --applications-root [your apps] - -When you hit the "grab" button, it will grab a highres "preview_l.jpg" and -a lowres copy into the application's directory. Resize to portrait to get -a portrait version, named "preview_p.jpg". +If icon image is not found, the launcher app creates one automatically on first demo startup. diff --git a/fonts.qrc b/fonts.qrc deleted file mode 100644 index 51030a9..0000000 --- a/fonts.qrc +++ /dev/null @@ -1,24 +0,0 @@ - - - qml/fonts/TitilliumWeb-Black.ttf - qml/fonts/TitilliumWeb-Bold.ttf - qml/fonts/TitilliumWeb-BoldItalic.ttf - qml/fonts/TitilliumWeb-ExtraLight.ttf - qml/fonts/TitilliumWeb-ExtraLightItalic.ttf - qml/fonts/TitilliumWeb-Italic.ttf - qml/fonts/TitilliumWeb-Light.ttf - qml/fonts/TitilliumWeb-LightItalic.ttf - qml/fonts/TitilliumWeb-Regular.ttf - qml/fonts/TitilliumWeb-SemiBold.ttf - qml/fonts/TitilliumWeb-SemiBoldItalic.ttf - qml/fonts/fontawesome-webfont.ttf - qml/fonts/Montserrat-Bold.ttf - qml/fonts/Montserrat-Light.ttf - qml/fonts/Montserrat-Medium.ttf - qml/fonts/Montserrat-Regular.ttf - qml/fonts/Teko-Bold.ttf - qml/fonts/Teko-Light.ttf - qml/fonts/Teko-Medium.ttf - qml/fonts/Teko-Regular.ttf - - diff --git a/icons.qrc b/icons.qrc deleted file mode 100644 index 40f8b2f..0000000 --- a/icons.qrc +++ /dev/null @@ -1,24 +0,0 @@ - - - qml/icons/close_icon.svg - qml/icons/detail_icon.svg - qml/icons/grid_icon.svg - qml/icons/info_icon.svg - qml/icons/settingsmenu_launcher_icon.svg - qml/icons/qt_logo_green_rgb.svg - qml/icons/header_toggle_icon.svg - qml/icons/spinner.png - qml/icons/FloatingButton_Active.svg - qml/icons/FloatingButton_Available.svg - qml/icons/FloatingButton_Unavailable.svg - qml/icons/Built_with_Qt_RGB_logo_white.svg - qml/icons/mouse_icon.svg - qml/icons/touch_icon.svg - qml/icons/mouse_icon_disabled.svg - qml/icons/detail_icon_disabled.svg - qml/icons/touch_icon_disabled.svg - qml/icons/grid_icon_disabled.svg - qml/icons/display_icon.svg - qml/icons/checkmark.svg - - diff --git a/images.qrc b/images.qrc deleted file mode 100644 index f686255..0000000 --- a/images.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - qml/images/backImg.jpg - - diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..179c1cc --- /dev/null +++ b/main.cpp @@ -0,0 +1,71 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(USE_STATIC_BUILD_FLAG) +#include +Q_IMPORT_QML_PLUGIN(QtLauncherPlugin) +Q_IMPORT_QML_PLUGIN(QtImageProvidersPlugin) +#endif + +void displayHelp(const char *appName) +{ + printf("Usage: \n" + " > %s [options]\n" + "\n" + "Options:\n" + " --applications-root [path] Specify a different applications root\n" + , appName + ); +} + +int main(int argc, char **argv) +{ + QGuiApplication app(argc, argv); + + QString appsRoot; + + const QStringList args = app.arguments(); + for (int i = 1; i < args.size(); ++i) { + const QString arg = args.at(i); + if (arg == QStringLiteral("--applications-root")) { + ++i; + appsRoot = args.at(i); + } else if (arg == QStringLiteral("-h") + || arg == QStringLiteral("--help") + || arg == QStringLiteral("-?")) { + displayHelp(argv[0]); + return 0; + } else { + qCritical() << "Unknown command line argument:" << args.at(i); + displayHelp(argv[0]); + return 0; + } + } + + if (appsRoot.isEmpty()) { + QSettings settings("Qt", "QtLauncher"); + appsRoot = settings.value("defaultApplicationRoot").toString(); + } + + if (appsRoot.isEmpty()) { + appsRoot = "/usr/examples/data"; + } + + qInfo() << "Applications Root:" << appsRoot; + + QQmlApplicationEngine engine; + + engine.setInitialProperties({{"appsRoot", appsRoot}}); + engine.loadFromModule("QtLauncher", "Main"); + + return app.exec(); +} diff --git a/qml.qrc b/qml.qrc deleted file mode 100644 index 102bd9d..0000000 --- a/qml.qrc +++ /dev/null @@ -1,29 +0,0 @@ - - - qml/Main.qml - qml/ApplicationIcon.qml - qml/BootScreen.qml - qml/LaunchScreen.qml - qml/HighlightShader.qml - qml/AutoScroller.qml - qml/HandwritingModeButton.qml - qml/Background.qml - qml/Header.qml - qml/ViewSettings.qml - qml/DetailView.qml - qml/GridViewIcon.qml - qml/DetailViewIcon.qml - qml/DemoHeader.qml - qml/DemoInfoPopup.qml - qml/AboutQt.qml - qml/LayoutSettings.qml - qml/settings.xml - qml/ImageTextDelegate.qml - qml/BusyIndicator.qml - qml/MainWindow.qml - qml/FlickSlider.qml - qml/LauncherCheckBox.qml - qml/DemoMode.qml - qml/GlobalIndicator.qml - - diff --git a/qml/AboutQt.qml b/qml/AboutQt.qml deleted file mode 100644 index 04614f3..0000000 --- a/qml/AboutQt.qml +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 - -Item { - id: root - - Flickable { - width: parent.width - height: parent.height - contentHeight: aboutQtColumn.height - contentWidth: aboutQtColumn.width - clip: true - - Column { - id: aboutQtColumn - spacing: pluginMain.spacing - Image { - height: root.height * 0.125 - source: "icons/qt_logo_green_rgb.svg" - fillMode: Image.PreserveAspectFit - } - - Text { - text: qsTr("This is Qt for Device Creation feature 'Boot to Qt (B2Qt)' Demo Launcher application. " + - "In addition to providing a host for various demo applications demonstrating Qt capabilities " + - "for embedded use cases, this application itself is manifesting how to create a booting, " + - "embedded application and a launcher with Qt on top of various different hardware and operating " + - "systems. In other words, this same application can be seen on several different hardware and " + - "operating system combinations either as a launchable app from the OS or as a full boot experience.") - color: "white" - font.pixelSize: pluginMain.valueFontSize - font.family: appFont - width: root.width - wrapMode: Text.Wrap - } - - Text { - text: qsTr("Qt version: ") + engine.qtVersion - color: "white" - font.pixelSize: pluginMain.valueFontSize - font.family: appFont - } - - Text { - text: qsTr("Demo Launcher application version: ") + Qt.application.version - color: "white" - font.pixelSize: pluginMain.valueFontSize - font.family: appFont - } - - Text { - text: qsTr("The Qt Company") - color: "white" - font.pixelSize: pluginMain.subTitleFontSize - font.family: appFont - } - - Text { - text: qsTr("The Qt Company develops and delivers the Qt development framework " + - "under commercial and open source licenses. We enable the reuse of " + - "software code across all operating systems, platforms and screen " + - "types, from desktops and embedded systems to wearables and mobile " + - "devices. Qt is used by approximately one million developers worldwide " + - "and is the platform of choice for in-vehicle digital cockpits, " + - "automation systems, medical devices, Digital TV/STB and other " + - "business critical applications in 70+ industries. With more than 250 " + - "employees worldwide, the company is headquartered in Espoo, Finland " + - "and is listed on Nasdaq Helsinki Stock Exchange. To learn more visit " + - "http://qt.io") - color: "white" - font.pixelSize: pluginMain.valueFontSize - font.family: appFont - width: root.width - wrapMode: Text.Wrap - } - } - } -} diff --git a/qml/ApplicationIcon.qml b/qml/ApplicationIcon.qml deleted file mode 100644 index c755a10..0000000 --- a/qml/ApplicationIcon.qml +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Controls 2.1 - -Item { - id: appIcon - signal clicked(string sLocation, string sMainFile, string sName, string sDescription) - property bool highlight: false - property bool isSelected: false - property alias preview: preview - property alias hoverSource: hoverItem.source - - Image { - id: preview; - anchors.fill: parent - anchors.margins: viewSettings.pageMargin*0.5 - source: highlight ? "image://QtSquareImage/" + icon : - "image://QtSquareImage/gradient/" + icon - sourceSize: Qt.size(width, height) - - Image { - id: hoverItem - anchors.fill: parent - source: "image://QtImageMask/hover/namebox" - sourceSize: Qt.size(width, height) - opacity: highlight ? 1.0 : 0.0 - visible: !isSelected && opacity > 0.01 - - Behavior on opacity { NumberAnimation { duration: 300 } } - } - } - - - MouseArea { - anchors.fill: parent - onClicked: appIcon.clicked(location, mainFile, name, description) - hoverEnabled: globalSettings.mouseSelected - onEntered: { - if (globalSettings.mouseSelected) - highlight = true; - } - onExited: { - if (globalSettings.mouseSelected) - highlight = false - } - } -} diff --git a/qml/AutoScroller.qml b/qml/AutoScroller.qml deleted file mode 100644 index 9f5c698..0000000 --- a/qml/AutoScroller.qml +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtQuick.VirtualKeyboard 2.0 - -Item { - property var inputItem: InputContext.priv.inputItem - property var appLoader - - onInputItemChanged: open(); - - function open() { - appLoader = null - if (inputItem) { - var parent_ = inputItem.parent - var found = false - while (parent_) { - if (parent_.objectName == "applicationLoader") { - appLoader = parent_ - found = true - break; - } - parent_ = parent_.parent - } - if (found) delayedLoading.triggered() - } - } - - function ensureVisible(loader) { - if (Qt.inputMethod.visible && inputItem && loader) { - - //Check if the text field is under the virtual keyboard. Also add some margin just to make sure. - if (inputItem.mapToItem(loader, 0,0).y > root.height - inputPanel.height - root.height * 0.125) { - - //Scroll the text field to the vertical center of the remaining screen space above the virtual keyboard. - loader.anchors.topMargin = ((root.height - inputPanel.height) / 2) - inputItem.mapToItem(loader, 0,0).y - (inputItem.height / 2); - } else { - loader.anchors.topMargin = 0; - } - } - } - Timer { - id: delayedLoading - interval: 10 - onTriggered: { - ensureVisible(appLoader) - } - } -} diff --git a/qml/Background.qml b/qml/Background.qml deleted file mode 100644 index f7f86fa..0000000 --- a/qml/Background.qml +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 - -Image { - anchors.fill: parent - source: "images/backImg.jpg" - fillMode: Image.PreserveAspectCrop - - // QTBUG-63585, background image causes poor performance of flickable items - // on low-end gpu devices - visible: false - - Rectangle { - anchors.fill: parent - color: viewSettings.backgroundColor - opacity: 0.9 - } -} diff --git a/qml/BootScreen.qml b/qml/BootScreen.qml deleted file mode 100644 index 1318495..0000000 --- a/qml/BootScreen.qml +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 - -Rectangle { - id: bootScreen - color: viewSettings.backgroundColor - opacity: 0.95 - property string applicationName: "" - - Column { - anchors.centerIn: parent - - BusyIndicator { - anchors.horizontalCenter: parent.horizontalCenter - width: bootScreen.width * 0.1 - } - - Text { - anchors.horizontalCenter: parent.horizontalCenter - font.family: viewSettings.appFont - font.pixelSize: bootScreen.height * 0.05 - color: "white" - text: qsTr("Loading") - } - Text { - anchors.horizontalCenter: parent.horizontalCenter - font.family: viewSettings.appFont - font.pixelSize: bootScreen.height * 0.05 - font.styleName: "Bold" - color: "white" - text: applicationName - } - } -} diff --git a/qml/BusyIndicator.qml b/qml/BusyIndicator.qml deleted file mode 100644 index 2d45ef6..0000000 --- a/qml/BusyIndicator.qml +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.4 -import Circle 1.0 - -CircularIndicator { - id: circularIndicator - height: width - padding: 23 - backgroundColor: viewSettings.loaderBackgroundColor - progressColor: viewSettings.loaderForegroundColor - - SequentialAnimation { - running: true - - // Fill 20 degrees of the circle before starting looping - NumberAnimation { - target: circularIndicator - property: "spanAngle" - from: 0 - to: 20 - duration: 200 - } - - SequentialAnimation { - loops: Animation.Infinite - - // Fill the circle, except have both caps still visible - NumberAnimation { - target: circularIndicator - property: "spanAngle" - from: 20 - to: 345 - duration: 800 - } - - // Clear the circle, except for a 20 degree head start. The head start is to - // avoid an abrupt change in the cap of the indicator arc from an end to a beginning. - ParallelAnimation { - NumberAnimation { - target: circularIndicator - property: "startAngle" - from: 0 - to: 360 - duration: 800 - onStopped: circularIndicator.startAngle = 0 - } - NumberAnimation { - target: circularIndicator - property: "spanAngle" - from: 345 - to: 20 - duration: 800 - } - } - } - } -} diff --git a/qml/DemoHeader.qml b/qml/DemoHeader.qml deleted file mode 100644 index 0ee83bc..0000000 --- a/qml/DemoHeader.qml +++ /dev/null @@ -1,158 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 - -Rectangle { - id: demoHeaderBar - width: parent.width - height: viewSettings.demoHeaderHeight - color: viewSettings.backgroundColor - opacity: 0.9 - y: 0 - z: 1 - visible: engine.state === "app-running" - Behavior on y { NumberAnimation { duration: 100 } } - - property bool open: y > -height/2 - - signal infoClicked() - signal closeClicked() - - Row { - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.margins: viewSettings.pageMargin * 0.3 - spacing: viewSettings.pageMargin - - Image { - id: headerLogo - source: "icons/qt_logo_green_rgb.svg" - height: parent.height - width: height / sourceSize.height * sourceSize.width - } - - Text { - id: demoName - height: parent.height - verticalAlignment: Text.AlignVCenter - font.pixelSize: parent.height * 0.5 - font.family: viewSettings.appFont - font.styleName: "SemiBold" - color: "white" - text: engine.applicationName - } - } - - Row { - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.margins: viewSettings.pageMargin * 0.3 - spacing: viewSettings.pageMargin - - Image { - id: infoImg - height: parent.height - width: height - source: "icons/info_icon.svg" - MouseArea { - anchors.fill: parent - anchors.margins: -parent.height * 0.2 - onClicked: demoHeaderBar.infoClicked() - } - } - - Image { - id: applicationCloseButton - objectName: "applicationCloseButton" - height: parent.height - width: height - source: "icons/close_icon.svg" - MouseArea { - anchors.fill: parent - anchors.margins: -parent.height * 0.2 - onClicked: demoHeaderBar.closeClicked() - } - } - } - - Image { - id: headerToggleButton - source: "icons/header_toggle_icon.svg" - height: parent.height * 0.5 - width: height / sourceSize.height * sourceSize.width - anchors.horizontalCenter: parent.horizontalCenter - y: open ? parent.height - height/2 : parent.height - rotation: open ? 180 : 0 - Drag.active: headerToggleMouseArea.drag.active - - Behavior on rotation { NumberAnimation { duration: 100 } } - Behavior on y { NumberAnimation { duration: 100 } } - - MouseArea { - id: headerToggleMouseArea - anchors.fill: parent - anchors.margins: -parent.height * 0.5 - drag.target: demoHeaderBar - drag.axis: Drag.YAxis - drag.minimumX: -demoHeaderBar.height - drag.maximumY: 0 - - DropArea { - anchors.fill: parent - onDropped: demoHeaderVisibilityDelay.restart() - } - - onClicked: { - if (demoHeaderBar.y < -demoHeaderBar.height / 2) { - demoHeaderBar.y = 0 - demoHeaderVisibilityDelay.restart() - } else { - demoHeaderBar.y = -demoHeaderBar.height - } - } - onReleased: { - demoHeaderBar.y = demoHeaderBar.y > -demoHeaderBar.height / 4 ? 0 : -demoHeaderBar.height - parent.Drag.drop() - } - } - } - - Component.onCompleted: demoHeaderVisibilityDelay.start() - - Timer { - id: demoHeaderVisibilityDelay - interval: viewSettings.headerAutoHideDelay - onTriggered: { - if (!demoHeaderVisibilityDelay.running) - demoHeaderBar.y = -demoHeaderBar.height - } - } -} diff --git a/qml/DemoInfoPopup.qml b/qml/DemoInfoPopup.qml deleted file mode 100644 index c850221..0000000 --- a/qml/DemoInfoPopup.qml +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Controls 2.2 - -Rectangle { - id: demoInfoPopup - color: viewSettings.backgroundColor - opacity: 0.9 - - // Prevent user from interacting with the transparent demo on the background - MouseArea { - anchors.fill: parent - } - - function open() - { - visible = true; - } - - function close() - { - visible = false; - } - - Rectangle { - id: frame - color: viewSettings.backgroundColor - border.color: viewSettings.borderColor - border.width: 3 - anchors.centerIn: parent - width: parent.width * 0.5 - height: parent.height * 0.8 - - Image { - id: builtWithQtIcon - anchors.left: parent.left - anchors.top: parent.top - anchors.margins: viewSettings.pageMargin - source: "icons/Built_with_Qt_RGB_logo_white.svg" - height: parent.height * 0.1 - width: height / sourceSize.height * sourceSize.width - } - - Image { - anchors.right: parent.right - anchors.verticalCenter: builtWithQtIcon.verticalCenter - anchors.margins: viewSettings.pageMargin - source: "icons/close_icon.svg" - height: parent.height * 0.1 - width: height / sourceSize.height * sourceSize.width - MouseArea { - anchors.fill: parent - anchors.margins: -viewSettings.pageMargin * 0.5 - onClicked: demoInfoPopup.close() - } - } - - Text { - id: infoTitle - anchors.top: builtWithQtIcon.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: viewSettings.pageMargin - verticalAlignment: Text.AlignVCenter - height: builtWithQtIcon.height - font.pixelSize: height * 0.8 - color: "white" - font.family: viewSettings.appFont - font.styleName: "SemiBold" - text: qsTr("About Current Demo") - } - - Flickable { - id: flickable - anchors.top: infoTitle.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.margins: viewSettings.pageMargin - contentWidth: tt.width - contentHeight: tt.height - flickableDirection: Flickable.VerticalFlick - clip: true - - Text { - id: tt - font.family: viewSettings.appFont - font.styleName: "SemiBold" - font.pixelSize: infoTitle.font.pixelSize * 0.5 - color: "#bbbbbb" - text: engine.applicationDescription - width: frame.width * 0.9 - wrapMode: Text.WordWrap - } - } - - FlickSlider { - flickItem: flickable - anchors.right: frame.right - width: viewSettings.pageMargin * 0.5 - } - } -} diff --git a/qml/DemoMode.qml b/qml/DemoMode.qml deleted file mode 100644 index 5199ae3..0000000 --- a/qml/DemoMode.qml +++ /dev/null @@ -1,393 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import AutomationHelper 1.0 - -Item { - property var visibleItem - property var demoHeader - property var launcherHeader - property var visibleItemName: visibleItem ? visibleItem.objectName : 0 - property bool demoModeSeleted: globalSettings.demoModeSelected - property bool demoIsRunning: false - - property int demoStepDuration: 2000 - property int applicationWaitDuration: 1000 - property int verticalFlickVelocity: 1000 - property int horizontalFlickVelocity: 1000 - - onDemoModeSeletedChanged: { - if (demoModeSeleted) { - demoStartCounter.restart() - } else { - demoStartCounter.stop() - stopDemos() - } - } - - /* - Start the demo sequence. First demo to start depends on the current screen. - */ - function startDemos() { - console.log("Start automatic demo mode") - if (visibleItemName === "settingsView") { - settingsDemoAnimation.start() - } else if ((visibleItemName === "launchScreen") || (visibleItemName === "detailView")) { - switchToSettingScreenAnimation.start() - } else { - exitFromRunningDemoAnimation.start() - } - - demoIsRunning = true - } - - /* - Stop all currently running demos - */ - function stopDemos() { - if (demoIsRunning) { - switchToSettingScreenAnimation.stop() - settingsDemoAnimation.stop() - gridViewDemoAnimation.stop() - graphicsEffectsDemoAnimation.stop() - qtChartsDemoAnimation.stop() - switchToDetailViewAnimation.stop() - detailViewDemoAnimation.stop() - eBikeViewDemoAnimation.stop() - demoIsRunning = false - } - - // Postpone restarting - if (demoModeSeleted) { - demoStartCounter.restart() - } - } - - Timer { - id: demoStartCounter - interval: globalSettings.demoModeStartupTime * 1000 - repeat: false - onTriggered: startDemos() - } - - /* - Cet index of with \a title from the \a applicationList - */ - function applicationIndex(applicationList, title) { - var i - var applicationListModel = applicationList.model - - // count and get() do not work on QAbstractItemModel, rowCount and query must be used - for (i=0; i mouseArea.drag.minimumX) { - if (x + 20 >= mouseArea.drag.maximumX) { - anchors.left = undefined - anchors.right = parent.right - } else if (x - 20 <= mouseArea.drag.minimumX) { - anchors.right = undefined - anchors.left = parent.left - } - } - } - - function snapVertical() { - if (!floating) - return - if (mouseArea.drag.maximumY > mouseArea.drag.minimumY) { - if (y + 20 >= mouseArea.drag.maximumY) { - anchors.top = undefined - anchors.bottom = parent.bottom - } else if (y - 20 <= mouseArea.drag.minimumY) { - anchors.bottom = undefined - anchors.top = parent.top - } - } - } - - MouseArea { - id: mouseArea - anchors.fill: parent - drag { - target: handwritingModeButton.floating ? handwritingModeButton : undefined - axis: Drag.XAxis | Drag.YAxis - minimumX: 0 - maximumX: handwritingModeButton.parent.width - handwritingModeButton.width - onMaximumXChanged: !mouseArea.drag.active && handwritingModeButton.snapHorizontal() - minimumY: 0 - maximumY: handwritingModeButton.parent.height - handwritingModeButton.height - onMaximumYChanged: !mouseArea.drag.active && handwritingModeButton.snapVertical() - } - onPressed: { - if (!handwritingModeButton.floating) - return - handwritingModeButton.anchors.left = undefined - handwritingModeButton.anchors.top = undefined - handwritingModeButton.anchors.right = undefined - handwritingModeButton.anchors.bottom = undefined - } - onReleased: { - handwritingModeButton.snapHorizontal() - handwritingModeButton.snapVertical() - } - onClicked: { - handwritingModeButton.snapHorizontal() - handwritingModeButton.snapVertical() - clickTimer.restart() - } - onDoubleClicked: { - clickTimer.stop() - handwritingModeButton.snapHorizontal() - handwritingModeButton.snapVertical() - handwritingModeButton.doubleClicked() - } - Timer { - id: clickTimer - interval: Qt.styleHints ? Qt.styleHints.mouseDoubleClickInterval / 3 : 0 - repeat: false - onTriggered: handwritingModeButton.clicked() - } - } -} diff --git a/qml/Header.qml b/qml/Header.qml deleted file mode 100644 index f9cf920..0000000 --- a/qml/Header.qml +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 - -Item { - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: viewSettings.pageMargin - height: viewSettings.headerHeight - - signal menuClicked() - - Image { - objectName: "settingsMenuIcon" - anchors.left: parent.left - anchors.top: parent.top - source: "icons/settingsmenu_launcher_icon.svg" - height: parent.height * 0.7 - width: height / sourceSize.height * sourceSize.width - - MouseArea { - anchors.fill: parent - anchors.margins: -parent.height*0.2 - onClicked: menuClicked() - } - } - - Image { - anchors.right: parent.right - anchors.top: parent.top - source: "icons/qt_logo_green_rgb.svg" - height: parent.height - width: height / sourceSize.height * sourceSize.width - } -} diff --git a/qml/HighlightShader.qml b/qml/HighlightShader.qml deleted file mode 100644 index 7c7d662..0000000 --- a/qml/HighlightShader.qml +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 - -ShaderEffect { - id: root - - property variant source; - - property alias interval: shaderTrigger.interval - property bool running: true; - - property real t: -1; - NumberAnimation on t { id: shaderAnimation; from: -2; to: 3; duration: 2000; loops: 1; running: false } - - Timer { - id: shaderTrigger - repeat: true - interval: 10000 - running: visible && root.running; - onTriggered: shaderAnimation.running = true - } - - fragmentShader: - " - uniform lowp sampler2D source; - uniform highp float t; - uniform lowp float qt_Opacity; - varying highp vec2 qt_TexCoord0; - void main() { - lowp vec4 p = texture2D(source, qt_TexCoord0) * qt_Opacity; - highp float l = max(0.0, 1.0 - length(qt_TexCoord0.x + qt_TexCoord0.y - t)); - gl_FragColor = p + pow(l, 3.0) * p.w; - } - " -} diff --git a/qml/ImageTextDelegate.qml b/qml/ImageTextDelegate.qml deleted file mode 100644 index 4f9353d..0000000 --- a/qml/ImageTextDelegate.qml +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 - -Item { - id: itt - property alias sourceSelected: img.source - property alias sourceDisabled: img2.source - property alias text: tt.text - property bool selected - - signal clicked() - - Image { - id: img - width: parent.width - height: width - sourceSize: Qt.size(width, height) - visible: selected - } - - Image { - id: img2 - width: parent.width - height: width - sourceSize: Qt.size(width, height) - visible: !selected - } - - Text { - id: tt - width: parent.width - height: parent.height * 0.3 - anchors.top: img.bottom - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignTop - fontSizeMode: Text.Fit - minimumPixelSize: 1 - font.pixelSize: height - color: selected ? "white" : "#848895" - font.family: appFont - } - MouseArea { - anchors.fill: parent - onClicked: itt.clicked() - } -} diff --git a/qml/LaunchScreen.qml b/qml/LaunchScreen.qml deleted file mode 100644 index 70e9c71..0000000 --- a/qml/LaunchScreen.qml +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Controls 2.3 - -Item { - id: gridroot - anchors.fill: parent - - GridView { - id: grid - objectName: "launcherGridView" - anchors.fill: parent - anchors.margins: viewSettings.pageMargin * 0.5 - anchors.topMargin: viewSettings.pageMargin - cacheBuffer: 10000 - - cellWidth: width / 3 - cellHeight: cellWidth - clip: true - model: applicationsModel; - - delegate: GridViewIcon { - id: iconRoot2; - height: grid.cellHeight - width: grid.cellWidth - onClicked: root.launchApplication(sLocation, sMainFile, sName, sDescription) - } - } - - FlickSlider { - flickItem: grid - anchors.right: parent.right - } -} diff --git a/qml/LauncherCheckBox.qml b/qml/LauncherCheckBox.qml deleted file mode 100644 index bf81b80..0000000 --- a/qml/LauncherCheckBox.qml +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.9 -import QtQuick.Controls 2.2 - -CheckBox { - id: checkBox - text: qsTr("Flip screen") - - indicator: Rectangle { - implicitHeight: 26 - implicitWidth: 26 - height: pluginMain.buttonHeight - width: height - x: checkBox.leftPadding - y: parent.height / 2 - height / 2 - color: "transparent" - border.color: "#9d9faa" - border.width: 2 - radius: 4 - - Image { - anchors.centerIn: parent - sourceSize.width: parent.width - sourceSize.height: parent.height - width: parent.width * 0.9 - height: width - source: "icons/checkmark.svg" - visible: checkBox.checked - antialiasing: true - smooth: true - fillMode: Image.PreserveAspectFit - } - } - - contentItem: Text { - text: checkBox.text - font.family: appFont - font.pixelSize: pluginMain.subTitleFontSize - opacity: enabled ? 1.0 : 0.3 - color: checkBox.down ? "#17a81a" : "#41cd52" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - leftPadding: checkBox.indicator.width + checkBox.spacing - height: pluginMain.fieldTextHeight - font.styleName: checkBox.checked ? "Bold" : "Regular" - } -} diff --git a/qml/LayoutSettings.qml b/qml/LayoutSettings.qml deleted file mode 100644 index 09606aa..0000000 --- a/qml/LayoutSettings.qml +++ /dev/null @@ -1,198 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.9 -import QtQuick.Controls 2.2 - -Item { - id: root - property string title: qsTr("Display Settings") - property int titleWidth: width * 0.382 - property int margin: root.width * 0.05 - property int buttonSize: height * 0.15 - - property bool gridSelected: globalSettings.gridSelected - property bool mouseSelected: globalSettings.mouseSelected - - onGridSelectedChanged: updateTimer.start() - onMouseSelectedChanged: updateTimer.start(); - - Timer { - id: updateTimer - interval: 10 - onTriggered: { - globalSettings.gridSelected = root.gridSelected - globalSettings.mouseSelected = root.mouseSelected - } - } - - Column { - id: column - spacing: root.margin * 0.2 - - Text { - color: "white" - text: qsTr("Layout") - font.pixelSize: pluginMain.subTitleFontSize - font.family: appFont - } - - Row { - id: layoutRow - spacing: root.margin - - ImageTextDelegate { - objectName: "gridLayoutButton" - height: root.buttonSize - width: height - onClicked: root.gridSelected = true - sourceSelected: "icons/grid_icon.svg" - sourceDisabled: "icons/grid_icon_disabled.svg" - selected: root.gridSelected - text: qsTr("GRID") - } - - ImageTextDelegate { - objectName: "detailLayoutButton" - height: root.buttonSize - width: height - onClicked: root.gridSelected = false - sourceSelected: "icons/detail_icon.svg" - sourceDisabled: "icons/detail_icon_disabled.svg" - selected: !root.gridSelected - text: qsTr("DETAIL") - } - } - - Item { - height: root.margin - width: 1 - } - - Text { - color: "white" - text: qsTr("Input") - font.pixelSize: pluginMain.subTitleFontSize - font.family: appFont - } - - Row { - id: inputRow - spacing: root.margin - - ImageTextDelegate { - height: root.buttonSize - width: height - onClicked: root.mouseSelected = true - sourceSelected: "icons/mouse_icon.svg" - sourceDisabled: "icons/mouse_icon_disabled.svg" - selected: root.mouseSelected - text: qsTr("MOUSE") - } - ImageTextDelegate { - id: detailButton - height: root.buttonSize - width: height - onClicked: root.mouseSelected = false - sourceSelected: "icons/touch_icon.svg" - sourceDisabled: "icons/touch_icon_disabled.svg" - selected: !root.mouseSelected - text: qsTr("TOUCH") - } - } - - Item { - height: root.margin - width: 1 - } - - Row { - spacing: root.margin - - LauncherCheckBox { - id: demoModeCheckBox - text: qsTr("Demo mode") - checked: globalSettings.demoModeSelected - - onCheckedChanged: { - globalSettings.demoModeSelected = checked - } - } - - LauncherCheckBox { - id: flipScreenCheckBox - text: qsTr("Flip screen") - checked: globalSettings.rotationSelected - - onCheckedChanged: { - globalSettings.rotationSelected = checked - } - } - } - - Row { - spacing: root.margin * 0.2 - Text { - height: pluginMain.buttonHeight - text: qsTr("Demo startup time:") - color: "white" - font.pixelSize: pluginMain.valueFontSize - font.family: appFont - verticalAlignment: Text.AlignVCenter - } - - TextField { - id: demoStartupTime - rightPadding: 6 - bottomPadding: 6 - topPadding: 6 - height: pluginMain.buttonHeight - width: root.width * 0.1 - color: "black" - font.pixelSize: pluginMain.valueFontSize - text: globalSettings.demoModeStartupTime - horizontalAlignment: Text.AlignRight - inputMethodHints: Qt.ImhDigitsOnly - background: Rectangle { - border.color: demoStartupTime.focus ? viewSettings.buttonGreenColor : "transparent" - border.width: parent.width * 0.05 - } - onAccepted: globalSettings.demoModeStartupTime = text - } - - Text { - height: pluginMain.buttonHeight - text: qsTr("s") - color: "white" - font.pixelSize: pluginMain.valueFontSize - font.family: appFont - verticalAlignment: Text.AlignVCenter - } - } - } -} diff --git a/qml/Main.qml b/qml/Main.qml deleted file mode 100644 index 7764363..0000000 --- a/qml/Main.qml +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQml 2.2 -import QtQuick 2.6 -import QtQuick.Window 2.2 - -Window { - id: window - - visible: true - width: Screen.desktopAvailableWidth - height: Screen.desktopAvailableHeight - - color: viewSettings.backgroundColor - property alias appFont: viewSettings.appFont - contentOrientation: Screen.desktopAvailableHeight > Screen.desktopAvailableWidth ? - (globalSettings.rotationSelected ? Qt.InvertedLandscapeOrientation : Qt.LandscapeOrientation) : - (globalSettings.rotationSelected ? Qt.InvertedPortraitOrientation : Qt.PortraitOrientation) - - ViewSettings { - id: viewSettings - } - - Loader { - id: mainWindowLoader - anchors.fill: parent - active: false - source: "qrc:///qml/MainWindow.qml" - asynchronous: true - onLoaded: { - item.visible = true; - splashScreenLoader.item.visible = false; - splashScreenLoader.source = ""; - } - } - - Loader { - id: splashScreenLoader - anchors.fill: parent - sourceComponent: Item { - anchors.fill: parent - - Image { - anchors.fill: parent - source: "images/backImg.jpg" - fillMode: Image.PreserveAspectCrop - } - - BootScreen { - anchors.fill: parent - applicationName: qsTr("Qt Launcher") - } - } - onLoaded: { - mainWindowLoader.active = true; - } - } -} diff --git a/qml/MainWindow.qml b/qml/MainWindow.qml deleted file mode 100644 index 686dd87..0000000 --- a/qml/MainWindow.qml +++ /dev/null @@ -1,378 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.4 -import QtQuick.Window 2.2 -import QtQuick.VirtualKeyboard 2.1 -import QtDeviceUtilities.SettingsUI 1.0 -import com.qtcompany.B2QtLauncher 1.0 - -Item { - id: mainWindow - anchors.fill: parent - Component { - id: emptyComponent - Item { - objectName: "empty" - } - } - - Component { - id: gridComponent - LaunchScreen { - objectName: "launchScreen" - id: launchScreen - } - } - - Component { - id: detailComponent - DetailView { - objectName: "detailView" - id: detailView - } - } - - Component { - id: settingsUIComponent - SettingsUI { - id: settingsUI - objectName: "settingsView" - anchors.fill: parent - model: "settings.xml" - margin: viewSettings.pageMargin - onClosed: root.closeApplication() - } - } - - LauncherApplicationsModel { - id: applicationsModel - onReady: engine.markApplicationsModelReady(); - Component.onCompleted: { - //Set the directory to parse for apps - initialize(applicationSettings.appsRoot); - } - } - - LauncherEngine { - id: engine - fpsEnabled: applicationSettings.isShowFPSEnabled - } - - Item { - id: root - anchors.centerIn: parent - property bool portraitMode: Screen.desktopAvailableHeight > Screen.desktopAvailableWidth ? true : false - property bool demoHeaderEnabled: applicationLoader.sourceComponent !== settingsUIComponent - property int rotateAmount: globalSettings.rotationSelected ? 180 : 0 - rotation: portraitMode ? 90 + rotateAmount : 0 + rotateAmount - width: portraitMode ? window.height : window.width - height: portraitMode ? window.width : window.height - - function closeApplication() - { - engine.closeApplication() - applicationLoader.setSource("") - applicationLoader.sourceComponent = emptyComponent - } - - function launchApplication(loc, mainFile, name, desc) - { - engine.launchApplication(loc, mainFile, name, desc) - applicationLoader.source = engine.applicationMain - } - - function launchSettings() - { - engine.state = "app-launching" - applicationLoader.sourceComponent = settingsUIComponent - } - - Background {} - - Header { - id: header - enabled: engine.state == "running" - onMenuClicked: root.launchSettings() - } - - Loader { - id: contentLoader - anchors.fill: parent - anchors.topMargin: header.height + viewSettings.pageMargin - sourceComponent: globalSettings.gridSelected ? gridComponent : detailComponent - enabled: engine.state != "settings" - } - - states: [ - State { - name: "running" - PropertyChanges { target: applicationLoader; opacity: 0; } - PropertyChanges { target: contentLoader; opacity: 1 } - PropertyChanges { target: header; opacity: 1 } - PropertyChanges { target: bootScreenLoader; opacity: 0 } - }, - State { - name: "app-launching" - PropertyChanges { target: header; opacity: 0 } - PropertyChanges { target: bootScreenLoader; opacity: 1 } - }, - State { - name: "app-running" - PropertyChanges { target: applicationLoader; opacity: 1 } - PropertyChanges { target: contentLoader; opacity: 0 } - PropertyChanges { target: header; opacity: 0 } - PropertyChanges { target: bootScreenLoader; opacity: 0 } - }, - State { - name: "settings" - PropertyChanges { target: applicationLoader; opacity: 1 } - PropertyChanges { target: contentLoader; opacity: 1 } - PropertyChanges { target: header; opacity: 0 } - PropertyChanges { target: bootScreenLoader; opacity: 0 } - }, - State { - name: "app-closing" - PropertyChanges { target: applicationLoader; opacity: 0; source: "" } - PropertyChanges { target: contentLoader; opacity: 0 } - PropertyChanges { target: header; opacity: 0 } - PropertyChanges { target: bootScreenLoader; opacity: 0 } - } - ] - - state: engine.state - - Timer { - id: failedAppLaunchTrigger; - interval: viewSettings.stateDelay; - running: false - repeat: false - onTriggered: root.closeApplication() - } - - Loader { - id: applicationLoader - objectName: "applicationLoader" - opacity: 0; - visible: opacity > 0.1 - anchors.fill: parent - - asynchronous: true; - onStatusChanged: { - if (status == Loader.Error) - failedAppLaunchTrigger.start(); - } - onLoaded: { - if (applicationLoader.item.objectName == "settingsView") - engine.state = "settings" - else if (applicationLoader.item.objectName !== "empty") - engine.state = "app-running"; - } - Behavior on anchors.topMargin {NumberAnimation{ duration: 200 } } - } - - DemoHeader { - id: demoHeader - visible: applicationLoader.visible && root.demoHeaderEnabled - onInfoClicked: demoInfoPopup.open() - onCloseClicked: root.closeApplication(); - } - Loader { - id: bootScreenLoader - visible: opacity > 0 - anchors.fill: parent - sourceComponent: BootScreen { - applicationName: engine.applicationName - } - } - - DemoInfoPopup { - id: demoInfoPopup - visible: false - height: mainWindow.height - width: mainWindow.width - z: demoHeader.z + 1 - } - - /* Handwriting input panel for full screen handwriting input. - - This component is an optional add-on for the InputPanel component, that - is, its use does not affect the operation of the InputPanel component, - but it also can not be used as a standalone component. - - The handwriting input panel is positioned to cover the entire area of - application. The panel itself is transparent, but once it is active the - user can draw handwriting on it. - */ - HandwritingInputPanel { - z: 79 - id: handwritingInputPanel - anchors.fill: parent - inputPanel: inputPanel - Rectangle { - z: -1 - anchors.fill: parent - color: "black" - opacity: 0.10 - } - } - - /* Container area for the handwriting mode button. - - Handwriting mode button can be moved freely within the container area. - In this example, a single click changes the handwriting mode and a - double-click changes the availability of the full screen handwriting input. - */ - Item { - z: 89 - visible: handwritingInputPanel.enabled && Qt.inputMethod.visible - anchors { left: parent.left; top: parent.top; right: parent.right; bottom: inputPanel.top; } - HandwritingModeButton { - id: handwritingModeButton - anchors.top: parent.top - anchors.right: parent.right - anchors.margins: 10 - floating: true - flipable: true - width: 76 - height: width - state: handwritingInputPanel.state - onClicked: handwritingInputPanel.active = !handwritingInputPanel.active - onDoubleClicked: handwritingInputPanel.available = !handwritingInputPanel.available - } - onVisibleChanged: console.log("hw visible: "+visible) - Component.onCompleted: console.log("input visible " +visible) - } - - /* Keyboard input panel. - The keyboard is anchored to the bottom of the application. - */ - InputPanel { - id: inputPanel - z: 99 - x: root.portraitMode ? - (globalSettings.rotationSelected ? - inputPanel.height + root.height : -inputPanel.height - root.height) : - 0 - y: root.portraitMode ? - (globalSettings.rotationSelected ? inputPanel.height : inputPanel.height) : - (globalSettings.rotationSelected ? -root.height : root.height) - width: root.portraitMode ? window.height : window.width - rotation: root.rotation - property real alignmentWorkaround: height * 0.1 - onActiveChanged: { - if (!active) - applicationLoader.anchors.topMargin = 0; - else { - autoScroller.open(); - } - } - states: State { - name: "visible" - /* The visibility of the InputPanel can be bound to the Qt.inputMethod.visible property, - but then the handwriting input panel and the keyboard input panel can be visible - at the same time. Here the visibility is bound to InputPanel.active property instead, - which allows the handwriting panel to control the visibility when necessary. - */ - when: inputPanel.active - PropertyChanges { - target: inputPanel - x: root.portraitMode ? - (globalSettings.rotationSelected ? - root.height - inputPanel.height * 2 - inputPanel.alignmentWorkaround : - -inputPanel.height - inputPanel.alignmentWorkaround) : - 0 - y: root.portraitMode ? - inputPanel.height + inputPanel.alignmentWorkaround : - (globalSettings.rotationSelected ? 0 : root.height - inputPanel.height) - } - } - - transitions: Transition { - from: "" - to: "visible" - reversible: true - ParallelAnimation { - NumberAnimation { - properties: "x" - duration: 250 - easing.type: Easing.InOutQuad - } - NumberAnimation { - properties: "y" - duration: 250 - easing.type: Easing.InOutQuad - } - } - } - AutoScroller { - id: autoScroller - } - } - - GlobalIndicator { - id: fps - enabled: engine.fpsEnabled - text: "FPS: " + engine.fps - } - - GlobalIndicator { - id: demoModeIndicator - enabled: demoMode.demoIsRunning - text: qsTr("DEMO MODE - Tap screen to use") - anchors.bottom: fps.enabled ? fps.top : parent.bottom - } - } - - DemoMode { - id: demoMode - demoHeader: demoHeader - launcherHeader: header - visibleItem: (applicationLoader.item && (applicationLoader.item.objectName !== "empty")) ? - applicationLoader.item : contentLoader.item - } - - // MouseArea for capturing mouse clicks/presses - MouseArea { - anchors.fill: parent - propagateComposedEvents: true - - // Press or click - function pressedOrClicked(mouse) { - if (mouse.source === Qt.MouseEventSynthesizedByApplication) { - mouse.accepted = false - return - } - mouse.accepted = demoMode.demoIsRunning - demoMode.stopDemos() - } - - onClicked: pressedOrClicked(mouse) - onPressed: pressedOrClicked(mouse) - } -} diff --git a/qml/ViewSettings.qml b/qml/ViewSettings.qml deleted file mode 100644 index 82f4241..0000000 --- a/qml/ViewSettings.qml +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 - -Item { - id: viewSettings - - property real pageMargin: 0.03 * Math.min(window.width, window.height) - property real headerHeight: 3 * pageMargin - property real spacing: pageMargin * 0.5 - property real demoHeaderHeight: 2.5 * pageMargin - property string appFont: "TitilliumWeb" - property int stateDelay: 200; - property int headerAutoHideDelay: 3000 - property string backgroundColor: "#09102b" - property string borderColor: "#9d9faa" - property string buttonGreenColor: "#41cd52" - property string buttonGrayColor: "#9d9faa" - property string buttonActiveColor: "#216729" - property string loaderBackgroundColor: "#848895" - property string loaderForegroundColor: "#41cd52" - property string scrollBarColor: "#41cd52" -} diff --git a/qml/fonts/Montserrat-Bold.ttf b/qml/fonts/Montserrat-Bold.ttf deleted file mode 100644 index 8e9a5f3..0000000 Binary files a/qml/fonts/Montserrat-Bold.ttf and /dev/null differ diff --git a/qml/fonts/Montserrat-Light.ttf b/qml/fonts/Montserrat-Light.ttf deleted file mode 100644 index e66dc5b..0000000 Binary files a/qml/fonts/Montserrat-Light.ttf and /dev/null differ diff --git a/qml/fonts/Montserrat-Medium.ttf b/qml/fonts/Montserrat-Medium.ttf deleted file mode 100644 index 88d70b8..0000000 Binary files a/qml/fonts/Montserrat-Medium.ttf and /dev/null differ diff --git a/qml/fonts/Montserrat-Regular.ttf b/qml/fonts/Montserrat-Regular.ttf deleted file mode 100644 index 626355a..0000000 Binary files a/qml/fonts/Montserrat-Regular.ttf and /dev/null differ diff --git a/qml/fonts/Teko-Bold.ttf b/qml/fonts/Teko-Bold.ttf deleted file mode 100644 index d061824..0000000 Binary files a/qml/fonts/Teko-Bold.ttf and /dev/null differ diff --git a/qml/fonts/Teko-Light.ttf b/qml/fonts/Teko-Light.ttf deleted file mode 100644 index ec5194a..0000000 Binary files a/qml/fonts/Teko-Light.ttf and /dev/null differ diff --git a/qml/fonts/Teko-Medium.ttf b/qml/fonts/Teko-Medium.ttf deleted file mode 100644 index cc38086..0000000 Binary files a/qml/fonts/Teko-Medium.ttf and /dev/null differ diff --git a/qml/fonts/Teko-Regular.ttf b/qml/fonts/Teko-Regular.ttf deleted file mode 100644 index 3161e63..0000000 Binary files a/qml/fonts/Teko-Regular.ttf and /dev/null differ diff --git a/qml/fonts/TitilliumWeb-Black.ttf b/qml/fonts/TitilliumWeb-Black.ttf deleted file mode 100644 index fc5c4b5..0000000 Binary files a/qml/fonts/TitilliumWeb-Black.ttf and /dev/null differ diff --git a/qml/fonts/TitilliumWeb-Bold.ttf b/qml/fonts/TitilliumWeb-Bold.ttf deleted file mode 100644 index 0af0fe7..0000000 Binary files a/qml/fonts/TitilliumWeb-Bold.ttf and /dev/null differ diff --git a/qml/fonts/TitilliumWeb-BoldItalic.ttf b/qml/fonts/TitilliumWeb-BoldItalic.ttf deleted file mode 100644 index 77425ea..0000000 Binary files a/qml/fonts/TitilliumWeb-BoldItalic.ttf and /dev/null differ diff --git a/qml/fonts/TitilliumWeb-ExtraLight.ttf b/qml/fonts/TitilliumWeb-ExtraLight.ttf deleted file mode 100644 index 2b506ef..0000000 Binary files a/qml/fonts/TitilliumWeb-ExtraLight.ttf and /dev/null differ diff --git a/qml/fonts/TitilliumWeb-ExtraLightItalic.ttf b/qml/fonts/TitilliumWeb-ExtraLightItalic.ttf deleted file mode 100644 index c1be5ba..0000000 Binary files a/qml/fonts/TitilliumWeb-ExtraLightItalic.ttf and /dev/null differ diff --git a/qml/fonts/TitilliumWeb-Italic.ttf b/qml/fonts/TitilliumWeb-Italic.ttf deleted file mode 100644 index 42f2c10..0000000 Binary files a/qml/fonts/TitilliumWeb-Italic.ttf and /dev/null differ diff --git a/qml/fonts/TitilliumWeb-Light.ttf b/qml/fonts/TitilliumWeb-Light.ttf deleted file mode 100644 index ca67971..0000000 Binary files a/qml/fonts/TitilliumWeb-Light.ttf and /dev/null differ diff --git a/qml/fonts/TitilliumWeb-LightItalic.ttf b/qml/fonts/TitilliumWeb-LightItalic.ttf deleted file mode 100644 index 2ea724f..0000000 Binary files a/qml/fonts/TitilliumWeb-LightItalic.ttf and /dev/null differ diff --git a/qml/fonts/TitilliumWeb-Regular.ttf b/qml/fonts/TitilliumWeb-Regular.ttf deleted file mode 100644 index 6da8219..0000000 Binary files a/qml/fonts/TitilliumWeb-Regular.ttf and /dev/null differ diff --git a/qml/fonts/TitilliumWeb-SemiBold.ttf b/qml/fonts/TitilliumWeb-SemiBold.ttf deleted file mode 100644 index dfdcdbe..0000000 Binary files a/qml/fonts/TitilliumWeb-SemiBold.ttf and /dev/null differ diff --git a/qml/fonts/TitilliumWeb-SemiBoldItalic.ttf b/qml/fonts/TitilliumWeb-SemiBoldItalic.ttf deleted file mode 100644 index b68a669..0000000 Binary files a/qml/fonts/TitilliumWeb-SemiBoldItalic.ttf and /dev/null differ diff --git a/qml/fonts/fontawesome-webfont.ttf b/qml/fonts/fontawesome-webfont.ttf deleted file mode 100644 index 35acda2..0000000 Binary files a/qml/fonts/fontawesome-webfont.ttf and /dev/null differ diff --git a/qml/icons/Built_with_Qt_RGB_logo_white.svg b/qml/icons/Built_with_Qt_RGB_logo_white.svg deleted file mode 100644 index cd972bd..0000000 --- a/qml/icons/Built_with_Qt_RGB_logo_white.svg +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - diff --git a/qml/icons/FloatingButton_Active.svg b/qml/icons/FloatingButton_Active.svg deleted file mode 100644 index 76a38eb..0000000 --- a/qml/icons/FloatingButton_Active.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/qml/icons/FloatingButton_Available.svg b/qml/icons/FloatingButton_Available.svg deleted file mode 100644 index 1178c8c..0000000 --- a/qml/icons/FloatingButton_Available.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/qml/icons/FloatingButton_Unavailable.svg b/qml/icons/FloatingButton_Unavailable.svg deleted file mode 100644 index d8149b5..0000000 --- a/qml/icons/FloatingButton_Unavailable.svg +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/qml/icons/back_icon.svg b/qml/icons/back_icon.svg deleted file mode 100644 index 7670ff3..0000000 --- a/qml/icons/back_icon.svg +++ /dev/null @@ -1 +0,0 @@ -back \ No newline at end of file diff --git a/qml/icons/bluetooth_icon.svg b/qml/icons/bluetooth_icon.svg deleted file mode 100644 index 2cdf7f9..0000000 --- a/qml/icons/bluetooth_icon.svg +++ /dev/null @@ -1 +0,0 @@ -bluetooth \ No newline at end of file diff --git a/qml/icons/checkmark.svg b/qml/icons/checkmark.svg deleted file mode 100644 index 830ecd0..0000000 --- a/qml/icons/checkmark.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - diff --git a/qml/icons/close_icon.svg b/qml/icons/close_icon.svg deleted file mode 100644 index 311721e..0000000 --- a/qml/icons/close_icon.svg +++ /dev/null @@ -1 +0,0 @@ -close \ No newline at end of file diff --git a/qml/icons/date-time_icon.svg b/qml/icons/date-time_icon.svg deleted file mode 100644 index 3af7afc..0000000 --- a/qml/icons/date-time_icon.svg +++ /dev/null @@ -1 +0,0 @@ -date-time \ No newline at end of file diff --git a/qml/icons/detail.svg b/qml/icons/detail.svg deleted file mode 100644 index 142a1a0..0000000 --- a/qml/icons/detail.svg +++ /dev/null @@ -1 +0,0 @@ -detail \ No newline at end of file diff --git a/qml/icons/detail_icon.svg b/qml/icons/detail_icon.svg deleted file mode 100644 index f62ec81..0000000 --- a/qml/icons/detail_icon.svg +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - image/svg+xml - - detail - - - - - - detail - - - - - - diff --git a/qml/icons/detail_icon_disabled.svg b/qml/icons/detail_icon_disabled.svg deleted file mode 100644 index 697a0a0..0000000 --- a/qml/icons/detail_icon_disabled.svg +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - image/svg+xml - - detail - - - - - - detail - - - - - - diff --git a/qml/icons/display_icon.svg b/qml/icons/display_icon.svg deleted file mode 100644 index 598d2ee..0000000 --- a/qml/icons/display_icon.svg +++ /dev/null @@ -1 +0,0 @@ -display_icon \ No newline at end of file diff --git a/qml/icons/grid_icon.svg b/qml/icons/grid_icon.svg deleted file mode 100644 index fe08f0c..0000000 --- a/qml/icons/grid_icon.svg +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - image/svg+xml - - grid_icon - - - - - - grid_icon - - diff --git a/qml/icons/grid_icon_disabled.svg b/qml/icons/grid_icon_disabled.svg deleted file mode 100644 index 942b2ed..0000000 --- a/qml/icons/grid_icon_disabled.svg +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - image/svg+xml - - grid_icon - - - - - - grid_icon - - diff --git a/qml/icons/header_toggle.png b/qml/icons/header_toggle.png deleted file mode 100644 index 0482820..0000000 Binary files a/qml/icons/header_toggle.png and /dev/null differ diff --git a/qml/icons/header_toggle_icon.svg b/qml/icons/header_toggle_icon.svg deleted file mode 100644 index 18f71c5..0000000 --- a/qml/icons/header_toggle_icon.svg +++ /dev/null @@ -1 +0,0 @@ -header_toggle \ No newline at end of file diff --git a/qml/icons/info_icon.svg b/qml/icons/info_icon.svg deleted file mode 100644 index 8a7d960..0000000 --- a/qml/icons/info_icon.svg +++ /dev/null @@ -1 +0,0 @@ -info \ No newline at end of file diff --git a/qml/icons/language_icon.svg b/qml/icons/language_icon.svg deleted file mode 100644 index 2d287b6..0000000 --- a/qml/icons/language_icon.svg +++ /dev/null @@ -1 +0,0 @@ -language \ No newline at end of file diff --git a/qml/icons/mouse_icon.svg b/qml/icons/mouse_icon.svg deleted file mode 100644 index 8d5d088..0000000 --- a/qml/icons/mouse_icon.svg +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - image/svg+xml - - mouse_icon - - - - - - - - - - mouse_icon - - - - - - - diff --git a/qml/icons/mouse_icon_disabled.svg b/qml/icons/mouse_icon_disabled.svg deleted file mode 100644 index 49c8a39..0000000 --- a/qml/icons/mouse_icon_disabled.svg +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - image/svg+xml - - mouse_icon - - - - - - - - - - mouse_icon - - - - - - - diff --git a/qml/icons/mute_icon.svg b/qml/icons/mute_icon.svg deleted file mode 100644 index 57cf348..0000000 --- a/qml/icons/mute_icon.svg +++ /dev/null @@ -1 +0,0 @@ -mute \ No newline at end of file diff --git a/qml/icons/network_icon.svg b/qml/icons/network_icon.svg deleted file mode 100644 index 6492630..0000000 --- a/qml/icons/network_icon.svg +++ /dev/null @@ -1 +0,0 @@ -network \ No newline at end of file diff --git a/qml/icons/pause_icon.svg b/qml/icons/pause_icon.svg deleted file mode 100644 index 1eeb71b..0000000 --- a/qml/icons/pause_icon.svg +++ /dev/null @@ -1 +0,0 @@ -pause \ No newline at end of file diff --git a/qml/icons/play_icon.svg b/qml/icons/play_icon.svg deleted file mode 100644 index 2384991..0000000 --- a/qml/icons/play_icon.svg +++ /dev/null @@ -1 +0,0 @@ -play \ No newline at end of file diff --git a/qml/icons/power_icon.svg b/qml/icons/power_icon.svg deleted file mode 100644 index 68c6755..0000000 --- a/qml/icons/power_icon.svg +++ /dev/null @@ -1 +0,0 @@ -power \ No newline at end of file diff --git a/qml/icons/qt_logo_green_rgb.svg b/qml/icons/qt_logo_green_rgb.svg deleted file mode 100644 index bdb07d1..0000000 --- a/qml/icons/qt_logo_green_rgb.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - diff --git a/qml/icons/settings_icon.svg b/qml/icons/settings_icon.svg deleted file mode 100644 index 7862920..0000000 --- a/qml/icons/settings_icon.svg +++ /dev/null @@ -1 +0,0 @@ -settings \ No newline at end of file diff --git a/qml/icons/settingsmenu_launcher_icon.svg b/qml/icons/settingsmenu_launcher_icon.svg deleted file mode 100644 index 83dcad5..0000000 --- a/qml/icons/settingsmenu_launcher_icon.svg +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - image/svg+xml - - - - - - - settingsmenu_launcher - - - - - - - diff --git a/qml/icons/spinner.png b/qml/icons/spinner.png deleted file mode 100644 index f64144a..0000000 Binary files a/qml/icons/spinner.png and /dev/null differ diff --git a/qml/icons/stop_icon.svg b/qml/icons/stop_icon.svg deleted file mode 100644 index c694e55..0000000 --- a/qml/icons/stop_icon.svg +++ /dev/null @@ -1 +0,0 @@ -stop \ No newline at end of file diff --git a/qml/icons/touch_icon.svg b/qml/icons/touch_icon.svg deleted file mode 100644 index 0237b64..0000000 --- a/qml/icons/touch_icon.svg +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - image/svg+xml - - touch_icon - - - - - - touch_icon - - - diff --git a/qml/icons/touch_icon_disabled.svg b/qml/icons/touch_icon_disabled.svg deleted file mode 100644 index 77b27b2..0000000 --- a/qml/icons/touch_icon_disabled.svg +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - image/svg+xml - - touch_icon - - - - - - touch_icon - - - diff --git a/qml/icons/volume_icon.svg b/qml/icons/volume_icon.svg deleted file mode 100644 index 095875a..0000000 --- a/qml/icons/volume_icon.svg +++ /dev/null @@ -1 +0,0 @@ -volume \ No newline at end of file diff --git a/qml/images/backImg.jpg b/qml/images/backImg.jpg deleted file mode 100644 index b41a4eb..0000000 Binary files a/qml/images/backImg.jpg and /dev/null differ diff --git a/qml/settings.xml b/qml/settings.xml deleted file mode 100644 index fb19ebc..0000000 --- a/qml/settings.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - Layout & Input - LayoutSettings - qml - qml/icons/detail_icon.svg - - - Network - NetworkSettings - network - newIcons/network_icon.svg - - - Date & Time - TimeDate - timedate - newIcons/date-time_icon.svg - - - Language - Language - locale - newIcons/language_icon.svg - - - Bluetooth - Bluetooth - bluetooth - newIcons/bluetooth_icon.svg - - - Display - Display - display - newIcons/display_icon.svg - - - About Qt - AboutQt - qml - qml/icons/info_icon.svg - - - Power - Power - power - newIcons/power_icon.svg - - - diff --git a/screenshot/Button.qml b/screenshot/Button.qml deleted file mode 100644 index 0c03ac1..0000000 --- a/screenshot/Button.qml +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 - -Rectangle { - - width: 100 - height: 40 - - gradient: Gradient { - GradientStop { position: 0; color: pressed ? "steelblue" : "white" } - GradientStop { position: 1; color: pressed ? "lightsteelblue" : "darkgray" } - } - - border.color: pressed ? "darkgray" : "lightgray" - border.width: 1; - - radius: height / 4 - - property alias text: label.text - property alias pressed: mouse.pressed - - signal clicked; - - Text { - id: label - color: "black" - font.pixelSize: parent.size / 2; - anchors.centerIn: parent; - } - - MouseArea { - id: mouse - anchors.fill: parent - - onClicked: parent.clicked() - - } -} diff --git a/screenshot/Main.qml b/screenshot/Main.qml deleted file mode 100644 index 8aa0af5..0000000 --- a/screenshot/Main.qml +++ /dev/null @@ -1,191 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 - -import Qt.labs.screenshot 1.0 -import QtQuick.Window 2.0 -import com.qtcompany.B2QtLauncher 1.0 - - -Window -{ - id: root - visible: true - - width: 1280 - height: 720 - - LauncherApplicationsModel { - id: applicationsModel - onReady: { - engine.markApplicationsModelReady(); - } - Component.onCompleted: { - //Set the directory to parse for apps - initialize(applicationSettings.appsRoot); - } - } - - LauncherEngine { - id: engine - bootAnimationEnabled: applicationSettings.isBootAnimationEnabled - fpsEnabled: applicationSettings.isShowFPSEnabled - } - - ListView { - id: listView - - anchors.fill: parent; - - model: applicationsModel - - delegate: Loader { - width: root.width - height: root.height - source: location + "/main.qml"; - focus: false - clip: true - } - - interactive: false - - property int listIndex: -1; - onListIndexChanged: positionViewAtIndex(listIndex, ListView.Beginning); - function next() { - if (listIndex < count - 1) - ++listIndex; - print("next: updating list index to: ", listIndex, count); - } - function previous() { - if (listIndex > 0) - --listIndex; - print("prev: updating list index to: ", listIndex); - } - - } - - ScreenShot { - id: screenshot; - } - - SequentialAnimation { - id: grabAnimation; - PropertyAction{ target: controls; property: "visible"; value: false } - PauseAnimation { duration: 100 } - ScriptAction { - script: { - var isPortrait = root.width < root.height; - - var size = Qt.size(800, 450); - var smallSize = Qt.size(128, 72); - var loc = applicationsModel.locationAt(listView.listIndex) + "/" - var name = "preview_l" - var ext = ".jpg" - - if (isPortrait) { - name = "preview_p" - size = Qt.size(400, 225); - smallSize = Qt.size(128, 72); - } - - screenshot.grab(loc + name + ext, size); // medium resolution - //screenshot.grab(loc + name + "_lr" + ext, smallSize); // low resolution - } - } - PauseAnimation { duration: 100 } - PropertyAction { target: controls; property: "visible"; value: true } - } - - Item { - id: controls - - height: 40 - width: parent.width - - Button { - id: prevButton - width: 100 - text: "<<"; - anchors.left: parent.left - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.margins: 2 - - onClicked: listView.previous(); - } - - Button { - id: nextButton - width: 100 - height: parent.height - text: ">>"; - - anchors.right: parent.right - anchors.margins: 2 - anchors.top: parent.top - anchors.bottom: parent.bottom - - onClicked: listView.next(); - } - - Button { - text: 'Grab: "' + applicationsModel.nameAt(listView.listIndex) + '"' - height: parent.height - anchors.left: prevButton.right - anchors.right: nextButton.left - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.margins: 2 - - onClicked: { - grabAnimation.running = true; - } - } - } - - Rectangle { - id: blackOutLine - anchors.fill: parent - anchors.margins: 3 - color: "transparent" - border.color: "black" - border.width: 3 - visible: !controls.visible - } - - Rectangle { - id: whiteOutLine - anchors.fill: parent - color: "transparent" - border.color: "white" - border.width: 3 - visible: !controls.visible - } - -} diff --git a/screenshot/plugin/plugin.cpp b/screenshot/plugin/plugin.cpp deleted file mode 100644 index f701b88..0000000 --- a/screenshot/plugin/plugin.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include - -#include -#include - -#include - -class ScreenShot : public QQuickItem -{ - Q_OBJECT - -public slots: - bool grab(const QString &name, const QSize &size = QSize()) { - if (window()) { - QImage image = window()->grabWindow(); - if (size.width() > 0 && size.height() > 0) - image = image.scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - - QImageWriter writer(name); - writer.setQuality(95); - bool ok = writer.write(image); - if (ok) - qDebug("ScreenShot::grab: saved '%s'", qPrintable(name)); - else - qDebug("ScreenShot::grab: Failed to save '%s'", qPrintable(name)); - return ok; - } else { - qWarning("ScreenShot::grab: no window to grab !!"); - } - return false; - } -}; - -QML_DECLARE_TYPE(ScreenShot) - -class ScreenShotPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0") - -public: - virtual void registerTypes(const char *uri) - { - qmlRegisterType(uri, 1, 0, "ScreenShot"); - } -}; - -#include "plugin.moc" - diff --git a/screenshot/plugin/qmldir b/screenshot/plugin/qmldir deleted file mode 100644 index 49db718..0000000 --- a/screenshot/plugin/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -module Qt.labs.screenshot -plugin screenshotplugin - diff --git a/screenshot/plugin/screenshot.pro b/screenshot/plugin/screenshot.pro deleted file mode 100644 index 8d672dc..0000000 --- a/screenshot/plugin/screenshot.pro +++ /dev/null @@ -1,17 +0,0 @@ -TEMPLATE = lib -TARGET = screenshotplugin -QT += quick -CONFIG += qt plugin - -TARGETPATH=Qt/labs/screenshot - -SOURCES += plugin.cpp - -OTHER_FILES = qmldir - -target.path = $$[QT_INSTALL_QML]/$$TARGETPATH - -qmldir.files = qmldir -qmldir.path = $$[QT_INSTALL_QML]/$$TARGETPATH - -INSTALLS = target qmldir diff --git a/src/applicationsettings.cpp b/src/applicationsettings.cpp deleted file mode 100644 index 957fcc7..0000000 --- a/src/applicationsettings.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "applicationsettings.h" - -#include -#include -#include - -ApplicationSettings::ApplicationSettings(QString appsRoot, QObject *parent) - : QObject(parent) - , m_mainFile(QUrl(QStringLiteral("qrc:///qml/Main.qml"))) - , m_appsRoot(appsRoot) - , m_isShowFPSEnabled(false) -{ -} - -QString ApplicationSettings::appsRoot() const -{ - return m_appsRoot; -} - -bool ApplicationSettings::isShowFPSEnabled() const -{ - return m_isShowFPSEnabled; -} - -bool ApplicationSettings::parseCommandLineArguments() -{ - const QStringList args = QCoreApplication::arguments(); - for (int i = 1; i < args.size(); ++i) { - const QString arg = args.at(i); - if (arg == QStringLiteral("--main-file")) { - ++i; - m_mainFile = QUrl::fromUserInput(args.at(i)); - } else if (arg == QStringLiteral("--applications-root")) { - ++i; - m_appsRoot = args.at(i); - } else if (arg == QStringLiteral("--show-fps")) { - m_isShowFPSEnabled = true; - } else if (arg == QStringLiteral("-h") - || arg == QStringLiteral("--help") - || arg == QStringLiteral("-?")) { - return false; - } else { - qCritical() << "Unknown command line argument:" << args.at(i); - return false; - } - } - return true; -} - -QUrl ApplicationSettings::mainFile() const -{ - return m_mainFile; -} diff --git a/src/applicationsettings.h b/src/applicationsettings.h deleted file mode 100644 index ad50e57..0000000 --- a/src/applicationsettings.h +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef APPLICATIONSETTINGS_H -#define APPLICATIONSETTINGS_H - -#include -#include - -class ApplicationSettings : public QObject -{ - Q_OBJECT - Q_PROPERTY(QUrl mainFile READ mainFile NOTIFY mainFileChanged) - Q_PROPERTY(QString appsRoot READ appsRoot NOTIFY appsRootChanged) - Q_PROPERTY(bool isShowFPSEnabled READ isShowFPSEnabled NOTIFY isShowFPSEnabledChanged) -public: - explicit ApplicationSettings(QString appsRoot, QObject *parent = 0); - - QUrl mainFile() const; - QString appsRoot() const; - bool isShowFPSEnabled() const; - - bool parseCommandLineArguments(); - -signals: - void mainFileChanged(QUrl newFile); - void appsRootChanged(QString appRoot); - void isShowFPSEnabledChanged(bool isEnabled); - -private: - QUrl m_mainFile; - QString m_appsRoot; - bool m_isShowFPSEnabled; - -}; - -#endif // APPLICATIONSETTINGS_H diff --git a/src/applicationsmodel.cpp b/src/applicationsmodel.cpp deleted file mode 100644 index 5c29c93..0000000 --- a/src/applicationsmodel.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "applicationsmodel.h" -#include "applicationsmodel_p.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static bool appOrder(const AppData& a, const AppData& b) -{ - if (a.priority != b.priority) - return a.priority > b.priority; - return a.name < b.name; -} - -void IndexingThread::run() -{ - QList results; - QList roots = root.split(":"); - foreach (const QString &root, roots) { - QDirIterator it(root, QDir::Dirs | QDir::NoDotDot); - while (it.hasNext()) { - QString path = it.next(); - if (QFile::exists(path + "/demo.xml")) - parseDemo(path, results); - } - } - - std::sort(results.begin(), results.end(), appOrder); - - qDebug() << "Indexer: all done... total:" << results.size(); - emit indexingFinished(results); -} - -void IndexingThread::parseDemo(QString path, QList &results) { - QFile file(path + "/demo.xml"); - - if (!file.open(QIODevice::ReadOnly)) - return; - - QXmlStreamReader xml(&file); - - AppData data; - while (!xml.atEnd()) { - switch (xml.readNext()) { - - case QXmlStreamReader::StartElement: - if (xml.name().toString().toLower() == "application") { - data.location = QUrl::fromLocalFile(path); - data.name = xml.attributes().value("title").toString().trimmed(); - data.main = QString("/%1").arg(xml.attributes().value("main").toString()); - - QString imageName = QString("%1/%2") - .arg(path, xml.attributes().value("icon").toString()); - - data.icon = QFile::exists(imageName) - ? QUrl::fromLocalFile(imageName) - : QUrl(); - - data.priority = xml.attributes().value("priority").toInt(); - - } else if (xml.name().toString().toLower() == "description") { - data.description = xml.readElementText().trimmed(); - } - break; - - case QXmlStreamReader::EndElement: - if (xml.name().toString().toLower() == "application") - results << data; - break; - - default: - break; - } - } - - if (xml.error() != QXmlStreamReader::NoError) - qWarning("XML Parser error: %s", qPrintable(xml.errorString())); -} - -ApplicationsModel::ApplicationsModel(QObject *parent) : - QAbstractItemModel(parent) -{ -} - -QHash ApplicationsModel::roleNames() const -{ - QHash names; - names[NameRole] = "name"; - names[DescriptionRole] = "description"; - names[MainFileRole] = "mainFile"; - names[LocationRole] = "location"; - names[IconRole] = "icon"; - names[PriorityRole] = "priority"; - return names; -} - -void ApplicationsModel::initialize(const QString &appsRoot) -{ - auto *thread = new IndexingThread; - thread->root = appsRoot; - thread->model = this; - qRegisterMetaType>("QList"); - connect(thread, &IndexingThread::indexingFinished, - this, &ApplicationsModel::handleIndexingResult); - connect(thread, &QThread::finished, thread, &QObject::deleteLater); - thread->start(); -} - -QVariant ApplicationsModel::data(const QModelIndex &index, int role) const -{ - Q_ASSERT(index.row() >= 0 && index.row() < m_data.size()); - Q_ASSERT(index.column() == 0); - - const AppData &ad = m_data.at(index.row()); - - switch (role) { - case NameRole: return ad.name; - case DescriptionRole: return ad.description; - case LocationRole: return ad.location; - case MainFileRole: return ad.main; - case IconRole: return ad.icon; - case PriorityRole: return ad.priority; - default: qDebug() << "ApplicationsModel::data: unhandled role" << role; - } - - return QVariant(); -} - -QString ApplicationsModel::nameAt(int i) const -{ - if (i < 0 || i >= m_data.size()) { - return "ERROR: out-of-range"; - } - return m_data[i].name; -} - -QString ApplicationsModel::locationAt(int i) const -{ - if (i < 0 || i >= m_data.size()) { - return "ERROR: out-of-range"; - } - return m_data[i].location.toLocalFile(); -} - -QVariant ApplicationsModel::query(int i, const QString &name) const -{ - if (i < 0 || i >= m_data.size()) { - return QVariant(); - } - - const AppData &ad = m_data.at(i); - if (name == QStringLiteral("description")) - return ad.description; - if (name == QStringLiteral("name")) - return ad.name; - if (name == QStringLiteral("location")) - return ad.location; - if (name == QStringLiteral("mainFile")) - return ad.main; - if (name == QStringLiteral("icon")) - return ad.icon; - if (name == QStringLiteral("priority")) - return ad.priority; - - qWarning("ApplicationsModel::query: Asking for bad name %s", qPrintable(name)); - - return QVariant(); -} - -void ApplicationsModel::handleIndexingResult(QList results) -{ - beginResetModel(); - m_data = results; - endResetModel(); - emit ready(); -} diff --git a/src/applicationsmodel.h b/src/applicationsmodel.h deleted file mode 100644 index 74122e1..0000000 --- a/src/applicationsmodel.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef APPLICATIONSMODEL_H -#define APPLICATIONSMODEL_H - -#include -#include - - -struct AppData { - QString name; - QString description; - QString main; - QUrl location; - QUrl icon; - int priority; -}; - - -class ApplicationsModel : public QAbstractItemModel -{ - Q_OBJECT -public: - enum { - NameRole = Qt::UserRole + 1, - DescriptionRole, - MainFileRole, - LocationRole, - IconRole, - LargeIconNameRole, - PriorityRole - }; - - explicit ApplicationsModel(QObject *parent = 0); - - Q_INVOKABLE void initialize(const QString &appsRoot); - - QModelIndex index(int r, int c, const QModelIndex &) const { return createIndex(r, c); } - QModelIndex parent(const QModelIndex&) const { return QModelIndex(); } - int rowCount(const QModelIndex&) const { return m_data.size(); } - int columnCount(const QModelIndex&) const { return 1; } - QVariant data(const QModelIndex &index, int role) const; - - QHash roleNames() const; - - Q_INVOKABLE QString nameAt(int i) const; - Q_INVOKABLE QString locationAt(int i) const; - - Q_INVOKABLE QVariant query(int i, const QString &name) const; - -signals: - void ready(); - -private slots: - void handleIndexingResult(QList results); - -private: - - QList m_data; -}; - - - -#endif // APPLICATIONSMODEL_H diff --git a/src/applicationsmodel_p.h b/src/applicationsmodel_p.h deleted file mode 100644 index ba1254b..0000000 --- a/src/applicationsmodel_p.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef APPLICATIONSMODEL_P_H -#define APPLICATIONSMODEL_P_H - -#include "applicationsmodel.h" - -#include - -class IndexingThread : public QThread -{ - Q_OBJECT -public: - virtual ~IndexingThread() = default; - void run() final; - -private: - void parseDemo(QString path, QList &results); - -signals: - void indexingFinished(QList results); - -public: - QString root; - ApplicationsModel *model = nullptr; -}; - -#endif // APPLICATIONSMODEL_P_H diff --git a/src/automationhelper.cpp b/src/automationhelper.cpp deleted file mode 100644 index b4c6a99..0000000 --- a/src/automationhelper.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "automationhelper.h" -#include -#include -#include - -AutomationHelper::AutomationHelper(QObject* parent) : - QObject(parent) -{ -} - -/*! - * \brief Click center of given QQuickItem - * \param item Item to click - */ -void AutomationHelper::click(QQuickItem* item) -{ - QQuickWindow* window = item->window(); - if (!window) { - qWarning()<<"No window for item "<(item->width()/2); - int centerY = static_cast(item->height()/2); - QPointF globalCoordinates = item->mapToGlobal(QPoint(centerX, centerY)); - QPointF windowCoordinates = window->mapFromGlobal(globalCoordinates.toPoint()); - - QMouseEvent pressEvent(QEvent::MouseButtonPress, windowCoordinates, windowCoordinates, windowCoordinates, - Qt::MouseButton::LeftButton, Qt::NoButton, Qt::NoModifier, Qt::MouseEventSynthesizedByApplication); - QMouseEvent releaseEvent(QEvent::MouseButtonRelease, windowCoordinates, windowCoordinates, windowCoordinates, - Qt::MouseButton::LeftButton, Qt::NoButton, Qt::NoModifier, Qt::MouseEventSynthesizedByApplication); - QApplication::instance()->sendEvent(window, &pressEvent); - QApplication::instance()->sendEvent(window, &releaseEvent); -} - -/*! - * \brief Click center of child item of given QQuickItem - * \param item Item which child to click - * \param childObjectName Object name of the child to click - */ -void AutomationHelper::clickChildObject(QQuickItem* item, QString childObjectName) -{ - QQuickItem* obj = findChildObject(item, childObjectName); - if (!obj) { - qWarning()<<"No such child "<findChild(childObjectName); -} diff --git a/src/automationhelper.h b/src/automationhelper.h deleted file mode 100644 index 8ed5000..0000000 --- a/src/automationhelper.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef AUTOMATIONHELPER_H -#define AUTOMATIONHELPER_H - -#include -#include - -class AutomationHelper : public QObject -{ - Q_OBJECT -public: - AutomationHelper(QObject *parent = 0); - -public slots: - void click(QQuickItem* item); - void clickChildObject(QQuickItem* item, QString childObjectName); - QQuickItem* findChildObject(QQuickItem* item, QString childObjectName); -}; - -#endif // AUTOMATIONHELPER_H diff --git a/src/circularindicator.cpp b/src/circularindicator.cpp deleted file mode 100644 index 9afef84..0000000 --- a/src/circularindicator.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "circularindicator.h" - -CircularIndicator::CircularIndicator(QQuickItem *parent) - : QQuickPaintedItem(parent) - , m_startAngle(0) - , m_spanAngle(360) - , m_lineWidth(10) - , m_progressColor(QColor(255, 0, 0)) - , m_backgroundColor(QColor(240, 240, 240)) - , m_padding(1) -{ -} - -int CircularIndicator::startAngle() const -{ - return m_startAngle; -} - -void CircularIndicator::setStartAngle(int angle) -{ - if (angle == m_startAngle) - return; - - m_startAngle = angle; - emit startAngleChanged(m_startAngle); - update(); -} - -int CircularIndicator::spanAngle() const -{ - return m_spanAngle; -} - -void CircularIndicator::setSpanAngle(int angle) -{ - if (angle == m_spanAngle) - return; - - m_spanAngle = angle; - emit spanAngleChanged(m_spanAngle); - update(); -} - -int CircularIndicator::lineWidth() const -{ - return m_lineWidth; -} - -void CircularIndicator::setLineWidth(int width) -{ - if (width == m_lineWidth) - return; - - m_lineWidth = width; - emit lineWidthChanged(m_lineWidth); - update(); -} - -QColor CircularIndicator::progressColor() const -{ - return m_progressColor; -} - -void CircularIndicator::setProgressColor(const QColor &color) -{ - if (color == m_progressColor) - return; - - m_progressColor = color; - emit progressColorChanged(m_progressColor); - update(); -} - -QColor CircularIndicator::backgroundColor() const -{ - return m_backgroundColor; -} - -void CircularIndicator::setBackgroundColor(const QColor &color) -{ - if (color == m_backgroundColor) - return; - - m_backgroundColor = color; - emit backgroundColorChanged(m_backgroundColor); - update(); -} - -int CircularIndicator::padding() const -{ - return m_padding; -} - -void CircularIndicator::setPadding(int padding) -{ - if (padding == m_padding) - return; - - m_padding = padding; - emit paddingChanged(m_padding); - update(); -} - -void CircularIndicator::paint(QPainter *painter) -{ - painter->setRenderHint(QPainter::Antialiasing); - - const int indicatorSize = qMin(width(), height()) - m_padding * 2 - m_lineWidth; - - if (indicatorSize <= 0) - return; - - QRect indicatorRect(width() / 2 - indicatorSize / 2, - height() / 2 - indicatorSize / 2, - indicatorSize, - indicatorSize); - - QPen pen; - pen.setCapStyle(Qt::RoundCap); - pen.setWidth(m_lineWidth); - - // Draw the background - pen.setColor(m_backgroundColor); - painter->setPen(pen); - painter->drawArc(indicatorRect, 0, 360 * 16); - - if (m_startAngle == m_spanAngle) - return; - - // Draw the foreground - pen.setColor(m_progressColor); - painter->setPen(pen); - painter->drawArc(indicatorRect, (90 - m_startAngle) * 16, -m_spanAngle * 16); -} diff --git a/src/circularindicator.h b/src/circularindicator.h deleted file mode 100644 index 00d3077..0000000 --- a/src/circularindicator.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef CIRCULARINDICATOR_H -#define CIRCULARINDICATOR_H - -#include -#include - -class CircularIndicator : public QQuickPaintedItem -{ - Q_OBJECT - Q_PROPERTY(int startAngle READ startAngle WRITE setStartAngle NOTIFY startAngleChanged) - Q_PROPERTY(int spanAngle READ spanAngle WRITE setSpanAngle NOTIFY spanAngleChanged) - Q_PROPERTY(int lineWidth READ lineWidth WRITE setLineWidth NOTIFY lineWidthChanged) - Q_PROPERTY(QColor progressColor READ progressColor WRITE setProgressColor NOTIFY progressColorChanged) - Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged) - Q_PROPERTY(int padding READ padding WRITE setPadding NOTIFY paddingChanged) - -public: - CircularIndicator(QQuickItem *parent = 0); - ~CircularIndicator() = default; - - int startAngle() const; - int spanAngle() const; - int lineWidth() const; - QColor progressColor() const; - QColor backgroundColor() const; - int padding() const; - -public slots: - void setStartAngle(int angle); - void setSpanAngle(int angle); - void setLineWidth(int width); - void setProgressColor(const QColor &color); - void setBackgroundColor(const QColor &color); - void setPadding(int padding); - -signals: - void startAngleChanged(int); - void spanAngleChanged(int); - void lineWidthChanged(int); - void progressColorChanged(QColor); - void backgroundColorChanged(QColor); - void paddingChanged(int); - -protected: - void paint(QPainter *painter); - -private: - int m_startAngle; - int m_spanAngle; - int m_lineWidth; - QColor m_progressColor; - QColor m_backgroundColor; - int m_padding; -}; - -#endif // CIRCULARINDICATOR_H diff --git a/src/engine.cpp b/src/engine.cpp deleted file mode 100644 index d51a034..0000000 --- a/src/engine.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "engine.h" -#include "fpscounter.h" - -#include -#include -#include - -#include -#include - -#include - -#include -#include - - -#define ENGINE_STATE_RUNNING QStringLiteral("running") -#define ENGINE_STATE_SETTINGS QStringLiteral("settings") - -#define ENGINE_STATE_APPLAUNCHING QStringLiteral("app-launching") -#define ENGINE_STATE_APPRUNNING QStringLiteral("app-running") -#define ENGINE_STATE_APPCLOSING QStringLiteral("app-closing") - -Engine::Engine(QQuickItem *parent) - : QQuickItem(parent) - , m_fpsCounter(nullptr) - , m_fps(0) - , m_intro_done(false) - , m_apps_ready(false) - , m_fps_enabled(false) -{ - m_state = ENGINE_STATE_RUNNING; - - QScreen *screen = QGuiApplication::primaryScreen(); - m_screenSize = screen->size(); - m_dpcm = screen->physicalDotsPerInchY() / 2.54f; - - // Make the buttons smaller for smaller screens to compensate for that - // one typically holds it nearer to the eyes. - float low = 5; - float high = 20; - float screenSizeCM = qMax(qMin(m_screenSize.width(), m_screenSize.height()) / m_dpcm, low); - m_dpcm *= (screenSizeCM - low) / (high - low) * 0.5 + 0.5; - - connect(this, SIGNAL(windowChanged(QQuickWindow*)), this, SLOT(windowChanged(QQuickWindow*))); -} - -bool Engine::checkForGlAvailability() -{ - QQuickWindow window; - return ((window.sceneGraphBackend() != "software") && - (window.sceneGraphBackend() != "softwarecontext")); -} - -void Engine::updateReadyness() -{ - if (!m_intro_done) - return; - if (!m_apps_ready) - return; - - m_state = ENGINE_STATE_RUNNING; - emit stateChanged(m_state); -} - -void Engine::updateFPSCounter() -{ - if (m_fpsCounter) { - delete m_fpsCounter; - m_fpsCounter = nullptr; - } - - if (m_fps_enabled && window()) { - m_fpsCounter = new FpsCounter(window()); - connect(m_fpsCounter, SIGNAL(fps(qreal)), this, SLOT(setFps(qreal))); - } -} - -void Engine::setState(const QString &state) -{ - if (state == m_state) - return; - m_state = state; - emit stateChanged(m_state); -} - -void Engine::setFps(qreal fps) -{ - fps = qRound(fps); - if (qFuzzyCompare(m_fps, fps)) - return; - m_fps = fps; - emit fpsChanged(m_fps); -} - -void Engine::windowChanged(QQuickWindow *window) -{ - Q_UNUSED(window) - //When window changes we need to recreate the fps counters - updateFPSCounter(); -} - -void Engine::setFpsEnabled(bool enabled) -{ - if (m_fps_enabled == enabled) - return; - m_fps_enabled = enabled; - - updateFPSCounter(); - - emit fpsEnabledChanged(m_fps_enabled); -} - -bool Engine::fileExists(const QUrl &fileName) -{ - QFile file(fileName.toLocalFile()); - return file.exists(); -} - -void Engine::launchApplication(const QUrl &path, const QString &mainFile, const QString &name, const QString &desc) -{ - // only launch apps when in the homescreen... - if (m_state != QStringLiteral("running")) - return; - - m_applicationMain = path; - m_applicationMain.setPath(path.path() + "/" + mainFile); - m_applicationName = name; - m_applicationDescription = desc; - emit applicationMainChanged(m_applicationMain); - emit applicationNameChanged(m_applicationName); - emit applicationDescriptionChanged(m_applicationName); - setState(ENGINE_STATE_APPLAUNCHING); -} - -void Engine::closeApplication() -{ - emit activeIconChanged(nullptr); - - m_applicationMain = QUrl(); - m_applicationName = QString(); - m_applicationDescription = QString(); - emit applicationMainChanged(m_applicationMain); - emit applicationNameChanged(m_applicationName); - emit applicationDescriptionChanged(m_applicationName); - - setState(ENGINE_STATE_RUNNING); -} diff --git a/src/engine.h b/src/engine.h deleted file mode 100644 index 3ef185c..0000000 --- a/src/engine.h +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef ENGINE_H -#define ENGINE_H - -#include -#include -#include - -#include - -class QQmlEngine; -class FpsCounter; -class QQuickWindow; - -class Engine : public QQuickItem -{ - Q_OBJECT - - Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged) - - Q_PROPERTY(QUrl applicationMain READ applicationMain NOTIFY applicationMainChanged) - Q_PROPERTY(QString applicationName READ applicationName NOTIFY applicationNameChanged) - Q_PROPERTY(QString applicationDescription READ applicationDescription NOTIFY applicationDescriptionChanged) - - Q_PROPERTY(bool fpsEnabled READ isFpsEnabled WRITE setFpsEnabled NOTIFY fpsEnabledChanged) - Q_PROPERTY(qreal fps READ fps NOTIFY fpsChanged) - - Q_PROPERTY(const QString qtVersion READ qtVersion CONSTANT) - -public: - explicit Engine(QQuickItem *parent = nullptr); - - QString state() const { return m_state; } - void setState(const QString &state); - - bool isFpsEnabled() const { return m_fps_enabled; } - void setFpsEnabled(bool enabled); - - qreal fps() const { return m_fps; } - - QString qtVersion() const { return QT_VERSION_STR; } - - QUrl applicationMain() const { return m_applicationMain; } - QString applicationName() const { return m_applicationName; } - QString applicationDescription() const { return m_applicationDescription; } - - static bool checkForGlAvailability(); - - Q_INVOKABLE int titleFontSize() const { return qMax(m_dpcm * 0.9, 20); } - Q_INVOKABLE int centimeter(int val = 1) const { return (m_dpcm * val); } - Q_INVOKABLE int mm(int val) const { return (int)(m_dpcm * val * 0.1); } - -protected: - -signals: - void stateChanged(const QString &state); - void activeIconChanged(QQuickItem *item); - void applicationMainChanged(const QUrl &applicationMain); - void applicationNameChanged(const QString &applicationName); - void applicationDescriptionChanged(const QString &applicationName); - void fpsChanged(qreal fps); - void fpsEnabledChanged(bool enabled); - -public slots: - void markApplicationsModelReady() { m_apps_ready = true; updateReadyness(); } - void markIntroAnimationDone() { m_intro_done = true; updateReadyness(); } - - void launchApplication(const QUrl &location, const QString &mainFile, const QString &name, const QString &desc); - void closeApplication(); - - void setFps(qreal fps); - - bool fileExists(const QUrl &fileName); - -private slots: - void windowChanged(QQuickWindow *window); - -private: - void updateReadyness(); - void updateFPSCounter(); - - QString m_state; - - QUrl m_applicationMain; - QString m_applicationName; - QString m_applicationDescription; - - QSize m_screenSize; - qreal m_dpcm; - - FpsCounter *m_fpsCounter; - qreal m_fps; - - uint m_intro_done : 1; - uint m_apps_ready : 1; - uint m_fps_enabled : 1; -}; - -#endif // ENGINE_H diff --git a/src/fpscounter.cpp b/src/fpscounter.cpp deleted file mode 100644 index 9c764f7..0000000 --- a/src/fpscounter.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "fpscounter.h" - -#include - -FpsCounter::FpsCounter(QQuickWindow *window) -{ - connect(window, SIGNAL(frameSwapped()), this, SLOT(frameSwapped())); - startTimer(1000); - m_frameCounter = 0; - m_timer.start(); -} - -void FpsCounter::timerEvent(QTimerEvent *) -{ - emit fps(m_frameCounter * 1000.0 / m_timer.elapsed()); - m_frameCounter = 0; - m_timer.start(); -} diff --git a/src/fpscounter.h b/src/fpscounter.h deleted file mode 100644 index a64719a..0000000 --- a/src/fpscounter.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef FPSCOUNTER_H -#define FPSCOUNTER_H - -#include -#include - -class QQuickWindow; - -class FpsCounter : public QObject -{ - Q_OBJECT -public: - FpsCounter(QQuickWindow *window); - - void timerEvent(QTimerEvent *); - -signals: - void fps(qreal newFps); - -public slots: - void frameSwapped() { ++m_frameCounter; } - -private: - QElapsedTimer m_timer; - int m_frameCounter; -}; - -#endif // FPSCOUNTER_H diff --git a/src/imageproviders.cpp b/src/imageproviders.cpp deleted file mode 100644 index bd3bb60..0000000 --- a/src/imageproviders.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "imageproviders.h" - -#include -#include -#include -#include -#include -#include -#include - -static const int CORNER_CUTSIZE = 20; -static const int BORDERSIZE = 3; - -void cutEdges(QImage &image, int cutSize) -{ - if (!image.isNull()) { - const int w = image.width()-1; - const int h = image.height()-1; - if (w >= cutSize && h >= cutSize) { - for (int y=0; y <= cutSize; y++) { - for (int x=0; x <= (cutSize - y); x++) { - image.setPixelColor(x, y, QColor(Qt::transparent)); - image.setPixelColor(w - x, h - y, QColor(Qt::transparent)); - } - } - } - } -} - -void drawBorders(QPainter& painter, int w, int h, int cutSize, const QColor &color) -{ - QPen pen; - pen.setCosmetic(true); - pen.setWidth(3); - pen.setColor(color); - - painter.setPen(pen); - painter.setBrush(Qt::NoBrush); - - QPainterPath path; - path.moveTo(cutSize + 1, 1); - path.lineTo(w - 1, 1); - path.lineTo(w - 1, h - cutSize - 1); - path.lineTo(w - cutSize - 1, h - 1); - path.lineTo(1, h - 1); - path.lineTo(1, cutSize + 1); - path.lineTo(cutSize + 1, 1); - path.closeSubpath(); - painter.drawPath(path); -} - -QtImageProvider::QtImageProvider() : QQuickImageProvider(QQuickImageProvider::Pixmap) -{ -} - -QPixmap QtImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) -{ - Q_UNUSED(size); - Q_UNUSED(requestedSize); - - QString idd = id; - idd.remove("file://"); - - QImage image(idd); - if (!image.isNull()) { - image = image.copy(BORDERSIZE, BORDERSIZE, image.width() - BORDERSIZE * 2, image.height() - BORDERSIZE * 2) - .convertToFormat(QImage::Format_ARGB32); - cutEdges(image, CORNER_CUTSIZE); - } - - return QPixmap::fromImage(image); -} - -QtSquareImageProvider::QtSquareImageProvider() : QQuickImageProvider(QQuickImageProvider::Pixmap) -{ -} - -QPixmap QtSquareImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) -{ - Q_UNUSED(size); - Q_UNUSED(requestedSize); - - QString idd = id; - idd.remove("file://"); - idd.remove("gradient/"); - - QImage image(idd); - if (!image.isNull()) { - const int min = qMin(image.width(), image.height()); - image = image.copy(BORDERSIZE, BORDERSIZE, min - BORDERSIZE * 2, min - BORDERSIZE * 2) - .scaled(requestedSize.width(), requestedSize.height()) - .convertToFormat(QImage::Format_ARGB32); - - if (id.contains("gradient")) { - QPainter p(&image); - QRect r = image.rect(); - QLinearGradient gradient(r.topLeft(), r.bottomLeft()); - gradient.setColorAt(0, QColor("#99FFFFFF")); - gradient.setColorAt(0.25, Qt::transparent); - p.fillRect(r, gradient); - } - - cutEdges(image, CORNER_CUTSIZE); - } - - return QPixmap::fromImage(image); -} - -QtImageMaskProvider::QtImageMaskProvider() : QQuickImageProvider(QQuickImageProvider::Pixmap) -{ -} - -QPixmap QtImageMaskProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) -{ - Q_UNUSED(size); - - if (requestedSize.width() <= 0) - return QPixmap(1, 1); - - QImage image(requestedSize.width(), requestedSize.height(), QImage::Format_ARGB32); - image.fill(Qt::transparent); - - QPainter p(&image); - - if (id.contains("hover")) { - QRect r = image.rect().adjusted(1, 1, -1, -1); - QLinearGradient gradient(r.topLeft(), r.bottomRight()); - gradient.setColorAt(0, QColor("#99000000")); - gradient.setColorAt(1, QColor("#9941cd52")); - p.fillRect(r, gradient); - } - - if (id.contains("namebox")) - p.fillRect(QRectF(0, image.height() * 0.65, image.width(), image.height() * 0.35), QBrush(QColor("#99000000"))); - - cutEdges(image, CORNER_CUTSIZE); - drawBorders(p, image.width(), image.height(), CORNER_CUTSIZE, QColor("#41cd52")); - return QPixmap::fromImage(image); -} diff --git a/src/imageproviders.h b/src/imageproviders.h deleted file mode 100644 index 89ac6d1..0000000 --- a/src/imageproviders.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef IMAGEPROVIDERS_H -#define IMAGEPROVIDERS_H - -#include - - -class QtImageProvider : public QQuickImageProvider -{ -public: - QtImageProvider(); - QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize); -}; - -class QtSquareImageProvider : public QQuickImageProvider -{ -public: - QtSquareImageProvider(); - QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize); -}; - -class QtImageMaskProvider : public QQuickImageProvider -{ -public: - QtImageMaskProvider(); - QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize); -}; -#endif // IMAGEPROVIDERS_H diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100644 index 154973c..0000000 --- a/src/main.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#if defined(USE_QTWEBENGINE) -#include -#endif - -#include "engine.h" -#include "applicationsmodel.h" -#include "applicationsettings.h" -#include "settingsmanager.h" -#include "imageproviders.h" -#include "circularindicator.h" -#include "automationhelper.h" - -void displayHelp(const char *appName) -{ - printf("Usage: \n" - " > %s [options]\n" - "\n" - "Options:\n" - " --main-file [qml-file] Launches an alternative QML file\n" - " --applications-root [path] Specify a different applications root\n" - " --show-fps Show FPS\n" - , appName - ); -} - -int main(int argc, char **argv) -{ -#if defined(USE_QTWEBENGINE) - // This is currently needed by all QtWebEngine applications using the HW accelerated QQuickWebView. - // It enables sharing the QOpenGLContext of all QQuickWindows of the application. - // We have to do so until we expose public API for it in Qt or choose to enable it by default. - QtWebEngine::initialize(); -#endif - QSettings launcherSettings("Qt", "QtLauncher"); - - qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); - - QByteArray applicationsRootStr = launcherSettings.value("defaultApplicationRoot").toByteArray(); - qputenv("QT_QUICK_CONTROLS_CONF", applicationsRootStr + "/qtquickcontrols2/qtquickcontrols2.conf"); - QIcon::setThemeSearchPaths(QStringList() << applicationsRootStr + "/qtquickcontrols2/icons"); - - QIcon::setThemeName("gallery"); - - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - - QApplication app(argc, argv); - app.setApplicationVersion(APPLICATION_VERSION); - - QFontDatabase::addApplicationFont(":/qml/fonts/TitilliumWeb-Light.ttf"); - QFontDatabase::addApplicationFont(":/qml/fonts/TitilliumWeb-Regular.ttf"); - QFontDatabase::addApplicationFont(":/qml/fonts/TitilliumWeb-SemiBold.ttf"); - QFontDatabase::addApplicationFont(":/qml/fonts/TitilliumWeb-Bold.ttf"); - QFontDatabase::addApplicationFont(":/qml/fonts/TitilliumWeb-Black.ttf"); - - //For eBike demo - QFontDatabase::addApplicationFont(":/qml/fonts/Montserrat-Bold.ttf"); - QFontDatabase::addApplicationFont(":/qml/fonts/Montserrat-Light.ttf"); - QFontDatabase::addApplicationFont(":/qml/fonts/Montserrat-Medium.ttf"); - QFontDatabase::addApplicationFont(":/qml/fonts/Montserrat-Regular.ttf"); - QFontDatabase::addApplicationFont(":/qml/fonts/Teko-Bold.ttf"); - QFontDatabase::addApplicationFont(":/qml/fonts/Teko-Light.ttf"); - QFontDatabase::addApplicationFont(":/qml/fonts/Teko-Medium.ttf"); - QFontDatabase::addApplicationFont(":/qml/fonts/Teko-Regular.ttf"); - QFontDatabase::addApplicationFont(":/qml/fonts/fontawesome-webfont.ttf"); - - ApplicationSettings applicationSettings(applicationsRootStr); - - if (!applicationSettings.parseCommandLineArguments()) { - displayHelp(argv[0]); - return 0; - } - - qDebug() << "Main File:" << applicationSettings.mainFile(); - qDebug() << "Applications Root:" << applicationSettings.appsRoot(); - qDebug() << "Show FPS:" << (applicationSettings.isShowFPSEnabled() ? "yes" : "no"); - - - qmlRegisterType("com.qtcompany.B2QtLauncher", 1, 0, "LauncherApplicationsModel"); - qmlRegisterType("com.qtcompany.B2QtLauncher", 1, 0, "LauncherEngine"); - qmlRegisterType("Circle", 1, 0, "CircularIndicator"); - qmlRegisterType("AutomationHelper", 1, 0, "AutomationHelper"); - - QQmlApplicationEngine engine; - SettingsManager settings; - - QtImageProvider imageProvider; - QtSquareImageProvider squareImageProvider; - QtImageMaskProvider imageMaskProvider; - - // Material style can be set only for devices supporting GL - QString style = launcherSettings.value("style").toString(); - if (Engine::checkForGlAvailability()) { - if (style.isEmpty()) - launcherSettings.setValue("style", "Material"); - } else { - qDebug() << "No GL available, skipping Material style"; - launcherSettings.setValue("style", "Default"); - } - QQuickStyle::setStyle(launcherSettings.value("style").toString()); - - engine.rootContext()->setContextProperty("_backgroundColor", launcherSettings.value("backgroundColor", "#09102b")); - engine.rootContext()->setContextProperty("_primaryGreen", launcherSettings.value("primaryGreen", "#41cd52")); - engine.rootContext()->setContextProperty("_mediumGreen", launcherSettings.value("mediumGreen", "#21be2b")); - engine.rootContext()->setContextProperty("_darkGreen", launcherSettings.value("darkGreen", "#17a81a")); - engine.rootContext()->setContextProperty("_primaryGrey", launcherSettings.value("primaryGrey", "#9d9faa")); - engine.rootContext()->setContextProperty("_secondaryGrey", launcherSettings.value("secondaryGrey", "#3a4055")); - - engine.rootContext()->setContextProperty("VideosLocation", - launcherSettings.value("videosLocation")); - engine.rootContext()->setContextProperty("DefaultVideoUrl", - launcherSettings.value("defaultVideoUrl")); - - - engine.addImageProvider("QtImage", &imageProvider); - engine.addImageProvider("QtSquareImage", &squareImageProvider); - engine.addImageProvider("QtImageMask", &imageMaskProvider); - engine.rootContext()->setContextProperty("globalSettings", &settings); - engine.rootContext()->setContextProperty("applicationSettings", &applicationSettings); - engine.rootContext()->setContextProperty("qpa_platform", qGuiApp->platformName()); - engine.rootContext()->setContextProperty("availableStyles", QQuickStyle::availableStyles()); - engine.load(applicationSettings.mainFile()); - - return app.exec(); -} diff --git a/src/settingsmanager.cpp b/src/settingsmanager.cpp deleted file mode 100644 index 58acbf1..0000000 --- a/src/settingsmanager.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "settingsmanager.h" - -static const int DEFAULT_DEMO_STARTUP_TIME = 2 * 60; - -SettingsManager::SettingsManager(QObject *parent) : - QObject(parent), - m_settings("The Qt Company", "Qt Demo Launcher") -{ -} - -SettingsManager::~SettingsManager() -{ - m_settings.sync(); -} - -QVariant SettingsManager::getValue(const QString &key, const QVariant &defaultValue) -{ - return m_settings.value(key, defaultValue); -} - -void SettingsManager::setValue(const QString &key, const QVariant &value) -{ - m_settings.setValue(key, value); - m_settings.sync(); -} - - -bool SettingsManager::gridSelected() -{ - return getValue("gridSelected", false).toBool(); -} - -void SettingsManager::setGridSelected(bool enabled) -{ - if (gridSelected() == enabled) - return; - - setValue("gridSelected", enabled); - emit gridSelectedChanged(enabled); -} - -bool SettingsManager::mouseSelected() -{ - return getValue("mouseSelected", false).toBool(); -} - -void SettingsManager::setMouseSelected(bool enabled) -{ - if (mouseSelected() == enabled) - return; - - setValue("mouseSelected", enabled); - emit mouseSelectedChanged(enabled); -} - -bool SettingsManager::rotationSelected() -{ - return getValue("rotationSelected", false).toBool(); -} - -void SettingsManager::setRotationSelected(bool enabled) -{ - if (rotationSelected() == enabled) - return; - setValue("rotationSelected", enabled); - emit rotationSelectedChanged(enabled); -} - -bool SettingsManager::demoModeSelected() -{ - return getValue("demoModeSelected", false).toBool(); -} - -void SettingsManager::setDemoModeSelected(bool enabled) -{ - if (demoModeSelected() == enabled) - return; - setValue("demoModeSelected", enabled); - emit demoModeSelectedChanged(enabled); -} - -int SettingsManager::demoModeStartupTime() -{ - return getValue("demoModeStartupTime", DEFAULT_DEMO_STARTUP_TIME).toInt(); -} - -void SettingsManager::setDemoModeStartupTime(int startupTime) -{ - if (demoModeStartupTime() == startupTime) - return; - setValue("demoModeStartupTime", startupTime); - emit demoModeStartupTimeChanged(startupTime); -} diff --git a/src/settingsmanager.h b/src/settingsmanager.h deleted file mode 100644 index df6fcfa..0000000 --- a/src/settingsmanager.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Device Creation. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef SETTINGSMANAGER_H -#define SETTINGSMANAGER_H - -#include -#include - -class SettingsManager : public QObject -{ - Q_OBJECT -public: - explicit SettingsManager(QObject *parent = nullptr); - ~SettingsManager(); - - Q_INVOKABLE QVariant getValue(const QString& key, const QVariant &defaultValue); - Q_INVOKABLE void setValue(const QString& key, const QVariant &value); - - Q_PROPERTY(bool gridSelected READ gridSelected WRITE setGridSelected NOTIFY gridSelectedChanged) - - bool gridSelected(); - void setGridSelected(bool enabled); - - Q_PROPERTY (bool mouseSelected READ mouseSelected WRITE setMouseSelected NOTIFY mouseSelectedChanged) - - bool mouseSelected(); - void setMouseSelected(bool enabled); - - Q_PROPERTY (bool rotationSelected READ rotationSelected WRITE setRotationSelected NOTIFY rotationSelectedChanged) - Q_PROPERTY (bool demoModeSelected READ demoModeSelected WRITE setDemoModeSelected NOTIFY demoModeSelectedChanged) - Q_PROPERTY (int demoModeStartupTime READ demoModeStartupTime WRITE setDemoModeStartupTime NOTIFY demoModeStartupTimeChanged) - - bool rotationSelected(); - void setRotationSelected(bool enabled); - bool demoModeSelected(); - void setDemoModeSelected(bool enabled); - int demoModeStartupTime(); - void setDemoModeStartupTime(int startupTime); - -signals: - void gridSelectedChanged(bool enabled); - void mouseSelectedChanged(bool enabled); - void rotationSelectedChanged(bool enabled); - void demoModeSelectedChanged(bool enabled); - void demoModeStartupTimeChanged(int startupTime); - -private: - QSettings m_settings; -}; - -#endif // SETTINGSMANAGER_H diff --git a/startup.pro b/startup.pro deleted file mode 100644 index aecf0aa..0000000 --- a/startup.pro +++ /dev/null @@ -1,45 +0,0 @@ -QT += qml quick widgets quickcontrols2 -TARGET = qtlauncher - -DEFINES += APPLICATION_VERSION=\\\"2.0.1\\\" - -qtHaveModule(webengine) { - DEFINES += USE_QTWEBENGINE - QT += webengine -} - -HEADERS += \ - src/engine.h \ - src/applicationsmodel.h \ - src/applicationsmodel_p.h \ - src/fpscounter.h \ - src/applicationsettings.h \ - src/settingsmanager.h \ - src/imageproviders.h \ - src/circularindicator.h \ - src/automationhelper.h - -SOURCES += src/main.cpp \ - src/engine.cpp \ - src/applicationsmodel.cpp \ - src/fpscounter.cpp \ - src/applicationsettings.cpp \ - src/settingsmanager.cpp \ - src/imageproviders.cpp \ - src/circularindicator.cpp \ - src/automationhelper.cpp - -target.path = $$[INSTALL_ROOT]/usr/bin - -INSTALLS += target - -RESOURCES += \ - icons.qrc \ - images.qrc \ - fonts.qrc \ - qml.qrc - -static { - QTPLUGIN += qtvirtualkeyboardplugin - QT += svg -} -- cgit v1.2.3