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
0607c32c
Commit
0607c32c
authored
Jan 17, 2013
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added image logging functionality
parent
749a7494
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
3 deletions
+52
-3
HUD.cc
src/ui/HUD.cc
+47
-3
HUD.h
src/ui/HUD.h
+5
-0
No files found.
src/ui/HUD.cc
View file @
0607c32c
...
...
@@ -123,7 +123,8 @@ HUD::HUD(int width, int height, QWidget* parent)
videoEnabled
(
false
),
xImageFactor
(
1.0
),
yImageFactor
(
1.0
),
imageRequested
(
false
)
imageRequested
(
false
),
imageLoggingEnabled
(
false
)
{
// Set auto fill to false
setAutoFillBackground
(
false
);
...
...
@@ -224,7 +225,7 @@ void HUD::contextMenuEvent (QContextMenuEvent* event)
//menu.addAction(selectHUDColorAction);
menu
.
addAction
(
enableVideoAction
);
menu
.
addAction
(
selectOfflineDirectoryAction
);
//menu.addAction(selectVideoChannel
Action);
menu
.
addAction
(
selectSaveDirectory
Action
);
menu
.
exec
(
event
->
globalPos
());
}
...
...
@@ -242,9 +243,14 @@ void HUD::createActions()
enableVideoAction
->
setChecked
(
videoEnabled
);
connect
(
enableVideoAction
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
enableVideo
(
bool
)));
selectOfflineDirectoryAction
=
new
QAction
(
tr
(
"
Select
image log"
),
this
);
selectOfflineDirectoryAction
=
new
QAction
(
tr
(
"
Load
image log"
),
this
);
selectOfflineDirectoryAction
->
setStatusTip
(
tr
(
"Load previously logged images into simulation / replay"
));
connect
(
selectOfflineDirectoryAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
selectOfflineDirectory
()));
selectSaveDirectoryAction
=
new
QAction
(
tr
(
"Save images to directory"
),
this
);
selectSaveDirectoryAction
->
setStatusTip
(
tr
(
"Save images from image stream to a directory"
));
selectSaveDirectoryAction
->
setCheckable
(
true
);
connect
(
selectSaveDirectoryAction
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
saveImages
(
bool
)));
}
/**
...
...
@@ -1484,5 +1490,43 @@ void HUD::copyImage()
{
this
->
glImage
=
QGLWidget
::
convertToGLFormat
(
u
->
getImage
());
}
// Save to directory if logging is enabled
if
(
imageLoggingEnabled
)
{
u
->
getImage
().
save
(
QString
(
"%1/%2.png"
).
arg
(
imageLogDirectory
).
arg
(
imageLogCounter
));
imageLogCounter
++
;
}
}
}
void
HUD
::
saveImages
(
bool
save
)
{
if
(
save
)
{
QFileDialog
dialog
(
this
);
dialog
.
setFileMode
(
QFileDialog
::
DirectoryOnly
);
QString
imageLogDirectory
=
QFileDialog
::
getExistingDirectory
(
this
,
tr
(
"Select image log directory"
),
QDesktopServices
::
storageLocation
(
QDesktopServices
::
DesktopLocation
));
qDebug
()
<<
"Logging to:"
<<
imageLogDirectory
;
if
(
imageLogDirectory
!=
""
)
{
imageLogCounter
=
0
;
imageLoggingEnabled
=
true
;
qDebug
()
<<
"Logging on"
;
}
else
{
imageLoggingEnabled
=
false
;
selectSaveDirectoryAction
->
setChecked
(
false
);
}
}
else
{
imageLoggingEnabled
=
false
;
selectSaveDirectoryAction
->
setChecked
(
false
);
}
}
src/ui/HUD.h
View file @
0607c32c
...
...
@@ -86,6 +86,7 @@ public slots:
void
finishImage
();
void
saveImage
();
void
saveImage
(
QString
fileName
);
void
saveImages
(
bool
save
);
/** @brief Select directory where to load the offline files from */
void
selectOfflineDirectory
();
/** @brief Enable the HUD instruments */
...
...
@@ -220,14 +221,18 @@ protected:
bool
hudInstrumentsEnabled
;
bool
videoEnabled
;
bool
dataStreamEnabled
;
bool
imageLoggingEnabled
;
float
xImageFactor
;
float
yImageFactor
;
QAction
*
enableHUDAction
;
QAction
*
enableVideoAction
;
QAction
*
selectOfflineDirectoryAction
;
QAction
*
selectVideoChannelAction
;
QAction
*
selectSaveDirectoryAction
;
void
paintEvent
(
QPaintEvent
*
event
);
bool
imageRequested
;
QString
imageLogDirectory
;
unsigned
int
imageLogCounter
;
};
#endif // HUD_H
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