diff --git a/artwork/PFD/pfd.svg b/artwork/PFD/pfd.svg new file mode 100644 index 000000000..d6c1f8278 --- /dev/null +++ b/artwork/PFD/pfd.svg @@ -0,0 +1,3811 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + 10 + 10 + + + 20 + 20 + + + 20 + 20 + + + 10 + 10 + + + 30 + 30 + + + 40 + 40 + + + 50 + 50 + + + 60 + 60 + + + 70 + 70 + + + 80 + 80 + + + 90 + 90 + + + 40 + 40 + + + 30 + 30 + + + 60 + 60 + + + 50 + 50 + + + 80 + 80 + + + 70 + 70 + + + 90 + 90 + + + + + + + + ETA + DIST + HOME + + HDG + + + + 00:00:00 + + + 0000000 + 000 + + + + + + + + + + + + + + GPS + Sats + Tx + Rx + Throttle + + + + + mA + + V + + WPT + HDG + DIST + MODE + ETA + + + + + + 99999 + + + 12.60 + + + + + + + + + + + + + + + + + 00:00:00 + + + 00000000 + + + 000 + + + Drive Circle Right + + + description or # + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + N + 33 + 30 + W + 24 + 21 + S + 15 + 12 + E + 6 + 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + m/s + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 00000 + + + + + m + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 00000 + + + + + ft/s + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AUTOPILOT + + + + + + MASTER CAUTION + + + + + + RC INPUT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ground/openpilotgcs/copydata.pro b/ground/openpilotgcs/copydata.pro index 2962e7956..a0f25f204 100644 --- a/ground/openpilotgcs/copydata.pro +++ b/ground/openpilotgcs/copydata.pro @@ -31,6 +31,9 @@ equals(copydata, 1) { Qt5SerialPort$${DS}.dll \ Qt5Multimedia$${DS}.dll \ Qt5MultimediaWidgets$${DS}.dll \ + Qt5Quick$${DS}.dll \ + Qt5Qml$${DS}.dll \ + Qt5V8$${DS}.dll \ icuin51.dll \ icudt51.dll \ icuuc51.dll @@ -67,6 +70,71 @@ equals(copydata, 1) { data_copy.commands += $(COPY_FILE) $$targetPath(\"$$[QT_INSTALL_PLUGINS]/$$dll\") $$targetPath(\"$$GCS_APP_PATH/$$dll\") $$addNewline() } + # create QtQuick2 plugin directories + QT_QUICK2_DIRS = qtquick \ + qtquick.2 \ + qtquick/layouts \ + qtquick/localstorage \ + qtquick/particles.2 \ + qtquick/privatewidgets \ + qtquick/window.2 \ + qtquick/xmllistmodel + for(dir, QT_QUICK2_DIRS) { + data_copy.commands += -@$(MKDIR) $$targetPath(\"$$GCS_APP_PATH/$$dir\") $$addNewline() + } + + # Copy QtQuick2 complete directories + # These directories have a lot of files + # Easier to copy everything + QTQ_WHOLE_DIRS = qtquick/controls \ + qtquick/dialogs + for(dir, QTQ_WHOLE_DIRS) { + data_copy.commands += $(COPY_DIR) $$targetPath(\"$$[QT_INSTALL_QML]/$$dir\") $$targetPath(\"$$GCS_APP_PATH/$$dir\") $$addNewline() + } + + # Remove the few unwanted DDLs after whole dir copy + QT_QUICK2_DELS = qtquick/controls/qtquickcontrolsplugin \ + qtquick/controls/private/qtquickcontrolsprivateplugin \ + qtquick/dialogs/dialogplugin + + CONFIG(debug, debug|release) { + for(delfile, QT_QUICK2_DELS) { + data_copy.commands += $(DEL_FILE) $$targetPath(\"$$GCS_APP_PATH/$${delfile}.dll\") $$addNewline() + } + } + CONFIG(release, debug|release) { + for(delfile, QT_QUICK2_DELS) { + data_copy.commands += $(DEL_FILE) $$targetPath(\"$$GCS_APP_PATH/$${delfile}d.dll\") $$addNewline() + } + } + + # Remaining QtQuick plugin DLLs + QT_QUICK2_DLLS = QtQuick.2/qtquick2plugin$${DS}.dll \ + QtQuick.2/plugins.qmltypes \ + QtQuick.2/qmldir \ + qtquick/layouts/qquicklayoutsplugin$${DS}.dll \ + qtquick/layouts/plugins.qmltypes \ + qtquick/layouts/qmldir \ + qtquick/localstorage/qmllocalstorageplugin$${DS}.dll \ + qtquick/localstorage/plugins.qmltypes \ + qtquick/localstorage/qmldir \ + qtquick/particles.2/particlesplugin$${DS}.dll \ + qtquick/particles.2/plugins.qmltypes \ + qtquick/particles.2/qmldir \ + qtquick/privatewidgets/widgetsplugin$${DS}.dll \ + qtquick/privatewidgets/plugins.qmltypes \ + qtquick/privatewidgets/qmldir \ + qtquick/window.2/windowplugin$${DS}.dll \ + qtquick/window.2/plugins.qmltypes \ + qtquick/window.2/qmldir \ + qtquick/XmlListModel/qmlxmllistmodelplugin$${DS}.dll \ + qtquick/XmlListModel/plugins.qmltypes \ + qtquick/XmlListModel/qmldir + + for(dll, QT_QUICK2_DLLS) { + data_copy.commands += $(COPY_FILE) $$targetPath(\"$$[QT_INSTALL_QML]/$$dll\") $$targetPath(\"$$GCS_APP_PATH/$$dll\") $$addNewline() + } + # copy MinGW DLLs MINGW_DLLS = SDL.dll for(dll, MINGW_DLLS) { diff --git a/ground/openpilotgcs/share/openpilotgcs/pfd/default/AltitudeScale.qml b/ground/openpilotgcs/share/openpilotgcs/pfd/default/AltitudeScale.qml index 05a701f35..18df7808e 100644 --- a/ground/openpilotgcs/share/openpilotgcs/pfd/default/AltitudeScale.qml +++ b/ground/openpilotgcs/share/openpilotgcs/pfd/default/AltitudeScale.qml @@ -1,16 +1,16 @@ -import Qt 4.7 +import QtQuick 2.0 Item { id: sceneItem property variant sceneSize SvgElementImage { - id: altitude_bg - elementName: "altitude-bg" + id: altitude_window + elementName: "altitude-window" sceneSize: sceneItem.sceneSize clip: true - property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "altitude-bg") + property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "altitude-window") x: Math.floor(scaledBounds.x * sceneItem.width) y: Math.floor(scaledBounds.y * sceneItem.height) @@ -35,7 +35,7 @@ Item { model: 7 Item { height: altitude_scale.height / 6 - width: altitude_bg.width + width: altitude_window.width Text { text: altitude_scale.topNumber - index*5 @@ -50,16 +50,39 @@ Item { } } } + + SvgElementImage { + id: altitude_vector + elementName: "altitude-vector" + sceneSize: sceneItem.sceneSize + + height: -NedAccel.Down * altitude_scale.height/30 + + anchors.left: parent.left + anchors.bottom: parent.verticalCenter + } + + SvgElementImage { + id: altitude_waypoint + elementName: "altitude-waypoint" + sceneSize: sceneItem.sceneSize + visible: PathDesired.End_Down !== 0.0 + + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + + anchors.verticalCenterOffset: -altitude_scale.height/30 * (PositionState.Down - PathDesired.End_Down) + } } SvgElementImage { - id: altitude_window + id: altitude_box clip: true - elementName: "altitude-window" + elementName: "altitude-box" sceneSize: sceneItem.sceneSize - property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "altitude-window") + property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "altitude-box") x: scaledBounds.x * sceneItem.width y: scaledBounds.y * sceneItem.height @@ -72,31 +95,22 @@ Item { color: "white" font { family: "Arial" - pixelSize: parent.height * 0.6 + pixelSize: parent.height * 0.4 } anchors.centerIn: parent } } - SvgElementImage { - id: altitude_unit - elementName: "altitude-unit" - sceneSize: sceneItem.sceneSize - clip: true - - x: Math.floor(scaledBounds.x * sceneItem.width) - y: Math.floor(scaledBounds.y * sceneItem.height) - - Text { - id: altitude_unit_text - text: qmlWidget.altitudeUnit - color: "white" - font { - family: "Arial" - pixelSize: parent.height - } - anchors.right: parent.right + Text { + id: altitude_unit_text + text: qmlWidget.altitudeUnit + color: "white" + font { + family: "Arial" + pixelSize: sceneSize.height * 0.025 } + anchors.top: altitude_window.bottom + anchors.right: altitude_window.right + anchors.margins: font.pixelSize * 0.3 } - } diff --git a/ground/openpilotgcs/share/openpilotgcs/pfd/default/Compass.qml b/ground/openpilotgcs/share/openpilotgcs/pfd/default/Compass.qml index db2ba4d65..198b9502c 100644 --- a/ground/openpilotgcs/share/openpilotgcs/pfd/default/Compass.qml +++ b/ground/openpilotgcs/share/openpilotgcs/pfd/default/Compass.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 2.0 import "." Item { @@ -6,32 +6,57 @@ Item { property variant sceneSize SvgElementImage { - id: compass - elementName: "compass" + id: compass_fixed + elementName: "compass-fixed" sceneSize: sceneItem.sceneSize - clip: true - x: Math.floor(scaledBounds.x * sceneItem.width) y: Math.floor(scaledBounds.y * sceneItem.height) - //anchors.horizontalCenter: parent.horizontalCenter + } - //split compass band to 8 parts to ensure it doesn't exceed the max texture size - Row { - anchors.centerIn: parent - //the band is 540 degrees wide, AttitudeState.Yaw is converted to -180..180 range - anchors.horizontalCenterOffset: -1*((AttitudeState.Yaw+180+720) % 360 - 180)/540*width + SvgElementImage { + id: compass_plane + elementName: "compass-plane" + sceneSize: sceneItem.sceneSize - Repeater { - model: 5 - SvgElementImage { - id: compass_band - elementName: "compass-band" - sceneSize: background.sceneSize - hSliceCount: 5 - hSlice: index - } + x: Math.floor(scaledBounds.x * sceneItem.width) + y: Math.floor(scaledBounds.y * sceneItem.height) + } + + SvgElementImage { + id: compass_wheel + elementName: "compass-wheel" + sceneSize: sceneItem.sceneSize + + x: Math.floor(scaledBounds.x * sceneItem.width) + y: Math.floor(scaledBounds.y * sceneItem.height) + + rotation: -AttitudeState.Yaw + transformOrigin: Item.Center + + smooth: true + } + + Item { + id: compass_text_box + + property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "compass-text") + + x: scaledBounds.x * sceneItem.width + y: scaledBounds.y * sceneItem.height + width: scaledBounds.width * sceneItem.width + height: scaledBounds.height * sceneItem.height + + Text { + id: compass_text + text: Math.floor(AttitudeState.Yaw).toFixed() + color: "white" + font { + family: "Arial" + pixelSize: parent.height * 1.2 } + anchors.centerIn: parent } } + } diff --git a/ground/openpilotgcs/share/openpilotgcs/pfd/default/HorizontCenter.qml b/ground/openpilotgcs/share/openpilotgcs/pfd/default/HorizontCenter.qml new file mode 100644 index 000000000..c5f7c36f1 --- /dev/null +++ b/ground/openpilotgcs/share/openpilotgcs/pfd/default/HorizontCenter.qml @@ -0,0 +1,25 @@ +import QtQuick 2.0 + +Item { + id: sceneItem + property variant sceneSize + property real horizontCenter : world_center.y + world_center.height/2 + + SvgElementImage { + id: world_center + elementName: "center-arrows" + sceneSize: background.sceneSize + + x: Math.floor(scaledBounds.x * sceneItem.width) + y: Math.floor(scaledBounds.y * sceneItem.height) + } + + SvgElementImage { + id: world_center_plane + elementName: "center-plane" + sceneSize: background.sceneSize + + x: Math.floor(scaledBounds.x * sceneItem.width) + y: Math.floor(scaledBounds.y * sceneItem.height) + } +} diff --git a/ground/openpilotgcs/share/openpilotgcs/pfd/default/Info.qml b/ground/openpilotgcs/share/openpilotgcs/pfd/default/Info.qml new file mode 100644 index 000000000..2697019a6 --- /dev/null +++ b/ground/openpilotgcs/share/openpilotgcs/pfd/default/Info.qml @@ -0,0 +1,40 @@ +import QtQuick 2.0 + +Item { + id: info + property variant sceneSize + + SvgElementImage { + id: info_bg + elementName: "info-bg" + sceneSize: info.sceneSize + } + + Repeater { + id: satNumberBar + + // hack, qml/js treats qint8 as a char, necessary to convert it back to integer value + property int satNumber : String(GPSPositionSensor.Satellites).charCodeAt(0) + + model: 10 + SvgElementImage { + property int minSatNumber : index+1 + elementName: "gps" + minSatNumber + sceneSize: info.sceneSize + visible: satNumberBar.satNumber >= minSatNumber + } + } + + SvgElementPositionItem { + sceneSize: info.sceneSize + elementName: "gps-mode-text" + + Text { + text: ["No GPS", "No Fix", "Fix2D", "Fix3D"][GPSPositionSensor.Status] + + anchors.centerIn: parent + font.pixelSize: parent.height*1.2 + color: "white" + } + } +} diff --git a/ground/openpilotgcs/share/openpilotgcs/pfd/default/Pfd.qml b/ground/openpilotgcs/share/openpilotgcs/pfd/default/Pfd.qml index e03a20e02..0670e1f36 100644 --- a/ground/openpilotgcs/share/openpilotgcs/pfd/default/Pfd.qml +++ b/ground/openpilotgcs/share/openpilotgcs/pfd/default/Pfd.qml @@ -1,12 +1,11 @@ -import Qt 4.7 -import "." +import QtQuick 2.0 Rectangle { color: "#666666" SvgElementImage { id: background - elementName: "background" + elementName: "pfd-window" fillMode: Image.PreserveAspectFit anchors.fill: parent @@ -14,6 +13,8 @@ Rectangle { Item { id: sceneItem + property variant viewportSize : Qt.size(width, height) + width: parent.paintedWidth height: parent.paintedHeight anchors.centerIn: parent @@ -25,25 +26,23 @@ Rectangle { source: qmlWidget.terrainEnabled ? "PfdTerrainView.qml" : "PfdWorldView.qml" } - SvgElementImage { - id: rollscale - elementName: "rollscale" - sceneSize: background.sceneSize + HorizontCenter { + id: horizontCenterItem + sceneSize: sceneItem.viewportSize + anchors.fill: parent + } - smooth: true - anchors.centerIn: parent - //rotate it around the center of scene - transform: Rotation { - angle: -AttitudeState.Roll - origin.x : sceneItem.width/2 - x - origin.y : sceneItem.height/2 - y - } + RollScale { + id: rollscale + sceneSize: sceneItem.viewportSize + horizontCenter: horizontCenterItem.horizontCenter + anchors.fill: parent } SvgElementImage { id: foreground elementName: "foreground" - sceneSize: background.sceneSize + sceneSize: sceneItem.viewportSize anchors.centerIn: parent } @@ -51,7 +50,7 @@ Rectangle { SvgElementImage { id: side_slip elementName: "sideslip" - sceneSize: background.sceneSize + sceneSize: sceneItem.viewportSize smooth: true property real sideSlip: AccelState.y @@ -72,27 +71,37 @@ Rectangle { Compass { anchors.fill: parent - sceneSize: background.sceneSize + sceneSize: sceneItem.viewportSize } SpeedScale { anchors.fill: parent - sceneSize: background.sceneSize + sceneSize: sceneItem.viewportSize } AltitudeScale { anchors.fill: parent - sceneSize: background.sourceSize + sceneSize: sceneItem.viewportSize } VsiScale { anchors.fill: parent - sceneSize: background.sourceSize + sceneSize: sceneItem.viewportSize } PfdIndicators { anchors.fill: parent - sceneSize: background.sourceSize + sceneSize: sceneItem.viewportSize + } + + Info { + anchors.fill: parent + sceneSize: sceneItem.viewportSize + } + + Warnings { + anchors.fill: parent + sceneSize: sceneItem.viewportSize } } } diff --git a/ground/openpilotgcs/share/openpilotgcs/pfd/default/PfdIndicators.qml b/ground/openpilotgcs/share/openpilotgcs/pfd/default/PfdIndicators.qml index 641bbbb2e..a254f231e 100644 --- a/ground/openpilotgcs/share/openpilotgcs/pfd/default/PfdIndicators.qml +++ b/ground/openpilotgcs/share/openpilotgcs/pfd/default/PfdIndicators.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 2.0 Item { id: sceneItem diff --git a/ground/openpilotgcs/share/openpilotgcs/pfd/default/PfdTerrainView.qml b/ground/openpilotgcs/share/openpilotgcs/pfd/default/PfdTerrainView.qml index 2beebf05f..21355d16f 100644 --- a/ground/openpilotgcs/share/openpilotgcs/pfd/default/PfdTerrainView.qml +++ b/ground/openpilotgcs/share/openpilotgcs/pfd/default/PfdTerrainView.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 2.0 import org.OpenPilot 1.0 OsgEarth { diff --git a/ground/openpilotgcs/share/openpilotgcs/pfd/default/PfdWorldView.qml b/ground/openpilotgcs/share/openpilotgcs/pfd/default/PfdWorldView.qml index 4ce07956b..5fa6f764d 100644 --- a/ground/openpilotgcs/share/openpilotgcs/pfd/default/PfdWorldView.qml +++ b/ground/openpilotgcs/share/openpilotgcs/pfd/default/PfdWorldView.qml @@ -1,29 +1,36 @@ -import Qt 4.7 +import QtQuick 2.0 Item { id: worldView + property real horizontCenter : horizontCenterItem.horizontCenter Rectangle { + // using rectange instead of svg rendered to pixmap + // as it's much more memory efficient id: world smooth: true - property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "world") + property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "horizon") width: Math.round(sceneItem.width*scaledBounds.width/2)*2 height: Math.round(sceneItem.height*scaledBounds.height/2)*2 + property double pitch1DegScaledHeight: (svgRenderer.scaledElementBounds("pfd.svg", "pitch-90").y - + svgRenderer.scaledElementBounds("pfd.svg", "pitch90").y)/180.0 + + property double pitch1DegHeight: sceneItem.height*pitch1DegScaledHeight + gradient: Gradient { - GradientStop { position: 0.3; color: "#6589E2" } - GradientStop { position: 0.4999; color: "#AFC2F0" } - GradientStop { position: 0.5; color: "#A46933" } - GradientStop { position: 0.8; color: "black" } + GradientStop { position: 0.4999; color: "#0164CC" } + GradientStop { position: 0.5001; color: "#653300" } } transform: [ Translate { id: pitchTranslate x: Math.round((world.parent.width - world.width)/2) - y: Math.round((world.parent.height - world.height)/2 + - AttitudeState.Pitch*world.parent.height/94) + // y is centered around world_center element + y: Math.round(horizontCenter - world.height/2 + + AttitudeState.Pitch*world.pitch1DegHeight) }, Rotation { angle: -AttitudeState.Roll @@ -32,20 +39,11 @@ Item { } ] - SvgElementImage { - id: pitch_scale - elementName: "pitch_scale" - //worldView is loaded with Loader, so background element is visible - sceneSize: background.sceneSize - anchors.centerIn: parent - border: 64 //sometimes numbers are excluded from bounding rect - - smooth: true - } - SvgElementImage { id: horizont_line - elementName: "world-centerline" + //elementName: "world-centerline" + // TODO: rename the centerline element in svg file + elementName: "path4731" //worldView is loaded with Loader, so background element is visible sceneSize: background.sceneSize anchors.centerIn: parent @@ -53,4 +51,34 @@ Item { smooth: true } } + + Item { + id: pitch_window + property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "pitch-window") + + x: Math.floor(scaledBounds.x * sceneItem.width) + y: Math.floor(scaledBounds.y * sceneItem.height) + width: Math.floor(scaledBounds.width * sceneItem.width) + height: Math.floor(scaledBounds.height * sceneItem.height) + + rotation: -AttitudeState.Roll + transformOrigin: Item.Center + + smooth: true + clip: true + + SvgElementImage { + id: pitch_scale + elementName: "pitch-scale" + //worldView is loaded with Loader, so background element is visible + sceneSize: background.sceneSize + anchors.centerIn: parent + //see comment for world transform + anchors.verticalCenterOffset: AttitudeState.Pitch*world.pitch1DegHeight + border: 64 //sometimes numbers are excluded from bounding rect + + smooth: true + } + } + } diff --git a/ground/openpilotgcs/share/openpilotgcs/pfd/default/RollScale.qml b/ground/openpilotgcs/share/openpilotgcs/pfd/default/RollScale.qml new file mode 100644 index 000000000..66263efd6 --- /dev/null +++ b/ground/openpilotgcs/share/openpilotgcs/pfd/default/RollScale.qml @@ -0,0 +1,28 @@ +import QtQuick 2.0 +import "." + +Item { + id: sceneItem + property variant sceneSize + property real horizontCenter + + onHorizontCenterChanged: console.log("horizont center:"+horizontCenter) + + SvgElementImage { + id: rollscale + elementName: "roll-scale" + sceneSize: sceneItem.sceneSize + + x: Math.floor(scaledBounds.x * sceneItem.width) + y: Math.floor(scaledBounds.y * sceneItem.height) + + smooth: true + + //rotate it around the center of horizon + transform: Rotation { + angle: -AttitudeState.Roll + origin.y : sceneItem.horizontCenter - rollscale.height/2 + origin.x : rollscale.width/2 + } + } +} diff --git a/ground/openpilotgcs/share/openpilotgcs/pfd/default/SpeedScale.qml b/ground/openpilotgcs/share/openpilotgcs/pfd/default/SpeedScale.qml index bbb7d50e2..e0b971afa 100644 --- a/ground/openpilotgcs/share/openpilotgcs/pfd/default/SpeedScale.qml +++ b/ground/openpilotgcs/share/openpilotgcs/pfd/default/SpeedScale.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 2.0 Item { id: sceneItem @@ -7,8 +7,8 @@ Item { Math.pow(VelocityState.East,2)) SvgElementImage { - id: speed_bg - elementName: "speed-bg" + id: speed_window + elementName: "speed-window" sceneSize: sceneItem.sceneSize clip: true @@ -31,14 +31,14 @@ Item { // speed numbers Column { - width: speed_bg.width + width: speed_window.width anchors.right: speed_scale.right Repeater { model: 7 Item { height: speed_scale.height / 6 - width: speed_bg.width + width: speed_window.width Text { //don't show negative numbers @@ -56,13 +56,25 @@ Item { } } } + + SvgElementImage { + id: speed_waypoint + elementName: "speed-waypoint" + sceneSize: sceneItem.sceneSize + visible: PathDesired.EndingVelocity !== 0.0 + + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + + anchors.verticalCenterOffset: speed_scale.height/30 * (sceneItem.groundSpeed - PathDesired.EndingVelocity) + } } SvgElementImage { - id: speed_window + id: speed_box clip: true - elementName: "speed-window" + elementName: "speed-box" sceneSize: sceneItem.sceneSize x: scaledBounds.x * sceneItem.width @@ -76,30 +88,22 @@ Item { color: "white" font { family: "Arial" - pixelSize: parent.height * 0.6 + pixelSize: parent.height * 0.4 } anchors.centerIn: parent } } - SvgElementImage { - id: speed_unit - elementName: "speed-unit" - sceneSize: sceneItem.sceneSize - clip: true - - x: Math.floor(scaledBounds.x * sceneItem.width) - y: Math.floor(scaledBounds.y * sceneItem.height) - - Text { - id: speed_unit_text - text: qmlWidget.speedUnit - color: "white" - font { - family: "Arial" - pixelSize: parent.height - } - anchors.right: parent.right + Text { + id: speed_unit_text + text: qmlWidget.speedUnit + color: "white" + font { + family: "Arial" + pixelSize: sceneSize.height * 0.025 } + anchors.top: speed_window.bottom + anchors.right: speed_window.right + anchors.margins: font.pixelSize * 0.3 } } diff --git a/ground/openpilotgcs/share/openpilotgcs/pfd/default/SvgElementImage.qml b/ground/openpilotgcs/share/openpilotgcs/pfd/default/SvgElementImage.qml index ea9d54626..6006380f0 100644 --- a/ground/openpilotgcs/share/openpilotgcs/pfd/default/SvgElementImage.qml +++ b/ground/openpilotgcs/share/openpilotgcs/pfd/default/SvgElementImage.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 2.0 Image { id: sceneItem @@ -17,7 +17,14 @@ Image { sourceSize.width: Math.round(sceneSize.width*scaledBounds.width) sourceSize.height: Math.round(sceneSize.height*scaledBounds.height) - Component.onCompleted: { + x: Math.floor(scaledBounds.x * sceneSize.width) + y: Math.floor(scaledBounds.y * sceneSize.height) + + Component.onCompleted: reloadImage() + onElementNameChanged: reloadImage() + onSceneSizeChanged: reloadImage() + + function reloadImage() { var params = "" if (hSliceCount > 1) params += "hslice="+hSlice+":"+hSliceCount+";" @@ -30,5 +37,6 @@ Image { params = "?" + params source = "image://svg/"+svgFileName+"!"+elementName+params + scaledBounds = svgRenderer.scaledElementBounds(svgFileName, elementName) } } diff --git a/ground/openpilotgcs/share/openpilotgcs/pfd/default/SvgElementPositionItem.qml b/ground/openpilotgcs/share/openpilotgcs/pfd/default/SvgElementPositionItem.qml new file mode 100644 index 000000000..cc43a024b --- /dev/null +++ b/ground/openpilotgcs/share/openpilotgcs/pfd/default/SvgElementPositionItem.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 + +Item { + id: sceneItem + property variant sceneSize + property string elementName + property string svgFileName: "pfd.svg" + property variant scaledBounds: svgRenderer.scaledElementBounds(svgFileName, elementName) + + x: Math.floor(scaledBounds.x * sceneSize.width) + y: Math.floor(scaledBounds.y * sceneSize.height) + width: Math.floor(scaledBounds.width * sceneSize.width) + height: Math.floor(scaledBounds.height * sceneSize.height) +} diff --git a/ground/openpilotgcs/share/openpilotgcs/pfd/default/VsiScale.qml b/ground/openpilotgcs/share/openpilotgcs/pfd/default/VsiScale.qml index dbcf6aa63..c40591424 100644 --- a/ground/openpilotgcs/share/openpilotgcs/pfd/default/VsiScale.qml +++ b/ground/openpilotgcs/share/openpilotgcs/pfd/default/VsiScale.qml @@ -1,27 +1,30 @@ -import Qt 4.7 +import QtQuick 2.0 Item { id: sceneItem property variant sceneSize SvgElementImage { - id: vsi_bg - elementName: "vsi-bg" + id: vsi_window + elementName: "vsi-window" sceneSize: sceneItem.sceneSize clip: true x: Math.floor(scaledBounds.x * sceneItem.width) y: Math.floor(scaledBounds.y * sceneItem.height) + property double scaleSteps : 8 + property double scaleStepValue : 1000 + property double scaleStepHeight : height/scaleSteps + SvgElementImage { id: vsi_bar elementName: "vsi-bar" sceneSize: sceneItem.sceneSize - //the scale in 1000 ft/min with height == 5200 ft/min - height: (-VelocityState.Down*3.28*60/1000)*(vsi_scale.height/5.2) - + //the scale in 1000 ft/min, convert from VelocityState.Down value in m/s + height: (-VelocityState.Down*3.28*60/vsi_window.scaleStepValue)*vsi_window.scaleStepHeight anchors.bottom: parent.verticalCenter anchors.left: parent.left @@ -42,16 +45,16 @@ Item { anchors.left: parent.right Repeater { - model: [2, 1, 0, 1, 2] + model: [3, 2, 1, 0, 1, 2, 3] Item { - height: vsi_scale.height / 5.2 //the scale height is 5200 - width: vsi_bg.width - vsi_scale.width //fill area right to scale + height: vsi_window.scaleStepHeight + width: vsi_window.width - vsi_scale.width //fill area right to scale Text { text: modelData visible: modelData !== 0 //hide "0" label color: "white" - font.pixelSize: parent.height / 4 + font.pixelSize: parent.height * 0.5 font.family: "Arial" anchors.centerIn: parent @@ -64,14 +67,28 @@ Item { SvgElementImage { - id: vsi_window + id: vsi_centerline clip: true smooth: true - elementName: "vsi-window" + elementName: "vsi-centerline" sceneSize: sceneItem.sceneSize x: Math.floor(scaledBounds.x * sceneItem.width) y: Math.floor(scaledBounds.y * sceneItem.height) } + + Text { + id: vsi_unit_text + text: "ft / m" + + color: "white" + font { + family: "Arial" + pixelSize: sceneSize.height * 0.02 + } + anchors.top: vsi_window.bottom + anchors.left: vsi_window.left + anchors.margins: font.pixelSize * 0.5 + } } diff --git a/ground/openpilotgcs/share/openpilotgcs/pfd/default/Warnings.qml b/ground/openpilotgcs/share/openpilotgcs/pfd/default/Warnings.qml new file mode 100644 index 000000000..0f86755e0 --- /dev/null +++ b/ground/openpilotgcs/share/openpilotgcs/pfd/default/Warnings.qml @@ -0,0 +1,115 @@ +import QtQuick 2.0 + +Item { + id: warnings + property variant sceneSize + // Uninitialised, OK, Warning, Error, Critical + property variant statusColors : ["gray", "green", "red", "red", "red"] + + SvgElementImage { + id: warning_bg + elementName: "warnings-bg" + sceneSize: warnings.sceneSize + } + + SvgElementPositionItem { + id: warning_rc_input + sceneSize: parent.sceneSize + elementName: "warning-rc-input" + + Rectangle { + anchors.fill: parent + color: warnings.statusColors[SystemAlarms.Alarm_ManualControl] + + Text { + anchors.centerIn: parent + text: "RC INPUT" + font { + family: "Arial" + pixelSize: parent.height * 0.8 + weight: Font.DemiBold + } + } + } + } + + SvgElementPositionItem { + id: warning_master_caution + sceneSize: parent.sceneSize + elementName: "warning-master-caution" + + property bool warningActive: (SystemAlarms.Alarm_BootFault > 1 || + SystemAlarms.Alarm_OutOfMemory > 1 || + SystemAlarms.Alarm_StackOverflow > 1 || + SystemAlarms.Alarm_CPUOverload > 1 || + SystemAlarms.Alarm_EventSystem > 1) + Rectangle { + anchors.fill: parent + color: parent.warningActive ? "red" : "red" + opacity: parent.warningActive ? 1.0 : 0.15 + + Text { + anchors.centerIn: parent + text: "MASTER CAUTION" + font { + family: "Arial" + pixelSize: parent.height * 0.8 + weight: Font.DemiBold + } + } + } + } + + SvgElementPositionItem { + id: warning_autopilot + sceneSize: parent.sceneSize + elementName: "warning-autopilot" + + Rectangle { + anchors.fill: parent + color: warnings.statusColors[SystemAlarms.Alarm_Guidance] + + Text { + anchors.centerIn: parent + text: "AUTOPILOT" + font { + family: "Arial" + pixelSize: parent.height * 0.8 + weight: Font.DemiBold + } + } + } + } + + SvgElementImage { + id: warning_gps + elementName: "warning-gps" + sceneSize: warnings.sceneSize + + visible: SystemAlarms.Alarm_GPS > 1 + } + + SvgElementImage { + id: warning_telemetry + elementName: "warning-telemetry" + sceneSize: warnings.sceneSize + + visible: SystemAlarms.Alarm_Telemetry > 1 + } + + SvgElementImage { + id: warning_battery + elementName: "warning-battery" + sceneSize: warnings.sceneSize + + visible: SystemAlarms.Alarm_Battery > 1 + } + + SvgElementImage { + id: warning_attitude + elementName: "warning-attitude" + sceneSize: warnings.sceneSize + + visible: SystemAlarms.Alarm_Attitude > 1 + } +} diff --git a/ground/openpilotgcs/share/openpilotgcs/pfd/default/pfd.svg b/ground/openpilotgcs/share/openpilotgcs/pfd/default/pfd.svg index 2b7ff19bd..2aa980b78 100644 --- a/ground/openpilotgcs/share/openpilotgcs/pfd/default/pfd.svg +++ b/ground/openpilotgcs/share/openpilotgcs/pfd/default/pfd.svg @@ -7,1607 +7,19 @@ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" - xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="1038.8931" - height="707.56323" + width="640" + height="480" id="svg2" version="1.1" - inkscape:version="0.48.4 r9939" - sodipodi:docname="pfd.svg" - style="display:inline" - inkscape:export-filename="C:\Users\Nuno\Desktop\OpenPilot\PFD\PFD-4.png" - inkscape:export-xdpi="71.993568" - inkscape:export-ydpi="71.993568"> + inkscape:version="0.48.2 r9819" + sodipodi:docname="pfd-2.svg" + inkscape:export-filename="/Users/muralha/Desktop/new PFD ideas/pfd/test2.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + id="defs4" /> - - - - - - - - + inkscape:guide-bbox="true"> + position="320,275.14994" + id="guide4799" /> - + position="299.42715,305" + id="guide7549" /> + position="215.3671,225.48102" + id="guide8295" /> - - - - - - + position="273.07596,436.08863" + id="guide8297" /> + position="328.00768,112" + id="guide8892" /> @@ -1721,2990 +73,4482 @@ image/svg+xml - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + inkscape:groupmode="layer" + id="layer25" + inkscape:label="home-bg" + style="display:inline"> + id="home-bg" + inkscape:label="#g4876"> - + y="404.5" + x="551.5" + height="59" + width="89" + id="rect4746" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:0.99999982;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" /> + + + + + + + + + + + + + + + + + + + + + + + - + + - - 10 - - - 10 - - - 20 - - - 20 - - - -10 - - - -10 - - - -20 - - - -20 - + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#00ffff;fill-opacity:1;stroke:none;display:inline;font-family:Sans" + id="home-eta-text"> + d="m 585.61493,452.36133 c -0.60938,10e-6 -1.06836,0.30079 -1.37695,0.90234 -0.30469,0.59766 -0.45704,1.49805 -0.45704,2.70117 0,1.19923 0.15235,2.09962 0.45704,2.70118 0.30859,0.59765 0.76757,0.89648 1.37695,0.89648 0.61328,0 1.07226,-0.29883 1.37695,-0.89648 0.30859,-0.60156 0.46289,-1.50195 0.46289,-2.70118 0,-1.20312 -0.1543,-2.10351 -0.46289,-2.70117 -0.30469,-0.60155 -0.76367,-0.90233 -1.37695,-0.90234 m 0,-0.9375 c 0.98046,10e-6 1.72851,0.38868 2.24414,1.16601 0.51952,0.77345 0.77929,1.89845 0.7793,3.375 -10e-6,1.47266 -0.25978,2.59766 -0.7793,3.375 -0.51563,0.77344 -1.26368,1.16016 -2.24414,1.16016 -0.98047,0 -1.73047,-0.38672 -2.25,-1.16016 -0.51563,-0.77734 -0.77344,-1.90234 -0.77344,-3.375 0,-1.47655 0.25781,-2.60155 0.77344,-3.375 0.51953,-0.77733 1.26953,-1.166 2.25,-1.16601" + style="font-size:12px;fill:#00ffff" + id="path6552" + inkscape:connector-curvature="0" /> + d="m 593.25555,452.36133 c -0.60937,10e-6 -1.06836,0.30079 -1.37695,0.90234 -0.30469,0.59766 -0.45703,1.49805 -0.45703,2.70117 0,1.19923 0.15234,2.09962 0.45703,2.70118 0.30859,0.59765 0.76758,0.89648 1.37695,0.89648 0.61328,0 1.07226,-0.29883 1.37696,-0.89648 0.30859,-0.60156 0.46288,-1.50195 0.46289,-2.70118 -1e-5,-1.20312 -0.1543,-2.10351 -0.46289,-2.70117 -0.3047,-0.60155 -0.76368,-0.90233 -1.37696,-0.90234 m 0,-0.9375 c 0.98047,10e-6 1.72851,0.38868 2.24414,1.16601 0.51953,0.77345 0.77929,1.89845 0.7793,3.375 -10e-6,1.47266 -0.25977,2.59766 -0.7793,3.375 -0.51563,0.77344 -1.26367,1.16016 -2.24414,1.16016 -0.98047,0 -1.73047,-0.38672 -2.25,-1.16016 -0.51562,-0.77734 -0.77343,-1.90234 -0.77343,-3.375 0,-1.47655 0.25781,-2.60155 0.77343,-3.375 0.51953,-0.77733 1.26953,-1.166 2.25,-1.16601" + style="font-size:12px;fill:#00ffff" + id="path6554" + inkscape:connector-curvature="0" /> + d="m 598.48798,458.8418 1.23632,0 0,1.48828 -1.23632,0 0,-1.48828 m 0,-4.7168 1.23632,0 0,1.48828 -1.23632,0 0,-1.48828" + style="font-size:12px;fill:#00ffff" + id="path6556" + inkscape:connector-curvature="0" /> + d="m 604.95087,452.36133 c -0.60938,10e-6 -1.06837,0.30079 -1.37696,0.90234 -0.30469,0.59766 -0.45703,1.49805 -0.45703,2.70117 0,1.19923 0.15234,2.09962 0.45703,2.70118 0.30859,0.59765 0.76758,0.89648 1.37696,0.89648 0.61327,0 1.07226,-0.29883 1.37695,-0.89648 0.30859,-0.60156 0.46288,-1.50195 0.46289,-2.70118 -10e-6,-1.20312 -0.1543,-2.10351 -0.46289,-2.70117 -0.30469,-0.60155 -0.76368,-0.90233 -1.37695,-0.90234 m 0,-0.9375 c 0.98046,10e-6 1.72851,0.38868 2.24414,1.16601 0.51952,0.77345 0.77929,1.89845 0.77929,3.375 0,1.47266 -0.25977,2.59766 -0.77929,3.375 -0.51563,0.77344 -1.26368,1.16016 -2.24414,1.16016 -0.98047,0 -1.73047,-0.38672 -2.25,-1.16016 -0.51563,-0.77734 -0.77344,-1.90234 -0.77344,-3.375 0,-1.47655 0.25781,-2.60155 0.77344,-3.375 0.51953,-0.77733 1.26953,-1.166 2.25,-1.16601" + style="font-size:12px;fill:#00ffff" + id="path6558" + inkscape:connector-curvature="0" /> + d="m 612.59149,452.36133 c -0.60938,10e-6 -1.06836,0.30079 -1.37695,0.90234 -0.30469,0.59766 -0.45703,1.49805 -0.45703,2.70117 0,1.19923 0.15234,2.09962 0.45703,2.70118 0.30859,0.59765 0.76757,0.89648 1.37695,0.89648 0.61328,0 1.07226,-0.29883 1.37695,-0.89648 0.30859,-0.60156 0.46289,-1.50195 0.4629,-2.70118 -10e-6,-1.20312 -0.15431,-2.10351 -0.4629,-2.70117 -0.30469,-0.60155 -0.76367,-0.90233 -1.37695,-0.90234 m 0,-0.9375 c 0.98047,10e-6 1.72851,0.38868 2.24414,1.16601 0.51953,0.77345 0.77929,1.89845 0.7793,3.375 -10e-6,1.47266 -0.25977,2.59766 -0.7793,3.375 -0.51563,0.77344 -1.26367,1.16016 -2.24414,1.16016 -0.98047,0 -1.73047,-0.38672 -2.25,-1.16016 -0.51562,-0.77734 -0.77344,-1.90234 -0.77344,-3.375 0,-1.47655 0.25782,-2.60155 0.77344,-3.375 0.51953,-0.77733 1.26953,-1.166 2.25,-1.16601" + style="font-size:12px;fill:#00ffff" + id="path6560" + inkscape:connector-curvature="0" /> + d="m 617.82391,458.8418 1.23633,0 0,1.48828 -1.23633,0 0,-1.48828 m 0,-4.7168 1.23633,0 0,1.48828 -1.23633,0 0,-1.48828" + style="font-size:12px;fill:#00ffff" + id="path6562" + inkscape:connector-curvature="0" /> + d="m 624.2868,452.36133 c -0.60937,10e-6 -1.06836,0.30079 -1.37695,0.90234 -0.30469,0.59766 -0.45703,1.49805 -0.45703,2.70117 0,1.19923 0.15234,2.09962 0.45703,2.70118 0.30859,0.59765 0.76758,0.89648 1.37695,0.89648 0.61328,0 1.07226,-0.29883 1.37696,-0.89648 0.30859,-0.60156 0.46288,-1.50195 0.46289,-2.70118 -1e-5,-1.20312 -0.1543,-2.10351 -0.46289,-2.70117 -0.3047,-0.60155 -0.76368,-0.90233 -1.37696,-0.90234 m 0,-0.9375 c 0.98047,10e-6 1.72851,0.38868 2.24414,1.16601 0.51953,0.77345 0.77929,1.89845 0.7793,3.375 -10e-6,1.47266 -0.25977,2.59766 -0.7793,3.375 -0.51563,0.77344 -1.26367,1.16016 -2.24414,1.16016 -0.98047,0 -1.73047,-0.38672 -2.25,-1.16016 -0.51562,-0.77734 -0.77343,-1.90234 -0.77343,-3.375 0,-1.47655 0.25781,-2.60155 0.77343,-3.375 0.51953,-0.77733 1.26953,-1.166 2.25,-1.16601" + style="font-size:12px;fill:#00ffff" + id="path6564" + inkscape:connector-curvature="0" /> + d="m 631.92743,452.36133 c -0.60938,10e-6 -1.06836,0.30079 -1.37695,0.90234 -0.30469,0.59766 -0.45704,1.49805 -0.45704,2.70117 0,1.19923 0.15235,2.09962 0.45704,2.70118 0.30859,0.59765 0.76757,0.89648 1.37695,0.89648 0.61328,0 1.07226,-0.29883 1.37695,-0.89648 0.30859,-0.60156 0.46289,-1.50195 0.46289,-2.70118 0,-1.20312 -0.1543,-2.10351 -0.46289,-2.70117 -0.30469,-0.60155 -0.76367,-0.90233 -1.37695,-0.90234 m 0,-0.9375 c 0.98046,10e-6 1.72851,0.38868 2.24414,1.16601 0.51952,0.77345 0.77929,1.89845 0.7793,3.375 -10e-6,1.47266 -0.25978,2.59766 -0.7793,3.375 -0.51563,0.77344 -1.26368,1.16016 -2.24414,1.16016 -0.98047,0 -1.73047,-0.38672 -2.25,-1.16016 -0.51563,-0.77734 -0.77344,-1.90234 -0.77344,-3.375 0,-1.47655 0.25781,-2.60155 0.77344,-3.375 0.51953,-0.77733 1.26953,-1.166 2.25,-1.16601" + style="font-size:12px;fill:#00ffff" + id="path6566" + inkscape:connector-curvature="0" /> + + + + + d="m 585.61493,439.36133 c -0.60938,10e-6 -1.06836,0.30079 -1.37695,0.90234 -0.30469,0.59766 -0.45704,1.49805 -0.45704,2.70117 0,1.19923 0.15235,2.09962 0.45704,2.70118 0.30859,0.59765 0.76757,0.89648 1.37695,0.89648 0.61328,0 1.07226,-0.29883 1.37695,-0.89648 0.30859,-0.60156 0.46289,-1.50195 0.46289,-2.70118 0,-1.20312 -0.1543,-2.10351 -0.46289,-2.70117 -0.30469,-0.60155 -0.76367,-0.90233 -1.37695,-0.90234 m 0,-0.9375 c 0.98046,10e-6 1.72851,0.38868 2.24414,1.16601 0.51952,0.77345 0.77929,1.89845 0.7793,3.375 -10e-6,1.47266 -0.25978,2.59766 -0.7793,3.375 -0.51563,0.77344 -1.26368,1.16016 -2.24414,1.16016 -0.98047,0 -1.73047,-0.38672 -2.25,-1.16016 -0.51563,-0.77734 -0.77344,-1.90234 -0.77344,-3.375 0,-1.47655 0.25781,-2.60155 0.77344,-3.375 0.51953,-0.77733 1.26953,-1.166 2.25,-1.16601" + style="font-size:12px;fill:#00ffff" + id="path6537" + inkscape:connector-curvature="0" /> + d="m 593.25555,439.36133 c -0.60937,10e-6 -1.06836,0.30079 -1.37695,0.90234 -0.30469,0.59766 -0.45703,1.49805 -0.45703,2.70117 0,1.19923 0.15234,2.09962 0.45703,2.70118 0.30859,0.59765 0.76758,0.89648 1.37695,0.89648 0.61328,0 1.07226,-0.29883 1.37696,-0.89648 0.30859,-0.60156 0.46288,-1.50195 0.46289,-2.70118 -1e-5,-1.20312 -0.1543,-2.10351 -0.46289,-2.70117 -0.3047,-0.60155 -0.76368,-0.90233 -1.37696,-0.90234 m 0,-0.9375 c 0.98047,10e-6 1.72851,0.38868 2.24414,1.16601 0.51953,0.77345 0.77929,1.89845 0.7793,3.375 -10e-6,1.47266 -0.25977,2.59766 -0.7793,3.375 -0.51563,0.77344 -1.26367,1.16016 -2.24414,1.16016 -0.98047,0 -1.73047,-0.38672 -2.25,-1.16016 -0.51562,-0.77734 -0.77343,-1.90234 -0.77343,-3.375 0,-1.47655 0.25781,-2.60155 0.77343,-3.375 0.51953,-0.77733 1.26953,-1.166 2.25,-1.16601" + style="font-size:12px;fill:#00ffff" + id="path6539" + inkscape:connector-curvature="0" /> + d="m 600.89618,439.36133 c -0.60938,10e-6 -1.06836,0.30079 -1.37695,0.90234 -0.30469,0.59766 -0.45704,1.49805 -0.45704,2.70117 0,1.19923 0.15235,2.09962 0.45704,2.70118 0.30859,0.59765 0.76757,0.89648 1.37695,0.89648 0.61328,0 1.07226,-0.29883 1.37695,-0.89648 0.30859,-0.60156 0.46289,-1.50195 0.46289,-2.70118 0,-1.20312 -0.1543,-2.10351 -0.46289,-2.70117 -0.30469,-0.60155 -0.76367,-0.90233 -1.37695,-0.90234 m 0,-0.9375 c 0.98046,10e-6 1.72851,0.38868 2.24414,1.16601 0.51952,0.77345 0.77929,1.89845 0.7793,3.375 -10e-6,1.47266 -0.25978,2.59766 -0.7793,3.375 -0.51563,0.77344 -1.26368,1.16016 -2.24414,1.16016 -0.98047,0 -1.73047,-0.38672 -2.25,-1.16016 -0.51563,-0.77734 -0.77344,-1.90234 -0.77344,-3.375 0,-1.47655 0.25781,-2.60155 0.77344,-3.375 0.51953,-0.77733 1.26953,-1.166 2.25,-1.16601" + style="font-size:12px;fill:#00ffff" + id="path6541" + inkscape:connector-curvature="0" /> + d="m 608.5368,439.36133 c -0.60937,10e-6 -1.06836,0.30079 -1.37695,0.90234 -0.30469,0.59766 -0.45703,1.49805 -0.45703,2.70117 0,1.19923 0.15234,2.09962 0.45703,2.70118 0.30859,0.59765 0.76758,0.89648 1.37695,0.89648 0.61328,0 1.07226,-0.29883 1.37696,-0.89648 0.30859,-0.60156 0.46288,-1.50195 0.46289,-2.70118 -1e-5,-1.20312 -0.1543,-2.10351 -0.46289,-2.70117 -0.3047,-0.60155 -0.76368,-0.90233 -1.37696,-0.90234 m 0,-0.9375 c 0.98047,10e-6 1.72851,0.38868 2.24414,1.16601 0.51953,0.77345 0.77929,1.89845 0.7793,3.375 -10e-6,1.47266 -0.25977,2.59766 -0.7793,3.375 -0.51563,0.77344 -1.26367,1.16016 -2.24414,1.16016 -0.98047,0 -1.73047,-0.38672 -2.25,-1.16016 -0.51562,-0.77734 -0.77343,-1.90234 -0.77343,-3.375 0,-1.47655 0.25781,-2.60155 0.77343,-3.375 0.51953,-0.77733 1.26953,-1.166 2.25,-1.16601" + style="font-size:12px;fill:#00ffff" + id="path6543" + inkscape:connector-curvature="0" /> + + + + + + + + + + + transform="translate(0,-4)" + sodipodi:insensitive="true"> - - Link + inkscape:groupmode="layer" + id="layer48" + inkscape:label="info-bg"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - Bat. + inkscape:groupmode="layer" + id="layer64" + inkscape:label="battery" + style="display:inline"> + + + + + + + + + + + + + + + + + + - - GPS - - - - - - + inkscape:groupmode="layer" + id="layer63" + inkscape:label="throttle" + style="display:inline"> - - - + id="eng1" + d="m 469,34.5 0,-11.082914" + style="fill:none;stroke:#008000;stroke-width:6;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline" /> + - + id="eng3" + d="m 485,34.5 0,-11.082914" + style="fill:none;stroke:#008000;stroke-width:6;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline" /> - - - - - - - - - - - - - - - - - - - - - - - - SPD - - ALT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2 - 1 - 2 - 1 - - - - ft/s - VSI - - - - - - - - - + id="eng5" + d="m 501,34.5 0,-11.082914" + style="fill:none;stroke:#008000;stroke-width:6;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline" /> - + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id="compass-fixed" + inkscape:label="#g9078"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + inkscape:transform-center-y="-72.696228" + style="font-size:33.9886322px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;display:inline;font-family:Sans" + id="compass-0"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + id="speed-scale" + inkscape:label="#g8377" + transform="translate(84,10)"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ground/openpilotgcs/src/libs/utils/svgimageprovider.cpp b/ground/openpilotgcs/src/libs/utils/svgimageprovider.cpp index 2b9a8c79a..14804dbc5 100644 --- a/ground/openpilotgcs/src/libs/utils/svgimageprovider.cpp +++ b/ground/openpilotgcs/src/libs/utils/svgimageprovider.cpp @@ -32,7 +32,7 @@ SvgImageProvider::SvgImageProvider(const QString &basePath) : QObject(), - QDeclarativeImageProvider(QDeclarativeImageProvider::Image), + QQuickImageProvider(QQuickImageProvider::Image), m_basePath(basePath) {} diff --git a/ground/openpilotgcs/src/libs/utils/svgimageprovider.h b/ground/openpilotgcs/src/libs/utils/svgimageprovider.h index e24f51e5a..a58b312b5 100644 --- a/ground/openpilotgcs/src/libs/utils/svgimageprovider.h +++ b/ground/openpilotgcs/src/libs/utils/svgimageprovider.h @@ -29,13 +29,13 @@ #define SVGIMAGEPROVIDER_H_ #include -#include +#include #include #include #include "utils_global.h" -class QTCREATOR_UTILS_EXPORT SvgImageProvider : public QObject, public QDeclarativeImageProvider { +class QTCREATOR_UTILS_EXPORT SvgImageProvider : public QObject, public QQuickImageProvider { Q_OBJECT public: SvgImageProvider(const QString &basePath); diff --git a/ground/openpilotgcs/src/libs/utils/utils.pro b/ground/openpilotgcs/src/libs/utils/utils.pro index aff6db1e0..202751020 100644 --- a/ground/openpilotgcs/src/libs/utils/utils.pro +++ b/ground/openpilotgcs/src/libs/utils/utils.pro @@ -6,7 +6,7 @@ QT += gui \ xml \ svg \ opengl \ - declarative \ + qml quick \ widgets DEFINES += QTCREATOR_UTILS_LIB diff --git a/ground/openpilotgcs/src/plugins/coreplugin/authorsdialog.cpp b/ground/openpilotgcs/src/plugins/coreplugin/aboutdialog.cpp similarity index 52% rename from ground/openpilotgcs/src/plugins/coreplugin/authorsdialog.cpp rename to ground/openpilotgcs/src/plugins/coreplugin/aboutdialog.cpp index c4f94d6aa..e47015051 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/authorsdialog.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/aboutdialog.cpp @@ -1,14 +1,9 @@ /** ****************************************************************************** * - * @file authorsdialog.cpp + * @file aboutdialog.h * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009. - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup CorePlugin Core Plugin - * @{ - * @brief The Core GCS plugin *****************************************************************************/ /* * This program is free software; you can redistribute it and/or modify @@ -26,74 +21,44 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "authorsdialog.h" +#include "aboutdialog.h" #include "version_info/version_info.h" #include "coreconstants.h" #include "icore.h" -#include - #include #include #include +#include +#include +#include -#include -#include -#include -#include -#include +#include +#include +#include +#include -#include -#include -#include -#include - -using namespace Core; -using namespace Core::Internal; using namespace Core::Constants; -AuthorsDialog::AuthorsDialog(QWidget *parent) - : QDialog(parent) +AboutDialog::AboutDialog(QWidget *parent) : + QDialog(parent) { - // We need to set the window icon explicitly here since for some reason the - // application icon isn't used when the size of the dialog is fixed (at least not on X11/GNOME) - setWindowIcon(QIcon(":/core/images/openpilot_logo_32.png")); setWindowTitle(tr("About OpenPilot")); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - // This loads a QML doc containing a Tabbed view - QDeclarativeView *view = new QDeclarativeView(this); - view->setSource(QUrl("qrc:/core/qml/AboutDialog.qml")); - - - QString version = QLatin1String(GCS_VERSION_LONG); - version += QDate(2007, 25, 10).toString(Qt::SystemLocaleDate); - - QString ideRev; - - // : This gets conditionally inserted as argument %8 into the description string. - ideRev = tr("From revision %1
").arg(VersionInfo::revision().left(10)); + setMinimumSize(600, 400); + setMaximumSize(800, 600); const QString description = tr( - "

