Skip to content

Commit

Permalink
Merge pull request #10 from infincia/master
Browse files Browse the repository at this point in the history
resync
  • Loading branch information
pilotnbr1 authored Dec 3, 2019
2 parents e544c7b + 96bfc01 commit 5d3d4eb
Show file tree
Hide file tree
Showing 20 changed files with 320 additions and 131 deletions.
43 changes: 21 additions & 22 deletions QOpenHD.pro
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,6 @@ SOURCES += \
lib/GeographicLib-1.50/src/UTMUPS.cpp \
lib/GeographicLib-1.50/src/Utility.cpp

#CONFIG += EnableRC


iOSBuild {
QMAKE_INFO_PLIST = ios/Info.plist
Expand All @@ -173,9 +171,9 @@ iOSBuild {
icons/LaunchScreen.storyboard
LIBS += -framework VideoToolbox -framework AudioToolbox -framework CoreAudio -framework CoreVideo -framework CoreMedia
CONFIG -= bitcode
CONFIG += EnableGamepads
#CONFIG += EnableGamepads
CONFIG += EnableSpeech
CONFIG += EnableVideo
CONFIG += EnableMainVideo
CONFIG += EnablePiP
CONFIG += EnableLink

Expand All @@ -198,12 +196,12 @@ MacBuild {
DISTFILES += mac/Info.plist
LIBS += -framework ApplicationServices
LIBS += -framework VideoToolbox -framework CoreVideo -framework CoreMedia
CONFIG += EnableGamepads
#CONFIG += EnableGamepads
CONFIG += EnableJoysticks
CONFIG += EnableSpeech
CONFIG += EnableVideo
CONFIG += EnableMainVideo
CONFIG += EnablePiP
#CONFIG += EnableLink
CONFIG += EnableLink

DEFINES += GST_GL_HAVE_WINDOW_COCOA=1
DEFINES += GST_GL_HAVE_PLATFORM_CGL=1
Expand All @@ -212,9 +210,9 @@ MacBuild {

LinuxBuild {
QT += x11extras
CONFIG += EnableGamepads
#CONFIG += EnableGamepads
CONFIG += EnableJoysticks
CONFIG += EnableVideo
CONFIG += EnableMainVideo
CONFIG += EnablePiP
CONFIG += EnableLink

Expand All @@ -227,19 +225,16 @@ RaspberryPiBuild {
# handled by another process running on the ground station. We could
# replace that at some point but for now it isn't necessary.
message("RaspberryPiBuild - config")
#CONFIG += EnableVideo
#CONFIG +- EnablePiP
CONFIG += EnableMainVideo
CONFIG += EnablePiP
CONFIG += EnableLink

DEFINES += GST_GL_HAVE_PLATFORM_EGL=1
DEFINES += HAVE_QT_EGLFS=1
}

WindowsBuild {
CONFIG += EnableGamepads
#CONFIG += EnableGamepads
CONFIG += EnableJoysticks
CONFIG += EnableSpeech
CONFIG += EnableVideo
CONFIG += EnableMainVideo
#CONFIG +- EnablePiP
CONFIG += EnableLink

Expand All @@ -251,10 +246,10 @@ WindowsBuild {
}

AndroidBuild {
CONFIG += EnableGamepads
#CONFIG += EnableGamepads
CONFIG += EnableJoysticks
CONFIG += EnableSpeech
CONFIG += EnableVideo
CONFIG += EnableMainVideo
CONFIG += EnablePiP
CONFIG += EnableLink

Expand All @@ -274,9 +269,9 @@ EnableSpeech {
QT += texttospeech
}

EnableVideo {
message("EnableVideo")
DEFINES += ENABLE_VIDEO
EnableMainVideo {
message("EnableMainVideo")
DEFINES += ENABLE_MAIN_VIDEO
}

EnablePiP {
Expand Down Expand Up @@ -328,8 +323,12 @@ installer {

}
WindowsBuild {
DESTDIR_WIN = $$replace(DESTDIR, "/", "\\")

OTHER_FILES += tools/qopenhd_installer.nsi
QMAKE_POST_LINK += c:\Qt\5.13.1\msvc2017\bin\windeployqt.exe --qmldir $${PWD}/qml \"$${DESTDIR_WIN}\\QOpenHD.exe\"
QMAKE_POST_LINK +=$${PWD}/win_deploy_sdl.cmd \"$$DESTDIR_WIN\" \"$$PWD\QJoysticks\lib\SDL\bin\windows\msvc\x86\" $$escape_expand(\\n)

QMAKE_POST_LINK += $$escape_expand(\\n) c:\Qt\5.13.1\msvc2017\bin\windeployqt.exe --qmldir $${PWD}/qml \"$${DESTDIR_WIN}\\QOpenHD.exe\"

#QMAKE_POST_LINK += && $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcp140.dll\" \"$$DESTDIR_WIN\"
#QMAKE_POST_LINK += && $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcr140.dll\" \"$$DESTDIR_WIN\"
Expand Down
2 changes: 2 additions & 0 deletions inc/openhdrc.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ private slots:
QTextToSpeech *m_speech;
#endif

uint8_t seqno = 0;

uint m_rc1 = 1500;
uint m_rc2 = 1500;
uint m_rc3 = 1500;
Expand Down
3 changes: 2 additions & 1 deletion inc/openhdvideostream.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public slots:
bool firstRun = true;

bool m_enable_videotest = false;
bool m_enable_hardware_video_decoder = true;
bool m_enable_software_video_decoder = false;
bool m_enable_rtp = true;

bool m_enable_pip_video = false;

Expand Down
5 changes: 4 additions & 1 deletion inc/qopenhdlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ class QOpenHDLink: public QObject {
explicit QOpenHDLink(QObject *parent = nullptr);

Q_INVOKABLE void setWidgetLocation(QString widgetName, int alignment, int xOffset, int yOffset, bool hCenter, bool vCenter);
Q_INVOKABLE void setWidgetEnabled(QString widgetName, bool enabled);

signals:
void widgetLocation(QString widgetName, int alignment, int xOffset, int yOffset, bool hCenter, bool vCenter);
void widgetEnabled(QString widgetName, bool enabled);

private slots:
void readyRead();

Expand All @@ -28,7 +31,7 @@ private slots:

void processCommand(QByteArray buffer);
void processSetWidgetLocation(nlohmann::json command);

void processSetWidgetEnabled(nlohmann::json commandData);

QUdpSocket *linkSocket = nullptr;
};
Expand Down
4 changes: 4 additions & 0 deletions inc/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ QString tracker_mode_from_enum(TRACKER_MODE mode);

uint map(double input, double input_start, double input_end, uint16_t output_start, uint16_t output_end);

#if defined(__android__)
void keep_screen_on(bool on);
#endif

#endif // UTIL_H
21 changes: 11 additions & 10 deletions qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ApplicationWindow {
minimumHeight: 320
minimumWidth: 480
title: qsTr("Open.HD")
color: EnableVideo ? "black" : "#00000000"
color: EnableMainVideo ? "black" : "#00000000"

visibility: UseFullscreen ? "FullScreen" : "AutomaticVisibility"

Expand All @@ -32,11 +32,11 @@ ApplicationWindow {
OpenHDRC.initRC;
}
initialised = true;
if (EnableVideo) {
if (EnableMainVideo) {
MainStream.startVideo();
if (EnablePiP) {
PiPStream.startVideo();
}
}
if (EnablePiP) {
PiPStream.startVideo();
}
}
}
Expand All @@ -46,7 +46,7 @@ ApplicationWindow {
// to be initialized, depending on the order they appear in the QML, will simply
// not work on desktop linux.
Loader {
source: (EnableVideo && EnablePiP) ? "DummyVideoItem.qml" : ""
source: (EnableMainVideo && EnablePiP) ? "DummyVideoItem.qml" : ""
}

/*
Expand All @@ -60,7 +60,8 @@ ApplicationWindow {
property int pip_video_port: 5601
property int battery_cells: 3
property bool show_pip_video: false
property bool enable_hardware_video_decoder: true
property bool enable_software_video_decoder: false
property bool enable_rtp: true

property bool enable_speech: true
property bool enable_imperial: false
Expand All @@ -76,13 +77,13 @@ ApplicationWindow {
property bool show_flight_mode: true
property bool show_ground_status: true
property bool show_air_status: true
property bool show_log_onscreen: true
property bool show_message_hud: true
property bool show_horizon: true
property bool show_fpv: true
property bool show_altitude: true
property bool show_speed: true
property bool show_heading: true
property bool show_second_alt: true
property bool show_altitude_second: true
property bool show_arrow: true
property bool show_map: true
property bool show_throttle: true
Expand Down Expand Up @@ -117,7 +118,7 @@ ApplicationWindow {
width: parent.width
height: parent.height
z: 1.0
source: EnableVideo ? "MainVideoItem.qml" : ""
source: EnableMainVideo ? "MainVideoItem.qml" : ""
}

Connections {
Expand Down
62 changes: 46 additions & 16 deletions qml/ui/AppSettingsPanel.ui.qml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ Item {

TabButton {
text: qsTr("Video")
width: EnableVideo ? implicitWidth : 0
width: (EnableMainVideo || EnablePiP) ? implicitWidth : 0
height: 48
font.pixelSize: 13
visible: EnableVideo
visible: (EnableMainVideo || EnablePiP)
}


Expand Down Expand Up @@ -190,7 +190,7 @@ Item {
Rectangle {
width: parent.width
height: rowHeight
color: "#8cbfd7f3"
color: "#00000000"
y: 3 * rowHeight
visible: EnableRC

Expand Down Expand Up @@ -553,8 +553,8 @@ Item {

anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
checked: settings.show_log_onscreen
onCheckedChanged: settings.show_log_onscreen = checked
checked: settings.show_message_hud
onCheckedChanged: settings.show_message_hud = checked
}
}

Expand Down Expand Up @@ -733,8 +733,8 @@ Item {

anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
checked: settings.show_second_alt
onCheckedChanged: settings.show_second_alt = checked
checked: settings.show_altitude_second
onCheckedChanged: settings.show_altitude_second = checked
}
}

Expand Down Expand Up @@ -885,10 +885,10 @@ Item {
id: videoView
width: parent.width
height: parent.height
contentHeight: 4 * rowHeight
contentHeight: 5 * rowHeight

clip: true
visible: EnableVideo
visible: EnableMainVideo || EnablePiP

Rectangle {
width: parent.width
Expand All @@ -897,7 +897,7 @@ Item {
y: 0 * rowHeight

Text {
text: "Use hardware video decoder"
text: "Always use software video decoder"
font.weight: Font.Bold
font.pixelSize: 13
anchors.leftMargin: 8
Expand All @@ -915,8 +915,8 @@ Item {

anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
checked: settings.enable_hardware_video_decoder
onCheckedChanged: settings.enable_hardware_video_decoder = checked
checked: settings.enable_software_video_decoder
onCheckedChanged: settings.enable_software_video_decoder = checked
}
}

Expand All @@ -926,6 +926,36 @@ Item {
color: "#00000000"
y: 1 * rowHeight

Text {
text: "Stream is RTP"
font.weight: Font.Bold
font.pixelSize: 13
anchors.leftMargin: 8
verticalAlignment: Text.AlignVCenter
anchors.verticalCenter: parent.verticalCenter
width: 224
height: elementHeight
anchors.left: parent.left
}

Switch {
width: 32
height: elementHeight
anchors.rightMargin: Qt.inputMethod.visible ? 96 : 36

anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
checked: settings.enable_rtp
onCheckedChanged: settings.enable_rtp = checked
}
}

Rectangle {
width: parent.width
height: rowHeight
color: "#8cbfd7f3"
y: 2 * rowHeight

Text {
text: "Main video port"
font.weight: Font.Bold
Expand Down Expand Up @@ -958,8 +988,8 @@ Item {
Rectangle {
width: parent.width
height: rowHeight
color: "#8cbfd7f3"
y: 2 * rowHeight
color: "#00000000"
y: 3 * rowHeight
visible: EnablePiP

Text {
Expand Down Expand Up @@ -989,8 +1019,8 @@ Item {
Rectangle {
width: parent.width
height: rowHeight
color: "#00000000"
y: 3 * rowHeight
color: "#8cbfd7f3"
y: 4 * rowHeight
visible: EnablePiP

Text {
Expand Down
1 change: 0 additions & 1 deletion qml/ui/HUDOverlayGridForm.ui.qml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ Item {

VideoWidget {
id: pipVideoWidget
elementName: "pipVideoItem"
}

MapWidget {
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/AltitudeSecondWidgetForm.ui.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ BaseWidget {
defaultYOffset: 64
dragging: false

visible: settings.show_second_alt
visible: settings.show_altitude_second

widgetIdentifier: "altitude_second_widget"

Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/MessageHUDForm.ui.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ BaseWidget {
width: 480
height: 72

visible: settings.show_log_onscreen
visible: settings.show_message_hud

widgetIdentifier: "message_hud_widget"

Expand Down
Loading

0 comments on commit 5d3d4eb

Please sign in to comment.