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