Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
6a937f1b
Commit
6a937f1b
authored
Jul 16, 2011
by
lm
Browse files
Merge branch 'videostreaming' of
https://github.com/fattonz/qgroundcontrol
into dev-mac
parents
aa5f67d4
22d043ae
Changes
8
Hide whitespace changes
Inline
Side-by-side
images/patterns/lenna.jpg
0 → 100644
View file @
6a937f1b
96.5 KB
mavground.qrc
View file @
6a937f1b
...
...
@@ -86,6 +86,7 @@
<file>images/mapproviders/googleearth.svg</file>
<file>images/contrib/slugs.png</file>
<file>images/style-outdoor.css</file>
<file>images/patterns/lenna.jpg</file>
</qresource>
<qresource prefix="/general">
<file alias="vera.ttf">images/Vera.ttf</file>
...
...
qgcvideo.pro
View file @
6a937f1b
...
...
@@ -7,15 +7,11 @@ TEMPLATE = app
TARGET
=
qgcvideo
BASEDIR
=
.
BUILDDIR
=
build
/
qgcvideo
LANGUAGE
=
C
++
CONFIG
+=
release
CONFIG
-=
debug
OBJECTS_DIR
=
$$
BUILDDIR
/
obj
MOC_DIR
=
$$
BUILDDIR
/
moc
UI_HEADERS_DIR
=
src
/
ui
/
generated
macx
:
DESTDIR
=
$$
BASEDIR
/
bin
/
mac
...
...
@@ -29,11 +25,18 @@ INCLUDEPATH += . \
#
Input
HEADERS
+=
\
src
/
comm
/
UDPLink
.
h
\
src
/
comm
/
LinkInterface
.
h
\
src
/
comm
/
LinkManager
.
h
\
src
/
QGC
.
h
\
src
/
apps
/
qgcvideo
/
QGCVideoMainWindow
.
h
\
src
/
apps
/
qgcvideo
/
QGCVideoApp
.
h
\
src
/
apps
/
qgcvideo
/
QGCVideoWidget
.
h
SOURCES
+=
\
src
/
comm
/
UDPLink
.
cc
\
src
/
comm
/
LinkManager
.
cc
\
src
/
QGC
.
cc
\
src
/
apps
/
qgcvideo
/
main
.
cc
\
src
/
apps
/
qgcvideo
/
QGCVideoMainWindow
.
cc
\
src
/
apps
/
qgcvideo
/
QGCVideoApp
.
cc
\
...
...
src/apps/qgcvideo/QGCVideoApp.cc
View file @
6a937f1b
...
...
@@ -44,6 +44,8 @@
#include
<QMainWindow>
#include
"QGCVideoApp.h"
#include
"QGCVideoMainWindow.h"
#include
"UDPLink.h"
/**
...
...
@@ -76,7 +78,7 @@ QGCVideoApp::QGCVideoApp(int &argc, char* argv[]) : QApplication(argc, argv)
setFont
(
fontDatabase
.
font
(
fontFamilyName
,
"Roman"
,
12
));
// Create main window
QMainWindow
*
window
=
new
QMainWindow
();
QMainWindow
*
window
=
new
Q
GCVideo
MainWindow
();
//window->setCentralWidget(new XMLCommProtocolWidget(window));
window
->
setWindowTitle
(
applicationName
()
+
" "
+
applicationVersion
());
window
->
show
();
...
...
src/apps/qgcvideo/QGCVideoMainWindow.cc
View file @
6a937f1b
...
...
@@ -32,14 +32,67 @@
#include
"QGCVideoMainWindow.h"
#include
"ui_QGCVideoMainWindow.h"
#include
"UDPLink.h"
#include
<QDebug>
QGCVideoMainWindow
::
QGCVideoMainWindow
(
QWidget
*
parent
)
:
QMainWindow
(
parent
),
link
(
QHostAddress
::
Any
,
5555
),
ui
(
new
Ui
::
QGCVideoMainWindow
)
{
ui
->
setupUi
(
this
);
// Set widgets in video mode
ui
->
video1Widget
->
enableVideo
(
true
);
ui
->
video2Widget
->
enableVideo
(
true
);
ui
->
video3Widget
->
enableVideo
(
true
);
ui
->
video4Widget
->
enableVideo
(
true
);
// Connect link to this widget, receive all bytes
connect
(
&
link
,
SIGNAL
(
bytesReceived
(
LinkInterface
*
,
QByteArray
)),
this
,
SLOT
(
receiveBytes
(
LinkInterface
*
,
QByteArray
)));
// Open port
link
.
connect
();
}
QGCVideoMainWindow
::~
QGCVideoMainWindow
()
{
delete
ui
;
}
void
QGCVideoMainWindow
::
receiveBytes
(
LinkInterface
*
link
,
QByteArray
data
)
{
// There is no need to differentiate between links
// for this use case here
Q_UNUSED
(
link
);
// Image data is stored in QByteArray
// Output bytes and load Lenna!
QString
bytes
;
QString
ascii
;
for
(
int
i
=
0
;
i
<
data
.
size
();
i
++
)
{
unsigned
char
v
=
data
[
i
];
bytes
.
append
(
QString
().
sprintf
(
"%02x "
,
v
));
if
(
data
.
at
(
i
)
>
31
&&
data
.
at
(
i
)
<
127
)
{
ascii
.
append
(
data
.
at
(
i
));
}
else
{
ascii
.
append
(
219
);
}
}
qDebug
()
<<
"Received"
<<
data
.
size
()
<<
"bytes"
;
qDebug
()
<<
bytes
;
qDebug
()
<<
"ASCII:"
<<
ascii
;
// Load image into window
QImage
test
(
":images/patterns/lenna.jpg"
);
ui
->
video1Widget
->
copyImage
(
test
);
ui
->
video2Widget
->
copyImage
(
test
);
ui
->
video3Widget
->
copyImage
(
test
);
ui
->
video4Widget
->
copyImage
(
test
);
}
src/apps/qgcvideo/QGCVideoMainWindow.h
View file @
6a937f1b
...
...
@@ -33,6 +33,7 @@
#define QGCVIDEOMAINWINDOW_H
#include
<QMainWindow>
#include
"UDPLink.h"
namespace
Ui
{
class
QGCVideoMainWindow
;
...
...
@@ -46,6 +47,12 @@ public:
explicit
QGCVideoMainWindow
(
QWidget
*
parent
=
0
);
~
QGCVideoMainWindow
();
public
slots
:
void
receiveBytes
(
LinkInterface
*
link
,
QByteArray
data
);
protected:
UDPLink
link
;
private:
Ui
::
QGCVideoMainWindow
*
ui
;
};
...
...
src/apps/qgcvideo/QGCVideoWidget.cc
View file @
6a937f1b
...
...
@@ -160,7 +160,7 @@ QGCVideoWidget::QGCVideoWidget(QWidget* parent)
// Refresh timer
refreshTimer
->
setInterval
(
updateInterval
);
connect
(
refreshTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
paint
QGCVideoWidget
()));
connect
(
refreshTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
paint
HUD
()));
// Resize to correct size and fill with image
//glDrawPixels(glImage.width(), glImage.height(), GL_RGBA, GL_UNSIGNED_BYTE, glImage.bits());
...
...
@@ -201,16 +201,12 @@ QSize QGCVideoWidget::sizeHint() const
void
QGCVideoWidget
::
showEvent
(
QShowEvent
*
event
)
{
// React only to internal (pre-display)
// events
Q_UNUSED
(
event
)
refreshTimer
->
start
(
updateInterval
);
}
void
QGCVideoWidget
::
hideEvent
(
QHideEvent
*
event
)
{
// React only to internal (pre-display)
// events
Q_UNUSED
(
event
);
refreshTimer
->
stop
();
}
...
...
@@ -220,20 +216,20 @@ void QGCVideoWidget::contextMenuEvent (QContextMenuEvent* event)
QMenu
menu
(
this
);
// Update actions
enableHUDAction
->
setChecked
(
hudInstrumentsEnabled
);
enableVideoAction
->
setChecked
(
videoEnabled
);
//
enableVideoAction->setChecked(videoEnabled);
menu
.
addAction
(
enableHUDAction
);
//menu.addAction(selectQGCVideoWidgetColorAction);
menu
.
addAction
(
enableVideoAction
);
menu
.
addAction
(
selectOfflineDirectoryAction
);
//
menu.addAction(enableVideoAction);
//
menu.addAction(selectOfflineDirectoryAction);
//menu.addAction(selectVideoChannelAction);
menu
.
exec
(
event
->
globalPos
());
}
void
QGCVideoWidget
::
createActions
()
{
enableHUDAction
=
new
QAction
(
tr
(
"Enable
QGCVideoWidget
"
),
this
);
enableHUDAction
->
setStatusTip
(
tr
(
"Show the
QGCVideoWidget
instruments in this window"
));
enableHUDAction
=
new
QAction
(
tr
(
"Enable
HUD
"
),
this
);
enableHUDAction
->
setStatusTip
(
tr
(
"Show the
HUD
instruments in this window"
));
enableHUDAction
->
setCheckable
(
true
);
enableHUDAction
->
setChecked
(
hudInstrumentsEnabled
);
connect
(
enableHUDAction
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
enableHUDInstruments
(
bool
)));
...
...
@@ -242,11 +238,11 @@ void QGCVideoWidget::createActions()
enableVideoAction
->
setStatusTip
(
tr
(
"Show the video live feed"
));
enableVideoAction
->
setCheckable
(
true
);
enableVideoAction
->
setChecked
(
videoEnabled
);
connect
(
enableVideoAction
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
enableVideo
(
bool
)));
//
connect(enableVideoAction, SIGNAL(triggered(bool)), this, SLOT(enableVideo(bool)));
selectOfflineDirectoryAction
=
new
QAction
(
tr
(
"Select image log"
),
this
);
selectOfflineDirectoryAction
->
setStatusTip
(
tr
(
"Load previously logged images into simulation / replay"
));
connect
(
selectOfflineDirectoryAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
selectOfflineDirectory
()));
//
connect(selectOfflineDirectoryAction, SIGNAL(triggered()), this, SLOT(selectOfflineDirectory()));
}
/**
...
...
src/apps/qgcvideo/QGCVideoWidget.h
View file @
6a937f1b
...
...
@@ -30,6 +30,7 @@ public slots:
/** @brief Copy an image from an external buffer */
void
copyImage
(
const
QImage
&
img
);
void
enableHUDInstruments
(
bool
enabled
)
{
hudInstrumentsEnabled
=
enabled
;
}
void
enableVideo
(
bool
enabled
)
{
videoEnabled
=
enabled
;
}
protected
slots
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment