]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Dialog for the Recorder.
authorouv <ouv@opencascade.com>
Mon, 12 Dec 2005 12:06:27 +0000 (12:06 +0000)
committerouv <ouv@opencascade.com>
Mon, 12 Dec 2005 12:06:27 +0000 (12:06 +0000)
src/VISUGUI/VISUM_msg_en.po
src/VVTK/Makefile.in
src/VVTK/VVTK_MainWindow.cxx
src/VVTK/VVTK_RecorderDlg.cxx [new file with mode: 0644]
src/VVTK/VVTK_RecorderDlg.h [new file with mode: 0644]

index f897f4859e7c42829836bc231f806ef6f02fed40..036343952f178c5ca1e67aeb2ff98f97212b49df 100644 (file)
@@ -322,6 +322,45 @@ msgstr "Start"
 msgid "VisuGUI_BuildProgressDlg::CLOSE"
 msgstr "Close"
 
+msgid "VVTK_RecorderDlg::DLG_RECORDER_TITLE"
+msgstr "Recorder"
+
+msgid "VVTK_RecorderDlg::SETTINGS"
+msgstr "Settings"
+
+msgid "VVTK_RecorderDlg::FILE_NAME"
+msgstr "Save to file : "
+
+msgid "VVTK_RecorderDlg::FLT_ALL_FILES"
+msgstr "All Files (*.*)"
+
+msgid "VVTK_RecorderDlg::FLT_AVI_FILES"
+msgstr "AVI Files (*.avi)"
+
+msgid "VVTK_RecorderDlg::RECORDING_MODE"
+msgstr "Mode : "
+
+msgid "VVTK_RecorderDlg::SKIPPED_FRAMES"
+msgstr "Recording at a given FPS"
+
+msgid "VVTK_RecorderDlg::ALL_DISLPAYED_FRAMES"
+msgstr "Recording all displayed frames"
+
+msgid "VVTK_RecorderDlg::FPS"
+msgstr "FPS : "
+
+msgid "VVTK_RecorderDlg::QUALITY"
+msgstr "Quality : "
+
+msgid "VVTK_RecorderDlg::PROGRESSIVE"
+msgstr "Progressive"
+
+msgid "VVTK_RecorderDlg::START"
+msgstr "Start"
+
+msgid "VVTK_RecorderDlg::CLOSE"
+msgstr "Close"
+
 msgid "VVTK_ViewManager::VTK_VIEW_TITLE"
 msgstr "VISU scene:%1 - viewer:%2"
 
index 5f38d378558598641256e0b443a71c48adad0811..66b48653a131c88c9f337b424085efa3350d2cd5 100755 (executable)
@@ -25,6 +25,7 @@ EXPORT_HEADERS = \
        VVTK_MainWindow.h \
        VVTK_ImageWriter.h \
        VVTK_ImageWriterMgr.h \
+       VVTK_RecorderDlg.h \
        VVTK_Recorder.h
 
 # Libraries targets
@@ -43,6 +44,7 @@ LIB_SRC = \
        VVTK_MainWindow.cxx \
        VVTK_ImageWriter.cxx \
        VVTK_ImageWriterMgr.cxx \
+       VVTK_RecorderDlg.cxx \
        VVTK_Recorder.cxx
 
 LIB_MOC = \
@@ -51,6 +53,7 @@ LIB_MOC = \
        VVTK_ViewManager.h \
        VVTK_PickingDlg.h \
        VVTK_SegmentationCursorDlg.h \
+       VVTK_RecorderDlg.h \
        VVTK_PrimitiveBox.h \
        VVTK_SizeBox.h \
        VVTK_MainWindow.h 
index df26f83385fda30ed44eae15560ffbf335f14d8a..a265d21dfa675298c6399b08680c864fcc3e1d75 100644 (file)
@@ -29,6 +29,7 @@
 #include "VVTK_MainWindow.h"
 #include "VVTK_InteractorStyle.h"
 #include "VVTK_Recorder.h"
+#include "VVTK_RecorderDlg.h"
 #include "VISU_WidgetCtrl.hxx"
 #include "VISU_GaussPtsAct.h"
 #include "VISU_Event.h" 
@@ -159,16 +160,16 @@ VVTK_MainWindow
 //----------------------------------------------------------------------------
 void VVTK_MainWindow::OnStartRecording()
 {
-  QString aFileName = QFileDialog::getSaveFileName( getenv( "HOME"), "*.avi", this );
-  if(aFileName.isNull())
+  VVTK_RecorderDlg* aRecorderDlg = new VVTK_RecorderDlg( this, myRecorder );
+
+  if( !aRecorderDlg->exec() )
     return;
-  
+
   myStartAction->setEnabled( false );
   myPlayAction->setEnabled( false );
   myPauseAction->setEnabled( true );
   myStopAction->setEnabled( true );
 
-  myRecorder->SetName(aFileName.latin1());
   myRecorder->Record();
 }
 
