diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index a8df5dd55aa1c800b50fa4ed31037f99c22e2ecd..8283130f45de6acca27d867c67a637a867438727 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -36,6 +36,7 @@ src/QmlControls/QGCView.qml src/QmlControls/QGCViewPanel.qml src/QmlControls/QGCViewDialog.qml + src/QmlControls/QGCViewMessage.qml src/QmlControls/ParameterEditor.qml diff --git a/src/AutoPilotPlugins/PX4/AirframeComponent.qml b/src/AutoPilotPlugins/PX4/AirframeComponent.qml index 277458be031cc5cb28f7d99d2f150c7dd56a67e6..f169bf63c093aeec53eaba93018872b5d732235d 100644 --- a/src/AutoPilotPlugins/PX4/AirframeComponent.qml +++ b/src/AutoPilotPlugins/PX4/AirframeComponent.qml @@ -64,15 +64,11 @@ QGCView { Component { id: customConfigDialog - QGCLabel { + QGCViewMessage { id: customConfigPanel - anchors.fill: parent - wrapMode: Text.WordWrap - text: "Your vehicle is using a custom airframe configuration. " + - "This configuration can only be modified through the Parameter Editor.\n\n" + - "If you want to Reset your airframe configuration and select a standard configuration, click 'Reset' above." - - signal hideDialog + message: "Your vehicle is using a custom airframe configuration. " + + "This configuration can only be modified through the Parameter Editor.\n\n" + + "If you want to Reset your airframe configuration and select a standard configuration, click 'Reset' above." Fact { id: sys_autostart; name: "SYS_AUTOSTART" } diff --git a/src/QmlControls/QGCView.qml b/src/QmlControls/QGCView.qml index 001c2e59e7c1bbacce2ce404cd5cc5c446f6220d..6a61211c8efbed9ad9e474fe7111dff4aadbbcd1 100644 --- a/src/QmlControls/QGCView.qml +++ b/src/QmlControls/QGCView.qml @@ -44,11 +44,9 @@ Item { /// to go. signal completed - function __showDialog(component, title, charWidth, buttons) { + function __setupDialogButtons(buttons) { __acceptButton.visible = false __rejectButton.visible = false - __dialogCharWidth = charWidth - __dialogTitle = title // Accept role buttons if (buttons & StandardButton.Ok) { @@ -106,12 +104,31 @@ Item { __rejectButton.text = "Abort" __rejectButton.visible = true } + } + + function __showDialog(component, title, charWidth, buttons) { + __dialogCharWidth = charWidth + __dialogTitle = title + + __setupDialogButtons(buttons) __dialogComponent = component __viewPanel.enabled = false __dialogOverlay.visible = true } + function __showMessage(title, message, buttons) { + __dialogCharWidth = 50 + __dialogTitle = title + __messageDialogText = message + + __setupDialogButtons(buttons) + + __dialogComponent = __messageDialog + __viewPanel.enabled = false + __dialogOverlay.visible = true + } + function __hideDialog() { __dialogComponent = null __viewPanel.enabled = true @@ -130,6 +147,8 @@ Item { /// The title for the dialog panel property string __dialogTitle + property string __messageDialogText + property Component __dialogComponent Component.onCompleted: completed() @@ -137,8 +156,9 @@ Item { Connections { target: __viewPanel.item - onShowDialog: __showDialog(component, title, charWidth, buttons) - onHideDialog: __hideDialog() + onShowDialog: __showDialog(component, title, charWidth, buttons) + onShowMessage: __showMessage(title, message, buttons) + onHideDialog: __hideDialog() } Connections { @@ -230,4 +250,12 @@ Item { } } // Rectangle - Dialog panel } // Item - Dialog overlay + + Component { + id: __messageDialog + + QGCViewMessage { + message: __messageDialogText + } + } } \ No newline at end of file diff --git a/src/QmlControls/QGCViewMessage.qml b/src/QmlControls/QGCViewMessage.qml new file mode 100644 index 0000000000000000000000000000000000000000..303436df4c314010f626608987a72c51f46d38e0 --- /dev/null +++ b/src/QmlControls/QGCViewMessage.qml @@ -0,0 +1,41 @@ +/*===================================================================== + + QGroundControl Open Source Ground Control Station + + (c) 2009 - 2015 QGROUNDCONTROL PROJECT + + This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + + ======================================================================*/ + +/// @file +/// @author Don Gagne + +import QtQuick 2.3 +import QtQuick.Controls 1.3 + +import QGroundControl.Controls 1.0 +import QGroundControl.Palette 1.0 + +QGCViewDialog { + property string message + + QGCLabel { + anchors.fill: parent + wrapMode: Text.WordWrap + text: message + } +} diff --git a/src/QmlControls/QGCViewPanel.qml b/src/QmlControls/QGCViewPanel.qml index 3bf89d9e84660ee2d671337e8b1056af1d3604a2..de4a49bc4668f9f5e55ee5827c22b2285dd8a107 100644 --- a/src/QmlControls/QGCViewPanel.qml +++ b/src/QmlControls/QGCViewPanel.qml @@ -31,10 +31,11 @@ import QGroundControl.Palette 1.0 import QGroundControl.Controls 1.0 Rectangle { - QGCPalette { id: qgcPal; colorGroupEnabled: enabled } + property QGCPalette qgcPal: QGCPalette { colorGroupEnabled: enabled } signal showDialog(Component component, string title, int charWidth, int buttons) signal hideDialog + signal showMessage(string title, string message, int buttons) color: qgcPal.window } diff --git a/src/QmlControls/qmldir b/src/QmlControls/qmldir index 5c30f2a0d5b974f6ead3384828496b3546e9cae1..c158fd07b1d90f13cbd080addd453c2e207177b4 100644 --- a/src/QmlControls/qmldir +++ b/src/QmlControls/qmldir @@ -20,4 +20,5 @@ ViewWidget 1.0 ViewWidget.qml QGCView 1.0 QGCView.qml QGCViewPanel 1.0 QGCViewPanel.qml QGCViewDialog 1.0 QGCViewDialog.qml +QGCViewMessage 1.0 QGCViewMessage.qml