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