Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4OpenGLQtMovieDialog Class Reference

#include <G4OpenGLQtMovieDialog.hh>

+ Inheritance diagram for G4OpenGLQtMovieDialog:

Public Slots

void stopFinishClose ()
 
void save ()
 
bool checkEncoderSwParameters ()
 
bool checkSaveFileNameParameters ()
 
bool checkTempFolderParameters ()
 

Public Member Functions

 G4OpenGLQtMovieDialog (G4OpenGLQtViewer *, QWidget *)
 
 ~G4OpenGLQtMovieDialog ()
 
void setRecordingStatus (QString)
 
void setRecordingInfos (QString)
 

Detailed Description

The G4OpenGLQtMovieDialog class provide a Dialog displaying differents options for each file format

Definition at line 45 of file G4OpenGLQtMovieDialog.hh.

Constructor & Destructor Documentation

◆ G4OpenGLQtMovieDialog()

G4OpenGLQtMovieDialog::G4OpenGLQtMovieDialog ( G4OpenGLQtViewer * parentViewer,
QWidget * parentw )

Construct a G4OpenGLQtMovieDialog

Parameters
parent: parent widget

Definition at line 64 of file G4OpenGLQtMovieDialog.cc.

68 : QDialog( parentw ),
69 fParentViewer(parentViewer)
70{
71 setModal(false);
72 setWindowTitle( tr( " Save as movie" ));
73
74
75 // global layout
76 QVBoxLayout* globalVLayout = new QVBoxLayout(this);
77 globalVLayout->setContentsMargins(10,10,10,10);
78 globalVLayout->setSpacing(10);
79
80 // Encoder group box
81 QGroupBox *encoderGroupBox = new QGroupBox(tr("Encoder path"),this);
82 QVBoxLayout *encoderVGroupBoxLayout = new QVBoxLayout(encoderGroupBox);
83
84 // Encoder Path
85 QWidget *encoderHBox = new QWidget(encoderGroupBox);
86 QHBoxLayout *encoderHBoxLayout = new QHBoxLayout(encoderHBox);
87 fEncoderPath = new QLineEdit("",encoderHBox);
88
89 QPushButton *encoderButton = new QPushButton(tr("..."),encoderHBox);
90 encoderButton->setMaximumWidth (30);
91
92 fEncoderStatus = new QLabel(encoderGroupBox);
93
94 fEncoderStatus->setWordWrap(true);
95 encoderVGroupBoxLayout->setContentsMargins(15,15,15,15);
96
97 fEncoderStatus->setText("");
98
99 encoderHBoxLayout->addWidget(fEncoderPath);
100 encoderHBoxLayout->addWidget(encoderButton);
101 encoderVGroupBoxLayout->addWidget(encoderHBox);
102 encoderVGroupBoxLayout->addWidget(fEncoderStatus);
103
104 encoderGroupBox->setLayout(encoderVGroupBoxLayout);
105 globalVLayout->addWidget(encoderGroupBox);
106
107 connect( encoderButton, SIGNAL( clicked( ) ), this, SLOT(selectEncoderPathAction() ) );
108
109
110 // temp folder group box
111 QGroupBox *tempFolderGroupBox = new QGroupBox(tr("Temporary folder path"),this);
112 QVBoxLayout *tempFolderVGroupBoxLayout = new QVBoxLayout(tempFolderGroupBox);
113
114 // temp folder Path
115 QWidget *tempFolderHBox = new QWidget(tempFolderGroupBox);
116 QHBoxLayout *tempFolderHBoxLayout = new QHBoxLayout(tempFolderHBox);
117
118 fTempFolderPath = new QLineEdit("",tempFolderHBox);
119
120 QPushButton *tempButton = new QPushButton(tr("..."),tempFolderHBox);
121 tempButton->setMaximumWidth (30);
122
123 fTempFolderStatus = new QLabel(tempFolderGroupBox);
124 fTempFolderStatus->setWordWrap(true);
125 tempFolderVGroupBoxLayout->setContentsMargins(15,15,15,15);
126 fTempFolderStatus->setText("");
127
128 tempFolderHBoxLayout->addWidget(fTempFolderPath);
129 tempFolderHBoxLayout->addWidget(tempButton);
130 tempFolderVGroupBoxLayout->addWidget(tempFolderHBox);
131 tempFolderVGroupBoxLayout->addWidget(fTempFolderStatus);
132
133 tempFolderGroupBox->setLayout(tempFolderVGroupBoxLayout);
134 globalVLayout->addWidget(tempFolderGroupBox);
135
136 connect( tempButton, SIGNAL( clicked( ) ), this, SLOT(selectTempPathAction() ) );
137
138
139
140
141 // save file group box
142 QGroupBox *saveFileGroupBox = new QGroupBox(tr("Save as"),this);
143 QVBoxLayout *saveFileVGroupBoxLayout = new QVBoxLayout(saveFileGroupBox);
144
145 // save file
146 QWidget *saveFileHBox = new QWidget(saveFileGroupBox);
147 QHBoxLayout *saveFileHBoxLayout = new QHBoxLayout(saveFileHBox);
148
149 fSaveFileName = new QLineEdit("G4Movie.mpeg",saveFileHBox);
150
151 QPushButton *saveButton = new QPushButton(tr("..."),saveFileHBox);
152 saveButton->setMaximumWidth (30);
153
154 fSaveFileStatus = new QLabel(saveFileGroupBox);
155 fSaveFileStatus->setWordWrap(true);
156 saveFileVGroupBoxLayout->setContentsMargins(15,15,15,15);
157 fSaveFileStatus->setText("");
158
159 saveFileHBoxLayout->addWidget(fSaveFileName);
160 saveFileHBoxLayout->addWidget(saveButton);
161 saveFileVGroupBoxLayout->addWidget(saveFileHBox);
162 saveFileVGroupBoxLayout->addWidget(fSaveFileStatus);
163
164 saveFileGroupBox->setLayout(saveFileVGroupBoxLayout);
165 globalVLayout->addWidget(saveFileGroupBox);
166
167 connect( saveButton, SIGNAL( clicked( ) ), this, SLOT(selectSaveFileNameAction() ) );
168
169
170
171 // label
172
173 QLabel *infoLabel = new QLabel(" Press SPACE to Start/Pause video recording \n Press RETURN to Stop video recording",this);
174
175 // global status
176 QGroupBox *statusGroupBox = new QGroupBox(tr("Status"),this);
177 QVBoxLayout *statusVGroupBoxLayout = new QVBoxLayout(statusGroupBox);
178
179 fRecordingStatus = new QLabel(statusGroupBox);
180 statusVGroupBoxLayout->setContentsMargins(15,15,15,15);
181 fRecordingStatus->setWordWrap(true);
182 QPalette mypalette( fRecordingStatus->palette() );
183 mypalette.setColor( QPalette::Text, Qt::green);
184 fRecordingStatus->setPalette(mypalette);
185
186 fRecordingInfos = new QLabel(statusGroupBox);
187 fRecordingInfos->setWordWrap(true);
189
190 statusVGroupBoxLayout->addWidget(fRecordingStatus);
191 statusVGroupBoxLayout->addWidget(fRecordingInfos);
192
193 statusGroupBox->setLayout(statusVGroupBoxLayout);
194 globalVLayout->addWidget(infoLabel);
195 globalVLayout->addWidget(statusGroupBox);
196
197 // buttons
198 QWidget *buttonBox = new QWidget(this);
199
200 QHBoxLayout *buttonBoxLayout = new QHBoxLayout(buttonBox);
201
202 QPushButton *buttonReset = new QPushButton( tr( "&Reset" ),buttonBox );
203 buttonReset->setAutoDefault( TRUE );
204 buttonBoxLayout->addWidget(buttonReset);
205
206 fButtonStartPause = new QPushButton( tr( " &Start " ),buttonBox );
207 fButtonStartPause->setEnabled(true);
208 fButtonStartPause->setAutoDefault( TRUE );
209 buttonBoxLayout->addWidget(fButtonStartPause);
210
211 fButtonStopFinishClose = new QPushButton( tr( "&Stop" ),buttonBox );
212 fButtonStopFinishClose->setEnabled(false);
213 fButtonStopFinishClose->setAutoDefault( TRUE );
214 buttonBoxLayout->addWidget(fButtonStopFinishClose);
215
216 fButtonSave = new QPushButton( tr( "&Save" ),buttonBox );
217 fButtonSave->setEnabled(false);
218 fButtonSave->setAutoDefault( TRUE );
219 buttonBoxLayout->addWidget(fButtonSave);
220
221 QPushButton *buttonCancel = new QPushButton( tr( "&Cancel" ),buttonBox );
222 buttonCancel->setAutoDefault( TRUE );
223 buttonBoxLayout->addWidget(buttonCancel);
224
225 buttonBox->setLayout(buttonBoxLayout);
226 globalVLayout->addWidget(buttonBox);
227
228
229
230 setLayout(globalVLayout);
231
232 // signals and slots connections
233 connect( fButtonStartPause, SIGNAL( clicked() ), fParentViewer, SLOT( startPauseVideo() ) );
234 connect( buttonReset, SIGNAL( clicked() ), this, SLOT( resetRecording() ) );
235 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
236 connect( fButtonStopFinishClose, SIGNAL( clicked() ), this, SLOT( stopFinishClose() ) );
237 connect( fButtonSave, SIGNAL( clicked() ), this, SLOT( save() ) );
238
239 // fill
241 fEncoderPath->setText(fParentViewer->getEncoderPath());
242 fTempFolderPath->setText(fParentViewer->getTempFolderPath());
243
244 // connect line edit signals
245 connect (fEncoderPath,SIGNAL(textChanged ( const QString&)),this,SLOT(checkEncoderSwParameters()));
246 connect (fTempFolderPath,SIGNAL(textChanged ( const QString&)),this,SLOT(checkTempFolderParameters()));
247 connect (fSaveFileName,SIGNAL(textChanged ( const QString&)),this,SLOT(checkSaveFileNameParameters()));
248
249 connect (fEncoderPath,SIGNAL(editingFinished ()),this,SLOT(checkEncoderSwParameters()));
250 connect (fTempFolderPath,SIGNAL(editingFinished ()),this,SLOT(checkTempFolderParameters()));
251 connect (fSaveFileName,SIGNAL(editingFinished ()),this,SLOT(checkSaveFileNameParameters()));
252
253}
#define TRUE
Definition globals.hh:41

