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