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