From 0bc1607893bb4e9dd5ca0286b2be07ba6f17df01 Mon Sep 17 00:00:00 2001 From: Devin Lin Date: Sun, 14 Aug 2022 11:34:46 -0400 Subject: [PATCH] statusbar: Rename WifiIndicator to InternetIndicator, and consolidate --- components/mobileshell/mobileshellplugin.cpp | 1 - .../mobileshell/qml/components/BaseItem.qml | 2 +- .../qml/dataproviders/WifiProvider.qml | 36 ------------------- .../mobileshell/qml/statusbar/StatusBar.qml | 4 ++- ...ifiIndicator.qml => InternetIndicator.qml} | 28 +++++++++++++-- .../indicators/SignalStrengthIndicator.qml | 2 ++ components/mobileshell/resources.qrc | 3 +- 7 files changed, 32 insertions(+), 44 deletions(-) delete mode 100644 components/mobileshell/qml/dataproviders/WifiProvider.qml rename components/mobileshell/qml/statusbar/indicators/{WifiIndicator.qml => InternetIndicator.qml} (56%) diff --git a/components/mobileshell/mobileshellplugin.cpp b/components/mobileshell/mobileshellplugin.cpp index 5a8a7de1..972a20f7 100644 --- a/components/mobileshell/mobileshellplugin.cpp +++ b/components/mobileshell/mobileshellplugin.cpp @@ -82,7 +82,6 @@ void MobileShellPlugin::registerTypes(const char *uri) qmlRegisterSingletonType(resolvePath("dataproviders/BluetoothProvider.qml"), uri, 1, 0, "BluetoothProvider"); qmlRegisterSingletonType(resolvePath("dataproviders/SignalStrengthProvider.qml"), uri, 1, 0, "SignalStrengthProvider"); qmlRegisterSingletonType(resolvePath("dataproviders/VolumeProvider.qml"), uri, 1, 0, "VolumeProvider"); - qmlRegisterSingletonType(resolvePath("dataproviders/WifiProvider.qml"), uri, 1, 0, "WifiProvider"); // /homescreen qmlRegisterType(resolvePath("homescreen/HomeScreen.qml"), uri, 1, 0, "HomeScreen"); diff --git a/components/mobileshell/qml/components/BaseItem.qml b/components/mobileshell/qml/components/BaseItem.qml index 314e206e..7378bf48 100644 --- a/components/mobileshell/qml/components/BaseItem.qml +++ b/components/mobileshell/qml/components/BaseItem.qml @@ -5,7 +5,7 @@ import QtQuick 2.15 /** * Serves a similar function as a QQC2.Control, but does not - * take input events, preventing conflicts with Flickable. + * take touch input events, preventing conflicts with Flickable. */ Item { diff --git a/components/mobileshell/qml/dataproviders/WifiProvider.qml b/components/mobileshell/qml/dataproviders/WifiProvider.qml deleted file mode 100644 index 837af03e..00000000 --- a/components/mobileshell/qml/dataproviders/WifiProvider.qml +++ /dev/null @@ -1,36 +0,0 @@ -/* - SPDX-FileCopyrightText: 2021 Devin Lin - SPDX-FileCopyrightText: 2019 Marco Martin - SPDX-FileCopyrightText: 2013-2017 Jan Grulich - - SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL -*/ - -import QtQuick 2.2 -import QtQuick.Layouts 1.4 -import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.plasma.networkmanagement 0.2 as PlasmaNM - -pragma Singleton - -QtObject { - property string icon: connectionIconProvider.connectionIcon - property bool indicatorRunning: connectionIconProvider.connecting - - property var networkStatus: PlasmaNM.NetworkStatus { - id: networkStatus - } - - property var networkModel: PlasmaNM.NetworkModel { - id: connectionModel - } - - property var handler: PlasmaNM.Handler { - id: handler - } - - property var connectionIcon: PlasmaNM.ConnectionIcon { - id: connectionIconProvider - } -} - diff --git a/components/mobileshell/qml/statusbar/StatusBar.qml b/components/mobileshell/qml/statusbar/StatusBar.qml index e96e86a9..9358cc12 100644 --- a/components/mobileshell/qml/statusbar/StatusBar.qml +++ b/components/mobileshell/qml/statusbar/StatusBar.qml @@ -179,11 +179,13 @@ Item { Layout.fillHeight: true showLabel: false visible: root.showTime + internetIndicator: internetIndicatorItem } Indicators.BluetoothIndicator { Layout.fillHeight: true } - Indicators.WifiIndicator { + Indicators.InternetIndicator { + id: internetIndicatorItem Layout.fillHeight: true } Indicators.VolumeIndicator { diff --git a/components/mobileshell/qml/statusbar/indicators/WifiIndicator.qml b/components/mobileshell/qml/statusbar/indicators/InternetIndicator.qml similarity index 56% rename from components/mobileshell/qml/statusbar/indicators/WifiIndicator.qml rename to components/mobileshell/qml/statusbar/indicators/InternetIndicator.qml index 5d696d1c..2819a757 100644 --- a/components/mobileshell/qml/statusbar/indicators/WifiIndicator.qml +++ b/components/mobileshell/qml/statusbar/indicators/InternetIndicator.qml @@ -15,9 +15,31 @@ import org.kde.plasma.private.mobileshell 1.0 as MobileShell PlasmaCore.IconItem { id: connectionIcon - property MobileShell.WifiProvider provider: MobileShell.WifiProvider + + // data + + readonly property string icon: connectionIconProvider.connectionIcon + readonly property bool indicatorRunning: connectionIconProvider.connecting + + readonly property var networkStatus: PlasmaNM.NetworkStatus { + id: networkStatus + } - source: provider.icon + readonly property var networkModel: PlasmaNM.NetworkModel { + id: connectionModel + } + + readonly property var handler: PlasmaNM.Handler { + id: handler + } + + readonly property var connectionIcon: PlasmaNM.ConnectionIcon { + id: connectionIconProvider + } + + // implementation + + source: icon colorGroup: PlasmaCore.ColorScope.colorGroup Layout.fillHeight: true @@ -27,7 +49,7 @@ PlasmaCore.IconItem { id: connectingIndicator anchors.fill: parent - running: provider.indicatorRunning + running: connectionIcon.indicatorRunning visible: running } } diff --git a/components/mobileshell/qml/statusbar/indicators/SignalStrengthIndicator.qml b/components/mobileshell/qml/statusbar/indicators/SignalStrengthIndicator.qml index 792eeaa1..f7179752 100644 --- a/components/mobileshell/qml/statusbar/indicators/SignalStrengthIndicator.qml +++ b/components/mobileshell/qml/statusbar/indicators/SignalStrengthIndicator.qml @@ -15,6 +15,8 @@ import org.kde.plasma.private.mobileshell 1.0 as MobileShell Item { property MobileShell.SignalStrengthProvider provider: MobileShell.SignalStrengthProvider + required property InternetIndicator internetIndicator + property bool showLabel: true property real textPixelSize: PlasmaCore.Units.gridUnit * 0.6 diff --git a/components/mobileshell/resources.qrc b/components/mobileshell/resources.qrc index 1f3d6baa..128960de 100644 --- a/components/mobileshell/resources.qrc +++ b/components/mobileshell/resources.qrc @@ -36,7 +36,6 @@ qml/dataproviders/BluetoothProvider.qml qml/dataproviders/SignalStrengthProvider.qml qml/dataproviders/VolumeProvider.qml - qml/dataproviders/WifiProvider.qml qml/homescreen/HomeScreen.qml @@ -57,7 +56,7 @@ qml/statusbar/indicators/BluetoothIndicator.qml qml/statusbar/indicators/SignalStrengthIndicator.qml qml/statusbar/indicators/VolumeIndicator.qml - qml/statusbar/indicators/WifiIndicator.qml + qml/statusbar/indicators/InternetIndicator.qml qml/statusbar/ClockText.qml qml/statusbar/StatusBar.qml