Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Animation.cpp #4

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Animation.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "Animation.h"

#include <QDateTime>
#include <cmath>

Animation::Animation(QObject *parent)
: QObject(parent)
Expand Down Expand Up @@ -38,6 +39,16 @@ void Animation::update()
mPfd->setDmeDistance(99.0 * sin(mPlayTime / 100.0));
mPfd->setAirspeedBug(-50.0 * cos(mPlayTime / 10.0) + 50.0);
mPfd->setAltitudeBug(-1000.0 * cos(mPlayTime / 40.0) + 1000.0);

mPfd->setLeftTankFuel(15 - 15 * cos(mPlayTime / 10.0));
mPfd->setRightTankFuel(15 - 15 * cos(mPlayTime / 20.0));
mPfd->setEgt(1300 - 600 * cos(mPlayTime / 10.0));
mPfd->setFuelFlow(10 - 10 * cos(mPlayTime / 10.0));
mPfd->setEngineTemperature(160 - 85 * cos(mPlayTime / 10.0));
mPfd->setEnginePressure(57.5 - 57.5 * cos(mPlayTime / 10.0));
mPfd->setVac(5 - 2 * cos(mPlayTime / 5.0));
mPfd->setAmp(60 * sin(mPlayTime / 10.0));
mPfd->setRpm(1750 - 1750 * cos(mPlayTime / 10.0));
}

