summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2019-10-30 09:16:58 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-11-03 04:02:00 -0800
commit113cb1acc0b6b44b416272ae417a3f35fba2cc83 (patch)
tree7b8ec904fc7abaf21e6c31ef7a0b9553ad60dfde
parent9c8fbe494db231b59c2e072b54af85bc217c00d8 (diff)
downloadsubsurface-113cb1acc0b6b44b416272ae417a3f35fba2cc83.tar.gz
Mobile: use appendTextToLog to get timestamps in logs
This helps tremendously when tracking down some problems. We should never use console.log. In the process this also updates a couple of the messages to be clearer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--mobile-widgets/qml/DiveDetails.qml2
-rw-r--r--mobile-widgets/qml/DiveList.qml4
-rw-r--r--mobile-widgets/qml/DownloadFromDiveComputer.qml6
-rw-r--r--mobile-widgets/qml/DownloadedDiveDelegate.qml2
-rw-r--r--mobile-widgets/qml/SsrfTextField.qml2
-rw-r--r--mobile-widgets/qml/main.qml44
6 files changed, 30 insertions, 30 deletions
diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml
index db99879d4..e6862ac6a 100644
--- a/mobile-widgets/qml/DiveDetails.qml
+++ b/mobile-widgets/qml/DiveDetails.qml
@@ -247,7 +247,7 @@ Kirigami.Page {
function startEditMode() {
if (!currentItem.modelData) {
- console.log("DiveDetails trying to access undefined currentItem.modelData")
+ manager.appendTextToLog("DiveDetails trying to access undefined currentItem.modelData")
return
}
diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml
index d4173d5f7..3172f71b7 100644
--- a/mobile-widgets/qml/DiveList.qml
+++ b/mobile-widgets/qml/DiveList.qml
@@ -29,8 +29,8 @@ Kirigami.ScrollablePage {
manager.saveChangesCloud(true)
refreshing = false
} else {
- console.log("sync with cloud storage requested, but credentialStatus is " + prefs.credentialStatus)
- console.log("no syncing, turn off spinner")
+ manager.appendTextToLog("sync with cloud storage requested, but credentialStatus is " + prefs.credentialStatus)
+ manager.appendTextToLog("no syncing, turn off spinner")
refreshing = false
}
}
diff --git a/mobile-widgets/qml/DownloadFromDiveComputer.qml b/mobile-widgets/qml/DownloadFromDiveComputer.qml
index 549835df8..a916a372e 100644
--- a/mobile-widgets/qml/DownloadFromDiveComputer.qml
+++ b/mobile-widgets/qml/DownloadFromDiveComputer.qml
@@ -30,10 +30,10 @@ Kirigami.Page {
onDownloadFinished : {
progressBar.visible = false
if (rowCount() > 0) {
- console.log(rowCount() + " dive downloaded")
+ manager.appendTextToLog(rowCount() + " dive downloaded")
divesDownloaded = true
} else {
- console.log("no new dives downloaded")
+ manager.appendTextToLog("no new dives downloaded")
divesDownloaded = false
}
manager.appendTextToLog("DCDownloadThread finished")
@@ -361,7 +361,7 @@ Kirigami.Page {
selected: model.selected ? model.selected : false
onClicked : {
- console.log("Selecting index" + index);
+ manager.appendTextToLog("Selecting index" + index);
importModel.selectRow(index)
}
}
diff --git a/mobile-widgets/qml/DownloadedDiveDelegate.qml b/mobile-widgets/qml/DownloadedDiveDelegate.qml
index d5674db6d..6a3136975 100644
--- a/mobile-widgets/qml/DownloadedDiveDelegate.qml
+++ b/mobile-widgets/qml/DownloadedDiveDelegate.qml
@@ -41,7 +41,7 @@ Kirigami.AbstractListItem {
height: childrenRect.heigh - Kirigami.Units.smallSpacing;
anchors.verticalCenter: parent.verticalCenter
onClicked: {
- console.log("Clicked on the checkbox of item " + index)
+ manager.appendTextToLog("Clicked on the checkbox of item " + index)
importModel.selectRow(index)
}
}
diff --git a/mobile-widgets/qml/SsrfTextField.qml b/mobile-widgets/qml/SsrfTextField.qml
index d4ec5098a..15f7cc0db 100644
--- a/mobile-widgets/qml/SsrfTextField.qml
+++ b/mobile-widgets/qml/SsrfTextField.qml
@@ -25,7 +25,7 @@ Controls.TextField {
if (flickable !== undefined) {
waitForKeyboard.start()
} else {
- console.log("flickable is undefined")
+ manager.appendTextToLog("flickable is undefined")
}
}
diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml
index 8bd9a0228..a31604a12 100644
--- a/mobile-widgets/qml/main.qml
+++ b/mobile-widgets/qml/main.qml
@@ -51,7 +51,7 @@ Kirigami.ApplicationWindow {
FontMetrics {
id: fontMetrics
Component.onCompleted: {
- console.log("Using the following font: " + fontMetrics.font.family
+ manager.appendTextToLog("Using the following font: " + fontMetrics.font.family
+ " at " + subsurfaceTheme.basePointSize + "pt" +
" with mobile_scale: " + PrefDisplay.mobile_scale)
}
@@ -534,8 +534,8 @@ if you have network connectivity and want to sync your data to cloud storage."),
widthInGridUnits = Math.floor(rootItem.colWidth / kirigamiGridUnit)
}
var factor = 1.0
- console.log(numColumns + " columns with column width of " + rootItem.colWidth)
- console.log("width in Grid Units " + widthInGridUnits + " original gridUnit " + Kirigami.Units.gridUnit + " now " + kirigamiGridUnit)
+ manager.appendTextToLog(numColumns + " columns with column width of " + rootItem.colWidth)
+ manager.appendTextToLog("width in Grid Units " + widthInGridUnits + " original gridUnit " + Kirigami.Units.gridUnit + " now " + kirigamiGridUnit)
if (Kirigami.Units.gridUnit !== kirigamiGridUnit) {
factor = kirigamiGridUnit / Kirigami.Units.gridUnit
// change our glabal grid unit
@@ -547,7 +547,7 @@ if you have network connectivity and want to sync your data to cloud storage."),
// set the initial UI scaling as in the the preferences
fontMetrics.font.pointSize = subsurfaceTheme.basePointSize * PrefDisplay.mobile_scale;
- console.log("Done setting up sizes")
+ manager.appendTextToLog("Done setting up sizes")
}
QtObject {
@@ -621,11 +621,11 @@ if you have network connectivity and want to sync your data to cloud storage."),
Component.onCompleted: {
// break the binding
initialWidth = initialWidth * 1
- console.log("SubsufaceTheme constructor completed, initial width " + initialWidth)
+ manager.appendTextToLog("SubsufaceTheme constructor completed, initial width " + initialWidth)
if (rootItem.firstChange) // only run the setup if we haven't seen a change, yet
setupUnits() // but don't count this as a change (after all, it's not)
else
- console.log("Already adjusted size, ignoring this")
+ manager.appendTextToLog("Already adjusted size, ignoring this")
// this needs to pick the theme from persistent preference settings
var theme = PrefDisplay.theme
@@ -639,29 +639,29 @@ if you have network connectivity and want to sync your data to cloud storage."),
}
onWidthChanged: {
- console.log("Window width changed to " + width + " orientation " + Screen.primaryOrientation)
+ manager.appendTextToLog("Window width changed to " + width + " orientation " + Screen.primaryOrientation)
if (subsurfaceTheme.initialWidth !== undefined) {
if (width !== subsurfaceTheme.initialWidth && rootItem.firstChange) {
rootItem.firstChange = false
rootItem.lastOrientation = Screen.primaryOrientation
subsurfaceTheme.initialWidth = width
subsurfaceTheme.initialHeight = height
- console.log("first real change, so recalculating units and recording size as " + width + " x " + height)
+ manager.appendTextToLog("first real change, so recalculating units and recording size as " + width + " x " + height)
setupUnits()
} else if (rootItem.lastOrientation !== undefined && rootItem.lastOrientation != Screen.primaryOrientation) {
- console.log("Screen rotated, no action necessary")
+ manager.appendTextToLog("Screen rotated, no action necessary")
rootItem.lastOrientation = Screen.primaryOrientation
setupUnits()
} else {
- console.log("size change without rotation to " + width + " x " + height)
+ manager.appendTextToLog("size change without rotation to " + width + " x " + height)
if (width > subsurfaceTheme.initialWidth) {
- console.log("resetting to initial width " + subsurfaceTheme.initialWidth + " and height " + subsurfaceTheme.initialHeight)
+ manager.appendTextToLog("resetting to initial width " + subsurfaceTheme.initialWidth + " and height " + subsurfaceTheme.initialHeight)
rootItem.width = subsurfaceTheme.initialWidth
rootItem.height = subsurfaceTheme.initialHeight
}
}
} else {
- console.log("width changed before initial width initialized, ignoring")
+ manager.appendTextToLog("width changed before initial width initialized, ignoring")
}
}
@@ -687,7 +687,7 @@ if you have network connectivity and want to sync your data to cloud storage."),
// This is called whenever the user navigates using the breadcrumbs in the header
if (pageStack.currentItem === null) {
- console.log("there's no current page")
+ manager.appendTextToLog("there's no current page")
} else {
// horrible, insane hack to make picking the mapPage work
// for some reason I cannot figure out, whenever the mapPage is selected
@@ -696,22 +696,22 @@ if you have network connectivity and want to sync your data to cloud storage."),
if (pageStack.currentItem.objectName === mapPage.objectName) {
// remember that we actively picked the mapPage
if (hackToOpenMap !== 2 /* MapForced */ ) {
- console.log("changed to map, hack on")
+ manager.appendTextToLog("pageStack switched to map")
hackToOpenMap = 1 /* MapSelected */
} else {
- console.log("forced back to map, ignore")
+ manager.appendTextToLog("pageStack forced back to map")
}
} else if (pageStack.currentItem.objectName !== mapPage.objectName &&
pageStack.lastItem.objectName === mapPage.objectName &&
hackToOpenMap === 1 /* MapSelected */) {
// if we just picked the mapPage and are suddenly back on a different page
// force things back to the mapPage
- console.log("hack was on, map is last page, switching back to map, hack off")
+ manager.appendTextToLog("pageStack wrong page, switching back to map")
pageStack.currentIndex = pageStack.contentItem.contentChildren.length - 1
hackToOpenMap = 2 /* MapForced */
} else {
// if we picked a different page reset the mapPage hack
- console.log("switched to " + pageStack.currentItem.objectName + " - hack off")
+ manager.appendTextToLog("pageStack switched to " + pageStack.currentItem.objectName)
hackToOpenMap = 0 /* Otherpage */
}
@@ -788,27 +788,27 @@ if you have network connectivity and want to sync your data to cloud storage."),
onPluggedInDeviceNameChanged: {
if (detailsWindow.state === 'edit' || detailsWindow.state === 'add') {
/* we're in the middle of editing / adding a dive */
- console.log("Download page requested by Android Intent, but adding/editing dive; no action taken")
+ manager.appendTextToLog("Download page requested by Android Intent, but adding/editing dive; no action taken")
} else {
- console.log("Show download page for device " + pluggedInDeviceName)
+ manager.appendTextToLog("Show download page for device " + pluggedInDeviceName)
/* if we recognized the device, we'll pass in a triple of ComboBox indeces as "vendor;product;connection" */
var vendorProductConnection = pluggedInDeviceName.split(';')
if (vendorProductConnection.length === 3)
diveList.showDownloadPage(vendorProductConnection[0], vendorProductConnection[1], vendorProductConnection[2])
else
diveList.showDownloadPage()
- console.log("done showing download page")
+ manager.appendTextToLog("done showing download page")
}
}
Component.onCompleted: {
// try to see if we can detect certain device vendors through these properties
if (Screen.manufacturer + " " + Screen.model + " " + Screen.name !== " ")
- console.log("Running on " + Screen.manufacturer + " " + Screen.model + " " + Screen.name)
+ manager.appendTextToLog("Running on " + Screen.manufacturer + " " + Screen.model + " " + Screen.name)
rootItem.visible = true
diveList.opacity = 1
rootItem.opacity = 1
- console.log("setting the defaultColumnWidth to " + Kirigami.Units.gridUnit * 21)
+ manager.appendTextToLog("setting the defaultColumnWidth to " + Kirigami.Units.gridUnit * 21)
pageStack.defaultColumnWidth = Kirigami.Units.gridUnit * 21
manager.appInitialized()
}