Skip to content

Commit a376d1a

Browse files
committed
New Customization Options!
- You can now change colours of day, date and time individually. - You can now show/hide any line.
1 parent 6a22f05 commit a376d1a

File tree

6 files changed

+131
-36
lines changed

6 files changed

+131
-36
lines changed

package/contents/config/main.xml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
<entry name="day_letter_spacing" type="Int">
1313
<default>17</default>
1414
</entry>
15+
<entry name="show_day" type="Bool">
16+
<default>true</default>
17+
</entry>
1518
<entry name="date_font_size" type="Int">
1619
<default>19</default>
1720
</entry>
@@ -21,13 +24,25 @@
2124
<entry name="date_format" type="String">
2225
<default>dd MMM yyyy</default>
2326
</entry>
27+
<entry name="show_date" type="Bool">
28+
<default>true</default>
29+
</entry>
2430
<entry name="time_font_size" type="Int">
2531
<default>19</default>
2632
</entry>
2733
<entry name="time_letter_spacing" type="Int">
2834
<default>3</default>
2935
</entry>
30-
<entry name="font_color" type="Color">
36+
<entry name="time_font_color" type="Color">
37+
<default>#FFFFFF</default>
38+
</entry>
39+
<entry name="show_time" type="Bool">
40+
<default>true</default>
41+
</entry>
42+
<entry name="date_font_color" type="Color">
43+
<default>#FFFFFF</default>
44+
</entry>
45+
<entry name="day_font_color" type="Color">
3146
<default>#FFFFFF</default>
3247
</entry>
3348
<entry name="use_24_hour_format" type="Bool">

package/contents/ui/ColorDial.qml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import QtQuick 2.0
2+
import QtQuick.Controls 2.0
3+
import QtQuick.Layouts 1.15
4+
import QtQuick.Dialogs 1.0
5+
import org.kde.plasma.core 2.0 as PlasmaCore
6+
7+
RowLayout {
8+
id: root
9+
property var color;
10+
11+
Label {
12+
text: i18n("Font Color")
13+
}
14+
Rectangle {
15+
id: colorbutton
16+
height: PlasmaCore.Units.gridUnit * 1.3; width: height
17+
border.width: 1
18+
color: root.color
19+
border.color: "gray"
20+
MouseArea {
21+
anchors.fill: parent
22+
onClicked: {
23+
colordialog.visible=true
24+
}
25+
}
26+
}
27+
ColorDialog {
28+
id: colordialog
29+
title: i18n("Select a color")
30+
onAccepted: {
31+
root.color=color
32+
}
33+
}
34+
}
35+

package/contents/ui/ColorDialog.qml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
RowLayout {
2+
Label {
3+
text: i18n("Font Color")
4+
}
5+
Rectangle {
6+
id: colorbutton
7+
height: PlasmaCore.Units.gridUnit * 1.3; width: height
8+
border.width: 1
9+
border.color: "gray"
10+
color: cfg_font_color
11+
MouseArea {
12+
anchors.fill: parent
13+
onClicked: {
14+
colordialog.visible=true
15+
}
16+
}
17+
}
18+
}
19+
ColorDialog {
20+
id: colordialog
21+
title: i18n("Select a color")
22+
onAccepted: {
23+
cfg_font_color=color
24+
}
25+
}

