Changeset View
Changeset View
Standalone View
Standalone View
applets/digital-clock/package/contents/ui/configTimeZones.qml
Show All 21 Lines | |||||
22 | import QtQuick.Controls 1.2 as QtControls | 22 | import QtQuick.Controls 1.2 as QtControls | ||
23 | import QtQuick.Layouts 1.0 | 23 | import QtQuick.Layouts 1.0 | ||
24 | import QtQuick.Dialogs 1.1 | 24 | import QtQuick.Dialogs 1.1 | ||
25 | 25 | | |||
26 | import org.kde.plasma.private.digitalclock 1.0 | 26 | import org.kde.plasma.private.digitalclock 1.0 | ||
27 | import org.kde.plasma.core 2.0 as PlasmaCore | 27 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
28 | import org.kde.plasma.components 2.0 as PlasmaComponents | 28 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
29 | 29 | | |||
30 | Item { | 30 | ColumnLayout { | ||
31 | id: timeZonesPage | 31 | id: timeZonesPage | ||
32 | width: parent.width | 32 | anchors.left: parent.left | ||
davidedmundson: Do you need these?
Generally it's a sign of a problem or bad layering if the root item has… | |||||
Ops, copy&pPaste from HolidayConfig.qml. I'll remove it, width/height are not needed, I just checked, AppletConfiguration.qml handles that. kmaterka: Ops, copy&pPaste from HolidayConfig.qml. I'll remove it, width/height are not needed, I just… | |||||
33 | height: parent.height | 33 | anchors.right: parent.right | ||
34 | 34 | | |||
35 | property alias cfg_selectedTimeZones: timeZones.selectedTimeZones | 35 | property alias cfg_selectedTimeZones: timeZones.selectedTimeZones | ||
36 | property alias cfg_wheelChangesTimezone: enableWheelCheckBox.checked | 36 | property alias cfg_wheelChangesTimezone: enableWheelCheckBox.checked | ||
37 | 37 | | |||
38 | TimeZoneModel { | 38 | TimeZoneModel { | ||
39 | id: timeZones | 39 | id: timeZones | ||
40 | 40 | | |||
41 | onSelectedTimeZonesChanged: { | 41 | onSelectedTimeZonesChanged: { | ||
42 | if (selectedTimeZones.length === 0) { | 42 | if (selectedTimeZones.length === 0) { | ||
43 | messageWidget.visible = true; | 43 | messageWidget.visible = true; | ||
44 | 44 | | |||
45 | timeZones.selectLocalTimeZone(); | 45 | timeZones.selectLocalTimeZone(); | ||
46 | } | 46 | } | ||
47 | } | 47 | } | ||
48 | } | 48 | } | ||
49 | 49 | | |||
50 | // This is just for getting the column width | 50 | // This is just for getting the column width | ||
51 | QtControls.CheckBox { | 51 | QtControls.CheckBox { | ||
52 | id: checkbox | 52 | id: checkbox | ||
53 | visible: false | 53 | visible: false | ||
54 | } | 54 | } | ||
55 | 55 | | |||
56 | | ||||
57 | ColumnLayout { | | |||
58 | anchors.fill: parent | | |||
59 | | ||||
60 | Rectangle { | 56 | Rectangle { | ||
If we're going to port stuff, we may as well port to: https://api.kde.org/frameworks/kirigami/html/classorg_1_1kde_1_1kirigami_1_1InlineMessage.html the library version of this davidedmundson: If we're going to port stuff, we may as well port to:
https://api.kde. | |||||
kmaterka: Cool! I need there must be something! | |||||
61 | id: messageWidget | 57 | id: messageWidget | ||
62 | 58 | | |||
63 | anchors { | 59 | Layout.fillWidth: true | ||
64 | left: parent.left | 60 | Layout.margins: 1 | ||
ngraham: Don't use hardcoded margins. This should be `Kirigami.Units.smallSpacing` | |||||
I just copied values form the original Rectangle. I will remove it entirely, probably it's not needed anymore. kmaterka: I just copied values form the original Rectangle. I will remove it entirely, probably it's not… | |||||
65 | right: parent.right | | |||
66 | margins: 1 | | |||
67 | } | | |||
68 | 61 | | |||
69 | height: 0 | 62 | implicitHeight: messageWidgetRow.implicitHeight + (2 * units.smallSpacing) | ||
70 | 63 | | |||
71 | //TODO: This is the actual color KMessageWidget uses as its base color but here it gives | 64 | //TODO: This is the actual color KMessageWidget uses as its base color but here it gives | ||
72 | // a different color, figure out why | 65 | // a different color, figure out why | ||
73 | //property color gradBaseColor: Qt.rgba(0.69, 0.5, 0, 1) | 66 | //property color gradBaseColor: Qt.rgba(0.69, 0.5, 0, 1) | ||
74 | gradient: Gradient { | 67 | gradient: Gradient { | ||
75 | GradientStop { position: 0.0; color: "#FFD86D" } //Qt.lighter(messageWidget.gradBaseColor, 1.1) | 68 | GradientStop { position: 0.0; color: "#FFD86D" } //Qt.lighter(messageWidget.gradBaseColor, 1.1) | ||
76 | GradientStop { position: 0.1; color: "#EAC360" } // messageWidget.gradBaseColor | 69 | GradientStop { position: 0.1; color: "#EAC360" } // messageWidget.gradBaseColor | ||
77 | GradientStop { position: 1.0; color: "#CAB064" } //Qt.darker(messageWidget.gradBaseColor, 1.1) | 70 | GradientStop { position: 1.0; color: "#CAB064" } //Qt.darker(messageWidget.gradBaseColor, 1.1) | ||
78 | } | 71 | } | ||
79 | 72 | | |||
80 | radius: 5 | 73 | radius: 5 | ||
81 | border.width: 1 | 74 | border.width: 1 | ||
82 | border.color: "#79735B" | 75 | border.color: "#79735B" | ||
83 | 76 | | |||
84 | visible: false | 77 | visible: false | ||
85 | 78 | opacity: visible ? 1.0 : 0 | |||
86 | Behavior on visible { | 79 | height: visible ? implicitHeight : 0 | ||
87 | ParallelAnimation { | 80 | Behavior on opacity { NumberAnimation { easing.type: Easing.Linear } } | ||
88 | PropertyAnimation { | 81 | Behavior on height { NumberAnimation { easing.type: Easing.Linear } } | ||
89 | target: messageWidget | | |||
90 | property: "opacity" | | |||
91 | to: messageWidget.visible ? 0 : 1.0 | | |||
92 | easing.type: Easing.Linear | | |||
93 | } | | |||
94 | PropertyAnimation { | | |||
95 | target: messageWidget | | |||
96 | property: "Layout.minimumHeight" | | |||
97 | to: messageWidget.visible ? 0 : messageWidgetLabel.height + (2 *units.largeSpacing) | | |||
98 | easing.type: Easing.Linear | | |||
99 | } | | |||
100 | } | | |||
101 | } | | |||
102 | 82 | | |||
103 | RowLayout { | 83 | RowLayout { | ||
104 | anchors.fill: parent | 84 | id: messageWidgetRow | ||
105 | anchors.margins: units.largeSpacing | 85 | | ||
86 | anchors.fill: messageWidget | ||||
106 | anchors.leftMargin: units.smallSpacing | 87 | anchors.leftMargin: units.smallSpacing | ||
107 | anchors.rightMargin: units.smallSpacing | 88 | anchors.rightMargin: units.smallSpacing | ||
108 | spacing: units.smallSpacing | 89 | spacing: units.smallSpacing | ||
109 | 90 | | |||
110 | PlasmaCore.IconItem { | 91 | PlasmaCore.IconItem { | ||
111 | anchors.verticalCenter: parent.verticalCenter | 92 | Layout.alignment: Qt.AlignVCenter | ||
112 | height: units.iconSizes.smallMedium | 93 | height: units.iconSizes.smallMedium | ||
113 | width: height | 94 | width: height | ||
114 | source: "dialog-warning" | 95 | source: "dialog-warning" | ||
96 | opacity: messageWidget.opacity | ||||
davidedmundson: What's this for? Opacity should be inherited by children
| |||||
kmaterka: I will use Kirigami component. | |||||
115 | } | 97 | } | ||
116 | 98 | | |||
117 | QtControls.Label { | 99 | QtControls.Label { | ||
118 | id: messageWidgetLabel | 100 | Layout.alignment: Qt.AlignVCenter | ||
119 | anchors.verticalCenter: parent.verticalCenter | | |||
120 | Layout.fillWidth: true | 101 | Layout.fillWidth: true | ||
102 | Layout.topMargin: units.smallSpacing | ||||
103 | Layout.bottomMargin: units.smallSpacing | ||||
121 | text: i18n("At least one time zone needs to be enabled. 'Local' was enabled automatically.") | 104 | text: i18n("At least one time zone needs to be enabled. 'Local' was enabled automatically.") | ||
122 | verticalAlignment: Text.AlignVCenter | 105 | verticalAlignment: Text.AlignVCenter | ||
123 | wrapMode: Text.WordWrap | 106 | wrapMode: Text.WordWrap | ||
107 | opacity: messageWidget.opacity | ||||
124 | } | 108 | } | ||
125 | 109 | | |||
126 | PlasmaComponents.ToolButton { | 110 | PlasmaComponents.ToolButton { | ||
127 | anchors.verticalCenter: parent.verticalCenter | 111 | Layout.alignment: Qt.AlignVCenter | ||
128 | iconName: "dialog-close" | 112 | iconName: "dialog-close" | ||
129 | flat: true | 113 | flat: true | ||
114 | opacity: messageWidget.opacity | ||||
130 | 115 | | |||
131 | onClicked: { | 116 | onClicked: { | ||
132 | messageWidget.visible = false; | 117 | messageWidget.visible = false; | ||
133 | } | 118 | } | ||
134 | } | 119 | } | ||
135 | } | 120 | } | ||
136 | } | 121 | } | ||
137 | 122 | | |||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | |||||
199 | 184 | | |||
200 | RowLayout { | 185 | RowLayout { | ||
201 | Layout.fillWidth: true | 186 | Layout.fillWidth: true | ||
202 | QtControls.CheckBox { | 187 | QtControls.CheckBox { | ||
203 | id: enableWheelCheckBox | 188 | id: enableWheelCheckBox | ||
204 | text: i18n("Switch time zone with mouse wheel") | 189 | text: i18n("Switch time zone with mouse wheel") | ||
205 | } | 190 | } | ||
206 | } | 191 | } | ||
207 | | ||||
208 | } | | |||
209 | } | 192 | } |
Do you need these?
Generally it's a sign of a problem or bad layering if the root item has anchors in it.