mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 23:47:20 +00:00
update desktoppanel qml part
This commit is contained in:
parent
335fbb137e
commit
f882756fad
@ -22,6 +22,7 @@ import org.kde.plasma.private.awesomewidget 1.0
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: aboutPage
|
id: aboutPage
|
||||||
|
// backend
|
||||||
AWActions {
|
AWActions {
|
||||||
id: awActions
|
id: awActions
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import org.kde.plasma.private.desktoppanel 1.0
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: aboutPage
|
id: aboutPage
|
||||||
|
// backend
|
||||||
DPAdds {
|
DPAdds {
|
||||||
id: dpAdds
|
id: dpAdds
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,9 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtQuick.Controls 1.3 as QtControls
|
|
||||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
|
||||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
|
||||||
|
|
||||||
import org.kde.plasma.private.desktoppanel 1.0
|
import org.kde.plasma.private.desktoppanel 1.0
|
||||||
|
import "."
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -36,280 +34,69 @@ Item {
|
|||||||
implicitHeight: pageColumn.implicitHeight
|
implicitHeight: pageColumn.implicitHeight
|
||||||
|
|
||||||
property bool debug: dpAdds.isDebugEnabled()
|
property bool debug: dpAdds.isDebugEnabled()
|
||||||
property variant weight: {
|
|
||||||
25: 0,
|
|
||||||
50: 1,
|
|
||||||
63: 3,
|
|
||||||
75: 4,
|
|
||||||
87: 5
|
|
||||||
}
|
|
||||||
|
|
||||||
property alias cfg_currentFontFamily: selectFont.text
|
property alias cfg_currentFontFamily: font.value
|
||||||
property alias cfg_currentFontSize: fontSize.value
|
property alias cfg_currentFontSize: fontSize.value
|
||||||
property string cfg_currentFontWeight: fontWeight.currentText
|
property string cfg_currentFontWeight: fontWeight.value
|
||||||
property string cfg_currentFontStyle: fontStyle.currentText
|
property string cfg_currentFontStyle: fontStyle.value
|
||||||
property alias cfg_currentFontColor: selectColor.text
|
property alias cfg_currentFontColor: selectColor.text
|
||||||
property alias cfg_currentTextStyleColor: selectStyleColor.text
|
property alias cfg_currentTextStyleColor: selectStyleColor.text
|
||||||
property string cfg_currentTextStyle: textStyle.currentText
|
property string cfg_currentTextStyle: textStyle.value
|
||||||
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: pageColumn
|
id: pageColumn
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
Row {
|
|
||||||
height: implicitHeight
|
FontSelector {
|
||||||
width: parent.width
|
id: font
|
||||||
QtControls.Label {
|
|
||||||
height: parent.height
|
|
||||||
width: parent.width / 3
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: i18n("Font")
|
text: i18n("Font")
|
||||||
}
|
value: plasmoid.configuration.currentFontFamily
|
||||||
QtControls.Button {
|
|
||||||
id: selectFont
|
|
||||||
width: parent.width * 2 / 3
|
|
||||||
text: plasmoid.configuration.currentFontFamily
|
|
||||||
onClicked: {
|
|
||||||
if (debug) console.debug()
|
|
||||||
fontDialog.setFont()
|
|
||||||
fontDialog.visible = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
IntegerSelector {
|
||||||
height: implicitHeight
|
|
||||||
width: parent.width
|
|
||||||
QtControls.Label {
|
|
||||||
height: parent.height
|
|
||||||
width: parent.width / 3
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: i18n("Font size")
|
|
||||||
}
|
|
||||||
QtControls.SpinBox {
|
|
||||||
id: fontSize
|
id: fontSize
|
||||||
width: parent.width * 2 / 3
|
|
||||||
minimumValue: 8
|
|
||||||
maximumValue: 32
|
maximumValue: 32
|
||||||
|
minimumValue: 8
|
||||||
stepSize: 1
|
stepSize: 1
|
||||||
|
text: i18n("Font size")
|
||||||
value: plasmoid.configuration.currentFontSize
|
value: plasmoid.configuration.currentFontSize
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
ComboBoxSelector {
|
||||||
height: implicitHeight
|
|
||||||
width: parent.width
|
|
||||||
QtControls.Label {
|
|
||||||
height: parent.height
|
|
||||||
width: parent.width / 3
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: i18n("Font weight")
|
|
||||||
}
|
|
||||||
QtControls.ComboBox {
|
|
||||||
id: fontWeight
|
id: fontWeight
|
||||||
width: parent.width * 2 / 3
|
model: general.fontWeightModel
|
||||||
textRole: "label"
|
text: i18n("Font weight")
|
||||||
model: [
|
value: plasmoid.configuration.currentFontWeight
|
||||||
{
|
onValueEdited: cfg_currentFontWeight = newValue
|
||||||
'label': i18n("light"),
|
|
||||||
'name': "light"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("normal"),
|
|
||||||
'name': "normal"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("demi bold"),
|
|
||||||
'name': "demibold"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("bold"),
|
|
||||||
'name': "bold"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("black"),
|
|
||||||
'name': "black"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
onCurrentIndexChanged: cfg_currentFontWeight = model[currentIndex]["name"]
|
|
||||||
Component.onCompleted: {
|
|
||||||
if (debug) console.debug()
|
|
||||||
for (var i = 0; i < model.length; i++) {
|
|
||||||
if (model[i]["name"] == plasmoid.configuration.currentFontWeight) {
|
|
||||||
if (debug) console.info("Found", model[i]["name"], "on", i)
|
|
||||||
fontWeight.currentIndex = i
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
ComboBoxSelector {
|
||||||
height: implicitHeight
|
|
||||||
width: parent.width
|
|
||||||
QtControls.Label {
|
|
||||||
height: parent.height
|
|
||||||
width: parent.width / 3
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: i18n("Font style")
|
|
||||||
}
|
|
||||||
QtControls.ComboBox {
|
|
||||||
id: fontStyle
|
id: fontStyle
|
||||||
width: parent.width * 2 / 3
|
model: general.fontStyleModel
|
||||||
textRole: "label"
|
text: i18n("Font style")
|
||||||
model: [
|
value: plasmoid.configuration.currentFontStyle
|
||||||
{
|
onValueEdited: cfg_currentFontStyle = newValue
|
||||||
'label': i18n("normal"),
|
|
||||||
'name': "normal"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("italic"),
|
|
||||||
'name': "italic"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
onCurrentIndexChanged: cfg_currentFontStyle = model[currentIndex]["name"]
|
|
||||||
Component.onCompleted: {
|
|
||||||
if (debug) console.debug()
|
|
||||||
for (var i = 0; i < model.length; i++) {
|
|
||||||
if (model[i]["name"] == plasmoid.configuration.currentFontStyle) {
|
|
||||||
if (debug) console.info("Found", model[i]["name"], "on", i)
|
|
||||||
fontStyle.currentIndex = i
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
ColorSelector {
|
||||||
height: implicitHeight
|
|
||||||
width: parent.width
|
|
||||||
QtControls.Label {
|
|
||||||
height: parent.height
|
|
||||||
width: parent.width / 3
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: i18n("Font color")
|
|
||||||
}
|
|
||||||
QtControls.Button {
|
|
||||||
id: selectColor
|
id: selectColor
|
||||||
width: parent.width * 2 / 3
|
text: i18n("Font color")
|
||||||
style: QtStyles.ButtonStyle {
|
value: plasmoid.configuration.currentFontColor
|
||||||
background: Rectangle {
|
|
||||||
color: plasmoid.configuration.currentFontColor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
text: plasmoid.configuration.currentFontColor
|
|
||||||
onClicked: colorDialog.visible = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
ComboBoxSelector {
|
||||||
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
|
id: textStyle
|
||||||
width: parent.width * 2 / 3
|
model: general.textStyleModel
|
||||||
textRole: "label"
|
text: i18n("Style")
|
||||||
model: [
|
value: plasmoid.configuration.currentTextStyle
|
||||||
{
|
onValueEdited: cfg_currentTextStyle = newValue
|
||||||
'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 {
|
ColorSelector {
|
||||||
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
|
id: selectStyleColor
|
||||||
width: parent.width * 2 / 3
|
text: i18n("Style color")
|
||||||
style: QtStyles.ButtonStyle {
|
value: plasmoid.configuration.currentTextStyleColor
|
||||||
background: Rectangle {
|
|
||||||
color: plasmoid.configuration.currentTextStyleColor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
text: plasmoid.configuration.currentTextStyleColor
|
|
||||||
onClicked: textStyleColorDialog.visible = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QtDialogs.ColorDialog {
|
|
||||||
id: colorDialog
|
|
||||||
title: i18n("Select a color")
|
|
||||||
color: selectColor.text
|
|
||||||
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")
|
|
||||||
signal setFont
|
|
||||||
|
|
||||||
onAccepted: {
|
|
||||||
if (debug) console.debug()
|
|
||||||
selectFont.text = fontDialog.font.family
|
|
||||||
fontSize.value = fontDialog.font.pointSize
|
|
||||||
fontStyle.currentIndex = fontDialog.font.italic ? 1 : 0
|
|
||||||
fontWeight.currentIndex = weight[fontDialog.font.weight]
|
|
||||||
}
|
|
||||||
onSetFont: {
|
|
||||||
if (debug) console.debug()
|
|
||||||
fontDialog.font = Qt.font({
|
|
||||||
family: selectFont.text,
|
|
||||||
pointSize: fontSize.value > 0 ? fontSize.value : 12,
|
|
||||||
italic: fontStyle.currentIndex == 1,
|
|
||||||
weight: Font.Normal,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtQuick.Controls 1.3 as QtControls
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
|
||||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
|
||||||
|
|
||||||
import org.kde.plasma.private.desktoppanel 1.0
|
import org.kde.plasma.private.desktoppanel 1.0
|
||||||
|
|
||||||
|
@ -16,11 +16,9 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtQuick.Controls 1.3 as QtControls
|
|
||||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
|
||||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
|
||||||
|
|
||||||
import org.kde.plasma.private.desktoppanel 1.0
|
import org.kde.plasma.private.desktoppanel 1.0
|
||||||
|
import "."
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -36,280 +34,69 @@ Item {
|
|||||||
implicitHeight: pageColumn.implicitHeight
|
implicitHeight: pageColumn.implicitHeight
|
||||||
|
|
||||||
property bool debug: dpAdds.isDebugEnabled()
|
property bool debug: dpAdds.isDebugEnabled()
|
||||||
property variant weight: {
|
|
||||||
25: 0,
|
|
||||||
50: 1,
|
|
||||||
63: 3,
|
|
||||||
75: 4,
|
|
||||||
87: 5
|
|
||||||
}
|
|
||||||
|
|
||||||
property alias cfg_fontFamily: selectFont.text
|
property alias cfg_fontFamily: font.value
|
||||||
property alias cfg_fontSize: fontSize.value
|
property alias cfg_fontSize: fontSize.value
|
||||||
property string cfg_fontWeight: fontWeight.currentText
|
property string cfg_fontWeight: fontWeight.value
|
||||||
property string cfg_fontStyle: fontStyle.currentText
|
property string cfg_fontStyle: fontStyle.value
|
||||||
property alias cfg_fontColor: selectColor.text
|
property alias cfg_fontColor: selectColor.value
|
||||||
property alias cfg_textStyleColor: selectStyleColor.text
|
property alias cfg_textStyleColor: selectStyleColor.value
|
||||||
property string cfg_textStyle: textStyle.currentText
|
property string cfg_textStyle: textStyle.value
|
||||||
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: pageColumn
|
id: pageColumn
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
Row {
|
|
||||||
height: implicitHeight
|
FontSelector {
|
||||||
width: parent.width
|
id: font
|
||||||
QtControls.Label {
|
|
||||||
height: parent.height
|
|
||||||
width: parent.width / 3
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: i18n("Font")
|
text: i18n("Font")
|
||||||
}
|
value: plasmoid.configuration.fontFamily
|
||||||
QtControls.Button {
|
|
||||||
id: selectFont
|
|
||||||
width: parent.width * 2 / 3
|
|
||||||
text: plasmoid.configuration.fontFamily
|
|
||||||
onClicked: {
|
|
||||||
if (debug) console.debug()
|
|
||||||
fontDialog.setFont()
|
|
||||||
fontDialog.visible = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
IntegerSelector {
|
||||||
height: implicitHeight
|
|
||||||
width: parent.width
|
|
||||||
QtControls.Label {
|
|
||||||
height: parent.height
|
|
||||||
width: parent.width / 3
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: i18n("Font size")
|
|
||||||
}
|
|
||||||
QtControls.SpinBox {
|
|
||||||
id: fontSize
|
id: fontSize
|
||||||
width: parent.width * 2 / 3
|
|
||||||
minimumValue: 8
|
|
||||||
maximumValue: 32
|
maximumValue: 32
|
||||||
|
minimumValue: 8
|
||||||
stepSize: 1
|
stepSize: 1
|
||||||
|
text: i18n("Font size")
|
||||||
value: plasmoid.configuration.fontSize
|
value: plasmoid.configuration.fontSize
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
ComboBoxSelector {
|
||||||
height: implicitHeight
|
|
||||||
width: parent.width
|
|
||||||
QtControls.Label {
|
|
||||||
height: parent.height
|
|
||||||
width: parent.width / 3
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: i18n("Font weight")
|
|
||||||
}
|
|
||||||
QtControls.ComboBox {
|
|
||||||
id: fontWeight
|
id: fontWeight
|
||||||
width: parent.width * 2 / 3
|
model: general.fontWeightModel
|
||||||
textRole: "label"
|
text: i18n("Font weight")
|
||||||
model: [
|
value: plasmoid.configuration.fontWeight
|
||||||
{
|
onValueEdited: cfg_fontWeight = newValue
|
||||||
'label': i18n("light"),
|
|
||||||
'name': "light"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("normal"),
|
|
||||||
'name': "normal"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("demi bold"),
|
|
||||||
'name': "demibold"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("bold"),
|
|
||||||
'name': "bold"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("black"),
|
|
||||||
'name': "black"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
onCurrentIndexChanged: cfg_fontWeight = model[currentIndex]["name"]
|
|
||||||
Component.onCompleted: {
|
|
||||||
if (debug) console.debug()
|
|
||||||
for (var i = 0; i < model.length; i++) {
|
|
||||||
if (model[i]["name"] == plasmoid.configuration.fontWeight) {
|
|
||||||
if (debug) console.info("Found", model[i]["name"], "on", i)
|
|
||||||
fontWeight.currentIndex = i
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
ComboBoxSelector {
|
||||||
height: implicitHeight
|
|
||||||
width: parent.width
|
|
||||||
QtControls.Label {
|
|
||||||
height: parent.height
|
|
||||||
width: parent.width / 3
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: i18n("Font style")
|
|
||||||
}
|
|
||||||
QtControls.ComboBox {
|
|
||||||
id: fontStyle
|
id: fontStyle
|
||||||
width: parent.width * 2 / 3
|
model: general.fontStyleModel
|
||||||
textRole: "label"
|
text: i18n("Font style")
|
||||||
model: [
|
value: plasmoid.configuration.fontStyle
|
||||||
{
|
onValueEdited: cfg_fontStyle = newValue
|
||||||
'label': i18n("normal"),
|
|
||||||
'name': "normal"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("italic"),
|
|
||||||
'name': "italic"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
onCurrentIndexChanged: cfg_fontStyle = model[currentIndex]["name"]
|
|
||||||
Component.onCompleted: {
|
|
||||||
if (debug) console.debug()
|
|
||||||
for (var i = 0; i < model.length; i++) {
|
|
||||||
if (model[i]["name"] == plasmoid.configuration.fontStyle) {
|
|
||||||
if (debug) console.info("Found", model[i]["name"], "on", i)
|
|
||||||
fontStyle.currentIndex = i
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
ColorSelector {
|
||||||
height: implicitHeight
|
|
||||||
width: parent.width
|
|
||||||
QtControls.Label {
|
|
||||||
height: parent.height
|
|
||||||
width: parent.width / 3
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: i18n("Font color")
|
|
||||||
}
|
|
||||||
QtControls.Button {
|
|
||||||
id: selectColor
|
id: selectColor
|
||||||
width: parent.width * 2 / 3
|
text: i18n("Font color")
|
||||||
style: QtStyles.ButtonStyle {
|
value: plasmoid.configuration.fontColor
|
||||||
background: Rectangle {
|
|
||||||
color: plasmoid.configuration.fontColor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
text: plasmoid.configuration.fontColor
|
|
||||||
onClicked: colorDialog.visible = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
ComboBoxSelector {
|
||||||
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
|
id: textStyle
|
||||||
width: parent.width * 2 / 3
|
model: general.textStyleModel
|
||||||
textRole: "label"
|
text: i18n("Style")
|
||||||
model: [
|
value: plasmoid.configuration.textStyle
|
||||||
{
|
onValueEdited: cfg_textStyle = newValue
|
||||||
'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 {
|
ColorSelector {
|
||||||
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
|
id: selectStyleColor
|
||||||
width: parent.width * 2 / 3
|
text: i18n("Style color")
|
||||||
style: QtStyles.ButtonStyle {
|
value: plasmoid.configuration.textStyleColor
|
||||||
background: Rectangle {
|
|
||||||
color: plasmoid.configuration.textStyleColor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
text: plasmoid.configuration.textStyleColor
|
|
||||||
onClicked: textStyleColorDialog.visible = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QtDialogs.ColorDialog {
|
|
||||||
id: colorDialog
|
|
||||||
title: i18n("Select a color")
|
|
||||||
color: selectColor.text
|
|
||||||
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")
|
|
||||||
signal setFont
|
|
||||||
|
|
||||||
onAccepted: {
|
|
||||||
if (debug) console.debug()
|
|
||||||
selectFont.text = fontDialog.font.family
|
|
||||||
fontSize.value = fontDialog.font.pointSize
|
|
||||||
fontStyle.currentIndex = fontDialog.font.italic ? 1 : 0
|
|
||||||
fontWeight.currentIndex = weight[fontDialog.font.weight]
|
|
||||||
}
|
|
||||||
onSetFont: {
|
|
||||||
if (debug) console.debug()
|
|
||||||
fontDialog.font = Qt.font({
|
|
||||||
family: selectFont.text,
|
|
||||||
pointSize: fontSize.value > 0 ? fontSize.value : 12,
|
|
||||||
italic: fontStyle.currentIndex == 1,
|
|
||||||
weight: Font.Normal,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user