Commit 7f1d60e3 authored by Don Gagne's avatar Don Gagne

Remove X to close since it conflicts with QGCViewDialogs

parent b8d25964
...@@ -26,115 +26,166 @@ import QtQuick.Controls 1.2 ...@@ -26,115 +26,166 @@ import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2 import QtQuick.Controls.Styles 1.2
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
import QGroundControl 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.Controllers 1.0 import QGroundControl.Controllers 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
Rectangle { QGCView {
id: logwindow id: qgcView
anchors.fill: parent viewPanel: panel
anchors.margins: ScreenTools.defaultFontPixelWidth
color: qgcPal.window
property bool loaded: false property bool loaded: false
QGCPalette { id: qgcPal } QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
Connections { Component {
target: debugMessageModel id: filtersDialogComponent
onDataChanged: { QGCViewDialog {
// Keep the view in sync if the button is checked QGCFlickable {
if (loaded) { anchors.fill: parent
if (followTail.checked) { contentHeight: categoryColumn.height
listview.positionViewAtEnd(); clip: true
Column {
id: categoryColumn
spacing: ScreenTools.defaultFontPixelHeight / 2
Repeater {
model: QGroundControl.loggingCategories()
QGCCheckBox {
text: modelData
checked: QGroundControl.categoryLoggingOn(modelData)
onClicked: {
QGroundControl.setCategoryLoggingOn(modelData, checked)
QGroundControl.updateLoggingFilterRules()
}
}
}
} }
} }
} } // QGCViewDialog
} } // Component - filtersDialogComponent
QGCViewPanel {
id: panel
anchors.fill: parent
Component {
id: delegateItem
Rectangle { Rectangle {
color: index % 2 == 0 ? qgcPal.window : qgcPal.windowShade id: logwindow
height: Math.round(ScreenTools.defaultFontPixelHeight * 0.5 + field.height) anchors.fill: parent
width: listview.width anchors.margins: ScreenTools.defaultFontPixelWidth
color: qgcPal.window
Text {
id: field Connections {
text: display target: debugMessageModel
color: qgcPal.text
width: parent.width onDataChanged: {
wrapMode: Text.Wrap // Keep the view in sync if the button is checked
font.family: ScreenTools.normalFontFamily if (loaded) {
anchors.verticalCenter: parent.verticalCenter if (followTail.checked) {
listview.positionViewAtEnd();
}
}
}
} }
}
}
ListView { Component {
Component.onCompleted: { id: delegateItem
loaded = true Rectangle {
} color: index % 2 == 0 ? qgcPal.window : qgcPal.windowShade
anchors.top: parent.top height: Math.round(ScreenTools.defaultFontPixelHeight * 0.5 + field.height)
anchors.left: parent.left width: listview.width
anchors.right: parent.right
anchors.bottom: followTail.top Text {
anchors.bottomMargin: ScreenTools.defaultFontPixelWidth id: field
clip: true text: display
id: listview color: qgcPal.text
model: debugMessageModel width: parent.width
delegate: delegateItem wrapMode: Text.Wrap
} font.family: ScreenTools.normalFontFamily
anchors.verticalCenter: parent.verticalCenter
FileDialog { }
id: writeDialog }
folder: shortcuts.home }
nameFilters: ["Log files (*.txt)", "All Files (*)"]
selectExisting: false ListView {
title: "Select log save file" Component.onCompleted: {
onAccepted: { loaded = true
debugMessageModel.writeMessages(fileUrl); }
visible = false; anchors.top: parent.top
} anchors.left: parent.left
onRejected: visible = false anchors.right: parent.right
} anchors.bottom: followTail.top
anchors.bottomMargin: ScreenTools.defaultFontPixelWidth
Connections { clip: true
target: debugMessageModel id: listview
onWriteStarted: writeButton.enabled = false; model: debugMessageModel
onWriteFinished: writeButton.enabled = true; delegate: delegateItem
} }
QGCButton { FileDialog {
id: writeButton id: writeDialog
anchors.bottom: parent.bottom folder: shortcuts.home
anchors.left: parent.left nameFilters: [qsTr("Log files (*.txt)"), qsTr("All Files (*)")]
onClicked: writeDialog.visible = true selectExisting: false
text: "Save App Log" title: qsTr("Select log save file")
} onAccepted: {
debugMessageModel.writeMessages(fileUrl);
BusyIndicator { visible = false;
id: writeBusy }
anchors.bottom: writeButton.bottom onRejected: visible = false
anchors.left: writeButton.right }
height: writeButton.height
visible: !writeButton.enabled Connections {
} target: debugMessageModel
onWriteStarted: writeButton.enabled = false;
QGCButton { onWriteFinished: writeButton.enabled = true;
id: followTail }
anchors.bottom: parent.bottom
anchors.right: parent.right QGCButton {
text: "Show Latest" id: writeButton
checkable: true anchors.bottom: parent.bottom
checked: true anchors.left: parent.left
onClicked: writeDialog.visible = true
onCheckedChanged: { text: qsTr("Save App Log")
if (checked && loaded) { }
listview.positionViewAtEnd();
BusyIndicator {
id: writeBusy
anchors.bottom: writeButton.bottom
anchors.left: writeButton.right
height: writeButton.height
visible: !writeButton.enabled
}
QGCButton {
id: followTail
anchors.right: filterButton.left
anchors.rightMargin: ScreenTools.defaultFontPixelWidth
anchors.bottom: parent.bottom
text: qsTr("Show Latest")
checkable: true
checked: true
onCheckedChanged: {
if (checked && loaded) {
listview.positionViewAtEnd();
}
}
}
QGCButton {
id: filterButton
anchors.bottom: parent.bottom
anchors.right: parent.right
text: qsTr("Set logging")
onClicked: showDialog(filtersDialogComponent, qsTr("Turn on logging categories"), qgcView.showDialogDefaultWidth, StandardButton.Close)
} }
} }
} } // QGCViewPanel
} } // QGCView
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment