AppMessages.qml 8.7 KB
Newer Older
1 2
/****************************************************************************
 *
Gus Grubba's avatar
Gus Grubba committed
3
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 5 6 7 8
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/
9

10 11
import QtQuick                  2.3
import QtQuick.Controls         1.2
12
import QtQuick.Controls.Styles  1.4
13
import QtQuick.Dialogs          1.2
14
import QtQuick.Layouts          1.12
15

16
import QGroundControl               1.0
17 18
import QGroundControl.Palette       1.0
import QGroundControl.Controls      1.0
19 20
import QGroundControl.FactSystem    1.0
import QGroundControl.FactControls  1.0
21 22 23
import QGroundControl.Controllers   1.0
import QGroundControl.ScreenTools   1.0

24 25
Item {
    id:         _root
Nate Weibley's avatar
Nate Weibley committed
26

27 28
    property bool loaded: false

29 30 31
    Component {
        id: filtersDialogComponent
        QGCViewDialog {
32
            QGCFlickable {
33 34
                anchors.fill: parent

35 36
                contentHeight:  categoryColumn.height
                clip:           true
37

38 39 40 41 42 43
                ColumnLayout {
                    anchors.fill: parent
                    RowLayout {
                        spacing: ScreenTools.defaultFontPixelHeight / 2
                        Layout.alignment: Qt.AlignVCenter
                        Layout.fillHeight: true
44 45
                        Layout.fillWidth: true

46 47 48
                        QGCLabel {
                            text: qsTr("Search:")
                        }
49

50 51 52 53 54 55
                        QGCTextField {
                            id: searchText
                            text: ""
                            Layout.fillWidth: true
                            enabled: true
                        }
56

57 58 59 60 61
                        QGCButton {
                            text: qsTr("Clear")
                            onClicked: searchText.text = ""
                        }
                    }
62

63 64 65 66 67 68 69
                    Row {
                        spacing:    ScreenTools.defaultFontPixelHeight / 2
                        QGCButton {
                            text: qsTr("Clear All")
                            onClicked: categoryRepeater.setAllLogs(false)
                        }
                    }
70 71 72

                    Column {
                        id:         categoryColumn
73 74
                        spacing:    ScreenTools.defaultFontPixelHeight / 2

75 76 77 78 79 80 81 82 83
                        Repeater {
                            id:     categoryRepeater
                            model:  QGroundControl.loggingCategories()

                            function setAllLogs(value) {
                                var logCategories = QGroundControl.loggingCategories()
                                for (var category of logCategories) {
                                    QGroundControl.setCategoryLoggingOn(category, value)
                                }
84
                                QGroundControl.updateLoggingFilterRules()
85 86 87 88 89 90 91 92 93 94 95 96 97
                                // Update model for repeater
                                categoryRepeater.model = undefined
                                categoryRepeater.model = QGroundControl.loggingCategories()
                            }

                            QGCCheckBox {
                                text:       modelData
                                visible:    searchText.text ? text.match(`(${searchText.text})`, "i") : true
                                checked:    QGroundControl.categoryLoggingOn(modelData)
                                onClicked:  {
                                    QGroundControl.setCategoryLoggingOn(modelData, checked)
                                    QGroundControl.updateLoggingFilterRules()
                                }
98 99 100
                            }
                        }
                    }
101 102
                }
            }
103