[730] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
[873] | 27 | // $Id: G4OpenGLQtMovieDialog.cc,v 1.8 2008/10/24 13:49:19 lgarnier Exp $ |
---|
| 28 | // GEANT4 tag $Name: $ |
---|
[730] | 29 | // |
---|
| 30 | // |
---|
| 31 | |
---|
| 32 | #ifdef G4VIS_BUILD_OPENGLQT_DRIVER |
---|
| 33 | |
---|
| 34 | #include "G4OpenGLQtMovieDialog.hh" |
---|
| 35 | #include "G4OpenGLQtViewer.hh" |
---|
| 36 | |
---|
| 37 | #include <qpushbutton.h> |
---|
[732] | 38 | #include <qpalette.h> |
---|
[730] | 39 | #include <qlabel.h> |
---|
[733] | 40 | #include <qgroupbox.h> |
---|
[730] | 41 | #include <qlayout.h> |
---|
| 42 | #include <qlineedit.h> |
---|
| 43 | #include <qfiledialog.h> |
---|
| 44 | #include <qprocess.h> |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | // +---------------------------------------+ |
---|
| 48 | // + Path for encoder + |
---|
| 49 | // + _______ + |
---|
| 50 | // + | select| ____________________ + |
---|
| 51 | // + ------- + |
---|
[732] | 52 | // + Temp path + |
---|
| 53 | // + _______ + |
---|
| 54 | // + | select| ____________________ + |
---|
| 55 | // + ------- + |
---|
[730] | 56 | // + + |
---|
| 57 | // + max number of frames ________ + |
---|
| 58 | // + .... + |
---|
| 59 | // + + |
---|
| 60 | // + Label : X frames Saves/Encoding + |
---|
| 61 | // + Cancel Encode + |
---|
| 62 | // +---------------------------------------+ |
---|
| 63 | |
---|
| 64 | G4OpenGLQtMovieDialog::G4OpenGLQtMovieDialog( |
---|
[731] | 65 | G4OpenGLQtViewer* parentViewer, |
---|
| 66 | QWidget* parentWidget |
---|
[730] | 67 | ) |
---|
[731] | 68 | : QDialog( parentWidget ), |
---|
| 69 | fParentViewer(parentViewer) |
---|
[730] | 70 | { |
---|
[754] | 71 | #if QT_VERSION > 0x030200 |
---|
[730] | 72 | setModal(false); |
---|
[754] | 73 | #endif |
---|
[730] | 74 | #if QT_VERSION < 0x040000 |
---|
| 75 | setCaption( tr( " Movie parameters" )); |
---|
| 76 | #else |
---|
| 77 | setWindowTitle( tr( " Movie parameters" )); |
---|
| 78 | #endif |
---|
| 79 | |
---|
| 80 | |
---|
| 81 | // global layout |
---|
| 82 | QVBoxLayout* globalVLayout = new QVBoxLayout(this); |
---|
| 83 | globalVLayout->setMargin(10); |
---|
| 84 | globalVLayout->setSpacing(10); |
---|
| 85 | |
---|
[733] | 86 | // Encoder group box |
---|
[755] | 87 | QGroupBox *encoderGroupBox = new QGroupBox(tr("Encoder path"),this); |
---|
[734] | 88 | QVBoxLayout *encoderVGroupBoxLayout = new QVBoxLayout(encoderGroupBox); |
---|
[730] | 89 | |
---|
[732] | 90 | // Encoder Path |
---|
[733] | 91 | QWidget *encoderHBox = new QWidget(encoderGroupBox); |
---|
| 92 | QHBoxLayout *encoderHBoxLayout = new QHBoxLayout(encoderHBox); |
---|
| 93 | fEncoderPath = new QLineEdit("",encoderHBox); |
---|
[730] | 94 | |
---|
[733] | 95 | QPushButton *encoderButton = new QPushButton(tr("..."),encoderHBox); |
---|
[732] | 96 | encoderButton->setMaximumWidth (30); |
---|
[730] | 97 | |
---|
[733] | 98 | fEncoderStatus = new QLabel(encoderGroupBox); |
---|
[754] | 99 | |
---|
| 100 | #if QT_VERSION > 0x040000 |
---|
[748] | 101 | fEncoderStatus->setWordWrap(true); |
---|
[755] | 102 | encoderVGroupBoxLayout->setMargin(15); |
---|
[754] | 103 | #else |
---|
| 104 | fEncoderStatus->setAlignment ( Qt::AlignAuto |Qt::WordBreak ); |
---|
[755] | 105 | encoderGroupBox->setInsideMargin(15); |
---|
[754] | 106 | #endif |
---|
| 107 | |
---|
[733] | 108 | fEncoderStatus->setText(""); |
---|
| 109 | |
---|
[732] | 110 | #if QT_VERSION < 0x040000 |
---|
[733] | 111 | encoderHBoxLayout->add(fEncoderPath); |
---|
| 112 | encoderHBoxLayout->add(encoderButton); |
---|
[734] | 113 | encoderVGroupBoxLayout->add(encoderHBox); |
---|
| 114 | encoderVGroupBoxLayout->add(fEncoderStatus); |
---|
[735] | 115 | |
---|
| 116 | globalVLayout->add(encoderGroupBox); |
---|
[732] | 117 | #else |
---|
[733] | 118 | encoderHBoxLayout->addWidget(fEncoderPath); |
---|
| 119 | encoderHBoxLayout->addWidget(encoderButton); |
---|
[734] | 120 | encoderVGroupBoxLayout->addWidget(encoderHBox); |
---|
| 121 | encoderVGroupBoxLayout->addWidget(fEncoderStatus); |
---|
[730] | 122 | |
---|
[734] | 123 | encoderGroupBox->setLayout(encoderVGroupBoxLayout); |
---|
[735] | 124 | globalVLayout->addWidget(encoderGroupBox); |
---|
[732] | 125 | #endif |
---|
[735] | 126 | |
---|
[733] | 127 | connect( encoderButton, SIGNAL( clicked( ) ), this, SLOT(selectEncoderPathAction() ) ); |
---|
[732] | 128 | |
---|
[730] | 129 | |
---|
[733] | 130 | // temp folder group box |
---|
[755] | 131 | QGroupBox *tempFolderGroupBox = new QGroupBox(tr("Temporary folder path"),this); |
---|
[734] | 132 | QVBoxLayout *tempFolderVGroupBoxLayout = new QVBoxLayout(tempFolderGroupBox); |
---|
[733] | 133 | |
---|
[732] | 134 | // temp folder Path |
---|
[733] | 135 | QWidget *tempFolderHBox = new QWidget(tempFolderGroupBox); |
---|
[734] | 136 | QHBoxLayout *tempFolderHBoxLayout = new QHBoxLayout(tempFolderHBox); |
---|
[732] | 137 | |
---|
[733] | 138 | fTempFolderPath = new QLineEdit("",tempFolderHBox); |
---|
| 139 | |
---|
| 140 | QPushButton *tempButton = new QPushButton(tr("..."),tempFolderHBox); |
---|
| 141 | tempButton->setMaximumWidth (30); |
---|
| 142 | |
---|
| 143 | fTempFolderStatus = new QLabel(tempFolderGroupBox); |
---|
[754] | 144 | #if QT_VERSION > 0x040000 |
---|
[748] | 145 | fTempFolderStatus->setWordWrap(true); |
---|
[755] | 146 | tempFolderVGroupBoxLayout->setMargin(15); |
---|
[754] | 147 | #else |
---|
| 148 | fTempFolderStatus->setAlignment ( Qt::AlignAuto |Qt::WordBreak ); |
---|
[755] | 149 | tempFolderGroupBox->setInsideMargin(15); |
---|
[754] | 150 | #endif |
---|
[733] | 151 | fTempFolderStatus->setText(""); |
---|
| 152 | |
---|
[730] | 153 | #if QT_VERSION < 0x040000 |
---|
[733] | 154 | tempFolderHBoxLayout->add(fTempFolderPath); |
---|
| 155 | tempFolderHBoxLayout->add(tempButton); |
---|
[734] | 156 | tempFolderVGroupBoxLayout->add(tempFolderHBox); |
---|
| 157 | tempFolderVGroupBoxLayout->add(fTempFolderStatus); |
---|
[735] | 158 | |
---|
| 159 | globalVLayout->add(tempFolderGroupBox); |
---|
[730] | 160 | #else |
---|
[733] | 161 | tempFolderHBoxLayout->addWidget(fTempFolderPath); |
---|
| 162 | tempFolderHBoxLayout->addWidget(tempButton); |
---|
[734] | 163 | tempFolderVGroupBoxLayout->addWidget(tempFolderHBox); |
---|
| 164 | tempFolderVGroupBoxLayout->addWidget(fTempFolderStatus); |
---|
[730] | 165 | |
---|
[734] | 166 | tempFolderGroupBox->setLayout(tempFolderVGroupBoxLayout); |
---|
[735] | 167 | globalVLayout->addWidget(tempFolderGroupBox); |
---|
[733] | 168 | #endif |
---|
[735] | 169 | |
---|
[733] | 170 | connect( tempButton, SIGNAL( clicked( ) ), this, SLOT(selectTempPathAction() ) ); |
---|
[732] | 171 | |
---|
[733] | 172 | |
---|
[734] | 173 | |
---|
| 174 | |
---|
[733] | 175 | // save file group box |
---|
[755] | 176 | QGroupBox *saveFileGroupBox = new QGroupBox(tr("Save as"),this); |
---|
[734] | 177 | QVBoxLayout *saveFileVGroupBoxLayout = new QVBoxLayout(saveFileGroupBox); |
---|
[733] | 178 | |
---|
| 179 | // save file |
---|
| 180 | QWidget *saveFileHBox = new QWidget(saveFileGroupBox); |
---|
| 181 | QHBoxLayout *saveFileHBoxLayout = new QHBoxLayout(saveFileHBox); |
---|
| 182 | |
---|
[857] | 183 | fSaveFileName = new QLineEdit("G4Movie.mpeg",saveFileHBox); |
---|
[733] | 184 | |
---|
| 185 | QPushButton *saveButton = new QPushButton(tr("..."),saveFileHBox); |
---|
| 186 | saveButton->setMaximumWidth (30); |
---|
| 187 | |
---|
| 188 | fSaveFileStatus = new QLabel(saveFileGroupBox); |
---|
[754] | 189 | #if QT_VERSION > 0x040000 |
---|
[748] | 190 | fSaveFileStatus->setWordWrap(true); |
---|
[755] | 191 | saveFileVGroupBoxLayout->setMargin(15); |
---|
[754] | 192 | #else |
---|
| 193 | fSaveFileStatus->setAlignment ( Qt::AlignAuto |Qt::WordBreak ); |
---|
[755] | 194 | saveFileGroupBox->setInsideMargin(15); |
---|
[754] | 195 | #endif |
---|
[733] | 196 | fSaveFileStatus->setText(""); |
---|
| 197 | |
---|
| 198 | #if QT_VERSION < 0x040000 |
---|
[734] | 199 | saveFileHBoxLayout->add(fSaveFileName); |
---|
[733] | 200 | saveFileHBoxLayout->add(saveButton); |
---|
[734] | 201 | saveFileVGroupBoxLayout->add(saveFileHBox); |
---|
| 202 | saveFileVGroupBoxLayout->add(fSaveFileStatus); |
---|
[735] | 203 | |
---|
| 204 | globalVLayout->add(saveFileGroupBox); |
---|
[733] | 205 | #else |
---|
[734] | 206 | saveFileHBoxLayout->addWidget(fSaveFileName); |
---|
[733] | 207 | saveFileHBoxLayout->addWidget(saveButton); |
---|
[734] | 208 | saveFileVGroupBoxLayout->addWidget(saveFileHBox); |
---|
| 209 | saveFileVGroupBoxLayout->addWidget(fSaveFileStatus); |
---|
[733] | 210 | |
---|
[734] | 211 | saveFileGroupBox->setLayout(saveFileVGroupBoxLayout); |
---|
[735] | 212 | globalVLayout->addWidget(saveFileGroupBox); |
---|
[730] | 213 | #endif |
---|
[735] | 214 | |
---|
[733] | 215 | connect( saveButton, SIGNAL( clicked( ) ), this, SLOT(selectSaveFileNameAction() ) ); |
---|
[730] | 216 | |
---|
| 217 | |
---|
| 218 | |
---|
[732] | 219 | // label |
---|
| 220 | |
---|
[754] | 221 | QLabel *infoLabel = new QLabel(" Press SPACE to Start/Pause video recording \n Press RETURN to Stop video recording",this); |
---|
[730] | 222 | |
---|
[733] | 223 | // global status |
---|
[755] | 224 | QGroupBox *statusGroupBox = new QGroupBox(tr("Status"),this); |
---|
[735] | 225 | QVBoxLayout *statusVGroupBoxLayout = new QVBoxLayout(statusGroupBox); |
---|
[733] | 226 | |
---|
[744] | 227 | fRecordingStatus = new QLabel(statusGroupBox); |
---|
[754] | 228 | #if QT_VERSION > 0x040000 |
---|
[755] | 229 | statusVGroupBoxLayout->setMargin(15); |
---|
[748] | 230 | fRecordingStatus->setWordWrap(true); |
---|
[754] | 231 | #else |
---|
[755] | 232 | statusGroupBox->setInsideMargin(15); |
---|
[754] | 233 | fRecordingStatus->setAlignment ( Qt::AlignAuto |Qt::WordBreak ); |
---|
| 234 | #endif |
---|
[744] | 235 | QPalette palette( fRecordingStatus->palette() ); |
---|
[754] | 236 | #if QT_VERSION > 0x040000 |
---|
[744] | 237 | palette.setColor( QPalette::Text, Qt::green); |
---|
[754] | 238 | #else |
---|
| 239 | palette.setColor( QColorGroup::Text, Qt::green); |
---|
| 240 | #endif |
---|
[744] | 241 | fRecordingStatus->setPalette(palette); |
---|
| 242 | |
---|
| 243 | fRecordingInfos = new QLabel(statusGroupBox); |
---|
[754] | 244 | #if QT_VERSION > 0x040000 |
---|
[748] | 245 | fRecordingInfos->setWordWrap(true); |
---|
[754] | 246 | #else |
---|
| 247 | fRecordingInfos->setAlignment ( Qt::AlignAuto |Qt::WordBreak ); |
---|
| 248 | #endif |
---|
[744] | 249 | setRecordingInfos(""); |
---|
| 250 | |
---|
[730] | 251 | #if QT_VERSION < 0x040000 |
---|
[744] | 252 | statusVGroupBoxLayout->add(fRecordingStatus); |
---|
| 253 | statusVGroupBoxLayout->add(fRecordingInfos); |
---|
[735] | 254 | |
---|
[730] | 255 | globalVLayout->add(infoLabel); |
---|
[735] | 256 | globalVLayout->add(statusGroupBox); |
---|
[730] | 257 | #else |
---|
[744] | 258 | statusVGroupBoxLayout->addWidget(fRecordingStatus); |
---|
| 259 | statusVGroupBoxLayout->addWidget(fRecordingInfos); |
---|
[735] | 260 | |
---|
| 261 | statusGroupBox->setLayout(statusVGroupBoxLayout); |
---|
[730] | 262 | globalVLayout->addWidget(infoLabel); |
---|
[735] | 263 | globalVLayout->addWidget(statusGroupBox); |
---|
[730] | 264 | #endif |
---|
[732] | 265 | |
---|
| 266 | // buttons |
---|
[730] | 267 | QWidget *buttonBox = new QWidget(this); |
---|
| 268 | |
---|
| 269 | QHBoxLayout *buttonBoxLayout = new QHBoxLayout(buttonBox); |
---|
| 270 | |
---|
[750] | 271 | QPushButton *buttonReset = new QPushButton( tr( "&Reset" ),buttonBox ); |
---|
| 272 | buttonReset->setAutoDefault( TRUE ); |
---|
| 273 | buttonBoxLayout->addWidget(buttonReset); |
---|
[733] | 274 | |
---|
[857] | 275 | fButtonStartPause = new QPushButton( tr( " &Start " ),buttonBox ); |
---|
| 276 | fButtonStartPause->setEnabled(true); |
---|
| 277 | fButtonStartPause->setAutoDefault( TRUE ); |
---|
| 278 | buttonBoxLayout->addWidget(fButtonStartPause); |
---|
[750] | 279 | |
---|
[857] | 280 | fButtonStopFinishClose = new QPushButton( tr( "&Stop" ),buttonBox ); |
---|
| 281 | fButtonStopFinishClose->setEnabled(false); |
---|
| 282 | fButtonStopFinishClose->setAutoDefault( TRUE ); |
---|
| 283 | buttonBoxLayout->addWidget(fButtonStopFinishClose); |
---|
[730] | 284 | |
---|
[857] | 285 | fButtonSave = new QPushButton( tr( "&Save" ),buttonBox ); |
---|
| 286 | fButtonSave->setEnabled(false); |
---|
| 287 | fButtonSave->setAutoDefault( TRUE ); |
---|
| 288 | buttonBoxLayout->addWidget(fButtonSave); |
---|
| 289 | |
---|
| 290 | QPushButton *buttonCancel = new QPushButton( tr( "&Cancel" ),buttonBox ); |
---|
| 291 | buttonCancel->setAutoDefault( TRUE ); |
---|
| 292 | buttonBoxLayout->addWidget(buttonCancel); |
---|
| 293 | |
---|
[730] | 294 | #if QT_VERSION >= 0x040000 |
---|
| 295 | buttonBox->setLayout(buttonBoxLayout); |
---|
| 296 | #endif |
---|
| 297 | globalVLayout->addWidget(buttonBox); |
---|
| 298 | |
---|
| 299 | |
---|
| 300 | |
---|
| 301 | #if QT_VERSION >= 0x040000 |
---|
| 302 | setLayout(globalVLayout); |
---|
| 303 | #endif |
---|
| 304 | |
---|
| 305 | // signals and slots connections |
---|
[857] | 306 | connect( fButtonStartPause, SIGNAL( clicked() ), fParentViewer, SLOT( startPauseVideo() ) ); |
---|
[750] | 307 | connect( buttonReset, SIGNAL( clicked() ), this, SLOT( resetRecording() ) ); |
---|
[730] | 308 | connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); |
---|
[857] | 309 | connect( fButtonStopFinishClose, SIGNAL( clicked() ), this, SLOT( stopFinishClose() ) ); |
---|
| 310 | connect( fButtonSave, SIGNAL( clicked() ), this, SLOT( save() ) ); |
---|
[737] | 311 | |
---|
| 312 | // fill |
---|
[748] | 313 | setRecordingStatus(""); |
---|
[737] | 314 | fEncoderPath->setText(fParentViewer->getEncoderPath()); |
---|
| 315 | fTempFolderPath->setText(fParentViewer->getTempFolderPath()); |
---|
| 316 | |
---|
[750] | 317 | // connect line edit signals |
---|
[857] | 318 | connect (fEncoderPath,SIGNAL(textChanged ( const QString&)),this,SLOT(checkEncoderSwParameters())); |
---|
| 319 | connect (fTempFolderPath,SIGNAL(textChanged ( const QString&)),this,SLOT(checkTempFolderParameters())); |
---|
| 320 | connect (fSaveFileName,SIGNAL(textChanged ( const QString&)),this,SLOT(checkSaveFileNameParameters())); |
---|
[750] | 321 | |
---|
[755] | 322 | #if QT_VERSION >= 0x040000 |
---|
[857] | 323 | connect (fEncoderPath,SIGNAL(editingFinished ()),this,SLOT(checkEncoderSwParameters())); |
---|
| 324 | connect (fTempFolderPath,SIGNAL(editingFinished ()),this,SLOT(checkTempFolderParameters())); |
---|
| 325 | connect (fSaveFileName,SIGNAL(editingFinished ()),this,SLOT(checkSaveFileNameParameters())); |
---|
[755] | 326 | #else |
---|
[857] | 327 | connect (fEncoderPath,SIGNAL(lostFocus ()),this,SLOT(checkEncoderSwParameters())); |
---|
| 328 | connect (fTempFolderPath,SIGNAL(lostFocus ()),this,SLOT(checkTempFolderParameters())); |
---|
| 329 | connect (fSaveFileName,SIGNAL(lostFocus ()),this,SLOT(checkSaveFileNameParameters())); |
---|
[755] | 330 | #endif |
---|
[751] | 331 | |
---|
[730] | 332 | } |
---|
| 333 | |
---|
| 334 | |
---|
| 335 | |
---|
| 336 | G4OpenGLQtMovieDialog::~G4OpenGLQtMovieDialog() |
---|
| 337 | { |
---|
| 338 | } |
---|
| 339 | |
---|
[733] | 340 | void G4OpenGLQtMovieDialog::selectEncoderPathAction() |
---|
[730] | 341 | { |
---|
[754] | 342 | #if QT_VERSION < 0x040000 |
---|
| 343 | QString nomFich = QFileDialog::getOpenFileName ( ".", |
---|
| 344 | NULL, |
---|
| 345 | this, |
---|
| 346 | "Select your encoder", |
---|
| 347 | tr("Select your encoder ...")); |
---|
| 348 | #else |
---|
[730] | 349 | QString nomFich = QFileDialog::getOpenFileName ( this, |
---|
| 350 | "Select your encoder", |
---|
| 351 | tr("Select your encoder ...")); |
---|
[754] | 352 | |
---|
| 353 | #endif |
---|
| 354 | |
---|
[730] | 355 | if (nomFich == "") { |
---|
| 356 | return; |
---|
| 357 | } |
---|
[750] | 358 | fEncoderPath->setText(nomFich); |
---|
[857] | 359 | checkEncoderSwParameters(); |
---|
[733] | 360 | } |
---|
| 361 | |
---|
[750] | 362 | |
---|
[733] | 363 | void G4OpenGLQtMovieDialog::selectTempPathAction() |
---|
| 364 | { |
---|
[754] | 365 | #if QT_VERSION < 0x040000 |
---|
[755] | 366 | QString nomFich = QFileDialog::getExistingDirectory (NULL, |
---|
[754] | 367 | this, |
---|
| 368 | "Select temporary folder", |
---|
| 369 | tr("Select temporary folder ...")); |
---|
| 370 | #else |
---|
[755] | 371 | QString nomFich = QFileDialog::getExistingDirectory ( this, |
---|
[733] | 372 | "Select temporary folder", |
---|
| 373 | tr("Select temporary folder ...")); |
---|
[754] | 374 | |
---|
| 375 | #endif |
---|
[733] | 376 | if (nomFich == "") { |
---|
| 377 | return; |
---|
| 378 | } |
---|
[750] | 379 | fTempFolderPath->setText(nomFich); |
---|
[857] | 380 | checkTempFolderParameters(); |
---|
[733] | 381 | } |
---|
| 382 | |
---|
[750] | 383 | |
---|
[733] | 384 | void G4OpenGLQtMovieDialog::selectSaveFileNameAction() |
---|
| 385 | { |
---|
[754] | 386 | #if QT_VERSION < 0x040000 |
---|
| 387 | QString nomFich = QFileDialog::getSaveFileName ( ".", |
---|
| 388 | NULL, |
---|
| 389 | this, |
---|
| 390 | "Select saved file", |
---|
| 391 | tr("Select saved file ...")); |
---|
| 392 | #else |
---|
[742] | 393 | QString nomFich = QFileDialog::getSaveFileName ( this, |
---|
[733] | 394 | "Select saved file", |
---|
| 395 | tr("Select saved file ...")); |
---|
[754] | 396 | |
---|
| 397 | #endif |
---|
[733] | 398 | if (nomFich == "") { |
---|
| 399 | return; |
---|
| 400 | } |
---|
[750] | 401 | fSaveFileName->setText(nomFich); |
---|
[857] | 402 | checkSaveFileNameParameters(); |
---|
[733] | 403 | } |
---|
| 404 | |
---|
[750] | 405 | |
---|
[857] | 406 | void G4OpenGLQtMovieDialog::stopFinishClose() { |
---|
| 407 | fParentViewer->stopVideo(); |
---|
[730] | 408 | } |
---|
| 409 | |
---|
[857] | 410 | void G4OpenGLQtMovieDialog::save() { |
---|
| 411 | if (((fParentViewer->isPaused()) || fParentViewer->isRecording() || fParentViewer->isStopped())) { |
---|
| 412 | fParentViewer->saveVideo(); |
---|
[747] | 413 | } |
---|
[733] | 414 | } |
---|
| 415 | |
---|
| 416 | /** |
---|
[732] | 417 | * If one of parameter is incorrect, put it in red and don't valid it |
---|
[733] | 418 | * If valid, save it |
---|
[732] | 419 | */ |
---|
[857] | 420 | bool G4OpenGLQtMovieDialog::checkEncoderSwParameters() { |
---|
[730] | 421 | |
---|
[747] | 422 | bool status = true; |
---|
[732] | 423 | QPalette palette( fEncoderPath->palette() ); |
---|
| 424 | |
---|
[857] | 425 | QString temp = fParentViewer->setEncoderPath(fEncoderPath->text()); |
---|
[744] | 426 | setRecordingInfos(""); |
---|
[740] | 427 | fEncoderStatus->setText(temp); |
---|
[733] | 428 | if (temp != "") { |
---|
[754] | 429 | #if QT_VERSION > 0x040000 |
---|
[732] | 430 | palette.setColor( QPalette::Base, Qt::red); |
---|
[754] | 431 | #else |
---|
| 432 | palette.setColor( QColorGroup::Base, Qt::red); |
---|
| 433 | #endif |
---|
[746] | 434 | if (fParentViewer->isReadyToEncode()) { |
---|
[748] | 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"); |
---|
[747] | 436 | } |
---|
| 437 | status = false; |
---|
[732] | 438 | } else { |
---|
[754] | 439 | #if QT_VERSION > 0x040000 |
---|
[732] | 440 | palette.setColor( QPalette::Base, Qt::white); |
---|
[754] | 441 | #else |
---|
| 442 | palette.setColor( QColorGroup::Base, Qt::white); |
---|
| 443 | #endif |
---|
[733] | 444 | fEncoderPath->setText(fParentViewer->getEncoderPath()); |
---|
[732] | 445 | } |
---|
| 446 | fEncoderPath->setPalette(palette); |
---|
[747] | 447 | return status; |
---|
[733] | 448 | } |
---|
[732] | 449 | |
---|
| 450 | |
---|
[733] | 451 | /** |
---|
| 452 | * If one of parameter is incorrect, put it in red and don't valid it |
---|
| 453 | * If valid, save it |
---|
| 454 | */ |
---|
[857] | 455 | bool G4OpenGLQtMovieDialog::checkTempFolderParameters() { |
---|
[732] | 456 | |
---|
[747] | 457 | bool status = true; |
---|
[733] | 458 | QPalette palette( fTempFolderPath->palette() ); |
---|
| 459 | |
---|
[857] | 460 | QString temp = fParentViewer->setTempFolderPath(fTempFolderPath->text()); |
---|
[736] | 461 | fTempFolderStatus->setText(temp); |
---|
| 462 | if (temp != "") { |
---|
[754] | 463 | #if QT_VERSION > 0x040000 |
---|
[732] | 464 | palette.setColor( QPalette::Base, Qt::red); |
---|
[754] | 465 | #else |
---|
| 466 | palette.setColor( QColorGroup::Base, Qt::red); |
---|
| 467 | #endif |
---|
[747] | 468 | status = false; |
---|
[732] | 469 | } else { |
---|
[754] | 470 | #if QT_VERSION > 0x040000 |
---|
[732] | 471 | palette.setColor( QPalette::Base, Qt::white); |
---|
[754] | 472 | #else |
---|
| 473 | palette.setColor( QColorGroup::Base, Qt::white); |
---|
| 474 | #endif |
---|
[736] | 475 | fTempFolderPath->setText(fParentViewer->getTempFolderPath()); |
---|
[732] | 476 | } |
---|
[733] | 477 | fTempFolderPath->setPalette(palette); |
---|
[747] | 478 | return status; |
---|
[732] | 479 | } |
---|
| 480 | |
---|
[733] | 481 | |
---|
| 482 | /** |
---|
| 483 | * If one of parameter is incorrect, put it in red and don't valid it |
---|
| 484 | * If valid, save it |
---|
| 485 | */ |
---|
[857] | 486 | bool G4OpenGLQtMovieDialog::checkSaveFileNameParameters() { |
---|
[733] | 487 | |
---|
[747] | 488 | bool status = true; |
---|
[733] | 489 | QPalette palette( fSaveFileName->palette() ); |
---|
| 490 | |
---|
[857] | 491 | QString temp = fParentViewer->setSaveFileName(fSaveFileName->text()); |
---|
[750] | 492 | fSaveFileStatus->setText(temp); |
---|
[733] | 493 | if (temp != "") { |
---|
[754] | 494 | #if QT_VERSION > 0x040000 |
---|
[733] | 495 | palette.setColor( QPalette::Base, Qt::red); |
---|
[754] | 496 | #else |
---|
| 497 | palette.setColor( QColorGroup::Base, Qt::red); |
---|
| 498 | #endif |
---|
[747] | 499 | status = false; |
---|
[733] | 500 | } else { |
---|
[754] | 501 | #if QT_VERSION > 0x040000 |
---|
[733] | 502 | palette.setColor( QPalette::Base, Qt::white); |
---|
[754] | 503 | #else |
---|
| 504 | palette.setColor( QColorGroup::Base, Qt::white); |
---|
| 505 | #endif |
---|
[733] | 506 | fSaveFileName->setText(fParentViewer->getSaveFileName()); |
---|
| 507 | } |
---|
| 508 | fSaveFileName->setPalette(palette); |
---|
[747] | 509 | return status; |
---|
[733] | 510 | } |
---|
[737] | 511 | |
---|
| 512 | |
---|
[750] | 513 | void G4OpenGLQtMovieDialog::resetRecording() { |
---|
| 514 | fParentViewer->resetRecording(); |
---|
| 515 | } |
---|
| 516 | |
---|
| 517 | |
---|
[744] | 518 | void G4OpenGLQtMovieDialog::setRecordingStatus(QString txt) { |
---|
| 519 | fRecordingStatus->setText(txt); |
---|
[857] | 520 | if (fParentViewer->isWaiting()) { |
---|
| 521 | fButtonStartPause->setText(" &Start "); |
---|
| 522 | fButtonStartPause->setEnabled(true); |
---|
| 523 | fButtonStopFinishClose->setEnabled(false); |
---|
| 524 | fButtonSave->setEnabled(false); |
---|
| 525 | |
---|
| 526 | } else if (fParentViewer->isPaused()) { |
---|
| 527 | |
---|
| 528 | fButtonStartPause->setText(" &Continue "); |
---|
| 529 | fButtonStartPause->setEnabled(true); |
---|
| 530 | fButtonStopFinishClose->setEnabled(true); |
---|
| 531 | fButtonSave->setEnabled(false); |
---|
| 532 | |
---|
| 533 | } else if (fParentViewer->isRecording()) { |
---|
| 534 | |
---|
| 535 | fButtonStartPause->setText(" &Pause "); |
---|
| 536 | fButtonStartPause->setEnabled(true); |
---|
| 537 | fButtonStopFinishClose->setEnabled(true); |
---|
| 538 | fButtonSave->setEnabled(false); |
---|
| 539 | |
---|
| 540 | } else if (fParentViewer->isBadOutput()) { |
---|
| 541 | |
---|
| 542 | fButtonStartPause->setText(" &Start "); |
---|
| 543 | fButtonStartPause->setEnabled(true); |
---|
| 544 | fButtonStopFinishClose->setEnabled(false); |
---|
| 545 | fButtonSave->setEnabled(false); |
---|
| 546 | |
---|
| 547 | } else if (fParentViewer->isBadTmp()) { |
---|
| 548 | |
---|
| 549 | fButtonStartPause->setText(" &Start "); |
---|
| 550 | fButtonStartPause->setEnabled(false); |
---|
| 551 | fButtonStopFinishClose->setEnabled(false); |
---|
| 552 | fButtonSave->setEnabled(false); |
---|
| 553 | |
---|
| 554 | } else if (fParentViewer->isBadEncoder()) { |
---|
| 555 | |
---|
| 556 | fButtonStartPause->setText(" &Start "); |
---|
| 557 | fButtonStartPause->setEnabled(true); |
---|
| 558 | fButtonStopFinishClose->setEnabled(false); |
---|
| 559 | fButtonSave->setEnabled(false); |
---|
| 560 | |
---|
| 561 | } else if (fParentViewer->isSuccess()) { |
---|
| 562 | |
---|
| 563 | fButtonStartPause->setText(" &Start "); |
---|
| 564 | fButtonStartPause->setEnabled(false); |
---|
| 565 | fButtonStopFinishClose->setEnabled(false); |
---|
| 566 | fButtonSave->setEnabled(false); |
---|
| 567 | |
---|
| 568 | } else if (fParentViewer->isFailed()) { |
---|
| 569 | |
---|
| 570 | fButtonStartPause->setText(" &Start "); |
---|
| 571 | fButtonStartPause->setEnabled(false); |
---|
| 572 | fButtonStopFinishClose->setEnabled(false); |
---|
| 573 | fButtonSave->setEnabled(false); |
---|
| 574 | |
---|
| 575 | } else if (fParentViewer->isStopped()) { |
---|
| 576 | |
---|
| 577 | fButtonStartPause->setText(" &Start "); |
---|
| 578 | fButtonStartPause->setEnabled(false); |
---|
| 579 | fButtonStopFinishClose->setEnabled(false); |
---|
| 580 | fButtonSave->setEnabled(true); |
---|
| 581 | } |
---|
[737] | 582 | } |
---|
| 583 | |
---|
[750] | 584 | |
---|
[744] | 585 | void G4OpenGLQtMovieDialog::setRecordingInfos(QString txt) { |
---|
| 586 | fRecordingInfos->setText(txt); |
---|
| 587 | } |
---|
| 588 | |
---|
[751] | 589 | |
---|
| 590 | void G4OpenGLQtMovieDialog::enabledApplyButton() { |
---|
[857] | 591 | fButtonStartPause->setEnabled(true); |
---|
[751] | 592 | } |
---|
| 593 | |
---|
[730] | 594 | #endif |
---|