Commit 8b0b8906 authored by Don Gagne's avatar Don Gagne

Merge pull request #2140 from dogmaphobic/debugWindow

Debug window to help define device sizing issues.
parents cd6a0a28 5c3a79b9
......@@ -60,6 +60,7 @@
<file alias="FirmwareUpgrade.qml">src/VehicleSetup/FirmwareUpgrade.qml</file>
<file alias="JoystickConfig.qml">src/VehicleSetup/JoystickConfig.qml</file>
<file alias="SetupParameterEditor.qml">src/VehicleSetup/SetupParameterEditor.qml</file>
<file alias="DebugWindow.qml">src/VehicleSetup/DebugWindow.qml</file>
<file alias="CustomCommandWidget.qml">src/ViewWidgets/CustomCommandWidget.qml</file>
<file alias="SafetyComponent.qml">src/AutoPilotPlugins/PX4/SafetyComponent.qml</file>
......
......@@ -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()
......
......@@ -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;
};
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
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 <http://www.gnu.org/licenses/>.
======================================================================*/
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
}
}
}
}
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment