diff --git a/QGCApplication.pro b/QGCApplication.pro index 3ec9e9cab0c961cd0a29010f4fa642645dc7c465..56072babf1718c5ee783f38df5a3bc0b358005f0 100644 --- a/QGCApplication.pro +++ b/QGCApplication.pro @@ -270,7 +270,8 @@ HEADERS += \ src/ui/uas/QGCUnconnectedInfoWidget.h \ src/ui/uas/UASMessageView.h \ src/MissionItem.h \ - src/AutoPilotPlugins/PX4/PX4AirframeLoader.h + src/AutoPilotPlugins/PX4/PX4AirframeLoader.h \ + src/QGCSettings.h WindowsBuild { PRECOMPILED_HEADER += src/stable_headers.h @@ -381,7 +382,8 @@ SOURCES += \ src/ui/uas/QGCUnconnectedInfoWidget.cc \ src/ui/uas/UASMessageView.cc \ src/MissionItem.cc \ - src/AutoPilotPlugins/PX4/PX4AirframeLoader.cc + src/AutoPilotPlugins/PX4/PX4AirframeLoader.cc \ + src/QGCSettings.cpp !iOSBuild { SOURCES += \ diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index 6a423dbe2139a17b61e87597d086cd8ea2ac91f3..0fcc6cef378337986a1430e82e886994ea0549ae 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -64,6 +64,7 @@ src/VehicleSetup/JoystickConfig.qml src/VehicleSetup/SetupParameterEditor.qml src/VehicleSetup/DebugWindow.qml + src/VehicleSetup/GeneralSettings.qml src/ViewWidgets/CustomCommandWidget.qml src/AutoPilotPlugins/PX4/SafetyComponent.qml diff --git a/src/AutoPilotPlugins/PX4/PowerComponent.qml b/src/AutoPilotPlugins/PX4/PowerComponent.qml index f1202c9bd604cfd20328089b0287e4cd145f0fd4..ceb53b87c755fc73518f5ce4793e3012c994ab82 100644 --- a/src/AutoPilotPlugins/PX4/PowerComponent.qml +++ b/src/AutoPilotPlugins/PX4/PowerComponent.qml @@ -47,6 +47,10 @@ QGCView { property Fact battLowVolt: controller.getParameterFact(-1, "BAT_V_EMPTY") property Fact battVoltLoadDrop: controller.getParameterFact(-1, "BAT_V_LOAD_DROP") + readonly property string highlightPrefix: "" + readonly property string highlightSuffix: "" + + function getBatteryImage() { switch(battNumCells.value) { @@ -94,7 +98,7 @@ QGCView { onBatteryConnected: showMessage("ESC Calibration", "Performing calibration. This will take a few seconds..", 0) onCalibrationFailed: showMessage("ESC Calibration failed", errorMessage, StandardButton.Ok) onCalibrationSuccess: showMessage("ESC Calibration", "Calibration complete. You can disconnect your battery now if you like.", StandardButton.Ok) - onConnectBattery: showMessage("ESC Calibration", "WARNING: Props must be removed from vehicle prior to performing ESC calibration. Connect the battery now and calibration will begin.", 0) + onConnectBattery: showMessage("ESC Calibration", highlightPrefix + "WARNING: Props must be removed from vehicle prior to performing ESC calibration." + highlightSuffix + " Connect the battery now and calibration will begin.", 0) onDisconnectBattery: showMessage("ESC Calibration failed", "You must disconnect the battery prior to performing ESC Calibration. Disconnect your battery and try again.", StandardButton.Ok) } @@ -239,7 +243,7 @@ QGCView { QGCLabel { color: palette.warningText - text: "WARNING: Propellers must be removed from vehicle prior to performing ESC calibration." + text: "WARNING: Propellers must be removed from vehicle prior to performing ESC calibration." } QGCLabel { @@ -273,7 +277,7 @@ QGCView { QGCLabel { color: palette.warningText - text: "WARNING: Propellers must be removed from vehicle prior to performing UAVCAN ESC configuration." + text: "WARNING: Propellers must be removed from vehicle prior to performing UAVCAN ESC configuration." } QGCLabel { @@ -341,7 +345,7 @@ QGCView { wrapMode: Text.WordWrap text: "Batteries show less voltage at high throttle. Enter the difference in Volts between idle throttle and full " + "throttle, divided by the number of battery cells. Leave at the default if unsure. " + - "If this value is set too high, the battery might be deep discharged and damaged." + highlightPrefix + "If this value is set too high, the battery might be deep discharged and damaged." + highlightSuffix } Row { diff --git a/src/FlightMap/FlightMapSettings.cc b/src/FlightMap/FlightMapSettings.cc index 63fa846f810ad0390d9cb407a887a8839e13a114..c963721d2510390ef2c5466a8475a1292a1e1a60 100644 --- a/src/FlightMap/FlightMapSettings.cc +++ b/src/FlightMap/FlightMapSettings.cc @@ -1,24 +1,24 @@ /*===================================================================== - + 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 . - + ======================================================================*/ #include "FlightMapSettings.h" @@ -43,7 +43,7 @@ void FlightMapSettings::setToolbox(QGCToolbox *toolbox) qmlRegisterUncreatableType ("QGroundControl", 1, 0, "FlightMapSetting", "Reference only"); - _supportedMapProviders << "Bing" << "Google" << "Open"; + _supportedMapProviders << "Bing" << "Google" << "OpenStreetMap"; _loadSettings(); } @@ -51,7 +51,7 @@ void FlightMapSettings::setToolbox(QGCToolbox *toolbox) void FlightMapSettings::_storeSettings(void) { QSettings settings; - + settings.beginGroup(_settingsGroup); settings.setValue(_mapProviderKey, _supportedMapProviders.contains(_mapProvider) ? _mapProvider : _defaultMapProvider); } @@ -59,14 +59,14 @@ void FlightMapSettings::_storeSettings(void) void FlightMapSettings::_loadSettings(void) { QSettings settings; - + settings.beginGroup(_settingsGroup); _mapProvider = settings.value(_mapProviderKey, _defaultMapProvider).toString(); - + if (!_supportedMapProviders.contains(_mapProvider)) { _mapProvider = _defaultMapProvider; } - + _setMapTypesForCurrentProvider(); } @@ -88,22 +88,22 @@ void FlightMapSettings::setMapProvider(const QString& mapProvider) void FlightMapSettings::_setMapTypesForCurrentProvider(void) { _mapTypes.clear(); - + if (_mapProvider == "Bing") { _mapTypes << "Street Map" << "Satellite Map" << "Hybrid Map"; } else if (_mapProvider == "Google") { _mapTypes << "Street Map" << "Satellite Map" << "Terrain Map"; - } else if (_mapProvider == "Open") { + } else if (_mapProvider == "OpenStreetMap") { _mapTypes << "Street Map"; } - + emit mapTypesChanged(_mapTypes); } QString FlightMapSettings::mapTypeForMapName(const QString& mapName) { QSettings settings; - + settings.beginGroup(_settingsGroup); settings.beginGroup(mapName); settings.beginGroup(_mapProvider); @@ -113,7 +113,7 @@ QString FlightMapSettings::mapTypeForMapName(const QString& mapName) void FlightMapSettings::setMapTypeForMapName(const QString& mapName, const QString& mapType) { QSettings settings; - + settings.beginGroup(_settingsGroup); settings.beginGroup(mapName); settings.beginGroup(_mapProvider); @@ -123,7 +123,7 @@ void FlightMapSettings::setMapTypeForMapName(const QString& mapName, const QStri void FlightMapSettings::saveMapSetting (const QString &mapName, const QString& key, const QString& value) { QSettings settings; - + settings.beginGroup(_settingsGroup); settings.beginGroup(mapName); settings.setValue(key, value); @@ -132,7 +132,7 @@ void FlightMapSettings::saveMapSetting (const QString &mapName, const QString& k QString FlightMapSettings::loadMapSetting (const QString &mapName, const QString& key, const QString& defaultValue) { QSettings settings; - + settings.beginGroup(_settingsGroup); settings.beginGroup(mapName); return settings.value(key, defaultValue).toString(); diff --git a/src/FlightMap/FlightMapSettings.h b/src/FlightMap/FlightMapSettings.h index 28590dab763ba4b2d81d9a25d98119bebadff61b..23f04418b66550d2fe3d6c3565312c7d1b0cc327 100644 --- a/src/FlightMap/FlightMapSettings.h +++ b/src/FlightMap/FlightMapSettings.h @@ -32,46 +32,51 @@ This file is part of the QGROUNDCONTROL project class FlightMapSettings : public QGCTool { Q_OBJECT - + public: FlightMapSettings(QGCApplication* app); /// mapProvider is either Bing, Google or Open to specify to set of maps available - Q_PROPERTY(QString mapProvider READ mapProvider WRITE setMapProvider NOTIFY mapProviderChanged) - + Q_PROPERTY(QString mapProvider READ mapProvider WRITE setMapProvider NOTIFY mapProviderChanged) + + /// Map providers + Q_PROPERTY(QStringList mapProviders READ mapProviders CONSTANT) + /// Map types associated with current map provider - Q_PROPERTY(QStringList mapTypes MEMBER _mapTypes NOTIFY mapTypesChanged) - - Q_INVOKABLE QString mapTypeForMapName(const QString& mapName); - Q_INVOKABLE void setMapTypeForMapName(const QString& mapName, const QString& mapType); - - Q_INVOKABLE void saveMapSetting (const QString &mapName, const QString& key, const QString& value); - Q_INVOKABLE QString loadMapSetting (const QString &mapName, const QString& key, const QString& defaultValue); - Q_INVOKABLE void saveBoolMapSetting (const QString &mapName, const QString& key, bool value); - Q_INVOKABLE bool loadBoolMapSetting (const QString &mapName, const QString& key, bool defaultValue); + Q_PROPERTY(QStringList mapTypes MEMBER _mapTypes NOTIFY mapTypesChanged) + + Q_INVOKABLE QString mapTypeForMapName (const QString& mapName); + Q_INVOKABLE void setMapTypeForMapName(const QString& mapName, const QString& mapType); + + Q_INVOKABLE void saveMapSetting (const QString &mapName, const QString& key, const QString& value); + Q_INVOKABLE QString loadMapSetting (const QString &mapName, const QString& key, const QString& defaultValue); + Q_INVOKABLE void saveBoolMapSetting (const QString &mapName, const QString& key, bool value); + Q_INVOKABLE bool loadBoolMapSetting (const QString &mapName, const QString& key, bool defaultValue); // Property accessors - + QString mapProvider(void); void setMapProvider(const QString& mapProvider); - + // Override from QGCTool virtual void setToolbox(QGCToolbox *toolbox); + QStringList mapProviders() { return _supportedMapProviders; } + signals: void mapProviderChanged(const QString& mapProvider); void mapTypesChanged(const QStringList& mapTypes); - + private: void _storeSettings(void); void _loadSettings(void); - + void _setMapTypesForCurrentProvider(void); - + QString _mapProvider; ///< Current map provider QStringList _supportedMapProviders; QStringList _mapTypes; ///< Map types associated with current map provider - + static const char* _defaultMapProvider; static const char* _settingsGroup; static const char* _mapProviderKey; diff --git a/src/QGCPalette.cc b/src/QGCPalette.cc index cf0b1aa53d4d8b9465c28b07dec865e1826d4fe1..a01c916a7e74dd70946eb9da55c986605de316a9 100644 --- a/src/QGCPalette.cc +++ b/src/QGCPalette.cc @@ -1,24 +1,24 @@ /*===================================================================== - + QGroundControl Open Source Ground Control Station - + (c) 2009 - 2014 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 @@ -34,7 +34,7 @@ QList QGCPalette::_paletteObjects; QGCPalette::Theme QGCPalette::_theme = QGCPalette::Dark; QColor QGCPalette::_window[QGCPalette::_cThemes][QGCPalette::_cColorGroups] = { - { QColor("#ffffff"), QColor("#ffffff") }, + { QColor("#f9f8f4"), QColor("#f9f8f4") }, { QColor(0x22, 0x22, 0x22), QColor(0x22, 0x22, 0x22) } }; @@ -54,8 +54,8 @@ QColor QGCPalette::_text[QGCPalette::_cThemes][QGCPalette::_cColorGroups] = { }; QColor QGCPalette::_warningText[QGCPalette::_cThemes][QGCPalette::_cColorGroups] = { - { QColor(0xFF, 0xFF, 0x00), QColor(0xFF, 0xFF, 0x00) }, - { QColor(0xFF, 0xFF, 0x00), QColor(0xFF, 0xFF, 0x00) } + { QColor("#cc0808"), QColor("#cc0808") }, + { QColor("#e4e428"), QColor("#e4e428") } }; QColor QGCPalette::_button[QGCPalette::_cThemes][QGCPalette::_cColorGroups] = { @@ -79,8 +79,8 @@ QColor QGCPalette::_buttonHighlightText[QGCPalette::_cThemes][QGCPalette::_cColo }; QColor QGCPalette::_primaryButton[QGCPalette::_cThemes][QGCPalette::_cColorGroups] = { - { QColor(0x58, 0x58, 0x58), QColor(152, 255, 252) }, - { QColor(0x58, 0x58, 0x58), QColor(152, 255, 252) }, + { QColor(0x58, 0x58, 0x58), QColor("#badec5") }, + { QColor(0x58, 0x58, 0x58), QColor("#badec5") }, }; QColor QGCPalette::_primaryButtonText[QGCPalette::_cThemes][QGCPalette::_cColorGroups] = { diff --git a/src/QGCSettings.cpp b/src/QGCSettings.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e8116080b008fe9804f2e679a7f6ff9307ecbe6f --- /dev/null +++ b/src/QGCSettings.cpp @@ -0,0 +1,39 @@ +/*===================================================================== + +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 +* @brief Implementation of class QGCSettings +* +* @author Gus Grubba +* +*/ + + +#include "QGCSettings.h" + +QGCSettings::QGCSettings(QObject *parent) : QObject(parent) +{ + +} + diff --git a/src/QGCSettings.h b/src/QGCSettings.h new file mode 100644 index 0000000000000000000000000000000000000000..fcbd969ea42a6ccefeefd90cae397bd7c99ee39d --- /dev/null +++ b/src/QGCSettings.h @@ -0,0 +1,50 @@ +/*===================================================================== + + 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 + * @brief Definition of main class + * +* @author Gus Grubba + * + */ + + +#ifndef QGCSETTINGS_H +#define QGCSETTINGS_H + +#include + +class QGCSettings : public QObject +{ + Q_OBJECT +public: + explicit QGCSettings(QObject *parent = 0); + +signals: + +public slots: + +}; + +#endif // QGCSETTINGS_H diff --git a/src/QmlControls/QGroundControlQmlGlobal.h b/src/QmlControls/QGroundControlQmlGlobal.h index b52b976ee417cfce6d5bec74a2ae9eec83884817..8f3ad3c0b1bf8b39aa7fd6a47d60445df331f560 100644 --- a/src/QmlControls/QGroundControlQmlGlobal.h +++ b/src/QmlControls/QGroundControlQmlGlobal.h @@ -29,6 +29,8 @@ #include +#include "QGCApplication.h" +#include "MainWindow.h" #include "HomePositionManager.h" #include "FlightMapSettings.h" @@ -65,9 +67,61 @@ public: qreal zOrderWidgets () { return 100; } qreal zOrderMapItems () { return 50; } + //-- TODO: This should be in ScreenTools but I don't understand the changes done there (ScreenToolsController versus ScreenTools) + Q_PROPERTY(bool isDarkStyle READ isDarkStyle WRITE setIsDarkStyle NOTIFY isDarkStyleChanged) + bool isDarkStyle () { return qgcApp()->styleIsDark(); } + void setIsDarkStyle (bool dark) { qgcApp()->setStyle(dark); } + + //-- Audio Muting + Q_PROPERTY(bool isAudioMuted READ isAudioMuted WRITE setIsAudioMuted NOTIFY isAudioMutedChanged) + bool isAudioMuted () { return qgcApp()->toolbox()->audioOutput()->isMuted(); } + void setIsAudioMuted (bool muted) { qgcApp()->toolbox()->audioOutput()->mute(muted); } + + //-- Low power mode + Q_PROPERTY(bool isLowPowerMode READ isLowPowerMode WRITE setIsLowPowerMode NOTIFY isLowPowerModeChanged) + bool isLowPowerMode () { return MainWindow::instance()->lowPowerModeEnabled(); } + void setIsLowPowerMode (bool low) { MainWindow::instance()->enableLowPowerMode(low); } + + //-- Prompt save log + Q_PROPERTY(bool isSaveLogPrompt READ isSaveLogPrompt WRITE setIsSaveLogPrompt NOTIFY isSaveLogPromptChanged) + bool isSaveLogPrompt () { return qgcApp()->promptFlightDataSave(); } + void setIsSaveLogPrompt (bool prompt) { qgcApp()->setPromptFlightDataSave(prompt); } + + //-- ClearSettings + Q_INVOKABLE void deleteAllSettingsNextBoot () { qgcApp()->deleteAllSettingsNextBoot(); } + Q_INVOKABLE void clearDeleteAllSettingsNextBoot () { qgcApp()->clearDeleteAllSettingsNextBoot(); } + //-- TODO: Make this into an actual preference. bool isAdvancedMode () { return false; } + // + //-- Mavlink Protocol + // + + //-- Emit heartbeat + Q_PROPERTY(bool isHeartBeatEnabled READ isHeartBeatEnabled WRITE setIsHeartBeatEnabled NOTIFY isHeartBeatEnabledChanged) + bool isHeartBeatEnabled () { return qgcApp()->toolbox()->mavlinkProtocol()->heartbeatsEnabled(); } + void setIsHeartBeatEnabled (bool enable) { qgcApp()->toolbox()->mavlinkProtocol()->enableHeartbeats(enable); } + + //-- Multiplexing + Q_PROPERTY(bool isMultiplexingEnabled READ isMultiplexingEnabled WRITE setIsMultiplexingEnabled NOTIFY isMultiplexingEnabledChanged) + bool isMultiplexingEnabled () { return qgcApp()->toolbox()->mavlinkProtocol()->multiplexingEnabled(); } + void setIsMultiplexingEnabled(bool enable) { qgcApp()->toolbox()->mavlinkProtocol()->enableMultiplexing(enable); } + + //-- Version Check + Q_PROPERTY(bool isVersionCheckEnabled READ isVersionCheckEnabled WRITE setIsVersionCheckEnabled NOTIFY isVersionCheckEnabledChanged) + bool isVersionCheckEnabled () { return qgcApp()->toolbox()->mavlinkProtocol()->versionCheckEnabled(); } + void setIsVersionCheckEnabled(bool enable) { qgcApp()->toolbox()->mavlinkProtocol()->enableVersionCheck(enable); } + +signals: + void isDarkStyleChanged (bool dark); + void isAudioMutedChanged (bool muted); + void isLowPowerModeChanged (bool lowPower); + void isSaveLogPromptChanged (bool prompt); + void isHeartBeatEnabledChanged (bool enabled); + void isMultiplexingEnabledChanged (bool enabled); + void isVersionCheckEnabledChanged (bool enabled); + private: HomePositionManager* _homePositionManager; FlightMapSettings* _flightMapSettings; diff --git a/src/QmlControls/QmlTest.qml b/src/QmlControls/QmlTest.qml index f216e70d312a03225cd051822c9c794c4fd82bd5..8d0a72512343ff3933f77e2900090fd0e95ed8d0 100644 --- a/src/QmlControls/QmlTest.qml +++ b/src/QmlControls/QmlTest.qml @@ -12,19 +12,34 @@ Rectangle { Column { - Row { - ExclusiveGroup { id: themeGroup } - - QGCRadioButton { - text: "Light" - exclusiveGroup: themeGroup - onClicked: { palette.globalTheme = QGCPalette.Light } + Rectangle { + width: parent.width + height: themeChoice.height * 2 + color: palette.window + QGCLabel { + text: "Window Color" + anchors.left: parent.left + anchors.leftMargin: 20 + anchors.verticalCenter: parent.horizontalCenter } - - QGCRadioButton { - text: "Dark" - exclusiveGroup: themeGroup - onClicked: { palette.globalTheme = QGCPalette.Dark } + Row { + id: themeChoice + anchors.centerIn: parent + anchors.margins: 20 + spacing: 20 + ExclusiveGroup { id: themeGroup } + QGCRadioButton { + text: "Light" + checked: palette.globalTheme === QGCPalette.Light + exclusiveGroup: themeGroup + onClicked: { palette.globalTheme = QGCPalette.Light } + } + QGCRadioButton { + text: "Dark" + checked: palette.globalTheme === QGCPalette.Dark + exclusiveGroup: themeGroup + onClicked: { palette.globalTheme = QGCPalette.Dark } + } } } @@ -465,6 +480,38 @@ Rectangle { property var palette: QGCPalette { colorGroupEnabled: true } text: palette.textFieldText } + + // warningText + Loader { + sourceComponent: rowHeader + property var text: "warningText" + } + ClickableColor { + property var palette: QGCPalette { colorGroupEnabled: false } + color: palette.warningText + onColorSelected: palette.warningText = color + } + ClickableColor { + property var palette: QGCPalette { colorGroupEnabled: true } + color: palette.warningText + onColorSelected: palette.warningText = color + } + Text { + width: 80 + height: 20 + color: "black" + horizontalAlignment: Text.AlignHCenter + property var palette: QGCPalette { colorGroupEnabled: false } + text: palette.warningText + } + Text { + width: 80 + height: 20 + color: "black" + horizontalAlignment: Text.AlignHCenter + property var palette: QGCPalette { colorGroupEnabled: true } + text: palette.warningText + } } Grid { diff --git a/src/QmlControls/ScreenToolsController.h b/src/QmlControls/ScreenToolsController.h index 8ee411716303db28a1294776d2ae5924f06f7ca3..004d1fd41ab09487115db2ef8654d63a7eed9949 100644 --- a/src/QmlControls/ScreenToolsController.h +++ b/src/QmlControls/ScreenToolsController.h @@ -115,7 +115,7 @@ public: #endif signals: - void repaintRequested(void); + void repaintRequested(); private slots: void _updateCanvas(); diff --git a/src/VehicleSetup/FirmwareUpgrade.qml b/src/VehicleSetup/FirmwareUpgrade.qml index 131605548f4b1d6510792251e48676c4e5c1b3df..617254df6ff2766c8f67f268949fb3d56abb8897 100644 --- a/src/VehicleSetup/FirmwareUpgrade.qml +++ b/src/VehicleSetup/FirmwareUpgrade.qml @@ -39,7 +39,7 @@ QGCView { // User visible strings readonly property string title: "FIRMWARE" - readonly property string highlightPrefix: "" + readonly property string highlightPrefix: "" readonly property string highlightSuffix: "" readonly property string welcomeText: "QGroundControl can upgrade the firmware on Pixhawk devices, 3DR Radios and PX4 Flow Smart Cameras." readonly property string plugInText: highlightPrefix + "Plug in your device" + highlightSuffix + " via USB to " + highlightPrefix + "start" + highlightSuffix + " firmware upgrade" @@ -79,12 +79,12 @@ QGCView { initialBoardSearch = false statusTextArea.append(plugInText) } - + onBoardGone: { initialBoardSearch = false statusTextArea.append(plugInText) } - + onBoardFound: { if (initialBoardSearch) { // Board was found right away, so something is already plugged in before we've started upgrade @@ -138,7 +138,7 @@ QGCView { QGCViewDialog { anchors.fill: parent - + property bool showFirmwareTypeSelection: advancedMode.checked property bool px4Flow: controller.boardType == "PX4 Flow" @@ -156,16 +156,16 @@ QGCView { } controller.flash(stack, firmwareType, vehicleType) } - + function reject() { cancelFlash() hideDialog() } - + ExclusiveGroup { id: firmwareGroup } - + ListModel { id: firmwareTypeList @@ -186,7 +186,7 @@ QGCView { firmwareType: FirmwareUpgradeController.CustomFirmware } } - + ListModel { id: vehicleTypeList @@ -240,7 +240,7 @@ QGCView { firmwareType: FirmwareUpgradeController.CustomFirmware } } - + Column { anchors.fill: parent spacing: defaultTextHeight diff --git a/src/VehicleSetup/GeneralSettings.qml b/src/VehicleSetup/GeneralSettings.qml new file mode 100644 index 0000000000000000000000000000000000000000..bc7690450a7da6ea53fae3c24010e8a5091b31b4 --- /dev/null +++ b/src/VehicleSetup/GeneralSettings.qml @@ -0,0 +1,228 @@ +/*===================================================================== + + 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 . + + ======================================================================*/ + +import QtQuick 2.5 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 +import QtQuick.Dialogs 1.1 + +import QGroundControl 1.0 +import QGroundControl.FactSystem 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.ScreenTools 1.0 +import QGroundControl.MultiVehicleManager 1.0 +import QGroundControl.Palette 1.0 + +Rectangle { + id: _generalRoot + color: qgcPal.windowShade + + QGCPalette { + id: qgcPal + colorGroupEnabled: enabled + } + + Flickable { + clip: true + anchors.fill: parent + anchors.margins: ScreenTools.defaultFontPixelWidth + contentHeight: settingsColumn.height + contentWidth: _generalRoot.width + flickableDirection: Flickable.VerticalFlick + boundsBehavior: Flickable.StopAtBounds + + Column { + id: settingsColumn + width: _generalRoot.width + spacing: ScreenTools.defaultFontPixelHeight + anchors.margins: ScreenTools.defaultFontPixelWidth + QGCLabel { + text: "General Settings" + font.pixelSize: ScreenTools.mediumFontPixelSize + } + Rectangle { + height: 1 + width: parent.width + color: qgcPal.button + } + //----------------------------------------------------------------- + //-- Audio preferences + QGCCheckBox { + text: "Mute all audio output" + checked: QGroundControl.isAudioMuted + onClicked: { + QGroundControl.isAudioMuted = checked + } + } + //----------------------------------------------------------------- + //-- Low power mode + QGCCheckBox { + text: "Enable low power mode" + checked: QGroundControl.isLowPowerMode + onClicked: { + QGroundControl.isLowPowerMode = checked + } + } + //----------------------------------------------------------------- + //-- Prompt Save Log + QGCCheckBox { + text: "Prompt to save Flight Data Log after each flight" + checked: QGroundControl.isSaveLogPrompt + visible: !ScreenTools.isMobile + onClicked: { + QGroundControl.isSaveLogPrompt = checked + } + } + //----------------------------------------------------------------- + //-- Clear settings + QGCCheckBox { + id: clearCheck + text: "Clear all settings on next start" + checked: false + onClicked: { + checked ? clearDialog.visible = true : QGroundControl.clearDeleteAllSettingsNextBoot() + } + MessageDialog { + id: clearDialog + visible: false + icon: StandardIcon.Warning + standardButtons: StandardButton.Yes | StandardButton.No + title: "Clear Settings" + text: "All saved settings will be reset the next time you start QGroundControl. Is this really what you want?" + onYes: { + QGroundControl.deleteAllSettingsNextBoot() + clearDialog.visible = false + } + onNo: { + clearCheck.checked = false + clearDialog.visible = false + } + } + } + //----------------------------------------------------------------- + //-- Map Providers + Row { + spacing: ScreenTools.defaultFontPixelWidth + QGCLabel { + width: ScreenTools.defaultFontPixelWidth * 16 + text: "Map Providers" + } + QGCComboBox { + id: mapProviders + width: ScreenTools.defaultFontPixelWidth * 16 + model: QGroundControl.flightMapSettings.mapProviders + Component.onCompleted: { + var index = mapProviders.find(QGroundControl.flightMapSettings.mapProvider) + if (index < 0) { + console.warn("Active map provider not in combobox", QGroundControl.flightMapSettings.mapProvider) + } else { + mapProviders.currentIndex = index + } + } + onActivated: { + if (index != -1) { + currentIndex = index + console.log("New map provider: " + model[index]) + QGroundControl.flightMapSettings.mapProvider = model[index] + } + } + } + } + //----------------------------------------------------------------- + //-- Palette Styles + Row { + spacing: ScreenTools.defaultFontPixelWidth + QGCLabel { + width: ScreenTools.defaultFontPixelWidth * 16 + text: "Style" + } + QGCComboBox { + width: ScreenTools.defaultFontPixelWidth * 16 + model: [ "Dark", "Light" ] + currentIndex: QGroundControl.isDarkStyle ? 0 : 1 + onActivated: { + if (index != -1) { + currentIndex = index + console.log((index === 0) ? "Now it's Dark" : "Now it's Light") + QGroundControl.isDarkStyle = index === 0 ? true : false + } + } + } + } + //----------------------------------------------------------------- + //-- Mavlink Settings + //----------------------------------------------------------------- + Rectangle { + height: 1 + width: parent.width + color: qgcPal.button + } + QGCCheckBox { + id: showMavlinkSettings + text: "Show Advanced Mavlink Settings" + checked: false + } + QGCLabel { + text: "Mavlink Settings" + visible: showMavlinkSettings.checked + font.pixelSize: ScreenTools.mediumFontPixelSize + } + Rectangle { + height: 1 + width: parent.width + color: qgcPal.button + visible: showMavlinkSettings.checked + } + //----------------------------------------------------------------- + //-- Mavlink Heartbeats + QGCCheckBox { + text: "Emit heartbeat" + checked: QGroundControl.isHeartBeatEnabled + visible: showMavlinkSettings.checked + onClicked: { + QGroundControl.isHeartBeatEnabled = checked + } + } + //----------------------------------------------------------------- + //-- Mavlink Multiplexing + QGCCheckBox { + text: "Enable multiplexing (forward packets to all other links)" + checked: QGroundControl.isMultiplexingEnabled + visible: showMavlinkSettings.checked + onClicked: { + QGroundControl.isMultiplexingEnabled = checked + } + } + //----------------------------------------------------------------- + //-- Mavlink Version Check + QGCCheckBox { + text: "Only accept MAVs with same protocol version" + checked: QGroundControl.isVersionCheckEnabled + visible: showMavlinkSettings.checked + onClicked: { + QGroundControl.isVersionCheckEnabled = checked + } + } + } + } +} diff --git a/src/VehicleSetup/SetupView.qml b/src/VehicleSetup/SetupView.qml index e34cd48ad74d027884b07264b58831b755dbe9ed..4a0ab645765715e044c69d87dd3e6595020c8b3c 100644 --- a/src/VehicleSetup/SetupView.qml +++ b/src/VehicleSetup/SetupView.qml @@ -115,6 +115,11 @@ Rectangle { panelLoader.source = "DebugWindow.qml"; } + function showGeneralPanel() + { + panelLoader.source = "GeneralSettings.qml"; + } + Component.onCompleted: showSummaryPanel() Connections { @@ -241,6 +246,15 @@ Rectangle { onClicked: showSummaryPanel() } + SubMenuButton { + width: _buttonWidth + setupIndicator: false + exclusiveGroup: setupButtonGroup + visible: true + text: "GENERAL" + onClicked: showGeneralPanel() + } + SubMenuButton { id: firmwareButton width: _buttonWidth