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

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 @@
Core::
Core() :
QObject(),
capture_(false),
nextBackupId_(0),
coreWidget_(0)
{
......@@ -209,6 +210,11 @@ Core::init() {
connect(coreWidget_, SIGNAL(recentOpen(QAction*)) , this, SLOT(slotRecentOpen(QAction*)));
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(call(QString,bool&)), this, SLOT(slotCall(QString,bool&)));
......@@ -448,7 +454,7 @@ Core::init() {
this , SLOT(slotWheelEvent(QWheelEvent *, const std::string &)));
connect( coreWidget_->examiner_widgets_[i], SIGNAL( viewUpdated() ),
this, SLOT( viewUpdated()) );
this, SLOT( viewUpdated()) ,Qt::DirectConnection);
}
}
......
......@@ -413,15 +413,17 @@ private:
void captureVideo();
/// Start video capturing
void startVideoCapture();
void slotStartVideoCapture();
/// Stop video capturing
void stopVideoCapture();
void slotStopVideoCapture();
private:
QTimer videoTimer_;
QTime lastVideoTime_;
bool capture_;
/** @} */
//===========================================================================
/** @name Load / Save slots
......
......@@ -48,8 +48,8 @@
//-----------------------------------------------------------------------------
void Core::startVideoCapture() {
connect( &videoTimer_ , SIGNAL(timeout()), this, SLOT( viewUpdated() ) );
void Core::slotStartVideoCapture() {
connect( &videoTimer_ , SIGNAL(timeout()), this, SLOT( viewUpdated() ) ,Qt::DirectConnection );
// set track auf true;
videoTimer_.setSingleShot(false);
......@@ -61,7 +61,7 @@ void Core::startVideoCapture() {
QString name = "/home/moebius/snaps/autosnapshot.jpg";
applicationSnapshotName(name);
std::cerr << "Start " << std::endl;
capture_ = true;
}
void Core::captureVideo() {
......@@ -74,22 +74,18 @@ void Core::captureVideo() {
lastVideoTime_.restart();
// std::cerr << "Capture " << std::endl;
applicationSnapshot();
}
void Core::stopVideoCapture() {
void Core::slotStopVideoCapture() {
videoTimer_.stop();
capture_ = false;
}
void Core::viewUpdated() {
bool track = true;
if ( track ) {
if ( capture_ )
captureVideo();
}
}
......
......@@ -271,6 +271,10 @@ public:
/// Setup the main menubar
void setupMenuBar();
public:
QAction* startVideoCaptureAction_;
QAction* stopVideoCaptureAction_;
/** @} */
//===========================================================================
......
......@@ -376,6 +376,24 @@ void CoreWidget::setupMenuBar()
this, SLOT( slotShowSceneGraphDialog() ) );
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
// ======================================================================
......
......@@ -338,19 +338,19 @@ void glViewer::updateProjectionMatrix()
if (isVisible())
aspect = (double) glWidth() / (double) glHeight();
else
aspect = 1.0;
aspect = 1.0;
glstate_->ortho( -orthoWidth_, orthoWidth_,
-orthoWidth_/aspect, orthoWidth_/aspect,
near_, far_ );
-orthoWidth_/aspect, orthoWidth_/aspect,
near_, far_ );
break;
}
case PERSPECTIVE_PROJECTION:
{
glstate_->perspective(fovy_,
(GLdouble) glWidth() / (GLdouble) glHeight(),
near_, far_);
(GLdouble) glWidth() / (GLdouble) glHeight(),
near_, far_);
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