Skip to content

Commit

Permalink
New Customization Options!
Browse files Browse the repository at this point in the history
- You can now change colours of day, date and time individually.
- You can now show/hide any line.
  • Loading branch information
Prayag2 committed May 19, 2022
1 parent 6a22f05 commit a376d1a
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 36 deletions.
17 changes: 16 additions & 1 deletion package/contents/config/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
<entry name="day_letter_spacing" type="Int">
<default>17</default>
</entry>
<entry name="show_day" type="Bool">
<default>true</default>
</entry>
<entry name="date_font_size" type="Int">
<default>19</default>
</entry>
Expand All @@ -21,13 +24,25 @@
<entry name="date_format" type="String">
<default>dd MMM yyyy</default>
</entry>
<entry name="show_date" type="Bool">
<default>true</default>
</entry>
<entry name="time_font_size" type="Int">
<default>19</default>
</entry>
<entry name="time_letter_spacing" type="Int">
<default>3</default>
</entry>
<entry name="font_color" type="Color">
<entry name="time_font_color" type="Color">
<default>#FFFFFF</default>
</entry>
<entry name="show_time" type="Bool">
<default>true</default>
</entry>
<entry name="date_font_color" type="Color">
<default>#FFFFFF</default>
</entry>
<entry name="day_font_color" type="Color">
<default>#FFFFFF</default>
</entry>
<entry name="use_24_hour_format" type="Bool">
Expand Down
35 changes: 35 additions & 0 deletions package/contents/ui/ColorDial.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import QtQuick 2.0
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.15
import QtQuick.Dialogs 1.0
import org.kde.plasma.core 2.0 as PlasmaCore

RowLayout {
id: root
property var color;

Label {
text: i18n("Font Color")
}
Rectangle {
id: colorbutton
height: PlasmaCore.Units.gridUnit * 1.3; width: height
border.width: 1
color: root.color
border.color: "gray"
MouseArea {
anchors.fill: parent
onClicked: {
colordialog.visible=true
}
}
}
ColorDialog {
id: colordialog
title: i18n("Select a color")
onAccepted: {
root.color=color
}
}
}

25 changes: 25 additions & 0 deletions package/contents/ui/ColorDialog.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
RowLayout {
Label {
text: i18n("Font Color")
}
Rectangle {
id: colorbutton
height: PlasmaCore.Units.gridUnit * 1.3; width: height
border.width: 1
border.color: "gray"
color: cfg_font_color
MouseArea {
anchors.fill: parent
onClicked: {
colordialog.visible=true
}
}
}
}
ColorDialog {
id: colordialog
title: i18n("Select a color")
onAccepted: {
cfg_font_color=color
}
}
73 changes: 42 additions & 31 deletions package/contents/ui/configAppearance.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,36 @@ Column {
id: appearancePage

// properties
property alias cfg_show_day: showDay.checked
property alias cfg_show_date: showDate.checked
property alias cfg_show_time: showTime.checked
property alias cfg_day_font_size: dayFontSize.value
property alias cfg_date_font_size: dateFontSize.value
property alias cfg_time_font_size: timeFontSize.value
property alias cfg_day_letter_spacing: dayLetterSpacing.value
property alias cfg_day_font_color: dayFontColor.color
property alias cfg_date_letter_spacing: dateLetterSpacing.value
property alias cfg_time_letter_spacing: timeLetterSpacing.value
property alias cfg_font_color: colordialog.color
property alias cfg_time_font_color: timeFontColor.color
property alias cfg_use_24_hour_format: use24HourFormat.checked
property alias cfg_time_character: timeCharacter.text
property alias cfg_date_format: dateFormat.text
property alias cfg_date_font_color: dateFontColor.color

// size
spacing: 5

Title {
title: i18n("Day")
}
RowLayout {
Label {
text: i18n("Show Day")
}
CheckBox {
id: showDay
}
}
NumberField {
id: dayFontSize
label: i18n("Font Size")
Expand All @@ -34,10 +47,21 @@ Column {
id: dayLetterSpacing
label: i18n("Letter Spacing")
}

ColorDial {
id: dayFontColor
color: cfg_day_font_color
}
Title {
title: i18n("Date")
}
RowLayout {
Label {
text: i18n("Show Date")
}
CheckBox {
id: showDate
}
}
NumberField {
id: dateFontSize
label: i18n("Font Size")
Expand All @@ -54,11 +78,23 @@ Column {
id: dateFormat
}
}
ColorDial {
id: dateFontColor
color: cfg_date_font_color
}


Title {
title: i18n("Time")
}
RowLayout {
Label {
text: i18n("Show Time")
}
CheckBox {
id: showTime
}
}
NumberField {
id: timeFontSize
label: i18n("Font Size")
Expand All @@ -84,34 +120,9 @@ Column {
maximumLength: 1
}
}


Title {
title: i18n("Font Settings")
}
RowLayout {
Label {
text: i18n("Font Color")
}
Rectangle {
id: colorbutton
height: PlasmaCore.Units.gridUnit * 1.3; width: height
border.width: 1
border.color: "gray"
color: cfg_font_color
MouseArea {
anchors.fill: parent
onClicked: {
colordialog.visible=true
}
}
}
}
ColorDialog {
id: colordialog
title: i18n("Select a color")
onAccepted: {
cfg_font_color=color
}
ColorDial {
id: timeFontColor
color: cfg_time_font_color
}

}
15 changes: 12 additions & 3 deletions package/contents/ui/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,15 @@ Item {
// The day ("Tuesday", "Wednesday" etc..)
PlasmaComponents.Label {
id: display_day

// visible
visible: plasmoid.configuration.show_day

// font settings
font.pixelSize: plasmoid.configuration.day_font_size
font.letterSpacing: plasmoid.configuration.day_letter_spacing
font.family: font_anurati.name
color: plasmoid.configuration.font_color
color: plasmoid.configuration.day_font_color
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
}
Expand All @@ -88,11 +91,14 @@ Item {
PlasmaComponents.Label {
id: display_date

// visibility
visible: plasmoid.configuration.show_date

// font settings
font.pixelSize: plasmoid.configuration.date_font_size
font.letterSpacing: plasmoid.configuration.date_letter_spacing
font.family: font_poppins.name
color: plasmoid.configuration.font_color
color: plasmoid.configuration.date_font_color
horizontalAlignment: Text.AlignHCenter
anchors.horizontalCenter: parent.horizontalCenter
}
Expand All @@ -101,10 +107,13 @@ Item {
PlasmaComponents.Label {
id: display_time

// visibility
visible: plasmoid.configuration.show_time

// font settings
font.pixelSize: plasmoid.configuration.time_font_size
font.family: font_poppins.name
color: plasmoid.configuration.font_color
color: plasmoid.configuration.time_font_color
font.letterSpacing: plasmoid.configuration.time_letter_spacing
horizontalAlignment: Text.AlignHCenter
anchors.horizontalCenter: parent.horizontalCenter
Expand Down
2 changes: 1 addition & 1 deletion package/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"ServiceTypes": [
"Plasma/Applet"
],
"Version": "0.0.1",
"Version": "0.2.0",
"Website": "https://github.com/prayag2/kde_modernclock"

},
Expand Down

0 comments on commit a376d1a

Please sign in to comment.