From ad2c86c76ba0f10c85f6e422f629176cf84db49b Mon Sep 17 00:00:00 2001 From: JarbasAI <33701864+JarbasAl@users.noreply.github.com> Date: Tue, 5 Nov 2024 00:18:04 +0000 Subject: [PATCH] fix: don't use reserved SYSTEM namespace :facepalm: (#41) * fix: don't use reserved SYSTEM namespace :facepalm: * remove duplicated files from ovos-gui --- ovos_gui_plugin_shell_companion/__init__.py | 20 +-- ...nalSettings.qml => AdditionalSettings.qml} | 2 +- .../gui/qt5/FeatureRequest.qml | 123 ------------- .../gui/qt5/RequestHandler.qml | 35 ---- .../gui/qt5/SYSTEM_AnimatedImageFrame.qml | 83 --------- .../gui/qt5/SYSTEM_HtmlFrame.qml | 20 --- .../gui/qt5/SYSTEM_ImageFrame.qml | 83 --------- .../gui/qt5/SYSTEM_TextFrame.qml | 45 ----- .../gui/qt5/SYSTEM_UrlFrame.qml | 169 ------------------ .../gui/qt5/SwipeArea.qml | 52 ------ .../gui/qt5/WebViewHtmlFrame.qml | 99 ---------- .../gui/qt5/WebViewUrlFrame.qml | 94 ---------- 12 files changed, 11 insertions(+), 814 deletions(-) rename ovos_gui_plugin_shell_companion/gui/qt5/{SYSTEM_AdditionalSettings.qml => AdditionalSettings.qml} (96%) delete mode 100644 ovos_gui_plugin_shell_companion/gui/qt5/FeatureRequest.qml delete mode 100644 ovos_gui_plugin_shell_companion/gui/qt5/RequestHandler.qml delete mode 100644 ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_AnimatedImageFrame.qml delete mode 100644 ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_HtmlFrame.qml delete mode 100644 ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_ImageFrame.qml delete mode 100644 ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_TextFrame.qml delete mode 100644 ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_UrlFrame.qml delete mode 100644 ovos_gui_plugin_shell_companion/gui/qt5/SwipeArea.qml delete mode 100644 ovos_gui_plugin_shell_companion/gui/qt5/WebViewHtmlFrame.qml delete mode 100644 ovos_gui_plugin_shell_companion/gui/qt5/WebViewUrlFrame.qml diff --git a/ovos_gui_plugin_shell_companion/__init__.py b/ovos_gui_plugin_shell_companion/__init__.py index c7ba66b..0d03ffa 100644 --- a/ovos_gui_plugin_shell_companion/__init__.py +++ b/ovos_gui_plugin_shell_companion/__init__.py @@ -90,7 +90,7 @@ def handle_system_display_homescreen(self, message): def handle_device_settings(self, message): """ Display device settings page. """ self.gui["state"] = "settings/settingspage" - self.gui.show_page("SYSTEM_AdditionalSettings.qml", override_idle=True) + self.gui.show_page("AdditionalSettings", override_idle=True) def handle_device_homescreen_settings(self, message): """ @@ -100,14 +100,14 @@ def handle_device_homescreen_settings(self, message): self.gui["idleScreenList"] = {"screenBlob": screens} self.gui["selectedScreen"] = self.homescreen_manager.get_active_homescreen() self.gui["state"] = "settings/homescreen_settings" - self.gui.show_page("SYSTEM_AdditionalSettings.qml", override_idle=True) + self.gui.show_page("AdditionalSettings", override_idle=True) def handle_device_ssh_settings(self, message): """ display ssh settings page """ self.gui["state"] = "settings/ssh_settings" - self.gui.show_page("SYSTEM_AdditionalSettings.qml", override_idle=True) + self.gui.show_page("AdditionalSettings", override_idle=True) def handle_set_homescreen(self, message): """ @@ -125,15 +125,15 @@ def handle_device_developer_settings(self, message): def handle_device_customize_settings(self, message): self.gui['state'] = 'settings/customize_settings' - self.gui.show_page("SYSTEM_AdditionalSettings.qml", override_idle=True) + self.gui.show_page("AdditionalSettings", override_idle=True) def handle_device_create_theme(self, message): self.gui['state'] = 'settings/customize_theme' - self.gui.show_page("SYSTEM_AdditionalSettings.qml", override_idle=True) + self.gui.show_page("AdditionalSettings", override_idle=True) def handle_device_display_factory(self, message): self.gui['state'] = 'settings/factory_settings' - self.gui.show_page("SYSTEM_AdditionalSettings.qml", override_idle=True) + self.gui.show_page("AdditionalSettings", override_idle=True) def handle_device_display_settings(self, message): LOG.debug(f"Display settings: {self.config}") @@ -141,7 +141,7 @@ def handle_device_display_settings(self, message): # wallpaper_rotation data is determined via Messagebus in Qt directly self.gui['display_auto_dim'] = self.config.get("auto_dim", False) self.gui['display_auto_nightmode'] = self.config.get("auto_nightmode", False) - self.gui.show_page("SYSTEM_AdditionalSettings.qml", override_idle=True) + self.gui.show_page("AdditionalSettings", override_idle=True) def handle_device_about_page(self, message): # TODO: Move `system_information` generation to util method @@ -149,7 +149,7 @@ def handle_device_about_page(self, message): system_information = {"display_list": self.about_page_data} self.gui['state'] = 'settings/about_page' self.gui['system_info'] = system_information - self.gui.show_page("SYSTEM_AdditionalSettings.qml", override_idle=True) + self.gui.show_page("AdditionalSettings", override_idle=True) def handle_display_auto_dim_config_set(self, message): auto_dim = message.data.get("auto_dim", False) @@ -171,13 +171,13 @@ def display_advanced_config_for_group(self, message=None): self.gui["groupName"] = group_name self.gui["groupConfigurationData"] = group_meta self.gui['state'] = 'settings/configuration_generator_display' - self.gui.show_page("SYSTEM_AdditionalSettings.qml", override_idle=True) + self.gui.show_page("AdditionalSettings", override_idle=True) def display_advanced_config_groups(self, message=None): groups_list = message.data.get("groups") self.gui["groupList"] = groups_list self.gui['state'] = 'settings/configuration_groups_display' - self.gui.show_page("SYSTEM_AdditionalSettings.qml", override_idle=True) + self.gui.show_page("AdditionalSettings", override_idle=True) def build_initial_about_page_data(self): uname_info = platform.uname() diff --git a/ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_AdditionalSettings.qml b/ovos_gui_plugin_shell_companion/gui/qt5/AdditionalSettings.qml similarity index 96% rename from ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_AdditionalSettings.qml rename to ovos_gui_plugin_shell_companion/gui/qt5/AdditionalSettings.qml index 9f55318..0eae6c8 100644 --- a/ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_AdditionalSettings.qml +++ b/ovos_gui_plugin_shell_companion/gui/qt5/AdditionalSettings.qml @@ -54,7 +54,7 @@ Mycroft.Delegate { } onPageToLoadChanged: { - console.log(sessionData.state) + console.log("Shell companion: " + sessionData.state) rootLoader.setSource(sessionData.state + ".qml") } } diff --git a/ovos_gui_plugin_shell_companion/gui/qt5/FeatureRequest.qml b/ovos_gui_plugin_shell_companion/gui/qt5/FeatureRequest.qml deleted file mode 100644 index 1e83d97..0000000 --- a/ovos_gui_plugin_shell_companion/gui/qt5/FeatureRequest.qml +++ /dev/null @@ -1,123 +0,0 @@ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtWebEngine 1.7 -import QtWebChannel 1.0 -import QtQuick.Layouts 1.12 -import org.kde.kirigami 2.11 as Kirigami - -Item { - property var requestedFeature; - property url securityOrigin; - - width: parent.width - height: parent.height - - onRequestedFeatureChanged: { - message.text = securityOrigin + " has requested access to your " - + message.textForFeature(requestedFeature); - } - - RowLayout { - anchors.fill: parent - - Label { - id: message - Layout.fillWidth: true - Layout.leftMargin: Kirigami.Units.largeSpacing - wrapMode: Text.WordWrap - maximumLineCount: 2 - elide: Text.ElideRight - - function textForFeature(feature) { - if (feature === WebEngineView.MediaAudioCapture) - return "microphone" - if (feature === WebEngineView.MediaVideoCapture) - return "camera" - if (feature === WebEngineView.MediaAudioVideoCapture) - return "camera and microphone" - if (feature === WebEngineView.Geolocation) - return "location" - } - } - - Button { - id: acceptButton - Layout.alignment: Qt.AlignRight - Layout.preferredWidth: parent.width * 0.18 - - background: Rectangle { - color: acceptButton.activeFocus ? Kirigami.Theme.highlightColor : Qt.lighter(Kirigami.Theme.backgroundColor, 1.2) - border.color: Kirigami.Theme.disabledTextColor - radius: 20 - } - - contentItem: Item { - Kirigami.Heading { - level: 3 - font.pixelSize: parent.width * 0.075 - anchors.centerIn: parent - text: "Accept" - } - } - - onClicked: { - webview.grantFeaturePermission(securityOrigin, - requestedFeature, true); - interactionBar.isRequested = false; - } - } - - Button { - id: denyButton - Layout.alignment: Qt.AlignRight - Layout.preferredWidth: parent.width * 0.18 - - background: Rectangle { - color: denyButton.activeFocus ? Kirigami.Theme.highlightColor : Qt.lighter(Kirigami.Theme.backgroundColor, 1.2) - border.color: Kirigami.Theme.disabledTextColor - radius: 20 - } - - contentItem: Item { - Kirigami.Heading { - level: 3 - font.pixelSize: parent.width * 0.075 - anchors.centerIn: parent - text: "Deny" - } - } - - onClicked: { - webview.grantFeaturePermission(securityOrigin, - requestedFeature, false); - interactionBar.isRequested = false - } - } - - Button { - id: closeButton - Layout.alignment: Qt.AlignRight - Layout.preferredWidth: Kirigami.Units.iconSizes.large - (Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing) - Layout.preferredHeight: Kirigami.Units.iconSizes.large - (Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing) - Layout.leftMargin: Kirigami.Units.largeSpacing - Layout.rightMargin: Kirigami.Units.largeSpacing - - background: Rectangle { - color: denyButton.activeFocus ? Kirigami.Theme.highlightColor : Qt.lighter(Kirigami.Theme.backgroundColor, 1.2) - border.color: Kirigami.Theme.disabledTextColor - radius: 200 - } - - Kirigami.Icon { - anchors.centerIn: parent - width: Kirigami.Units.iconSizes.medium - height: Kirigami.Units.iconSizes.medium - source: "window-close" - } - - onClicked: { - interactionBar.isRequested = false - } - } - } -} diff --git a/ovos_gui_plugin_shell_companion/gui/qt5/RequestHandler.qml b/ovos_gui_plugin_shell_companion/gui/qt5/RequestHandler.qml deleted file mode 100644 index 9951510..0000000 --- a/ovos_gui_plugin_shell_companion/gui/qt5/RequestHandler.qml +++ /dev/null @@ -1,35 +0,0 @@ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtWebEngine 1.7 -import QtWebChannel 1.0 -import QtQuick.Layouts 1.12 -import org.kde.kirigami 2.11 as Kirigami - -Rectangle { - property bool isRequested: false - property alias source: interactionLoader.source - property alias interactionItem: interactionLoader.item - - visible: isRequested - enabled: isRequested - width: parent.width - height: isRequested ? Kirigami.Units.gridUnit * 6 : 0 - color: Kirigami.Theme.backgroundColor - - function setSource(interactionSource){ - interactionLoader.setSource(interactionSource) - } - - Keys.onEscapePressed: { - isRequested = false; - } - - Keys.onBackPressed: { - isRequested = false; - } - - Loader { - id: interactionLoader - anchors.fill: parent - } -} diff --git a/ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_AnimatedImageFrame.qml b/ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_AnimatedImageFrame.qml deleted file mode 100644 index 1df514c..0000000 --- a/ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_AnimatedImageFrame.qml +++ /dev/null @@ -1,83 +0,0 @@ -import QtQuick.Layouts 1.4 -import QtQuick 2.4 -import QtQuick.Controls 2.0 -import org.kde.kirigami 2.4 as Kirigami - -import Mycroft 1.0 as Mycroft - -Mycroft.Delegate { - id: systemImageFrame - skillBackgroundColorOverlay: sessionData.background_color ? sessionData.background_color : "#000000" - property bool hasTitle: sessionData.title.length > 0 ? true : false - property bool hasCaption: sessionData.caption.length > 0 ? true : false - - ColumnLayout { - id: systemImageFrameLayout - anchors.fill: parent - - Kirigami.Heading { - id: systemImageTitle - visible: hasTitle - enabled: hasTitle - Layout.fillWidth: true - Layout.preferredHeight: paintedHeight + Kirigami.Units.largeSpacing - level: 3 - text: sessionData.title - wrapMode: Text.Wrap - font.family: "Noto Sans" - font.weight: Font.Bold - } - - AnimatedImage { - id: systemImageDisplay - visible: true - enabled: true - Layout.fillWidth: true - Layout.fillHeight: true - source: sessionData.image - property var fill: sessionData.fill - - onFillChanged: { - console.log(fill) - if(fill == "PreserveAspectCrop"){ - systemImageDisplay.fillMode = 2 - } else if (fill == "PreserveAspectFit"){ - console.log("inFit") - systemImageDisplay.fillMode = 1 - } else if (fill == "Stretch"){ - systemImageDisplay.fillMode = 0 - } else { - systemImageDisplay.fillMode = 0 - } - } - - - Rectangle { - id: systemImageCaptionBox - visible: hasCaption - enabled: hasCaption - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - height: systemImageCaption.paintedHeight - color: "#95000000" - - Kirigami.Heading { - id: systemImageCaption - level: 2 - anchors.left: parent.left - anchors.leftMargin: Kirigami.Units.largeSpacing - anchors.right: parent.right - anchors.rightMargin: Kirigami.Units.largeSpacing - anchors.verticalCenter: parent.verticalCenter - text: sessionData.caption - wrapMode: Text.Wrap - font.family: "Noto Sans" - font.weight: Font.Bold - } - } - } - } -} - - diff --git a/ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_HtmlFrame.qml b/ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_HtmlFrame.qml deleted file mode 100644 index fb5dcc6..0000000 --- a/ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_HtmlFrame.qml +++ /dev/null @@ -1,20 +0,0 @@ -import QtQuick.Layouts 1.4 -import QtQuick 2.4 -import QtQuick.Controls 2.0 -import org.kde.kirigami 2.4 as Kirigami - -import Mycroft 1.0 as Mycroft - -Mycroft.Delegate { - id: systemHtmlFrame - skillBackgroundColorOverlay: "#000000" - - Loader { - id: webViewHtmlLoader - source: "WebViewHtmlFrame.qml" - anchors.fill: parent - property var pageHtml: sessionData.html - property var resourceLocation: sessionData.resourceLocation - } -} - diff --git a/ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_ImageFrame.qml b/ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_ImageFrame.qml deleted file mode 100644 index 7eb8ba4..0000000 --- a/ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_ImageFrame.qml +++ /dev/null @@ -1,83 +0,0 @@ -import QtQuick.Layouts 1.4 -import QtQuick 2.4 -import QtQuick.Controls 2.0 -import org.kde.kirigami 2.4 as Kirigami - -import Mycroft 1.0 as Mycroft - -Mycroft.Delegate { - id: systemImageFrame - skillBackgroundColorOverlay: sessionData.background_color ? sessionData.background_color : "#000000" - property bool hasTitle: sessionData.title.length > 0 ? true : false - property bool hasCaption: sessionData.caption.length > 0 ? true : false - - ColumnLayout { - id: systemImageFrameLayout - anchors.fill: parent - - Kirigami.Heading { - id: systemImageTitle - visible: hasTitle - enabled: hasTitle - Layout.fillWidth: true - Layout.preferredHeight: paintedHeight + Kirigami.Units.largeSpacing - level: 3 - text: sessionData.title - wrapMode: Text.Wrap - font.family: "Noto Sans" - font.weight: Font.Bold - } - - Image { - id: systemImageDisplay - visible: true - enabled: true - Layout.fillWidth: true - Layout.fillHeight: true - source: sessionData.image - property var fill: sessionData.fill - - onFillChanged: { - console.log(fill) - if(fill == "PreserveAspectCrop"){ - systemImageDisplay.fillMode = 2 - } else if (fill == "PreserveAspectFit"){ - console.log("inFit") - systemImageDisplay.fillMode = 1 - } else if (fill == "Stretch"){ - systemImageDisplay.fillMode = 0 - } else { - systemImageDisplay.fillMode = 0 - } - } - - - Rectangle { - id: systemImageCaptionBox - visible: hasCaption - enabled: hasCaption - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - height: systemImageCaption.paintedHeight - color: "#95000000" - - Kirigami.Heading { - id: systemImageCaption - level: 2 - anchors.left: parent.left - anchors.leftMargin: Kirigami.Units.largeSpacing - anchors.right: parent.right - anchors.rightMargin: Kirigami.Units.largeSpacing - anchors.verticalCenter: parent.verticalCenter - text: sessionData.caption - wrapMode: Text.Wrap - font.family: "Noto Sans" - font.weight: Font.Bold - } - } - } - } -} - - diff --git a/ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_TextFrame.qml b/ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_TextFrame.qml deleted file mode 100644 index ebe7985..0000000 --- a/ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_TextFrame.qml +++ /dev/null @@ -1,45 +0,0 @@ -import QtQuick.Layouts 1.4 -import QtQuick 2.4 -import QtQuick.Controls 2.0 -import org.kde.kirigami 2.4 as Kirigami - -import Mycroft 1.0 as Mycroft - -Mycroft.CardDelegate { - id: systemTextFrame - skillBackgroundColorOverlay: "#000000" - cardBackgroundOverlayColor: "#000000" - - property bool hasTitle: sessionData.title.length > 0 ? true : false - - contentItem: Rectangle { - color: "blue" - - ColumnLayout { - anchors.fill: parent - - Mycroft.AutoFitLabel { - id: systemTextFrameTitle - wrapMode: Text.Wrap - visible: hasTitle - enabled: hasTitle - Layout.fillWidth: true - Layout.fillHeight: true - font.family: "Noto Sans" - font.weight: Font.Bold - text: sessionData.title - } - - Mycroft.AutoFitLabel { - id: systemTextFrameMainBody - wrapMode: Text.Wrap - font.family: "Noto Sans" - Layout.fillWidth: true - Layout.fillHeight: true - font.weight: Font.Bold - text: sessionData.text - } - } - } -} - diff --git a/ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_UrlFrame.qml b/ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_UrlFrame.qml deleted file mode 100644 index 33b197a..0000000 --- a/ovos_gui_plugin_shell_companion/gui/qt5/SYSTEM_UrlFrame.qml +++ /dev/null @@ -1,169 +0,0 @@ -import QtQuick.Layouts 1.4 -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import org.kde.kirigami 2.11 as Kirigami -import QtWebEngine 1.8 -import Mycroft 1.0 as Mycroft - -Mycroft.AbstractDelegate { - id: systemUrlFrame - property var pageUrl: sessionData.url - - onPageUrlChanged: { - if(typeof pageUrl !== "undefined" || typeof pageUrl !== null){ - webview.url = pageUrl - } - } - - contentItem: Item { - anchors.fill: parent - - Rectangle { - id: blankArea - color: Kirigami.Theme.backgroundColor - height: Mycroft.Units.gridUnit * 2 - anchors.top: parent.top - width: parent.width - } - - SwipeArea { - anchors.top: blankArea.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - preventStealing: true - - Flickable { - id: flickable - clip: true; - anchors.fill: parent - contentHeight: systemUrlFrame.height * 2 - contentWidth: systemUrlFrame.width - - property var storeCHeight - property var storeCWidth - - WebEngineView { - id: webview - anchors.fill : parent; - profile: defaultProfile - - settings.autoLoadImages: true - settings.javascriptEnabled: true - settings.errorPageEnabled: true - settings.pluginsEnabled: true - settings.allowWindowActivationFromJavaScript: true - settings.javascriptCanOpenWindows: true - settings.fullScreenSupportEnabled: true - settings.autoLoadIconsForPage: true - settings.touchIconsEnabled: true - settings.webRTCPublicInterfacesOnly: true - settings.showScrollBars: false - - onNewViewRequested: function(request) { - if (!request.userInitiated) { - console.log("Warning: Blocked a popup window."); - } else if (request.destination === WebEngineView.NewViewInDialog) { - popuproot.open() - request.openIn(popupwebview); - } else { - request.openIn(webview); - } - } - - onJavaScriptDialogRequested: function(request) { - request.accepted = true; - } - - onFeaturePermissionRequested: { - interactionBar.setSource("FeatureRequest.qml") - interactionBar.interactionItem.securityOrigin = securityOrigin; - interactionBar.interactionItem.requestedFeature = feature; - interactionBar.isRequested = true; - } - - onFullScreenRequested: function(request) { - if (request.toggleOn) { - flickable.storeCWidth = flickable.contentWidth - flickable.storeCHeight = flickable.contentHeight - flickable.contentWidth = flickable.width - flickable.contentHeight = flickable.height - } - else { - flickable.contentWidth = flickable.storeCWidth - flickable.contentHeight = flickable.storeCHeight - } - request.accept() - } - - onLoadingChanged: { - if (loadRequest.status !== WebEngineView.LoadSucceededStatus) { - return; - } - - flickable.contentHeight = 0; - flickable.contentWidth = flickable.width; - - runJavaScript ( - "document.documentElement.scrollHeight;", - function (actualPageHeight) { - flickable.contentHeight = Math.max ( - actualPageHeight, flickable.height); - }); - } - } - - WebEngineProfile { - id: defaultProfile - httpUserAgent: "Mozilla/5.0 (Linux; Android 13; Pixel 6a) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Mobile Safari/537.36" - } - - onFlickEnded: { - webview.runJavaScript ( - "document.documentElement.scrollHeight;", - function (actualPageHeight) { - flickable.contentHeight = Math.max ( - actualPageHeight, flickable.height); - }); - } - } - - RequestHandler { - id: interactionBar - anchors.top: parent.top - z: 1001 - } - - Popup { - id: popuproot - modal: true - focus: true - width: root.width - Kirigami.Units.largeSpacing * 1.25 - height: root.height - Kirigami.Units.largeSpacing * 1.25 - closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent - anchors.centerIn: parent - - WebEngineView { - id: popupwebview - anchors.fill: parent - url: "about:blank" - settings.autoLoadImages: true - settings.javascriptEnabled: true - settings.errorPageEnabled: true - settings.pluginsEnabled: true - settings.allowWindowActivationFromJavaScript: true - settings.javascriptCanOpenWindows: true - settings.fullScreenSupportEnabled: true - settings.autoLoadIconsForPage: true - settings.touchIconsEnabled: true - settings.webRTCPublicInterfacesOnly: true - property string urlalias: popupwebview.url - - onNewViewRequested: function(request) { - console.log(request.destination) - } - } - } - } - } -} diff --git a/ovos_gui_plugin_shell_companion/gui/qt5/SwipeArea.qml b/ovos_gui_plugin_shell_companion/gui/qt5/SwipeArea.qml deleted file mode 100644 index a0a29d8..0000000 --- a/ovos_gui_plugin_shell_companion/gui/qt5/SwipeArea.qml +++ /dev/null @@ -1,52 +0,0 @@ -import QtQuick 2.9 - -MouseArea { - id: mouseSwipeArea - preventStealing: true - - property real prevX: 0 - property real prevY: 0 - property real velocityX: 0.0 - property real velocityY: 0.0 - property int startX: 0 - property int startY: 0 - property bool tracing: false - - signal swipe(string direction) - - onPressed: { - startX = mouse.x - startY = mouse.y - prevX = mouse.x - prevY = mouse.y - velocityX = 0 - velocityY = 0 - tracing = true - } - - onPositionChanged: { - if ( !tracing ) return - var currVelX = (mouse.x-prevX) - var currVelY = (mouse.y-prevY) - - velocityX = (velocityX + currVelX)/2.0; - velocityY = (velocityY + currVelY)/2.0; - - prevX = mouse.x - prevY = mouse.y - - if ( velocityX > 15 && mouse.x > mouseSwipeArea.width * 0.25 ) { - tracing = false - mouseSwipeArea.swipe("right") - } else if ( velocityX < -15 && mouse.x < mouseSwipeArea.width * 0.75 ) { - tracing = false - mouseSwipeArea.swipe("left") - } else if (velocityY > 15 && mouse.y > mouseSwipeArea.height * 0.25 ) { - tracing = false - mouseSwipeArea.swipe("down") - } else if ( velocityY < -15 && mouse.y < mouseSwipeArea.height * 0.75 ) { - tracing = false - mouseSwipeArea.swipe("up") - } - } -} diff --git a/ovos_gui_plugin_shell_companion/gui/qt5/WebViewHtmlFrame.qml b/ovos_gui_plugin_shell_companion/gui/qt5/WebViewHtmlFrame.qml deleted file mode 100644 index 25a57d2..0000000 --- a/ovos_gui_plugin_shell_companion/gui/qt5/WebViewHtmlFrame.qml +++ /dev/null @@ -1,99 +0,0 @@ -import QtQuick 2.4 -import QtQuick.Controls 2.2 -import QtWebEngine 1.8 -import QtQuick.Controls 2.0 -import org.kde.kirigami 2.4 as Kirigami - -Item { - id: root - property var pageHtml: webViewHtmlLoader.pageHtml - property var resourceLocation: webViewHtmlLoader.resourceLocation ? webViewHtmlLoader.resourceLocation : "http://localhost" - - onResourceLocationChanged: { - console.log(resourceLocation) - } - - onPageHtmlChanged: { - if(pageHtml){ - webview.loadHtml(pageHtml, resourceLocation) - } - } - - RequestHandler { - id: interactionBar - anchors.top: parent.top - z: 1001 - } - - WebEngineView { - id: webview - anchors.fill: parent - settings.autoLoadImages: true - settings.javascriptEnabled: true - settings.errorPageEnabled: true - settings.pluginsEnabled: true - settings.allowWindowActivationFromJavaScript: true - settings.javascriptCanOpenWindows: true - settings.fullScreenSupportEnabled: true - settings.autoLoadIconsForPage: true - settings.touchIconsEnabled: true - settings.webRTCPublicInterfacesOnly: true - - onNewViewRequested: function(request) { - if (!request.userInitiated) { - console.log("Warning: Blocked a popup window."); - } else if (request.destination === WebEngineView.NewViewInDialog) { - popuproot.open() - request.openIn(popupwebview); - } else { - request.openIn(webview); - } - } - - onJavaScriptDialogRequested: function(request) { - request.accepted = true; - } - - onFeaturePermissionRequested: { - interactionBar.setSource("FeatureRequest.qml") - interactionBar.interactionItem.securityOrigin = securityOrigin; - interactionBar.interactionItem.requestedFeature = feature; - interactionBar.isRequested = true; - } - - onFullScreenRequested: { - request.accept() - } - } - - Popup { - id: popuproot - modal: true - focus: true - width: root.width - Kirigami.Units.largeSpacing * 1.25 - height: root.height - Kirigami.Units.largeSpacing * 1.25 - closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent - anchors.centerIn: parent - - WebEngineView { - id: popupwebview - anchors.fill: parent - url: "about:blank" - settings.autoLoadImages: true - settings.javascriptEnabled: true - settings.errorPageEnabled: true - settings.pluginsEnabled: true - settings.allowWindowActivationFromJavaScript: true - settings.javascriptCanOpenWindows: true - settings.fullScreenSupportEnabled: true - settings.autoLoadIconsForPage: true - settings.touchIconsEnabled: true - settings.webRTCPublicInterfacesOnly: true - property string urlalias: popupwebview.url - - onNewViewRequested: function(request) { - console.log(request.destination) - } - } - } -} diff --git a/ovos_gui_plugin_shell_companion/gui/qt5/WebViewUrlFrame.qml b/ovos_gui_plugin_shell_companion/gui/qt5/WebViewUrlFrame.qml deleted file mode 100644 index db60ae1..0000000 --- a/ovos_gui_plugin_shell_companion/gui/qt5/WebViewUrlFrame.qml +++ /dev/null @@ -1,94 +0,0 @@ -import QtQuick 2.4 -import QtQuick.Controls 2.2 -import QtWebEngine 1.8 -import QtQuick.Controls 2.0 -import org.kde.kirigami 2.4 as Kirigami - -Item { - id: root - property var pageUrl: webViewUrlLoader.pageUrl - - onPageUrlChanged: { - if(typeof pageUrl !== "undefined" || typeof pageUrl !== null){ - webview.url = pageUrl - } - } - - RequestHandler { - id: interactionBar - anchors.top: parent.top - z: 1001 - } - - WebEngineView { - id: webview - anchors.fill: parent - settings.autoLoadImages: true - settings.javascriptEnabled: true - settings.errorPageEnabled: true - settings.pluginsEnabled: true - settings.allowWindowActivationFromJavaScript: true - settings.javascriptCanOpenWindows: true - settings.fullScreenSupportEnabled: true - settings.autoLoadIconsForPage: true - settings.touchIconsEnabled: true - settings.webRTCPublicInterfacesOnly: true - - onNewViewRequested: function(request) { - if (!request.userInitiated) { - console.log("Warning: Blocked a popup window."); - } else if (request.destination === WebEngineView.NewViewInDialog) { - popuproot.open() - request.openIn(popupwebview); - } else { - request.openIn(webview); - } - } - - onJavaScriptDialogRequested: function(request) { - request.accepted = true; - } - - onFeaturePermissionRequested: { - interactionBar.setSource("FeatureRequest.qml") - interactionBar.interactionItem.securityOrigin = securityOrigin; - interactionBar.interactionItem.requestedFeature = feature; - interactionBar.isRequested = true; - } - - onFullScreenRequested: { - request.accept() - } - } - - Popup { - id: popuproot - modal: true - focus: true - width: root.width - Kirigami.Units.largeSpacing * 1.25 - height: root.height - Kirigami.Units.largeSpacing * 1.25 - closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent - anchors.centerIn: parent - - WebEngineView { - id: popupwebview - anchors.fill: parent - url: "about:blank" - settings.autoLoadImages: true - settings.javascriptEnabled: true - settings.errorPageEnabled: true - settings.pluginsEnabled: true - settings.allowWindowActivationFromJavaScript: true - settings.javascriptCanOpenWindows: true - settings.fullScreenSupportEnabled: true - settings.autoLoadIconsForPage: true - settings.touchIconsEnabled: true - settings.webRTCPublicInterfacesOnly: true - property string urlalias: popupwebview.url - - onNewViewRequested: function(request) { - console.log(request.destination) - } - } - } -}