2020-08-31 01:38:46 +00:00
|
|
|
/*
|
2021-07-30 14:19: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
|
|
|
*/
|
|
|
|
|
|
2023-03-18 19:28:17 +00:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Layouts
|
2020-08-31 01:38:46 +00:00
|
|
|
|
|
|
|
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
2021-09-13 17:33:57 +00:00
|
|
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
2023-03-18 19:28:17 +00:00
|
|
|
|
|
|
|
|
import "../../dataproviders" as DataProviders
|
2020-08-31 01:38:46 +00:00
|
|
|
|
|
|
|
|
Item {
|
2023-05-12 23:05:00 +00:00
|
|
|
property InternetIndicator internetIndicator
|
2022-08-14 15:34:46 +00:00
|
|
|
|
2023-03-18 19:28:17 +00:00
|
|
|
readonly property var provider: DataProviders.SignalStrengthInfo {}
|
2022-11-11 16:21:12 +00:00
|
|
|
|
2022-08-14 15:42:11 +00:00
|
|
|
// check if the internet indicator icon is a mobile data related one
|
2022-09-10 16:41:08 +00:00
|
|
|
readonly property bool isInternetIndicatorMobileData: internetIndicator && internetIndicator.icon && internetIndicator.icon.startsWith('network-mobile-')
|
2022-08-14 15:42:11 +00:00
|
|
|
|
2021-12-22 23:29:00 +00:00
|
|
|
property bool showLabel: true
|
|
|
|
|
property real textPixelSize: PlasmaCore.Units.gridUnit * 0.6
|
2021-10-12 13:50:36 +00:00
|
|
|
|
2021-12-22 23:29:00 +00:00
|
|
|
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
|
2021-07-30 14:19:46 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2020-08-31 01:38:46 +00:00
|
|
|
width: height
|
|
|
|
|
height: parent.height
|
2021-07-30 14:19:46 +00:00
|
|
|
|
|
|
|
|
source: provider.icon
|
2022-08-14 15:42:11 +00:00
|
|
|
|
|
|
|
|
// don't show mobile indicator icon if the networkmanager one is already showing
|
2022-10-23 16:12:40 +00:00
|
|
|
visible: !isInternetIndicatorMobileData && provider.showIndicator
|
2020-08-31 01:38:46 +00:00
|
|
|
}
|
2021-12-22 23:29:00 +00:00
|
|
|
|
2020-08-31 01:38:46 +00:00
|
|
|
PlasmaComponents.Label {
|
2021-07-30 14:19:46 +00:00
|
|
|
id: label
|
2021-12-22 23:29:00 +00:00
|
|
|
visible: showLabel
|
|
|
|
|
width: visible ? implicitWidth : 0
|
2021-10-12 13:50:36 +00:00
|
|
|
anchors.leftMargin: PlasmaCore.Units.smallSpacing
|
2021-07-30 14:19:46 +00:00
|
|
|
anchors.left: strengthIcon.right
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
|
|
|
|
|
text: provider.label
|
2020-08-31 01:38:46 +00:00
|
|
|
color: PlasmaCore.ColorScope.textColor
|
2021-12-22 23:29:00 +00:00
|
|
|
font.pixelSize: textPixelSize
|
2020-08-31 01:38:46 +00:00
|
|
|
}
|
|
|
|
|
}
|