mirror of
https://github.com/developersu/ClearClock.git
synced 2025-05-14 19:20:26 +03:00
Fix font config related issues and make everything use the new custom FontConfig type
This commit is contained in:
parent
71bb86e98f
commit
7c01e4ca57
2 changed files with 93 additions and 166 deletions
|
@ -20,26 +20,26 @@ Item {
|
||||||
signal configurationChanged
|
signal configurationChanged
|
||||||
|
|
||||||
property alias cfg_clockUse24hFormat: use24hFormat.checkState
|
property alias cfg_clockUse24hFormat: use24hFormat.checkState
|
||||||
property string cfg_clockFontColor: clockFontColorButton.value
|
property string cfg_clockFontColor
|
||||||
property string cfg_clockFontFamily
|
property string cfg_clockFontFamily
|
||||||
property alias cfg_clockBoldText: clockBoldCheckBox.checked
|
property bool cfg_clockBoldText
|
||||||
property alias cfg_clockItalicText: clockItalicCheckBox.checked
|
property bool cfg_clockItalicText
|
||||||
property alias cfg_clockFontSize: clockFontSizeSpinBox.value
|
property int cfg_clockFontSize
|
||||||
|
|
||||||
property alias cfg_showDayDisplay: showDayDisplayCheckBox.checked
|
property alias cfg_showDayDisplay: showDayDisplayCheckBox.checked
|
||||||
property string cfg_dayFontColor: dayFontColorRect.color
|
property string cfg_dayFontColor
|
||||||
property string cfg_dayFontFamily
|
property string cfg_dayFontFamily
|
||||||
property alias cfg_dayBoldText: dayBoldCheckBox.checked
|
property bool cfg_dayBoldText
|
||||||
property alias cfg_dayItalicText: dayItalicCheckBox.checked
|
property bool cfg_dayItalicText
|
||||||
property alias cfg_dayFontSize: dayFontSizeSpinBox.value
|
property int cfg_dayFontSize
|
||||||
|
|
||||||
property alias cfg_showDateDisplay: showDateDisplayCheckBox.checked
|
property alias cfg_showDateDisplay: showDateDisplayCheckBox.checked
|
||||||
property alias cfg_dateCustomDateFormat: customDateFormat.text
|
property alias cfg_dateCustomDateFormat: customDateFormat.text
|
||||||
property string cfg_dateFontColor: dateFontColorRect.color
|
property string cfg_dateFontColor
|
||||||
property string cfg_dateFontFamily
|
property string cfg_dateFontFamily
|
||||||
property alias cfg_dateBoldText: dateBoldCheckBox.checked
|
property bool cfg_dateBoldText
|
||||||
property alias cfg_dateItalicText: dateItalicCheckBox.checked
|
property bool cfg_dateItalicText
|
||||||
property alias cfg_dateFontSize: dateFontSizeSpinBox.value
|
property int cfg_dateFontSize
|
||||||
|
|
||||||
|
|
||||||
function fixFontFamilyChange(id, comboBox) {
|
function fixFontFamilyChange(id, comboBox) {
|
||||||
|
@ -108,70 +108,32 @@ Item {
|
||||||
checked: cfg_clockUse24hFormat
|
checked: cfg_clockUse24hFormat
|
||||||
}
|
}
|
||||||
|
|
||||||
QtLayouts.RowLayout {
|
FontConfig {
|
||||||
|
fontModel: fontsModel
|
||||||
|
|
||||||
QtControls.Label {
|
colorValue: cfg_clockFontColor
|
||||||
text: i18n("Font style:")
|
onColorValueChanged: {
|
||||||
|
cfg_clockFontColor = colorValue
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorButton {
|
fontValue: cgf_clockFontFamily
|
||||||
id: clockFontColorButton
|
onFontValueChanged: {
|
||||||
value: cfg_clockFontColor
|
cfg_clockFontFamily = fontValue
|
||||||
|
|
||||||
onValueChanged: {
|
|
||||||
cfg_clockFontColor = value
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.ComboBox {
|
boldValue: cfg_clockBoldText
|
||||||
id: clockFontFamilyComboBox
|
onBoldValueChanged: {
|
||||||
QtLayouts.Layout.fillWidth: true
|
cfg_clockBoldText = boldValue
|
||||||
QtLayouts.Layout.minimumWidth: units.gridUnit * 10
|
|
||||||
model: fontsModel
|
|
||||||
textRole: "text"
|
|
||||||
|
|
||||||
function loadComboBoxValue() {
|
|
||||||
if (cgf_clockFontFamily === "ccdefault") {
|
|
||||||
return 0
|
|
||||||
} else {
|
|
||||||
for (i = 0; i < fontsModel.count; i++) {
|
|
||||||
if (cgf_clockFontFamily === fontsModel.get(i).value) {
|
|
||||||
return i + 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
currentIndex: loadComboBoxValue()
|
|
||||||
|
|
||||||
onCurrentIndexChanged: {
|
|
||||||
var current = model.get(currentIndex)
|
|
||||||
if (current) {
|
|
||||||
cfg_clockFontFamily = current.value
|
|
||||||
appearancePage.configurationChanged()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Button {
|
italicValue: cfg_clockItalicText
|
||||||
id: clockBoldCheckBox
|
onItalicValueChanged: {
|
||||||
icon.name: "format-text-bold"
|
cfg_clockItalicText = italicValue
|
||||||
checkable: true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Button {
|
pxSizeValue: cfg_clockFontSize
|
||||||
id: clockItalicCheckBox
|
onPxSizeValueChanged: {
|
||||||
icon.name: "format-text-italic"
|
cfg_clockFontSize = pxSizeValue
|
||||||
checkable: true
|
|
||||||
}
|
|
||||||
|
|
||||||
QtControls.SpinBox {
|
|
||||||
id: clockFontSizeSpinBox
|
|
||||||
textFromValue: function(value, locale) {
|
|
||||||
return qsTr("%1px").arg(value);
|
|
||||||
}
|
|
||||||
from: 10
|
|
||||||
to: 350
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,60 +153,33 @@ Item {
|
||||||
text: i18n("Show day display")
|
text: i18n("Show day display")
|
||||||
}
|
}
|
||||||
|
|
||||||
QtLayouts.RowLayout {
|
FontConfig {
|
||||||
QtLayouts.Layout.fillWidth: true
|
fontModel: fontsModel
|
||||||
enabled: showDayDisplayCheckBox.checked
|
enabled: showDayDisplayCheckBox.checked
|
||||||
|
|
||||||
QtControls.Label {
|
colorValue: cfg_dayFontColor
|
||||||
text: i18n("Font style:")
|
onColorValueChanged: {
|
||||||
opacity: if (enabled) 1
|
cfg_dayFontColor = colorValue
|
||||||
else 0.4
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorButton {
|
fontValue: cgf_dayFontFamily
|
||||||
id: dayFontColorButton
|
onFontValueChanged: {
|
||||||
value: cfg_dayFontColor
|
cfg_dayFontFamily = fontValue
|
||||||
|
|
||||||
onValueChanged: {
|
|
||||||
cfg_dayFontColor = value
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.ComboBox {
|
boldValue: cfg_dayBoldText
|
||||||
id: dayFontFamilyComboBox
|
onBoldValueChanged: {
|
||||||
QtLayouts.Layout.fillWidth: true
|
cfg_dayBoldText = boldValue
|
||||||
QtLayouts.Layout.minimumWidth: units.gridUnit * 10
|
|
||||||
model: fontsModel
|
|
||||||
textRole: "text"
|
|
||||||
|
|
||||||
onCurrentIndexChanged: {
|
|
||||||
var current = model.get(currentIndex)
|
|
||||||
if (current) {
|
|
||||||
cfg_dayFontFamily = current.value
|
|
||||||
appearancePage.configurationChanged()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Button {
|
italicValue: cfg_dayItalicText
|
||||||
id: dayBoldCheckBox
|
onItalicValueChanged: {
|
||||||
icon.name: "format-text-bold"
|
cfg_dayItalicText = italicValue
|
||||||
checkable: true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Button {
|
pxSizeValue: cfg_dayFontSize
|
||||||
id: dayItalicCheckBox
|
onPxSizeValueChanged: {
|
||||||
icon.name: "format-text-italic"
|
cfg_dayFontSize = pxSizeValue
|
||||||
checkable: true
|
|
||||||
}
|
|
||||||
|
|
||||||
QtControls.SpinBox {
|
|
||||||
id: dayFontSizeSpinBox
|
|
||||||
textFromValue: function(value, locale) {
|
|
||||||
return qsTr("%1px").arg(value);
|
|
||||||
}
|
|
||||||
from: 10
|
|
||||||
to: 350
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -269,6 +204,8 @@ Item {
|
||||||
|
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
text: i18n("Date format:")
|
text: i18n("Date format:")
|
||||||
|
opacity: if (enabled) 1
|
||||||
|
else 0.4
|
||||||
}
|
}
|
||||||
|
|
||||||
QtLayouts.RowLayout {
|
QtLayouts.RowLayout {
|
||||||
|
@ -284,60 +221,33 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QtLayouts.RowLayout {
|
FontConfig {
|
||||||
QtLayouts.Layout.fillWidth: true
|
fontModel: fontsModel
|
||||||
enabled: showDateDisplayCheckBox.checked
|
enabled: showDateDisplayCheckBox.checked
|
||||||
|
|
||||||
QtControls.Label {
|
colorValue: cfg_dateFontColor
|
||||||
text: i18n("Font style:")
|
onColorValueChanged: {
|
||||||
opacity: if (enabled) 1
|
cfg_dateFontColor = colorValue
|
||||||
else 0.4
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorButton {
|
fontValue: cgf_dateFontFamily
|
||||||
id: dateFontColorButton
|
onFontValueChanged: {
|
||||||
value: cfg_dateFontColor
|
cfg_dateFontFamily = fontValue
|
||||||
|
|
||||||
onValueChanged: {
|
|
||||||
cfg_dateFontColor = value
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.ComboBox {
|
boldValue: cfg_dateBoldText
|
||||||
id: dateFontFamilyComboBox
|
onBoldValueChanged: {
|
||||||
QtLayouts.Layout.fillWidth: true
|
cfg_dateBoldText = boldValue
|
||||||
QtLayouts.Layout.minimumWidth: units.gridUnit * 10
|
|
||||||
model: fontsModel
|
|
||||||
textRole: "text"
|
|
||||||
|
|
||||||
onCurrentIndexChanged: {
|
|
||||||
var current = model.get(currentIndex)
|
|
||||||
if (current) {
|
|
||||||
cfg_dateFontFamily = current.value
|
|
||||||
appearancePage.configurationChanged()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Button {
|
italicValue: cfg_dateItalicText
|
||||||
id: dateBoldCheckBox
|
onItalicValueChanged: {
|
||||||
icon.name: "format-text-bold"
|
cfg_dateItalicText = italicValue
|
||||||
checkable: true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Button {
|
pxSizeValue: cfg_dateFontSize
|
||||||
id: dateItalicCheckBox
|
onPxSizeValueChanged: {
|
||||||
icon.name: "format-text-italic"
|
cfg_dateFontSize = pxSizeValue
|
||||||
checkable: true
|
|
||||||
}
|
|
||||||
|
|
||||||
QtControls.SpinBox {
|
|
||||||
id: dateFontSizeSpinBox
|
|
||||||
textFromValue: function(value, locale) {
|
|
||||||
return qsTr("%1px").arg(value);
|
|
||||||
}
|
|
||||||
from: 10
|
|
||||||
to: 350
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ import QtQuick.Controls 2.12 as QtControls
|
||||||
import QtQuick.Layouts 1.15 as QtLayouts
|
import QtQuick.Layouts 1.15 as QtLayouts
|
||||||
import QtQuick.Dialogs 1.2
|
import QtQuick.Dialogs 1.2
|
||||||
|
|
||||||
import "ColorButton.qml"
|
import "."
|
||||||
|
|
||||||
QtLayouts.RowLayout {
|
QtLayouts.RowLayout {
|
||||||
|
|
||||||
|
@ -18,10 +18,12 @@ QtLayouts.RowLayout {
|
||||||
|
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
text: i18n("Font style:")
|
text: i18n("Font style:")
|
||||||
|
opacity: if (enabled) 1
|
||||||
|
else 0.4
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorButton {
|
ColorButton {
|
||||||
id: dayFontColorButton
|
id: fontColorButton
|
||||||
value: colorValue
|
value: colorValue
|
||||||
|
|
||||||
onValueChanged: {
|
onValueChanged: {
|
||||||
|
@ -30,43 +32,58 @@ QtLayouts.RowLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.ComboBox {
|
QtControls.ComboBox {
|
||||||
id: clockFontFamilyComboBox
|
id: fontFamilyComboBox
|
||||||
QtLayouts.Layout.fillWidth: true
|
QtLayouts.Layout.fillWidth: true
|
||||||
QtLayouts.Layout.minimumWidth: units.gridUnit * 10
|
QtLayouts.Layout.minimumWidth: units.gridUnit * 10
|
||||||
model: fontModel
|
model: fontModel
|
||||||
textRole: "text"
|
textRole: "text"
|
||||||
|
currentIndex: fontValue
|
||||||
|
|
||||||
onCurrentIndexChanged: {
|
onCurrentIndexChanged: {
|
||||||
var current = model.get(currentIndex)
|
var current = model.get(currentIndex)
|
||||||
if (current) {
|
if (current) {
|
||||||
fontValue = current.value
|
fontValue = current.value
|
||||||
appearancePage.configurationChanged()
|
// appearancePage.configurationChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
id: clockBoldCheckBox
|
id: boldCheckBox
|
||||||
icon.name: "format-text-bold"
|
icon.name: "format-text-bold"
|
||||||
checkable: true
|
checkable: true
|
||||||
|
checked: boldValue
|
||||||
|
|
||||||
|
onStateChanged: {
|
||||||
|
boldValue = checked
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
id: clockItalicCheckBox
|
id: italicCheckBox
|
||||||
icon.name: "format-text-italic"
|
icon.name: "format-text-italic"
|
||||||
checkable: true
|
checkable: true
|
||||||
|
checked: italicValue
|
||||||
|
|
||||||
|
onStateChanged: {
|
||||||
|
italicvalue = checked
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.SpinBox {
|
QtControls.SpinBox {
|
||||||
id: clockFontSizeSpinBox
|
id: fontSizeSpinBox
|
||||||
textFromValue: function(value, locale) {
|
|
||||||
return qsTr("%1px").arg(value);
|
|
||||||
}
|
|
||||||
from: 10
|
from: 10
|
||||||
to: 350
|
to: 350
|
||||||
|
value: pxSizeValue
|
||||||
|
|
||||||
|
onValueChanged: {
|
||||||
|
pxSizeValue = value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
text: "px"
|
text: i18n("px")
|
||||||
|
opacity: if (enabled) 1
|
||||||
|
else 0.4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue