Add debug page

This commit is contained in:
Anton Thomasson 2020-01-26 13:27:56 +01:00
parent 2f973f3d57
commit 8257eed03a
3 changed files with 64 additions and 0 deletions

View file

@ -34,6 +34,7 @@ DISTFILES += qml/harbour-seaprint.qml \
qml/pages/*.qml \
qml/pages/*.js \
qml/pages/*svg \
qml/pages/DebugPage.qml \
rpm/harbour-seaprint.changes.in \
rpm/harbour-seaprint.changes.run.in \
rpm/harbour-seaprint.spec \

43
qml/pages/DebugPage.qml Normal file
View file

@ -0,0 +1,43 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
id: aboutPage
allowedOrientations: Orientation.All
property var printer
SilicaFlickable {
id: flick
anchors.fill : parent
contentHeight: textArea.height + header.height
contentWidth : parent.width - (2.0 * Theme.paddingLarge)
PageHeader {
id: header
title: printer.attrs["printer-name"].value
}
TextArea {
id: textArea
readOnly: true
width: parent.width
anchors.top: header.bottom
anchors.bottom: flick.bottom
font.family: "courier"
font.pixelSize: Theme.fontSizeTiny
wrapMode: TextEdit.Wrap
text: JSON.stringify(printer.attrs, null, " ")
onPressAndHold: {
selectAll()
copy()
deselect()
notifier.notify("Copied to clipboard")
}
}
}
}

View file

@ -131,7 +131,26 @@ Page {
}
}
Timer
{
id: debugCountReset
interval: 666
repeat: false
onTriggered:
{
debugCount = 0;
}
}
property int debugCount: 0
onClicked: {
if(++debugCount == 5)
{
pageStack.push(Qt.resolvedUrl("DebugPage.qml"), {printer: printer})
return;
}
debugCountReset.restart();
if(!canPrint)
return;
if(selectedFile != "")
@ -161,6 +180,7 @@ Page {
source: printer.attrs["printer-icons"] ? "image://ippdiscovery/"+printer.attrs["printer-icons"].value[0] : "icon-seaprint-nobg.svg"
// Some printers serve their icons over https with invalid certs...
onStatusChanged: if (status == Image.Error) source = "icon-seaprint-nobg.svg"
}
Column {