diff --git a/src/VVTK/VVTK_RecorderDlg.cxx b/src/VVTK/VVTK_RecorderDlg.cxx
new file mode 100644 (file)
index 0000000..6abb1da
--- /dev/null
@@ -0,0 +1,183 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+//  File   : VVTK_RecorderDlg.cxx
+//  Author : Oleg UVAROV
+//  Module : VISU
+
+#include "VVTK_RecorderDlg.h"
+#include "VVTK_Recorder.h"
+
+#include "SUIT_FileDlg.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
+
+#include "QtxDblSpinBox.h"
+#include "QtxIntSpinBox.h"
+
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+
+/*!
+ * Constructor
+ */
+VVTK_RecorderDlg::VVTK_RecorderDlg( QWidget* theParent, VVTK_Recorder* theRecorder ):
+  QDialog( theParent, "VVTK_RecorderDlg", false ),
+  myRecorder( theRecorder )
+{
+  setCaption( tr( "DLG_RECORDER_TITLE" ) );
+
+  SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+
+  QVBoxLayout* aTopLayout = new QVBoxLayout( this );
+  aTopLayout->setSpacing( 6 );
+  aTopLayout->setMargin( 6 );
+  aTopLayout->setAutoAdd( true );
+
+  // Settings
+  QGroupBox* mySettingsBox = new QGroupBox( tr( "SETTINGS" ), this );
+  mySettingsBox->setColumnLayout( 0, Qt::Vertical );
+  mySettingsBox->layout()->setSpacing( 0 );
+  mySettingsBox->layout()->setMargin( 0 );
+
+  QGridLayout* aSettingsLayout = new QGridLayout( mySettingsBox->layout() );
+  aSettingsLayout->setSpacing( 6 );
+  aSettingsLayout->setMargin( 11 );
+
+  QLabel* aFileNameLabel = new QLabel( tr( "FILE_NAME" ), mySettingsBox );
+  myFileNameLineEdit = new QLineEdit( mySettingsBox );
+  myFileNameLineEdit->setMinimumWidth( 250 );
+  myFileNameLineEdit->setReadOnly( true );
+
+  QPushButton* aFileNameButton = new QPushButton( mySettingsBox );
+  aFileNameButton->setAutoDefault( false );
+  aFileNameButton->setPixmap( aResourceMgr->loadPixmap( "VISU", tr( "ICON_LOAD_TEXTURE" ) ) );
+  connect( aFileNameButton, SIGNAL( clicked() ), this, SLOT( onBrowseFile() ) );
+
+  QLabel* aRecordingModeLabel = new QLabel( tr( "RECORDING_MODE" ), mySettingsBox );
+  myRecordingModeComboBox = new QComboBox( mySettingsBox );
+  myRecordingModeComboBox->insertItem( tr( "SKIPPED_FRAMES" ) );
+  myRecordingModeComboBox->insertItem( tr( "ALL_DISLPAYED_FRAMES" ) );
+  myRecordingModeComboBox->setCurrentItem( aResourceMgr->integerValue( "VISU", "recorder_mode", 1 ) );
+
+  QLabel* aFPSLabel = new QLabel( tr( "FPS" ), mySettingsBox );
+  myFPSSpinBox = new QtxDblSpinBox( 0.1, 100.0, 1.0, mySettingsBox );
+  myFPSSpinBox->setValue( aResourceMgr->doubleValue( "VISU", "recorder_fps", 10.0 ) );
+
+  QLabel* aQualityLabel = new QLabel( tr( "QUALITY" ), mySettingsBox );
+  myQualitySpinBox = new QtxIntSpinBox( 1, 100, 1, mySettingsBox );
+  myQualitySpinBox->setValue( aResourceMgr->integerValue( "VISU", "recorder_quality", 80 ) );
+
+  myProgressiveCheckBox = new QCheckBox( tr( "PROGRESSIVE" ), mySettingsBox );
+  myProgressiveCheckBox->setChecked( aResourceMgr->booleanValue( "VISU", "recorder_progressive", false ) );
+
+  aSettingsLayout->addWidget( aFileNameLabel, 0, 0 );
+  aSettingsLayout->addMultiCellWidget( myFileNameLineEdit, 1, 1, 0, 1 );
+  aSettingsLayout->addWidget( aFileNameButton, 1, 2 );
+  aSettingsLayout->addWidget( aRecordingModeLabel, 2, 0 );
+  aSettingsLayout->addWidget( myRecordingModeComboBox, 2, 1 );
+  aSettingsLayout->addWidget( aFPSLabel, 3, 0 );
+  aSettingsLayout->addWidget( myFPSSpinBox, 3, 1 );
+  aSettingsLayout->addWidget( aQualityLabel, 4, 0 );
+  aSettingsLayout->addWidget( myQualitySpinBox, 4, 1 );
+  aSettingsLayout->addWidget( myProgressiveCheckBox, 5, 0 );
+
+  // Start / Close
+  QGroupBox* CommonGroup = new QGroupBox( this );
+  CommonGroup->setColumnLayout(0, Qt::Vertical );
+  CommonGroup->layout()->setSpacing( 0 );
+  CommonGroup->layout()->setMargin( 0 );
+  QGridLayout* CommonGroupLayout = new QGridLayout( CommonGroup->layout() );
+  CommonGroupLayout->setAlignment( Qt::AlignTop );
+  CommonGroupLayout->setSpacing( 6 );
+  CommonGroupLayout->setMargin( 11 );
+
+  QPushButton* aStartButton = new QPushButton( tr( "START" ), CommonGroup );
+  aStartButton->setAutoDefault( true );
+  aStartButton->setDefault( true );
+  CommonGroupLayout->addWidget( aStartButton, 0, 0 );
+  CommonGroupLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+
+  QPushButton* aCloseButton = new QPushButton( tr( "CLOSE" ), CommonGroup );
+  aCloseButton->setAutoDefault( true );
+  CommonGroupLayout->addWidget( aCloseButton, 0, 2 );
+
+  connect( aStartButton, SIGNAL( clicked() ), this, SLOT( onStart() ) );
+  connect( aCloseButton, SIGNAL( clicked() ), this, SLOT( onClose() ) );
+}
+
+VVTK_RecorderDlg::~VVTK_RecorderDlg()
+{
+}
+
+void VVTK_RecorderDlg::show()
+{
+  if( onBrowseFile() )
+    QWidget::show();
+}
+
+void VVTK_RecorderDlg::onStart()
+{
+  if( myFileName.isNull() )
+    return;
+
+  myRecorder->SetName( myFileName.latin1() );
+
+  myRecorder->SetUseSkippedFrames( myRecordingModeComboBox->currentItem() == 0 );
+  myRecorder->SetNbFPS( myFPSSpinBox->value() );
+  myRecorder->SetQuality( myQualitySpinBox->value() );
+  myRecorder->SetProgressiveMode( myProgressiveCheckBox->isChecked() );
+
+  accept();
+
+}
+
+void VVTK_RecorderDlg::onClose()
+{
+  reject();
+}
+
+bool VVTK_RecorderDlg::onBrowseFile()
+{
+  QString aRootDir = QString( getenv( "VISU_ROOT_DIR") );
+
+  QStringList aFilter;
+  aFilter.append( tr( "FLT_AVI_FILES" ) );
+  aFilter.append( tr( "FLT_ALL_FILES" ) );
+
+  QString aFileName = SUIT_FileDlg::getFileName( this, getenv( "HOME" ), aFilter,
+                                                tr( "FILE_NAME" ), false );
+
+  if( aFileName.isNull() )
+    return false;
+
+  myFileName = aFileName;
+  myFileNameLineEdit->setText( aFileName.section( '/', -1 ) );
+
+  return true;
+}
diff --git a/src/VVTK/VVTK_RecorderDlg.h b/src/VVTK/VVTK_RecorderDlg.h
new file mode 100644 (file)
index 0000000..f46ef1b
--- /dev/null
@@ -0,0 +1,80 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+//  File   : VVTK_RecorderDlg.h
+//  Author : Oleg UVAROV
+//  Module : VISU
+//  $Header$
+
+#ifndef VVTK_RECORDERDLG_H
+#define VVTK_RECORDERDLG_H
+
+#include <qdatetime.h>
+#include <qdialog.h>
+
+class QCheckBox;
+class QComboBox;
+class QGroupBox;
+class QLCDNumber;
+class QLineEdit;
+class QPushButton;
+class QTimer;
+
+class QtxDblSpinBox;
+class QtxIntSpinBox;
+
+class VVTK_Recorder;
+
+//! Recorder Dialog.
+class VVTK_RecorderDlg : public QDialog
+{
+  Q_OBJECT
+
+public:
+  VVTK_RecorderDlg( QWidget*, VVTK_Recorder* );
+  ~VVTK_RecorderDlg();
+
+  virtual void     show();
+
+  QString          fileName() const { return myFileName; }
+
+protected slots:
+  void             onStart();
+  void             onClose();
+
+  bool             onBrowseFile();
+
+private:
+  VVTK_Recorder*   myRecorder;
+  QString          myFileName;
+
+  QLineEdit*       myFileNameLineEdit;
+
+  QComboBox*       myRecordingModeComboBox;
+  QtxDblSpinBox*   myFPSSpinBox;
+  QtxIntSpinBox*   myQualitySpinBox;
+  QCheckBox*       myProgressiveCheckBox;
+
+};
+
+#endif