◆ ~G4OpenGLQtMovieDialog()

G4OpenGLQtMovieDialog::~G4OpenGLQtMovieDialog ( )

Destroys G4OpenGLQtMovieDialog

Definition at line 257 of file G4OpenGLQtMovieDialog.cc.

258{
259}

Member Function Documentation

◆ checkEncoderSwParameters

bool G4OpenGLQtMovieDialog::checkEncoderSwParameters ( )
slot

If one of parameter is incorrect, put it in red and don't valid it If valid, save it

Definition at line 318 of file G4OpenGLQtMovieDialog.cc.

318 {
319
320 bool status = true;
321 QPalette mypalette( fEncoderPath->palette() );
322
323 QString temp = fParentViewer->setEncoderPath(fEncoderPath->text());
325 fEncoderStatus->setText(temp);
326 if (temp != "") {
327 mypalette.setColor( QPalette::Base, Qt::red);
328 if (fParentViewer->isReadyToEncode()) {
329 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");
330 }
331 status = false;
332 } else {
333 mypalette.setColor( QPalette::Base, Qt::white);
334 fEncoderPath->setText(fParentViewer->getEncoderPath());
335 }
336 fEncoderPath->setPalette(mypalette);
337 return status;
338}
QString setEncoderPath(QString path)

Referenced by G4OpenGLQtMovieDialog(), G4OpenGLQtViewer::saveVideo(), and G4OpenGLQtViewer::stopVideo().

