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

View File

@@ -57,10 +57,12 @@ done < playlist_file
### Changing settings in `theme.conf.user`
You can change a few settings in this file
- `day_time_start` and `day_time_end` - set your day start/end time
- `background_img_day` and `background_img_night` - default background day/night image, now support GIF animated image
- `background_vid_day` and `background_vid_night` - video playlists
- `dayTimeStart` and `dayTimeEnd` - set your day start/end time
- `bgImgDay` and `bgImgNight` - default background day/night image, now support GIF animated image
- `bgVidDay` and `bgImgNight` - video day/night playlists
- `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
- `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
@@ -71,8 +73,8 @@ Example config (not the same as the screenshots):
```
[General]
background_vid_day=playlist_day.m3u
background_vid_night=playlist_night.m3u
bgVidDay=playlist_day.m3u
bgVidNight=playlist_night.m3u
displayFont="Misc Fixed"
showLoginButton=false
passwordLeftMargin=15

View File

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

View File

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