mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
dataproviders: declare SignalStrengthInfo as singleton
This commit is contained in:
parent
3ca9dab083
commit
184b663903
4 changed files with 10 additions and 13 deletions
|
|
@ -63,7 +63,7 @@ void MobileShellPlugin::registerTypes(const char *uri)
|
||||||
qmlRegisterSingletonType(resolvePath("dataproviders/AudioInfo.qml"), uri, 1, 0, "AudioInfo");
|
qmlRegisterSingletonType(resolvePath("dataproviders/AudioInfo.qml"), uri, 1, 0, "AudioInfo");
|
||||||
qmlRegisterSingletonType(resolvePath("dataproviders/BatteryInfo.qml"), uri, 1, 0, "BatteryInfo");
|
qmlRegisterSingletonType(resolvePath("dataproviders/BatteryInfo.qml"), uri, 1, 0, "BatteryInfo");
|
||||||
qmlRegisterSingletonType(resolvePath("dataproviders/BluetoothInfo.qml"), uri, 1, 0, "BluetoothInfo");
|
qmlRegisterSingletonType(resolvePath("dataproviders/BluetoothInfo.qml"), uri, 1, 0, "BluetoothInfo");
|
||||||
qmlRegisterType(resolvePath("dataproviders/SignalStrengthInfo.qml"), uri, 1, 0, "SignalStrengthInfo");
|
qmlRegisterSingletonType(resolvePath("dataproviders/SignalStrengthInfo.qml"), uri, 1, 0, "SignalStrengthInfo");
|
||||||
|
|
||||||
// /homescreen
|
// /homescreen
|
||||||
qmlRegisterType(resolvePath("homescreen/HomeScreen.qml"), uri, 1, 0, "HomeScreen");
|
qmlRegisterType(resolvePath("homescreen/HomeScreen.qml"), uri, 1, 0, "HomeScreen");
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
pragma Singleton
|
||||||
|
|
||||||
import QtQuick 2.1
|
import QtQuick 2.1
|
||||||
import org.kde.plasma.mm 1.0
|
import org.kde.plasma.mm 1.0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,9 @@ import org.kde.plasma.core as PlasmaCore
|
||||||
import org.kde.plasma.plasma5support 2.0 as P5Support
|
import org.kde.plasma.plasma5support 2.0 as P5Support
|
||||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||||
import org.kde.kitemmodels as KItemModels
|
import org.kde.kitemmodels as KItemModels
|
||||||
|
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||||
|
|
||||||
import "indicators" as Indicators
|
import "indicators" as Indicators
|
||||||
import "../dataproviders" as DataProviders
|
|
||||||
import "../components" as Components
|
import "../components" as Components
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
@ -210,10 +210,8 @@ Item {
|
||||||
Item { Layout.fillWidth: true }
|
Item { Layout.fillWidth: true }
|
||||||
|
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
property var signalStrengthInfo: DataProviders.SignalStrengthInfo {}
|
|
||||||
|
|
||||||
visible: root.showTime
|
visible: root.showTime
|
||||||
text: signalStrengthInfo.label
|
text: MobileShell.SignalStrengthInfo.label
|
||||||
color: Kirigami.Theme.disabledTextColor
|
color: Kirigami.Theme.disabledTextColor
|
||||||
font.pixelSize: root.smallerTextPixelSize
|
font.pixelSize: root.smallerTextPixelSize
|
||||||
horizontalAlignment: Qt.AlignRight
|
horizontalAlignment: Qt.AlignRight
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,11 @@ import QtQuick.Layouts
|
||||||
import org.kde.plasma.core as PlasmaCore
|
import org.kde.plasma.core as PlasmaCore
|
||||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
|
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||||
import "../../dataproviders" as DataProviders
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
property InternetIndicator internetIndicator
|
property InternetIndicator internetIndicator
|
||||||
|
|
||||||
readonly property var provider: DataProviders.SignalStrengthInfo {}
|
|
||||||
|
|
||||||
// check if the internet indicator icon is a mobile data related one
|
// check if the internet indicator icon is a mobile data related one
|
||||||
readonly property bool isInternetIndicatorMobileData: internetIndicator && internetIndicator.icon && internetIndicator.icon.startsWith('network-mobile-')
|
readonly property bool isInternetIndicatorMobileData: internetIndicator && internetIndicator.icon && internetIndicator.icon.startsWith('network-mobile-')
|
||||||
|
|
||||||
|
|
@ -35,10 +32,10 @@ Item {
|
||||||
width: height
|
width: height
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
|
||||||
source: provider.icon
|
source: MobileShell.SignalStrengthInfo.icon
|
||||||
|
|
||||||
// don't show mobile indicator icon if the networkmanager one is already showing
|
// don't show mobile indicator icon if the networkmanager one is already showing
|
||||||
visible: !isInternetIndicatorMobileData && provider.showIndicator
|
visible: !isInternetIndicatorMobileData && MobileShell.SignalStrengthInfo.showIndicator
|
||||||
}
|
}
|
||||||
|
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
|
|
@ -49,7 +46,7 @@ Item {
|
||||||
anchors.left: strengthIcon.right
|
anchors.left: strengthIcon.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
text: provider.label
|
text: MobileShell.SignalStrengthInfo.label
|
||||||
color: Kirigami.Theme.textColor
|
color: Kirigami.Theme.textColor
|
||||||
font.pixelSize: textPixelSize
|
font.pixelSize: textPixelSize
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue