| 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 | //
|
|---|
| 27 | // $Id: G4OpenGLQtMovieDialog.cc,v 1.8 2008/10/24 13:49:19 lgarnier Exp $
|
|---|
| 28 | // GEANT4 tag $Name: $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 |
|
|---|
| 32 | #ifdef G4VIS_BUILD_OPENGLQT_DRIVER
|
|---|
| 33 |
|
|---|
| 34 | #include "G4OpenGLQtMovieDialog.hh"
|
|---|
| 35 | #include "G4OpenGLQtViewer.hh"
|
|---|
| 36 |
|
|---|
| 37 | #include <qpushbutton.h>
|
|---|
| 38 | #include <qpalette.h>
|
|---|
| 39 | #include <qlabel.h>
|
|---|
| 40 | #include <qgroupbox.h>
|
|---|
| 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 | // + ------- +
|
|---|
| 52 | // + Temp path +
|
|---|
| 53 | // + _______ +
|
|---|
| 54 | // + | select| ____________________ +
|
|---|
| 55 | // + ------- +
|
|---|
| 56 | // + +
|
|---|
| 57 | // + max number of frames ________ +
|
|---|
| 58 | // + .... +
|
|---|
| 59 | // + +
|
|---|
| 60 | // + Label : X frames Saves/Encoding +
|
|---|
| 61 | // + Cancel Encode +
|
|---|
| 62 | // +---------------------------------------+
|
|---|
| 63 |
|
|---|
| 64 | G4OpenGLQtMovieDialog::G4OpenGLQtMovieDialog(
|
|---|
| 65 | G4OpenGLQtViewer* parentViewer,
|
|---|
| 66 | QWidget* parentWidget
|
|---|
| 67 | )
|
|---|
| 68 | : QDialog( parentWidget ),
|
|---|
| 69 | fParentViewer(parentViewer)
|
|---|
| 70 | {
|
|---|
| 71 | #if QT_VERSION > 0x030200
|
|---|
| 72 | setModal(false);
|
|---|
| 73 | #endif
|
|---|
| 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 |
|
|---|
| 86 | // Encoder group box
|
|---|
| 87 | QGroupBox *encoderGroupBox = new QGroupBox(tr("Encoder path"),this);
|
|---|
| 88 | QVBoxLayout *encoderVGroupBoxLayout = new QVBoxLayout(encoderGroupBox);
|
|---|
| 89 |
|
|---|
| 90 | // Encoder Path
|
|---|
| 91 | QWidget *encoderHBox = new QWidget(encoderGroupBox);
|
|---|
| 92 | QHBoxLayout *encoderHBoxLayout = new QHBoxLayout(encoderHBox);
|
|---|
| 93 | fEncoderPath = new QLineEdit("",encoderHBox);
|
|---|
| 94 |
|
|---|
| 95 | QPushButton *encoderButton = new QPushButton(tr("..."),encoderHBox);
|
|---|
| 96 | encoderButton->setMaximumWidth (30);
|
|---|
| 97 |
|
|---|
| 98 | fEncoderStatus = new QLabel(encoderGroupBox);
|
|---|
| 99 |
|
|---|
| 100 | #if QT_VERSION > 0x040000
|
|---|
| 101 | fEncoderStatus->setWordWrap(true);
|
|---|
| 102 | encoderVGroupBoxLayout->setMargin(15);
|
|---|
| 103 | #else
|
|---|
| 104 | fEncoderStatus->setAlignment ( Qt::AlignAuto |Qt::WordBreak );
|
|---|
| 105 | encoderGroupBox->setInsideMargin(15);
|
|---|
| 106 | #endif
|
|---|
| 107 |
|
|---|
| 108 | fEncoderStatus->setText("");
|
|---|
| 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
|
|---|
| 118 | encoderHBoxLayout->addWidget(fEncoderPath);
|
|---|
| 119 | encoderHBoxLayout->addWidget(encoderButton);
|
|---|
| 120 | encoderVGroupBoxLayout->addWidget(encoderHBox);
|
|---|
| 121 | encoderVGroupBoxLayout->addWidget(fEncoderStatus);
|
|---|
| 122 |
|
|---|
| 123 | encoderGroupBox->setLayout(encoderVGroupBoxLayout);
|
|---|
| 124 | globalVLayout->addWidget(encoderGroupBox);
|
|---|
| 125 | #endif
|
|---|
| 126 |
|
|---|
| 127 | connect( encoderButton, SIGNAL( clicked( ) ), this, SLOT(selectEncoderPathAction() ) );
|
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 | // temp folder group box
|
|---|
| 131 | QGroupBox *tempFolderGroupBox = new QGroupBox(tr("Temporary folder path"),this);
|
|---|
| 132 | QVBoxLayout *tempFolderVGroupBoxLayout = new QVBoxLayout(tempFolderGroupBox);
|
|---|
| 133 |
|
|---|
| 134 | // temp folder Path
|
|---|
| 135 | QWidget *tempFolderHBox = new QWidget(tempFolderGroupBox);
|
|---|
| 136 | QHBoxLayout *tempFolderHBoxLayout = new QHBoxLayout(tempFolderHBox);
|
|---|
| 137 |
|
|---|
| 138 | fTempFolderPath = new QLineEdit("",tempFolderHBox);
|
|---|
| 139 |
|
|---|
| 140 | QPushButton *tempButton = new QPushButton(tr("..."),tempFolderHBox);
|
|---|
| 141 | tempButton->setMaximumWidth (30);
|
|---|
| 142 |
|
|---|
| 143 | fTempFolderStatus = new QLabel(tempFolderGroupBox);
|
|---|
| 144 | #if QT_VERSION > 0x040000
|
|---|
| 145 | fTempFolderStatus->setWordWrap(true);
|
|---|
| 146 | tempFolderVGroupBoxLayout->setMargin(15);
|
|---|
| 147 | #else
|
|---|
| 148 | fTempFolderStatus->setAlignment ( Qt::AlignAuto |Qt::WordBreak );
|
|---|
| 149 | tempFolderGroupBox->setInsideMargin(15);
|
|---|
| 150 | #endif
|
|---|
| 151 | fTempFolderStatus->setText("");
|
|---|
| 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
|
|---|
| 161 | tempFolderHBoxLayout->addWidget(fTempFolderPath);
|
|---|
| 162 | tempFolderHBoxLayout->addWidget(tempButton);
|
|---|
| 163 | tempFolderVGroupBoxLayout->addWidget(tempFolderHBox);
|
|---|
| 164 | tempFolderVGroupBoxLayout->addWidget(fTempFolderStatus);
|
|---|
| 165 |
|
|---|
| 166 | tempFolderGroupBox->setLayout(tempFolderVGroupBoxLayout);
|
|---|
| 167 | globalVLayout->addWidget(tempFolderGroupBox);
|
|---|
| 168 | #endif
|
|---|
| 169 |
|
|---|
| 170 | connect( tempButton, SIGNAL( clicked( ) ), this, SLOT(selectTempPathAction() ) );
|
|---|
| 171 |
|
|---|
| 172 |
|
|---|
| 173 |
|
|---|
| 174 |
|
|---|
| 175 | // save file group box
|
|---|
| 176 | QGroupBox *saveFileGroupBox = new QGroupBox(tr("Save as"),this);
|
|---|
| 177 | QVBoxLayout *saveFileVGroupBoxLayout = new QVBoxLayout(saveFileGroupBox);
|
|---|
| 178 |
|
|---|
| 179 | // save file
|
|---|
| 180 | QWidget *saveFileHBox = new QWidget(saveFileGroupBox);
|
|---|
| 181 | QHBoxLayout *saveFileHBoxLayout = new QHBoxLayout(saveFileHBox);
|
|---|
| 182 |
|
|---|
| 183 | fSaveFileName = new QLineEdit("G4Movie.mpeg",saveFileHBox);
|
|---|
| 184 |
|
|---|
| 185 | QPushButton *saveButton = new QPushButton(tr("..."),saveFileHBox);
|
|---|
| 186 | saveButton->setMaximumWidth (30);
|
|---|
| 187 |
|
|---|
| 188 | fSaveFileStatus = new QLabel(saveFileGroupBox);
|
|---|
| 189 | #if QT_VERSION > 0x040000
|
|---|
| 190 | fSaveFileStatus->setWordWrap(true);
|
|---|
| 191 | saveFileVGroupBoxLayout->setMargin(15);
|
|---|
| 192 | #else
|
|---|
| 193 | fSaveFileStatus->setAlignment ( Qt::AlignAuto |Qt::WordBreak );
|
|---|
| 194 | saveFileGroupBox->setInsideMargin(15);
|
|---|
| 195 | #endif
|
|---|
| 196 | fSaveFileStatus->setText("");
|
|---|
| 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
|
|---|
| 206 | saveFileHBoxLayout->addWidget(fSaveFileName);
|
|---|
| 207 | saveFileHBoxLayout->addWidget(saveButton);
|
|---|
| 208 | saveFileVGroupBoxLayout->addWidget(saveFileHBox);
|
|---|
| 209 | saveFileVGroupBoxLayout->addWidget(fSaveFileStatus);
|
|---|
| 210 |
|
|---|
| 211 | saveFileGroupBox->setLayout(saveFileVGroupBoxLayout);
|
|---|
| 212 | globalVLayout->addWidget(saveFileGroupBox);
|
|---|
| 213 | #endif
|
|---|
| 214 |
|
|---|
| 215 | connect( saveButton, SIGNAL( clicked( ) ), this, SLOT(selectSaveFileNameAction() ) );
|
|---|
| 216 |
|
|---|
| 217 |
|
|---|
| 218 |
|
|---|
| 219 | // label
|
|---|
| 220 |
|
|---|
| 221 | QLabel *infoLabel = new QLabel(" Press SPACE to Start/Pause video recording \n Press RETURN to Stop video recording",this);
|
|---|
| 222 |
|
|---|
| 223 | // global status
|
|---|
| 224 | QGroupBox *statusGroupBox = new QGroupBox(tr("Status"),this);
|
|---|
| 225 | QVBoxLayout *statusVGroupBoxLayout = new QVBoxLayout(statusGroupBox);
|
|---|
| 226 |
|
|---|
| 227 | fRecordingStatus = new QLabel(statusGroupBox);
|
|---|
| 228 | #if QT_VERSION > 0x040000
|
|---|
| 229 | statusVGroupBoxLayout->setMargin(15);
|
|---|
| 230 | fRecordingStatus->setWordWrap(true);
|
|---|
| 231 | #else
|
|---|
| 232 | statusGroupBox->setInsideMargin(15);
|
|---|
| 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);
|
|---|
| 242 |
|
|---|
| 243 | fRecordingInfos = new QLabel(statusGroupBox);
|
|---|
| 244 | #if QT_VERSION > 0x040000
|
|---|
| 245 | fRecordingInfos->setWordWrap(true);
|
|---|
| 246 | #else
|
|---|
| 247 | fRecordingInfos->setAlignment ( Qt::AlignAuto |Qt::WordBreak );
|
|---|
| 248 | #endif
|
|---|
| 249 | setRecordingInfos("");
|
|---|
| 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
|
|---|
| 258 | statusVGroupBoxLayout->addWidget(fRecordingStatus);
|
|---|
| 259 | statusVGroupBoxLayout->addWidget(fRecordingInfos);
|
|---|
| 260 |
|
|---|
| 261 | statusGroupBox->setLayout(statusVGroupBoxLayout);
|
|---|
| 262 | globalVLayout->addWidget(infoLabel);
|
|---|
| 263 | globalVLayout->addWidget(statusGroupBox);
|
|---|
| 264 | #endif
|
|---|
| 265 |
|
|---|
| 266 | // buttons
|
|---|
| 267 | QWidget *buttonBox = new QWidget(this);
|
|---|
| 268 |
|
|---|
| 269 | QHBoxLayout *buttonBoxLayout = new QHBoxLayout(buttonBox);
|
|---|
| 270 |
|
|---|
| 271 | QPushButton *buttonReset = new QPushButton( tr( "&Reset" ),buttonBox );
|
|---|
| 272 | buttonReset->setAutoDefault( TRUE );
|
|---|
| 273 | buttonBoxLayout->addWidget(buttonReset);
|
|---|
| 274 |
|
|---|
| 275 | fButtonStartPause = new QPushButton( tr( " &Start " ),buttonBox );
|
|---|
| 276 | fButtonStartPause->setEnabled(true);
|
|---|
| 277 | fButtonStartPause->setAutoDefault( TRUE );
|
|---|
| 278 | buttonBoxLayout->addWidget(fButtonStartPause);
|
|---|
| 279 |
|
|---|
| 280 | fButtonStopFinishClose = new QPushButton( tr( "&Stop" ),buttonBox );
|
|---|
| 281 | fButtonStopFinishClose->setEnabled(false);
|
|---|
| 282 | fButtonStopFinishClose->setAutoDefault( TRUE );
|
|---|
| 283 | buttonBoxLayout->addWidget(fButtonStopFinishClose);
|
|---|
| 284 |
|
|---|
| 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 |
|
|---|
| 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
|
|---|
| 306 | connect( fButtonStartPause, SIGNAL( clicked() ), fParentViewer, SLOT( startPauseVideo() ) );
|
|---|
| 307 | connect( buttonReset, SIGNAL( clicked() ), this, SLOT( resetRecording() ) );
|
|---|
| 308 | connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
|
|---|
| 309 | connect( fButtonStopFinishClose, SIGNAL( clicked() ), this, SLOT( stopFinishClose() ) );
|
|---|
| 310 | connect( fButtonSave, SIGNAL( clicked() ), this, SLOT( save() ) );
|
|---|
| 311 |
|
|---|
| 312 | // fill
|
|---|
| 313 | setRecordingStatus("");
|
|---|
| 314 | fEncoderPath->setText(fParentViewer->getEncoderPath());
|
|---|
| 315 | fTempFolderPath->setText(fParentViewer->getTempFolderPath());
|
|---|
| 316 |
|
|---|
| 317 | // connect line edit signals
|
|---|
| 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()));
|
|---|
| 321 |
|
|---|
| 322 | #if QT_VERSION >= 0x040000
|
|---|
| 323 | connect (fEncoderPath,SIGNAL(editingFinished ()),this,SLOT(checkEncoderSwParameters()));
|
|---|
| 324 | connect (fTempFolderPath,SIGNAL(editingFinished ()),this,SLOT(checkTempFolderParameters()));
|
|---|
| 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
|
|---|
| 331 |
|
|---|
| 332 | }
|
|---|
| 333 |
|
|---|
| 334 |
|
|---|
| 335 |
|
|---|
| 336 | G4OpenGLQtMovieDialog::~G4OpenGLQtMovieDialog()
|
|---|
| 337 | {
|
|---|
| 338 | }
|
|---|
| 339 |
|
|---|
| 340 | void G4OpenGLQtMovieDialog::selectEncoderPathAction()
|
|---|
| 341 | {
|
|---|
| 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
|
|---|
| 349 | QString nomFich = QFileDialog::getOpenFileName ( this,
|
|---|
| 350 | "Select your encoder",
|
|---|
| 351 | tr("Select your encoder ..."));
|
|---|
| 352 |
|
|---|
| 353 | #endif
|
|---|
| 354 |
|
|---|
| 355 | if (nomFich == "") {
|
|---|
| 356 | return;
|
|---|
| 357 | }
|
|---|
| 358 | fEncoderPath->setText(nomFich);
|
|---|
| 359 | checkEncoderSwParameters();
|
|---|
| 360 | }
|
|---|
| 361 |
|
|---|
| 362 |
|
|---|
| 363 | void G4OpenGLQtMovieDialog::selectTempPathAction()
|
|---|
| 364 | {
|
|---|
| 365 | #if QT_VERSION < 0x040000
|
|---|
| 366 | QString nomFich = QFileDialog::getExistingDirectory (NULL,
|
|---|
| 367 | this,
|
|---|
| 368 | "Select temporary folder",
|
|---|
| 369 | tr("Select temporary folder ..."));
|
|---|
| 370 | #else
|
|---|
| 371 | QString nomFich = QFileDialog::getExistingDirectory ( this,
|
|---|
| 372 | "Select temporary folder",
|
|---|
| 373 | tr("Select temporary folder ..."));
|
|---|
| 374 |
|
|---|
| 375 | #endif
|
|---|
| 376 | if (nomFich == "") {
|
|---|
| 377 | return;
|
|---|
| 378 | }
|
|---|
| 379 | fTempFolderPath->setText(nomFich);
|
|---|
| 380 | checkTempFolderParameters();
|
|---|
| 381 | }
|
|---|
| 382 |
|
|---|
| 383 |
|
|---|
| 384 | void G4OpenGLQtMovieDialog::selectSaveFileNameAction()
|
|---|
| 385 | {
|
|---|
| 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
|
|---|
| 393 | QString nomFich = QFileDialog::getSaveFileName ( this,
|
|---|
| 394 | "Select saved file",
|
|---|
| 395 | tr("Select saved file ..."));
|
|---|
| 396 |
|
|---|
| 397 | #endif
|
|---|
| 398 | if (nomFich == "") {
|
|---|
| 399 | return;
|
|---|
| 400 | }
|
|---|
| 401 | fSaveFileName->setText(nomFich);
|
|---|
| 402 | checkSaveFileNameParameters();
|
|---|
| 403 | }
|
|---|
| 404 |
|
|---|
| 405 |
|
|---|
| 406 | void G4OpenGLQtMovieDialog::stopFinishClose() {
|
|---|
| 407 | fParentViewer->stopVideo();
|
|---|
| 408 | }
|
|---|
| 409 |
|
|---|
| 410 | void G4OpenGLQtMovieDialog::save() {
|
|---|
| 411 | if (((fParentViewer->isPaused()) || fParentViewer->isRecording() || fParentViewer->isStopped())) {
|
|---|
| 412 | fParentViewer->saveVideo();
|
|---|
| 413 | }
|
|---|
| 414 | }
|
|---|
| 415 |
|
|---|
| 416 | /**
|
|---|
| 417 | * If one of parameter is incorrect, put it in red and don't valid it
|
|---|
| 418 | * If valid, save it
|
|---|
| 419 | */
|
|---|
| 420 | bool G4OpenGLQtMovieDialog::checkEncoderSwParameters() {
|
|---|
| 421 |
|
|---|
| 422 | bool status = true;
|
|---|
| 423 | QPalette palette( fEncoderPath->palette() );
|
|---|
| 424 |
|
|---|
| 425 | QString temp = fParentViewer->setEncoderPath(fEncoderPath->text());
|
|---|
| 426 | setRecordingInfos("");
|
|---|
| 427 | fEncoderStatus->setText(temp);
|
|---|
| 428 | if (temp != "") {
|
|---|
| 429 | #if QT_VERSION > 0x040000
|
|---|
| 430 | palette.setColor( QPalette::Base, Qt::red);
|
|---|
| 431 | #else
|
|---|
| 432 | palette.setColor( QColorGroup::Base, Qt::red);
|
|---|
| 433 | #endif
|
|---|
| 434 | if (fParentViewer->isReadyToEncode()) {
|
|---|
| 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");
|
|---|
| 436 | }
|
|---|
| 437 | status = false;
|
|---|
| 438 | } else {
|
|---|
| 439 | #if QT_VERSION > 0x040000
|
|---|
| 440 | palette.setColor( QPalette::Base, Qt::white);
|
|---|
| 441 | #else
|
|---|
| 442 | palette.setColor( QColorGroup::Base, Qt::white);
|
|---|
| 443 | #endif
|
|---|
| 444 | fEncoderPath->setText(fParentViewer->getEncoderPath());
|
|---|
| 445 | }
|
|---|
| 446 | fEncoderPath->setPalette(palette);
|
|---|
| 447 | return status;
|
|---|
| 448 | }
|
|---|
| 449 |
|
|---|
| 450 |
|
|---|
| 451 | /**
|
|---|
| 452 | * If one of parameter is incorrect, put it in red and don't valid it
|
|---|
| 453 | * If valid, save it
|
|---|
| 454 | */
|
|---|
| 455 | bool G4OpenGLQtMovieDialog::checkTempFolderParameters() {
|
|---|
| 456 |
|
|---|
| 457 | bool status = true;
|
|---|
| 458 | QPalette palette( fTempFolderPath->palette() );
|
|---|
| 459 |
|
|---|
| 460 | QString temp = fParentViewer->setTempFolderPath(fTempFolderPath->text());
|
|---|
| 461 | fTempFolderStatus->setText(temp);
|
|---|
| 462 | if (temp != "") {
|
|---|
| 463 | #if QT_VERSION > 0x040000
|
|---|
| 464 | palette.setColor( QPalette::Base, Qt::red);
|
|---|
| 465 | #else
|
|---|
| 466 | palette.setColor( QColorGroup::Base, Qt::red);
|
|---|
| 467 | #endif
|
|---|
| 468 | status = false;
|
|---|
| 469 | } else {
|
|---|
| 470 | #if QT_VERSION > 0x040000
|
|---|
| 471 | palette.setColor( QPalette::Base, Qt::white);
|
|---|
| 472 | #else
|
|---|
| 473 | palette.setColor( QColorGroup::Base, Qt::white);
|
|---|
| 474 | #endif
|
|---|
| 475 | fTempFolderPath->setText(fParentViewer->getTempFolderPath());
|
|---|
| 476 | }
|
|---|
| 477 | fTempFolderPath->setPalette(palette);
|
|---|
| 478 | return status;
|
|---|
| 479 | }
|
|---|
| 480 |
|
|---|
| 481 |
|
|---|
| 482 | /**
|
|---|
| 483 | * If one of parameter is incorrect, put it in red and don't valid it
|
|---|
| 484 | * If valid, save it
|
|---|
| 485 | */
|
|---|
| 486 | bool G4OpenGLQtMovieDialog::checkSaveFileNameParameters() {
|
|---|
| 487 |
|
|---|
| 488 | bool status = true;
|
|---|
| 489 | QPalette palette( fSaveFileName->palette() );
|
|---|
| 490 |
|
|---|
| 491 | QString temp = fParentViewer->setSaveFileName(fSaveFileName->text());
|
|---|
| 492 | fSaveFileStatus->setText(temp);
|
|---|
| 493 | if (temp != "") {
|
|---|
| 494 | #if QT_VERSION > 0x040000
|
|---|
| 495 | palette.setColor( QPalette::Base, Qt::red);
|
|---|
| 496 | #else
|
|---|
| 497 | palette.setColor( QColorGroup::Base, Qt::red);
|
|---|
| 498 | #endif
|
|---|
| 499 | status = false;
|
|---|
| 500 | } else {
|
|---|
| 501 | #if QT_VERSION > 0x040000
|
|---|
| 502 | palette.setColor( QPalette::Base, Qt::white);
|
|---|
| 503 | #else
|
|---|
| 504 | palette.setColor( QColorGroup::Base, Qt::white);
|
|---|
| 505 | #endif
|
|---|
| 506 | fSaveFileName->setText(fParentViewer->getSaveFileName());
|
|---|
| 507 | }
|
|---|
| 508 | fSaveFileName->setPalette(palette);
|
|---|
| 509 | return status;
|
|---|
| 510 | }
|
|---|
| 511 |
|
|---|
| 512 |
|
|---|
| 513 | void G4OpenGLQtMovieDialog::resetRecording() {
|
|---|
| 514 | fParentViewer->resetRecording();
|
|---|
| 515 | }
|
|---|
| 516 |
|
|---|
| 517 |
|
|---|
| 518 | void G4OpenGLQtMovieDialog::setRecordingStatus(QString txt) {
|
|---|
| 519 | fRecordingStatus->setText(txt);
|
|---|
| 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 | }
|
|---|
| 582 | }
|
|---|
| 583 |
|
|---|
| 584 |
|
|---|
| 585 | void G4OpenGLQtMovieDialog::setRecordingInfos(QString txt) {
|
|---|
| 586 | fRecordingInfos->setText(txt);
|
|---|
| 587 | }
|
|---|
| 588 |
|
|---|
| 589 |
|
|---|
| 590 | void G4OpenGLQtMovieDialog::enabledApplyButton() {
|
|---|
| 591 | fButtonStartPause->setEnabled(true);
|
|---|
| 592 | }
|
|---|
| 593 |
|
|---|
| 594 | #endif
|
|---|