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

Move Search from Tools menu

parent 9f5ffd93
......@@ -53,6 +53,7 @@ QGCView {
ParameterEditorController {
id: controller;
factPanel: panel
onShowErrorMessage: {
showMessage(qsTr("Parameter Load Errors"), errorMsg, StandardButton.Ok)
}
......@@ -61,55 +62,52 @@ QGCView {
QGCViewPanel {
id: panel
anchors.fill: parent
Column {
anchors.fill: parent
spacing: ScreenTools.defaultFontPixelHeight * 0.25
//---------------------------------------------
//-- Header
Item {
Row {
id: header
width: parent.width
height: ScreenTools.defaultFontPixelHeight * 1.75
QGCLabel {
text: qsTr("Search Results")
visible: _searchFilter
font.weight: Font.DemiBold
anchors.verticalCenter: parent.verticalCenter
}
Item {
id: groupTitle
visible: !_searchFilter
width: ScreenTools.defaultFontPixelWidth * 25
anchors.verticalCenter: parent.verticalCenter
QGCLabel {
text: qsTr("GROUPS")
font.weight: Font.DemiBold
anchors.centerIn: parent
anchors.left: parent.left
anchors.right: parent.right
height: searchText.height + ScreenTools.defaultFontPixelHeight / 3
spacing: ScreenTools.defaultFontPixelWidth
QGCButton {
anchors.top: searchText.top
anchors.bottom: searchText.bottom
text: qsTr("Filter by:")
onClicked: {
_searchResults = controller.searchParametersForComponent(-1, searchText.text)
_searchFilter = true
}
}
QGCLabel {
text: qsTr("%1 Parameters").arg(_currentGroup)
visible: !_searchFilter
font.weight: Font.DemiBold
anchors.left: groupTitle.right
anchors.leftMargin: ScreenTools.defaultFontPixelWidth
anchors.verticalCenter: parent.verticalCenter
QGCTextField {
id: searchText
}
QGCButton {
text: qsTr("Back")
anchors.top: searchText.top
anchors.bottom: searchText.bottom
text: qsTr("Clear")
visible: _searchFilter
anchors.right: parent.right
height: ScreenTools.defaultFontPixelHeight * 1.75
onClicked: {
searchText.text = ""
_searchFilter = false
hideDialog()
}
}
} // Row - Header
QGCButton {
anchors.top: header.top
anchors.bottom: header.bottom
anchors.right: parent.right
text: qsTr("Tools")
visible: !_searchFilter
anchors.right: parent.right
height: ScreenTools.defaultFontPixelHeight * 1.75
menu: Menu {
MenuItem {
text: qsTr("Refresh")
......@@ -117,11 +115,7 @@ QGCView {
}
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)
onTriggered: showDialog(resetToDefaultConfirmComponent, qsTr("Reset All"), qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Reset)
}
MenuSeparator { }
MenuItem {
......@@ -152,23 +146,17 @@ QGCView {
}
}
}
}
Rectangle {
color: __qgcPal.text
width: parent.width
height: 1
opacity: 0.1
anchors.topMargin: -1
}
//---------------------------------------------
//-- Contents
Loader {
width: parent.width
height: parent.height - header.height
anchors.left: parent.left
anchors.right: parent.right
anchors.top: header.bottom
anchors.bottom: parent.bottom
sourceComponent: _searchFilter ? searchResultsViewComponent: groupedViewComponent
}
}
}
//-- Parameter Groups
Component {
......@@ -403,4 +391,21 @@ QGCView {
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
......@@ -46,7 +46,7 @@ public:
Q_INVOKABLE QStringList getGroupsForComponent(int componentId);
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 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