package/contents/ui/configAppearance.qml

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,36 @@ Column {
99
id: appearancePage
1010

1111
// properties
12+
property alias cfg_show_day: showDay.checked
13+
property alias cfg_show_date: showDate.checked
14+
property alias cfg_show_time: showTime.checked
1215
property alias cfg_day_font_size: dayFontSize.value
1316
property alias cfg_date_font_size: dateFontSize.value
1417
property alias cfg_time_font_size: timeFontSize.value
1518
property alias cfg_day_letter_spacing: dayLetterSpacing.value
19+
property alias cfg_day_font_color: dayFontColor.color
1620
property alias cfg_date_letter_spacing: dateLetterSpacing.value
1721
property alias cfg_time_letter_spacing: timeLetterSpacing.value
18-
property alias cfg_font_color: colordialog.color
22+
property alias cfg_time_font_color: timeFontColor.color
1923
property alias cfg_use_24_hour_format: use24HourFormat.checked
2024
property alias cfg_time_character: timeCharacter.text
2125
property alias cfg_date_format: dateFormat.text
26+
property alias cfg_date_font_color: dateFontColor.color
2227

2328
// size
2429
spacing: 5
2530

2631
Title {
2732
title: i18n("Day")
2833
}
34+
RowLayout {
35+
Label {
36+
text: i18n("Show Day")
37+
}
38+
CheckBox {
39+
id: showDay
40+
}
41+
}
2942
NumberField {
3043
id: dayFontSize
3144
label: i18n("Font Size")
@@ -34,10 +47,21 @@ Column {
3447
id: dayLetterSpacing
3548
label: i18n("Letter Spacing")
3649
}
37-
50+
ColorDial {
51+
id: dayFontColor
52+
color: cfg_day_font_color
53+
}
3854
Title {
3955
title: i18n("Date")
4056
}
57+
RowLayout {
58+
Label {
59+
text: i18n("Show Date")
60+
}
61+
CheckBox {
62+
id: showDate
63+
}
64+
}
4165
NumberField {
4266
id: dateFontSize
4367
label: i18n("Font Size")
@@ -54,11 +78,23 @@ Column {
5478
id: dateFormat
5579
}
5680
}
81+
ColorDial {
82+
id: dateFontColor
83+
color: cfg_date_font_color
84+
}
5785

5886

5987
Title {
6088
title: i18n("Time")
6189
}
90+
RowLayout {
91+
Label {
92+
text: i18n("Show Time")
93+
}
94+
CheckBox {
95+
id: showTime
96+
}
97+
}
6298
NumberField {
6399
id: timeFontSize
64100
label: i18n("Font Size")
@@ -84,34 +120,9 @@ Column {
84120
maximumLength: 1
85121
}
86122
}
87-
88-
89-
Title {
90-
title: i18n("Font Settings")
91-
}
92-
RowLayout {
93-
Label {
94-
text: i18n("Font Color")
95-
}
96-
Rectangle {
97-
id: colorbutton
98-
height: PlasmaCore.Units.gridUnit * 1.3; width: height
99-
border.width: 1
100-
border.color: "gray"
101-
color: cfg_font_color
102-
MouseArea {
103-
anchors.fill: parent
104-
onClicked: {
105-
colordialog.visible=true
106-
}
107-
}
108-
}
109-
}
110-
ColorDialog {
111-
id: colordialog
112-
title: i18n("Select a color")
113-
onAccepted: {
114-
cfg_font_color=color
115-
}
123+
ColorDial {
124+
id: timeFontColor
125+
color: cfg_time_font_color
116126
}
127+
117128
}

package/contents/ui/main.qml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,15 @@ Item {
7474
// The day ("Tuesday", "Wednesday" etc..)
7575
PlasmaComponents.Label {
7676
id: display_day
77+
78+
// visible
79+
visible: plasmoid.configuration.show_day
7780

7881
// font settings
7982
font.pixelSize: plasmoid.configuration.day_font_size
8083
font.letterSpacing: plasmoid.configuration.day_letter_spacing
8184
font.family: font_anurati.name
82-
color: plasmoid.configuration.font_color
85+
color: plasmoid.configuration.day_font_color
8386
anchors.horizontalCenter: parent.horizontalCenter
8487
horizontalAlignment: Text.AlignHCenter
8588
}
@@ -88,11 +91,14 @@ Item {
8891
PlasmaComponents.Label {
8992
id: display_date
9093

94+
// visibility
95+
visible: plasmoid.configuration.show_date
96+
9197
// font settings
9298
font.pixelSize: plasmoid.configuration.date_font_size
9399
font.letterSpacing: plasmoid.configuration.date_letter_spacing
94100
font.family: font_poppins.name
95-
color: plasmoid.configuration.font_color
101+
color: plasmoid.configuration.date_font_color
96102
horizontalAlignment: Text.AlignHCenter
97103
anchors.horizontalCenter: parent.horizontalCenter
98104
}
@@ -101,10 +107,13 @@ Item {
101107
PlasmaComponents.Label {
102108
id: display_time
103109

110+
// visibility
111+
visible: plasmoid.configuration.show_time
112+
104113
// font settings
105114
font.pixelSize: plasmoid.configuration.time_font_size
106115
font.family: font_poppins.name
107-
color: plasmoid.configuration.font_color
116+
color: plasmoid.configuration.time_font_color
108117
font.letterSpacing: plasmoid.configuration.time_letter_spacing
109118
horizontalAlignment: Text.AlignHCenter
110119
anchors.horizontalCenter: parent.horizontalCenter

package/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"ServiceTypes": [
1616
"Plasma/Applet"
1717
],
18-
"Version": "0.0.1",
18+
"Version": "0.2.0",
1919
"Website": "https://github.com/prayag2/kde_modernclock"
2020

2121
},

0 commit comments

Comments
 (0)