-
Notifications
You must be signed in to change notification settings - Fork 15
/
CompactRepresentation.qml
71 lines (55 loc) · 2.23 KB
/
CompactRepresentation.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* SPDX-FileCopyrightText: 2018 Friedrich W. H. Kossebau <[email protected]>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick
import QtQuick.Layouts
import org.kde.plasma.plasmoid
import org.kde.plasma.core as PlasmaCore
import "../code/utils.js" as Utils
ColumnLayout {
id: compactRoot
readonly property bool vertical: (plasmoid.formFactor == PlasmaCore.Types.Vertical)
function printDebug(msg) {
if (plasmoid.configuration.logConsole) {
console.log("[debug] [CompactRep.qml] " + msg);
}
}
IconAndTextItem {
vertical: compactRoot.vertical
iconSource: Utils.getConditionIcon(iconCode)
text: appState == showDATA ? Utils.currentTempUnit(Utils.toUserTemp(weatherData["details"]["temp"])) : "--- °X"
Layout.fillWidth: compactRoot.vertical
Layout.fillHeight: !compactRoot.vertical
MouseArea {
id: compactMouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: root.expanded = !root.expanded
}
}
// Component {
// id: iconComponent
// PlasmaCore.SvgItem {
// readonly property int minIconSize: Math.max((compactRoot.vertical ? compactRoot.width : compactRoot.height), Kirigami.Units.iconSizes.small)
// svg: PlasmaCore.Svg {
// id: svg
// imagePath: plasmoid.file("", "icons/" + iconCode + ".svg")
// }
// // reset implicit size, so layout in free dimension does not stop at the default one
// implicitWidth: Kirigami.Units.iconSizes.small
// implicitHeight: Kirigami.Units.iconSizes.small
// Layout.minimumWidth: compactRoot.vertical ? Kirigami.Units.iconSizes.small : minIconSize
// Layout.minimumHeight: compactRoot.vertical ? minIconSize : Kirigami.Units.iconSizes.small
// }
// }
// Component {
// id: iconAndTextComponent
// IconAndTextItem {
// vertical: compactRoot.vertical
// iconSource: plasmoid.file("", "icons/" + iconCode + ".svg")
// text: appState == showDATA ? Utils.currentTempUnit(weatherData["details"]["temp"]) : "---.-° X"
// }
// }
}