massive qml edit

This commit is contained in:
2024-03-27 01:28:14 +02:00
parent 4fcea42e8e
commit 3f20aa8878
31 changed files with 175 additions and 519 deletions

View File

@ -68,23 +68,27 @@ Row {
}
}
// TODO migrate history
// Button {
// width: parent.width / 15
// iconName: "view-history"
// menu: Menu {
// id: historyConfig
// Instantiator {
// model: awTelemetryHandler.get("awwidgetconfig")
// MenuItem {
// text: modelData
// onTriggered: textArea.text = modelData
// }
// onObjectAdded: historyConfig.insertItem(index, object)
// onObjectRemoved: historyConfig.removeItem(object)
// }
// }
// }
Button {
width: parent.width / 15
icon.name: "view-history"
onClicked: historyConfig.open()
Menu {
id: historyConfig
Instantiator {
model: awTelemetryHandler.get("awwidgetconfig")
delegate: MenuItem {
text: modelData
onTriggered: textArea.text = modelData
}
onObjectAdded: (index, object) => historyConfig.insertItem(index, object)
onObjectRemoved: (index, object) => historyConfig.removeItem(object)
}
}
}
MessageDialog {
id: compiledText

View File

@ -23,7 +23,9 @@ Label {
width: parent.width
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
text: i18n("Detailed information may be found on <a href=\"https://arcanis.me/projects/awesome-widgets/\">project homepage</a>")
onLinkActivated: Qt.openUrlExternally(link)
}

View File

@ -77,9 +77,9 @@ ScrollView {
function getLastTag() {
// get substring to analyze
var substring = textArea.getText(0, textArea.cursorPosition)
const substring = textArea.getText(0, textArea.cursorPosition)
// find last position of index in the given substring
var signIndex = substring.lastIndexOf('$') + 1
const signIndex = substring.lastIndexOf("$") + 1
if ((signIndex === 0) || (signIndex === textArea.cursorPosition))
return ""
// get current tag text
@ -89,6 +89,14 @@ ScrollView {
function insert(text) {
textArea.insert(textArea.cursorPosition, text)
}
function removeSelection() {
textArea.remove(textArea.selectionStart, textArea.selectionEnd)
}
function selectedText() {
return textArea.selectedText
}
}

View File

@ -34,8 +34,6 @@ Dialog {
width: 640
height: 480
property bool debug: awActions.isDebugEnabled()
title: i18n("Report a bug")
standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel | DialogButtonBox.Reset
@ -48,6 +46,7 @@ Dialog {
Layout.fillWidth: true
placeholderText: i18n("Report subject")
}
ColumnLayout {
Layout.fillWidth: true
@ -55,41 +54,50 @@ Dialog {
Layout.fillWidth: true
height: parent.height / 5
title: i18n("Description")
TextArea {
id: description
anchors.fill: parent
textFormat: TextEdit.PlainText
}
}
GroupBox {
Layout.fillWidth: true
height: parent.height / 5
title: i18n("Steps to reproduce")
TextArea {
id: reproduce
anchors.fill: parent
textFormat: TextEdit.PlainText
}
}
GroupBox {
Layout.fillWidth: true
height: parent.height / 5
title: i18n("Expected result")
TextArea {
id: expected
anchors.fill: parent
textFormat: TextEdit.PlainText
}
}
GroupBox {
Layout.fillWidth: true
Layout.alignment: Qt.AlignBottom
title: i18n("Logs")
ColumnLayout {
anchors.fill: parent
Layout.fillWidth: true
Row {
Layout.fillWidth: true
Layout.fillWidth: true
Label {
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignJustify
@ -97,17 +105,20 @@ Dialog {
wrapMode: Text.WordWrap
text: i18n("Use command")
}
TextField {
width: parent.width * 3 / 5
readOnly: true
text: "QT_LOGGING_RULES=*=true plasmawindowed org.kde.plasma.awesomewidget"
}
}
Button {
Layout.fillWidth: true
text: i18n("Load log file")
onClicked: logPath.open()
}
TextArea {
id: logBody
Layout.fillWidth: true
@ -127,16 +138,11 @@ Dialog {
}
onAccepted: {
if (debug) console.debug()
var text = awBugReporter.generateText(description.text, reproduce.text,
expected.text, logBody.text)
const text = awBugReporter.generateText(description.text, reproduce.text, expected.text, logBody.text)
awBugReporter.sendBugReport(title.text, text)
}
onReset: {
if (debug) console.debug()
title.text = ""
description.text = ""
reproduce.text = ""
@ -144,8 +150,6 @@ Dialog {
}
Component.onCompleted: {
if (debug) console.debug()
awBugReporter.doConnect()
}
}

View File

@ -32,9 +32,11 @@ Row {
id: label
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
}
Button {
id: button
width: parent.width * 3 / 5

View File

@ -30,6 +30,7 @@ Row {
height: parent.heigth
width: parent.width * 2 / 5
}
CheckBox {
id: checkBox
width: parent.width * 3 / 5

View File

@ -20,10 +20,11 @@ import QtQuick.Dialogs
ButtonSelector {
// TODO somehow doesn't work
// background: Rectangle {
// color: value
// }
background: Rectangle {
implicitWidth: 100
implicitHeight: 25
color: value
}
onButtonActivated: colorDialog.visible = true

View File

@ -39,14 +39,16 @@ Row {
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
}
ComboBox {
id: comboBox
width: parent.width * 3 / 5
textRole: 'label'
onCurrentIndexChanged: valueEdited(comboBox.model[comboBox.currentIndex]['name'])
textRole: "label"
onCurrentIndexChanged: valueEdited(comboBox.model[comboBox.currentIndex]["name"])
Component.onCompleted: {
var total = comboBox.model.length
for (var i = 0; i < total; i++) {
const total = comboBox.model.length
for (let i = 0; i < total; i++) {
if (comboBox.model[i]["name"] === value)
comboBox.currentIndex = i
}

View File

@ -37,8 +37,9 @@ Item {
fileMode: FileDialog.SaveFile
title: i18n("Export")
currentFolder: awConfig.configurationDirectory()
onAccepted: {
var status = awConfig.exportConfiguration(
const status = awConfig.exportConfiguration(
configuration,
fileDialog.fileUrl.toString().replace("file://", ""))
if (status) {
@ -51,7 +52,6 @@ Item {
messageDialog.open()
}
}
function open() {
return fileDialog.open()
}

View File

@ -21,6 +21,7 @@ import QtQuick 2.15
// required by i18n functions
import org.kde.plasma.core as PlasmaCore
QtObject {
property variant fontWeight: {
"light": Font.Light,

View File

@ -30,6 +30,7 @@ Row {
text: i18n("Bgcolor")
textField: textArea
}
HtmlEditorFont {
width: parent.width * 3 / 15
textField: textArea
@ -45,6 +46,7 @@ Row {
textField: textArea
end: "<br>\n"
}
// font properties
HtmlEditorButton {
width: parent.width / 15
@ -53,6 +55,7 @@ Row {
start: "<b>"
end: "</b>"
}
HtmlEditorButton {
width: parent.width / 15
icon.name: "format-text-italic"
@ -60,6 +63,7 @@ Row {
start: "<i>"
end: "</i>"
}
HtmlEditorButton {
width: parent.width / 15
icon.name: "format-text-underline"
@ -67,6 +71,7 @@ Row {
start: "<u>"
end: "</u>"
}
HtmlEditorButton {
width: parent.width / 15
icon.name: "format-text-strikethrough"
@ -83,6 +88,7 @@ Row {
start: "<p align=\"left\">"
end: "</p>"
}
HtmlEditorButton {
width: parent.width / 15
icon.name: "format-justify-center"
@ -90,6 +96,7 @@ Row {
start: "<p align=\"center\">"
end: "</p>"
}
HtmlEditorButton {
width: parent.width / 15
icon.name: "format-justify-right"
@ -97,6 +104,7 @@ Row {
start: "<p align=\"right\">"
end: "</p>"
}
HtmlEditorButton {
width: parent.width / 15
icon.name: "format-justify-fill"

View File

@ -31,7 +31,7 @@ Button {
function updateText() {
// get selected text
var selected = textField.selectedText()
const selected = textField.selectedText()
// remove it from widget
textField.removeSelection()
// insert edited text

View File

@ -36,13 +36,13 @@ HtmlEditorButton {
clickedEvent: function() {
// get new font
var defaultFont = {
const defaultFont = {
"color": defaultFontColor,
"family": defaultFontFamily,
"size": defaultFontSize
}
// we are using custom selector as soon as we need to select color as well
var font = awActions.getFont(defaultFont)
const font = awActions.getFont(defaultFont)
// check status
if (!font.applied)

View File

@ -57,14 +57,13 @@ Item {
}
onAccepted: {
var importConfig = awConfig.importConfiguration(
const importConfig = awConfig.importConfiguration(
fileDialog.fileUrl.toString().replace("file://", ""),
importPlasmoid.checked, importExtensions.checked,
importAdds.checked)
configurationReceived(importConfig)
}
}
function open() {
return fileDialog.open()
}

View File

@ -39,6 +39,7 @@ Row {
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
}
SpinBox {
id: spinBox
width: parent.width * 3 / 5

View File

@ -35,6 +35,7 @@ Row {
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
}
TextField {
id: textField
width: parent.width * 3 / 5