Warning, /plasma/kdeplasma-addons/applets/weather/package/contents/ui/config/ConfigAppearance.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * SPDX-FileCopyrightText: 2018 Friedrich W. H. Kossebau <kossebau@kde.org>
0003 * SPDX-FileCopyrightText: 2022 Ismael Asensio <isma.af@gmail.com>
0004 *
0005 * SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007
0008 import QtQuick
0009 import QtQuick.Controls as QQC2
0010
0011 import org.kde.kirigami as Kirigami
0012 import org.kde.plasma.plasmoid
0013 import org.kde.plasma.private.weather
0014 import org.kde.kcmutils as KCM
0015
0016 KCM.SimpleKCM {
0017 readonly property bool canShowMoreInCompactMode: !Plasmoid.needsToBeSquare
0018
0019 property bool cfg_showTemperatureInCompactMode
0020 property bool cfg_showTemperatureInBadge
0021
0022 property alias cfg_showTemperatureInTooltip: showTemperatureInTooltipCheckBox.checked
0023 property alias cfg_showWindInTooltip: showWindInTooltipCheckBox.checked
0024 property alias cfg_showPressureInTooltip: showPressureInTooltipCheckBox.checked
0025 property alias cfg_showHumidityInTooltip: showHumidityInTooltipCheckBox.checked
0026
0027 function setShowTemperature(inCompactMode, inBadge) {
0028 cfg_showTemperatureInCompactMode = inCompactMode
0029 cfg_showTemperatureInBadge = inBadge
0030 }
0031
0032 Kirigami.FormLayout {
0033 Item {
0034 Kirigami.FormData.isSection: true
0035 Kirigami.FormData.label: i18nc("@title:group", "Compact Mode")
0036
0037 // TODO: conditionalize this once there are also settings for non-compact mode
0038 visible: false
0039 }
0040
0041 QQC2.RadioButton {
0042 id: radioTempInBadge
0043 Kirigami.FormData.label: i18nc("@label", "Show temperature:")
0044 checked: cfg_showTemperatureInCompactMode && (cfg_showTemperatureInBadge || !canShowMoreInCompactMode)
0045 onToggled: setShowTemperature(true, true)
0046 text: i18nc("@option:radio Show temperature:", "Over the widget icon")
0047 }
0048
0049 QQC2.RadioButton {
0050 id: radioTempBesideIcon
0051 visible: canShowMoreInCompactMode
0052 checked: cfg_showTemperatureInCompactMode && !cfg_showTemperatureInBadge && canShowMoreInCompactMode
0053 onToggled: setShowTemperature(true, false)
0054 text: i18nc("@option:radio Show temperature:", "Beside the widget icon")
0055 }
0056
0057 QQC2.RadioButton {
0058 id: radioTempHide
0059 checked: !cfg_showTemperatureInCompactMode
0060 onToggled: setShowTemperature(false, false)
0061 text: i18nc("@option:radio Show temperature:", "Do not show")
0062 }
0063
0064 Item {
0065 Kirigami.FormData.isSection: true
0066 }
0067
0068 QQC2.CheckBox {
0069 id: showTemperatureInTooltipCheckBox
0070 Kirigami.FormData.label: i18nc("@label", "Show in tooltip:")
0071 text: i18nc("@option:check", "Temperature")
0072 }
0073
0074 QQC2.CheckBox {
0075 id: showWindInTooltipCheckBox
0076 text: i18nc("@option:check Show in tooltip: wind", "Wind")
0077 }
0078
0079 QQC2.CheckBox {
0080 id: showPressureInTooltipCheckBox
0081 text: i18nc("@option:check Show in tooltip: pressure", "Pressure")
0082 }
0083
0084 QQC2.CheckBox {
0085 id: showHumidityInTooltipCheckBox
0086 text: i18nc("@option:check Show in tooltip: humidity", "Humidity")
0087 }
0088 }
0089 }