From: jfa Date: Thu, 22 Mar 2007 10:31:23 +0000 (+0000) Subject: Provide more user-friendly behaviour if AVI recording is not available: warning on... X-Git-Tag: V4_0a2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ec04ace5bf60c94c744fcc20650d5a943c57233c;p=modules%2Fvisu.git Provide more user-friendly behaviour if AVI recording is not available: warning on attempt to use instead of controls disabling. --- diff --git a/src/VISUGUI/VISU_msg_en.po b/src/VISUGUI/VISU_msg_en.po index de870423..b59b4e4f 100644 --- a/src/VISUGUI/VISU_msg_en.po +++ b/src/VISUGUI/VISU_msg_en.po @@ -907,6 +907,9 @@ msgstr "Error" msgid "VisuGUI_TimeAnimationDlg::MSG_NO_ANIMATIONDATA" msgstr "There is no data for animation" +msgid "VisuGUI_TimeAnimationDlg::MSG_NO_AVI_MAKER" +msgstr "Tool jpeg2yuv, necessary for AVI recording, is not available.\nPlease, refer to the documentation." + #: VisuGUI_VectorsDlg.cxx @@ -1786,6 +1789,9 @@ msgstr "Stop recording" msgid "VVTK_MainWindow::DSC_VVTK_RECORDING_STOP" msgstr "Stop recording" +msgid "VVTK_MainWindow::MSG_NO_AVI_MAKER" +msgstr "Tool jpeg2yuv, necessary for AVI recording, is not available.\nPlease, refer to the documentation." + msgid "VVTK_MainWindow1::LBL_TOOLBAR_GAUSS_LABEL" msgstr "Gauss Viewer Tools" @@ -2144,4 +2150,4 @@ msgid "VISU_PLOT3D" msgstr "Plot3D" msgid "VISU_SCALAR_MAP_ON_DEFORMED_SHAPE" -msgstr "Scalar Map on Def. Shape" \ No newline at end of file +msgstr "Scalar Map on Def. Shape" diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index 27f53ab9..18a4ce07 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -1245,29 +1245,29 @@ VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule, _PTR(Stu this, SLOT( onCheckDump(bool) )); aSaveLay->addMultiCellWidget(mySaveAVICheck, 3, 3, 0, 2); - QLabel* aPathAVILbl = new QLabel("Path:", aSaveBox); - aPathAVILbl->setEnabled(false); - connect(mySaveAVICheck, SIGNAL( toggled(bool)), - aPathAVILbl, SLOT( setEnabled(bool) )); - aSaveLay->addWidget(aPathAVILbl, 4, 0); + myPathAVILbl = new QLabel("Path:", aSaveBox); + myPathAVILbl->setEnabled(false); + //connect(mySaveAVICheck, SIGNAL( toggled(bool)), + // myPathAVILbl, SLOT( setEnabled(bool) )); + aSaveLay->addWidget(myPathAVILbl, 4, 0); myPathAVIEdit = new QLineEdit(aSaveBox); myPathAVIEdit->setReadOnly(true); myPathAVIEdit->setEnabled(false); - connect(mySaveAVICheck, SIGNAL( toggled(bool)), - myPathAVIEdit, SLOT( setEnabled(bool) )); + //connect(mySaveAVICheck, SIGNAL( toggled(bool)), + // myPathAVIEdit, SLOT( setEnabled(bool) )); aSaveLay->addWidget(myPathAVIEdit, 4, 1); - QPushButton* aBrowseAVIBtn = new QPushButton("Browse...", aSaveBox); - aBrowseAVIBtn->setEnabled(false); - connect(mySaveAVICheck, SIGNAL( toggled(bool)), - aBrowseAVIBtn, SLOT( setEnabled(bool) )); - connect(aBrowseAVIBtn, SIGNAL( clicked()), + myBrowseAVIBtn = new QPushButton("Browse...", aSaveBox); + myBrowseAVIBtn->setEnabled(false); + //connect(mySaveAVICheck, SIGNAL( toggled(bool)), + // myBrowseAVIBtn, SLOT( setEnabled(bool) )); + connect(myBrowseAVIBtn, SIGNAL( clicked()), this, SLOT( onBrowseAVI() )); - aSaveLay->addWidget(aBrowseAVIBtn, 4, 2); + aSaveLay->addWidget(myBrowseAVIBtn, 4, 2); mySaveAVICheck->setChecked(false); - mySaveAVICheck->setEnabled(myAnimator->checkAVIMaker()); + //mySaveAVICheck->setEnabled(myAnimator->checkAVIMaker()); TopLayout->addMultiCellWidget(aSaveBox, 7, 7, 0, 3); @@ -1560,12 +1560,33 @@ void VisuGUI_TimeAnimationDlg::onCheckDump(bool) } else { myAnimator->dumpTo(""); } - mySaveAVICheck->setEnabled(!mySaveCheck->isChecked() && myAnimator->checkAVIMaker()); + //mySaveAVICheck->setEnabled(!mySaveCheck->isChecked() && myAnimator->checkAVIMaker()); + mySaveAVICheck->setEnabled(!mySaveCheck->isChecked()); } else if (source == mySaveAVICheck) { if (mySaveAVICheck->isChecked()) { - if (mySaveCheck->isChecked()) - mySaveCheck->setChecked(false); + if (!myAnimator->checkAVIMaker()) { + // AVI maker is not available + SUIT_MessageBox::warn1(this, tr("ERROR"), tr("MSG_NO_AVI_MAKER"), tr("&OK")); + mySaveAVICheck->setChecked(false); + } + else { + if (mySaveCheck->isChecked()) { + mySaveCheck->setChecked(false); + } + myPathAVILbl->setEnabled(true); + myPathAVIEdit->setEnabled(true); + myBrowseAVIBtn->setEnabled(true); + } + } + else { + // it is necessary in case of not available AVI maker, + // because otherwise they will stay enabled + // (??? slots, connected on SIGNAL(toggled(bool)) of mySaveAVICheck, + // works in wrong order ???) + myPathAVILbl->setEnabled(false); + myPathAVIEdit->setEnabled(false); + myBrowseAVIBtn->setEnabled(false); } mySaveCheck->setEnabled(!mySaveAVICheck->isChecked()); } diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.h b/src/VISUGUI/VisuGUI_TimeAnimation.h index f717b3f6..9b18330d 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.h +++ b/src/VISUGUI/VisuGUI_TimeAnimation.h @@ -205,8 +205,10 @@ class VisuGUI_TimeAnimationDlg: public QDialog bool myCloseBtnClicked; QCloseEvent* myEvent; - QCheckBox* mySaveAVICheck; - QLineEdit* myPathAVIEdit; + QCheckBox* mySaveAVICheck; + QLineEdit* myPathAVIEdit; + QLabel* myPathAVILbl; + QPushButton* myBrowseAVIBtn; QPushButton* myPublishBtn; QPushButton* mySaveBtn; diff --git a/src/VVTK/VVTK_MainWindow.cxx b/src/VVTK/VVTK_MainWindow.cxx index 63cf2bc0..80a3345c 100644 --- a/src/VVTK/VVTK_MainWindow.cxx +++ b/src/VVTK/VVTK_MainWindow.cxx @@ -47,6 +47,7 @@ #include "SUIT_ResourceMgr.h" #include "SUIT_ToolButton.h" #include "SUIT_Accel.h" +#include "SUIT_MessageBox.h" #include "QtxAction.h" #include @@ -115,9 +116,9 @@ VVTK_MainWindow connect( myStopAction, SIGNAL( activated() ), this, SLOT( OnStopRecording() ) ); myRecorder = VVTK_Recorder::New(); - myRecorder->CheckExistAVIMaker(); - if(myRecorder->ErrorStatus()) - myRecordingToolBar->setEnabled(false); + //myRecorder->CheckExistAVIMaker(); + //if(myRecorder->ErrorStatus()) + // myRecordingToolBar->setEnabled(false); } //---------------------------------------------------------------------------- @@ -191,17 +192,23 @@ VVTK_MainWindow //---------------------------------------------------------------------------- void VVTK_MainWindow::OnStartRecording() { - VVTK_RecorderDlg* aRecorderDlg = new VVTK_RecorderDlg( this, myRecorder ); + myRecorder->CheckExistAVIMaker(); + if (myRecorder->ErrorStatus()) { + SUIT_MessageBox::warn1(this, tr("ERROR"), tr("MSG_NO_AVI_MAKER"), tr("&OK")); + } + else { + VVTK_RecorderDlg* aRecorderDlg = new VVTK_RecorderDlg( this, myRecorder ); - if( !aRecorderDlg->exec() ) - return; + if( !aRecorderDlg->exec() ) + return; - myStartAction->setEnabled( false ); - myPlayAction->setEnabled( false ); - myPauseAction->setEnabled( true ); - myStopAction->setEnabled( true ); + myStartAction->setEnabled( false ); + myPlayAction->setEnabled( false ); + myPauseAction->setEnabled( true ); + myStopAction->setEnabled( true ); - myRecorder->Record(); + myRecorder->Record(); + } } //----------------------------------------------------------------------------