34#include <qpushbutton.h>
40#include <qfiledialog.h>
44#include "moc_G4OpenGLQtMovieDialog.cpp"
69 fParentViewer(parentViewer)
72 setWindowTitle( tr(
" Save as movie" ));
76 QVBoxLayout* globalVLayout =
new QVBoxLayout(
this);
77 globalVLayout->setMargin(10);
78 globalVLayout->setSpacing(10);
81 QGroupBox *encoderGroupBox =
new QGroupBox(tr(
"Encoder path"),
this);
82 QVBoxLayout *encoderVGroupBoxLayout =
new QVBoxLayout(encoderGroupBox);
85 QWidget *encoderHBox =
new QWidget(encoderGroupBox);
86 QHBoxLayout *encoderHBoxLayout =
new QHBoxLayout(encoderHBox);
87 fEncoderPath =
new QLineEdit(
"",encoderHBox);
89 QPushButton *encoderButton =
new QPushButton(tr(
"..."),encoderHBox);
90 encoderButton->setMaximumWidth (30);
92 fEncoderStatus =
new QLabel(encoderGroupBox);
94 fEncoderStatus->setWordWrap(
true);
95 encoderVGroupBoxLayout->setMargin(15);
97 fEncoderStatus->setText(
"");
99 encoderHBoxLayout->addWidget(fEncoderPath);
100 encoderHBoxLayout->addWidget(encoderButton);
101 encoderVGroupBoxLayout->addWidget(encoderHBox);
102 encoderVGroupBoxLayout->addWidget(fEncoderStatus);
104 encoderGroupBox->setLayout(encoderVGroupBoxLayout);
105 globalVLayout->addWidget(encoderGroupBox);
107 connect( encoderButton, SIGNAL( clicked( ) ),
this, SLOT(selectEncoderPathAction() ) );
111 QGroupBox *tempFolderGroupBox =
new QGroupBox(tr(
"Temporary folder path"),
this);
112 QVBoxLayout *tempFolderVGroupBoxLayout =
new QVBoxLayout(tempFolderGroupBox);
115 QWidget *tempFolderHBox =
new QWidget(tempFolderGroupBox);
116 QHBoxLayout *tempFolderHBoxLayout =
new QHBoxLayout(tempFolderHBox);
118 fTempFolderPath =
new QLineEdit(
"",tempFolderHBox);
120 QPushButton *tempButton =
new QPushButton(tr(
"..."),tempFolderHBox);
121 tempButton->setMaximumWidth (30);
123 fTempFolderStatus =
new QLabel(tempFolderGroupBox);
124 fTempFolderStatus->setWordWrap(
true);
125 tempFolderVGroupBoxLayout->setMargin(15);
126 fTempFolderStatus->setText(
"");
128 tempFolderHBoxLayout->addWidget(fTempFolderPath);
129 tempFolderHBoxLayout->addWidget(tempButton);
130 tempFolderVGroupBoxLayout->addWidget(tempFolderHBox);
131 tempFolderVGroupBoxLayout->addWidget(fTempFolderStatus);
133 tempFolderGroupBox->setLayout(tempFolderVGroupBoxLayout);
134 globalVLayout->addWidget(tempFolderGroupBox);
136 connect( tempButton, SIGNAL( clicked( ) ),
this, SLOT(selectTempPathAction() ) );
142 QGroupBox *saveFileGroupBox =
new QGroupBox(tr(
"Save as"),
this);
143 QVBoxLayout *saveFileVGroupBoxLayout =
new QVBoxLayout(saveFileGroupBox);
146 QWidget *saveFileHBox =
new QWidget(saveFileGroupBox);
147 QHBoxLayout *saveFileHBoxLayout =
new QHBoxLayout(saveFileHBox);
149 fSaveFileName =
new QLineEdit(
"G4Movie.mpeg",saveFileHBox);
151 QPushButton *saveButton =
new QPushButton(tr(
"..."),saveFileHBox);
152 saveButton->setMaximumWidth (30);
154 fSaveFileStatus =
new QLabel(saveFileGroupBox);
155 fSaveFileStatus->setWordWrap(
true);
156 saveFileVGroupBoxLayout->setMargin(15);
157 fSaveFileStatus->setText(
"");
159 saveFileHBoxLayout->addWidget(fSaveFileName);
160 saveFileHBoxLayout->addWidget(saveButton);
161 saveFileVGroupBoxLayout->addWidget(saveFileHBox);
162 saveFileVGroupBoxLayout->addWidget(fSaveFileStatus);
164 saveFileGroupBox->setLayout(saveFileVGroupBoxLayout);
165 globalVLayout->addWidget(saveFileGroupBox);
167 connect( saveButton, SIGNAL( clicked( ) ),
this, SLOT(selectSaveFileNameAction() ) );
173 QLabel *infoLabel =
new QLabel(
" Press SPACE to Start/Pause video recording \n Press RETURN to Stop video recording",
this);
176 QGroupBox *statusGroupBox =
new QGroupBox(tr(
"Status"),
this);
177 QVBoxLayout *statusVGroupBoxLayout =
new QVBoxLayout(statusGroupBox);
179 fRecordingStatus =
new QLabel(statusGroupBox);
180 statusVGroupBoxLayout->setMargin(15);
181 fRecordingStatus->setWordWrap(
true);
182 QPalette mypalette( fRecordingStatus->palette() );
183 mypalette.setColor( QPalette::Text, Qt::green);
184 fRecordingStatus->setPalette(mypalette);
186 fRecordingInfos =
new QLabel(statusGroupBox);
187 fRecordingInfos->setWordWrap(
true);
190 statusVGroupBoxLayout->addWidget(fRecordingStatus);
191 statusVGroupBoxLayout->addWidget(fRecordingInfos);
193 statusGroupBox->setLayout(statusVGroupBoxLayout);
194 globalVLayout->addWidget(infoLabel);
195 globalVLayout->addWidget(statusGroupBox);
198 QWidget *buttonBox =
new QWidget(
this);
200 QHBoxLayout *buttonBoxLayout =
new QHBoxLayout(buttonBox);
202 QPushButton *buttonReset =
new QPushButton( tr(
"&Reset" ),buttonBox );
203 buttonReset->setAutoDefault(
TRUE );
204 buttonBoxLayout->addWidget(buttonReset);
206 fButtonStartPause =
new QPushButton( tr(
" &Start " ),buttonBox );
207 fButtonStartPause->setEnabled(
true);
208 fButtonStartPause->setAutoDefault(
TRUE );
209 buttonBoxLayout->addWidget(fButtonStartPause);
211 fButtonStopFinishClose =
new QPushButton( tr(
"&Stop" ),buttonBox );
212 fButtonStopFinishClose->setEnabled(
false);
213 fButtonStopFinishClose->setAutoDefault(
TRUE );
214 buttonBoxLayout->addWidget(fButtonStopFinishClose);
216 fButtonSave =
new QPushButton( tr(
"&Save" ),buttonBox );
217 fButtonSave->setEnabled(
false);
218 fButtonSave->setAutoDefault(
TRUE );
219 buttonBoxLayout->addWidget(fButtonSave);
221 QPushButton *buttonCancel =
new QPushButton( tr(
"&Cancel" ),buttonBox );
222 buttonCancel->setAutoDefault(
TRUE );
223 buttonBoxLayout->addWidget(buttonCancel);
225 buttonBox->setLayout(buttonBoxLayout);
226 globalVLayout->addWidget(buttonBox);
230 setLayout(globalVLayout);
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() ) );
261void G4OpenGLQtMovieDialog::selectEncoderPathAction()
263 QString nomFich = QFileDialog::getOpenFileName (
this,
264 "Select your encoder",
265 tr(
"Select your encoder ..."));
271 fEncoderPath->setText(nomFich);
276void G4OpenGLQtMovieDialog::selectTempPathAction()
278 QString nomFich = QFileDialog::getExistingDirectory (
this,
279 "Select temporary folder",
280 tr(
"Select temporary folder ..."));
285 fTempFolderPath->setText(nomFich);
290void G4OpenGLQtMovieDialog::selectSaveFileNameAction()
292 QString nomFich = QFileDialog::getSaveFileName (
this,
294 tr(
"Select saved file ..."));
299 fSaveFileName->setText(nomFich);
321 QPalette mypalette( fEncoderPath->palette() );
323 QString temp = fParentViewer->
setEncoderPath(fEncoderPath->text());
325 fEncoderStatus->setText(temp);
327 mypalette.setColor( QPalette::Base, Qt::red);
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");
333 mypalette.setColor( QPalette::Base, Qt::white);
336 fEncoderPath->setPalette(mypalette);
348 QPalette mypalette( fTempFolderPath->palette() );
351 fTempFolderStatus->setText(temp);
353 mypalette.setColor( QPalette::Base, Qt::red);
356 mypalette.setColor( QPalette::Base, Qt::white);
359 fTempFolderPath->setPalette(mypalette);
371 QPalette mypalette( fSaveFileName->palette() );
374 fSaveFileStatus->setText(temp);
376 mypalette.setColor( QPalette::Base, Qt::red);
379 mypalette.setColor( QPalette::Base, Qt::white);
382 fSaveFileName->setPalette(mypalette);
387void G4OpenGLQtMovieDialog::resetRecording() {
393 fRecordingStatus->setText(txt);
395 fButtonStartPause->setText(
" &Start ");
396 fButtonStartPause->setEnabled(
true);
397 fButtonStopFinishClose->setEnabled(
false);
398 fButtonSave->setEnabled(
false);
400 }
else if (fParentViewer->
isPaused()) {
402 fButtonStartPause->setText(
" &Continue ");
403 fButtonStartPause->setEnabled(
true);
404 fButtonStopFinishClose->setEnabled(
true);
405 fButtonSave->setEnabled(
false);
409 fButtonStartPause->setText(
" &Pause ");
410 fButtonStartPause->setEnabled(
true);
411 fButtonStopFinishClose->setEnabled(
true);
412 fButtonSave->setEnabled(
false);
416 fButtonStartPause->setText(
" &Start ");
417 fButtonStartPause->setEnabled(
true);
418 fButtonStopFinishClose->setEnabled(
false);
419 fButtonSave->setEnabled(
false);
421 }
else if (fParentViewer->
isBadTmp()) {
423 fButtonStartPause->setText(
" &Start ");
424 fButtonStartPause->setEnabled(
false);
425 fButtonStopFinishClose->setEnabled(
false);
426 fButtonSave->setEnabled(
false);
430 fButtonStartPause->setText(
" &Start ");
431 fButtonStartPause->setEnabled(
true);
432 fButtonStopFinishClose->setEnabled(
false);
433 fButtonSave->setEnabled(
false);
437 fButtonStartPause->setText(
" &Start ");
438 fButtonStartPause->setEnabled(
false);
439 fButtonStopFinishClose->setEnabled(
false);
440 fButtonSave->setEnabled(
false);
442 }
else if (fParentViewer->
isFailed()) {
444 fButtonStartPause->setText(
" &Start ");
445 fButtonStartPause->setEnabled(
false);
446 fButtonStopFinishClose->setEnabled(
false);
447 fButtonSave->setEnabled(
false);
451 fButtonStartPause->setText(
" &Start ");
452 fButtonStartPause->setEnabled(
false);
453 fButtonStopFinishClose->setEnabled(
false);
454 fButtonSave->setEnabled(
true);
460 fRecordingInfos->setText(txt);
464void G4OpenGLQtMovieDialog::enabledApplyButton() {
465 fButtonStartPause->setEnabled(
true);
bool checkSaveFileNameParameters()
void setRecordingInfos(QString)
void setRecordingStatus(QString)
G4OpenGLQtMovieDialog(G4OpenGLQtViewer *, QWidget *)
bool checkTempFolderParameters()
bool checkEncoderSwParameters()
QString getSaveFileName()
QString getTempFolderPath()
QString setEncoderPath(QString path)
QString setSaveFileName(QString path)
QString setTempFolderPath(QString path)