From cf1b17437e17c4d61c896cd04d91601920f59378 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Thu, 4 Feb 2021 18:04:13 +0200 Subject: [PATCH] provide Environment Ability --- .../abilities/client/Environment.qml | 37 +++++++++++++++++++ declarativeimports/abilities/client/qmldir | 1 + .../abilities/definition/Environment.qml | 24 ++++++++++++ .../abilities/definition/qmldir | 1 + .../abilities/host/Environment.qml | 32 ++++++++++++++++ declarativeimports/abilities/host/qmldir | 1 + 6 files changed, 96 insertions(+) create mode 100644 declarativeimports/abilities/client/Environment.qml create mode 100644 declarativeimports/abilities/definition/Environment.qml create mode 100644 declarativeimports/abilities/host/Environment.qml diff --git a/declarativeimports/abilities/client/Environment.qml b/declarativeimports/abilities/client/Environment.qml new file mode 100644 index 000000000..68167b7d1 --- /dev/null +++ b/declarativeimports/abilities/client/Environment.qml @@ -0,0 +1,37 @@ +/* +* Copyright 2020 Michail Vourlakos +* +* This file is part of Latte-Dock +* +* Latte-Dock is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* Latte-Dock is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ + +import QtQuick 2.8 + +import org.kde.latte.abilities.definition 0.1 as AbilityDefinition + +AbilityDefinition.Environment { + property Item bridge: null + + isGraphicsSystemAccelerated: ref.environment.isGraphicsSystemAccelerated + + readonly property AbilityDefinition.Environment local: AbilityDefinition.Environment { + isGraphicsSystemAccelerated: (GraphicsInfo.api !== GraphicsInfo.Software) && (GraphicsInfo.api !== GraphicsInfo.Unknown) + } + + Item { + id: ref + readonly property Item environment: bridge ? bridge.environment : local + } +} diff --git a/declarativeimports/abilities/client/qmldir b/declarativeimports/abilities/client/qmldir index 908138529..4e9a509f6 100644 --- a/declarativeimports/abilities/client/qmldir +++ b/declarativeimports/abilities/client/qmldir @@ -4,6 +4,7 @@ Animations 0.1 Animations.qml AppletAbilities 0.1 AppletAbilities.qml Containment 0.1 Containment.qml Debug 0.1 Debug.qml +Environment 0.1 Environment.qml Indexer 0.1 Indexer.qml Indicators 0.1 Indicators.qml Metrics 0.1 Metrics.qml diff --git a/declarativeimports/abilities/definition/Environment.qml b/declarativeimports/abilities/definition/Environment.qml new file mode 100644 index 000000000..b5922aea6 --- /dev/null +++ b/declarativeimports/abilities/definition/Environment.qml @@ -0,0 +1,24 @@ +/* +* Copyright 2021 Michail Vourlakos +* +* This file is part of Latte-Dock +* +* Latte-Dock is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* Latte-Dock is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ + +import QtQuick 2.0 + +Item { + property bool isGraphicsSystemAccelerated: false +} diff --git a/declarativeimports/abilities/definition/qmldir b/declarativeimports/abilities/definition/qmldir index cccb28bc1..11fda76e1 100644 --- a/declarativeimports/abilities/definition/qmldir +++ b/declarativeimports/abilities/definition/qmldir @@ -4,6 +4,7 @@ Animations 0.1 Animations.qml AppletRequirements 0.1 AppletRequirements.qml Containment 0.1 Containment.qml Debug 0.1 Debug.qml +Environment 0.1 Environment.qml Indexer 0.1 Indexer.qml Indicators 0.1 Indicators.qml Metrics 0.1 Metrics.qml diff --git a/declarativeimports/abilities/host/Environment.qml b/declarativeimports/abilities/host/Environment.qml new file mode 100644 index 000000000..15d0642c5 --- /dev/null +++ b/declarativeimports/abilities/host/Environment.qml @@ -0,0 +1,32 @@ +/* +* Copyright 2021 Michail Vourlakos +* +* This file is part of Latte-Dock +* +* Latte-Dock is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* Latte-Dock is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ + +import QtQuick 2.8 + +import org.kde.latte.abilities.definition 0.1 as AbilityDefinition + +AbilityDefinition.Environment { + id: apis + + isGraphicsSystemAccelerated: (GraphicsInfo.api !== GraphicsInfo.Software) && (GraphicsInfo.api !== GraphicsInfo.Unknown) + + readonly property Item publicApi: Item { + readonly property alias isGraphicsSystemAccelerated: apis.isGraphicsSystemAccelerated + } +} diff --git a/declarativeimports/abilities/host/qmldir b/declarativeimports/abilities/host/qmldir index 19be4d85c..bb4187f8d 100644 --- a/declarativeimports/abilities/host/qmldir +++ b/declarativeimports/abilities/host/qmldir @@ -3,6 +3,7 @@ module org.kde.latte.abilities.host Animations 0.1 Animations.qml Containment 0.1 Containment.qml Debug 0.1 Debug.qml +Environment 0.1 Environment.qml Indicators 0.1 Indicators.qml Metrics 0.1 Metrics.qml MyView 0.1 MyView.qml