void Animation::init()
Expand Down
77 changes: 25 additions & 52 deletions ExampleBasicSix.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,78 +10,51 @@ Window {
minimumHeight: 600
visibility: Window.Maximized
title: "Basic Six Example"
color: "#ffffff"
color: "#000000"

GridLayout {
Grid {
columns: 3

anchors {
fill: parent
centerIn: parent
margins: 16
}

Item {
Layout.fillWidth: true
Layout.fillHeight: true

AirspeedIndicator {
radius: 0.5 * Math.min(parent.width, parent.height)
airspeed: pfd.airspeed
}
AirspeedIndicator {
radius: 250
airspeed: pfd.airspeed
}

Item {
Layout.fillWidth: true
Layout.fillHeight: true

AttitudeIndicator {
radius: 0.5 * Math.min(parent.width, parent.height)
roll: pfd.roll
pitch: pfd.pitch
}
AttitudeIndicator {
radius: 250
roll: pfd.roll
pitch: pfd.pitch
}

Item {
Layout.fillWidth: true
Layout.fillHeight: true

Altimeter {
radius: 0.5 * Math.min(parent.width, parent.height)
altitude: pfd.altitude
pressure: pfd.pressure
}
Altimeter {
radius: 250
altitude: pfd.altitude
pressure: pfd.pressure
}

Item {
Layout.fillWidth: true
Layout.fillHeight: true

TurnCoordinator {
radius: 0.5 * Math.min(parent.width, parent.height)
turnRate: pfd.turnRate
slipSkid: pfd.slipSkid
}
TurnCoordinator {
radius: 250
turnRate: pfd.turnRate
slipSkid: pfd.slipSkid
}


Item {
Layout.fillWidth: true
Layout.fillHeight: true

HeadingIndicator {
radius: 0.5 * Math.min(parent.width, parent.height)
heading: pfd.heading
}
HeadingIndicator {
radius: 250
heading: pfd.heading
}

Item {
Layout.fillWidth: true
Layout.fillHeight: true

VerticalSpeedIndicator {
radius: 0.5 * Math.min(parent.width, parent.height)
climbRate: pfd.climbRate
}
VerticalSpeedIndicator {
radius: 250
climbRate: pfd.climbRate
}

}
}
2 changes: 1 addition & 1 deletion ExampleEFIS.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Window {
minimumHeight: 600
visibility: Window.Maximized
title: "EFIS Example"
color: "#ffffff"
color: "#000000"

Item {
id: container
Expand Down
41 changes: 34 additions & 7 deletions ExampleMiscellaneousGauges.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import "Misc/PropellerGauge"
import "Misc/TankGauge"
import "Misc/TemperaturePressureGauge"
import "Misc/VacAmpGauge"
import "Misc/EgtFuelFlowGauge"

import QtQuick 2.15
import QtQuick.Window 2.15
Expand All @@ -11,24 +14,48 @@ Window {
minimumHeight: 600
visibility: Window.Maximized
title: "Miscellaneous Gauges Example"
color: "#ffffff"
color: "#000000"

// Test

GridLayout {
columns: 2
FontLoader { source: "Resources/Fonts/CenturyGothic.ttf" }


Grid {
columns: 3

anchors {
fill: parent
centerIn: parent
margins: 16
}

TankGauge {
radius: 300
radius: 250
leftTankFuel: pfd.leftTankFuel
rightTankFuel: pfd.rightTankFuel
}

EgtFuelFlowGauge {
radius: 250
egt: pfd.egt
fuelFlow: pfd.fuelFlow
}

PropellerGauge {
radius: 300
radius: 250
rpm: pfd.rpm
}


VacAmpGauge {
radius: 250
vac: pfd.vac
amp: pfd.amp
}

TemperaturePressureGauge {
radius: 250
engineTemperature: pfd.engineTemperature
enginePressure: pfd.enginePressure
}
}
}
94 changes: 94 additions & 0 deletions Misc/EgtFuelFlowGauge/EgtFuelFlowGauge.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import "../../Misc"

import QtQuick 2.0

Item {
property double radius: 300

width: 2 * radius
height: 2 * radius

property double egt: 0
property double fuelFlow: 0

Rectangle {
width: 2 * radius
height: 2 * radius
radius: parent.radius
clip: true
color: "#181818"
scale: 0.775

EgtGauge {
x: -0.525 * width
y: 0
width: parent.width
height: parent.height
value: egt
}

FuelFlowGauge {
x: 0.525 * width
y: 0
width: parent.width
height: parent.height
value: fuelFlow
}

GaugeMask {}

CustomText {
x: 30 / 300 * parent.radius
width: 40 / 300 * parent.radius
height: 195 / 300 * parent.radius
color: "#ffffff"
text: "EGT"
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: Math.max(6, 0.075 * parent.width)
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
lineHeight: 1
wrapMode: Text.Wrap
}

CustomText {
x: 530 / 300 * parent.radius
width: 20 / 300 * parent.radius
height: 230 / 300 * parent.radius
color: "#ffffff"
text: "FUEL"
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: Math.max(6, 0.05 * parent.width)
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
lineHeight: 1
wrapMode: Text.Wrap
}

CustomText {
x: 560 / 300 * parent.radius
width: 30 / 300 * parent.radius
height: 230 / 300 * parent.radius
color: "#ffffff"
text: "F LOW"
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: Math.max(6, 0.05 * parent.width)
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
lineHeight: 1
wrapMode: Text.Wrap
}
}

CustomImage {
anchors.fill: parent
source: "../../Resources/misc/case.svg"
}
}


/*##^##
Designer {
D{i:0;formeditorColor:"#000000"}D{i:2}D{i:3}D{i:4}D{i:5}D{i:6}D{i:7}D{i:1}D{i:8}
}
##^##*/
73 changes: 73 additions & 0 deletions Misc/EgtFuelFlowGauge/EgtGauge.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import "../../Misc"

import QtQuick 2.15
import QtGraphicalEffects 1.0
import QtQuick.Extras 1.4
import QtQuick.Controls.Styles 1.4

CircularGauge {
id: root
minimumValue: 700
maximumValue: 1900
stepSize: 1
value: 0

property double minimumValueAngle: 125
property double maximumValueAngle: 55

style: CircularGaugeStyle {
id: style
minimumValueAngle: root.minimumValueAngle
maximumValueAngle: root.maximumValueAngle
tickmarkStepSize: 75
labelStepSize: 1000
minorTickmarkCount: 0

labelInset: 0.25 * outerRadius
tickmarkInset: 0.02 * outerRadius

tickmark: Rectangle {
color: "#ffffff"
width: 0.02 * outerRadius
height: 0.115 * outerRadius
radius: 0.01 * outerRadius
antialiasing: true
}

tickmarkLabel: Item {}

foreground: Item {}

needle: CustomNeedle {
width: 0.075 * outerRadius
height: 0.95 * outerRadius
}

background: Item {
id: background
width: 2 * outerRadius
height: 2 * outerRadius

CustomText {
color: "#ffffff"
x: 1.6 * outerRadius
y: 1.6 * outerRadius
text: "25 °C"
font.pixelSize: Math.max(6, 0.05 * parent.width)
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}

CustomText {
color: "#ffffff"
x: 1.63 * outerRadius
y: 1.725 * outerRadius
text: "DIV"
font.pixelSize: Math.max(6, 0.05 * parent.width)
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
}
}

Loading