Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
6a937f1b
Commit
6a937f1b
authored
Jul 16, 2011
by
lm
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'videostreaming' of
https://github.com/fattonz/qgroundcontrol
into dev-mac
parents
aa5f67d4
22d043ae
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
82 additions
and
19 deletions
+82
-19
lenna.jpg
images/patterns/lenna.jpg
+0
-0
mavground.qrc
mavground.qrc
+1
-0
qgcvideo.pro
qgcvideo.pro
+9
-6
QGCVideoApp.cc
src/apps/qgcvideo/QGCVideoApp.cc
+3
-1
QGCVideoMainWindow.cc
src/apps/qgcvideo/QGCVideoMainWindow.cc
+53
-0
QGCVideoMainWindow.h
src/apps/qgcvideo/QGCVideoMainWindow.h
+7
-0
QGCVideoWidget.cc
src/apps/qgcvideo/QGCVideoWidget.cc
+8
-12
QGCVideoWidget.h
src/apps/qgcvideo/QGCVideoWidget.h
+1
-0
No files found.
images/patterns/lenna.jpg
0 → 100644
View file @
6a937f1b
96.5 KB
mavground.qrc
View file @
6a937f1b
...
@@ -86,6 +86,7 @@
...
@@ -86,6 +86,7 @@
<file>images/mapproviders/googleearth.svg</file>
<file>images/mapproviders/googleearth.svg</file>
<file>images/contrib/slugs.png</file>
<file>images/contrib/slugs.png</file>
<file>images/style-outdoor.css</file>
<file>images/style-outdoor.css</file>
<file>images/patterns/lenna.jpg</file>
</qresource>
</qresource>
<qresource prefix="/general">
<qresource prefix="/general">
<file alias="vera.ttf">images/Vera.ttf</file>
<file alias="vera.ttf">images/Vera.ttf</file>
...
...
qgcvideo.pro
View file @
6a937f1b
...
@@ -7,15 +7,11 @@ TEMPLATE = app
...
@@ -7,15 +7,11 @@ TEMPLATE = app
TARGET
=
qgcvideo
TARGET
=
qgcvideo
BASEDIR
=
.
BASEDIR
=
.
BUILDDIR
=
build
/
qgcvideo
LANGUAGE
=
C
++
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
macx
:
DESTDIR
=
$$
BASEDIR
/
bin
/
mac
...
@@ -29,11 +25,18 @@ INCLUDEPATH += . \
...
@@ -29,11 +25,18 @@ INCLUDEPATH += . \
#
Input
#
Input
HEADERS
+=
\
HEADERS
+=
\
src
/
comm
/
UDPLink
.
h
\
src
/
comm
/
LinkInterface
.
h
\
src
/
comm
/
LinkManager
.
h
\
src
/
QGC
.
h
\
src
/
apps
/
qgcvideo
/
QGCVideoMainWindow
.
h
\
src
/
apps
/
qgcvideo
/
QGCVideoMainWindow
.
h
\
src
/
apps
/
qgcvideo
/
QGCVideoApp
.
h
\
src
/
apps
/
qgcvideo
/
QGCVideoApp
.
h
\
src
/
apps
/
qgcvideo
/
QGCVideoWidget
.
h
src
/
apps
/
qgcvideo
/
QGCVideoWidget
.
h
SOURCES
+=
\
SOURCES
+=
\
src
/
comm
/
UDPLink
.
cc
\
src
/
comm
/
LinkManager
.
cc
\
src
/
QGC
.
cc
\
src
/
apps
/
qgcvideo
/
main
.
cc
\
src
/
apps
/
qgcvideo
/
main
.
cc
\
src
/
apps
/
qgcvideo
/
QGCVideoMainWindow
.
cc
\
src
/
apps
/
qgcvideo
/
QGCVideoMainWindow
.
cc
\
src
/
apps
/
qgcvideo
/
QGCVideoApp
.
cc
\
src
/
apps
/
qgcvideo
/
QGCVideoApp
.
cc
\
...
...
src/apps/qgcvideo/QGCVideoApp.cc
View file @
6a937f1b
...
@@ -44,6 +44,8 @@
...
@@ -44,6 +44,8 @@
#include <QMainWindow>
#include <QMainWindow>
#include "QGCVideoApp.h"
#include "QGCVideoApp.h"
#include "QGCVideoMainWindow.h"
#include "UDPLink.h"
/**
/**
...
@@ -76,7 +78,7 @@ QGCVideoApp::QGCVideoApp(int &argc, char* argv[]) : QApplication(argc, argv)
...
@@ -76,7 +78,7 @@ QGCVideoApp::QGCVideoApp(int &argc, char* argv[]) : QApplication(argc, argv)
setFont
(
fontDatabase
.
font
(
fontFamilyName
,
"Roman"
,
12
));
setFont
(
fontDatabase
.
font
(
fontFamilyName
,
"Roman"
,
12
));
// Create main window
// Create main window
QMainWindow
*
window
=
new
QMainWindow
();
QMainWindow
*
window
=
new
Q
GCVideo
MainWindow
();
//window->setCentralWidget(new XMLCommProtocolWidget(window));
//window->setCentralWidget(new XMLCommProtocolWidget(window));
window
->
setWindowTitle
(
applicationName
()
+
" "
+
applicationVersion
());
window
->
setWindowTitle
(
applicationName
()
+
" "
+
applicationVersion
());
window
->
show
();
window
->
show
();
...
...
src/apps/qgcvideo/QGCVideoMainWindow.cc
View file @
6a937f1b
...
@@ -32,14 +32,67 @@
...
@@ -32,14 +32,67 @@
#include "QGCVideoMainWindow.h"
#include "QGCVideoMainWindow.h"
#include "ui_QGCVideoMainWindow.h"
#include "ui_QGCVideoMainWindow.h"
#include "UDPLink.h"
#include <QDebug>
QGCVideoMainWindow
::
QGCVideoMainWindow
(
QWidget
*
parent
)
:
QGCVideoMainWindow
::
QGCVideoMainWindow
(
QWidget
*
parent
)
:
QMainWindow
(
parent
),
QMainWindow
(
parent
),
link
(
QHostAddress
::
Any
,
5555
),
ui
(
new
Ui
::
QGCVideoMainWindow
)
ui
(
new
Ui
::
QGCVideoMainWindow
)
{
{
ui
->
setupUi
(
this
);
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
()
QGCVideoMainWindow
::~
QGCVideoMainWindow
()
{
{
delete
ui
;
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 @@
...
@@ -33,6 +33,7 @@
#define QGCVIDEOMAINWINDOW_H
#define QGCVIDEOMAINWINDOW_H
#include <QMainWindow>
#include <QMainWindow>
#include "UDPLink.h"
namespace
Ui
{
namespace
Ui
{
class
QGCVideoMainWindow
;
class
QGCVideoMainWindow
;
...
@@ -46,6 +47,12 @@ public:
...
@@ -46,6 +47,12 @@ public:
explicit
QGCVideoMainWindow
(
QWidget
*
parent
=
0
);
explicit
QGCVideoMainWindow
(
QWidget
*
parent
=
0
);
~
QGCVideoMainWindow
();
~
QGCVideoMainWindow
();
public
slots
:
void
receiveBytes
(
LinkInterface
*
link
,
QByteArray
data
);
protected:
UDPLink
link
;
private:
private:
Ui
::
QGCVideoMainWindow
*
ui
;
Ui
::
QGCVideoMainWindow
*
ui
;
};
};
...
...
src/apps/qgcvideo/QGCVideoWidget.cc
View file @
6a937f1b
...
@@ -160,7 +160,7 @@ QGCVideoWidget::QGCVideoWidget(QWidget* parent)
...
@@ -160,7 +160,7 @@ QGCVideoWidget::QGCVideoWidget(QWidget* parent)
// Refresh timer
// Refresh timer
refreshTimer
->
setInterval
(
updateInterval
);
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
// Resize to correct size and fill with image
//glDrawPixels(glImage.width(), glImage.height(), GL_RGBA, GL_UNSIGNED_BYTE, glImage.bits());
//glDrawPixels(glImage.width(), glImage.height(), GL_RGBA, GL_UNSIGNED_BYTE, glImage.bits());
...
@@ -201,16 +201,12 @@ QSize QGCVideoWidget::sizeHint() const
...
@@ -201,16 +201,12 @@ QSize QGCVideoWidget::sizeHint() const
void
QGCVideoWidget
::
showEvent
(
QShowEvent
*
event
)
void
QGCVideoWidget
::
showEvent
(
QShowEvent
*
event
)
{
{
// React only to internal (pre-display)
// events
Q_UNUSED
(
event
)
Q_UNUSED
(
event
)
refreshTimer
->
start
(
updateInterval
);
refreshTimer
->
start
(
updateInterval
);
}
}
void
QGCVideoWidget
::
hideEvent
(
QHideEvent
*
event
)
void
QGCVideoWidget
::
hideEvent
(
QHideEvent
*
event
)
{
{
// React only to internal (pre-display)
// events
Q_UNUSED
(
event
);
Q_UNUSED
(
event
);
refreshTimer
->
stop
();
refreshTimer
->
stop
();
}
}
...
@@ -220,20 +216,20 @@ void QGCVideoWidget::contextMenuEvent (QContextMenuEvent* event)
...
@@ -220,20 +216,20 @@ void QGCVideoWidget::contextMenuEvent (QContextMenuEvent* event)
QMenu
menu
(
this
);
QMenu
menu
(
this
);
// Update actions
// Update actions
enableHUDAction
->
setChecked
(
hudInstrumentsEnabled
);
enableHUDAction
->
setChecked
(
hudInstrumentsEnabled
);
enableVideoAction
->
setChecked
(
videoEnabled
);
//
enableVideoAction->setChecked(videoEnabled);
menu
.
addAction
(
enableHUDAction
);
menu
.
addAction
(
enableHUDAction
);
//menu.addAction(selectQGCVideoWidgetColorAction);
//menu.addAction(selectQGCVideoWidgetColorAction);
menu
.
addAction
(
enableVideoAction
);
//
menu.addAction(enableVideoAction);
menu
.
addAction
(
selectOfflineDirectoryAction
);
//
menu.addAction(selectOfflineDirectoryAction);
//menu.addAction(selectVideoChannelAction);
//menu.addAction(selectVideoChannelAction);
menu
.
exec
(
event
->
globalPos
());
menu
.
exec
(
event
->
globalPos
());
}
}
void
QGCVideoWidget
::
createActions
()
void
QGCVideoWidget
::
createActions
()
{
{
enableHUDAction
=
new
QAction
(
tr
(
"Enable
QGCVideoWidget
"
),
this
);
enableHUDAction
=
new
QAction
(
tr
(
"Enable
HUD
"
),
this
);
enableHUDAction
->
setStatusTip
(
tr
(
"Show the
QGCVideoWidget
instruments in this window"
));
enableHUDAction
->
setStatusTip
(
tr
(
"Show the
HUD
instruments in this window"
));
enableHUDAction
->
setCheckable
(
true
);
enableHUDAction
->
setCheckable
(
true
);
enableHUDAction
->
setChecked
(
hudInstrumentsEnabled
);
enableHUDAction
->
setChecked
(
hudInstrumentsEnabled
);
connect
(
enableHUDAction
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
enableHUDInstruments
(
bool
)));
connect
(
enableHUDAction
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
enableHUDInstruments
(
bool
)));
...
@@ -242,11 +238,11 @@ void QGCVideoWidget::createActions()
...
@@ -242,11 +238,11 @@ void QGCVideoWidget::createActions()
enableVideoAction
->
setStatusTip
(
tr
(
"Show the video live feed"
));
enableVideoAction
->
setStatusTip
(
tr
(
"Show the video live feed"
));
enableVideoAction
->
setCheckable
(
true
);
enableVideoAction
->
setCheckable
(
true
);
enableVideoAction
->
setChecked
(
videoEnabled
);
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
=
new
QAction
(
tr
(
"Select image log"
),
this
);
selectOfflineDirectoryAction
->
setStatusTip
(
tr
(
"Load previously logged images into simulation / replay"
));
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:
...
@@ -30,6 +30,7 @@ public slots:
/** @brief Copy an image from an external buffer */
/** @brief Copy an image from an external buffer */
void
copyImage
(
const
QImage
&
img
);
void
copyImage
(
const
QImage
&
img
);
void
enableHUDInstruments
(
bool
enabled
)
{
hudInstrumentsEnabled
=
enabled
;
}
void
enableHUDInstruments
(
bool
enabled
)
{
hudInstrumentsEnabled
=
enabled
;
}
void
enableVideo
(
bool
enabled
)
{
videoEnabled
=
enabled
;
}
protected
slots
:
protected
slots
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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