mirror of
https://github.com/developersu/ClearClock.git
synced 2025-05-14 19:20:26 +03:00
Start implementing custom FontConfig item
This commit is contained in:
parent
029ea84116
commit
24e5b43fe3
3 changed files with 19 additions and 58 deletions
|
@ -155,18 +155,14 @@ Item {
|
||||||
|
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
id: clockBoldCheckBox
|
id: clockBoldCheckBox
|
||||||
// ToolTip.text: i18n("Bold text")
|
|
||||||
icon.name: "format-text-bold"
|
icon.name: "format-text-bold"
|
||||||
checkable: true
|
checkable: true
|
||||||
// Accessible.name: ToolTip.text
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
id: clockItalicCheckBox
|
id: clockItalicCheckBox
|
||||||
// ToolTip.text: i18n("Italic text")
|
|
||||||
icon.name: "format-text-italic"
|
icon.name: "format-text-italic"
|
||||||
checkable: true
|
checkable: true
|
||||||
// Accessible.name: ToolTip.text
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.SpinBox {
|
QtControls.SpinBox {
|
||||||
|
@ -234,18 +230,14 @@ Item {
|
||||||
|
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
id: dayBoldCheckBox
|
id: dayBoldCheckBox
|
||||||
// ToolTip.text: i18n("Bold text")
|
|
||||||
icon.name: "format-text-bold"
|
icon.name: "format-text-bold"
|
||||||
checkable: true
|
checkable: true
|
||||||
// Accessible.name: ToolTip.text
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
id: dayItalicCheckBox
|
id: dayItalicCheckBox
|
||||||
// ToolTip.text: i18n("Italic text")
|
|
||||||
icon.name: "format-text-italic"
|
icon.name: "format-text-italic"
|
||||||
checkable: true
|
checkable: true
|
||||||
// Accessible.name: ToolTip.text
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.SpinBox {
|
QtControls.SpinBox {
|
||||||
|
@ -292,10 +284,8 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
// ToolTip.text: i18n("Time format documentation")
|
|
||||||
icon.name: "exifinfo"
|
icon.name: "exifinfo"
|
||||||
// Accessible.name: ToolTip.text
|
onClicked: Qt.openUrlExternally("https://doc.qt.io/qt-5/qml-qtqml-qt.html#formatDateTime-method")
|
||||||
onClicked: Qt.openUrlExternally(link)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -337,18 +327,14 @@ Item {
|
||||||
|
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
id: dateBoldCheckBox
|
id: dateBoldCheckBox
|
||||||
// ToolTip.text: i18n("Bold text")
|
|
||||||
icon.name: "format-text-bold"
|
icon.name: "format-text-bold"
|
||||||
checkable: true
|
checkable: true
|
||||||
// Accessible.name: ToolTip.text
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
id: dateItalicCheckBox
|
id: dateItalicCheckBox
|
||||||
// ToolTip.text: i18n("Italic text")
|
|
||||||
icon.name: "format-text-italic"
|
icon.name: "format-text-italic"
|
||||||
checkable: true
|
checkable: true
|
||||||
// Accessible.name: ToolTip.text
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.SpinBox {
|
QtControls.SpinBox {
|
||||||
|
|
|
@ -28,7 +28,7 @@ QtControls.Button {
|
||||||
ColorDialog {
|
ColorDialog {
|
||||||
id: dialog
|
id: dialog
|
||||||
title: "Select Background Color"
|
title: "Select Background Color"
|
||||||
currentColor: value
|
color: value
|
||||||
showAlphaChannel: true
|
showAlphaChannel: true
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
value = dialog.color
|
value = dialog.color
|
||||||
|
|
|
@ -3,39 +3,29 @@ 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"
|
||||||
|
|
||||||
QtLayouts.RowLayout {
|
QtLayouts.RowLayout {
|
||||||
|
|
||||||
|
property var fontModel
|
||||||
|
|
||||||
|
property color colorValue
|
||||||
|
property string fontValue
|
||||||
|
property bool boldValue
|
||||||
|
property bool italicValue
|
||||||
|
property int pxSizeValue
|
||||||
|
|
||||||
|
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
text: i18n("Font style:")
|
text: i18n("Font style:")
|
||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Button {
|
ColorButton {
|
||||||
id: clockFontColorButton
|
id: dayFontColorButton
|
||||||
text: i18n(" ")
|
value: colorValue
|
||||||
Rectangle {
|
|
||||||
id: clockFontColorRect
|
|
||||||
anchors.fill: parent
|
|
||||||
border.color: "darkgray"
|
|
||||||
border.width: 1
|
|
||||||
radius: 4
|
|
||||||
color: cfg_clockFontColor
|
|
||||||
opacity: if (enabled) 1
|
|
||||||
else 0.4
|
|
||||||
}
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: clockFontColorDialog.open()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColorDialog {
|
onValueChanged: {
|
||||||
id: clockFontColorDialog
|
colorValue = value
|
||||||
title: "Select Background Color"
|
|
||||||
currentColor: cfg_clockFontColor
|
|
||||||
showAlphaChannel: true
|
|
||||||
onAccepted: {
|
|
||||||
cfg_clockFontColor = clockFontColorDialog.color
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,27 +33,13 @@ QtLayouts.RowLayout {
|
||||||
id: clockFontFamilyComboBox
|
id: clockFontFamilyComboBox
|
||||||
QtLayouts.Layout.fillWidth: true
|
QtLayouts.Layout.fillWidth: true
|
||||||
QtLayouts.Layout.minimumWidth: units.gridUnit * 10
|
QtLayouts.Layout.minimumWidth: units.gridUnit * 10
|
||||||
model: fontsModel
|
model: fontModel
|
||||||
textRole: "text"
|
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: {
|
onCurrentIndexChanged: {
|
||||||
var current = model.get(currentIndex)
|
var current = model.get(currentIndex)
|
||||||
if (current) {
|
if (current) {
|
||||||
cfg_clockFontFamily = current.value
|
fontValue = current.value
|
||||||
appearancePage.configurationChanged()
|
appearancePage.configurationChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,4 +72,3 @@ QtLayouts.RowLayout {
|
||||||
text: "px"
|
text: "px"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue