|
|
@ -15,16 +15,20 @@ import QGroundControl.Controls 1.0 |
|
|
|
import QGroundControl.Palette 1.0 |
|
|
|
import QGroundControl.Palette 1.0 |
|
|
|
import QGroundControl.ScreenTools 1.0 |
|
|
|
import QGroundControl.ScreenTools 1.0 |
|
|
|
|
|
|
|
|
|
|
|
Item { |
|
|
|
Drawer { |
|
|
|
anchors.fill: parent |
|
|
|
edge: Qt.RightEdge |
|
|
|
|
|
|
|
interactive: false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
property var dialogComponent |
|
|
|
|
|
|
|
property string dialogTitle |
|
|
|
|
|
|
|
property var dialogButtons: StandardButton.NoButton |
|
|
|
|
|
|
|
|
|
|
|
property real _defaultTextHeight: _textMeasure.contentHeight |
|
|
|
property real _defaultTextHeight: _textMeasure.contentHeight |
|
|
|
property real _defaultTextWidth: _textMeasure.contentWidth |
|
|
|
property real _defaultTextWidth: _textMeasure.contentWidth |
|
|
|
|
|
|
|
|
|
|
|
function setupDialogButtons() { |
|
|
|
function setupDialogButtons(buttons) { |
|
|
|
_acceptButton.visible = false |
|
|
|
_acceptButton.visible = false |
|
|
|
_rejectButton.visible = false |
|
|
|
_rejectButton.visible = false |
|
|
|
var buttons = mainWindowDialog.dialogButtons |
|
|
|
|
|
|
|
// Accept role buttons |
|
|
|
// Accept role buttons |
|
|
|
if (buttons & StandardButton.Ok) { |
|
|
|
if (buttons & StandardButton.Ok) { |
|
|
|
_acceptButton.text = qsTr("Ok") |
|
|
|
_acceptButton.text = qsTr("Ok") |
|
|
@ -81,18 +85,33 @@ Item { |
|
|
|
_rejectButton.text = qsTr("Abort") |
|
|
|
_rejectButton.text = qsTr("Abort") |
|
|
|
_rejectButton.visible = true |
|
|
|
_rejectButton.visible = true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (buttons & StandardButton.Cancel || buttons & StandardButton.Close || buttons & StandardButton.Discard || buttons & StandardButton.Abort || buttons & StandardButton.Ignore) { |
|
|
|
|
|
|
|
closePolicy = Popup.NoAutoClose; |
|
|
|
|
|
|
|
interactive = false; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
closePolicy = Popup.CloseOnEscape | Popup.CloseOnPressOutside; |
|
|
|
|
|
|
|
interactive = true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Connections { |
|
|
|
Connections { |
|
|
|
target: _dialogComponentLoader.item |
|
|
|
target: _dialogComponentLoader.item |
|
|
|
onHideDialog: { |
|
|
|
onHideDialog: { |
|
|
|
Qt.inputMethod.hide() |
|
|
|
Qt.inputMethod.hide() |
|
|
|
mainWindowDialog.close() |
|
|
|
close() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Component.onCompleted: setupDialogButtons(dialogButtons) |
|
|
|
|
|
|
|
|
|
|
|
QGCLabel { id: _textMeasure; text: "X"; visible: false } |
|
|
|
QGCLabel { id: _textMeasure; text: "X"; visible: false } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
background: Rectangle { |
|
|
|
|
|
|
|
color: qgcPal.windowShadeDark |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// This is the main dialog panel |
|
|
|
// This is the main dialog panel |
|
|
|
Item { |
|
|
|
Item { |
|
|
|
id: _dialogPanel |
|
|
|
id: _dialogPanel |
|
|
@ -103,9 +122,8 @@ Item { |
|
|
|
height: _acceptButton.visible ? _acceptButton.height : _rejectButton.height |
|
|
|
height: _acceptButton.visible ? _acceptButton.height : _rejectButton.height |
|
|
|
color: qgcPal.windowShade |
|
|
|
color: qgcPal.windowShade |
|
|
|
QGCLabel { |
|
|
|
QGCLabel { |
|
|
|
id: titleLabel |
|
|
|
|
|
|
|
x: _defaultTextWidth |
|
|
|
x: _defaultTextWidth |
|
|
|
text: mainWindowDialog.dialogTitle |
|
|
|
text: dialogTitle |
|
|
|
height: parent.height |
|
|
|
height: parent.height |
|
|
|
verticalAlignment: Text.AlignVCenter |
|
|
|
verticalAlignment: Text.AlignVCenter |
|
|
|
} |
|
|
|
} |
|
|
@ -136,7 +154,7 @@ Item { |
|
|
|
anchors.right: parent.right |
|
|
|
anchors.right: parent.right |
|
|
|
anchors.top: _spacer.bottom |
|
|
|
anchors.top: _spacer.bottom |
|
|
|
anchors.bottom: parent.bottom |
|
|
|
anchors.bottom: parent.bottom |
|
|
|
sourceComponent: mainWindowDialog.dialogComponent |
|
|
|
sourceComponent: dialogComponent |
|
|
|
focus: true |
|
|
|
focus: true |
|
|
|
property bool acceptAllowed: _acceptButton.visible |
|
|
|
property bool acceptAllowed: _acceptButton.visible |
|
|
|
property bool rejectAllowed: _rejectButton.visible |
|
|
|
property bool rejectAllowed: _rejectButton.visible |
|
|
|