add option to customize font size

This commit is contained in:
hat3ph
2024-04-17 08:11:52 +08:00
committed by GitHub
parent c8d2a8f50d
commit ac6b191237
4 changed files with 48 additions and 42 deletions

View File

@@ -221,7 +221,7 @@ Rectangle {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
color: clock.color color: clock.color
text : Qt.formatTime(clock.dateTime, config.timeFormat || "hh:mm") text : Qt.formatTime(clock.dateTime, config.timeFormat || "hh:mm")
font.pointSize: 72 font.pointSize: config.clockFontSize
font.family: textFont.name font.family: textFont.name
} }
@@ -231,7 +231,7 @@ Rectangle {
color: clock.color color: clock.color
text : Qt.formatDate(clock.dateTime, Qt.DefaultLocaleLongDate) text : Qt.formatDate(clock.dateTime, Qt.DefaultLocaleLongDate)
font.family: textFont.name font.family: textFont.name
font.pointSize: 24 font.pointSize: config.dateFontSize
} }
} }
@@ -262,7 +262,7 @@ Rectangle {
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
font.family: textFont.name font.family: textFont.name
font.bold: true font.bold: true
font.pixelSize: 16 font.pixelSize: config.labelFontSize
color: "white" color: "white"
text: "Username" text: "Username"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -312,7 +312,7 @@ Rectangle {
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
font.family: textFont.name font.family: textFont.name
font.bold: true font.bold: true
font.pixelSize: 16 font.pixelSize: config.labelFontSize
color: "white" color: "white"
} }
@@ -401,7 +401,7 @@ Rectangle {
id: error_message id: error_message
height: parent.height height: parent.height
font.family: textFont.name font.family: textFont.name
font.pixelSize: 12 font.pixelSize: config.errorMsgFontSize
color: "white" color: "white"
anchors.top: password_input_box.bottom anchors.top: password_input_box.bottom
anchors.left: password_input_box.left anchors.left: password_input_box.left
@@ -483,7 +483,7 @@ Rectangle {
text: modelItem ? modelItem.modelData.shortName : "zz" text: modelItem ? modelItem.modelData.shortName : "zz"
font.family: textFont.name font.family: textFont.name
font.pixelSize: 14 font.pixelSize: config.languageBoxFontSize
color: "#505050" color: "#505050"
} }
} }
@@ -533,30 +533,30 @@ Rectangle {
// load and randomize playlist // load and randomize playlist
var time = parseInt(new Date().toLocaleTimeString(Qt.locale(),'h')) var time = parseInt(new Date().toLocaleTimeString(Qt.locale(),'h'))
if ( time >= config.day_time_start && time <= config.day_time_end ) { if ( time >= config.dayTimeStart && time <= config.dayTimeEnd ) {
playlist1.load(Qt.resolvedUrl(config.background_vid_day), 'm3u') playlist1.load(Qt.resolvedUrl(config.bgVidDay), 'm3u')
playlist2.load(Qt.resolvedUrl(config.background_vid_day), 'm3u') playlist2.load(Qt.resolvedUrl(config.bgVidDay), 'm3u')
//image1.source = config.background_img_day //image1.source = config.bgImgDay
if ( config.backgroud_img_day !== null ) { if ( config.bgImgDay !== null ) {
//image1.source = config.background_img_day //image1.source = config.bgImgDay
var fileType = config.background_img_day.substring(config.background_img_day.lastIndexOf(".") + 1) var fileType = config.bgImgDay.substring(config.bgImgDay.lastIndexOf(".") + 1)
console.log(fileType) //console.log(fileType)
if (fileType === "gif") { if (fileType === "gif") {
animatedGIF1.source = config.background_img_day animatedGIF1.source = config.bgImgDay
} else { } else {
image1.source = config.background_img_day image1.source = config.bgImgDay
} }
} }
} else { } else {
playlist1.load(Qt.resolvedUrl(config.background_vid_night), 'm3u') playlist1.load(Qt.resolvedUrl(config.bgVidNight), 'm3u')
playlist2.load(Qt.resolvedUrl(config.background_vid_night), 'm3u') playlist2.load(Qt.resolvedUrl(config.bgVidNight), 'm3u')
if ( config.backgroud_img_night !== null ) { if ( config.bgImgNight !== null ) {
var fileType = config.background_img_night.substring(config.background_img_night.lastIndexOf(".") + 1) var fileType = config.bgImgNight.substring(config.bgImgNight.lastIndexOf(".") + 1)
console.log(fileType) //console.log(fileType)
if (fileType === "gif") { if (fileType === "gif") {
animatedGIF1.source = config.background_img_night animatedGIF1.source = config.bgImgNight
} else { } else {
image1.source = config.background_img_night image1.source = config.bgImgNight
} }
} }
} }
@@ -573,5 +573,4 @@ Rectangle {
} }
clear_passwd_button.visible = false clear_passwd_button.visible = false
} }
} }

