[648] | 1 | // |
---|
[581] | 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 | // |
---|
[688] | 27 | // $Id: G4OpenGLQtExportDialog.cc,v 1.5 2008/01/15 11:05:08 lgarnier Exp $ |
---|
[593] | 28 | // GEANT4 tag $Name: $ |
---|
[581] | 29 | // |
---|
| 30 | // |
---|
| 31 | |
---|
[688] | 32 | //#define GEANT4_QT_DEBUG |
---|
[581] | 33 | #ifdef G4VIS_BUILD_OPENGLQT_DRIVER |
---|
| 34 | |
---|
| 35 | #include "G4OpenGLQtExportDialog.hh" |
---|
| 36 | |
---|
[693] | 37 | #define GEANT4_QT_DEBUG |
---|
| 38 | |
---|
[595] | 39 | #include <qvariant.h> |
---|
| 40 | #include <qpushbutton.h> |
---|
| 41 | #include <qcheckbox.h> |
---|
| 42 | #include <qlabel.h> |
---|
| 43 | #include <qcombobox.h> |
---|
| 44 | #include <qslider.h> |
---|
| 45 | #include <qlayout.h> |
---|
| 46 | #include <qgroupbox.h> |
---|
| 47 | #include <qradiobutton.h> |
---|
| 48 | #include <qimage.h> |
---|
| 49 | #include <qlineedit.h> |
---|
[633] | 50 | #include <qbuttongroup.h> |
---|
[581] | 51 | |
---|
| 52 | G4OpenGLQtExportDialog::G4OpenGLQtExportDialog( |
---|
| 53 | QWidget* parent |
---|
[639] | 54 | ,QString format |
---|
[583] | 55 | ,int aHeight |
---|
| 56 | ,int aWidth |
---|
| 57 | ) |
---|
[657] | 58 | : QDialog( parent ), |
---|
| 59 | isChangingSize(false) |
---|
[581] | 60 | { |
---|
[599] | 61 | #if QT_VERSION < 0x040000 |
---|
| 62 | setCaption( tr( " Export options" )); |
---|
| 63 | #else |
---|
[582] | 64 | setWindowTitle( tr( " Export options" )); |
---|
[599] | 65 | #endif |
---|
[583] | 66 | originalWidth = aWidth; |
---|
| 67 | originalHeight = aHeight; |
---|
| 68 | |
---|
[593] | 69 | // Initializations |
---|
| 70 | qualitySlider = NULL; |
---|
| 71 | width = NULL; |
---|
| 72 | height = NULL; |
---|
| 73 | colorButton = NULL; |
---|
| 74 | BWButton = NULL; |
---|
| 75 | |
---|
[583] | 76 | // global layout |
---|
[599] | 77 | QVBoxLayout* globalVLayout = new QVBoxLayout(this); |
---|
[642] | 78 | globalVLayout->setMargin(10); |
---|
| 79 | globalVLayout->setSpacing(10); |
---|
[581] | 80 | |
---|
[583] | 81 | |
---|
[599] | 82 | |
---|
[638] | 83 | // FIXME : L. Garnier 4/12/07 |
---|
| 84 | // Not implented. Should deal with alpha channel |
---|
[583] | 85 | |
---|
[639] | 86 | // if((format == "tif") || |
---|
| 87 | // (format == "tiff") || |
---|
| 88 | // (format == "jpg") || |
---|
| 89 | // (format == "jpeg") || |
---|
| 90 | // (format == "png") || |
---|
| 91 | // (format == "xpm")) { |
---|
[583] | 92 | |
---|
[638] | 93 | // QGroupBox *transparencyGroupBox = new QGroupBox(tr("Transparency"),this); |
---|
| 94 | // QVBoxLayout *transparencyGroupBoxLayout = new QVBoxLayout(transparencyGroupBox); |
---|
[583] | 95 | |
---|
[638] | 96 | // boxTransparency = new QCheckBox("Save transparency",transparencyGroupBox); |
---|
| 97 | // boxTransparency->setChecked( false ); |
---|
[583] | 98 | |
---|
[638] | 99 | // transparencyGroupBoxLayout->addWidget(boxTransparency); |
---|
| 100 | // #if QT_VERSION >= 0x040000 |
---|
| 101 | // transparencyGroupBox->setLayout(transparencyGroupBoxLayout); |
---|
| 102 | // #endif |
---|
| 103 | // globalVLayout->addWidget(transparencyGroupBox); |
---|
[581] | 104 | |
---|
[638] | 105 | // } |
---|
| 106 | |
---|
[656] | 107 | // FIXME : L. Garnier 4/12/07 |
---|
| 108 | // This is not working for PS and PDF images, it does nothing. |
---|
| 109 | // Image is staying in color mode |
---|
| 110 | // if ((format == "ps") || (format == "pdf") || (format == "eps")) { |
---|
| 111 | |
---|
| 112 | |
---|
[584] | 113 | // size box |
---|
| 114 | |
---|
[640] | 115 | QWidget * sizeWidget = new QWidget(this); // widget containing group button |
---|
[641] | 116 | QVBoxLayout * sizeWidgetLayout = new QVBoxLayout(sizeWidget); |
---|
[642] | 117 | sizeWidgetLayout->setMargin (10); |
---|
[599] | 118 | |
---|
[640] | 119 | // original and modify radiobuttons |
---|
[633] | 120 | #if QT_VERSION < 0x040000 |
---|
[640] | 121 | QButtonGroup * sizeButtonGroupBox = new QButtonGroup ( 2,Qt::Vertical, tr("Size"),this); |
---|
[642] | 122 | sizeButtonGroupBox->setInsideMargin (15); |
---|
[633] | 123 | |
---|
| 124 | original = new QRadioButton("Original",sizeButtonGroupBox); |
---|
| 125 | modify = new QRadioButton("Modify",sizeButtonGroupBox); |
---|
| 126 | |
---|
| 127 | sizeButtonGroupBox->insert(original); |
---|
| 128 | sizeButtonGroupBox->insert(modify); |
---|
| 129 | sizeButtonGroupBox->setExclusive(true); |
---|
[640] | 130 | sizeWidgetLayout->add(sizeButtonGroupBox); |
---|
[584] | 131 | |
---|
[640] | 132 | connect( sizeButtonGroupBox, SIGNAL( clicked(int) ), this, SLOT( changeSizeBox()) ); |
---|
[633] | 133 | #else |
---|
| 134 | |
---|
[657] | 135 | sizeGroupBox = new QGroupBox(tr("Size")); |
---|
[641] | 136 | QVBoxLayout *sizeGroupBoxLayout = new QVBoxLayout(sizeGroupBox); |
---|
[640] | 137 | QButtonGroup * sizeButtonGroupBox = new QButtonGroup(); |
---|
[642] | 138 | sizeGroupBoxLayout->setMargin (15); |
---|
[584] | 139 | |
---|
[633] | 140 | original = new QRadioButton("Original"); |
---|
| 141 | modify = new QRadioButton("Modify"); |
---|
| 142 | |
---|
[640] | 143 | sizeButtonGroupBox->addButton(original); |
---|
[633] | 144 | sizeButtonGroupBox->addButton(modify); |
---|
| 145 | sizeButtonGroupBox->setExclusive(true); |
---|
| 146 | |
---|
[640] | 147 | sizeGroupBoxLayout->addWidget(original); |
---|
[633] | 148 | sizeGroupBoxLayout->addWidget(modify); |
---|
[640] | 149 | |
---|
| 150 | sizeGroupBox->setLayout(sizeGroupBoxLayout); |
---|
| 151 | sizeWidgetLayout->addWidget(sizeGroupBox); |
---|
[633] | 152 | |
---|
[693] | 153 | connect( sizeButtonGroupBox, SIGNAL( buttonClicked(QAbstractButton*) ), this, SLOT( changeSizeBox()) ); |
---|
[633] | 154 | #endif |
---|
[635] | 155 | original->setChecked( true ); |
---|
[633] | 156 | |
---|
| 157 | |
---|
[584] | 158 | // height |
---|
[693] | 159 | heightWidget = new QWidget(sizeWidget); |
---|
[599] | 160 | |
---|
| 161 | QHBoxLayout *heightLineLayout = new QHBoxLayout(heightWidget); |
---|
| 162 | |
---|
[583] | 163 | QString tmp; |
---|
| 164 | |
---|
[635] | 165 | heightLineLayout->addWidget(new QLabel("Height",heightWidget)); |
---|
| 166 | height = new QLineEdit(tmp.setNum(originalHeight),heightWidget); |
---|
[583] | 167 | height->setMaxLength(5); |
---|
[633] | 168 | #if QT_VERSION < 0x040000 |
---|
| 169 | heightLineLayout->add(height); |
---|
| 170 | #else |
---|
[583] | 171 | heightLineLayout->addWidget(height); |
---|
[633] | 172 | #endif |
---|
[640] | 173 | |
---|
[599] | 174 | #if QT_VERSION >= 0x040000 |
---|
[583] | 175 | heightWidget->setLayout(heightLineLayout); |
---|
[599] | 176 | #endif |
---|
[640] | 177 | |
---|
[633] | 178 | #if QT_VERSION < 0x040000 |
---|
[640] | 179 | sizeWidgetLayout->add(heightWidget); |
---|
[633] | 180 | #else |
---|
[640] | 181 | sizeWidgetLayout->addWidget(heightWidget); |
---|
[633] | 182 | #endif |
---|
[584] | 183 | connect( height, SIGNAL( textChanged ( const QString& ) ), this, SLOT( textHeightChanged(const QString &) ) ); |
---|
[581] | 184 | |
---|
[584] | 185 | |
---|
| 186 | // width |
---|
[693] | 187 | widthWidget = new QWidget(sizeWidget); |
---|
[583] | 188 | |
---|
[633] | 189 | QHBoxLayout *widthLineLayout = new QHBoxLayout(widthWidget); |
---|
| 190 | |
---|
[599] | 191 | #if QT_VERSION < 0x040000 |
---|
[633] | 192 | widthLineLayout->add(new QLabel("Width ",widthWidget)); |
---|
[599] | 193 | #else |
---|
[633] | 194 | widthLineLayout->addWidget(new QLabel("Width ",widthWidget)); |
---|
[599] | 195 | #endif |
---|
[635] | 196 | width = new QLineEdit(tmp.setNum(originalWidth),widthWidget); |
---|
[583] | 197 | width->setMaxLength(5); |
---|
[633] | 198 | #if QT_VERSION < 0x040000 |
---|
| 199 | widthLineLayout->add(width); |
---|
| 200 | #else |
---|
[583] | 201 | widthLineLayout->addWidget(width); |
---|
[633] | 202 | #endif |
---|
[599] | 203 | #if QT_VERSION >= 0x040000 |
---|
[583] | 204 | widthWidget->setLayout(widthLineLayout); |
---|
[599] | 205 | #endif |
---|
[633] | 206 | #if QT_VERSION < 0x040000 |
---|
[640] | 207 | sizeWidgetLayout->add(widthWidget); |
---|
[633] | 208 | #else |
---|
[640] | 209 | sizeWidgetLayout->addWidget(widthWidget); |
---|
[633] | 210 | #endif |
---|
[584] | 211 | connect( width, SIGNAL( textChanged ( const QString& ) ), this, SLOT( textWidthChanged(const QString &) ) ); |
---|
[583] | 212 | |
---|
[640] | 213 | |
---|
| 214 | |
---|
| 215 | // ratio check box |
---|
| 216 | |
---|
| 217 | ratioCheckBox = new QCheckBox( "Keep ratio",sizeWidget); |
---|
| 218 | ratioCheckBox->setChecked( true ); |
---|
| 219 | |
---|
| 220 | #if QT_VERSION < 0x040000 |
---|
| 221 | sizeWidgetLayout->add(ratioCheckBox); |
---|
| 222 | #else |
---|
| 223 | sizeWidgetLayout->addWidget(ratioCheckBox); |
---|
[599] | 224 | #endif |
---|
[583] | 225 | |
---|
[640] | 226 | #if QT_VERSION < 0x040000 |
---|
| 227 | ratioCheckBox->setEnabled ( false ); |
---|
| 228 | heightWidget->setEnabled ( false ); |
---|
| 229 | widthWidget->setEnabled ( false ); |
---|
| 230 | #else |
---|
| 231 | ratioCheckBox->hide(); |
---|
[599] | 232 | heightWidget->hide(); |
---|
| 233 | widthWidget->hide(); |
---|
[640] | 234 | #endif |
---|
[583] | 235 | |
---|
[640] | 236 | #if QT_VERSION >= 0x040000 |
---|
| 237 | sizeWidget->setLayout(sizeWidgetLayout); |
---|
| 238 | #endif |
---|
| 239 | globalVLayout->addWidget(sizeWidget); |
---|
| 240 | |
---|
[656] | 241 | if (format == "eps") { |
---|
[640] | 242 | |
---|
[656] | 243 | QGroupBox *EPSWidgetGroupBox = new QGroupBox(tr("EPS options"),this); // widget containing group button |
---|
[640] | 244 | |
---|
| 245 | |
---|
[656] | 246 | #if QT_VERSION < 0x040000 |
---|
[642] | 247 | |
---|
[656] | 248 | EPSWidgetGroupBox->setInsideMargin (15); |
---|
[642] | 249 | |
---|
[655] | 250 | // QButtonGroup * EPSColorButtonGroupBox = new QButtonGroup( 2,Qt::Vertical, tr("EPS options"),this); |
---|
[652] | 251 | // EPSGroupBoxLayout = new QVBoxLayout(EPSColorButtonGroupBox); |
---|
[655] | 252 | // colorButton = new QRadioButton("Color",EPSColorButtonGroupBox); |
---|
| 253 | // BWButton = new QRadioButton("Grayscale",EPSColorButtonGroupBox); |
---|
| 254 | // EPSColorButtonGroupBox->setInsideMargin (15); |
---|
| 255 | // EPSColorButtonGroupBox->insert(colorButton); |
---|
| 256 | // EPSColorButtonGroupBox->insert(BWButton); |
---|
| 257 | // EPSColorButtonGroupBox->setExclusive(true); |
---|
| 258 | // EPSWidgetGroupBox->add(EPSColorButtonGroupBox); |
---|
[651] | 259 | |
---|
[652] | 260 | vectorEPSCheckBox = new QCheckBox( "Vector EPS File",EPSWidgetGroupBox); |
---|
| 261 | |
---|
[651] | 262 | #else |
---|
[656] | 263 | QVBoxLayout * EPSGroupBoxLayout = new QVBoxLayout(EPSWidgetGroupBox); |
---|
| 264 | EPSGroupBoxLayout->setMargin (15); |
---|
[651] | 265 | |
---|
[655] | 266 | // colorButton = new QRadioButton("Color",EPSWidgetGroupBox); |
---|
| 267 | // BWButton = new QRadioButton("Grayscale",EPSWidgetGroupBox); |
---|
[651] | 268 | |
---|
[655] | 269 | // QButtonGroup * EPSColorButtonGroupBox = new QButtonGroup(); |
---|
| 270 | // EPSColorButtonGroupBox->addButton(colorButton); |
---|
| 271 | // EPSColorButtonGroupBox->addButton(BWButton); |
---|
| 272 | // EPSColorButtonGroupBox->setExclusive(true); |
---|
[651] | 273 | |
---|
[655] | 274 | // EPSGroupBoxLayout->addWidget(colorButton); |
---|
| 275 | // EPSGroupBoxLayout->addWidget(BWButton); |
---|
[652] | 276 | |
---|
| 277 | vectorEPSCheckBox = new QCheckBox( "Vector EPS File",EPSWidgetGroupBox); |
---|
| 278 | EPSGroupBoxLayout->addWidget(vectorEPSCheckBox); |
---|
| 279 | |
---|
[651] | 280 | EPSWidgetGroupBox->setLayout(EPSGroupBoxLayout); |
---|
| 281 | #endif |
---|
[655] | 282 | // colorButton->setChecked( true ); |
---|
| 283 | vectorEPSCheckBox->setChecked( true ); |
---|
[651] | 284 | |
---|
| 285 | globalVLayout->addWidget(EPSWidgetGroupBox); |
---|
[656] | 286 | connect( vectorEPSCheckBox, SIGNAL( clicked() ), this, SLOT( changeVectorEPS()) ); |
---|
[651] | 287 | |
---|
| 288 | } |
---|
| 289 | |
---|
[656] | 290 | if ((format == "jpg") || |
---|
| 291 | (format == "jpeg")) { |
---|
| 292 | |
---|
| 293 | QGroupBox *imageGroupBox = new QGroupBox(tr("Image quality"),this); |
---|
| 294 | QHBoxLayout *hSliderLayout = new QHBoxLayout(imageGroupBox); |
---|
| 295 | hSliderLayout->setMargin (15); |
---|
[651] | 296 | |
---|
[656] | 297 | qualitySlider= new QSlider(Qt::Horizontal,imageGroupBox); |
---|
| 298 | #if QT_VERSION < 0x040000 |
---|
| 299 | qualitySlider->setMinValue(0); |
---|
| 300 | qualitySlider->setMaxValue(100); |
---|
| 301 | qualitySlider->setTickmarks(QSlider::Below); |
---|
| 302 | #else |
---|
| 303 | qualitySlider->setMinimum(0); |
---|
| 304 | qualitySlider->setMaximum(100); |
---|
| 305 | qualitySlider->setTickPosition(QSlider::TicksBelow); |
---|
| 306 | #endif |
---|
| 307 | qualitySlider->setValue(60); |
---|
| 308 | hSliderLayout->addWidget(new QLabel("Low ",imageGroupBox)); |
---|
| 309 | hSliderLayout->addWidget(qualitySlider); |
---|
| 310 | hSliderLayout->addWidget(new QLabel(" Maximum",imageGroupBox)); |
---|
| 311 | |
---|
| 312 | #if QT_VERSION >= 0x040000 |
---|
| 313 | imageGroupBox->setLayout(hSliderLayout); |
---|
| 314 | #endif |
---|
| 315 | |
---|
| 316 | #if QT_VERSION >= 0x040000 |
---|
| 317 | imageGroupBox->setLayout(hSliderLayout); |
---|
| 318 | #endif |
---|
| 319 | |
---|
| 320 | globalVLayout->addWidget(imageGroupBox); |
---|
| 321 | } |
---|
| 322 | |
---|
| 323 | |
---|
[584] | 324 | // button ok/cancel box |
---|
[583] | 325 | |
---|
[641] | 326 | QWidget *buttonBox = new QWidget(this); |
---|
[599] | 327 | |
---|
[641] | 328 | QHBoxLayout *buttonBoxLayout = new QHBoxLayout(buttonBox); |
---|
[583] | 329 | |
---|
[641] | 330 | buttonOk = new QPushButton( tr( "&OK" ),buttonBox ); |
---|
[581] | 331 | buttonOk->setAutoDefault( TRUE ); |
---|
| 332 | buttonOk->setDefault( TRUE ); |
---|
[641] | 333 | buttonBoxLayout->addWidget(buttonOk); |
---|
[581] | 334 | |
---|
[641] | 335 | buttonCancel = new QPushButton( tr( "&Cancel" ),buttonBox ); |
---|
[581] | 336 | buttonCancel->setAutoDefault( TRUE ); |
---|
[641] | 337 | buttonBoxLayout->addWidget(buttonCancel); |
---|
[581] | 338 | |
---|
[599] | 339 | #if QT_VERSION >= 0x040000 |
---|
[641] | 340 | buttonBox->setLayout(buttonBoxLayout); |
---|
[599] | 341 | #endif |
---|
[641] | 342 | globalVLayout->addWidget(buttonBox); |
---|
[581] | 343 | |
---|
| 344 | |
---|
[641] | 345 | |
---|
[599] | 346 | #if QT_VERSION >= 0x040000 |
---|
[583] | 347 | setLayout(globalVLayout); |
---|
[599] | 348 | #endif |
---|
[583] | 349 | |
---|
[581] | 350 | // signals and slots connections |
---|
| 351 | connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); |
---|
| 352 | connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); |
---|
| 353 | } |
---|
| 354 | |
---|
| 355 | |
---|
| 356 | |
---|
[582] | 357 | int G4OpenGLQtExportDialog::getSliderValue() |
---|
| 358 | { |
---|
[593] | 359 | if (!qualitySlider) return -1; |
---|
[582] | 360 | return qualitySlider->value(); |
---|
| 361 | } |
---|
| 362 | |
---|
[585] | 363 | int G4OpenGLQtExportDialog::getHeight() |
---|
| 364 | { |
---|
[652] | 365 | if (!height) return originalHeight; |
---|
[585] | 366 | return height->text().toInt(); |
---|
| 367 | } |
---|
| 368 | |
---|
| 369 | int G4OpenGLQtExportDialog::getWidth() |
---|
| 370 | { |
---|
[652] | 371 | if (!width) return originalWidth; |
---|
[585] | 372 | return width->text().toInt(); |
---|
| 373 | } |
---|
| 374 | |
---|
[593] | 375 | bool G4OpenGLQtExportDialog::getTransparency() |
---|
[586] | 376 | { |
---|
[593] | 377 | if (!boxTransparency) return -1; |
---|
[586] | 378 | return boxTransparency->isChecked(); |
---|
| 379 | } |
---|
[585] | 380 | |
---|
[587] | 381 | int G4OpenGLQtExportDialog::getNbColor() |
---|
[581] | 382 | { |
---|
[637] | 383 | if (!colorButton) return -1; |
---|
[587] | 384 | // Black and white |
---|
[593] | 385 | if (!colorButton->isChecked()) |
---|
[586] | 386 | return 1; |
---|
[587] | 387 | // rgb color |
---|
[586] | 388 | return 3; |
---|
[583] | 389 | } |
---|
[581] | 390 | |
---|
[652] | 391 | bool G4OpenGLQtExportDialog::getVectorEPS() |
---|
| 392 | { |
---|
| 393 | if (!vectorEPSCheckBox) return 0; |
---|
| 394 | return vectorEPSCheckBox->isChecked(); |
---|
| 395 | } |
---|
[586] | 396 | |
---|
[652] | 397 | |
---|
[656] | 398 | void G4OpenGLQtExportDialog::changeVectorEPS() |
---|
| 399 | { |
---|
| 400 | if (!vectorEPSCheckBox) return; |
---|
| 401 | if (vectorEPSCheckBox->isChecked()) { |
---|
| 402 | #if QT_VERSION < 0x040000 |
---|
| 403 | original->setEnabled ( true ); |
---|
| 404 | modify->setEnabled ( true ); |
---|
| 405 | #else |
---|
[657] | 406 | sizeGroupBox->show(); |
---|
[656] | 407 | original->show(); |
---|
| 408 | modify->show(); |
---|
| 409 | #endif |
---|
| 410 | changeSizeBox(); |
---|
| 411 | } else { |
---|
| 412 | #if QT_VERSION < 0x040000 |
---|
| 413 | original->setEnabled ( false ); |
---|
| 414 | modify->setEnabled ( false ); |
---|
| 415 | ratioCheckBox->setEnabled ( false ); |
---|
| 416 | heightWidget->setEnabled ( false ); |
---|
| 417 | widthWidget->setEnabled ( false ); |
---|
| 418 | #else |
---|
[657] | 419 | sizeGroupBox->hide(); |
---|
[656] | 420 | original->hide(); |
---|
| 421 | modify->hide(); |
---|
| 422 | ratioCheckBox->hide(); |
---|
| 423 | heightWidget->hide(); |
---|
| 424 | widthWidget->hide(); |
---|
| 425 | #endif |
---|
| 426 | } |
---|
| 427 | } |
---|
| 428 | |
---|
| 429 | |
---|
[633] | 430 | void G4OpenGLQtExportDialog::changeSizeBox() |
---|
[586] | 431 | { |
---|
[637] | 432 | if (!original) return; |
---|
| 433 | if (!heightWidget) return; |
---|
| 434 | if (!widthWidget) return; |
---|
| 435 | if (!ratioCheckBox) return; |
---|
| 436 | |
---|
[586] | 437 | if ( original->isChecked()) { |
---|
[640] | 438 | #if QT_VERSION < 0x040000 |
---|
| 439 | ratioCheckBox->setEnabled ( false ); |
---|
| 440 | heightWidget->setEnabled ( false ); |
---|
| 441 | widthWidget->setEnabled ( false ); |
---|
| 442 | #else |
---|
| 443 | ratioCheckBox->hide(); |
---|
[599] | 444 | heightWidget->hide(); |
---|
| 445 | widthWidget->hide(); |
---|
[640] | 446 | #endif |
---|
[586] | 447 | } else { |
---|
[640] | 448 | #if QT_VERSION < 0x040000 |
---|
| 449 | ratioCheckBox->setEnabled ( true ); |
---|
| 450 | heightWidget->setEnabled ( true ); |
---|
| 451 | widthWidget->setEnabled ( true ); |
---|
| 452 | #else |
---|
[599] | 453 | heightWidget->show(); |
---|
| 454 | widthWidget->show(); |
---|
| 455 | ratioCheckBox->show(); |
---|
[640] | 456 | #endif |
---|
[586] | 457 | } |
---|
| 458 | } |
---|
| 459 | |
---|
[657] | 460 | |
---|
[584] | 461 | void G4OpenGLQtExportDialog::textWidthChanged( |
---|
| 462 | const QString & s |
---|
| 463 | ) |
---|
[583] | 464 | { |
---|
[637] | 465 | if (!ratioCheckBox) return; |
---|
| 466 | if (!width) return; |
---|
[657] | 467 | if (isChangingSize == true) return; // exclusive slot |
---|
[637] | 468 | |
---|
[584] | 469 | if (ratioCheckBox->isChecked()){ |
---|
[657] | 470 | isChangingSize = true; |
---|
[584] | 471 | QString tmp; |
---|
[657] | 472 | height->setText(tmp.setNum((int)(s.toInt()*(double)((double)originalHeight/(double)originalWidth)))); |
---|
| 473 | isChangingSize = false; |
---|
[584] | 474 | } |
---|
[581] | 475 | } |
---|
| 476 | |
---|
[584] | 477 | void G4OpenGLQtExportDialog:: textHeightChanged( |
---|
| 478 | const QString & s |
---|
| 479 | ) |
---|
| 480 | { |
---|
[637] | 481 | if (!ratioCheckBox) return; |
---|
| 482 | if (!width) return; |
---|
[657] | 483 | if (isChangingSize == true) return; // exclusive slot |
---|
[637] | 484 | |
---|
[584] | 485 | if (ratioCheckBox->isChecked()){ |
---|
[657] | 486 | isChangingSize = true; |
---|
[584] | 487 | QString tmp; |
---|
[656] | 488 | width->setText(tmp.setNum(s.toInt()*originalWidth/originalHeight)); |
---|
[657] | 489 | isChangingSize = false; |
---|
[584] | 490 | } |
---|
| 491 | } |
---|
[581] | 492 | |
---|
| 493 | G4OpenGLQtExportDialog::~G4OpenGLQtExportDialog() |
---|
| 494 | { |
---|
| 495 | } |
---|
| 496 | |
---|
| 497 | |
---|
| 498 | #endif |
---|