Skip to content

Commit

Permalink
Custom plugin work
Browse files Browse the repository at this point in the history
  • Loading branch information
dogmaphobic committed Nov 27, 2016
1 parent 92bf4bd commit 0920b97
Show file tree
Hide file tree
Showing 23 changed files with 215 additions and 74 deletions.
4 changes: 2 additions & 2 deletions QGCCommon.pri
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ linux {
equals(ANDROID_TARGET_ARCH, x86) {
CONFIG += Androidx86Build
DEFINES += __androidx86__
DEFINES += QGC_DISABLE_UVC
message("Android x86 build")
} else {
message("Android Arm build")
Expand Down Expand Up @@ -77,9 +76,10 @@ linux {
error("Unsupported Qt version, 5.5.x or greater is required for iOS")
}
message("iOS build")
CONFIG += iOSBuild MobileBuild app_bundle
CONFIG += iOSBuild MobileBuild app_bundle NoSerialBuild
DEFINES += __ios__
DEFINES += QGC_NO_GOOGLE_MAPS
DEFINES += NO_SERIAL_LINK
QMAKE_IOS_DEPLOYMENT_TARGET = 8.0
QMAKE_IOS_TARGETED_DEVICE_FAMILY = 1,2 # Universal
QMAKE_LFLAGS += -Wl,-no_pie
Expand Down
1 change: 1 addition & 0 deletions qgcresources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
<file alias="TrashDelete.svg">resources/TrashDelete.svg</file>
<file alias="XDelete.svg">resources/XDelete.svg</file>
<file alias="XDeleteBlack.svg">resources/XDeleteBlack.svg</file>
<file alias="waves.svg">resources/waves.svg</file>
<file>resources/icons/qgroundcontrol.ico</file>
</qresource>
<qresource prefix="/res/firmware">
Expand Down
4 changes: 2 additions & 2 deletions qgroundcontrol.pro
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ contains(DEFINES, QGC_ENABLE_BLUETOOTH) {
src/comm/BluetoothLink.h \
}

!iOSBuild {
!NoSerialBuild {
HEADERS += \
src/comm/QGCSerialPortInfo.h \
src/comm/SerialLink.h \
Expand Down Expand Up @@ -651,7 +651,7 @@ SOURCES += \
src/comm/MockLinkMissionItemHandler.cc \
}

!iOSBuild {
!NoSerialBuild {
SOURCES += \
src/comm/QGCSerialPortInfo.cc \
src/comm/SerialLink.cc \
Expand Down
21 changes: 21 additions & 0 deletions resources/waves.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/FlightDisplay/FlightDisplayView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ QGCView {
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }

property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _mainIsMap: QGroundControl.videoManager.hasVideo ? QGroundControl.loadBoolGlobalSetting(_mainIsMapKey, true) : true
property bool _mainIsMap: QGroundControl.videoManager.hasVideo ? QGroundControl.loadBoolGlobalSetting(_mainIsMapKey, QGroundControl.mainViewIsMap) : true
property bool _isPipVisible: QGroundControl.videoManager.hasVideo ? QGroundControl.loadBoolGlobalSetting(_PIPVisibleKey, true) : false

property real _roll: _activeVehicle ? _activeVehicle.roll.value : _defaultRoll
Expand Down
8 changes: 4 additions & 4 deletions src/FlightDisplay/FlightDisplayViewWidgets.qml
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ Item {
}

QGCLabel {
id: flyLabel
text: qsTr("Fly")
color: mapPal.text
visible: !ScreenTools.isShortScreen
id: flyLabel
text: qsTr("Fly")
color: mapPal.text
visible: !ScreenTools.isShortScreen && _mainIsMap
anchors.topMargin: _toolButtonTopMargin
anchors.horizontalCenter: toolColumn.horizontalCenter
anchors.top: parent.top
Expand Down
19 changes: 17 additions & 2 deletions src/FlightDisplay/VideoManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,24 @@ VideoManager::VideoManager(QGCApplication* app)
{
//-- Get saved settings
QSettings settings;
#if defined(NO_UDP_VIDEO) && defined(QGC_GST_STREAMING)
setVideoSource(settings.value(kVideoSourceKey, kRTSPStream).toString());
#else
setVideoSource(settings.value(kVideoSourceKey, kUDPStream).toString());
setUdpPort(settings.value(kVideoUDPPortKey, 5600).toUInt());
setRtspURL(settings.value(kVideoRTSPUrlKey, "rtsp://192.168.42.1:554/live").toString()); //-- Example RTSP URL
#endif
//-- Check if core plugin defines its own video requirements
if(qgcApp()->qgcOptions()->definesVideo()) {
if(qgcApp()->qgcOptions()->videoUDPPort()) {
setUdpPort(qgcApp()->qgcOptions()->videoUDPPort());
setVideoSource(kUDPStream);
} else {
setVideoSource(kRTSPStream);
setRtspURL(qgcApp()->qgcOptions()->videoRSTPUrl());
}
} else {
setUdpPort(settings.value(kVideoUDPPortKey, 5600).toUInt());
setRtspURL(settings.value(kVideoRTSPUrlKey, "rtsp://192.168.42.1:554/live").toString()); //-- Example RTSP URL
}
_init = true;
#if defined(QGC_GST_STREAMING)
_updateVideo();
Expand Down
2 changes: 1 addition & 1 deletion src/QGCApplication.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
#include CUSTOMHEADER
#endif

#ifndef __ios__
#ifndef NO_SERIAL_LINK
#include "SerialLink.h"
#endif

Expand Down
65 changes: 65 additions & 0 deletions src/QmlControls/QGroundControlQmlGlobal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -353,3 +353,68 @@ QMap<QString, FactMetaData*>& QGroundControlQmlGlobal::nameToMetaDataMap(void) {

return map;
}

bool QGroundControlQmlGlobal::colapseSettings()
{
return qgcApp()->qgcOptions()->colapseSettings();
}

bool QGroundControlQmlGlobal::mainViewIsMap()
{
return qgcApp()->qgcOptions()->mainViewIsMap();
}

bool QGroundControlQmlGlobal::enableVirtualJoystick()
{
return qgcApp()->qgcOptions()->enableVirtualJoystick();
}

bool QGroundControlQmlGlobal::enableAutoConnectOptions()
{
return qgcApp()->qgcOptions()->enableAutoConnectOptions();
}

bool QGroundControlQmlGlobal::enableVideoSourceOptions()
{
return qgcApp()->qgcOptions()->enableVideoSourceOptions();
}

bool QGroundControlQmlGlobal::hasCustomSettings()
{
if(qgcApp()->customCorePlugin()) {
if(qgcApp()->customCorePlugin()->settingsQML()) {
return !qgcApp()->customCorePlugin()->settingsQML()->pageUrl().isEmpty();
}
}
return false;
}

QString QGroundControlQmlGlobal::customSettingsURL()
{
if(qgcApp()->customCorePlugin()) {
if(qgcApp()->customCorePlugin()->settingsQML()) {
return qgcApp()->customCorePlugin()->settingsQML()->pageUrl();
}
}
return QString();
}

QString QGroundControlQmlGlobal::customSettingsTitle()
{
if(qgcApp()->customCorePlugin()) {
if(qgcApp()->customCorePlugin()->settingsQML()) {
return qgcApp()->customCorePlugin()->settingsQML()->pageTitle();
}
}
return QString();
}

QString QGroundControlQmlGlobal::customSettingsLogoUrl()
{
if(qgcApp()->customCorePlugin()) {
if(qgcApp()->customCorePlugin()->settingsQML()) {
return qgcApp()->customCorePlugin()->settingsQML()->pageIconUrl();
}
}
return QString();
}
28 changes: 24 additions & 4 deletions src/QmlControls/QGroundControlQmlGlobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,27 @@ class QGroundControlQmlGlobal : public QGCTool
Q_PROPERTY(qreal zOrderMapItems READ zOrderMapItems CONSTANT) ///< z order value for map items, for example: mission item indicators

// Various QGC settings exposed to Qml
Q_PROPERTY(bool isAdvancedMode READ isAdvancedMode CONSTANT) ///< Global "Advance Mode" preference. Certain UI elements and features are different based on this.
Q_PROPERTY(bool isDarkStyle READ isDarkStyle WRITE setIsDarkStyle NOTIFY isDarkStyleChanged) // TODO: Should be in ScreenTools?
Q_PROPERTY(bool isAudioMuted READ isAudioMuted WRITE setIsAudioMuted NOTIFY isAudioMutedChanged)
Q_PROPERTY(bool isSaveLogPrompt READ isSaveLogPrompt WRITE setIsSaveLogPrompt NOTIFY isSaveLogPromptChanged)
Q_PROPERTY(bool isSaveLogPromptNotArmed READ isSaveLogPromptNotArmed WRITE setIsSaveLogPromptNotArmed NOTIFY isSaveLogPromptNotArmedChanged)
Q_PROPERTY(bool virtualTabletJoystick READ virtualTabletJoystick WRITE setVirtualTabletJoystick NOTIFY virtualTabletJoystickChanged)
Q_PROPERTY(qreal baseFontPointSize READ baseFontPointSize WRITE setBaseFontPointSize NOTIFY baseFontPointSizeChanged)

//-------------------------------------------------------------------------
//-- Options that can be set by plugins
Q_PROPERTY(bool colapseSettings READ colapseSettings CONSTANT)
Q_PROPERTY(bool mainViewIsMap READ mainViewIsMap CONSTANT)
Q_PROPERTY(bool enableVirtualJoystick READ enableVirtualJoystick CONSTANT)
Q_PROPERTY(bool enableAutoConnectOptions READ enableAutoConnectOptions CONSTANT)
Q_PROPERTY(bool enableVideoSourceOptions READ enableVideoSourceOptions CONSTANT)

Q_PROPERTY(bool hasCustomSettings READ hasCustomSettings CONSTANT)
Q_PROPERTY(QString customSettingsURL READ customSettingsURL CONSTANT)
Q_PROPERTY(QString customSettingsTitle READ customSettingsTitle CONSTANT)
Q_PROPERTY(QString customSettingsLogoUrl READ customSettingsLogoUrl CONSTANT)

//-------------------------------------------------------------------------
// MavLink Protocol
Q_PROPERTY(bool isVersionCheckEnabled READ isVersionCheckEnabled WRITE setIsVersionCheckEnabled NOTIFY isVersionCheckEnabledChanged)
Q_PROPERTY(int mavlinkSystemID READ mavlinkSystemID WRITE setMavlinkSystemID NOTIFY mavlinkSystemIDChanged)
Expand Down Expand Up @@ -185,6 +198,16 @@ class QGroundControlQmlGlobal : public QGCTool
bool isVersionCheckEnabled () { return _toolbox->mavlinkProtocol()->versionCheckEnabled(); }
int mavlinkSystemID () { return _toolbox->mavlinkProtocol()->getSystemId(); }

bool colapseSettings ();
bool mainViewIsMap ();
bool enableVirtualJoystick ();
bool enableAutoConnectOptions();
bool enableVideoSourceOptions();
bool hasCustomSettings ();
QString customSettingsTitle ();
QString customSettingsURL ();
QString customSettingsLogoUrl ();

QGeoCoordinate lastKnownHomePosition() { return qgcApp()->lastKnownHomePosition(); }

static Fact* offlineEditingFirmwareType (void);
Expand All @@ -196,9 +219,6 @@ class QGroundControlQmlGlobal : public QGCTool
static Fact* speedUnits (void);
static Fact* batteryPercentRemainingAnnounce(void);

//-- TODO: Make this into an actual preference.
bool isAdvancedMode () { return false; }

void setIsDarkStyle (bool dark);
void setIsAudioMuted (bool muted);
void setIsSaveLogPrompt (bool prompt);
Expand Down
2 changes: 1 addition & 1 deletion src/Vehicle/Vehicle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ void Vehicle::_sendMessageOnLink(LinkInterface* link, mavlink_message_t message)
/// @return Direct usb connection link to board if one, NULL if none
LinkInterface* Vehicle::priorityLink(void)
{
#ifndef __ios__
#ifndef NO_SERIAL_LINK
foreach (LinkInterface* link, _links) {
if (link->isConnected()) {
SerialLink* pSerialLink = qobject_cast<SerialLink*>(link);
Expand Down
27 changes: 27 additions & 0 deletions src/VehicleSetup/SetupView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,33 @@ Rectangle {
visible: !ScreenTools.isShortScreen
}

SubMenuButton {
imageResource: "/res/gear-white.svg"
setupIndicator: false
exclusiveGroup: setupButtonGroup
text: "General"
visible: QGroundControl.colapseSettings
onClicked: panelLoader.setSource("GeneralSettings.qml")
}

SubMenuButton {
imageResource: QGroundControl.customSettingsLogoUrl
setupIndicator: false
exclusiveGroup: setupButtonGroup
text: QGroundControl.customSettingsTitle
visible: QGroundControl.colapseSettings && QGroundControl.hasCustomSettings
onClicked: panelLoader.setSource(QGroundControl.customSettingsURL)
}

SubMenuButton {
imageResource: "/res/waves.svg"
setupIndicator: false
exclusiveGroup: setupButtonGroup
text: "MAVLink"
visible: QGroundControl.colapseSettings
onClicked: panelLoader.setSource("MavlinkSettings.qml")
}

SubMenuButton {
id: summaryButton
imageResource: "/qmlimages/VehicleSummaryIcon.png"
Expand Down
8 changes: 4 additions & 4 deletions src/comm/LinkConfiguration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
*/

#include "LinkConfiguration.h"
#ifndef __ios__
#ifndef NO_SERIAL_LINK
#include "SerialLink.h"
#endif
#include "UDPLink.h"
#include "TCPLink.h"
#ifndef __mobile__
#if !defined(__mobile__)
#include "LogReplayLink.h"
#endif
#ifdef QGC_ENABLE_BLUETOOTH
Expand Down Expand Up @@ -79,7 +79,7 @@ LinkConfiguration* LinkConfiguration::createSettings(int type, const QString& na
{
LinkConfiguration* config = NULL;
switch(type) {
#ifndef __ios__
#ifndef NO_SERIAL_LINK
case LinkConfiguration::TypeSerial:
config = new SerialConfiguration(name);
break;
Expand Down Expand Up @@ -117,7 +117,7 @@ LinkConfiguration* LinkConfiguration::duplicateSettings(LinkConfiguration* sourc
{
LinkConfiguration* dupe = NULL;
switch(source->type()) {
#ifndef __ios__
#ifndef NO_SERIAL_LINK
case TypeSerial:
dupe = new SerialConfiguration(dynamic_cast<SerialConfiguration*>(source));
break;
Expand Down
2 changes: 1 addition & 1 deletion src/comm/LinkConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class LinkConfiguration : public QObject
/// The link types supported by QGC
/// Any changes here MUST be reflected in LinkManager::linkTypeStrings()
enum LinkType {
#ifndef __ios__
#ifndef NO_SERIAL_LINK
TypeSerial, ///< Serial Link
#endif
TypeUdp, ///< UDP Link
Expand Down
Loading

0 comments on commit 0920b97

Please sign in to comment.