mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 15:37:23 +00:00
Add support of text styling for desktop panel
This commit is contained in:
parent
7f6a2d8100
commit
ecf4be8d9c
@ -60,6 +60,12 @@
|
||||
<entry name="fontStyle" type="string">
|
||||
<default>normal</default>
|
||||
</entry>
|
||||
<entry name="textStyle" type="string">
|
||||
<default>normal</default>
|
||||
</entry>
|
||||
<entry name="textStyleColor" type="string">
|
||||
<default>#000000</default>
|
||||
</entry>
|
||||
<!-- current -->
|
||||
<entry name="currentTextAlign" type="string">
|
||||
<default>center</default>
|
||||
@ -79,6 +85,12 @@
|
||||
<entry name="currentFontStyle" type="string">
|
||||
<default>normal</default>
|
||||
</entry>
|
||||
<entry name="currentTextStyle" type="string">
|
||||
<default>normal</default>
|
||||
</entry>
|
||||
<entry name="currentTextStyleColor" type="string">
|
||||
<default>#000000</default>
|
||||
</entry>
|
||||
</group>
|
||||
|
||||
</kcfg>
|
||||
|
@ -49,6 +49,8 @@ Item {
|
||||
property string cfg_currentFontWeight: fontWeight.currentText
|
||||
property string cfg_currentFontStyle: fontStyle.currentText
|
||||
property alias cfg_currentFontColor: selectColor.text
|
||||
property alias cfg_currentTextStyleColor: selectStyleColor.text
|
||||
property string cfg_currentTextStyle: textStyle.currentText
|
||||
|
||||
|
||||
Column {
|
||||
@ -204,6 +206,74 @@ Item {
|
||||
onClicked: colorDialog.visible = true
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Style")
|
||||
}
|
||||
QtControls.ComboBox {
|
||||
id: textStyle
|
||||
width: parent.width * 2 / 3
|
||||
textRole: "label"
|
||||
model: [
|
||||
{
|
||||
'label': i18n("normal"),
|
||||
'name': "normal"
|
||||
},
|
||||
{
|
||||
'label': i18n("outline"),
|
||||
'name': "outline"
|
||||
},
|
||||
{
|
||||
'label': i18n("raised"),
|
||||
'name': "raised"
|
||||
},
|
||||
{
|
||||
'label': i18n("sunken"),
|
||||
'name': "sunken"
|
||||
}
|
||||
]
|
||||
onCurrentIndexChanged: cfg_currentTextStyle = model[currentIndex]["name"]
|
||||
Component.onCompleted: {
|
||||
if (debug) console.debug()
|
||||
for (var i = 0; i < model.length; i++) {
|
||||
if (model[i]["name"] == plasmoid.configuration.currentTextStyle) {
|
||||
if (debug) console.info("Found", model[i]["name"], "on", i)
|
||||
textStyle.currentIndex = i
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Style color")
|
||||
}
|
||||
QtControls.Button {
|
||||
id: selectStyleColor
|
||||
width: parent.width * 2 / 3
|
||||
style: QtStyles.ButtonStyle {
|
||||
background: Rectangle {
|
||||
color: plasmoid.configuration.currentTextStyleColor
|
||||
}
|
||||
}
|
||||
text: plasmoid.configuration.currentTextStyleColor
|
||||
onClicked: textStyleColorDialog.visible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QtDialogs.ColorDialog {
|
||||
@ -213,6 +283,13 @@ Item {
|
||||
onAccepted: selectColor.text = colorDialog.color
|
||||
}
|
||||
|
||||
QtDialogs.ColorDialog {
|
||||
id: textStyleColorDialog
|
||||
title: i18n("Select a color")
|
||||
color: selectStyleColor.text
|
||||
onAccepted: selectStyleColor.text = textStyleColorDialog.color
|
||||
}
|
||||
|
||||
QtDialogs.FontDialog {
|
||||
id: fontDialog
|
||||
title: i18n("Select a font")
|
||||
|
@ -33,4 +33,10 @@ QtObject {
|
||||
"right": Text.AlignRight,
|
||||
"justify": Text.AlignJustify
|
||||
}
|
||||
property variant textStyle: {
|
||||
"normal": Text.Normal,
|
||||
"outline": Text.Outline,
|
||||
"raised": Text.Raised,
|
||||
"sunken": Text.Sunken
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,8 @@ Item {
|
||||
property string cfg_fontWeight: fontWeight.currentText
|
||||
property string cfg_fontStyle: fontStyle.currentText
|
||||
property alias cfg_fontColor: selectColor.text
|
||||
property alias cfg_textStyleColor: selectStyleColor.text
|
||||
property string cfg_textStyle: textStyle.currentText
|
||||
|
||||
|
||||
Column {
|
||||
@ -204,6 +206,74 @@ Item {
|
||||
onClicked: colorDialog.visible = true
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Style")
|
||||
}
|
||||
QtControls.ComboBox {
|
||||
id: textStyle
|
||||
width: parent.width * 2 / 3
|
||||
textRole: "label"
|
||||
model: [
|
||||
{
|
||||
'label': i18n("normal"),
|
||||
'name': "normal"
|
||||
},
|
||||
{
|
||||
'label': i18n("outline"),
|
||||
'name': "outline"
|
||||
},
|
||||
{
|
||||
'label': i18n("raised"),
|
||||
'name': "raised"
|
||||
},
|
||||
{
|
||||
'label': i18n("sunken"),
|
||||
'name': "sunken"
|
||||
}
|
||||
]
|
||||
onCurrentIndexChanged: cfg_textStyle = model[currentIndex]["name"]
|
||||
Component.onCompleted: {
|
||||
if (debug) console.debug()
|
||||
for (var i = 0; i < model.length; i++) {
|
||||
if (model[i]["name"] == plasmoid.configuration.textStyle) {
|
||||
if (debug) console.info("Found", model[i]["name"], "on", i)
|
||||
textStyle.currentIndex = i
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Style color")
|
||||
}
|
||||
QtControls.Button {
|
||||
id: selectStyleColor
|
||||
width: parent.width * 2 / 3
|
||||
style: QtStyles.ButtonStyle {
|
||||
background: Rectangle {
|
||||
color: plasmoid.configuration.textStyleColor
|
||||
}
|
||||
}
|
||||
text: plasmoid.configuration.textStyleColor
|
||||
onClicked: textStyleColorDialog.visible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QtDialogs.ColorDialog {
|
||||
@ -213,6 +283,13 @@ Item {
|
||||
onAccepted: selectColor.text = colorDialog.color
|
||||
}
|
||||
|
||||
QtDialogs.ColorDialog {
|
||||
id: textStyleColorDialog
|
||||
title: i18n("Select a color")
|
||||
color: selectStyleColor.text
|
||||
onAccepted: selectStyleColor.text = textStyleColorDialog.color
|
||||
}
|
||||
|
||||
QtDialogs.FontDialog {
|
||||
id: fontDialog
|
||||
title: i18n("Select a font")
|
||||
|
@ -124,12 +124,16 @@ Item {
|
||||
repeater.itemAt(i).font.italic = plasmoid.configuration.currentFontStyle == "italic" ? true : false
|
||||
repeater.itemAt(i).font.pointSize = plasmoid.configuration.currentFontSize
|
||||
repeater.itemAt(i).font.weight = general.fontWeight[plasmoid.configuration.currentFontWeight]
|
||||
repeater.itemAt(i).style = general.textStyle[plasmoid.configuration.currentTextStyle]
|
||||
repeater.itemAt(i).styleColor = plasmoid.configuration.currentTextStyleColor
|
||||
} else {
|
||||
repeater.itemAt(i).color = plasmoid.configuration.fontColor
|
||||
repeater.itemAt(i).font.family = plasmoid.configuration.fontFamily
|
||||
repeater.itemAt(i).font.italic = plasmoid.configuration.fontStyle == "italic" ? true : false
|
||||
repeater.itemAt(i).font.pointSize = plasmoid.configuration.fontSize
|
||||
repeater.itemAt(i).font.weight = general.fontWeight[plasmoid.configuration.fontWeight]
|
||||
repeater.itemAt(i).style = general.textStyle[plasmoid.configuration.textStyle]
|
||||
repeater.itemAt(i).styleColor = plasmoid.configuration.textStyleColor
|
||||
}
|
||||
repeater.itemAt(i).update()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user