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 | G4OpenGLQtViewer* parentViewer, |
---|
69 | QWidget* parentWidget |
---|
70 | ) |
---|
71 | : QDialog( parentWidget ), |
---|
72 | fParentViewer(parentViewer) |
---|
73 | { |
---|
74 | setModal(false); |
---|
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 | |
---|
87 | QLabel *pathLabel = new QLabel("Select path for encoder :"); |
---|
88 | |
---|
89 | #if QT_VERSION < 0x040000 |
---|
90 | globalVLayout->add(pathLabel); |
---|
91 | #else |
---|
92 | globalVLayout->addWidget(pathLabel); |
---|
93 | #endif |
---|
94 | |
---|
95 | |
---|
96 | |
---|
97 | // width |
---|
98 | QWidget *selectPathWidget = new QWidget(this); |
---|
99 | |
---|
100 | QHBoxLayout *selectPathLineLayout = new QHBoxLayout(selectPathWidget); |
---|
101 | |
---|
102 | |
---|
103 | fSelectPath = new QLineEdit("",selectPathWidget); |
---|
104 | #if QT_VERSION < 0x040000 |
---|
105 | selectPathLineLayout->add(fSelectPath); |
---|
106 | #else |
---|
107 | selectPathLineLayout->addWidget(fSelectPath); |
---|
108 | #endif |
---|
109 | |
---|
110 | QPushButton *pathButton = new QPushButton(tr("..."),selectPathWidget); |
---|
111 | |
---|
112 | #if QT_VERSION < 0x040000 |
---|
113 | selectPathLineLayout->add(pathButton); |
---|
114 | #else |
---|
115 | selectPathLineLayout->addWidget(pathButton); |
---|
116 | #endif |
---|
117 | |
---|
118 | #if QT_VERSION >= 0x040000 |
---|
119 | selectPathWidget->setLayout(selectPathLineLayout); |
---|
120 | #endif |
---|
121 | connect( pathButton, SIGNAL( clicked( ) ), this, SLOT(selectPathAction() ) ); |
---|
122 | |
---|
123 | #if QT_VERSION < 0x040000 |
---|
124 | globalVLayout->add(selectPathWidget); |
---|
125 | #else |
---|
126 | globalVLayout->addWidget(selectPathWidget); |
---|
127 | #endif |
---|
128 | |
---|
129 | fSelectPath->setText(fParentViewer->getEncoderPath()); |
---|
130 | |
---|
131 | QLabel *infoLabel = new QLabel(" Press SPACE to Start/Pause video recording \n Press RETURN to Stop video recording"); |
---|
132 | |
---|
133 | #if QT_VERSION < 0x040000 |
---|
134 | globalVLayout->add(infoLabel); |
---|
135 | #else |
---|
136 | globalVLayout->addWidget(infoLabel); |
---|
137 | #endif |
---|
138 | |
---|
139 | QWidget *buttonBox = new QWidget(this); |
---|
140 | |
---|
141 | QHBoxLayout *buttonBoxLayout = new QHBoxLayout(buttonBox); |
---|
142 | |
---|
143 | |
---|
144 | QPushButton * buttonEncode = new QPushButton( tr( "&Apply" ),buttonBox ); |
---|
145 | buttonEncode->setAutoDefault( TRUE ); |
---|
146 | buttonEncode->setDefault( TRUE ); |
---|
147 | buttonBoxLayout->addWidget(buttonEncode); |
---|
148 | |
---|
149 | QPushButton *buttonCancel = new QPushButton( tr( "&Cancel" ),buttonBox ); |
---|
150 | buttonCancel->setAutoDefault( TRUE ); |
---|
151 | buttonBoxLayout->addWidget(buttonCancel); |
---|
152 | |
---|
153 | #if QT_VERSION >= 0x040000 |
---|
154 | buttonBox->setLayout(buttonBoxLayout); |
---|
155 | #endif |
---|
156 | globalVLayout->addWidget(buttonBox); |
---|
157 | |
---|
158 | |
---|
159 | |
---|
160 | #if QT_VERSION >= 0x040000 |
---|
161 | setLayout(globalVLayout); |
---|
162 | #endif |
---|
163 | |
---|
164 | // signals and slots connections |
---|
165 | connect( buttonEncode, SIGNAL( clicked() ), this, SLOT( accept() ) ); |
---|
166 | connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); |
---|
167 | } |
---|
168 | |
---|
169 | |
---|
170 | |
---|
171 | G4OpenGLQtMovieDialog::~G4OpenGLQtMovieDialog() |
---|
172 | { |
---|
173 | } |
---|
174 | |
---|
175 | void G4OpenGLQtMovieDialog::selectPathAction() |
---|
176 | { |
---|
177 | QString nomFich = QFileDialog::getOpenFileName ( this, |
---|
178 | "Select your encoder", |
---|
179 | tr("Select your encoder ...")); |
---|
180 | if (nomFich == "") { |
---|
181 | return; |
---|
182 | } |
---|
183 | fSelectPath->setText(nomFich); |
---|
184 | } |
---|
185 | |
---|
186 | |
---|
187 | #endif |
---|