| 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.6 2008/02/15 10:54:13 lgarnier Exp $
|
|---|
| 28 | // GEANT4 tag $Name: $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 |
|
|---|
| 32 | #define GEANT4_QT_DEBUG
|
|---|
| 33 | #ifdef G4VIS_BUILD_OPENGLQT_DRIVER
|
|---|
| 34 |
|
|---|
| 35 | #include "G4OpenGLQtMovieDialog.hh"
|
|---|
| 36 | #include "G4OpenGLQtViewer.hh"
|
|---|
| 37 |
|
|---|
| 38 | // #include <qvariant.h>
|
|---|
| 39 | #include <qpushbutton.h>
|
|---|
| 40 | // #include <qcheckbox.h>
|
|---|
| 41 | #include <qlabel.h>
|
|---|
| 42 | // #include <qcombobox.h>
|
|---|
| 43 | // #include <qslider.h>
|
|---|
| 44 | #include <qlayout.h>
|
|---|
| 45 | // #include <qgroupbox.h>
|
|---|
| 46 | // #include <qradiobutton.h>
|
|---|
| 47 | // #include <qimage.h>
|
|---|
| 48 | #include <qlineedit.h>
|
|---|
| 49 | #include <qfiledialog.h>
|
|---|
| 50 | #include <qprocess.h>
|
|---|
| 51 |
|
|---|
| 52 | // #include <qbuttongroup.h>
|
|---|
| 53 |
|
|---|
| 54 | // +---------------------------------------+
|
|---|
| 55 | // + Path for encoder +
|
|---|
| 56 | // + _______ +
|
|---|
| 57 | // + | select| ____________________ +
|
|---|
| 58 | // + ------- +
|
|---|
| 59 | // + +
|
|---|
| 60 | // + max number of frames ________ +
|
|---|
| 61 | // + .... +
|
|---|
| 62 | // + +
|
|---|
| 63 | // + Label : X frames Saves/Encoding +
|
|---|
| 64 | // + Cancel Encode +
|
|---|
| 65 | // +---------------------------------------+
|
|---|
| 66 |
|
|---|
| 67 | G4OpenGLQtMovieDialog::G4OpenGLQtMovieDialog(
|
|---|
| 68 | QWidget* parent
|
|---|
| 69 | )
|
|---|
| 70 | : QDialog( parent ),
|
|---|
| 71 | fParent(parent)
|
|---|
| 72 | {
|
|---|
| 73 | setModal(false);
|
|---|
| 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 | QLabel *pathLabel = new QLabel("Select path for encoder :");
|
|---|
| 87 |
|
|---|
| 88 | #if QT_VERSION < 0x040000
|
|---|
| 89 | globalVLayout->add(pathLabel);
|
|---|
| 90 | #else
|
|---|
| 91 | globalVLayout->addWidget(pathLabel);
|
|---|
| 92 | #endif
|
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 |
|
|---|
| 96 | // width
|
|---|
| 97 | QWidget *selectPathWidget = new QWidget(this);
|
|---|
| 98 |
|
|---|
| 99 | QHBoxLayout *selectPathLineLayout = new QHBoxLayout(selectPathWidget);
|
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 | fSelectPath = new QLineEdit("",selectPathWidget);
|
|---|
| 103 | #if QT_VERSION < 0x040000
|
|---|
| 104 | selectPathLineLayout->add(fSelectPath);
|
|---|
| 105 | #else
|
|---|
| 106 | selectPathLineLayout->addWidget(fSelectPath);
|
|---|
| 107 | #endif
|
|---|
| 108 |
|
|---|
| 109 | QPushButton *pathButton = new QPushButton(tr("..."),selectPathWidget);
|
|---|
| 110 |
|
|---|
| 111 | #if QT_VERSION < 0x040000
|
|---|
| 112 | selectPathLineLayout->add(pathButton);
|
|---|
| 113 | #else
|
|---|
| 114 | selectPathLineLayout->addWidget(pathButton);
|
|---|
| 115 | #endif
|
|---|
| 116 |
|
|---|
| 117 | #if QT_VERSION >= 0x040000
|
|---|
| 118 | selectPathWidget->setLayout(selectPathLineLayout);
|
|---|
| 119 | #endif
|
|---|
| 120 | connect( pathButton, SIGNAL( clicked( ) ), this, SLOT(selectPathAction() ) );
|
|---|
| 121 |
|
|---|
| 122 | #if QT_VERSION < 0x040000
|
|---|
| 123 | globalVLayout->add(selectPathWidget);
|
|---|
| 124 | #else
|
|---|
| 125 | globalVLayout->addWidget(selectPathWidget);
|
|---|
| 126 | #endif
|
|---|
| 127 |
|
|---|
| 128 | fSelectPath->setText(((G4OpenGLQtViewer*)fParent)->getEncoderPath());
|
|---|
| 129 |
|
|---|
| 130 | QLabel *infoLabel = new QLabel(" Press SPACE to Start/Pause video recording \n Press RETURN to Stop video recording");
|
|---|
| 131 |
|
|---|
| 132 | #if QT_VERSION < 0x040000
|
|---|
| 133 | globalVLayout->add(infoLabel);
|
|---|
| 134 | #else
|
|---|
| 135 | globalVLayout->addWidget(infoLabel);
|
|---|
| 136 | #endif
|
|---|
| 137 |
|
|---|
| 138 | QWidget *buttonBox = new QWidget(this);
|
|---|
| 139 |
|
|---|
| 140 | QHBoxLayout *buttonBoxLayout = new QHBoxLayout(buttonBox);
|
|---|
| 141 |
|
|---|
| 142 |
|
|---|
| 143 | QPushButton * buttonEncode = new QPushButton( tr( "&Apply" ),buttonBox );
|
|---|
| 144 | buttonEncode->setAutoDefault( TRUE );
|
|---|
| 145 | buttonEncode->setDefault( TRUE );
|
|---|
| 146 | buttonBoxLayout->addWidget(buttonEncode);
|
|---|
| 147 |
|
|---|
| 148 | QPushButton *buttonCancel = new QPushButton( tr( "&Cancel" ),buttonBox );
|
|---|
| 149 | buttonCancel->setAutoDefault( TRUE );
|
|---|
| 150 | buttonBoxLayout->addWidget(buttonCancel);
|
|---|
| 151 |
|
|---|
| 152 | #if QT_VERSION >= 0x040000
|
|---|
| 153 | buttonBox->setLayout(buttonBoxLayout);
|
|---|
| 154 | #endif
|
|---|
| 155 | globalVLayout->addWidget(buttonBox);
|
|---|
| 156 |
|
|---|
| 157 |
|
|---|
| 158 |
|
|---|
| 159 | #if QT_VERSION >= 0x040000
|
|---|
| 160 | setLayout(globalVLayout);
|
|---|
| 161 | #endif
|
|---|
| 162 |
|
|---|
| 163 | // signals and slots connections
|
|---|
| 164 | connect( buttonEncode, SIGNAL( clicked() ), this, SLOT( accept() ) );
|
|---|
| 165 | connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
|
|---|
| 166 | }
|
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 | G4OpenGLQtMovieDialog::~G4OpenGLQtMovieDialog()
|
|---|
| 171 | {
|
|---|
| 172 | }
|
|---|
| 173 |
|
|---|
| 174 | void G4OpenGLQtMovieDialog::selectPathAction()
|
|---|
| 175 | {
|
|---|
| 176 | QString nomFich = QFileDialog::getOpenFileName ( this,
|
|---|
| 177 | "Select your encoder",
|
|---|
| 178 | tr("Select your encoder ..."));
|
|---|
| 179 | if (nomFich == "") {
|
|---|
| 180 | return;
|
|---|
| 181 | }
|
|---|
| 182 | fSelectPath->setText(nomFich);
|
|---|
| 183 | }
|
|---|
| 184 |
|
|---|
| 185 |
|
|---|
| 186 | #endif
|
|---|