Commit 355fb0b5 authored by Don Gagne's avatar Don Gagne

Move Search from Tools menu

parent 9f5ffd93
...@@ -51,8 +51,9 @@ QGCView { ...@@ -51,8 +51,9 @@ QGCView {
property bool _showRCToParam: !ScreenTools.isMobile && QGroundControl.multiVehicleManager.activeVehicle.px4Firmware property bool _showRCToParam: !ScreenTools.isMobile && QGroundControl.multiVehicleManager.activeVehicle.px4Firmware
ParameterEditorController { ParameterEditorController {
id: controller; id: controller;
factPanel: panel factPanel: panel
onShowErrorMessage: { onShowErrorMessage: {
showMessage(qsTr("Parameter Load Errors"), errorMsg, StandardButton.Ok) showMessage(qsTr("Parameter Load Errors"), errorMsg, StandardButton.Ok)
} }
...@@ -61,112 +62,99 @@ QGCView { ...@@ -61,112 +62,99 @@ QGCView {
QGCViewPanel { QGCViewPanel {
id: panel id: panel
anchors.fill: parent anchors.fill: parent
Column {
anchors.fill: parent //---------------------------------------------
spacing: ScreenTools.defaultFontPixelHeight * 0.25 //-- Header
//--------------------------------------------- Row {
//-- Header id: header
Item { anchors.left: parent.left
id: header anchors.right: parent.right
width: parent.width height: searchText.height + ScreenTools.defaultFontPixelHeight / 3
height: ScreenTools.defaultFontPixelHeight * 1.75 spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
text: qsTr("Search Results") QGCButton {
visible: _searchFilter anchors.top: searchText.top
font.weight: Font.DemiBold anchors.bottom: searchText.bottom
anchors.verticalCenter: parent.verticalCenter text: qsTr("Filter by:")
onClicked: {
_searchResults = controller.searchParametersForComponent(-1, searchText.text)
_searchFilter = true
} }
Item { }
id: groupTitle
visible: !_searchFilter QGCTextField {
width: ScreenTools.defaultFontPixelWidth * 25 id: searchText
anchors.verticalCenter: parent.verticalCenter }
QGCLabel {
text: qsTr("GROUPS") QGCButton {
font.weight: Font.DemiBold anchors.top: searchText.top
anchors.centerIn: parent anchors.bottom: searchText.bottom
} text: qsTr("Clear")
visible: _searchFilter
onClicked: {
searchText.text = ""
_searchFilter = false
hideDialog()
} }
QGCLabel { }
text: qsTr("%1 Parameters").arg(_currentGroup) } // Row - Header
visible: !_searchFilter
font.weight: Font.DemiBold QGCButton {
anchors.left: groupTitle.right anchors.top: header.top
anchors.leftMargin: ScreenTools.defaultFontPixelWidth anchors.bottom: header.bottom
anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right
text: qsTr("Tools")
visible: !_searchFilter
menu: Menu {
MenuItem {
text: qsTr("Refresh")
onTriggered: controller.refresh()
} }
QGCButton { MenuItem {
text: qsTr("Back") text: qsTr("Reset all to defaults")
visible: _searchFilter onTriggered: showDialog(resetToDefaultConfirmComponent, qsTr("Reset All"), qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Reset)
anchors.right: parent.right
height: ScreenTools.defaultFontPixelHeight * 1.75
onClicked: {
_searchFilter = false
hideDialog()
}
} }
QGCButton { MenuSeparator { }
text: qsTr("Tools") MenuItem {
visible: !_searchFilter text: qsTr("Load from file...")
anchors.right: parent.right onTriggered: {
height: ScreenTools.defaultFontPixelHeight * 1.75 if (ScreenTools.isMobile) {
menu: Menu { qgcView.showDialog(mobileFilePicker, qsTr("Select Parameter File"), qgcView.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel)
MenuItem { } else {
text: qsTr("Refresh") controller.loadFromFilePicker()
onTriggered: controller.refresh()
}
MenuItem {
text: qsTr("Reset all to defaults")
onTriggered: controller.resetAllToDefaults()
}
MenuItem {
text: qsTr("Search...")
onTriggered: showDialog(searchDialogComponent, qsTr("Parameter Search"), qgcView.showDialogDefaultWidth, StandardButton.Reset | StandardButton.Apply)
}
MenuSeparator { }
MenuItem {
text: qsTr("Load from file...")
onTriggered: {
if (ScreenTools.isMobile) {
qgcView.showDialog(mobileFilePicker, qsTr("Select Parameter File"), qgcView.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel)
} else {
controller.loadFromFilePicker()
}
}
}
MenuItem {
text: qsTr("Save to file...")
onTriggered: {
if (ScreenTools.isMobile) {
qgcView.showDialog(mobileFileSaver, qsTr("Save Parameter File"), qgcView.showDialogDefaultWidth, StandardButton.Save | StandardButton.Cancel)
} else {
controller.saveToFilePicker()
}
}
} }
MenuSeparator { visible: _showRCToParam } }
MenuItem { }
text: qsTr("Clear RC to Param") MenuItem {
onTriggered: controller.clearRCToParam() text: qsTr("Save to file...")
visible: _showRCToParam onTriggered: {
if (ScreenTools.isMobile) {
qgcView.showDialog(mobileFileSaver, qsTr("Save Parameter File"), qgcView.showDialogDefaultWidth, StandardButton.Save | StandardButton.Cancel)
} else {
controller.saveToFilePicker()
} }
} }
} }
MenuSeparator { visible: _showRCToParam }
MenuItem {
text: qsTr("Clear RC to Param")
onTriggered: controller.clearRCToParam()
visible: _showRCToParam
}
} }
Rectangle { }
color: __qgcPal.text
width: parent.width //---------------------------------------------
height: 1 //-- Contents
opacity: 0.1 Loader {
anchors.topMargin: -1 anchors.left: parent.left
} anchors.right: parent.right
//--------------------------------------------- anchors.top: header.bottom
//-- Contents anchors.bottom: parent.bottom
Loader { sourceComponent: _searchFilter ? searchResultsViewComponent: groupedViewComponent
width: parent.width
height: parent.height - header.height
sourceComponent: _searchFilter ? searchResultsViewComponent: groupedViewComponent
}
} }
} }
...@@ -313,7 +301,7 @@ QGCView { ...@@ -313,7 +301,7 @@ QGCView {
} }
Component.onCompleted: { Component.onCompleted: {
if(_rowWidth < factRow.width + ScreenTools.defaultFontPixelWidth) { if(_rowWidth < factRow.width + ScreenTools.defaultFontPixelWidth) {
_rowWidth = factRow.width + ScreenTools.defaultFontPixelWidth _rowWidth = factRow.width + ScreenTools.defaultFontPixelWidth
} }
} }
} }
...@@ -403,4 +391,21 @@ QGCView { ...@@ -403,4 +391,21 @@ QGCView {
onFilenameReturned: controller.saveToFile(filename) onFilenameReturned: controller.saveToFile(filename)
} }
} }
Component {
id: resetToDefaultConfirmComponent
QGCViewDialog {
function accept() {
controller.resetAllToDefaults()
hideDialog()
}
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: qsTr("Select Reset to reset all parameters to their defaults.")
}
}
}
} // QGCView } // QGCView
...@@ -46,7 +46,7 @@ public: ...@@ -46,7 +46,7 @@ public:
Q_INVOKABLE QStringList getGroupsForComponent(int componentId); Q_INVOKABLE QStringList getGroupsForComponent(int componentId);
Q_INVOKABLE QStringList getParametersForGroup(int componentId, QString group); Q_INVOKABLE QStringList getParametersForGroup(int componentId, QString group);
Q_INVOKABLE QStringList searchParametersForComponent(int componentId, const QString& searchText, bool searchInName, bool searchInDescriptions); Q_INVOKABLE QStringList searchParametersForComponent(int componentId, const QString& searchText, bool searchInName=true, bool searchInDescriptions=true);
Q_INVOKABLE void clearRCToParam(void); Q_INVOKABLE void clearRCToParam(void);
Q_INVOKABLE void saveToFilePicker(void); Q_INVOKABLE void saveToFilePicker(void);
......
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