diff --git a/src/QmlControls/AppMessages.qml b/src/QmlControls/AppMessages.qml index 75102314ddcda71b9ecf250ad7d0cefa7d079e4f..afcaae0eefd0c1e23106bfb29f064eba9e8851b1 100644 --- a/src/QmlControls/AppMessages.qml +++ b/src/QmlControls/AppMessages.qml @@ -26,115 +26,166 @@ import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.2 import QtQuick.Dialogs 1.2 +import QGroundControl 1.0 import QGroundControl.Palette 1.0 import QGroundControl.Controls 1.0 import QGroundControl.Controllers 1.0 import QGroundControl.ScreenTools 1.0 -Rectangle { - id: logwindow - anchors.fill: parent - anchors.margins: ScreenTools.defaultFontPixelWidth - color: qgcPal.window +QGCView { + id: qgcView + viewPanel: panel property bool loaded: false - QGCPalette { id: qgcPal } + QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled } - Connections { - target: debugMessageModel - - onDataChanged: { - // Keep the view in sync if the button is checked - if (loaded) { - if (followTail.checked) { - listview.positionViewAtEnd(); + Component { + id: filtersDialogComponent + + QGCViewDialog { + QGCFlickable { + anchors.fill: parent + contentHeight: categoryColumn.height + 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 { - color: index % 2 == 0 ? qgcPal.window : qgcPal.windowShade - height: Math.round(ScreenTools.defaultFontPixelHeight * 0.5 + field.height) - width: listview.width - - Text { - id: field - text: display - color: qgcPal.text - width: parent.width - wrapMode: Text.Wrap - font.family: ScreenTools.normalFontFamily - anchors.verticalCenter: parent.verticalCenter + id: logwindow + anchors.fill: parent + anchors.margins: ScreenTools.defaultFontPixelWidth + color: qgcPal.window + + Connections { + target: debugMessageModel + + onDataChanged: { + // Keep the view in sync if the button is checked + if (loaded) { + if (followTail.checked) { + listview.positionViewAtEnd(); + } + } + } } - } - } - ListView { - Component.onCompleted: { - loaded = true - } - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: followTail.top - anchors.bottomMargin: ScreenTools.defaultFontPixelWidth - clip: true - id: listview - model: debugMessageModel - delegate: delegateItem - } - - FileDialog { - id: writeDialog - folder: shortcuts.home - nameFilters: ["Log files (*.txt)", "All Files (*)"] - selectExisting: false - title: "Select log save file" - onAccepted: { - debugMessageModel.writeMessages(fileUrl); - visible = false; - } - onRejected: visible = false - } - - Connections { - target: debugMessageModel - onWriteStarted: writeButton.enabled = false; - onWriteFinished: writeButton.enabled = true; - } - - QGCButton { - id: writeButton - anchors.bottom: parent.bottom - anchors.left: parent.left - onClicked: writeDialog.visible = true - text: "Save App Log" - } - - BusyIndicator { - id: writeBusy - anchors.bottom: writeButton.bottom - anchors.left: writeButton.right - height: writeButton.height - visible: !writeButton.enabled - } - - QGCButton { - id: followTail - anchors.bottom: parent.bottom - anchors.right: parent.right - text: "Show Latest" - checkable: true - checked: true - - onCheckedChanged: { - if (checked && loaded) { - listview.positionViewAtEnd(); + Component { + id: delegateItem + Rectangle { + color: index % 2 == 0 ? qgcPal.window : qgcPal.windowShade + height: Math.round(ScreenTools.defaultFontPixelHeight * 0.5 + field.height) + width: listview.width + + Text { + id: field + text: display + color: qgcPal.text + width: parent.width + wrapMode: Text.Wrap + font.family: ScreenTools.normalFontFamily + anchors.verticalCenter: parent.verticalCenter + } + } + } + + ListView { + Component.onCompleted: { + loaded = true + } + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: followTail.top + anchors.bottomMargin: ScreenTools.defaultFontPixelWidth + clip: true + id: listview + model: debugMessageModel + delegate: delegateItem + } + + FileDialog { + id: writeDialog + folder: shortcuts.home + nameFilters: [qsTr("Log files (*.txt)"), qsTr("All Files (*)")] + selectExisting: false + title: qsTr("Select log save file") + onAccepted: { + debugMessageModel.writeMessages(fileUrl); + visible = false; + } + onRejected: visible = false + } + + Connections { + target: debugMessageModel + onWriteStarted: writeButton.enabled = false; + onWriteFinished: writeButton.enabled = true; + } + + QGCButton { + id: writeButton + anchors.bottom: parent.bottom + anchors.left: parent.left + onClicked: writeDialog.visible = true + text: qsTr("Save App Log") + } + + 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 +