Commit ac08dd5a authored by DoinLakeFlyer's avatar DoinLakeFlyer

parent f48f8c8c
......@@ -177,6 +177,7 @@
<file alias="QGroundControl/Controls/SurveyMapVisual.qml">src/PlanView/SurveyMapVisual.qml</file>
<file alias="QGroundControl/Controls/TerrainStatus.qml">src/PlanView/TerrainStatus.qml</file>
<file alias="QGroundControl/Controls/TakeoffItemMapVisual.qml">src/PlanView/TakeoffItemMapVisual.qml</file>
<file alias="QGroundControl/Controls/ToolBarBase.qml">src/ui/toolbar/ToolBarBase.qml</file>
<file alias="QGroundControl/Controls/ToolStrip.qml">src/QmlControls/ToolStrip.qml</file>
<file alias="QGroundControl/Controls/TransectStyleComplexItemStats.qml">src/PlanView/TransectStyleComplexItemStats.qml</file>
<file alias="QGroundControl/Controls/VehicleRotationCal.qml">src/QmlControls/VehicleRotationCal.qml</file>
......
......@@ -217,20 +217,31 @@ bool ArduSubFirmwarePlugin::supportsMotorInterference(void)
return false;
}
const QVariantList& ArduSubFirmwarePlugin::toolBarIndicators(const Vehicle* vehicle)
const QVariantList& ArduSubFirmwarePlugin::toolIndicators(const Vehicle* vehicle)
{
Q_UNUSED(vehicle);
//-- Sub specific list of indicators (Enter your modified list here)
if(_toolBarIndicators.size() == 0) {
_toolBarIndicators = QVariantList({
if(_toolIndicators.size() == 0) {
_toolIndicators = QVariantList({
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/MessageIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/BatteryIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/JoystickIndicator.qml")),
});
}
return _toolIndicators;
}
const QVariantList& ArduSubFirmwarePlugin::modeIndicators(const Vehicle* vehicle)
{
Q_UNUSED(vehicle);
//-- Sub specific list of indicators (Enter your modified list here)
if(_modeIndicators.size() == 0) {
_modeIndicators = QVariantList({
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/ModeIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/ArmedIndicator.qml")),
});
}
return _toolBarIndicators;
return _modeIndicators;
}
void ArduSubFirmwarePlugin::_handleNamedValueFloat(mavlink_message_t* message)
......
......@@ -136,14 +136,16 @@ public:
QString brandImageOutdoor(const Vehicle* vehicle) const final { Q_UNUSED(vehicle); return QStringLiteral("/qmlimages/APM/BrandImageSub"); }
const FirmwarePlugin::remapParamNameMajorVersionMap_t& paramNameRemapMajorVersionMap(void) const final { return _remapParamName; }
int remapParamNameHigestMinorVersionNumber(int majorVersionNumber) const final;
const QVariantList& toolBarIndicators(const Vehicle* vehicle) final;
const QVariantList& toolIndicators(const Vehicle* vehicle) final;
const QVariantList& modeIndicators(const Vehicle* vehicle) final;
bool adjustIncomingMavlinkMessage(Vehicle* vehicle, mavlink_message_t* message) final;
virtual QMap<QString, FactGroup*>* factGroups(void) final;
void adjustMetaData(MAV_TYPE vehicleType, FactMetaData* metaData) override final;
private:
QVariantList _toolBarIndicators;
QVariantList _toolIndicators;
QVariantList _modeIndicators;
static bool _remapParamNameIntialized;
QMap<QString, QString> _factRenameMap;
static FirmwarePlugin::remapParamNameMajorVersionMap_t _remapParamName;
......
......@@ -304,17 +304,26 @@ QString FirmwarePlugin::vehicleImageCompass(const Vehicle*) const
return QStringLiteral("/qmlimages/compassInstrumentArrow.svg");
}
const QVariantList &FirmwarePlugin::toolBarIndicators(const Vehicle*)
const QVariantList& FirmwarePlugin::toolIndicators(const Vehicle*)
{
//-- Default list of indicators for all vehicles.
if(_toolBarIndicatorList.size() == 0) {
_toolBarIndicatorList = QVariantList({
if(_toolIndicatorList.size() == 0) {
_toolIndicatorList = QVariantList({
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/MessageIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/GPSIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/TelemetryRSSIIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/RCRSSIIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/BatteryIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/GPSRTKIndicator.qml")),
});
}
return _toolIndicatorList;
}
const QVariantList& FirmwarePlugin::modeIndicators(const Vehicle*)
{
//-- Default list of indicators for all vehicles.
if(_modeIndicatorList.size() == 0) {
_modeIndicatorList = QVariantList({
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/ROIIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/ArmedIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/ModeIndicator.qml")),
......@@ -323,7 +332,7 @@ const QVariantList &FirmwarePlugin::toolBarIndicators(const Vehicle*)
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/LinkIndicator.qml")),
});
}
return _toolBarIndicatorList;
return _modeIndicatorList;
}
const QVariantList& FirmwarePlugin::cameraList(const Vehicle*)
......
......@@ -267,10 +267,15 @@ public:
/// Return the resource file which contains the vehicle icon used in the compass
virtual QString vehicleImageCompass(const Vehicle* vehicle) const;
/// Allows the core plugin to override the toolbar indicators
/// signals toolbarIndicatorsChanged
/// @return A list of QUrl with the indicators (see MainToolBarIndicators.qml)
virtual const QVariantList& toolBarIndicators(const Vehicle* vehicle);
/// Returns the list of toolbar tool indicators associated with a vehicle
/// signals toolIndicatorsChanged
/// @return A list of QUrl with the indicators
virtual const QVariantList& toolIndicators(const Vehicle* vehicle);
/// Returns the list of toolbar mode indicators associated with a vehicle
/// signals modeIndicatorsChanged
/// @return A list of QUrl with the indicators
virtual const QVariantList& modeIndicators(const Vehicle* vehicle);
/// Returns a list of CameraMetaData objects for available cameras on the vehicle.
/// TODO: This should go into QGCCameraManager
......@@ -330,7 +335,8 @@ public:
static const QString px4FollowMeFlightMode;
signals:
void toolbarIndicatorsChanged(void);
void toolIndicatorsChanged(void);
void modeIndicatorsChanged(void);
protected:
// Arms the vehicle with validation and retries
......@@ -351,7 +357,9 @@ protected:
virtual QString _versionRegex() { return QString(); }
private:
QVariantList _toolBarIndicatorList;
QVariantList _toolIndicatorList;
QVariantList _modeIndicatorList;
static QVariantList _cameraList; ///< Standard QGC camera list
};
......
......@@ -34,8 +34,8 @@ import QGroundControl.Vehicle 1.0
Item {
id: _root
property var parentToolInsets // These insets tell you what screen real estate is available for positioning the controls in your overlay
property var toolInsets: _toolInsets // These are the insets for your custom overlay additions
property var parentToolInsets // These insets tell you what screen real estate is available for positioning the controls in your overlay
property var totalToolInsets: _toolInsets // These are the insets for your custom overlay additions
property var mapControl
QGCToolInsets {
......
......@@ -41,8 +41,8 @@ FlightMap {
property var guidedActionsController
property var rightPanelWidth
property var planMasterController
property bool pipMode: false // true: map is shown in a small pip mode
property var toolInsets // Insets for the center viewport area
property bool pipMode: false // true: map is shown in a small pip mode
property var toolInsets // Insets for the center viewport area
property var _planMasterController: planMasterController
property var _geoFenceController: planMasterController.geoFenceController
......
......@@ -33,9 +33,9 @@ import QGroundControl.Vehicle 1.0
Item {
id: _root
property var parentToolInsets
property var totalToolInsets: _totalToolInsets
property var mapControl
property var parentToolInsets
property var totalToolInsets: _totalToolInsets
property var mapControl
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property var _planMasterController: mainWindow.planMasterControllerPlanView
......
......@@ -32,7 +32,6 @@ Rectangle {
id: settingsButton
Layout.fillHeight: true
icon.source: "/qmlimages/PaperPlane.svg"
logo: true
checked: false
onClicked: {
checked = false
......
......@@ -11,7 +11,7 @@ import QGroundControl.Palette 1.0
// Toolbar for Plan View
Item {
anchors.fill: parent
width: missionStats.width + _margins
property var _planMasterController: mainWindow.planMasterControllerPlanView
property var _currentMissionItem: mainWindow.currentPlanMissionItem ///< Mission item to display status for
......@@ -109,11 +109,9 @@ Item {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.leftMargin: _margins
anchors.rightMargin: _margins
anchors.left: parent.left
anchors.right: uploadButton.visible ? uploadButton.left : parent.right
columnSpacing: 0
columns: 3
columns: 4
GridLayout {
columns: 8
......@@ -226,37 +224,25 @@ Item {
}
Item { width: 1; height: 1 }
/*
FIXME: Swap point display is currently hidden since the code which calcs it doesn't work correctly
QGCLabel { text: qsTr("Swap waypoint:"); font.pointSize: _dataFontSize; }
QGCLabel {
text: _batteryChangePointText
font.pointSize: _dataFontSize
Layout.minimumWidth: _mediumValueWidth
}
*/
}
}
QGCButton {
id: uploadButton
anchors.rightMargin: _margins
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
text: _controllerDirty ? qsTr("Upload Required") : qsTr("Upload")
enabled: !_controllerSyncInProgress
visible: !_controllerOffline && !_controllerSyncInProgress && !uploadCompleteText.visible
primary: _controllerDirty
onClicked: _planMasterController.upload()
PropertyAnimation on opacity {
easing.type: Easing.OutQuart
from: 0.5
to: 1
loops: Animation.Infinite
running: _controllerDirty && !_controllerSyncInProgress
alwaysRunToEnd: true
duration: 2000
QGCButton {
id: uploadButton
text: _controllerDirty ? qsTr("Upload Required") : qsTr("Upload")
enabled: !_controllerSyncInProgress
visible: !_controllerOffline && !_controllerSyncInProgress && !uploadCompleteText.visible
primary: _controllerDirty
onClicked: _planMasterController.upload()
PropertyAnimation on opacity {
easing.type: Easing.OutQuart
from: 0.5
to: 1
loops: Animation.Infinite
running: _controllerDirty && !_controllerSyncInProgress
alwaysRunToEnd: true
duration: 2000
}
}
}
......@@ -277,16 +263,6 @@ Item {
}
}
/*
Rectangle {
anchors.bottom: parent.bottom
height: toolBar.height * 0.05
width: activeVehicle ? activeVehicle.parameterManager.loadProgress * parent.width : 0
color: qgcPal.colorGreen
visible: !largeProgressBar.visible
}
*/
// Large mission download progress bar
Rectangle {
id: largeProgressBar
......
......@@ -32,7 +32,7 @@ Button {
background: Rectangle {
anchors.fill: parent
color: logo ? qgcPal.brandingPurple : (button.checked ? qgcPal.buttonHighlight : Qt.rgba(0,0,0,0))
color: button.checked ? qgcPal.buttonHighlight : Qt.rgba(0,0,0,0)
}
contentItem: Row {
......@@ -44,7 +44,7 @@ Button {
width: height
sourceSize.height: parent.height
fillMode: Image.PreserveAspectFit
color: logo ? "white" : (button.checked ? qgcPal.buttonHighlightText : qgcPal.buttonText)
color: logo ? "transparent" : (button.checked ? qgcPal.buttonHighlightText : qgcPal.buttonText)
source: button.icon.source
anchors.verticalCenter: parent.verticalCenter
}
......
......@@ -99,6 +99,7 @@ SurveyMapVisuals 1.0 SurveyMapVisuals.qml
TerrainStatus 1.0 TerrainStatus.qml
TransectStyleComplexItemStats 1.0 TransectStyleComplexItemStats.qml
TransectStyleMapVisuals 1.0 TransectStyleMapVisuals.qml
ToolBarBase 1.0 ToolBarBase.qml
ToolStrip 1.0 ToolStrip.qml
VehicleRotationCal 1.0 VehicleRotationCal.qml
VehicleSummaryRow 1.0 VehicleSummaryRow.qml
......
......@@ -414,8 +414,8 @@ Vehicle::Vehicle(MAV_AUTOPILOT firmwareType,
, _flightDistanceFact (0, _flightDistanceFactName, FactMetaData::valueTypeDouble)
, _flightTimeFact (0, _flightTimeFactName, FactMetaData::valueTypeElapsedTimeInSeconds)
, _distanceToHomeFact (0, _distanceToHomeFactName, FactMetaData::valueTypeDouble)
, _headingToNextWPFact (0, _headingToNextWPFactName, FactMetaData::valueTypeDouble)
, _missionItemIndexFact (0, _missionItemIndexFactName, FactMetaData::valueTypeUint16)
, _headingToNextWPFact (0, _headingToNextWPFactName, FactMetaData::valueTypeDouble)
, _headingToHomeFact (0, _headingToHomeFactName, FactMetaData::valueTypeDouble)
, _distanceToGCSFact (0, _distanceToGCSFactName, FactMetaData::valueTypeDouble)
, _hobbsFact (0, _hobbsFactName, FactMetaData::valueTypeString)
......@@ -446,7 +446,8 @@ void Vehicle::_commonInit()
{
_firmwarePlugin = _firmwarePluginManager->firmwarePluginForAutopilot(_firmwareType, _vehicleType);
connect(_firmwarePlugin, &FirmwarePlugin::toolbarIndicatorsChanged, this, &Vehicle::toolBarIndicatorsChanged);
connect(_firmwarePlugin, &FirmwarePlugin::toolIndicatorsChanged, this, &Vehicle::toolIndicatorsChanged);
connect(_firmwarePlugin, &FirmwarePlugin::modeIndicatorsChanged, this, &Vehicle::modeIndicatorsChanged);
connect(this, &Vehicle::coordinateChanged, this, &Vehicle::_updateDistanceHeadingToHome);
connect(this, &Vehicle::coordinateChanged, this, &Vehicle::_updateDistanceToGCS);
......@@ -3902,10 +3903,19 @@ QString Vehicle::vehicleImageCompass() const
return QString();
}
const QVariantList& Vehicle::toolBarIndicators()
const QVariantList& Vehicle::toolIndicators()
{
if(_firmwarePlugin) {
return _firmwarePlugin->toolIndicators(this);
}
static QVariantList emptyList;
return emptyList;
}
const QVariantList& Vehicle::modeIndicators()
{
if(_firmwarePlugin) {
return _firmwarePlugin->toolBarIndicators(this);
return _firmwarePlugin->modeIndicators(this);
}
static QVariantList emptyList;
return emptyList;
......
......@@ -615,7 +615,8 @@ public:
Q_PROPERTY(unsigned int telemetryTXBuffer READ telemetryTXBuffer NOTIFY telemetryTXBufferChanged)
Q_PROPERTY(int telemetryLNoise READ telemetryLNoise NOTIFY telemetryLNoiseChanged)
Q_PROPERTY(int telemetryRNoise READ telemetryRNoise NOTIFY telemetryRNoiseChanged)
Q_PROPERTY(QVariantList toolBarIndicators READ toolBarIndicators NOTIFY toolBarIndicatorsChanged)
Q_PROPERTY(QVariantList toolIndicators READ toolIndicators NOTIFY toolIndicatorsChanged)
Q_PROPERTY(QVariantList modeIndicators READ modeIndicators NOTIFY modeIndicatorsChanged)
Q_PROPERTY(bool initialPlanRequestComplete READ initialPlanRequestComplete NOTIFY initialPlanRequestCompleteChanged)
Q_PROPERTY(QVariantList staticCameraList READ staticCameraList CONSTANT)
Q_PROPERTY(QGCCameraManager* dynamicCameras READ dynamicCameras NOTIFY dynamicCamerasChanged)
......@@ -1086,7 +1087,8 @@ public:
QString vehicleImageOutline () const;
QString vehicleImageCompass () const;
const QVariantList& toolBarIndicators ();
const QVariantList& toolIndicators ();
const QVariantList& modeIndicators ();
const QVariantList& staticCameraList () const;
bool capabilitiesKnown () const { return _capabilityBitsKnown; }
......@@ -1160,7 +1162,8 @@ signals:
void capabilitiesKnownChanged (bool capabilitiesKnown);
void initialPlanRequestCompleteChanged(bool initialPlanRequestComplete);
void capabilityBitsChanged (uint64_t capabilityBits);
void toolBarIndicatorsChanged ();
void toolIndicatorsChanged ();
void modeIndicatorsChanged ();
void highLatencyLinkChanged (bool highLatencyLink);
void priorityLinkNameChanged (const QString& priorityLinkName);
void linksChanged ();
......
......@@ -516,8 +516,18 @@ QString QGCCorePlugin::stableVersionCheckFileUrl() const
#endif
}
QStringList
QGCCorePlugin::startupPages()
QStringList QGCCorePlugin::startupPages()
{
return { "/qml/QGroundControl/Specific/UnitsWizardPage.qml" };
}
const QVariantList &QGCCorePlugin::toolBarIndicators(void)
{
//-- Default list of indicators for all vehicles.
if(_toolBarIndicatorList.size() == 0) {
_toolBarIndicatorList = QVariantList({
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/GPSRTKIndicator.qml")),
});
}
return _toolBarIndicatorList;
}
......@@ -58,7 +58,7 @@ public:
Q_PROPERTY(QString brandImageOutdoor READ brandImageOutdoor CONSTANT)
Q_PROPERTY(QmlObjectListModel* customMapItems READ customMapItems CONSTANT)
Q_PROPERTY(QStringList startupPages READ startupPages NOTIFY startupPagesChanged)
Q_PROPERTY(QVariantList toolBarIndicators READ toolBarIndicators NOTIFY toolBarIndicatorsChanged)
Q_INVOKABLE bool guidedActionsControllerLogging() const;
......@@ -172,6 +172,11 @@ public:
/// @return QML files paths that will be loaded using the StartupWizard control
virtual QStringList startupPages();
/// Returns the list of toolbar indicators which are not related to a vehicle
/// signals toolbarIndicatorsChanged
/// @return A list of QUrl with the indicators
virtual const QVariantList& toolBarIndicators(void);
bool showTouchAreas() const { return _showTouchAreas; }
bool showAdvancedUI() const { return _showAdvancedUI; }
void setShowTouchAreas(bool show);
......@@ -181,12 +186,13 @@ public:
void setToolbox (QGCToolbox* toolbox);
signals:
void settingsPagesChanged ();
void analyzePagesChanged ();
void instrumentPagesChanged ();
void showTouchAreasChanged (bool showTouchAreas);
void showAdvancedUIChanged (bool showAdvancedUI);
void startupPagesChanged ();
void settingsPagesChanged ();
void analyzePagesChanged ();
void instrumentPagesChanged ();
void showTouchAreasChanged (bool showTouchAreas);
void showAdvancedUIChanged (bool showAdvancedUI);
void startupPagesChanged ();
void toolBarIndicatorsChanged ();
protected slots:
void _activeVehicleChanged (Vehicle* activeVehicle);
......@@ -203,6 +209,7 @@ protected:
Vehicle* _activeVehicle = nullptr;
QGCCameraManager* _dynamicCameras = nullptr;
QGCCameraControl* _currentCamera = nullptr;
QVariantList _toolBarIndicatorList;
private:
QGCCorePlugin_p* _p;
......
......@@ -21,16 +21,6 @@ QGCOptions::QGCOptions(QObject* parent)
QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
}
QUrl QGCOptions::mainToolbarUrl() const
{
return QUrl(QStringLiteral("qrc:/toolbar/MainToolBar.qml"));
}
QUrl QGCOptions::planToolbarUrl() const
{
return QUrl(QStringLiteral("qrc:/qml/PlanToolBar.qml"));
}
QColor QGCOptions::toolbarBackgroundLight() const
{
return QColor(255,255,255,204);
......@@ -41,11 +31,6 @@ QColor QGCOptions::toolbarBackgroundDark() const
return QColor(0,0,0,192);
}
QUrl QGCOptions::planToolbarIndicatorsUrl() const
{
return QUrl(QStringLiteral("PlanToolBar.qml"));
}
QGCFlyViewOptions* QGCOptions::flyViewOptions(void)
{
if (!_defaultFlyViewOptions) {
......
......@@ -55,11 +55,8 @@ public:
Q_PROPERTY(double toolbarHeightMultiplier READ toolbarHeightMultiplier CONSTANT)
Q_PROPERTY(bool enablePlanViewSelector READ enablePlanViewSelector CONSTANT)
Q_PROPERTY(QUrl preFlightChecklistUrl READ preFlightChecklistUrl CONSTANT)
Q_PROPERTY(QUrl mainToolbarUrl READ mainToolbarUrl CONSTANT)
Q_PROPERTY(QUrl planToolbarUrl READ planToolbarUrl CONSTANT)
Q_PROPERTY(QColor toolbarBackgroundLight READ toolbarBackgroundLight CONSTANT)
Q_PROPERTY(QColor toolbarBackgroundDark READ toolbarBackgroundDark CONSTANT)
Q_PROPERTY(QUrl planToolbarIndicatorsUrl READ planToolbarIndicatorsUrl CONSTANT)
Q_PROPERTY(bool showSensorCalibrationCompass READ showSensorCalibrationCompass NOTIFY showSensorCalibrationCompassChanged)
Q_PROPERTY(bool showSensorCalibrationGyro READ showSensorCalibrationGyro NOTIFY showSensorCalibrationGyroChanged)
Q_PROPERTY(bool showSensorCalibrationAccel READ showSensorCalibrationAccel NOTIFY showSensorCalibrationAccelChanged)
......@@ -107,16 +104,10 @@ public:
/// Provides an optional, custom preflight checklist
virtual QUrl preFlightChecklistUrl () const { return QUrl::fromUserInput("qrc:/qml/PreFlightCheckList.qml"); }
/// Allows replacing the Main toolbar
virtual QUrl mainToolbarUrl () const;
/// Allows replacing the Plan View toolbar
virtual QUrl planToolbarUrl () const;
/// Allows replacing the toolbar Light Theme color
virtual QColor toolbarBackgroundLight () const;
/// Allows replacing the toolbar Dark Theme color
virtual QColor toolbarBackgroundDark () const;
/// Allows replacing the Plan View toolbar container
virtual QUrl planToolbarIndicatorsUrl () const;
/// By returning false you can hide the following sensor calibration pages
virtual bool showSensorCalibrationCompass () const { return true; }
virtual bool showSensorCalibrationGyro () const { return true; }
......
......@@ -49,10 +49,7 @@ ApplicationWindow {
property var _rgPreventViewSwitch: [ false ]
readonly property real _topBottomMargins: ScreenTools.defaultFontPixelHeight * 0.5
readonly property string _mainToolbar: QGroundControl.corePlugin.options.mainToolbarUrl
readonly property string _planToolbar: QGroundControl.corePlugin.options.planToolbarUrl
//-------------------------------------------------------------------------
//-- Global Scope Variables
......@@ -107,44 +104,47 @@ ApplicationWindow {
return _rgPreventViewSwitch[_rgPreventViewSwitch.length - 1]
}
function viewSwitch(isPlanView) {
function viewSwitch(isPlanView, showModeIndicators) {
settingsWindow.visible = false
setupWindow.visible = false
analyzeWindow.visible = false
flightView.visible = false
planViewLoader.visible = false
if(isPlanView) {
toolbar.source = _planToolbar
var indicatorSource
if (isPlanView) {
indicatorSource = "qrc:/qml/PlanToolBarIndicators.qml"
} else {
toolbar.source = _mainToolbar
indicatorSource = "qrc:/toolbar/MainToolBarIndicators.qml"
}
toolbar.item.indicatorSource = indicatorSource
toolbar.item.showModeIndicators = showModeIndicators
}
function showFlyView() {
if (!flightView.visible) {
mainWindow.showPreFlightChecklistIfNeeded()
}
viewSwitch(false)
viewSwitch(false, true)
flightView.visible = true
}
function showPlanView() {
viewSwitch(true)
viewSwitch(true, false)
planViewLoader.visible = true
}
function showAnalyzeView() {
viewSwitch(false)
viewSwitch(false, false)
analyzeWindow.visible = true
}
function showSetupView() {
viewSwitch(false)
viewSwitch(false, false)
setupWindow.visible = true
}
function showSettingsView() {
viewSwitch(false)
viewSwitch(false, false)
settingsWindow.visible = true
}
......@@ -324,13 +324,13 @@ ApplicationWindow {
header: ToolBar {
height: ScreenTools.toolbarHeight
visible: !QGroundControl.videoManager.fullScreen
background: Rectangle {
background: Rectangle {
color: qgcPal.globalTheme === QGCPalette.Light ? QGroundControl.corePlugin.options.toolbarBackgroundLight : QGroundControl.corePlugin.options.toolbarBackgroundDark
}
Loader {
id: toolbar
anchors.fill: parent
source: _mainToolbar
source: "qrc:/toolbar/MainToolBar.qml"
//-- Toggle Full Screen / Windowed
MouseArea {
anchors.fill: parent
......
......@@ -20,13 +20,40 @@ import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0
Item {
id: toolBar
id: _root
Component.onCompleted: {
//-- TODO: Get this from the actual state
flyButton.checked = true
property alias indicatorSource: indicatorLoader.source
property alias showModeIndicators: indicatorLoader.showModeIndicators
// FIXME: Reaching up for communicationLost?
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
Component.onCompleted: _viewButtonClicked(flyButton)
function _viewButtonClicked(button) {
if (mainWindow.preventViewSwitch()) {
return false
}
viewButtonSelectRow.visible = false
buttonSelectHideTimer.stop()
currentButton.icon.source = button.icon.source
currentButton.logo = button.logo
return true
}
//-- Setup can be invoked from c++ side
Connections {
target: setupWindow
onVisibleChanged: {
if (setupWindow.visible) {
_viewButtonClicked(setupButton)
}
}
}
QGCPalette { id: qgcPal }
/// Bottom single pixel divider
Rectangle {
anchors.left: parent.left
......@@ -37,105 +64,87 @@ Item {
visible: qgcPal.globalTheme === QGCPalette.Light
}
//-- Setup can be invoked from c++ side
Connections {
target: setupWindow
onVisibleChanged: {
if (setupWindow.visible) {
buttonRow.clearAllChecks()
setupButton.checked = true
RowLayout {
id: viewButtonRow
anchors.bottomMargin: 1
anchors.top: parent.top
anchors.bottom: parent.bottom
spacing: ScreenTools.defaultFontPixelWidth / 2
QGCToolBarButton {
id: currentButton
Layout.fillHeight: true
onClicked: {
viewButtonSelectRow.visible = !viewButtonSelectRow.visible
if (viewButtonSelectRow.visible) {
buttonSelectHideTimer.start()
} else {
buttonSelectHideTimer.stop()
}
}
}
}
QGCFlickable {
anchors.fill: parent
contentWidth: toolbarRow.width
flickableDirection: Flickable.HorizontalFlick
//---------------------------------------------
// Toolbar Row
RowLayout {
id: toolbarRow
anchors.bottomMargin: 1
anchors.top: parent.top
anchors.bottom: parent.bottom
spacing: ScreenTools.defaultFontPixelWidth / 2
// Important Note: Toolbar buttons must manage their checked state manually in order to support
// view switch prevention. There doesn't seem to be a way to make this work if they are in a
// ButtonGroup.
//---------------------------------------------
// Toolbar Row
RowLayout {
id: buttonRow
Layout.fillHeight: true
spacing: 0
function clearAllChecks() {
for (var i=0; i<buttonRow.children.length; i++) {
if (buttonRow.children[i].toString().startsWith("QGCToolBarButton")) {
buttonRow.children[i].checked = false
}
}
}
id: viewButtonSelectRow
Layout.fillHeight: true
spacing: 0
visible: false
Timer {
id: buttonSelectHideTimer
interval: 5000
repeat: false
onTriggered: viewButtonSelectRow.visible = false
}