◆ checkSaveFileNameParameters

bool G4OpenGLQtMovieDialog::checkSaveFileNameParameters ( )
slot

If one of parameter is incorrect, put it in red and don't valid it If valid, save it

Definition at line 368 of file G4OpenGLQtMovieDialog.cc.

368 {
369
370 bool status = true;
371 QPalette mypalette( fSaveFileName->palette() );
372
373 QString temp = fParentViewer->setSaveFileName(fSaveFileName->text());
374 fSaveFileStatus->setText(temp);
375 if (temp != "") {
376 mypalette.setColor( QPalette::Base, Qt::red);
377 status = false;
378 } else {
379 mypalette.setColor( QPalette::Base, Qt::white);
380 fSaveFileName->setText(fParentViewer->getSaveFileName());
381 }
382 fSaveFileName->setPalette(mypalette);
383 return status;
384}
QString setSaveFileName(QString path)

Referenced by G4OpenGLQtMovieDialog(), G4OpenGLQtViewer::saveVideo(), and G4OpenGLQtViewer::stopVideo().

◆ checkTempFolderParameters

bool G4OpenGLQtMovieDialog::checkTempFolderParameters ( )
slot

If one of parameter is incorrect, put it in red and don't valid it If valid, save it

Definition at line 345 of file G4OpenGLQtMovieDialog.cc.

345 {
346
347 bool status = true;
348 QPalette mypalette( fTempFolderPath->palette() );
349
350 QString temp = fParentViewer->setTempFolderPath(fTempFolderPath->text());
351 fTempFolderStatus->setText(temp);
352 if (temp != "") {
353 mypalette.setColor( QPalette::Base, Qt::red);
354 status = false;
355 } else {
356 mypalette.setColor( QPalette::Base, Qt::white);
357 fTempFolderPath->setText(fParentViewer->getTempFolderPath());
358 }
359 fTempFolderPath->setPalette(mypalette);
360 return status;
361}
QString setTempFolderPath(QString path)

Referenced by G4OpenGLQtMovieDialog().

◆ save

void G4OpenGLQtMovieDialog::save ( )
slot

Definition at line 308 of file G4OpenGLQtMovieDialog.cc.

308 {
309 if (((fParentViewer->isPaused()) || fParentViewer->isRecording() || fParentViewer->isStopped())) {
310 fParentViewer->saveVideo();
311 }
312}

Referenced by G4OpenGLQtMovieDialog().

◆ setRecordingInfos()

void G4OpenGLQtMovieDialog::setRecordingInfos ( QString txt)

Definition at line 459 of file G4OpenGLQtMovieDialog.cc.

459 {
460 fRecordingInfos->setText(txt);
461}

Referenced by checkEncoderSwParameters(), and G4OpenGLQtMovieDialog().

◆ setRecordingStatus()

void G4OpenGLQtMovieDialog::setRecordingStatus ( QString txt)

Definition at line 392 of file G4OpenGLQtMovieDialog.cc.

392 {
393 fRecordingStatus->setText(txt);
394 if (fParentViewer->isWaiting()) {
395 fButtonStartPause->setText(" &Start ");
396 fButtonStartPause->setEnabled(true);
397 fButtonStopFinishClose->setEnabled(false);
398 fButtonSave->setEnabled(false);
399
400 } else if (fParentViewer->isPaused()) {
401
402 fButtonStartPause->setText(" &Continue ");
403 fButtonStartPause->setEnabled(true);
404 fButtonStopFinishClose->setEnabled(true);
405 fButtonSave->setEnabled(false);
406
407 } else if (fParentViewer->isRecording()) {
408
409 fButtonStartPause->setText(" &Pause ");
410 fButtonStartPause->setEnabled(true);
411 fButtonStopFinishClose->setEnabled(true);
412 fButtonSave->setEnabled(false);
413
414 } else if (fParentViewer->isBadOutput()) {
415
416 fButtonStartPause->setText(" &Start ");
417 fButtonStartPause->setEnabled(true);
418 fButtonStopFinishClose->setEnabled(false);
419 fButtonSave->setEnabled(false);
420
421 } else if (fParentViewer->isBadTmp()) {
422
423 fButtonStartPause->setText(" &Start ");
424 fButtonStartPause->setEnabled(false);
425 fButtonStopFinishClose->setEnabled(false);
426 fButtonSave->setEnabled(false);
427
428 } else if (fParentViewer->isBadEncoder()) {
429
430 fButtonStartPause->setText(" &Start ");
431 fButtonStartPause->setEnabled(true);
432 fButtonStopFinishClose->setEnabled(false);
433 fButtonSave->setEnabled(false);
434
435 } else if (fParentViewer->isSuccess()) {
436
437 fButtonStartPause->setText(" &Start ");
438 fButtonStartPause->setEnabled(false);
439 fButtonStopFinishClose->setEnabled(false);
440 fButtonSave->setEnabled(false);
441
442 } else if (fParentViewer->isFailed()) {
443
444 fButtonStartPause->setText(" &Start ");
445 fButtonStartPause->setEnabled(false);
446 fButtonStopFinishClose->setEnabled(false);
447 fButtonSave->setEnabled(false);
448
449 } else if (fParentViewer->isStopped()) {
450
451 fButtonStartPause->setText(" &Start ");
452 fButtonStartPause->setEnabled(false);
453 fButtonStopFinishClose->setEnabled(false);
454 fButtonSave->setEnabled(true);
455 }
456}

Referenced by G4OpenGLQtViewer::displayRecordingStatus(), and G4OpenGLQtMovieDialog().

◆ stopFinishClose

void G4OpenGLQtMovieDialog::stopFinishClose ( )
slot

Definition at line 304 of file G4OpenGLQtMovieDialog.cc.

304 {
305 fParentViewer->stopVideo();
306}

Referenced by G4OpenGLQtMovieDialog().


The documentation for this class was generated from the following files: