Commit f4548860 authored by Don Gagne's avatar Don Gagne

Merge pull request #3316 from DonLakeFlyer/ParamSearch

Move Search from Tools menu
parents 3e2699ee 355fb0b5
...@@ -53,6 +53,7 @@ QGCView { ...@@ -53,6 +53,7 @@ QGCView {
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,55 +62,52 @@ QGCView { ...@@ -61,55 +62,52 @@ QGCView {
QGCViewPanel { QGCViewPanel {
id: panel id: panel
anchors.fill: parent anchors.fill: parent
Column {
anchors.fill: parent
spacing: ScreenTools.defaultFontPixelHeight * 0.25
//--------------------------------------------- //---------------------------------------------
//-- Header //-- Header
Item { Row {
id: header id: header
width: parent.width anchors.left: parent.left
height: ScreenTools.defaultFontPixelHeight * 1.75 anchors.right: parent.right
QGCLabel { height: searchText.height + ScreenTools.defaultFontPixelHeight / 3
text: qsTr("Search Results") spacing: ScreenTools.defaultFontPixelWidth
visible: _searchFilter
font.weight: Font.DemiBold QGCButton {
anchors.verticalCenter: parent.verticalCenter anchors.top: searchText.top
} anchors.bottom: searchText.bottom
Item { text: qsTr("Filter by:")
id: groupTitle
visible: !_searchFilter onClicked: {
width: ScreenTools.defaultFontPixelWidth * 25 _searchResults = controller.searchParametersForComponent(-1, searchText.text)
anchors.verticalCenter: parent.verticalCenter _searchFilter = true
QGCLabel {
text: qsTr("GROUPS")
font.weight: Font.DemiBold
anchors.centerIn: parent
} }
} }
QGCLabel {
text: qsTr("%1 Parameters").arg(_currentGroup) QGCTextField {
visible: !_searchFilter id: searchText
font.weight: Font.DemiBold
anchors.left: groupTitle.right
anchors.leftMargin: ScreenTools.defaultFontPixelWidth
anchors.verticalCenter: parent.verticalCenter
} }
QGCButton { QGCButton {
text: qsTr("Back") anchors.top: searchText.top
anchors.bottom: searchText.bottom
text: qsTr("Clear")
visible: _searchFilter visible: _searchFilter
anchors.right: parent.right
height: ScreenTools.defaultFontPixelHeight * 1.75
onClicked: { onClicked: {
searchText.text = ""
_searchFilter = false _searchFilter = false
hideDialog() hideDialog()
} }
} }
} // Row - Header
QGCButton { QGCButton {
anchors.top: header.top
anchors.bottom: header.bottom
anchors.right: parent.right
text: qsTr("Tools") text: qsTr("Tools")
visible: !_searchFilter visible: !_searchFilter
anchors.right: parent.right
height: ScreenTools.defaultFontPixelHeight * 1.75
menu: Menu { menu: Menu {
MenuItem { MenuItem {
text: qsTr("Refresh") text: qsTr("Refresh")
...@@ -117,11 +115,7 @@ QGCView { ...@@ -117,11 +115,7 @@ QGCView {
} }
MenuItem { MenuItem {
text: qsTr("Reset all to defaults") text: qsTr("Reset all to defaults")
onTriggered: controller.resetAllToDefaults() onTriggered: showDialog(resetToDefaultConfirmComponent, qsTr("Reset All"), qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Reset)
}
MenuItem {
text: qsTr("Search...")
onTriggered: showDialog(searchDialogComponent, qsTr("Parameter Search"), qgcView.showDialogDefaultWidth, StandardButton.Reset | StandardButton.Apply)
} }
MenuSeparator { } MenuSeparator { }
MenuItem { MenuItem {
...@@ -152,23 +146,17 @@ QGCView { ...@@ -152,23 +146,17 @@ QGCView {
} }
} }
} }
}
Rectangle {
color: __qgcPal.text
width: parent.width
height: 1
opacity: 0.1
anchors.topMargin: -1
}
//--------------------------------------------- //---------------------------------------------
//-- Contents //-- Contents
Loader { Loader {
width: parent.width anchors.left: parent.left
height: parent.height - header.height anchors.right: parent.right
anchors.top: header.bottom
anchors.bottom: parent.bottom
sourceComponent: _searchFilter ? searchResultsViewComponent: groupedViewComponent sourceComponent: _searchFilter ? searchResultsViewComponent: groupedViewComponent
} }
} }
}
//-- Parameter Groups //-- Parameter Groups
Component { Component {
...@@ -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