shift-shell/components/mobileshell/qml/statusbar/indicators/SignalStrengthIndicator.qml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

57 lines
1.8 KiB
QML
Raw Normal View History

2020-08-31 01:38:46 +00:00
/*
* SPDX-FileCopyrightText: 2021 Devin Lin <espidev@gmail.com>
2021-03-01 20:03:25 +00:00
* SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
2020-08-31 01:38:46 +00:00
*
2021-03-01 20:03:25 +00:00
* SPDX-License-Identifier: GPL-2.0-or-later
2020-08-31 01:38:46 +00:00
*/
import QtQuick
import QtQuick.Layouts
2020-08-31 01:38:46 +00:00
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents
import "../../dataproviders" as DataProviders
2020-08-31 01:38:46 +00:00
Item {
property InternetIndicator internetIndicator
readonly property var provider: DataProviders.SignalStrengthInfo {}
// check if the internet indicator icon is a mobile data related one
readonly property bool isInternetIndicatorMobileData: internetIndicator && internetIndicator.icon && internetIndicator.icon.startsWith('network-mobile-')
property bool showLabel: true
property real textPixelSize: PlasmaCore.Units.gridUnit * 0.6
width: strengthIcon.width + label.width
Layout.minimumWidth: strengthIcon.width + label.width
2020-08-31 01:38:46 +00:00
PlasmaCore.IconItem {
id: strengthIcon
colorGroup: PlasmaCore.ColorScope.colorGroup
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
2020-08-31 01:38:46 +00:00
width: height
height: parent.height
source: provider.icon
// don't show mobile indicator icon if the networkmanager one is already showing
visible: !isInternetIndicatorMobileData && provider.showIndicator
2020-08-31 01:38:46 +00:00
}
2020-08-31 01:38:46 +00:00
PlasmaComponents.Label {
id: label
visible: showLabel
width: visible ? implicitWidth : 0
anchors.leftMargin: PlasmaCore.Units.smallSpacing
anchors.left: strengthIcon.right
anchors.verticalCenter: parent.verticalCenter
text: provider.label
2020-08-31 01:38:46 +00:00
color: PlasmaCore.ColorScope.textColor
font.pixelSize: textPixelSize
2020-08-31 01:38:46 +00:00
}
}