OpenPilot Ground Control Station

" - "GCS Revision: %1
" + "Revision: %1
" "UAVO Hash: %2
" "
" "Built from %3
" "Built on %4 at %5
" "Based on Qt %6 (%7 bit)
" "
" - "© %8, 2010-%9. All rights reserved.
" - "
" - "This program 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.
" - "
" - "The program is provided AS IS with NO WARRANTY OF ANY KIND, " - "INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A " - "PARTICULAR PURPOSE.
" + "© %8, 2010-%9. All rights reserved.
" ).arg( VersionInfo::revision().left(60), // %1 VersionInfo::uavoHash().left(8), // %2 @@ -105,6 +70,28 @@ AuthorsDialog::AuthorsDialog(QWidget *parent) QLatin1String(GCS_AUTHOR), // %8 VersionInfo::year() // %9 ); - // Expose the version description to the QML doc + + QQuickView *view = new QQuickView(); + view->rootContext()->setContextProperty("dialog", this); view->rootContext()->setContextProperty("version", description); + view->setResizeMode(QQuickView::SizeRootObjectToView); + view->setSource(QUrl("qrc:/core/qml/AboutDialog.qml")); + + QWidget * container = QWidget::createWindowContainer(view); + container->setMinimumSize(600, 400); + container->setMaximumSize(800, 600); + container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + QVBoxLayout *lay = new QVBoxLayout(); + lay->setContentsMargins(0,0,0,0); + setLayout(lay); + layout()->addWidget(container); +} + +void AboutDialog::openUrl(const QString &url) +{ + QDesktopServices::openUrl(QUrl(url)); +} + +AboutDialog::~AboutDialog() +{ } diff --git a/ground/openpilotgcs/src/plugins/coreplugin/authorsdialog.h b/ground/openpilotgcs/src/plugins/coreplugin/aboutdialog.h similarity index 74% rename from ground/openpilotgcs/src/plugins/coreplugin/authorsdialog.h rename to ground/openpilotgcs/src/plugins/coreplugin/aboutdialog.h index 7c88cdf0e..6bce8d24b 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/authorsdialog.h +++ b/ground/openpilotgcs/src/plugins/coreplugin/aboutdialog.h @@ -1,14 +1,9 @@ /** ****************************************************************************** * - * @file authors.h + * @file aboutdialog.h * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009. - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup CorePlugin Core Plugin - * @{ - * @brief The Core GCS plugin *****************************************************************************/ /* * This program is free software; you can redistribute it and/or modify @@ -26,19 +21,22 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef AUTHORSDIALOG_H -#define AUTHORSDIALOG_H +#ifndef ABOUTDIALOG_H +#define ABOUTDIALOG_H #include -namespace Core { -namespace Internal { -class AuthorsDialog : public QDialog { +class AboutDialog : public QDialog +{ Q_OBJECT -public: - explicit AuthorsDialog(QWidget *parent); -}; -} // namespace Internal -} // namespace Core -#endif // AUTHORSDIALOG_H +public: + explicit AboutDialog(QWidget *parent = 0); + ~AboutDialog(); + +public slots: + void openUrl(const QString &url); + +}; + +#endif // ABOUTDIALOG_H diff --git a/ground/openpilotgcs/src/plugins/coreplugin/core.qrc b/ground/openpilotgcs/src/plugins/coreplugin/core.qrc index 8a4418c53..f8158f9be 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/core.qrc +++ b/ground/openpilotgcs/src/plugins/coreplugin/core.qrc @@ -62,8 +62,6 @@ images/cpu.png images/tx-rx.svg qml/images/tab.png - qml/ScrollDecorator.qml - qml/TabWidget.qml qml/AboutDialog.qml ../../../../../build/openpilotgcs-synthetics/AuthorsModel.qml diff --git a/ground/openpilotgcs/src/plugins/coreplugin/coreplugin.pro b/ground/openpilotgcs/src/plugins/coreplugin/coreplugin.pro index 1631fda8f..f566a71e0 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/coreplugin.pro +++ b/ground/openpilotgcs/src/plugins/coreplugin/coreplugin.pro @@ -2,7 +2,8 @@ TEMPLATE = lib TARGET = Core DEFINES += CORE_LIBRARY -QT += declarative \ +QT += qml \ + quick \ xml \ network \ script \ @@ -32,7 +33,6 @@ SOURCES += mainwindow.cpp \ uniqueidmanager.cpp \ messagemanager.cpp \ messageoutputwindow.cpp \ - versiondialog.cpp \ iuavgadget.cpp \ uavgadgetmanager/uavgadgetmanager.cpp \ uavgadgetmanager/uavgadgetview.cpp \ @@ -70,8 +70,8 @@ SOURCES += mainwindow.cpp \ uavgadgetdecorator.cpp \ workspacesettings.cpp \ uavconfiginfo.cpp \ - authorsdialog.cpp \ - telemetrymonitorwidget.cpp + telemetrymonitorwidget.cpp \ + aboutdialog.cpp HEADERS += mainwindow.h \ tabpositionindicator.h \ @@ -105,7 +105,6 @@ HEADERS += mainwindow.h \ iversioncontrol.h \ iview.h \ icorelistener.h \ - versiondialog.h \ core_global.h \ basemode.h \ baseview.h \ @@ -131,9 +130,9 @@ HEADERS += mainwindow.h \ uavgadgetdecorator.h \ workspacesettings.h \ uavconfiginfo.h \ - authorsdialog.h \ iconfigurableplugin.h \ - telemetrymonitorwidget.h + telemetrymonitorwidget.h \ + aboutdialog.h FORMS += dialogs/settingsdialog.ui \ dialogs/shortcutsettings.ui \ diff --git a/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.cpp b/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.cpp index 7a09f1403..f84e0c3b3 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.cpp @@ -45,7 +45,7 @@ #include "uavgadgetinstancemanager.h" #include "workspacesettings.h" -#include "authorsdialog.h" +#include "aboutdialog.h" #include "baseview.h" #include "ioutputpane.h" #include "icorelistener.h" @@ -56,7 +56,6 @@ #include "threadmanager.h" #include "uniqueidmanager.h" #include "variablemanager.h" -#include "versiondialog.h" #include #include @@ -114,8 +113,7 @@ MainWindow::MainWindow() : m_modeManager(0), m_connectionManager(0), m_mimeDatabase(new MimeDatabase), - m_versionDialog(0), - m_authorsDialog(0), + m_aboutDialog(0), m_activeContext(0), m_generalSettings(new GeneralSettings), m_shortcutSettings(new ShortcutSettings), @@ -790,7 +788,7 @@ void MainWindow::registerDefaultActions() #ifdef Q_WS_MAC cmd->action()->setMenuRole(QAction::ApplicationSpecificRole); #endif - connect(tmpaction, SIGNAL(triggered()), this, SLOT(aboutOpenPilotAuthors())); + connect(tmpaction, SIGNAL(triggered()), this, SLOT(showAboutDialog())); } void MainWindow::newFile() @@ -799,42 +797,6 @@ void MainWindow::newFile() void MainWindow::openFile() {} -/*static QList getNonEditorFileFactories() - { - QList tmp; - return tmp; - } - - static IFileFactory *findFileFactory(const QList &fileFactories, - const MimeDatabase *db, - const QFileInfo &fi) - { - if (const MimeType mt = db->findByFile(fi)) { - const QString type = mt.type(); - foreach (IFileFactory *factory, fileFactories) { - if (factory->mimeTypes().contains(type)) - return factory; - } - } - return 0; - } - - // opens either an editor or loads a project - void MainWindow::openFiles(const QStringList &fileNames) - { - QList nonEditorFileFactories = getNonEditorFileFactories(); - - foreach (const QString &fileName, fileNames) { - const QFileInfo fi(fileName); - const QString absoluteFilePath = fi.absoluteFilePath(); - if (IFileFactory *fileFactory = findFileFactory(nonEditorFileFactories, mimeDatabase(), fi)) { - fileFactory->open(absoluteFilePath); - } else { - - } - } - }*/ - void MainWindow::setFocusToEditor() {} @@ -1401,43 +1363,24 @@ void MainWindow::openRecentFile() if (!fileName.isEmpty()) {} } -void MainWindow::aboutOpenPilotGCS() +void MainWindow::showAboutDialog() { - if (!m_versionDialog) { - m_versionDialog = new VersionDialog(this); - connect(m_versionDialog, SIGNAL(finished(int)), - this, SLOT(destroyVersionDialog())); + if (!m_aboutDialog) { + m_aboutDialog = new AboutDialog(this); + connect(m_aboutDialog, SIGNAL(finished(int)), + this, SLOT(destroyAboutDialog())); } - m_versionDialog->show(); + m_aboutDialog->show(); } -void MainWindow::destroyVersionDialog() +void MainWindow::destroyAboutDialog() { - if (m_versionDialog) { - m_versionDialog->deleteLater(); - m_versionDialog = 0; + if (m_aboutDialog) { + m_aboutDialog->deleteLater(); + m_aboutDialog = 0; } } -void MainWindow::aboutOpenPilotAuthors() -{ - if (!m_authorsDialog) { - m_authorsDialog = new AuthorsDialog(this); - connect(m_authorsDialog, SIGNAL(finished(int)), - this, SLOT(destroyAuthorsDialog())); - } - m_authorsDialog->show(); -} - -void MainWindow::destroyAuthorsDialog() -{ - if (m_authorsDialog) { - m_authorsDialog->deleteLater(); - m_authorsDialog = 0; - } -} - - void MainWindow::aboutPlugins() { PluginDialog dialog(this); @@ -1453,12 +1396,8 @@ void MainWindow::setFullScreen(bool on) if (on) { setWindowState(windowState() | Qt::WindowFullScreen); - // statusBar()->hide(); - // menuBar()->hide(); } else { setWindowState(windowState() & ~Qt::WindowFullScreen); - // menuBar()->show(); - // statusBar()->show(); } } diff --git a/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.h b/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.h index a1aa1f508..c19903424 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.h +++ b/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.h @@ -43,6 +43,8 @@ class QToolButton; class MyTabWidget; QT_END_NAMESPACE +class AboutDialog; + namespace Core { class ActionManager; class BaseMode; @@ -72,8 +74,6 @@ class FancyTabWidget; class GeneralSettings; class ShortcutSettings; class WorkspaceSettings; -class VersionDialog; -class AuthorsDialog; class CORE_EXPORT MainWindow : public EventFilteringMainWindow { Q_OBJECT @@ -154,12 +154,10 @@ private slots: void openRecentFile(); void setFocusToEditor(); void saveAll(); - void aboutOpenPilotGCS(); + void showAboutDialog(); + void destroyAboutDialog(); void aboutPlugins(); - void aboutOpenPilotAuthors(); void updateFocusWidget(QWidget *old, QWidget *now); - void destroyVersionDialog(); - void destroyAuthorsDialog(); void modeChanged(Core::IMode *mode); void showUavGadgetMenus(bool show, bool hasSplitter); void applyTabBarSettings(QTabWidget::TabPosition pos, bool movable); @@ -191,8 +189,7 @@ private: MimeDatabase *m_mimeDatabase; MyTabWidget *m_modeStack; Core::BaseView *m_outputView; - VersionDialog *m_versionDialog; - AuthorsDialog *m_authorsDialog; + AboutDialog *m_aboutDialog; IContext *m_activeContext; diff --git a/ground/openpilotgcs/src/plugins/coreplugin/qml/AboutDialog.qml b/ground/openpilotgcs/src/plugins/coreplugin/qml/AboutDialog.qml index 9e1d64f20..bd3d9c9e6 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/qml/AboutDialog.qml +++ b/ground/openpilotgcs/src/plugins/coreplugin/qml/AboutDialog.qml @@ -1,110 +1,140 @@ - /**************************************************************************** - ** - ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). - ** All rights reserved. - ** Contact: Nokia Corporation (qt-info@nokia.com) - ** - ** This file is part of the examples of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:BSD$ - ** You may use this file under the terms of the BSD license as follows: - ** - ** "Redistribution and use in source and binary forms, with or without - ** modification, are permitted provided that the following conditions are - ** met: - ** * Redistributions of source code must retain the above copyright - ** notice, this list of conditions and the following disclaimer. - ** * Redistributions in binary form must reproduce the above copyright - ** notice, this list of conditions and the following disclaimer in - ** the documentation and/or other materials provided with the - ** distribution. - ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor - ** the names of its contributors may be used to endorse or promote - ** products derived from this software without specific prior written - ** permission. - ** - ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - ** $QT_END_LICENSE$ - ** - ****************************************************************************/ +/** + ****************************************************************************** + * + * @file aboutdialog.qml + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2013. + * + *****************************************************************************/ +/* + * This program 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. + * + * This program 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 this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +import QtQuick 2.1 +import QtQuick.Layouts 1.0 +import QtQuick.Controls 1.0 - import QtQuick 1.1 - - // This is a tabbed pane element. Add a nested Rectangle to add a tab. - TabWidget { - // Define AuthorsModel as type - property AuthorsModel authors: AuthorsModel {} - - id: tabs - width: 640; height: 480 - // This tab is for the GCS version information - Rectangle { - property string title: "OpenPilot GCS" - anchors.fill: parent - color: "#e3e3e3" - - Rectangle { - anchors.fill: parent; anchors.margins: 20 - color: "#e3e3e3" - Image { - source: "../images/openpilot_logo_128.png" - x: 0; y: 0; z: 100 - fillMode: Image.PreserveAspectFit - } - Flickable { - anchors.fill: parent - anchors.centerIn: parent - Text { - id: versionLabel - x: 156; y: 0 - width: 430; height: 379 - horizontalAlignment: Qt.AlignLeft - font.pixelSize: 12 - wrapMode: Text.WordWrap - // @var version exposed in authorsdialog.cpp - text: version - } +Rectangle { + id: container + width: 600 + height: 400 + + property AuthorsModel authors: AuthorsModel {} + + ColumnLayout { + id: columnLayout1 + anchors.fill: parent + spacing: 10 + RowLayout { + id: rowLayout1 + opacity: 1 + Image { + id: logo + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.top: parent.top + anchors.topMargin: 10 + source: "../images/openpilot_logo_128.png" + z: 100 + fillMode: Image.PreserveAspectFit + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: { + dialog.openUrl("http://www.openpilot.org") + } + } + } + + Rectangle { + anchors.left: logo.right + anchors.margins: 10 + anchors.right: parent.right + anchors.top: parent.top + Layout.fillHeight: true + Layout.fillWidth: true + anchors.bottom: parent.bottom + color: "transparent" + + ColumnLayout { + anchors.fill: parent + Text { + id: headerLabel + text: qsTr("OpenPilot Ground Control Station") + Layout.fillWidth: true + font.pixelSize: 14 + font.bold: true + + } + Text { + id: versionLabel + Layout.fillWidth: true + font.pixelSize: 12 + wrapMode: Text.WordWrap + text: version + } + Text { + id: licenseLabel + Layout.fillWidth: true + font.pixelSize: 9 + wrapMode: Text.WordWrap + text: qsTr("This program 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.\n" + + "The program is provided AS IS with NO WARRANTY OF ANY KIND, " + + "INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.") + } + + Text { + id: contributorLabel + text: qsTr("Contributors") + Layout.fillWidth: true + font.pixelSize: 14 + font.bold: true + + } + ScrollView { + Layout.fillWidth: true + Layout.fillHeight: true + frameVisible: true + ListView { + id: authorsView + anchors.fill: parent + + spacing: 3 + model: authors + delegate: Text { + font.pixelSize: 12 + text: name + } + clip: true + } + } } } } - // This tab is for the authors/contributors/credits - Rectangle { - property string title: "Contributors" - anchors.fill: parent; color: "#e3e3e3" - Rectangle { - anchors.fill: parent; anchors.margins: 20 - color: "#e3e3e3" - Text { - id: description - text: "

These people have been key contributors to the OpenPilot project. Without the work of the people in this list, OpenPilot would not be what it is today.

This list is sorted alphabetically by name

" - width: 600 - wrapMode: Text.WordWrap - - } - ListView { - id: authorsView - y: description.y + description.height + 20 - width: parent.width; height: parent.height - description.height - 20 - spacing: 3 - model: authors - delegate: Text { - text: name - } - clip: true - } - ScrollDecorator { - flickableItem: authorsView - } - } - } + Button { + id: button + text: qsTr("Ok") + activeFocusOnPress: true + anchors.right: parent.right + anchors.rightMargin: 10 + anchors.bottom: parent.bottom + anchors.bottomMargin: 10 + onClicked: dialog.close() + } + } } diff --git a/ground/openpilotgcs/src/plugins/coreplugin/qml/AuthorsModel.qml.template b/ground/openpilotgcs/src/plugins/coreplugin/qml/AuthorsModel.qml.template index 63d7e45cc..8bbabc0ab 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/qml/AuthorsModel.qml.template +++ b/ground/openpilotgcs/src/plugins/coreplugin/qml/AuthorsModel.qml.template @@ -1,7 +1,7 @@ /* This list model was created for the AuthorsDialog. */ -import QtQuick 1.1 +import QtQuick 2.0 ListModel { ${LIST_ELEMENTS} diff --git a/ground/openpilotgcs/src/plugins/coreplugin/qml/ScrollDecorator.qml b/ground/openpilotgcs/src/plugins/coreplugin/qml/ScrollDecorator.qml deleted file mode 100644 index 24c79c927..000000000 --- a/ground/openpilotgcs/src/plugins/coreplugin/qml/ScrollDecorator.qml +++ /dev/null @@ -1,40 +0,0 @@ -import QtQuick 1.1 - -Rectangle { - id: scrollDecorator - - property Flickable flickableItem: null - - Loader { - id: scrollLoader - sourceComponent: scrollDecorator.flickableItem ? scrollBar : undefined - } - - Component.onDestruction: scrollLoader.sourceComponent = undefined - - Component { - id: scrollBar - Rectangle { - property Flickable flickable: scrollDecorator.flickableItem - - parent: flickable - anchors.right: parent.right - - smooth: true - radius: 2 - color: "gray" - border.color: "lightgray" - border.width: 1.0 - opacity: flickable.moving ? 0.8 : 0.4 - - Behavior on opacity { - NumberAnimation { duration: 500 } - } - - width: 4 - height: flickable.height * (flickable.height / flickable.contentHeight) - y: flickable.height * (flickable.contentY / flickable.contentHeight) - visible: flickable.height < flickable.contentHeight - } - } -} diff --git a/ground/openpilotgcs/src/plugins/coreplugin/qml/TabWidget.qml b/ground/openpilotgcs/src/plugins/coreplugin/qml/TabWidget.qml deleted file mode 100644 index b6ce6bd41..000000000 --- a/ground/openpilotgcs/src/plugins/coreplugin/qml/TabWidget.qml +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.1 - -Item { - id: tabWidget - - // Setting the default property to stack.children means any child items - // of the TabWidget are actually added to the 'stack' item's children. - // See the "Property Binding" - // documentation for details on default properties. - default property alias content: stack.children - - property int current: 0 - - onCurrentChanged: setOpacities() - Component.onCompleted: setOpacities() - - function setOpacities() { - for (var i = 0; i < stack.children.length; ++i) { - stack.children[i].opacity = (i == current ? 1 : 0) - } - } - - Row { - id: header - - Repeater { - model: stack.children.length - delegate: Rectangle { - width: tabWidget.width / stack.children.length; height: 36 - - Rectangle { - width: parent.width; height: 1 - anchors { bottom: parent.bottom; bottomMargin: 1 } - color: "#acb2c2" - } - BorderImage { - anchors { fill: parent; leftMargin: 2; topMargin: 5; rightMargin: 1 } - border { left: 7; right: 7 } - source: "images/tab.png" - visible: tabWidget.current == index - } - Text { - horizontalAlignment: Qt.AlignHCenter; verticalAlignment: Qt.AlignVCenter - anchors.fill: parent - text: stack.children[index].title - elide: Text.ElideRight - font.bold: tabWidget.current == index - } - MouseArea { - anchors.fill: parent - onClicked: tabWidget.current = index - } - } - } - } - - Item { - id: stack - width: tabWidget.width - anchors.top: header.bottom; anchors.bottom: tabWidget.bottom - } -} \ No newline at end of file diff --git a/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.cpp b/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.cpp deleted file mode 100644 index 6887239fe..000000000 --- a/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/** - ****************************************************************************** - * - * @file versiondialog.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009. - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup CorePlugin Core Plugin - * @{ - * @brief The Core GCS plugin - *****************************************************************************/ -/* - * This program 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. - * - * This program 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 this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "versiondialog.h" -#include "version_info/version_info.h" -#include "coreconstants.h" -#include "icore.h" - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -using namespace Core; -using namespace Core::Internal; -using namespace Core::Constants; - -VersionDialog::VersionDialog(QWidget *parent) - : QDialog(parent) -{ - // We need to set the window icon explicitly here since for some reason the - // application icon isn't used when the size of the dialog is fixed (at least not on X11/GNOME) - setWindowIcon(QIcon(":/core/images/openpilot_logo_32.png")); - - setWindowTitle(tr("About OpenPilot GCS")); - setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - QGridLayout *layout = new QGridLayout(this); - layout->setSizeConstraint(QLayout::SetFixedSize); - - const QString description = tr( - "

OpenPilot Ground Control Station

" - "GCS Revision: %1
" - "UAVO Hash: %2
" - "
" - "Built from %3
" - "Built on %4 at %5
" - "Based on Qt %6 (%7 bit)
" - "
" - "© %8, 2010-%9. All rights reserved.
" - "
" - "This program 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.
" - "
" - "The program is provided AS IS with NO WARRANTY OF ANY KIND, " - "INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A " - "PARTICULAR PURPOSE.
" - ).arg( - VersionInfo::revision().left(60), // %1 - VersionInfo::uavoHash().left(8), // %2 - VersionInfo::origin(), // $3 - QLatin1String(__DATE__), // %4 - QLatin1String(__TIME__), // %5 - QLatin1String(QT_VERSION_STR), // %6 - QString::number(QSysInfo::WordSize), // %7 - QLatin1String(GCS_AUTHOR), // %8 - VersionInfo::year() // %9 - ); - - QLabel *copyRightLabel = new QLabel(description); - copyRightLabel->setWordWrap(true); - copyRightLabel->setOpenExternalLinks(true); - copyRightLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); - - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close); - QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close); - QTC_ASSERT(closeButton, /**/); - buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole)); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); - - QLabel *logoLabel = new QLabel; - logoLabel->setPixmap(QPixmap(QLatin1String(":/core/images/openpilot_logo_128.png"))); - layout->addWidget(logoLabel, 0, 0, 1, 1); - layout->addWidget(copyRightLabel, 0, 1, 4, 4); - layout->addWidget(buttonBox, 4, 0, 1, 5); -} diff --git a/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.h b/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.h deleted file mode 100644 index 58fd217b7..000000000 --- a/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - ****************************************************************************** - * - * @file versiondialog.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009. - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup CorePlugin Core Plugin - * @{ - * @brief The Core GCS plugin - *****************************************************************************/ -/* - * This program 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. - * - * This program 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 this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef VERSIONDIALOG_H -#define VERSIONDIALOG_H - -#include - -namespace Core { -namespace Internal { -class VersionDialog : public QDialog { - Q_OBJECT -public: - explicit VersionDialog(QWidget *parent); -}; -} // namespace Internal -} // namespace Core - -#endif // VERSIONDIALOG_H diff --git a/ground/openpilotgcs/src/plugins/pfdqml/pfdqml.pro b/ground/openpilotgcs/src/plugins/pfdqml/pfdqml.pro index 55f15b4d2..0d7da9e26 100644 --- a/ground/openpilotgcs/src/plugins/pfdqml/pfdqml.pro +++ b/ground/openpilotgcs/src/plugins/pfdqml/pfdqml.pro @@ -2,7 +2,7 @@ TEMPLATE = lib TARGET = PfdQml QT += svg QT += opengl -QT += declarative +QT += qml quick OSG { DEFINES += USE_OSG } diff --git a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadget.cpp b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadget.cpp index 365a323b7..30e803f33 100644 --- a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadget.cpp +++ b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadget.cpp @@ -21,7 +21,10 @@ PfdQmlGadget::PfdQmlGadget(QString classId, PfdQmlGadgetWidget *widget, QWidget *parent) : IUAVGadget(classId, parent), m_widget(widget) -{} +{ + m_container = NULL; + m_parent = parent; +} PfdQmlGadget::~PfdQmlGadget() { diff --git a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadget.h b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadget.h index b6525007f..131ab9b31 100644 --- a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadget.h +++ b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadget.h @@ -35,11 +35,18 @@ public: QWidget *widget() { - return m_widget; + if(!m_container){ + m_container = QWidget::createWindowContainer(m_widget, m_parent); + m_container->setMinimumSize(64, 64); + m_container->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + } + return m_container; } void loadConfiguration(IUAVGadgetConfiguration *config); private: + QWidget *m_container; + QWidget *m_parent; PfdQmlGadgetWidget *m_widget; }; diff --git a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetfactory.cpp b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetfactory.cpp index f7d6b1f66..197f1929d 100644 --- a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetfactory.cpp +++ b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetfactory.cpp @@ -31,7 +31,7 @@ PfdQmlGadgetFactory::~PfdQmlGadgetFactory() Core::IUAVGadget *PfdQmlGadgetFactory::createGadget(QWidget *parent) { - PfdQmlGadgetWidget *gadgetWidget = new PfdQmlGadgetWidget(parent); + PfdQmlGadgetWidget *gadgetWidget = new PfdQmlGadgetWidget(); return new PfdQmlGadget(QString("PfdQmlGadget"), gadgetWidget, parent); } diff --git a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.cpp index aa6879b7e..7f0262ad3 100644 --- a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.cpp @@ -27,13 +27,13 @@ #include #include #include +#include -#include -#include -#include +#include +#include -PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWidget *parent) : - QDeclarativeView(parent), +PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWindow *parent) : + QQuickView(parent), m_openGLEnabled(false), m_terrainEnabled(false), m_actualPositionUsed(false), @@ -45,14 +45,13 @@ PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWidget *parent) : m_altitudeUnit("m"), m_altitudeFactor(1.0) { - setMinimumSize(64, 64); - setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); setResizeMode(SizeRootObjectToView); // setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers))); QStringList objectsToExport; - objectsToExport << "VelocityState" << + objectsToExport << + "VelocityState" << "PositionState" << "AttitudeState" << "AccelState" << @@ -61,6 +60,8 @@ PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWidget *parent) : "AltitudeHoldDesired" << "GPSPositionSensor" << "GCSTelemetryStats" << + "SystemAlarms" << + "NedAccel" << "FlightBatteryState"; ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); @@ -94,6 +95,8 @@ void PfdQmlGadgetWidget::setQmlFile(QString fn) SvgImageProvider *svgProvider = new SvgImageProvider(fn); engine()->addImageProvider("svg", svgProvider); + engine()->clearComponentCache(); + // it's necessary to allow qml side to query svg element position engine()->rootContext()->setContextProperty("svgRenderer", svgProvider); engine()->setBaseUrl(QUrl::fromLocalFile(fn)); @@ -101,7 +104,7 @@ void PfdQmlGadgetWidget::setQmlFile(QString fn) qDebug() << Q_FUNC_INFO << fn; setSource(QUrl::fromLocalFile(fn)); - foreach(const QDeclarativeError &error, errors()) { + foreach(const QQmlError &error, errors()) { qDebug() << error.description(); } } @@ -159,19 +162,7 @@ void PfdQmlGadgetWidget::setAltitudeFactor(double factor) void PfdQmlGadgetWidget::setOpenGLEnabled(bool arg) { - if (m_openGLEnabled != arg) { - m_openGLEnabled = arg; - - qDebug() << Q_FUNC_INFO << "Set OPENGL" << m_openGLEnabled; - if (m_openGLEnabled) { - setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers))); - } else { - setViewport(new QWidget); - } - - // update terrainEnabled status with opengl status chaged setTerrainEnabled(m_terrainEnabled); - } } // Switch between PositionState UAVObject position @@ -184,6 +175,16 @@ void PfdQmlGadgetWidget::setActualPositionUsed(bool arg) } } +void PfdQmlGadgetWidget::mouseReleaseEvent(QMouseEvent *event) +{ + // Reload the schene on the middle mouse button click. + if (event->button() == Qt::MiddleButton) { + setQmlFile(m_qmlFileName); + } + + QQuickView::mouseReleaseEvent(event); +} + void PfdQmlGadgetWidget::setLatitude(double arg) { // not sure qFuzzyCompare is accurate enough for geo coordinates diff --git a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.h b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.h index 46d540345..222fb8ce4 100644 --- a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.h +++ b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.h @@ -18,9 +18,9 @@ #define PFDQMLGADGETWIDGET_H_ #include "pfdqmlgadgetconfiguration.h" -#include +#include -class PfdQmlGadgetWidget : public QDeclarativeView { +class PfdQmlGadgetWidget : public QQuickView { Q_OBJECT Q_PROPERTY(QString earthFile READ earthFile WRITE setEarthFile NOTIFY earthFileChanged) Q_PROPERTY(bool terrainEnabled READ terrainEnabled WRITE setTerrainEnabled NOTIFY terrainEnabledChanged) @@ -37,7 +37,7 @@ class PfdQmlGadgetWidget : public QDeclarativeView { Q_PROPERTY(double altitude READ altitude WRITE setAltitude NOTIFY altitudeChanged) public: - PfdQmlGadgetWidget(QWidget *parent = 0); + PfdQmlGadgetWidget(QWindow *parent = 0); ~PfdQmlGadgetWidget(); void setQmlFile(QString fn); @@ -115,6 +115,9 @@ signals: void altitudeUnitChanged(QString arg); void altitudeFactorChanged(double arg); +protected: + void mouseReleaseEvent(QMouseEvent *event); + private: QString m_qmlFileName; QString m_earthFile; diff --git a/ground/openpilotgcs/src/plugins/qmlview/qmlview.pro b/ground/openpilotgcs/src/plugins/qmlview/qmlview.pro index c2897f3a0..de95a7218 100644 --- a/ground/openpilotgcs/src/plugins/qmlview/qmlview.pro +++ b/ground/openpilotgcs/src/plugins/qmlview/qmlview.pro @@ -2,7 +2,7 @@ TEMPLATE = lib TARGET = QMLView QT += svg QT += opengl -QT += declarative +QT += qml quick include(../../openpilotgcsplugin.pri) include(../../plugins/coreplugin/coreplugin.pri) diff --git a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadget.cpp b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadget.cpp index d5aa1749c..aa071e893 100644 --- a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadget.cpp +++ b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadget.cpp @@ -33,7 +33,10 @@ QmlViewGadget::QmlViewGadget(QString classId, QmlViewGadgetWidget *widget, QWidget *parent) : IUAVGadget(classId, parent), m_widget(widget) -{} +{ + m_container = NULL; + m_parent = parent; +} QmlViewGadget::~QmlViewGadget() { diff --git a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadget.h b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadget.h index 152c58042..fe7fac302 100644 --- a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadget.h +++ b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadget.h @@ -46,11 +46,18 @@ public: QWidget *widget() { - return m_widget; + if(!m_container){ + m_container = QWidget::createWindowContainer(m_widget, m_parent); + m_container->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + m_container->setMinimumSize(64, 64); + } + return m_container; } void loadConfiguration(IUAVGadgetConfiguration *config); private: + QWidget *m_container; + QWidget *m_parent; QmlViewGadgetWidget *m_widget; }; diff --git a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetfactory.cpp b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetfactory.cpp index 20b7693bb..619f15179 100644 --- a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetfactory.cpp +++ b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetfactory.cpp @@ -42,7 +42,7 @@ QmlViewGadgetFactory::~QmlViewGadgetFactory() Core::IUAVGadget *QmlViewGadgetFactory::createGadget(QWidget *parent) { - QmlViewGadgetWidget *gadgetWidget = new QmlViewGadgetWidget(parent); + QmlViewGadgetWidget *gadgetWidget = new QmlViewGadgetWidget(); return new QmlViewGadget(QString("QmlViewGadget"), gadgetWidget, parent); } diff --git a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetwidget.cpp index 9abbb4b23..808cf3e80 100644 --- a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetwidget.cpp @@ -38,14 +38,12 @@ #include #include -#include -#include +#include +#include -QmlViewGadgetWidget::QmlViewGadgetWidget(QWidget *parent) : - QDeclarativeView(parent) +QmlViewGadgetWidget::QmlViewGadgetWidget(QWindow *parent) : + QQuickView(parent) { - setMinimumSize(64, 64); - setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); setResizeMode(SizeRootObjectToView); QStringList objectsToExport; @@ -90,7 +88,7 @@ void QmlViewGadgetWidget::setQmlFile(QString fn) qDebug() << Q_FUNC_INFO << fn; setSource(QUrl::fromLocalFile(fn)); - foreach(const QDeclarativeError &error, errors()) { + foreach(const QQmlError &error, errors()) { qDebug() << error.description(); } } @@ -100,9 +98,5 @@ void QmlViewGadgetWidget::setQmlFile(QString fn) */ void QmlViewGadgetWidget::enableOpenGL(bool flag) { - if (flag) { - setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers))); - } else { - setViewport(new QWidget); - } + Q_UNUSED(flag) } diff --git a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetwidget.h b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetwidget.h index 783cc963e..ef54fcf1b 100644 --- a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetwidget.h +++ b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetwidget.h @@ -30,7 +30,7 @@ #include "qmlviewgadgetconfiguration.h" -#include +#include #include #include @@ -40,11 +40,11 @@ class UAVObject; -class QmlViewGadgetWidget : public QDeclarativeView { +class QmlViewGadgetWidget : public QQuickView { Q_OBJECT public: - QmlViewGadgetWidget(QWidget *parent = 0); + QmlViewGadgetWidget(QWindow *parent = 0); ~QmlViewGadgetWidget(); void setQmlFile(QString fn); diff --git a/ground/openpilotgcs/src/plugins/welcome/qml/ActivityPanel.qml b/ground/openpilotgcs/src/plugins/welcome/qml/ActivityPanel.qml index 111c4d7e9..fdc258500 100644 --- a/ground/openpilotgcs/src/plugins/welcome/qml/ActivityPanel.qml +++ b/ground/openpilotgcs/src/plugins/welcome/qml/ActivityPanel.qml @@ -1,4 +1,5 @@ -import QtQuick 1.1 +import QtQuick 2.0 +import QtQuick.XmlListModel 2.0 Item { id: container diff --git a/ground/openpilotgcs/src/plugins/welcome/qml/CommunityPanel.qml b/ground/openpilotgcs/src/plugins/welcome/qml/CommunityPanel.qml index caa3678b2..20f19fd70 100644 --- a/ground/openpilotgcs/src/plugins/welcome/qml/CommunityPanel.qml +++ b/ground/openpilotgcs/src/plugins/welcome/qml/CommunityPanel.qml @@ -1,5 +1,5 @@ // import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 -import QtQuick 1.1 +import QtQuick 2.0 Item { property alias sourceSize: background.sourceSize diff --git a/ground/openpilotgcs/src/plugins/welcome/qml/NewsPanel.qml b/ground/openpilotgcs/src/plugins/welcome/qml/NewsPanel.qml index 6d794b210..0e6a8ef99 100644 --- a/ground/openpilotgcs/src/plugins/welcome/qml/NewsPanel.qml +++ b/ground/openpilotgcs/src/plugins/welcome/qml/NewsPanel.qml @@ -1,5 +1,6 @@ // import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 -import QtQuick 1.1 +import QtQuick 2.0 +import QtQuick.XmlListModel 2.0 Item { id: container diff --git a/ground/openpilotgcs/src/plugins/welcome/qml/ScrollDecorator.qml b/ground/openpilotgcs/src/plugins/welcome/qml/ScrollDecorator.qml index 24c79c927..5e4e7e8d9 100644 --- a/ground/openpilotgcs/src/plugins/welcome/qml/ScrollDecorator.qml +++ b/ground/openpilotgcs/src/plugins/welcome/qml/ScrollDecorator.qml @@ -1,4 +1,4 @@ -import QtQuick 1.1 +import QtQuick 2.0 Rectangle { id: scrollDecorator diff --git a/ground/openpilotgcs/src/plugins/welcome/qml/SitesPanel.qml b/ground/openpilotgcs/src/plugins/welcome/qml/SitesPanel.qml index c94f243e2..00f2e3664 100644 --- a/ground/openpilotgcs/src/plugins/welcome/qml/SitesPanel.qml +++ b/ground/openpilotgcs/src/plugins/welcome/qml/SitesPanel.qml @@ -1,5 +1,5 @@ // import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 -import QtQuick 1.1 +import QtQuick 2.0 Item { id: container diff --git a/ground/openpilotgcs/src/plugins/welcome/qml/WelcomePageButton.qml b/ground/openpilotgcs/src/plugins/welcome/qml/WelcomePageButton.qml index 9e5c1a74f..618baee73 100644 --- a/ground/openpilotgcs/src/plugins/welcome/qml/WelcomePageButton.qml +++ b/ground/openpilotgcs/src/plugins/welcome/qml/WelcomePageButton.qml @@ -1,5 +1,5 @@ // import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 -import QtQuick 1.1 +import QtQuick 2.0 Item { id: welcomeButton diff --git a/ground/openpilotgcs/src/plugins/welcome/qml/main.qml b/ground/openpilotgcs/src/plugins/welcome/qml/main.qml index 82e7b1064..7a58a8fa3 100644 --- a/ground/openpilotgcs/src/plugins/welcome/qml/main.qml +++ b/ground/openpilotgcs/src/plugins/welcome/qml/main.qml @@ -1,4 +1,4 @@ -import QtQuick 1.1 +import QtQuick 2.0 Rectangle { id: container diff --git a/ground/openpilotgcs/src/plugins/welcome/welcome.pro b/ground/openpilotgcs/src/plugins/welcome/welcome.pro index eb44bc8da..40eba229c 100644 --- a/ground/openpilotgcs/src/plugins/welcome/welcome.pro +++ b/ground/openpilotgcs/src/plugins/welcome/welcome.pro @@ -1,6 +1,6 @@ TEMPLATE = lib TARGET = Welcome -QT += network declarative +QT += network qml quick include(../../openpilotgcsplugin.pri) include(welcome_dependencies.pri) diff --git a/ground/openpilotgcs/src/plugins/welcome/welcomemode.cpp b/ground/openpilotgcs/src/plugins/welcome/welcomemode.cpp index 501c4ba7a..e2c21956f 100644 --- a/ground/openpilotgcs/src/plugins/welcome/welcomemode.cpp +++ b/ground/openpilotgcs/src/plugins/welcome/welcomemode.cpp @@ -45,10 +45,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include @@ -59,7 +59,7 @@ namespace Welcome { struct WelcomeModePrivate { WelcomeModePrivate(); - QDeclarativeView *declarativeView; + QQuickView *quickView; }; WelcomeModePrivate::WelcomeModePrivate() @@ -70,15 +70,16 @@ WelcomeMode::WelcomeMode() : m_d(new WelcomeModePrivate), m_priority(Core::Constants::P_MODE_WELCOME) { - m_d->declarativeView = new QDeclarativeView; - m_d->declarativeView->setResizeMode(QDeclarativeView::SizeRootObjectToView); - m_d->declarativeView->engine()->rootContext()->setContextProperty("welcomePlugin", this); - m_d->declarativeView->setSource(QUrl("qrc:/welcome/qml/main.qml")); + m_d->quickView = new QQuickView; + m_d->quickView->setResizeMode(QQuickView::SizeRootObjectToView); + m_d->quickView->engine()->rootContext()->setContextProperty("welcomePlugin", this); + m_d->quickView->setSource(QUrl("qrc:/welcome/qml/main.qml")); + m_container = NULL; } WelcomeMode::~WelcomeMode() { - delete m_d->declarativeView; + delete m_d->quickView; delete m_d; } @@ -99,7 +100,12 @@ int WelcomeMode::priority() const QWidget *WelcomeMode::widget() { - return m_d->declarativeView; + if(!m_container){ + m_container = QWidget::createWindowContainer(m_d->quickView); + m_container->setMinimumSize(64, 64); + m_container->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + } + return m_container; } const char *WelcomeMode::uniqueModeName() const diff --git a/ground/openpilotgcs/src/plugins/welcome/welcomemode.h b/ground/openpilotgcs/src/plugins/welcome/welcomemode.h index fa3f22856..b6e837cc9 100644 --- a/ground/openpilotgcs/src/plugins/welcome/welcomemode.h +++ b/ground/openpilotgcs/src/plugins/welcome/welcomemode.h @@ -72,6 +72,7 @@ public slots: void triggerAction(const QString &actionId); private: + QWidget *m_container; WelcomeModePrivate *m_d; int m_priority; }; diff --git a/ground/uavobjgenerator/generators/gcs/uavobjectgeneratorgcs.cpp b/ground/uavobjgenerator/generators/gcs/uavobjectgeneratorgcs.cpp index 2b1eb5d14..8821614dd 100644 --- a/ground/uavobjgenerator/generators/gcs/uavobjectgeneratorgcs.cpp +++ b/ground/uavobjgenerator/generators/gcs/uavobjectgeneratorgcs.cpp @@ -127,6 +127,9 @@ bool UAVObjectGeneratorGCS::process_object(ObjectInfo *info) type = fieldTypeStrCPP[field->type]; // Append field if (field->numElements > 1) { + //add both field(elementIndex)/setField(elemntIndex,value) and field_element properties + //field_element is more convenient if only certain element is used + //and much easier to use from the qml side propertyGetters += QString(" Q_INVOKABLE %1 get%2(quint32 index) const;\n") .arg(type).arg(field->name); @@ -153,6 +156,42 @@ bool UAVObjectGeneratorGCS::process_object(ObjectInfo *info) propertyNotifications += QString(" void %1Changed(quint32 index, %2 value);\n") .arg(field->name).arg(type); + + for (int elementIndex = 0; elementIndex < field->numElements; elementIndex++) { + QString elementName = field->elementNames[elementIndex]; + properties += QString(" Q_PROPERTY(%1 %2 READ get%2 WRITE set%2 NOTIFY %2Changed);\n") + .arg(type).arg(field->name+"_"+elementName); + propertyGetters += + QString(" Q_INVOKABLE %1 get%2_%3() const;\n") + .arg(type).arg(field->name).arg(elementName); + propertiesImpl += + QString("%1 %2::get%3_%4() const\n" + "{\n" + " QMutexLocker locker(mutex);\n" + " return data.%3[%5];\n" + "}\n") + .arg(type).arg(info->name).arg(field->name).arg(elementName).arg(elementIndex); + propertySetters += + QString(" void set%1_%2(%3 value);\n") + .arg(field->name).arg(elementName).arg(type); + propertiesImpl += + QString("void %1::set%2_%3(%4 value)\n" + "{\n" + " mutex->lock();\n" + " bool changed = data.%2[%5] != value;\n" + " data.%2[%5] = value;\n" + " mutex->unlock();\n" + " if (changed) emit %2_%3Changed(value);\n" + "}\n\n") + .arg(info->name).arg(field->name).arg(elementName).arg(type).arg(elementIndex); + propertyNotifications += + QString(" void %1_%2Changed(%3 value);\n") + .arg(field->name).arg(elementName).arg(type); + propertyNotificationsImpl += + QString(" //if (data.%1[%2] != oldData.%1[%2])\n" + " emit %1_%3Changed(data.%1[%2]);\n") + .arg(field->name).arg(elementIndex).arg(elementName); + } } else { properties += QString(" Q_PROPERTY(%1 %2 READ get%2 WRITE set%2 NOTIFY %2Changed);\n") .arg(type).arg(field->name);