33#include <qpushbutton.h>
40#include <qradiobutton.h>
43#include <qbuttongroup.h>
46#include "moc_G4OpenGLQtExportDialog.cpp"
58 setWindowTitle( tr(
" Export options" ));
59 originalWidth = aWidth;
60 originalHeight = aHeight;
70 QVBoxLayout* globalVLayout =
new QVBoxLayout(
this);
71 globalVLayout->setMargin(10);
72 globalVLayout->setSpacing(10);
79 QWidget * sizeWidget =
new QWidget(
this);
80 QVBoxLayout * sizeWidgetLayout =
new QVBoxLayout(sizeWidget);
81 sizeWidgetLayout->setMargin (10);
85 sizeGroupBox =
new QGroupBox(tr(
"Size"));
86 QVBoxLayout *sizeGroupBoxLayout =
new QVBoxLayout(sizeGroupBox);
87 QButtonGroup * sizeButtonGroupBox =
new QButtonGroup();
88 sizeGroupBoxLayout->setMargin (15);
90 original =
new QRadioButton(
"Original");
91 modify =
new QRadioButton(
"Modify");
93 sizeButtonGroupBox->addButton(original);
94 sizeButtonGroupBox->addButton(modify);
95 sizeButtonGroupBox->setExclusive(
true);
97 sizeGroupBoxLayout->addWidget(original);
98 sizeGroupBoxLayout->addWidget(modify);
100 sizeGroupBox->setLayout(sizeGroupBoxLayout);
101 sizeWidgetLayout->addWidget(sizeGroupBox);
103 connect( sizeButtonGroupBox, SIGNAL( buttonClicked(QAbstractButton*) ),
this, SLOT(
changeSizeBox()) );
104 original->setChecked(
true );
108 heightWidget =
new QWidget(sizeWidget);
110 QHBoxLayout *heightLineLayout =
new QHBoxLayout(heightWidget);
114 heightLineLayout->addWidget(
new QLabel(
"Height",heightWidget));
115 height =
new QLineEdit(tmp.setNum(originalHeight),heightWidget);
116 height->setMaxLength(5);
117 heightLineLayout->addWidget(height);
119 heightWidget->setLayout(heightLineLayout);
121 sizeWidgetLayout->addWidget(heightWidget);
122 connect( height, SIGNAL( textChanged (
const QString& ) ),
this, SLOT(
textHeightChanged(
const QString &) ) );
126 widthWidget =
new QWidget(sizeWidget);
128 QHBoxLayout *widthLineLayout =
new QHBoxLayout(widthWidget);
130 widthLineLayout->addWidget(
new QLabel(
"Width ",widthWidget));
131 width =
new QLineEdit(tmp.setNum(originalWidth),widthWidget);
132 width->setMaxLength(5);
133 widthLineLayout->addWidget(width);
134 widthWidget->setLayout(widthLineLayout);
135 sizeWidgetLayout->addWidget(widthWidget);
136 connect( width, SIGNAL( textChanged (
const QString& ) ),
this, SLOT(
textWidthChanged(
const QString &) ) );
142 ratioCheckBox =
new QCheckBox(
"Keep ratio",sizeWidget);
143 ratioCheckBox->setChecked(
true );
145 sizeWidgetLayout->addWidget(ratioCheckBox);
147 ratioCheckBox->hide();
148 heightWidget->hide();
151 sizeWidget->setLayout(sizeWidgetLayout);
152 globalVLayout->addWidget(sizeWidget);
154 if (format ==
"eps") {
156 QGroupBox *EPSWidgetGroupBox =
new QGroupBox(tr(
"EPS options"),
this);
159 QVBoxLayout * EPSGroupBoxLayout =
new QVBoxLayout(EPSWidgetGroupBox);
160 EPSGroupBoxLayout->setMargin (15);
173 vectorEPSCheckBox =
new QCheckBox(
"Vector EPS File",EPSWidgetGroupBox);
174 EPSGroupBoxLayout->addWidget(vectorEPSCheckBox);
176 EPSWidgetGroupBox->setLayout(EPSGroupBoxLayout);
178 vectorEPSCheckBox->setChecked(
true );
180 globalVLayout->addWidget(EPSWidgetGroupBox);
181 connect( vectorEPSCheckBox, SIGNAL( clicked() ),
this, SLOT(
changeVectorEPS()) );
185 if ((format ==
"jpg") ||
186 (format ==
"jpeg")) {
188 QGroupBox *imageGroupBox =
new QGroupBox(tr(
"Image quality"),
this);
189 QHBoxLayout *hSliderLayout =
new QHBoxLayout(imageGroupBox);
190 hSliderLayout->setMargin (15);
192 qualitySlider=
new QSlider(Qt::Horizontal,imageGroupBox);
193 qualitySlider->setMinimum(0);
194 qualitySlider->setMaximum(100);
195 qualitySlider->setTickPosition(QSlider::TicksBelow);
196 qualitySlider->setValue(60);
197 hSliderLayout->addWidget(
new QLabel(
"Low ",imageGroupBox));
198 hSliderLayout->addWidget(qualitySlider);
199 hSliderLayout->addWidget(
new QLabel(
" Maximum",imageGroupBox));
201 imageGroupBox->setLayout(hSliderLayout);
203 globalVLayout->addWidget(imageGroupBox);
209 QWidget *buttonBox =
new QWidget(
this);
211 QHBoxLayout *buttonBoxLayout =
new QHBoxLayout(buttonBox);
213 buttonOk =
new QPushButton( tr(
"&OK" ),buttonBox );
214 buttonOk->setAutoDefault(
true );
215 buttonOk->setDefault(
true );
216 buttonBoxLayout->addWidget(buttonOk);
218 buttonCancel =
new QPushButton( tr(
"&Cancel" ),buttonBox );
219 buttonCancel->setAutoDefault(
true );
220 buttonBoxLayout->addWidget(buttonCancel);
222 buttonBox->setLayout(buttonBoxLayout);
223 globalVLayout->addWidget(buttonBox);
227 setLayout(globalVLayout);
230 connect( buttonOk, SIGNAL( clicked() ),
this, SLOT( accept() ) );
231 connect( buttonCancel, SIGNAL( clicked() ),
this, SLOT( reject() ) );
238 if (!qualitySlider)
return -1;
239 return qualitySlider->value();
244 if (!height)
return originalHeight;
245 return height->text().toInt();
250 if (!width)
return originalWidth;
251 return width->text().toInt();
256 if (!vectorEPSCheckBox)
return 0;
257 return vectorEPSCheckBox->isChecked();
263 if (!vectorEPSCheckBox)
return;
264 if (vectorEPSCheckBox->isChecked()) {
265 sizeGroupBox->show();
270 sizeGroupBox->hide();
273 ratioCheckBox->hide();
274 heightWidget->hide();
282 if (!original)
return;
283 if (!heightWidget)
return;
284 if (!widthWidget)
return;
285 if (!ratioCheckBox)
return;
287 if ( original->isChecked()) {
288 ratioCheckBox->hide();
289 heightWidget->hide();
292 heightWidget->show();
294 ratioCheckBox->show();
303 if (!ratioCheckBox)
return;
305 if (isChangingSize ==
true)
return;
307 if (ratioCheckBox->isChecked()){
308 isChangingSize =
true;
310 height->setText(tmp.setNum((
int)(s.toInt()*(
double)((
double)originalHeight/(
double)originalWidth))));
311 isChangingSize =
false;
319 if (!ratioCheckBox)
return;
321 if (isChangingSize ==
true)
return;
323 if (ratioCheckBox->isChecked()){
324 isChangingSize =
true;
326 width->setText(tmp.setNum(s.toInt()*originalWidth/originalHeight));
327 isChangingSize =
false;
~G4OpenGLQtExportDialog()
void textHeightChanged(const QString &)
void textWidthChanged(const QString &)
G4OpenGLQtExportDialog(QWidget *parentw, QString format, int height=0, int width=0)