View File

@@ -57,10 +57,12 @@ done < playlist_file
### Changing settings in `theme.conf.user` ### Changing settings in `theme.conf.user`
You can change a few settings in this file You can change a few settings in this file
- `day_time_start` and `day_time_end` - set your day start/end time - `dayTimeStart` and `dayTimeEnd` - set your day start/end time
- `background_img_day` and `background_img_night` - default background day/night image, now support GIF animated image - `bgImgDay` and `bgImgNight` - default background day/night image, now support GIF animated image
- `background_vid_day` and `background_vid_night` - video playlists - `bgVidDay` and `bgImgNight` - video day/night playlists
- `displayFont` - font - `displayFont` - font
- `clockFontSize`, `dateFontSize`, `labelFontSize`, `errorMsgFontSize` and `languageBoxFontSize` - customize font size
- `timeFormat` - customize time format
- `showLoginButton` - if set to false will hide the login button - `showLoginButton` - if set to false will hide the login button
- `showClearPasswordButton` - if set to false will hide the clear password button that appears when text is inputed - `showClearPasswordButton` - if set to false will hide the clear password button that appears when text is inputed
- `passwordLeftMargin` and `usernameLeftMargin` - set margin between input boxes and labels, some fonts are messy and allows fixing of overlap - `passwordLeftMargin` and `usernameLeftMargin` - set margin between input boxes and labels, some fonts are messy and allows fixing of overlap
@@ -71,8 +73,8 @@ Example config (not the same as the screenshots):
``` ```
[General] [General]
background_vid_day=playlist_day.m3u bgVidDay=playlist_day.m3u
background_vid_night=playlist_night.m3u bgVidNight=playlist_night.m3u
displayFont="Misc Fixed" displayFont="Misc Fixed"
showLoginButton=false showLoginButton=false
passwordLeftMargin=15 passwordLeftMargin=15

View File

@@ -1,11 +1,16 @@
[General] [General]
day_time_start=7 dayTimeStart=7
day_time_start=19 dayTimeEnd=19
background_img_day=background.jpg bgImgDay=background.jpg
background_img_night=background.jpg bgImgNight=background.jpg
background_vid_day=playlists/day.m3u bgVidDay=playlists/day.m3u
background_vid_night=playlists/night.m3u bgVidNight=playlists/night.m3u
displayFont="Droid Sans Mono for Powerline" displayFont="Droid Sans Mono for Powerline"
clockFontSize="72"
dateFontSize="24"
labelFontSize="16"
errorMsgFontSize="12"
languageBoxFontSize="14"
timeFormat="hh:mm" timeFormat="hh:mm"
showLoginButton=true showLoginButton=true
passwordLeftMargin=15 passwordLeftMargin=15
@@ -13,4 +18,4 @@ usernameLeftMargin=15
relativePositionX=0.3 relativePositionX=0.3
relativePositionY=0.7 relativePositionY=0.7
showTopBar=true showTopBar=true
autofocusInput=true autofocusInput=true

View File

@@ -1,8 +1,8 @@
[General] [General]
day_time_start=7 dayTimeStart=7
day_time_start=19 dayTimeEnd=19
background_vid_day=playlists/day.m3u bgVidDay=playlists/day.m3u
background_vid_night=playlists/night.m3u bgVidNight=playlists/night.m3u
displayFont="Misc Fixed" displayFont="Misc Fixed"
passwordLeftMargin=15 passwordLeftMargin=15
relativePositionX=0.5 relativePositionX=0.5
@@ -11,4 +11,4 @@ showLoginButton=false
type=color type=color
usernameLeftMargin=15 usernameLeftMargin=15
showTopBar=true showTopBar=true
autofocusInput=true autofocusInput=true