Unverified Commit aa0d8af6 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #8738 from DonLakeFlyer/ToolStripCustomization

ToolStrip re-architecture for encapsulation and customization
parents 0aa64af1 1e6b994f
......@@ -659,6 +659,8 @@ HEADERS += \
src/QmlControls/RCToParamDialogController.h \
src/QmlControls/ScreenToolsController.h \
src/QmlControls/TerrainProfile.h \
src/QmlControls/ToolStripAction.h \
src/QmlControls/ToolStripActionList.h \
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.h \
src/Settings/ADSBVehicleManagerSettings.h \
src/Settings/AppSettings.h \
......@@ -867,6 +869,8 @@ SOURCES += \
src/QmlControls/RCToParamDialogController.cc \
src/QmlControls/ScreenToolsController.cc \
src/QmlControls/TerrainProfile.cc \
src/QmlControls/ToolStripAction.cc \
src/QmlControls/ToolStripActionList.cc \
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc \
src/Settings/ADSBVehicleManagerSettings.cc \
src/Settings/AppSettings.cc \
......
......@@ -204,12 +204,19 @@
<file alias="QGroundControl/FlightDisplay/FlyViewMissionCompleteDialog.qml">src/FlightDisplay/FlyViewMissionCompleteDialog.qml</file>
<file alias="QGroundControl/FlightDisplay/FlyViewPreFlightChecklistPopup.qml">src/FlightDisplay/FlyViewPreFlightChecklistPopup.qml</file>
<file alias="QGroundControl/FlightDisplay/FlyViewToolStrip.qml">src/FlightDisplay/FlyViewToolStrip.qml</file>
<file alias="QGroundControl/FlightDisplay/FlyViewToolStripActionList.qml">src/FlightDisplay/FlyViewToolStripActionList.qml</file>
<file alias="QGroundControl/FlightDisplay/FlyViewVideo.qml">src/FlightDisplay/FlyViewVideo.qml</file>
<file alias="QGroundControl/FlightDisplay/FlyViewWidgetLayer.qml">src/FlightDisplay/FlyViewWidgetLayer.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionActionList.qml">src/FlightDisplay/GuidedActionActionList.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionConfirm.qml">src/FlightDisplay/GuidedActionConfirm.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionList.qml">src/FlightDisplay/GuidedActionList.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionsController.qml">src/FlightDisplay/GuidedActionsController.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionLand.qml">src/FlightDisplay/GuidedActionLand.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionList.qml">src/FlightDisplay/GuidedActionList.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionTakeoff.qml">src/FlightDisplay/GuidedActionTakeoff.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionPause.qml">src/FlightDisplay/GuidedActionPause.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionRTL.qml">src/FlightDisplay/GuidedActionRTL.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedAltitudeSlider.qml">src/FlightDisplay/GuidedAltitudeSlider.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedToolStripAction.qml">src/FlightDisplay/GuidedToolStripAction.qml</file>
<file alias="QGroundControl/FlightDisplay/MultiVehicleList.qml">src/FlightDisplay/MultiVehicleList.qml</file>
<file alias="QGroundControl/FlightDisplay/MultiVehiclePanel.qml">src/FlightDisplay/MultiVehiclePanel.qml</file>
<file alias="QGroundControl/FlightDisplay/PreFlightBatteryCheck.qml">src/FlightDisplay/PreFlightBatteryCheck.qml</file>
......@@ -217,6 +224,7 @@
<file alias="QGroundControl/FlightDisplay/PreFlightRCCheck.qml">src/FlightDisplay/PreFlightRCCheck.qml</file>
<file alias="QGroundControl/FlightDisplay/PreFlightSensorsHealthCheck.qml">src/FlightDisplay/PreFlightSensorsHealthCheck.qml</file>
<file alias="QGroundControl/FlightDisplay/PreFlightSoundCheck.qml">src/FlightDisplay/PreFlightSoundCheck.qml</file>
<file alias="QGroundControl/FlightDisplay/PreFlightCheckListShowAction.qml">src/FlightDisplay/PreFlightCheckListShowAction.qml</file>
<file alias="QGroundControl/FlightDisplay/TerrainProgress.qml">src/FlightDisplay/TerrainProgress.qml</file>
<file alias="QGroundControl/FlightDisplay/VehicleWarnings.qml">src/FlightDisplay/VehicleWarnings.qml</file>
<file alias="QGroundControl/FlightDisplay/qmldir">src/QmlControls/QGroundControl/FlightDisplay/qmldir</file>
......
......@@ -27,10 +27,9 @@ Popup {
clip: true
}
property bool useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _enforceChecklist: useChecklist && QGroundControl.settingsManager.appSettings.enforceChecklist.rawValue
property bool _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length
property bool _enforceChecklist: _useChecklist && QGroundControl.settingsManager.appSettings.enforceChecklist.rawValue
property bool _checklistComplete: _activeVehicle && (_activeVehicle.checkListState === Vehicle.CheckListPassed)
on_ActiveVehicleChanged: _showPreFlightChecklistIfNeeded()
......
......@@ -7,103 +7,26 @@
*
****************************************************************************/
import QGroundControl 1.0
import QGroundControl.Controls 1.0
import QtQml.Models 2.12
import QGroundControl 1.0
import QGroundControl.Controls 1.0
import QGroundControl.FlightDisplay 1.0
ToolStrip {
title: qsTr("Fly")
id: _root
title: qsTr("Fly")
property var guidedActionsController
property var guidedActionList
property bool usePreFlightChecklist
signal displayPreFlightChecklist
property bool _anyActionAvailable: guidedActionsController.showStartMission || guidedActionsController.showResumeMission || guidedActionsController.showChangeAlt || guidedActionsController.showLandAbort
property var _actionModel: [
{
title: guidedActionsController.startMissionTitle,
text: guidedActionsController.startMissionMessage,
action: guidedActionsController.actionStartMission,
visible: guidedActionsController.showStartMission
},
{
title: guidedActionsController.continueMissionTitle,
text: guidedActionsController.continueMissionMessage,
action: guidedActionsController.actionContinueMission,
visible: guidedActionsController.showContinueMission
},
{
title: guidedActionsController.changeAltTitle,
text: guidedActionsController.changeAltMessage,
action: guidedActionsController.actionChangeAlt,
visible: guidedActionsController.showChangeAlt
},
{
title: guidedActionsController.landAbortTitle,
text: guidedActionsController.landAbortMessage,
action: guidedActionsController.actionLandAbort,
visible: guidedActionsController.showLandAbort
}
]
model: [
{
name: "Checklist",
iconSource: "/qmlimages/check.svg",
buttonVisible: usePreFlightChecklist,
buttonEnabled: usePreFlightChecklist && activeVehicle && !activeVehicle.armed,
},
{
name: guidedActionsController.takeoffTitle,
iconSource: "/res/takeoff.svg",
buttonVisible: guidedActionsController.showTakeoff || !guidedActionsController.showLand,
buttonEnabled: guidedActionsController.showTakeoff,
action: guidedActionsController.actionTakeoff
},
{
name: guidedActionsController.landTitle,
iconSource: "/res/land.svg",
buttonVisible: guidedActionsController.showLand && !guidedActionsController.showTakeoff,
buttonEnabled: guidedActionsController.showLand,
action: guidedActionsController.actionLand
},
{
name: guidedActionsController.rtlTitle,
iconSource: "/res/rtl.svg",
buttonVisible: true,
buttonEnabled: guidedActionsController.showRTL,
action: guidedActionsController.actionRTL
},
{
name: guidedActionsController.pauseTitle,
iconSource: "/res/pause-mission.svg",
buttonVisible: guidedActionsController.showPause,
buttonEnabled: guidedActionsController.showPause,
action: guidedActionsController.actionPause
},
{
name: qsTr("Action"),
iconSource: "/res/action.svg",
buttonVisible: _anyActionAvailable,
buttonEnabled: true,
action: -1
}
]
onClicked: {
if(index === 0) {
displayPreFlightChecklist()
} else {
guidedActionsController.closeAll()
var action = model[index].action
if (action === -1) {
guidedActionList.model = _actionModel
guidedActionList.visible = true
} else {
guidedActionsController.confirmAction(action)
}
}
FlyViewToolStripActionList {
id: flyViewToolStripActionList
onDisplayPreFlightChecklist: _root.displayPreFlightChecklist()
}
model: flyViewToolStripActionList.model
}
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QtQml.Models 2.12
import QGroundControl 1.0
import QGroundControl.Controls 1.0
ToolStripActionList {
signal displayPreFlightChecklist
model: [
PreFlightCheckListShowAction {
onTriggered: displayPreFlightChecklist()
},
GuidedActionTakeoff {
guidedController: guidedActionsController
},
GuidedActionLand {
guidedController: guidedActionsController
},
GuidedActionRTL {
guidedController: guidedActionsController
},
GuidedActionPause {
guidedController: guidedActionsController
},
GuidedActionActionList {
guidedController: guidedActionsController
}
]
}
......@@ -38,7 +38,7 @@ Item {
property var mapControl
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property var _planMasterController: mainWindow.planMasterControllerPlanView
property var _planMasterController: mainWindow.planMasterControllerFlyView
property var _missionController: _planMasterController.missionController
property var _geoFenceController: _planMasterController.geoFenceController
property var _rallyPointController: _planMasterController.rallyPointController
......@@ -115,7 +115,6 @@ Item {
maxHeight: parent.height - y - parentToolInsets.leftEdgeBottomInset - _toolsMargin
guidedActionsController: _guidedController
guidedActionList: _guidedActionList
usePreFlightChecklist: preFlightChecklistPopup.useChecklist
visible: !QGroundControl.videoManager.fullScreen
onDisplayPreFlightChecklist: preFlightChecklistPopup.open()
......
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QGroundControl.FlightDisplay 1.0
GuidedToolStripAction {
text: guidedController.actionListTitle
iconSource: "/res/action.svg"
visible: guidedController.showActionList
enabled: true
actionID: guidedController.actionActionList
}
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QGroundControl.FlightDisplay 1.0
GuidedToolStripAction {
text: guidedController.landTitle
message: guidedController.landMessage
iconSource: "/res/land.svg"
visible: guidedController.showLand && !guidedController.showTakeoff
enabled: guidedController.showLand
actionID: guidedController.actionLand
}
......@@ -14,6 +14,7 @@ import QtQuick.Layouts 1.2
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0
import QGroundControl.FlightDisplay 1.0
import QGroundControl.Palette 1.0
/// Dialog showing list of available guided actions
......@@ -28,12 +29,41 @@ Rectangle {
property var guidedController
property var altitudeSlider
property alias model: actionRepeater.model
function show() {
visible = true
}
property real _margins: Math.round(ScreenTools.defaultFontPixelHeight * 0.66)
property real _actionWidth: ScreenTools.defaultFontPixelWidth * 25
property real _actionHorizSpacing: ScreenTools.defaultFontPixelHeight * 2
property var _model: [
{
title: guidedController.startMissionTitle,
text: guidedController.startMissionMessage,
action: guidedController.actionStartMission,
visible: guidedController.showStartMission
},
{
title: guidedController.continueMissionTitle,
text: guidedController.continueMissionMessage,
action: guidedController.actionContinueMission,
visible: guidedController.showContinueMission
},
{
title: guidedController.changeAltTitle,
text: guidedController.changeAltMessage,
action: guidedController.actionChangeAlt,
visible: guidedController.showChangeAlt
},
{
title: guidedController.landAbortTitle,
text: guidedController.landAbortMessage,
action: guidedController.actionLandAbort,
visible: guidedController.showLandAbort
}
]
QGCPalette { id: qgcPal }
......@@ -67,7 +97,8 @@ Rectangle {
spacing: _actionHorizSpacing
Repeater {
id: actionRepeater
id: actionRepeater
model: _model
ColumnLayout {
spacing: ScreenTools.defaultFontPixelHeight / 2
......
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QGroundControl.FlightDisplay 1.0
GuidedToolStripAction {
text: guidedController.pauseTitle
iconSource: "/res/pause-mission.svg"
visible: guidedController.showPause
enabled: guidedController.showPause
actionID: guidedController.actionPause
}
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QGroundControl.FlightDisplay 1.0
GuidedToolStripAction {
text: guidedController.rtlTitle
iconSource: "/res/rtl.svg"
visible: true
enabled: guidedController.showRTL
actionID: guidedController.actionRTL
}
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QGroundControl.FlightDisplay 1.0
GuidedToolStripAction {
text: guidedController.takeoffTitle
iconSource: "/res/takeoff.svg"
visible: guidedController.showTakeoff || !guidedController.showLand
enabled: guidedController.showTakeoff
actionID: guidedController.actionTakeoff
}
......@@ -52,6 +52,7 @@ Item {
readonly property string gotoTitle: qsTr("Go To Location")
readonly property string vtolTransitionTitle: qsTr("VTOL Transition")
readonly property string roiTitle: qsTr("ROI")
readonly property string actionListTitle: qsTr("Action")
readonly property string armMessage: qsTr("Arm the vehicle.")
readonly property string disarmMessage: qsTr("Disarm the vehicle")
......@@ -95,6 +96,7 @@ Item {
readonly property int actionVtolTransitionToFwdFlight: 20
readonly property int actionVtolTransitionToMRFlight: 21
readonly property int actionROI: 22
readonly property int actionActionList: 23
property bool _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length
property bool _enforceChecklist: _useChecklist && QGroundControl.settingsManager.appSettings.enforceChecklist.rawValue
......@@ -114,6 +116,7 @@ Item {
property bool showROI: _guidedActionsEnabled && !_hideROI && _vehicleFlying && activeVehicle.roiModeSupported && !_missionActive
property bool showLandAbort: _guidedActionsEnabled && _vehicleFlying && _fixedWingOnApproach
property bool showGotoLocation: _guidedActionsEnabled && _vehicleFlying
property bool showActionList: _guidedActionsEnabled && (showStartMission || showResumeMission || showChangeAlt || showLandAbort)
// Note: The '_missionItemCount - 2' is a hack to not trigger resume mission when a mission ends with an RTL item
property bool showResumeMission: activeVehicle && !_vehicleArmed && _vehicleWasFlying && _missionAvailable && _resumeMissionIndex > 0 && (_resumeMissionIndex < _missionItemCount - 2)
......@@ -412,6 +415,9 @@ Item {
confirmDialog.message = roiMessage
confirmDialog.hideTrigger = Qt.binding(function() { return !showROI })
break;
case actionActionList:
actionList.show()
return
default:
console.warn("Unknown actionCode", actionCode)
return
......
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QGroundControl.Controls 1.0
ToolStripAction {
property var guidedController
property int actionID
property string message
onTriggered: {
guidedActionsController.closeAll()
guidedController.confirmAction(actionID)
}
}
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QGroundControl 1.0
import QGroundControl.Controls 1.0
ToolStripAction {
text: qsTr("Checklist")
iconSource: "/qmlimages/check.svg"
visible: _useChecklist
enabled: _useChecklist && _activeVehicle && !_activeVehicle.armed
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length
}
This diff is collapsed.
......@@ -106,6 +106,8 @@
#include "RCToParamDialogController.h"
#include "QGCImageProvider.h"
#include "TerrainProfile.h"
#include "ToolStripAction.h"
#include "ToolStripActionList.h"
#if defined(QGC_ENABLE_PAIRING)
#include "PairingManager.h"
......@@ -559,6 +561,8 @@ void QGCApplication::_initCommon()
qmlRegisterType<RCToParamDialogController> (kQGCControllers, 1, 0, "RCToParamDialogController");
qmlRegisterType<TerrainProfile> ("QGroundControl.Controls", 1, 0, "TerrainProfile");
qmlRegisterType<ToolStripAction> ("QGroundControl.Controls", 1, 0, "ToolStripAction");
qmlRegisterType<ToolStripActionList> ("QGroundControl.Controls", 1, 0, "ToolStripActionList");
#ifndef __mobile__
#ifndef NO_SERIAL_LINK
......
......@@ -40,8 +40,10 @@ Item {
property real _viewportMaxBottom: parent.parent.height - parent.y
property real _viewportMaxHeight: _viewportMaxBottom - _viewportMaxTop
property var _dropPanelCancel
property var _parentButton
function show(panelEdgeTopPoint, panelComponent) {
function show(panelEdgeTopPoint, panelComponent, parentButton) {
_parentButton = parentButton
_dropEdgeTopPoint = panelEdgeTopPoint
_dropDownComponent = panelComponent
_calcPositions()
......@@ -52,13 +54,9 @@ Item {
function hide() {
if (_dropPanelCancel) {
_dropPanelCancel.destroy()
}
if (visible) {
_parentButton.checked = false
visible = false
_dropDownComponent = undefined
if (toolStrip.lastClickedButton) {
toolStrip.lastClickedButton.checked = false
}
}
}
......
......@@ -9,12 +9,19 @@ FlyViewMap 1.0 FlyViewMap.qml
FlyViewMissionCompleteDialog 1.0 FlyViewMissionCompleteDialog.qml
FlyViewPreFlightChecklistPopup 1.0 FlyViewPreFlightChecklistPopup.qml
FlyViewToolStrip 1.0 FlyViewToolStrip.qml
FlyViewToolStripActionList 1.0 FlyViewToolStripActionList.qml
FlyViewVideo 1.0 FlyViewVideo.qml
FlyViewWidgetLayer 1.0 FlyViewWidgetLayer.qml
GuidedActionActionList 1.0 GuidedActionActionList.qml
GuidedActionConfirm 1.0 GuidedActionConfirm.qml
GuidedActionList 1.0 GuidedActionList.qml
GuidedActionsController 1.0 GuidedActionsController.qml
GuidedActionLand 1.0 GuidedActionLand.qml
GuidedActionList 1.0 GuidedActionList.qml
GuidedActionPause 1.0 GuidedActionPause.qml
GuidedActionRTL 1.0 GuidedActionRTL.qml
GuidedAltitudeSlider 1.0 GuidedAltitudeSlider.qml
GuidedActionTakeoff 1.0 GuidedActionTakeoff.qml
GuidedToolStripAction 1.0 GuidedToolStripAction.qml
MultiVehicleList 1.0 MultiVehicleList.qml
MultiVehiclePanel 1.0 MultiVehiclePanel.qml
PreFlightBatteryCheck 1.0 PreFlightBatteryCheck.qml
......
......@@ -26,35 +26,16 @@ Rectangle {
property real maxHeight ///< Maximum height for control, determines whether text is hidden to make control shorter
property alias title: titleLabel.text
property AbstractButton lastClickedButton: null
function simulateClick(buttonIndex) {
buttonIndex = buttonIndex + 1 // skip over title
if (!toolStripColumn.children[buttonIndex].checked) {
toolStripColumn.children[buttonIndex].checked = true
toolStripColumn.children[buttonIndex].clicked()
}
toolStripColumn.children[buttonIndex].clicked()
}
// Ensure we don't get narrower than content
property real _idealWidth: (ScreenTools.isMobile ? ScreenTools.minTouchPixels : ScreenTools.defaultFontPixelWidth * 8) + toolStripColumn.anchors.margins * 2
signal clicked(int index, bool checked)
signal dropped(int index)
function setChecked(idx, check) {
repeater.itemAt(idx).checked = check
}
function getChecked(idx) {
return repeater.itemAt(idx).checked
}
ButtonGroup {
id: buttonGroup
buttons: toolStripColumn.children
}
DeadMouseArea {
anchors.fill: parent
}
......@@ -98,27 +79,25 @@ Rectangle {
fontPointSize: ScreenTools.smallFontPointSize
autoExclusive: true
enabled: modelData.buttonEnabled
visible: modelData.buttonVisible
enabled: modelData.enabled
visible: modelData.visible
imageSource: modelData.showAlternateIcon ? modelData.alternateIconSource : modelData.iconSource
text: modelData.name
checked: modelData.checked !== undefined ? modelData.checked : checked
text: modelData.text
checked: modelData.checked
checkable: modelData.dropPanelComponent || modelData.checkable
ButtonGroup.group: buttonGroup
// Only drop panel and toggleable are checkable
checkable: modelData.dropPanelComponent !== undefined || (modelData.toggle !== undefined && modelData.toggle)
onCheckedChanged: modelData.checked = checked
onClicked: {
dropPanel.hide() // DropPanel will call hide on "lastClickedButton"
if (modelData.dropPanelComponent === undefined) {
_root.clicked(index, checked)
dropPanel.hide()
if (!modelData.dropPanelComponent) {
modelData.triggered(this)
} else if (checked) {
var panelEdgeTopPoint = mapToItem(_root, width, 0)
dropPanel.show(panelEdgeTopPoint, modelData.dropPanelComponent)
dropPanel.show(panelEdgeTopPoint, modelData.dropPanelComponent, this)
checked = true
_root.dropped(index)
}
if(_root && buttonTemplate)
_root.lastClickedButton = buttonTemplate
}
}
}
......
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#include "ToolStripAction.h"
ToolStripAction::ToolStripAction(QObject* parent)
: QObject(parent)
{
}
void ToolStripAction::setEnabled(bool enabled)
{
if (enabled != _enabled) {
_enabled = enabled;
emit enabledChanged(enabled);
}
}
void ToolStripAction::setVisible(bool visible)
{
if (visible != _visible) {
_visible = visible;
emit visibleChanged(visible);
}
}
void ToolStripAction::setCheckable(bool checkable)
{
if (checkable != _checkable) {
_checkable = checkable;
emit checkableChanged(checkable);
}
}
void ToolStripAction::setChecked(bool checked)
{
if (checked != _checked) {
_checked = checked;
emit checkedChanged(checked);
}
}
void ToolStripAction::setShowAlternateIcon(bool showAlternateIcon)
{
if (showAlternateIcon != _showAlternateIcon) {
_showAlternateIcon = showAlternateIcon;
emit showAlternateIconChanged(showAlternateIcon);
}
}
void ToolStripAction::setText(const QString& text)
{
if (text != _text) {
_text = text;
emit textChanged(text);
}
}
void ToolStripAction::setIconSource(const QString& iconSource)
{
if (iconSource != _iconSource) {
_iconSource = iconSource;
emit iconSourceChanged(iconSource);
}
}
void ToolStripAction::setAlternateIconSource(const QString& alternateIconSource)
{
if (alternateIconSource != _alternateIconSource) {
_alternateIconSource = alternateIconSource;
emit alternateIconSourceChanged(alternateIconSource);
}
}
void ToolStripAction::setDropPanelComponent(QQmlComponent* dropPanelComponent)
{
_dropPanelComponent = dropPanelComponent;
emit dropPanelComponentChanged();
}
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.