Commit 48841db6 authored by Dirk Wilden's avatar Dirk Wilden

added videoCaptureDialog

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6337 383ad7c9-94d9-4d36-a494-682f7c89f535
parent c30b08ab
......@@ -211,10 +211,8 @@ 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( stopVideoCapture() ), this, SLOT( stopVideoCapture() ) );
connect( coreWidget_, SIGNAL( startVideoCapture(QString,int,bool) ), this, SLOT( startVideoCapture(QString,int,bool) ) );
connect(coreWidget_, SIGNAL(showPlugins()) , this, SLOT(slotShowPlugins()));
......
......@@ -446,16 +446,20 @@ private:
/// Function called for every frame when capturing video
void captureVideo();
public slots:
/// Start video capturing
void slotStartVideoCapture();
void startVideoCapture(QString _baseName, int _fps, bool _captureViewers);
/// Stop video capturing
void slotStopVideoCapture();
void stopVideoCapture();
private:
QTimer videoTimer_;
QTime lastVideoTime_;
int captureType_;
bool capture_;
/** @} */
......
......@@ -48,18 +48,25 @@
//-----------------------------------------------------------------------------
void Core::slotStartVideoCapture() {
void Core::startVideoCapture(QString _baseName, int _fps, bool _captureViewers) {
connect( &videoTimer_ , SIGNAL(timeout()), this, SLOT( viewUpdated() ) ,Qt::DirectConnection );
// set track auf true;
videoTimer_.setSingleShot(false);
// 25 fps
videoTimer_.start(40);
videoTimer_.start( 1000 / _fps);
lastVideoTime_.start();
QString name = "/home/moebius/snaps/autosnapshot.jpg";
applicationSnapshotName(name);
QString name = _baseName;
if (_captureViewers){
applicationSnapshotName(name);
captureType_ = 1;
} else {
applicationSnapshotName(name);
captureType_ = 0;
}
capture_ = true;
}
......@@ -74,11 +81,14 @@ void Core::captureVideo() {
lastVideoTime_.restart();
applicationSnapshot();
if (captureType_ == 1)
viewerSnapshot();
else
applicationSnapshot();
}
void Core::slotStopVideoCapture() {
void Core::stopVideoCapture() {
videoTimer_.stop();
capture_ = false;
}
......
......@@ -33,6 +33,7 @@ set (directories
../widgets/optionsWidget
../widgets/PluginDialog
../widgets/viewModeWidget
../widgets/videoCaptureDialog
)
# collect all header,source and ui files
......
......@@ -52,6 +52,8 @@
#include <OpenFlipper/BasePlugin/KeyInterface.hh>
#include <OpenFlipper/BasePlugin/LoggingInterface.hh>
#include <OpenFlipper/widgets/videoCaptureDialog/VideoCaptureDialog.hh>
#define WIDGET_HEIGHT 800
#define WIDGET_WIDTH 800
......@@ -866,6 +868,16 @@ CoreWidget::sceneRectChanged(const QRectF &rect)
pickToolbar_->updateGeometry ();
}
//-----------------------------------------------------------------------------
void
CoreWidget::startVideoCaptureDialog(){
VideoCaptureDialog* dialog = new VideoCaptureDialog();
connect(dialog, SIGNAL(startVideoCapture(QString,int,bool)), this, SIGNAL(startVideoCapture(QString,int,bool)) );
dialog->show();
}
......
......@@ -276,9 +276,18 @@ public:
/// Setup the main menubar
void setupMenuBar();
public:
QAction* startVideoCaptureAction_;
QAction* stopVideoCaptureAction_;
/** @} */
//===========================================================================
/** @name Video Capturing
* @{ */
//===========================================================================
signals:
void startVideoCapture(QString _baseName, int _fps, bool _captureViewers);
void stopVideoCapture();
private slots:
void startVideoCaptureDialog();
/** @} */
......@@ -287,6 +296,8 @@ public:
* @{ */
//===========================================================================
public:
/// Add a recent file and update menu
void addRecent(QString _filename, DataType _type);
......
......@@ -419,21 +419,22 @@ void CoreWidget::setupMenuBar()
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_);
QAction* 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 );
connect(startVideoCaptureAction, SIGNAL(triggered()), this, SLOT(startVideoCaptureDialog()) );
QAction* 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);
connect(stopVideoCaptureAction, SIGNAL(triggered()), this, SIGNAL(stopVideoCapture()) );
// ======================================================================
// help Menu
......
#include "VideoCaptureDialog.hh"
#include <QtGui>
#include <QMessageBox>
#include <QFileDialog>
#include <iostream>
#include <OpenFlipper/common/GlobalOptions.hh>
VideoCaptureDialog::VideoCaptureDialog(QWidget *parent) : QDialog(parent)
{
setupUi(this);
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()) );
connect(findButton, SIGNAL(clicked()), this, SLOT(findFile()) );
connect(startButton, SIGNAL(clicked()), this, SLOT(slotStartVideoCapture()) );
}
void VideoCaptureDialog::slotStartVideoCapture()
{
if (filename->text() == ""){
QMessageBox msgBox;
msgBox.setText("The Filename is empty!");
msgBox.exec();
return;
}
emit startVideoCapture( filename->text(), fps->value(), captureViewers->isChecked() );
accept();
}
void VideoCaptureDialog::findFile()
{
QString file = QFileDialog::getSaveFileName(this, tr("Output File"),
OpenFlipper::Options::applicationDirStr() + OpenFlipper::Options::dirSeparator() + "untitled.jpg",
tr("Images (*.jpg)"));
if (file != "")
filename->setText( file );
}
\ No newline at end of file
#include "ui_VideoCaptureDialog.hh"
#include <QtGui>
class VideoCaptureDialog : public QDialog, public Ui::VideoCaptureDialog
{
Q_OBJECT
public:
VideoCaptureDialog(QWidget *parent = 0);
private slots:
void slotStartVideoCapture();
void findFile();
signals:
void startVideoCapture(QString _baseName, int _fps, bool _captureViewers);
};
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>VideoCaptureDialog</class>
<widget class="QDialog" name="VideoCaptureDialog">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>440</width>
<height>180</height>
</rect>
</property>
<property name="windowTitle">
<string>Start Video Capturing</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Output filename:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="filename"/>
</item>
<item>
<widget class="QToolButton" name="findButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Frames per second:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="fps">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>60</number>
</property>
<property name="value">
<number>25</number>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string> Capture Region </string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="captureViewers">
<property name="text">
<string>Viewers only</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="captureApplication">
<property name="text">
<string>Application</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="startButton">
<property name="text">
<string>Start Capturing</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../../../resources.qrc"/>
</resources>
<connections/>
</ui>
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