diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index aa62037882c797dbbab95a6a557dc928c6ab1b19..33fba8e4ae1338c99e2f3dfa6fe8f72ed1c1fb5d 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -60,6 +60,7 @@ src/VehicleSetup/FirmwareUpgrade.qml src/VehicleSetup/JoystickConfig.qml src/VehicleSetup/SetupParameterEditor.qml + src/VehicleSetup/DebugWindow.qml src/ViewWidgets/CustomCommandWidget.qml src/AutoPilotPlugins/PX4/SafetyComponent.qml diff --git a/src/QmlControls/ScreenTools.qml b/src/QmlControls/ScreenTools.qml index 1b9ecc80dc10e18c45a585b85a3f28953fbcc639..659ba6953ba2a18cfee3e37ae6f03a082a88d595 100644 --- a/src/QmlControls/ScreenTools.qml +++ b/src/QmlControls/ScreenTools.qml @@ -21,6 +21,7 @@ Item { property bool isAndroid: ScreenToolsController.isAndroid property bool isiOS: ScreenToolsController.isiOS property bool isMobile: ScreenToolsController.isMobile + property bool isDebug: ScreenToolsController.isDebug function mouseX() { return ScreenToolsController.mouseX() diff --git a/src/QmlControls/ScreenToolsController.h b/src/QmlControls/ScreenToolsController.h index 17fb2e3014512280507d86d4169fc6500151d2d7..8ee411716303db28a1294776d2ae5924f06f7ca3 100644 --- a/src/QmlControls/ScreenToolsController.h +++ b/src/QmlControls/ScreenToolsController.h @@ -36,7 +36,7 @@ @brief Screen helper tools for QML widgets To use its functions, you need to import the module with the following line: @code - + @endcode */ @@ -51,6 +51,7 @@ public: Q_PROPERTY(bool isiOS READ isiOS CONSTANT) Q_PROPERTY(bool isMobile READ isMobile CONSTANT) Q_PROPERTY(bool testHighDPI READ testHighDPI CONSTANT) + Q_PROPERTY(bool isDebug READ isDebug CONSTANT) //! Used to trigger a \c Canvas element repaint. /*! @@ -82,15 +83,15 @@ public: // Returns current mouse position Q_INVOKABLE int mouseX(void) { return QCursor::pos().x(); } Q_INVOKABLE int mouseY(void) { return QCursor::pos().y(); } - - // Used to adjust default font size on an OS basis - Q_PROPERTY(double defaultFontPixelSizeRatio MEMBER _defaultFontPixelSizeRatio CONSTANT) - // Used to calculate font sizes based on default font size + // Used to adjust default font size on an OS basis + Q_PROPERTY(double defaultFontPixelSizeRatio MEMBER _defaultFontPixelSizeRatio CONSTANT) + + // Used to calculate font sizes based on default font size Q_PROPERTY(double smallFontPixelSizeRatio MEMBER _smallFontPixelSizeRatio CONSTANT) Q_PROPERTY(double mediumFontPixelSizeRatio MEMBER _mediumFontPixelSizeRatio CONSTANT) Q_PROPERTY(double largeFontPixelSizeRatio MEMBER _largeFontPixelSizeRatio CONSTANT) - + #if defined (__android__) bool isAndroid () { return true; } bool isiOS () { return false; } @@ -104,11 +105,13 @@ public: bool isiOS () { return false; } bool isMobile () { return qgcApp()->fakeMobile(); } #endif - + #ifdef QT_DEBUG - bool testHighDPI(void) { return qgcApp()->testHighDPI(); } + bool testHighDPI () { return qgcApp()->testHighDPI(); } + bool isDebug () { return true; } #else - bool testHighDPI(void) { return false; } + bool isDebug () { return false; } + bool testHighDPI () { return false; } #endif signals: @@ -118,8 +121,8 @@ private slots: void _updateCanvas(); private: - static const double _defaultFontPixelSizeRatio; - static const double _smallFontPixelSizeRatio; + static const double _defaultFontPixelSizeRatio; + static const double _smallFontPixelSizeRatio; static const double _mediumFontPixelSizeRatio; static const double _largeFontPixelSizeRatio; }; diff --git a/src/VehicleSetup/DebugWindow.qml b/src/VehicleSetup/DebugWindow.qml new file mode 100644 index 0000000000000000000000000000000000000000..ced76871dcf38e79912ed41c479d6aa58f113359 --- /dev/null +++ b/src/VehicleSetup/DebugWindow.qml @@ -0,0 +1,145 @@ +/*===================================================================== + + 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.3 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 +import QtQuick.Dialogs 1.2 +import QtQuick.Layouts 1.2 +import QtQuick.Window 2.2 + +import QGroundControl.Controls 1.0 +import QGroundControl.Palette 1.0 +import QGroundControl.Controllers 1.0 +import QGroundControl.ScreenTools 1.0 + +QGCView { + id: qgcView + viewPanel: panel + + QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled } + + QGCViewPanel { + id: panel + anchors.fill: parent + + Text { + id: _textMeasure + text: "X" + color: qgcPal.window + } + + GridLayout { + anchors.margins: 20 + anchors.top: parent.top + anchors.left: parent.left + columns: 2 + Text { + text: "Qt Platform:" + color: qgcPal.text + } + Text { + text: Qt.platform.os + color: qgcPal.text + } + Text { + text: "Default font width:" + color: qgcPal.text + } + Text { + text: _textMeasure.contentWidth + color: qgcPal.text + } + Text { + text: "Default font height:" + color: qgcPal.text + } + Text { + text: _textMeasure.contentHeight + color: qgcPal.text + } + Text { + text: "Default font pixel size:" + color: qgcPal.text + } + Text { + text: _textMeasure.font.pixelSize + color: qgcPal.text + } + Text { + text: "Default font point size:" + color: qgcPal.text + } + Text { + text: _textMeasure.font.pointSize + color: qgcPal.text + } + Text { + text: "QML Screen Desktop:" + color: qgcPal.text + } + Text { + text: Screen.desktopAvailableWidth + " x " + Screen.desktopAvailableHeight + color: qgcPal.text + } + Text { + text: "QML Screen Size:" + color: qgcPal.text + } + Text { + text: Screen.width + " x " + Screen.height + color: qgcPal.text + } + Text { + text: "QML Pixel Density:" + color: qgcPal.text + } + Text { + text: Screen.pixelDensity + color: qgcPal.text + } + Text { + text: "QML Pixel Ratio:" + color: qgcPal.text + } + Text { + text: Screen.devicePixelRatio + color: qgcPal.text + } + } + + Rectangle { + width: 100 + height: 100 + color: qgcPal.text + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.margins: 10 + Text { + text: "100x100" + anchors.centerIn: parent + color: qgcPal.window + } + } + } +} diff --git a/src/VehicleSetup/SetupView.qml b/src/VehicleSetup/SetupView.qml index 712f7d4149537a609628dee2ad69bcb0ea60f261..9c50dd10f5a89a8331c37bdae69fff69714ae1cd 100644 --- a/src/VehicleSetup/SetupView.qml +++ b/src/VehicleSetup/SetupView.qml @@ -110,6 +110,11 @@ Rectangle { } } + function showDebugPanel() + { + panelLoader.source = "DebugWindow.qml"; + } + Component.onCompleted: showSummaryPanel() Connections { @@ -297,6 +302,17 @@ Rectangle { onClicked: showParametersPanel() } + + SubMenuButton { + width: _buttonWidth + setupIndicator: false + exclusiveGroup: setupButtonGroup + visible: ScreenTools.isDebug + text: "DEBUG" + + onClicked: showDebugPanel() + } + } // Column } // Flickable