more correct logging, use qt logging for qml as well

This commit is contained in:
arcan1s
2015-08-30 16:24:00 +03:00
parent aacb50c946
commit 4c27382467
42 changed files with 635 additions and 598 deletions

View File

@ -110,6 +110,6 @@ Item {
}
Component.onCompleted: {
if (debug) console.log("")
if (debug) console.debug()
}
}

View File

@ -214,8 +214,10 @@ Item {
]
onCurrentIndexChanged: cfg_tempUnits = model[currentIndex]["name"]
Component.onCompleted: {
if (debug) console.debug()
for (var i = 0; i < model.length; i++) {
if (model[i]["name"] == plasmoid.configuration.tempUnits) {
if (debug) console.info("Found", model[i]["name"], "on", i)
tempUnits.currentIndex = i;
}
}
@ -302,6 +304,6 @@ Item {
}
Component.onCompleted: {
if (debug) console.log("")
if (debug) console.debug()
}
}

View File

@ -90,6 +90,7 @@ Item {
width: parent.width * 2 / 3
text: plasmoid.configuration.fontFamily
onClicked: {
if (debug) console.debug()
fontDialog.setFont()
fontDialog.visible = true
}
@ -154,8 +155,10 @@ Item {
]
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;
}
}
@ -189,8 +192,10 @@ Item {
]
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;
}
}
@ -235,12 +240,14 @@ Item {
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,
@ -251,6 +258,6 @@ Item {
}
Component.onCompleted: {
if (debug) console.log("")
if (debug) console.debug()
}
}

View File

@ -114,8 +114,10 @@ Item {
width: parent.width * 3 / 5
model: ["auto", "disable", "ati", "nvidia"]
Component.onCompleted: {
if (debug) console.debug()
for (var i=0; i<model.length; i++) {
if (model[i] == cfg_dataengine["GPUDEV"]) {
if (debug) console.info("Found", model[i], "on", i)
currentIndex = i;
}
}
@ -138,8 +140,10 @@ Item {
width: parent.width * 3 / 5
model: awKeys.getHddDevices(true)
Component.onCompleted: {
if (debug) console.debug()
for (var i=0; i<model.length; i++) {
if (model[i] == cfg_dataengine["HDDDEV"]) {
if (debug) console.info("Found", model[i], "on", i)
hdd.currentIndex = i;
}
}
@ -233,8 +237,10 @@ Item {
width: parent.width * 3 / 5
model: ["disable", "mpris", "mpd"]
Component.onCompleted: {
if (debug) console.debug()
for (var i=0; i<model.length; i++) {
if (model[i] == cfg_dataengine["PLAYER"]) {
if (debug) console.info("Found", model[i], "on", i)
player.currentIndex = i;
}
}
@ -295,14 +301,14 @@ Item {
}
Component.onCompleted: {
if (debug) console.log("")
if (debug) console.debug()
// init submodule
awKeys.initKeys(plasmoid.configuration.text)
}
Component.onDestruction: {
if (debug) console.log("")
if (debug) console.debug()
cfg_dataengine["GPUDEV"] = gpuDev.currentText
cfg_dataengine["HDDDEV"] = hdd.currentText

View File

@ -92,14 +92,14 @@ Item {
interval: plasmoid.configuration.interval
onNewData: {
if (debug) console.log("Update source " + sourceName)
if (debug) console.debug("Update source", sourceName)
systemmonitorDE.interval = plasmoid.configuration.interval
awKeys.setDataBySource(sourceName, data, settings)
}
onSourceAdded: {
if (debug) console.log("Source " + source)
if (debug) console.debug("Source", source)
awKeys.addDevice(source)
}
@ -112,7 +112,7 @@ Item {
interval: plasmoid.configuration.interval
onNewData: {
if (debug) console.log("Update source " + sourceName)
if (debug) console.debug("Update source", sourceName)
extsysmonDE.interval = plasmoid.configuration.interval
awKeys.setDataBySource(sourceName, data, settings)
@ -126,7 +126,7 @@ Item {
interval: 1000
onNewData: {
if (debug) console.log("Update source " + sourceName)
if (debug) console.debug("Update source", sourceName)
awKeys.setDataBySource(sourceName, data, settings)
}
@ -165,7 +165,7 @@ Item {
}
Component.onCompleted: {
if (debug) console.log("")
if (debug) console.debug()
// actions
plasmoid.setAction("requestKey", i18n("Request key"), "utilities-system-monitor")
@ -183,26 +183,27 @@ Item {
}
onDropSource: {
if (debug) console.log("Source " + sourceName)
if (debug) console.debug()
if (debug) console.debug("Source", sourceName)
systemmonitorDE.disconnectSource(sourceName)
}
onNeedTextUpdate: {
if (debug) console.log("")
if (debug) console.debug()
text.text = newText
sizeUpdate()
}
onNeedToolTipUpdate: {
if (debug) console.log("")
if (debug) console.debug()
tooltip.text = newText
}
onSizeUpdate: {
if (debug) console.log("")
if (debug) console.debug()
if (plasmoid.configuration.height == 0) {
Layout.minimumHeight = text.contentHeight
@ -222,7 +223,7 @@ Item {
Plasmoid.onUserConfiguringChanged: {
if (plasmoid.userConfiguring) return
if (debug) console.log("")
if (debug) console.debug()
// init submodule
awKeys.initKeys(plasmoid.configuration.text)
@ -235,25 +236,25 @@ Item {
}
function action_checkUpdates() {
if (debug) console.log("")
if (debug) console.debug()
return awActions.checkUpdates()
}
function action_showReadme() {
if (debug) console.log("")
if (debug) console.debug()
return awActions.showReadme()
}
function action_report() {
if (debug) console.log("")
if (debug) console.debug()
return awActions.sendEmail()
}
function action_requestKey() {
if (debug) console.log("")
if (debug) console.debug()
return awKeys.graphicalValueByKey()
}

View File

@ -513,6 +513,6 @@ Item {
}
Component.onCompleted: {
if (debug) console.log("")
if (debug) console.debug()
}
}

View File

@ -90,8 +90,7 @@ Item {
iconName: "font"
onClicked: {
if (debug) console.log("Font button")
if (debug) console.debug("Font button")
var defaultFont = {
"color": plasmoid.configuration.fontColor,
"family": plasmoid.configuration.fontFamily,
@ -112,8 +111,7 @@ Item {
iconName: "format-indent-more"
onClicked: {
if (debug) console.log("Indent button")
if (debug) console.debug("Indent button")
var pos = textPattern.cursorPosition
var selected = textPattern.selectedText
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
@ -126,8 +124,7 @@ Item {
iconName: "format-text-bold"
onClicked: {
if (debug) console.log("Bold button")
if (debug) console.debug("Bold button")
var pos = textPattern.cursorPosition
var selected = textPattern.selectedText
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
@ -139,8 +136,7 @@ Item {
iconName: "format-text-italic"
onClicked: {
if (debug) console.log("Italic button")
if (debug) console.debug("Italic button")
var pos = textPattern.cursorPosition
var selected = textPattern.selectedText
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
@ -152,8 +148,7 @@ Item {
iconName: "format-text-underline"
onClicked: {
if (debug) console.log("Underline button")
if (debug) console.debug("Underline button")
var pos = textPattern.cursorPosition
var selected = textPattern.selectedText
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
@ -165,8 +160,7 @@ Item {
iconName: "format-text-strikethrough"
onClicked: {
if (debug) console.log("Strike button")
if (debug) console.debug("Strike button")
var pos = textPattern.cursorPosition
var selected = textPattern.selectedText
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
@ -179,8 +173,7 @@ Item {
iconName: "format-justify-left"
onClicked: {
if (debug) console.log("Left button")
if (debug) console.debug("Left button")
var pos = textPattern.cursorPosition
var selected = textPattern.selectedText
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
@ -192,8 +185,7 @@ Item {
iconName: "format-justify-center"
onClicked: {
if (debug) console.log("Center button")
if (debug) console.debug("Center button")
var pos = textPattern.cursorPosition
var selected = textPattern.selectedText
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
@ -205,8 +197,7 @@ Item {
iconName: "format-justify-right"
onClicked: {
if (debug) console.log("Right button")
if (debug) console.debug("Right button")
var pos = textPattern.cursorPosition
var selected = textPattern.selectedText
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
@ -218,8 +209,7 @@ Item {
iconName: "format-justify-fill"
onClicked: {
if (debug) console.log("Justify button")
if (debug) console.debug("Justify button")
var pos = textPattern.cursorPosition
var selected = textPattern.selectedText
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
@ -289,7 +279,9 @@ Item {
}
]
onCurrentIndexChanged: {
if (debug) console.debug()
tags.model = awKeys.dictKeys(true, model[currentIndex]["regexp"])
if (debug) console.info("Init model", tags.model, "for", model[currentIndex]["label"])
tags.currentIndex = -1
}
}
@ -303,8 +295,7 @@ Item {
onClicked: {
if (!tags.currentText) return
if (debug) console.log("Add tag button")
if (debug) console.debug("Add tag button")
var pos = textPattern.cursorPosition
var selected = textPattern.selectedText
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
@ -317,8 +308,7 @@ Item {
onClicked: {
if (!tags.currentText) return
if (debug) console.log("Show tag button")
if (debug) console.debug("Show tag button")
var message = i18n("Tag: %1", tags.currentText)
message += "<br>"
message += i18n("Value: %1", awKeys.valueByKey(tags.currentText))
@ -332,8 +322,7 @@ Item {
text: i18n("Add lambda")
onClicked: {
if (debug) console.log("Lambda button")
if (debug) console.debug("Lambda button")
var pos = textPattern.cursorPosition
var selected = textPattern.selectedText
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
@ -370,8 +359,7 @@ Item {
interval: 5000
onNewData: {
if (debug) console.log("Update source " + sourceName)
if (debug) console.debug("Update source", sourceName)
awKeys.setDataBySource(sourceName, data, settings)
}
}
@ -383,8 +371,7 @@ Item {
interval: 5000
onNewData: {
if (debug) console.log("Update source " + sourceName)
if (debug) console.debug("Update source", sourceName)
awKeys.setDataBySource(sourceName, data, settings)
}
}
@ -396,14 +383,13 @@ Item {
interval: 5000
onNewData: {
if (debug) console.log("Update source " + sourceName)
if (debug) console.debug("Update source", sourceName)
awKeys.setDataBySource(sourceName, data, settings)
}
}
Component.onCompleted: {
if (debug) console.log("")
if (debug) console.debug()
// init submodule
awKeys.initKeys(plasmoid.configuration.text)