Commit f30c1640 authored by Jan Möbius's avatar Jan Möbius
Browse files

Basic video capture support. (Still a bit too slow)

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5703 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 490061b5
...@@ -106,6 +106,7 @@ ...@@ -106,6 +106,7 @@
Core:: Core::
Core() : Core() :
QObject(), QObject(),
capture_(false),
nextBackupId_(0), nextBackupId_(0),
coreWidget_(0) coreWidget_(0)
{ {
...@@ -209,6 +210,11 @@ Core::init() { ...@@ -209,6 +210,11 @@ Core::init() {
connect(coreWidget_, SIGNAL(recentOpen(QAction*)) , this, SLOT(slotRecentOpen(QAction*))); connect(coreWidget_, SIGNAL(recentOpen(QAction*)) , this, SLOT(slotRecentOpen(QAction*)));
connect(coreWidget_, SIGNAL(exit()) , this, SLOT(slotExit())); connect(coreWidget_, SIGNAL(exit()) , this, SLOT(slotExit()));
connect( coreWidget_->stopVideoCaptureAction_ , SIGNAL( triggered() ),
this , SLOT( slotStopVideoCapture() ) );
connect( coreWidget_->startVideoCaptureAction_ , SIGNAL( triggered() ),
this , SLOT( slotStartVideoCapture() ) );
connect(coreWidget_, SIGNAL(showPlugins()) , this, SLOT(slotShowPlugins())); connect(coreWidget_, SIGNAL(showPlugins()) , this, SLOT(slotShowPlugins()));
connect(coreWidget_, SIGNAL(call(QString,bool&)), this, SLOT(slotCall(QString,bool&))); connect(coreWidget_, SIGNAL(call(QString,bool&)), this, SLOT(slotCall(QString,bool&)));
...@@ -448,7 +454,7 @@ Core::init() { ...@@ -448,7 +454,7 @@ Core::init() {
this , SLOT(slotWheelEvent(QWheelEvent *, const std::string &))); this , SLOT(slotWheelEvent(QWheelEvent *, const std::string &)));
connect( coreWidget_->examiner_widgets_[i], SIGNAL( viewUpdated() ), connect( coreWidget_->examiner_widgets_[i], SIGNAL( viewUpdated() ),
this, SLOT( viewUpdated()) ); this, SLOT( viewUpdated()) ,Qt::DirectConnection);
} }
} }
......
...@@ -413,15 +413,17 @@ private: ...@@ -413,15 +413,17 @@ private:
void captureVideo(); void captureVideo();
/// Start video capturing /// Start video capturing
void startVideoCapture(); void slotStartVideoCapture();
/// Stop video capturing /// Stop video capturing
void stopVideoCapture(); void slotStopVideoCapture();
private: private:
QTimer videoTimer_; QTimer videoTimer_;
QTime lastVideoTime_; QTime lastVideoTime_;
bool capture_;
/** @} */ /** @} */
//=========================================================================== //===========================================================================
/** @name Load / Save slots /** @name Load / Save slots
......
...@@ -48,8 +48,8 @@ ...@@ -48,8 +48,8 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void Core::startVideoCapture() { void Core::slotStartVideoCapture() {
connect( &videoTimer_ , SIGNAL(timeout()), this, SLOT( viewUpdated() ) ); connect( &videoTimer_ , SIGNAL(timeout()), this, SLOT( viewUpdated() ) ,Qt::DirectConnection );
// set track auf true; // set track auf true;
videoTimer_.setSingleShot(false); videoTimer_.setSingleShot(false);
...@@ -61,7 +61,7 @@ void Core::startVideoCapture() { ...@@ -61,7 +61,7 @@ void Core::startVideoCapture() {
QString name = "/home/moebius/snaps/autosnapshot.jpg"; QString name = "/home/moebius/snaps/autosnapshot.jpg";
applicationSnapshotName(name); applicationSnapshotName(name);
std::cerr << "Start " << std::endl; capture_ = true;
} }
void Core::captureVideo() { void Core::captureVideo() {
...@@ -74,22 +74,18 @@ void Core::captureVideo() { ...@@ -74,22 +74,18 @@ void Core::captureVideo() {
lastVideoTime_.restart(); lastVideoTime_.restart();
// std::cerr << "Capture " << std::endl;
applicationSnapshot(); applicationSnapshot();
} }
void Core::stopVideoCapture() { void Core::slotStopVideoCapture() {
videoTimer_.stop();
capture_ = false;
} }
void Core::viewUpdated() { void Core::viewUpdated() {
bool track = true; if ( capture_ )
if ( track ) {
captureVideo(); captureVideo();
}
} }
......
...@@ -271,6 +271,10 @@ public: ...@@ -271,6 +271,10 @@ public:
/// Setup the main menubar /// Setup the main menubar
void setupMenuBar(); void setupMenuBar();
public:
QAction* startVideoCaptureAction_;
QAction* stopVideoCaptureAction_;
/** @} */ /** @} */
//=========================================================================== //===========================================================================
......
...@@ -376,6 +376,24 @@ void CoreWidget::setupMenuBar() ...@@ -376,6 +376,24 @@ void CoreWidget::setupMenuBar()
this, SLOT( slotShowSceneGraphDialog() ) ); this, SLOT( slotShowSceneGraphDialog() ) );
toolsMenu_->addAction( sceneGraphAction); toolsMenu_->addAction( sceneGraphAction);
toolsMenu_->addSeparator();
startVideoCaptureAction_ = new QAction( "Start Video Capture " ,toolsMenu_ );
startVideoCaptureAction_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"recordVideo.png") );
startVideoCaptureAction_->setCheckable( false );
startVideoCaptureAction_->setToolTip( "Start video capturing." );
startVideoCaptureAction_->setWhatsThis( "Start to capture a video sequence of the user actions");
toolsMenu_->addAction( startVideoCaptureAction_ );
stopVideoCaptureAction_ = new QAction( "Stop Video Capture " ,toolsMenu_ );
stopVideoCaptureAction_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"stopVideoCapture.png") );
stopVideoCaptureAction_->setCheckable( false );
stopVideoCaptureAction_->setToolTip( "Stop video capturing." );
stopVideoCaptureAction_->setWhatsThis( "Stop Video capturing");
toolsMenu_->addAction( stopVideoCaptureAction_);
// ====================================================================== // ======================================================================
// help Menu // help Menu
// ====================================================================== // ======================================================================
......
...@@ -338,19 +338,19 @@ void glViewer::updateProjectionMatrix() ...@@ -338,19 +338,19 @@ void glViewer::updateProjectionMatrix()
if (isVisible()) if (isVisible())
aspect = (double) glWidth() / (double) glHeight(); aspect = (double) glWidth() / (double) glHeight();
else else
aspect = 1.0; aspect = 1.0;
glstate_->ortho( -orthoWidth_, orthoWidth_, glstate_->ortho( -orthoWidth_, orthoWidth_,
-orthoWidth_/aspect, orthoWidth_/aspect, -orthoWidth_/aspect, orthoWidth_/aspect,
near_, far_ ); near_, far_ );
break; break;
} }
case PERSPECTIVE_PROJECTION: case PERSPECTIVE_PROJECTION:
{ {
glstate_->perspective(fovy_, glstate_->perspective(fovy_,
(GLdouble) glWidth() / (GLdouble) glHeight(), (GLdouble) glWidth() / (GLdouble) glHeight(),
near_, far_); near_, far_);
break; break;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment