Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // >> 27 // $Id: G4OpenGLQtMovieDialog.cc,v 1.8 2008-10-24 13:49:19 lgarnier Exp $ >> 28 // GEANT4 tag $Name: not supported by cvs2svn $ 27 // 29 // 28 // << 30 // >> 31 >> 32 #ifdef G4VIS_BUILD_OPENGLQT_DRIVER 29 33 30 #include "G4OpenGLQtViewer.hh" // should be fi 34 #include "G4OpenGLQtViewer.hh" // should be first in case we include 31 // some boost S 35 // some boost SIGNAL/SLOT library 32 #include "G4OpenGLQtMovieDialog.hh" 36 #include "G4OpenGLQtMovieDialog.hh" 33 37 34 #include <qpushbutton.h> 38 #include <qpushbutton.h> 35 #include <qpalette.h> 39 #include <qpalette.h> 36 #include <qlabel.h> 40 #include <qlabel.h> 37 #include <qgroupbox.h> 41 #include <qgroupbox.h> 38 #include <qlayout.h> 42 #include <qlayout.h> 39 #include <qlineedit.h> 43 #include <qlineedit.h> 40 #include <qfiledialog.h> 44 #include <qfiledialog.h> 41 #include <qprocess.h> 45 #include <qprocess.h> 42 46 43 #ifndef G4GMAKE << 44 #include "moc_G4OpenGLQtMovieDialog.cpp" << 45 #endif << 46 47 47 // +---------------------------------------+ 48 // +---------------------------------------+ 48 // + Path for encoder + 49 // + Path for encoder + 49 // + _______ + 50 // + _______ + 50 // + | select| ____________________ + 51 // + | select| ____________________ + 51 // + ------- + 52 // + ------- + 52 // + Temp path + 53 // + Temp path + 53 // + _______ + 54 // + _______ + 54 // + | select| ____________________ + 55 // + | select| ____________________ + 55 // + ------- + 56 // + ------- + 56 // + + 57 // + + 57 // + max number of frames ________ + 58 // + max number of frames ________ + 58 // + .... + 59 // + .... + 59 // + + 60 // + + 60 // + Label : X frames Saves/Encoding + 61 // + Label : X frames Saves/Encoding + 61 // + Cancel Encode + 62 // + Cancel Encode + 62 // +---------------------------------------+ 63 // +---------------------------------------+ 63 64 64 G4OpenGLQtMovieDialog::G4OpenGLQtMovieDialog( 65 G4OpenGLQtMovieDialog::G4OpenGLQtMovieDialog( 65 G4OpenGLQtViewer* parentViewer, 66 G4OpenGLQtViewer* parentViewer, 66 QWidget* parentw << 67 QWidget* parentWidget 67 ) 68 ) 68 : QDialog( parentw ), << 69 : QDialog( parentWidget ), 69 fParentViewer(parentViewer) 70 fParentViewer(parentViewer) 70 { 71 { 71 setModal(false); 72 setModal(false); 72 setWindowTitle( tr( " Save as movie" )); << 73 setWindowTitle( tr( " Movie parameters" )); 73 74 74 75 75 // global layout 76 // global layout 76 QVBoxLayout* globalVLayout = new QVBoxLayout 77 QVBoxLayout* globalVLayout = new QVBoxLayout(this); 77 globalVLayout->setContentsMargins(10,10,10,1 << 78 globalVLayout->setMargin(10); 78 globalVLayout->setSpacing(10); 79 globalVLayout->setSpacing(10); 79 << 80 80 // Encoder group box 81 // Encoder group box 81 QGroupBox *encoderGroupBox = new QGroupBox(t << 82 QGroupBox *encoderGroupBox = new QGroupBox(tr("Encoder path"),this); 82 QVBoxLayout *encoderVGroupBoxLayout = new QV 83 QVBoxLayout *encoderVGroupBoxLayout = new QVBoxLayout(encoderGroupBox); 83 84 84 // Encoder Path << 85 // Encoder Path 85 QWidget *encoderHBox = new QWidget(encoderGr 86 QWidget *encoderHBox = new QWidget(encoderGroupBox); 86 QHBoxLayout *encoderHBoxLayout = new QHBoxLa 87 QHBoxLayout *encoderHBoxLayout = new QHBoxLayout(encoderHBox); 87 fEncoderPath = new QLineEdit("",encoderHBox) 88 fEncoderPath = new QLineEdit("",encoderHBox); 88 89 89 QPushButton *encoderButton = new QPushButton 90 QPushButton *encoderButton = new QPushButton(tr("..."),encoderHBox); 90 encoderButton->setMaximumWidth (30); 91 encoderButton->setMaximumWidth (30); 91 92 92 fEncoderStatus = new QLabel(encoderGroupBox) 93 fEncoderStatus = new QLabel(encoderGroupBox); 93 94 94 fEncoderStatus->setWordWrap(true); 95 fEncoderStatus->setWordWrap(true); 95 encoderVGroupBoxLayout->setContentsMargins(1 << 96 encoderVGroupBoxLayout->setMargin(15); 96 97 97 fEncoderStatus->setText(""); 98 fEncoderStatus->setText(""); 98 99 99 encoderHBoxLayout->addWidget(fEncoderPath); 100 encoderHBoxLayout->addWidget(fEncoderPath); 100 encoderHBoxLayout->addWidget(encoderButton); 101 encoderHBoxLayout->addWidget(encoderButton); 101 encoderVGroupBoxLayout->addWidget(encoderHBo 102 encoderVGroupBoxLayout->addWidget(encoderHBox); 102 encoderVGroupBoxLayout->addWidget(fEncoderSt 103 encoderVGroupBoxLayout->addWidget(fEncoderStatus); 103 104 104 encoderGroupBox->setLayout(encoderVGroupBoxL 105 encoderGroupBox->setLayout(encoderVGroupBoxLayout); 105 globalVLayout->addWidget(encoderGroupBox); 106 globalVLayout->addWidget(encoderGroupBox); 106 107 107 connect( encoderButton, SIGNAL( clicked( ) ) 108 connect( encoderButton, SIGNAL( clicked( ) ), this, SLOT(selectEncoderPathAction() ) ); 108 109 109 110 110 // temp folder group box 111 // temp folder group box 111 QGroupBox *tempFolderGroupBox = new QGroupBo 112 QGroupBox *tempFolderGroupBox = new QGroupBox(tr("Temporary folder path"),this); 112 QVBoxLayout *tempFolderVGroupBoxLayout = new 113 QVBoxLayout *tempFolderVGroupBoxLayout = new QVBoxLayout(tempFolderGroupBox); 113 114 114 // temp folder Path << 115 // temp folder Path 115 QWidget *tempFolderHBox = new QWidget(tempFo 116 QWidget *tempFolderHBox = new QWidget(tempFolderGroupBox); 116 QHBoxLayout *tempFolderHBoxLayout = new QHBo 117 QHBoxLayout *tempFolderHBoxLayout = new QHBoxLayout(tempFolderHBox); 117 118 118 fTempFolderPath = new QLineEdit("",tempFolde 119 fTempFolderPath = new QLineEdit("",tempFolderHBox); 119 120 120 QPushButton *tempButton = new QPushButton(tr 121 QPushButton *tempButton = new QPushButton(tr("..."),tempFolderHBox); 121 tempButton->setMaximumWidth (30); 122 tempButton->setMaximumWidth (30); 122 123 123 fTempFolderStatus = new QLabel(tempFolderGro 124 fTempFolderStatus = new QLabel(tempFolderGroupBox); 124 fTempFolderStatus->setWordWrap(true); 125 fTempFolderStatus->setWordWrap(true); 125 tempFolderVGroupBoxLayout->setContentsMargin << 126 tempFolderVGroupBoxLayout->setMargin(15); 126 fTempFolderStatus->setText(""); 127 fTempFolderStatus->setText(""); 127 128 128 tempFolderHBoxLayout->addWidget(fTempFolderP 129 tempFolderHBoxLayout->addWidget(fTempFolderPath); 129 tempFolderHBoxLayout->addWidget(tempButton); 130 tempFolderHBoxLayout->addWidget(tempButton); 130 tempFolderVGroupBoxLayout->addWidget(tempFol 131 tempFolderVGroupBoxLayout->addWidget(tempFolderHBox); 131 tempFolderVGroupBoxLayout->addWidget(fTempFo 132 tempFolderVGroupBoxLayout->addWidget(fTempFolderStatus); 132 133 133 tempFolderGroupBox->setLayout(tempFolderVGro 134 tempFolderGroupBox->setLayout(tempFolderVGroupBoxLayout); 134 globalVLayout->addWidget(tempFolderGroupBox) 135 globalVLayout->addWidget(tempFolderGroupBox); 135 136 136 connect( tempButton, SIGNAL( clicked( ) ), t 137 connect( tempButton, SIGNAL( clicked( ) ), this, SLOT(selectTempPathAction() ) ); 137 138 138 139 139 140 140 141 141 // save file group box 142 // save file group box 142 QGroupBox *saveFileGroupBox = new QGroupBox( 143 QGroupBox *saveFileGroupBox = new QGroupBox(tr("Save as"),this); 143 QVBoxLayout *saveFileVGroupBoxLayout = new Q 144 QVBoxLayout *saveFileVGroupBoxLayout = new QVBoxLayout(saveFileGroupBox); 144 145 145 // save file << 146 // save file 146 QWidget *saveFileHBox = new QWidget(saveFile 147 QWidget *saveFileHBox = new QWidget(saveFileGroupBox); 147 QHBoxLayout *saveFileHBoxLayout = new QHBoxL 148 QHBoxLayout *saveFileHBoxLayout = new QHBoxLayout(saveFileHBox); 148 149 149 fSaveFileName = new QLineEdit("G4Movie.mpeg" 150 fSaveFileName = new QLineEdit("G4Movie.mpeg",saveFileHBox); 150 151 151 QPushButton *saveButton = new QPushButton(tr 152 QPushButton *saveButton = new QPushButton(tr("..."),saveFileHBox); 152 saveButton->setMaximumWidth (30); 153 saveButton->setMaximumWidth (30); 153 154 154 fSaveFileStatus = new QLabel(saveFileGroupBo 155 fSaveFileStatus = new QLabel(saveFileGroupBox); 155 fSaveFileStatus->setWordWrap(true); 156 fSaveFileStatus->setWordWrap(true); 156 saveFileVGroupBoxLayout->setContentsMargins( << 157 saveFileVGroupBoxLayout->setMargin(15); 157 fSaveFileStatus->setText(""); 158 fSaveFileStatus->setText(""); 158 159 159 saveFileHBoxLayout->addWidget(fSaveFileName) 160 saveFileHBoxLayout->addWidget(fSaveFileName); 160 saveFileHBoxLayout->addWidget(saveButton); 161 saveFileHBoxLayout->addWidget(saveButton); 161 saveFileVGroupBoxLayout->addWidget(saveFileH 162 saveFileVGroupBoxLayout->addWidget(saveFileHBox); 162 saveFileVGroupBoxLayout->addWidget(fSaveFile 163 saveFileVGroupBoxLayout->addWidget(fSaveFileStatus); 163 164 164 saveFileGroupBox->setLayout(saveFileVGroupBo 165 saveFileGroupBox->setLayout(saveFileVGroupBoxLayout); 165 globalVLayout->addWidget(saveFileGroupBox); 166 globalVLayout->addWidget(saveFileGroupBox); 166 167 167 connect( saveButton, SIGNAL( clicked( ) ), t 168 connect( saveButton, SIGNAL( clicked( ) ), this, SLOT(selectSaveFileNameAction() ) ); 168 169 169 170 170 171 171 // label 172 // label 172 173 173 QLabel *infoLabel = new QLabel(" Press SPAC 174 QLabel *infoLabel = new QLabel(" Press SPACE to Start/Pause video recording \n Press RETURN to Stop video recording",this); 174 175 175 // global status 176 // global status 176 QGroupBox *statusGroupBox = new QGroupBox(tr 177 QGroupBox *statusGroupBox = new QGroupBox(tr("Status"),this); 177 QVBoxLayout *statusVGroupBoxLayout = new QVB 178 QVBoxLayout *statusVGroupBoxLayout = new QVBoxLayout(statusGroupBox); 178 179 179 fRecordingStatus = new QLabel(statusGroupBox 180 fRecordingStatus = new QLabel(statusGroupBox); 180 statusVGroupBoxLayout->setContentsMargins(15 << 181 statusVGroupBoxLayout->setMargin(15); 181 fRecordingStatus->setWordWrap(true); 182 fRecordingStatus->setWordWrap(true); 182 QPalette mypalette( fRecordingStatus->palett << 183 QPalette palette( fRecordingStatus->palette() ); 183 mypalette.setColor( QPalette::Text, Qt::gree << 184 palette.setColor( QPalette::Text, Qt::green); 184 fRecordingStatus->setPalette(mypalette); << 185 fRecordingStatus->setPalette(palette); 185 186 186 fRecordingInfos = new QLabel(statusGroupBox) 187 fRecordingInfos = new QLabel(statusGroupBox); 187 fRecordingInfos->setWordWrap(true); 188 fRecordingInfos->setWordWrap(true); 188 setRecordingInfos(""); 189 setRecordingInfos(""); 189 190 190 statusVGroupBoxLayout->addWidget(fRecordingS 191 statusVGroupBoxLayout->addWidget(fRecordingStatus); 191 statusVGroupBoxLayout->addWidget(fRecordingI 192 statusVGroupBoxLayout->addWidget(fRecordingInfos); 192 193 193 statusGroupBox->setLayout(statusVGroupBoxLay 194 statusGroupBox->setLayout(statusVGroupBoxLayout); 194 globalVLayout->addWidget(infoLabel); 195 globalVLayout->addWidget(infoLabel); 195 globalVLayout->addWidget(statusGroupBox); 196 globalVLayout->addWidget(statusGroupBox); 196 197 197 // buttons 198 // buttons 198 QWidget *buttonBox = new QWidget(this); 199 QWidget *buttonBox = new QWidget(this); 199 200 200 QHBoxLayout *buttonBoxLayout = new QHBoxLayo 201 QHBoxLayout *buttonBoxLayout = new QHBoxLayout(buttonBox); 201 202 202 QPushButton *buttonReset = new QPushButton( 203 QPushButton *buttonReset = new QPushButton( tr( "&Reset" ),buttonBox ); 203 buttonReset->setAutoDefault( TRUE ); 204 buttonReset->setAutoDefault( TRUE ); 204 buttonBoxLayout->addWidget(buttonReset); 205 buttonBoxLayout->addWidget(buttonReset); 205 206 206 fButtonStartPause = new QPushButton( tr( " 207 fButtonStartPause = new QPushButton( tr( " &Start " ),buttonBox ); 207 fButtonStartPause->setEnabled(true); 208 fButtonStartPause->setEnabled(true); 208 fButtonStartPause->setAutoDefault( TRUE ); 209 fButtonStartPause->setAutoDefault( TRUE ); 209 buttonBoxLayout->addWidget(fButtonStartPause 210 buttonBoxLayout->addWidget(fButtonStartPause); 210 211 211 fButtonStopFinishClose = new QPushButton( tr 212 fButtonStopFinishClose = new QPushButton( tr( "&Stop" ),buttonBox ); 212 fButtonStopFinishClose->setEnabled(false); 213 fButtonStopFinishClose->setEnabled(false); 213 fButtonStopFinishClose->setAutoDefault( TRUE 214 fButtonStopFinishClose->setAutoDefault( TRUE ); 214 buttonBoxLayout->addWidget(fButtonStopFinish 215 buttonBoxLayout->addWidget(fButtonStopFinishClose); 215 216 216 fButtonSave = new QPushButton( tr( "&Save" ) 217 fButtonSave = new QPushButton( tr( "&Save" ),buttonBox ); 217 fButtonSave->setEnabled(false); 218 fButtonSave->setEnabled(false); 218 fButtonSave->setAutoDefault( TRUE ); 219 fButtonSave->setAutoDefault( TRUE ); 219 buttonBoxLayout->addWidget(fButtonSave); 220 buttonBoxLayout->addWidget(fButtonSave); 220 221 221 QPushButton *buttonCancel = new QPushButton( 222 QPushButton *buttonCancel = new QPushButton( tr( "&Cancel" ),buttonBox ); 222 buttonCancel->setAutoDefault( TRUE ); 223 buttonCancel->setAutoDefault( TRUE ); 223 buttonBoxLayout->addWidget(buttonCancel); 224 buttonBoxLayout->addWidget(buttonCancel); 224 225 225 buttonBox->setLayout(buttonBoxLayout); 226 buttonBox->setLayout(buttonBoxLayout); 226 globalVLayout->addWidget(buttonBox); 227 globalVLayout->addWidget(buttonBox); 227 228 228 229 229 230 230 setLayout(globalVLayout); 231 setLayout(globalVLayout); 231 232 232 // signals and slots connections 233 // signals and slots connections 233 connect( fButtonStartPause, SIGNAL( clicked( 234 connect( fButtonStartPause, SIGNAL( clicked() ), fParentViewer, SLOT( startPauseVideo() ) ); 234 connect( buttonReset, SIGNAL( clicked() ), t 235 connect( buttonReset, SIGNAL( clicked() ), this, SLOT( resetRecording() ) ); 235 connect( buttonCancel, SIGNAL( clicked() ), 236 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); 236 connect( fButtonStopFinishClose, SIGNAL( cli 237 connect( fButtonStopFinishClose, SIGNAL( clicked() ), this, SLOT( stopFinishClose() ) ); 237 connect( fButtonSave, SIGNAL( clicked() ), t 238 connect( fButtonSave, SIGNAL( clicked() ), this, SLOT( save() ) ); 238 239 239 // fill 240 // fill 240 setRecordingStatus(""); 241 setRecordingStatus(""); 241 fEncoderPath->setText(fParentViewer->getEnco 242 fEncoderPath->setText(fParentViewer->getEncoderPath()); 242 fTempFolderPath->setText(fParentViewer->getT 243 fTempFolderPath->setText(fParentViewer->getTempFolderPath()); 243 244 244 // connect line edit signals 245 // connect line edit signals 245 connect (fEncoderPath,SIGNAL(textChanged ( c 246 connect (fEncoderPath,SIGNAL(textChanged ( const QString&)),this,SLOT(checkEncoderSwParameters())); 246 connect (fTempFolderPath,SIGNAL(textChanged 247 connect (fTempFolderPath,SIGNAL(textChanged ( const QString&)),this,SLOT(checkTempFolderParameters())); 247 connect (fSaveFileName,SIGNAL(textChanged ( 248 connect (fSaveFileName,SIGNAL(textChanged ( const QString&)),this,SLOT(checkSaveFileNameParameters())); 248 249 249 connect (fEncoderPath,SIGNAL(editingFinished 250 connect (fEncoderPath,SIGNAL(editingFinished ()),this,SLOT(checkEncoderSwParameters())); 250 connect (fTempFolderPath,SIGNAL(editingFinis 251 connect (fTempFolderPath,SIGNAL(editingFinished ()),this,SLOT(checkTempFolderParameters())); 251 connect (fSaveFileName,SIGNAL(editingFinishe 252 connect (fSaveFileName,SIGNAL(editingFinished ()),this,SLOT(checkSaveFileNameParameters())); 252 253 253 } 254 } 254 255 255 256 256 257 257 G4OpenGLQtMovieDialog::~G4OpenGLQtMovieDialog( 258 G4OpenGLQtMovieDialog::~G4OpenGLQtMovieDialog() 258 { 259 { 259 } 260 } 260 261 261 void G4OpenGLQtMovieDialog::selectEncoderPathA 262 void G4OpenGLQtMovieDialog::selectEncoderPathAction() 262 { 263 { 263 QString nomFich = QFileDialog::getOpenFileN 264 QString nomFich = QFileDialog::getOpenFileName ( this, 264 265 "Select your encoder", 265 << 266 tr("Select your encoder ...")); 266 267 267 268 268 if (nomFich == "") { 269 if (nomFich == "") { 269 return; 270 return; 270 } 271 } 271 fEncoderPath->setText(nomFich); 272 fEncoderPath->setText(nomFich); 272 checkEncoderSwParameters(); 273 checkEncoderSwParameters(); 273 } 274 } 274 275 275 276 276 void G4OpenGLQtMovieDialog::selectTempPathActi 277 void G4OpenGLQtMovieDialog::selectTempPathAction() 277 { 278 { 278 QString nomFich = QFileDialog::getExistingD 279 QString nomFich = QFileDialog::getExistingDirectory ( this, 279 280 "Select temporary folder", 280 << 281 tr("Select temporary folder ...")); 281 282 282 if (nomFich == "") { 283 if (nomFich == "") { 283 return; 284 return; 284 } 285 } 285 fTempFolderPath->setText(nomFich); 286 fTempFolderPath->setText(nomFich); 286 checkTempFolderParameters(); 287 checkTempFolderParameters(); 287 } 288 } 288 289 289 290 290 void G4OpenGLQtMovieDialog::selectSaveFileName 291 void G4OpenGLQtMovieDialog::selectSaveFileNameAction() 291 { 292 { 292 QString nomFich = QFileDialog::getSaveFileN 293 QString nomFich = QFileDialog::getSaveFileName ( this, 293 294 "Select saved file", 294 << 295 tr("Select saved file ...")); 295 296 296 if (nomFich == "") { 297 if (nomFich == "") { 297 return; 298 return; 298 } 299 } 299 fSaveFileName->setText(nomFich); 300 fSaveFileName->setText(nomFich); 300 checkSaveFileNameParameters(); 301 checkSaveFileNameParameters(); 301 } 302 } 302 303 303 304 304 void G4OpenGLQtMovieDialog::stopFinishClose() 305 void G4OpenGLQtMovieDialog::stopFinishClose() { 305 fParentViewer->stopVideo(); 306 fParentViewer->stopVideo(); 306 } 307 } 307 308 308 void G4OpenGLQtMovieDialog::save() { 309 void G4OpenGLQtMovieDialog::save() { 309 if (((fParentViewer->isPaused()) || fParentV 310 if (((fParentViewer->isPaused()) || fParentViewer->isRecording() || fParentViewer->isStopped())) { 310 fParentViewer->saveVideo(); 311 fParentViewer->saveVideo(); 311 } 312 } 312 } 313 } 313 314 314 /** 315 /** 315 * If one of parameter is incorrect, put it in 316 * If one of parameter is incorrect, put it in red and don't valid it 316 * If valid, save it 317 * If valid, save it 317 */ 318 */ 318 bool G4OpenGLQtMovieDialog::checkEncoderSwPara 319 bool G4OpenGLQtMovieDialog::checkEncoderSwParameters() { 319 320 320 bool status = true; 321 bool status = true; 321 QPalette mypalette( fEncoderPath->palette() << 322 QPalette palette( fEncoderPath->palette() ); 322 323 323 QString temp = fParentViewer->setEncoderPath 324 QString temp = fParentViewer->setEncoderPath(fEncoderPath->text()); 324 setRecordingInfos(""); 325 setRecordingInfos(""); 325 fEncoderStatus->setText(temp); 326 fEncoderStatus->setText(temp); 326 if (temp != "") { 327 if (temp != "") { 327 mypalette.setColor( QPalette::Base, Qt::re << 328 palette.setColor( QPalette::Base, Qt::red); 328 if (fParentViewer->isReadyToEncode()) { 329 if (fParentViewer->isReadyToEncode()) { 329 setRecordingInfos("No valid encode defin 330 setRecordingInfos("No valid encode defined, screen capture had been saved in the temp folder in ppm format.\nPlease define a encoder and clic on Apply button"); 330 } 331 } 331 status = false; 332 status = false; 332 } else { 333 } else { 333 mypalette.setColor( QPalette::Base, Qt::wh << 334 palette.setColor( QPalette::Base, Qt::white); 334 fEncoderPath->setText(fParentViewer->getEn 335 fEncoderPath->setText(fParentViewer->getEncoderPath()); 335 } 336 } 336 fEncoderPath->setPalette(mypalette); << 337 fEncoderPath->setPalette(palette); 337 return status; 338 return status; 338 } 339 } 339 340 340 341 341 /** 342 /** 342 * If one of parameter is incorrect, put it in 343 * If one of parameter is incorrect, put it in red and don't valid it 343 * If valid, save it 344 * If valid, save it 344 */ 345 */ 345 bool G4OpenGLQtMovieDialog::checkTempFolderPar 346 bool G4OpenGLQtMovieDialog::checkTempFolderParameters() { 346 347 347 bool status = true; 348 bool status = true; 348 QPalette mypalette( fTempFolderPath->palette << 349 QPalette palette( fTempFolderPath->palette() ); 349 350 350 QString temp = fParentViewer->setTempFolderP 351 QString temp = fParentViewer->setTempFolderPath(fTempFolderPath->text()); 351 fTempFolderStatus->setText(temp); 352 fTempFolderStatus->setText(temp); 352 if (temp != "") { 353 if (temp != "") { 353 mypalette.setColor( QPalette::Base, Qt::re << 354 palette.setColor( QPalette::Base, Qt::red); 354 status = false; 355 status = false; 355 } else { 356 } else { 356 mypalette.setColor( QPalette::Base, Qt::wh << 357 palette.setColor( QPalette::Base, Qt::white); 357 fTempFolderPath->setText(fParentViewer->ge 358 fTempFolderPath->setText(fParentViewer->getTempFolderPath()); 358 } 359 } 359 fTempFolderPath->setPalette(mypalette); << 360 fTempFolderPath->setPalette(palette); 360 return status; 361 return status; 361 } 362 } 362 363 363 364 364 /** 365 /** 365 * If one of parameter is incorrect, put it in 366 * If one of parameter is incorrect, put it in red and don't valid it 366 * If valid, save it 367 * If valid, save it 367 */ 368 */ 368 bool G4OpenGLQtMovieDialog::checkSaveFileNameP 369 bool G4OpenGLQtMovieDialog::checkSaveFileNameParameters() { 369 370 370 bool status = true; 371 bool status = true; 371 QPalette mypalette( fSaveFileName->palette() << 372 QPalette palette( fSaveFileName->palette() ); 372 373 373 QString temp = fParentViewer->setSaveFileNam 374 QString temp = fParentViewer->setSaveFileName(fSaveFileName->text()); 374 fSaveFileStatus->setText(temp); 375 fSaveFileStatus->setText(temp); 375 if (temp != "") { << 376 if (temp != "") { 376 mypalette.setColor( QPalette::Base, Qt::re << 377 palette.setColor( QPalette::Base, Qt::red); 377 status = false; 378 status = false; 378 } else { 379 } else { 379 mypalette.setColor( QPalette::Base, Qt::wh << 380 palette.setColor( QPalette::Base, Qt::white); 380 fSaveFileName->setText(fParentViewer->getS 381 fSaveFileName->setText(fParentViewer->getSaveFileName()); 381 } 382 } 382 fSaveFileName->setPalette(mypalette); << 383 fSaveFileName->setPalette(palette); 383 return status; 384 return status; 384 } 385 } 385 386 386 387 387 void G4OpenGLQtMovieDialog::resetRecording() { 388 void G4OpenGLQtMovieDialog::resetRecording() { 388 fParentViewer->resetRecording(); 389 fParentViewer->resetRecording(); 389 } 390 } 390 391 391 392 392 void G4OpenGLQtMovieDialog::setRecordingStatus 393 void G4OpenGLQtMovieDialog::setRecordingStatus(QString txt) { 393 fRecordingStatus->setText(txt); 394 fRecordingStatus->setText(txt); 394 if (fParentViewer->isWaiting()) { 395 if (fParentViewer->isWaiting()) { 395 fButtonStartPause->setText(" &Start "); 396 fButtonStartPause->setText(" &Start "); 396 fButtonStartPause->setEnabled(true); 397 fButtonStartPause->setEnabled(true); 397 fButtonStopFinishClose->setEnabled(false); 398 fButtonStopFinishClose->setEnabled(false); 398 fButtonSave->setEnabled(false); 399 fButtonSave->setEnabled(false); 399 400 400 } else if (fParentViewer->isPaused()) { 401 } else if (fParentViewer->isPaused()) { 401 402 402 fButtonStartPause->setText(" &Continue ") 403 fButtonStartPause->setText(" &Continue "); 403 fButtonStartPause->setEnabled(true); 404 fButtonStartPause->setEnabled(true); 404 fButtonStopFinishClose->setEnabled(true); 405 fButtonStopFinishClose->setEnabled(true); 405 fButtonSave->setEnabled(false); 406 fButtonSave->setEnabled(false); 406 407 407 } else if (fParentViewer->isRecording()) { 408 } else if (fParentViewer->isRecording()) { 408 409 409 fButtonStartPause->setText(" &Pause "); 410 fButtonStartPause->setText(" &Pause "); 410 fButtonStartPause->setEnabled(true); 411 fButtonStartPause->setEnabled(true); 411 fButtonStopFinishClose->setEnabled(true); 412 fButtonStopFinishClose->setEnabled(true); 412 fButtonSave->setEnabled(false); 413 fButtonSave->setEnabled(false); 413 414 414 } else if (fParentViewer->isBadOutput()) { 415 } else if (fParentViewer->isBadOutput()) { 415 416 416 fButtonStartPause->setText(" &Start "); 417 fButtonStartPause->setText(" &Start "); 417 fButtonStartPause->setEnabled(true); 418 fButtonStartPause->setEnabled(true); 418 fButtonStopFinishClose->setEnabled(false); 419 fButtonStopFinishClose->setEnabled(false); 419 fButtonSave->setEnabled(false); 420 fButtonSave->setEnabled(false); 420 421 421 } else if (fParentViewer->isBadTmp()) { 422 } else if (fParentViewer->isBadTmp()) { 422 423 423 fButtonStartPause->setText(" &Start "); 424 fButtonStartPause->setText(" &Start "); 424 fButtonStartPause->setEnabled(false); 425 fButtonStartPause->setEnabled(false); 425 fButtonStopFinishClose->setEnabled(false); 426 fButtonStopFinishClose->setEnabled(false); 426 fButtonSave->setEnabled(false); 427 fButtonSave->setEnabled(false); 427 428 428 } else if (fParentViewer->isBadEncoder()) { 429 } else if (fParentViewer->isBadEncoder()) { 429 430 430 fButtonStartPause->setText(" &Start "); 431 fButtonStartPause->setText(" &Start "); 431 fButtonStartPause->setEnabled(true); 432 fButtonStartPause->setEnabled(true); 432 fButtonStopFinishClose->setEnabled(false); 433 fButtonStopFinishClose->setEnabled(false); 433 fButtonSave->setEnabled(false); 434 fButtonSave->setEnabled(false); 434 435 435 } else if (fParentViewer->isSuccess()) { 436 } else if (fParentViewer->isSuccess()) { 436 437 437 fButtonStartPause->setText(" &Start "); 438 fButtonStartPause->setText(" &Start "); 438 fButtonStartPause->setEnabled(false); 439 fButtonStartPause->setEnabled(false); 439 fButtonStopFinishClose->setEnabled(false); 440 fButtonStopFinishClose->setEnabled(false); 440 fButtonSave->setEnabled(false); 441 fButtonSave->setEnabled(false); 441 442 442 } else if (fParentViewer->isFailed()) { 443 } else if (fParentViewer->isFailed()) { 443 444 444 fButtonStartPause->setText(" &Start "); 445 fButtonStartPause->setText(" &Start "); 445 fButtonStartPause->setEnabled(false); 446 fButtonStartPause->setEnabled(false); 446 fButtonStopFinishClose->setEnabled(false); 447 fButtonStopFinishClose->setEnabled(false); 447 fButtonSave->setEnabled(false); 448 fButtonSave->setEnabled(false); 448 449 449 } else if (fParentViewer->isStopped()) { 450 } else if (fParentViewer->isStopped()) { 450 451 451 fButtonStartPause->setText(" &Start "); 452 fButtonStartPause->setText(" &Start "); 452 fButtonStartPause->setEnabled(false); 453 fButtonStartPause->setEnabled(false); 453 fButtonStopFinishClose->setEnabled(false); 454 fButtonStopFinishClose->setEnabled(false); 454 fButtonSave->setEnabled(true); 455 fButtonSave->setEnabled(true); 455 } 456 } 456 } 457 } 457 458 458 459 459 void G4OpenGLQtMovieDialog::setRecordingInfos( 460 void G4OpenGLQtMovieDialog::setRecordingInfos(QString txt) { 460 fRecordingInfos->setText(txt); 461 fRecordingInfos->setText(txt); 461 } 462 } 462 463 463 464 464 void G4OpenGLQtMovieDialog::enabledApplyButton 465 void G4OpenGLQtMovieDialog::enabledApplyButton() { 465 fButtonStartPause->setEnabled(true); 466 fButtonStartPause->setEnabled(true); 466 } 467 } >> 468 >> 469 #endif 467 470