Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guilhem Saurel
hpp-gui
Commits
c2c7da18
Commit
c2c7da18
authored
Mar 06, 2018
by
Joseph Mirabel
Committed by
Joseph Mirabel
Mar 06, 2018
Browse files
Move button to capture scene to gepetto-viewer-corba
parent
390e096f
Changes
2
Hide whitespace changes
Inline
Side-by-side
plugins/hppwidgetsplugin/pathplayer.cc
View file @
c2c7da18
...
...
@@ -5,12 +5,7 @@
#include
"hppwidgetsplugin/pathplayer.hh"
#include
<QDoubleSpinBox>
#include
<QFileDialog>
#include
<QTextBrowser>
#include
<QProgressDialog>
#include
<QPushButton>
#include
<QSpinBox>
#include
<QSlider>
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
# include <QtCore>
...
...
@@ -41,9 +36,6 @@ namespace hpp {
,
ui_
(
new
::
Ui
::
PathPlayerWidget
)
,
timerId_
(
0
)
,
velocity_
(
false
)
,
process_
(
new
QProcess
(
this
))
,
showPOutput_
(
new
QDialog
(
this
,
Qt
::
Dialog
|
Qt
::
WindowCloseButtonHint
|
Qt
::
WindowMinMaxButtonsHint
))
,
pOutput_
(
new
QTextBrowser
())
,
plugin_
(
plugin
)
{
ui_
->
setupUi
(
this
);
...
...
@@ -52,26 +44,13 @@ namespace hpp {
connect
(
pathIndex
(),
SIGNAL
(
valueChanged
(
int
)),
this
,
SLOT
(
pathIndexChanged
(
int
)));
connect
(
playPause
(),
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
playPauseToggled
(
bool
)));
connect
(
stop
(),
SIGNAL
(
clicked
()),
this
,
SLOT
(
stopClicked
()));
connect
(
record
(),
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
recordToggled
(
bool
)));
connect
(
ui_
->
refreshButton_path
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
update
()));
process_
->
setProcessChannelMode
(
QProcess
::
MergedChannels
);
connect
(
process_
,
SIGNAL
(
readyReadStandardOutput
()),
SLOT
(
readyReadProcessOutput
()));
showPOutput_
->
setModal
(
false
);
showPOutput_
->
setLayout
(
new
QHBoxLayout
());
showPOutput_
->
layout
()
->
addWidget
(
pOutput_
);
initSearchActions
();
}
PathPlayer
::~
PathPlayer
()
{
if
(
process_
!=
NULL
)
{
if
(
process_
->
state
()
==
QProcess
::
Running
)
process_
->
kill
();
delete
process_
;
}
delete
ui_
;
}
...
...
@@ -252,48 +231,6 @@ namespace hpp {
updateConfiguration
();
}
void
PathPlayer
::
recordToggled
(
bool
toggled
)
{
gepetto
::
gui
::
MainWindow
*
main
=
gepetto
::
gui
::
MainWindow
::
instance
();
if
(
toggled
)
{
QDir
tmp
(
"/tmp"
);
tmp
.
mkpath
(
"hpp-gui/record"
);
tmp
.
cd
(
"hpp-gui/record"
);
foreach
(
QString
f
,
tmp
.
entryList
(
QStringList
()
<<
"img_0_*.jpeg"
,
QDir
::
Files
))
tmp
.
remove
(
f
);
QString
path
=
tmp
.
absoluteFilePath
(
"img"
);
QString
ext
=
"jpeg"
;
main
->
osg
()
->
startCapture
(
main
->
centralWidget
()
->
windowID
(),
path
.
toLocal8Bit
().
data
(),
ext
.
toLocal8Bit
().
data
());
main
->
log
(
"Saving images to "
+
path
+
"_*."
+
ext
);
}
else
{
main
->
osg
()
->
stopCapture
(
main
->
centralWidget
()
->
windowID
());
QString
outputFile
=
QFileDialog
::
getSaveFileName
(
this
,
tr
(
"Save video to"
),
"untitled.mp4"
);
if
(
!
outputFile
.
isNull
())
{
if
(
QFile
::
exists
(
outputFile
))
QFile
::
remove
(
outputFile
);
QString
avconv
=
"avconv"
;
QStringList
args
;
QString
input
=
"/tmp/hpp-gui/record/img_0_%d.jpeg"
;
args
<<
"-r"
<<
"50"
<<
"-i"
<<
input
<<
"-vf"
<<
"scale=trunc(iw/2)*2:trunc(ih/2)*2"
<<
"-r"
<<
"25"
<<
"-vcodec"
<<
"libx264"
<<
outputFile
;
qDebug
()
<<
args
;
showPOutput_
->
setWindowTitle
(
avconv
+
" "
+
args
.
join
(
" "
));
pOutput_
->
clear
();
showPOutput_
->
resize
(
main
->
size
()
/
2
);
showPOutput_
->
show
();
process_
->
start
(
avconv
,
args
);
}
}
}
void
PathPlayer
::
pathPulse
()
{
if
(
playPause
()
->
isChecked
())
{
...
...
@@ -327,11 +264,6 @@ namespace hpp {
}
}
void
PathPlayer
::
readyReadProcessOutput
()
{
pOutput_
->
append
(
process_
->
readAll
());
}
void
PathPlayer
::
updateConfiguration
()
{
hpp
::
floatSeq_var
config
=
...
...
plugins/hppwidgetsplugin/pathplayer.hh
View file @
c2c7da18
...
...
@@ -74,10 +74,8 @@ signals:
// void timeChanged (double d);
void
playPauseToggled
(
bool
toggled
);
void
stopClicked
();
void
recordToggled
(
bool
toggled
);
void
pathPulse
();
void
timerEvent
(
QTimerEvent
*
event
);
void
readyReadProcessOutput
();
private:
void
initSearchActions
();
...
...
@@ -101,10 +99,6 @@ signals:
int
timerId_
;
bool
velocity_
;
QProcess
*
process_
;
QDialog
*
showPOutput_
;
QTextBrowser
*
pOutput_
;
HppWidgetsPlugin
*
plugin_
;
};
}
// namespace gui
...
...
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