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