Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/visualization/OpenGL/src/G4OpenGLQtExportDialog.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /visualization/OpenGL/src/G4OpenGLQtExportDialog.cc (Version 11.3.0) and /visualization/OpenGL/src/G4OpenGLQtExportDialog.cc (Version 9.1.p2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
                                                   >>  27 // $Id: G4OpenGLQtExportDialog.cc,v 1.4 2007/11/13 17:48:51 lgarnier Exp $
                                                   >>  28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
 27 //                                                 29 //
 28 //                                             <<  30 // 
                                                   >>  31 
                                                   >>  32 #ifdef G4VIS_BUILD_OPENGLQT_DRIVER
 29                                                    33 
 30 #include "G4OpenGLQtExportDialog.hh"               34 #include "G4OpenGLQtExportDialog.hh"
 31                                                    35 
 32 #include <qvariant.h>                              36 #include <qvariant.h>
 33 #include <qpushbutton.h>                           37 #include <qpushbutton.h>
 34 #include <qcheckbox.h>                             38 #include <qcheckbox.h>
 35 #include <qlabel.h>                                39 #include <qlabel.h>
 36 #include <qcombobox.h>                             40 #include <qcombobox.h>
 37 #include <qslider.h>                               41 #include <qslider.h>
 38 #include <qlayout.h>                               42 #include <qlayout.h>
 39 #include <qgroupbox.h>                             43 #include <qgroupbox.h>
 40 #include <qradiobutton.h>                          44 #include <qradiobutton.h>
 41 #include <qimage.h>                                45 #include <qimage.h>
 42 #include <qlineedit.h>                             46 #include <qlineedit.h>
 43 #include <qbuttongroup.h>                      << 
 44                                                << 
 45 #ifndef G4GMAKE                                << 
 46 #include "moc_G4OpenGLQtExportDialog.cpp"      << 
 47 #endif                                         << 
 48                                                    47 
 49 G4OpenGLQtExportDialog::G4OpenGLQtExportDialog     48 G4OpenGLQtExportDialog::G4OpenGLQtExportDialog(
 50  QWidget* parentw                              <<  49  QWidget* parent
 51 ,QString format                                <<  50 ,QString nomFich
 52  ,int aHeight                                      51  ,int aHeight
 53  ,int aWidth                                       52  ,int aWidth
 54 )                                                  53 )
 55   : QDialog( parentw ),                        <<  54   : QDialog( parent )
 56     isChangingSize(false)                      << 
 57 {                                                  55 {
                                                   >>  56 #if QT_VERSION < 0x040000
                                                   >>  57   setCaption( tr( " Export options" ));
                                                   >>  58 #else
 58   setWindowTitle( tr( " Export options" ));        59   setWindowTitle( tr( " Export options" ));
                                                   >>  60 #endif
 59   originalWidth = aWidth;                          61   originalWidth = aWidth;
 60   originalHeight = aHeight;                        62   originalHeight = aHeight;
 61                                                    63 
 62   // Initializations                               64   // Initializations
 63   vectorEPSCheckBox = NULL;                    << 
 64   qualitySlider = NULL;                            65   qualitySlider = NULL;
 65   width = NULL;                                    66   width = NULL;
 66   height = NULL;                                   67   height = NULL;
 67   colorButton = NULL;                              68   colorButton = NULL;
 68   BWButton = NULL;                                 69   BWButton = NULL;
 69                                                    70 
 70   // global layout                                 71   // global layout
                                                   >>  72 #if QT_VERSION < 0x040000
 71   QVBoxLayout* globalVLayout = new QVBoxLayout     73   QVBoxLayout* globalVLayout = new QVBoxLayout(this);
 72   globalVLayout->setContentsMargins(10,10,10,1 <<  74 #else
 73   globalVLayout->setSpacing(10);               <<  75   QVBoxLayout* globalVLayout = new QVBoxLayout();
                                                   >>  76 #endif
 74                                                    77 
                                                   >>  78   
                                                   >>  79   if (nomFich.endsWith(".jpg") || 
                                                   >>  80       nomFich.endsWith(".jepg")) {
                                                   >>  81     
                                                   >>  82     QGroupBox *imageGroupBox = new QGroupBox(tr("Image quality"));
                                                   >>  83 #if QT_VERSION < 0x040000
                                                   >>  84     QVBoxLayout *imageGroupBoxLayout = new QVBoxLayout(imageGroupBox);
                                                   >>  85 #else
                                                   >>  86     QVBoxLayout *imageGroupBoxLayout = new QVBoxLayout;
                                                   >>  87 #endif
                                                   >>  88     QWidget *sliderBox = new QWidget;
 75                                                    89 
                                                   >>  90 #if QT_VERSION < 0x040000
                                                   >>  91     QHBoxLayout *hSlider = new QHBoxLayout(sliderBox);
                                                   >>  92 #else
                                                   >>  93     QHBoxLayout *hSlider = new QHBoxLayout;
                                                   >>  94 #endif
 76                                                    95 
                                                   >>  96     //    qualityLabel =  new QLabel( tr( "Image quality" ) );
                                                   >>  97     //    imageGroupBoxLayout->addWidget(qualityLabel);
                                                   >>  98     qualitySlider= new QSlider(Qt::Horizontal,0);
                                                   >>  99 #if QT_VERSION < 0x040000
                                                   >> 100     qualitySlider->setMinValue(0);
                                                   >> 101     qualitySlider->setMaxValue(100);
                                                   >> 102     qualitySlider->setTickmarks(QSlider::Below); 
                                                   >> 103 #else
                                                   >> 104     qualitySlider->setMinimum(0);
                                                   >> 105     qualitySlider->setMaximum(100);
                                                   >> 106     qualitySlider->setTickPosition(QSlider::TicksBelow);
                                                   >> 107 #endif
                                                   >> 108     qualitySlider->setValue(60);
                                                   >> 109     hSlider->addWidget(new QLabel("low",0));
                                                   >> 110     hSlider->addWidget(qualitySlider);
                                                   >> 111     hSlider->addWidget(new QLabel("Maximum",0));
                                                   >> 112 #if QT_VERSION >= 0x040000
                                                   >> 113     sliderBox->setLayout(hSlider);
                                                   >> 114 #endif
                                                   >> 115     imageGroupBoxLayout->addWidget(sliderBox);
 77                                                   116 
 78   // size box                                  << 117 #if QT_VERSION >= 0x040000
                                                   >> 118     imageGroupBox->setLayout(imageGroupBoxLayout);
                                                   >> 119 #endif
                                                   >> 120     globalVLayout->addWidget(imageGroupBox);
                                                   >> 121   }
                                                   >> 122   
                                                   >> 123   if(nomFich.endsWith(".eps")) {
                                                   >> 124     QGroupBox *EPSGroupBox = new QGroupBox(tr("EPS options"));
                                                   >> 125 
                                                   >> 126 #if QT_VERSION < 0x040000
                                                   >> 127     QVBoxLayout *EPSGroupBoxLayout = new QVBoxLayout(EPSGroupBox);
                                                   >> 128 #else
                                                   >> 129     QVBoxLayout *EPSGroupBoxLayout = new QVBoxLayout;
                                                   >> 130 #endif
 79                                                   131 
 80   QWidget * sizeWidget = new QWidget(this); // << 132     //    transparencyEPS = new QCheckBox( "transparencyEPS" );
 81   QVBoxLayout * sizeWidgetLayout = new QVBoxLa << 133     //    transparencyEPS->setText( "save background" );
 82   sizeWidgetLayout->setContentsMargins(10,10,1 << 134     //    transparencyEPS->setChecked( true );
                                                   >> 135 
                                                   >> 136     colorButton = new QRadioButton("Color",0);
                                                   >> 137     BWButton = new QRadioButton("Grayscale",0);
                                                   >> 138     colorButton->setChecked( true );
                                                   >> 139     BWButton->setChecked( false );
 83                                                   140 
 84   // original and modify radiobuttons          << 
 85                                                   141 
 86   sizeGroupBox = new QGroupBox(tr("Size"));    << 142     //    EPSGroupBoxLayout->addWidget(transparencyEPS);    
 87   QVBoxLayout *sizeGroupBoxLayout = new QVBoxL << 143     EPSGroupBoxLayout->addWidget(colorButton);    
 88   QButtonGroup * sizeButtonGroupBox = new QBut << 144     EPSGroupBoxLayout->addWidget(BWButton);    
 89   sizeGroupBoxLayout->setContentsMargins(15,15 << 145 #if QT_VERSION >= 0x040000
                                                   >> 146     EPSGroupBox->setLayout(EPSGroupBoxLayout);
                                                   >> 147 #endif
                                                   >> 148     globalVLayout->addWidget(EPSGroupBox);
 90                                                   149 
 91   original = new QRadioButton("Original");     << 150   }
 92   modify = new QRadioButton("Modify");         << 
 93                                                   151 
 94   sizeButtonGroupBox->addButton(original);     << 152   if(nomFich.endsWith(".tif") ||
 95   sizeButtonGroupBox->addButton(modify);       << 153      nomFich.endsWith(".tiff") ||
 96   sizeButtonGroupBox->setExclusive(true);      << 154      nomFich.endsWith(".jpg") ||
                                                   >> 155      nomFich.endsWith(".png") ||
                                                   >> 156      nomFich.endsWith(".xpm")) {
                                                   >> 157 
                                                   >> 158     QGroupBox *transparencyGroupBox = new QGroupBox(tr("Transparency"));
                                                   >> 159 #if QT_VERSION < 0x040000
                                                   >> 160     QVBoxLayout *transparencyGroupBoxLayout = new QVBoxLayout(transparencyGroupBox);
                                                   >> 161 #else
                                                   >> 162     QVBoxLayout *transparencyGroupBoxLayout = new QVBoxLayout;
                                                   >> 163 #endif
 97                                                   164 
 98   sizeGroupBoxLayout->addWidget(original);     << 165     boxTransparency = new QCheckBox("Save transparency",0);
 99   sizeGroupBoxLayout->addWidget(modify);       << 166     boxTransparency->setChecked( false );
                                                   >> 167     //    boxTransparency->setEnabled(false);
                                                   >> 168 
                                                   >> 169     transparencyGroupBoxLayout->addWidget(boxTransparency);    
                                                   >> 170 #if QT_VERSION >= 0x040000
                                                   >> 171     transparencyGroupBox->setLayout(transparencyGroupBoxLayout);
                                                   >> 172 #endif
                                                   >> 173     globalVLayout->addWidget(transparencyGroupBox);
100                                                   174 
101   sizeGroupBox->setLayout(sizeGroupBoxLayout); << 175   }
102   sizeWidgetLayout->addWidget(sizeGroupBox);   << 176 
                                                   >> 177   // size box
                                                   >> 178   QGroupBox *sizeGroupBox = new QGroupBox(tr("Size"));
                                                   >> 179   QWidget* modifyAndRatioWidget = new QWidget;
103                                                   180 
104   connect( sizeButtonGroupBox, SIGNAL( buttonC << 181 #if QT_VERSION < 0x040000
                                                   >> 182   QHBoxLayout *modifyAndRatioLayout = new QHBoxLayout(modifyAndRatioWidget);
                                                   >> 183   QVBoxLayout *sizeGroupBoxLayout = new QVBoxLayout(sizeGroupBox);
                                                   >> 184 #else
                                                   >> 185   QHBoxLayout *modifyAndRatioLayout = new QHBoxLayout;
                                                   >> 186   QVBoxLayout *sizeGroupBoxLayout = new QVBoxLayout;
                                                   >> 187 #endif
                                                   >> 188 
                                                   >> 189   // original button
                                                   >> 190   original = new QRadioButton("Original",0);
105   original->setChecked( true );                   191   original->setChecked( true );
                                                   >> 192   sizeGroupBoxLayout->addWidget(original);
                                                   >> 193 
                                                   >> 194   // modify and ratio
                                                   >> 195   modify = new QRadioButton("Modify",0);
                                                   >> 196   modify->setChecked( false );
                                                   >> 197 
                                                   >> 198   ratioCheckBox = new QCheckBox( "Keep ratio",0 );
                                                   >> 199   ratioCheckBox->setChecked( true );
                                                   >> 200 
                                                   >> 201   modifyAndRatioLayout->addWidget(modify);
                                                   >> 202   modifyAndRatioLayout->addWidget(ratioCheckBox);
                                                   >> 203 #if QT_VERSION >= 0x040000
                                                   >> 204   modifyAndRatioWidget->setLayout(modifyAndRatioLayout);
                                                   >> 205 #endif
                                                   >> 206   sizeGroupBoxLayout->addWidget(modifyAndRatioWidget);
                                                   >> 207   if (modify->isChecked()) {
                                                   >> 208     ratioCheckBox->show();
                                                   >> 209   } else {
                                                   >> 210     ratioCheckBox->hide();
                                                   >> 211   }
106                                                   212 
                                                   >> 213   connect( original, SIGNAL( clicked(bool) ), this, SLOT( changeSizeBox(true)) );
                                                   >> 214   connect( modify, SIGNAL( clicked(bool) ), this, SLOT( changeSizeBox(false) ) );
107                                                   215 
108   // height                                       216   // height
109   heightWidget = new QWidget(sizeWidget);      << 217   heightWidget = new QWidget;
110                                                   218 
                                                   >> 219 #if QT_VERSION < 0x040000
111   QHBoxLayout *heightLineLayout = new QHBoxLay    220   QHBoxLayout *heightLineLayout = new QHBoxLayout(heightWidget);
                                                   >> 221 #else
                                                   >> 222   QHBoxLayout *heightLineLayout = new QHBoxLayout;
                                                   >> 223 #endif
112                                                   224 
113   QString tmp;                                    225   QString tmp;
114                                                << 226  
115   heightLineLayout->addWidget(new QLabel("Heig << 227   heightLineLayout->addWidget(new QLabel("Height",0));
116   height = new QLineEdit(tmp.setNum(originalHe << 228   height = new QLineEdit(tmp.setNum(originalHeight),0);
117   height->setMaxLength(5);                        229   height->setMaxLength(5);
118   heightLineLayout->addWidget(height);            230   heightLineLayout->addWidget(height);
119                                                << 231 #if QT_VERSION >= 0x040000
120   heightWidget->setLayout(heightLineLayout);      232   heightWidget->setLayout(heightLineLayout);
121                                                << 233 #endif
122   sizeWidgetLayout->addWidget(heightWidget);   << 234   sizeGroupBoxLayout->addWidget(heightWidget);
123   connect( height, SIGNAL( textChanged ( const    235   connect( height, SIGNAL( textChanged ( const QString& ) ), this, SLOT( textHeightChanged(const QString &) ) );
124                                                   236 
125                                                   237 
126   // width                                        238   // width
127   widthWidget = new QWidget(sizeWidget);       << 239   widthWidget = new QWidget;
128                                                   240 
                                                   >> 241 #if QT_VERSION < 0x040000
129   QHBoxLayout *widthLineLayout = new QHBoxLayo    242   QHBoxLayout *widthLineLayout = new QHBoxLayout(widthWidget);
                                                   >> 243 #else
                                                   >> 244   QHBoxLayout *widthLineLayout = new QHBoxLayout;
                                                   >> 245 #endif
130                                                   246 
131   widthLineLayout->addWidget(new QLabel("Width << 247   widthLineLayout->addWidget(new QLabel("Width ",0));
132   width = new QLineEdit(tmp.setNum(originalWid << 248   width = new QLineEdit(tmp.setNum(originalWidth),0);
133   width->setMaxLength(5);                         249   width->setMaxLength(5);
134   widthLineLayout->addWidget(width);              250   widthLineLayout->addWidget(width);
                                                   >> 251 #if QT_VERSION >= 0x040000
135   widthWidget->setLayout(widthLineLayout);        252   widthWidget->setLayout(widthLineLayout);
136   sizeWidgetLayout->addWidget(widthWidget);    << 253 #endif
                                                   >> 254   sizeGroupBoxLayout->addWidget(widthWidget);
137   connect( width, SIGNAL( textChanged ( const     255   connect( width, SIGNAL( textChanged ( const QString& ) ), this, SLOT( textWidthChanged(const QString &) ) );
138                                                   256 
                                                   >> 257 #if QT_VERSION >= 0x040000
                                                   >> 258   sizeGroupBox->setLayout(sizeGroupBoxLayout);
                                                   >> 259 #endif
                                                   >> 260   globalVLayout->addWidget(sizeGroupBox);
139                                                   261 
140                                                << 
141   // ratio check box                           << 
142                                                << 
143   ratioCheckBox = new QCheckBox( "Keep ratio", << 
144   ratioCheckBox->setChecked( true );           << 
145                                                << 
146   sizeWidgetLayout->addWidget(ratioCheckBox);  << 
147                                                << 
148   ratioCheckBox->hide();                       << 
149   heightWidget->hide();                           262   heightWidget->hide();
150   widthWidget->hide();                            263   widthWidget->hide();
151                                                   264 
152   sizeWidget->setLayout(sizeWidgetLayout);     << 
153   globalVLayout->addWidget(sizeWidget);        << 
154                                                << 
155  if (format == "eps") {                        << 
156                                                << 
157    QGroupBox *EPSWidgetGroupBox = new QGroupBo << 
158                                                << 
159                                                << 
160     QVBoxLayout * EPSGroupBoxLayout = new QVBo << 
161      EPSGroupBoxLayout->setContentsMargins(15, << 
162                                                << 
163 //     colorButton = new QRadioButton("Color", << 
164 //     BWButton = new QRadioButton("Grayscale" << 
165                                                << 
166 //     QButtonGroup * EPSColorButtonGroupBox = << 
167 //     EPSColorButtonGroupBox->addButton(color << 
168 //     EPSColorButtonGroupBox->addButton(BWBut << 
169 //     EPSColorButtonGroupBox->setExclusive(tr << 
170                                                << 
171 //     EPSGroupBoxLayout->addWidget(colorButto << 
172 //     EPSGroupBoxLayout->addWidget(BWButton); << 
173                                                << 
174     vectorEPSCheckBox = new QCheckBox( "Vector << 
175     EPSGroupBoxLayout->addWidget(vectorEPSChec << 
176                                                << 
177     EPSWidgetGroupBox->setLayout(EPSGroupBoxLa << 
178     //    colorButton->setChecked( true );     << 
179     vectorEPSCheckBox->setChecked( true );     << 
180                                                << 
181     globalVLayout->addWidget(EPSWidgetGroupBox << 
182     connect( vectorEPSCheckBox, SIGNAL( clicke << 
183                                                << 
184   }                                            << 
185                                                << 
186   if ((format == "jpg") ||                     << 
187       (format == "jpeg")) {                    << 
188                                                << 
189     QGroupBox *imageGroupBox = new QGroupBox(t << 
190     QHBoxLayout *hSliderLayout = new QHBoxLayo << 
191     hSliderLayout->setContentsMargins(15,15,15 << 
192                                                << 
193     qualitySlider= new QSlider(Qt::Horizontal, << 
194     qualitySlider->setMinimum(0);              << 
195     qualitySlider->setMaximum(100);            << 
196     qualitySlider->setTickPosition(QSlider::Ti << 
197     qualitySlider->setValue(60);               << 
198     hSliderLayout->addWidget(new QLabel("Low " << 
199     hSliderLayout->addWidget(qualitySlider);   << 
200     hSliderLayout->addWidget(new QLabel(" Maxi << 
201                                                << 
202     imageGroupBox->setLayout(hSliderLayout);   << 
203                                                << 
204     globalVLayout->addWidget(imageGroupBox);   << 
205   }                                            << 
206                                                << 
207                                                << 
208   // button ok/cancel box                         265   // button ok/cancel box
209                                                   266 
210   QWidget *buttonBox = new QWidget(this);      << 267   QGroupBox *buttonGroupBox = new QGroupBox();
211                                                << 
212   QHBoxLayout *buttonBoxLayout = new QHBoxLayo << 
213                                                   268 
214   buttonOk = new QPushButton( tr( "&OK" ),butt << 269 #if QT_VERSION < 0x040000
215   buttonOk->setAutoDefault( true );            << 270   QHBoxLayout *buttonGroupBoxLayout = new QHBoxLayout(buttonGroupBox);
216   buttonOk->setDefault( true );                << 271 #else
217   buttonBoxLayout->addWidget(buttonOk);        << 272   QHBoxLayout *buttonGroupBoxLayout = new QHBoxLayout;
218                                                << 273 #endif
219   buttonCancel = new QPushButton( tr( "&Cancel << 
220   buttonCancel->setAutoDefault( true );        << 
221   buttonBoxLayout->addWidget(buttonCancel);    << 
222                                                   274 
223   buttonBox->setLayout(buttonBoxLayout);       << 275   buttonOk = new QPushButton( tr( "&OK" ),0 );
224   globalVLayout->addWidget(buttonBox);         << 276   buttonOk->setAutoDefault( TRUE );
                                                   >> 277   buttonOk->setDefault( TRUE );
                                                   >> 278   buttonGroupBoxLayout->addWidget(buttonOk);
                                                   >> 279 
                                                   >> 280   buttonCancel = new QPushButton( tr( "&Cancel" ),0 );
                                                   >> 281   buttonCancel->setAutoDefault( TRUE );
                                                   >> 282   buttonGroupBoxLayout->addWidget(buttonCancel);
225                                                   283 
                                                   >> 284 #if QT_VERSION >= 0x040000
                                                   >> 285   buttonGroupBox->setLayout(buttonGroupBoxLayout);
                                                   >> 286 #endif
                                                   >> 287   globalVLayout->addWidget(buttonGroupBox);
226                                                   288 
227                                                   289 
                                                   >> 290 #if QT_VERSION >= 0x040000
228   setLayout(globalVLayout);                       291   setLayout(globalVLayout);
                                                   >> 292 #endif
229                                                   293 
230   // signals and slots connections                294   // signals and slots connections
231   connect( buttonOk, SIGNAL( clicked() ), this    295   connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
232   connect( buttonCancel, SIGNAL( clicked() ),     296   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
233 }                                                 297 }
234                                                   298 
235                                                   299 
236                                                   300 
237 int G4OpenGLQtExportDialog::getSliderValue()      301 int G4OpenGLQtExportDialog::getSliderValue()
238 {                                                 302 {
239   if (!qualitySlider) return -1;                  303   if (!qualitySlider) return -1;
240   return qualitySlider->value();                  304   return qualitySlider->value();
241 }                                                 305 }
242                                                   306 
243 int G4OpenGLQtExportDialog::getHeight()           307 int G4OpenGLQtExportDialog::getHeight()
244 {                                                 308 {
245   if (!height) return originalHeight;          << 309   if (!height) return -1;
246   return height->text().toInt();                  310   return height->text().toInt();
247 }                                                 311 }
248                                                   312 
249 int G4OpenGLQtExportDialog::getWidth()            313 int G4OpenGLQtExportDialog::getWidth()
250 {                                                 314 {
251   if (!width) return originalWidth;            << 315   if (!width) return -1;
252   return width->text().toInt();                   316   return width->text().toInt();
253 }                                                 317 }
254                                                   318 
255 bool G4OpenGLQtExportDialog::getVectorEPS()    << 319 bool G4OpenGLQtExportDialog::getTransparency()
256 {                                                 320 {
257   if (!vectorEPSCheckBox) return 0;            << 321   if (!boxTransparency) return -1;
258   return vectorEPSCheckBox->isChecked();       << 322   return boxTransparency->isChecked();
259 }                                                 323 }
260                                                   324 
261                                                << 325 int G4OpenGLQtExportDialog::getNbColor()
262 void G4OpenGLQtExportDialog::changeVectorEPS() << 
263 {                                                 326 {
264   if (!vectorEPSCheckBox) return;              << 327   // Black and white
265   if (vectorEPSCheckBox->isChecked()) {        << 328   if (!colorButton->isChecked())
266     sizeGroupBox->show();                      << 329     return 1;
267     original->show();                          << 330   // rgb color
268     modify->show();                            << 331   return 3;
269     changeSizeBox();                           << 
270   } else {                                     << 
271     sizeGroupBox->hide();                      << 
272     original->hide();                          << 
273     modify->hide();                            << 
274     ratioCheckBox->hide();                     << 
275     heightWidget->hide();                      << 
276     widthWidget->hide();                       << 
277   }                                            << 
278 }                                                 332 }
279                                                   333 
280                                                   334 
281 void G4OpenGLQtExportDialog::changeSizeBox()   << 335 void G4OpenGLQtExportDialog::changeSizeBox(bool aClick)
282 {                                                 336 {
283   if (!original) return;                       << 337   if (aClick) {
284   if (!heightWidget) return;                   << 338     modify->toggle();
285   if (!widthWidget) return;                    << 339   } else {
286   if (!ratioCheckBox) return;                  << 340     original->toggle();
287                                                << 341   }
288   if ( original->isChecked()) {                   342   if ( original->isChecked()) {
289     ratioCheckBox->hide();                     << 
290     heightWidget->hide();                         343     heightWidget->hide();
291     widthWidget->hide();                          344     widthWidget->hide();
                                                   >> 345     ratioCheckBox->hide();
292   } else {                                        346   } else {
293     heightWidget->show();                         347     heightWidget->show();
294     widthWidget->show();                          348     widthWidget->show();
295     ratioCheckBox->show();                        349     ratioCheckBox->show();
296   }                                               350   }
297 }                                                 351 }
298                                                   352 
299                                                << 
300 void G4OpenGLQtExportDialog::textWidthChanged(    353 void G4OpenGLQtExportDialog::textWidthChanged(
301  const QString & s                                354  const QString & s
302  )                                                355  )
303 {                                                 356 {
304   if (!ratioCheckBox) return;                  << 
305   if (!width) return;                          << 
306   if (isChangingSize == true) return; // exclu << 
307                                                << 
308   if (ratioCheckBox->isChecked()){                357   if (ratioCheckBox->isChecked()){
309     isChangingSize = true;                     << 
310     QString tmp;                                  358     QString tmp;
311   height->setText(tmp.setNum((int)(s.toInt()*( << 359     width->setText(tmp.setNum(s.toInt()*originalHeight/originalHeight));
312   isChangingSize = false;                      << 
313   }                                               360   }
314 }                                                 361 }
315                                                   362 
316 void G4OpenGLQtExportDialog::  textHeightChang    363 void G4OpenGLQtExportDialog::  textHeightChanged(
317  const QString & s                                364  const QString & s
318 )                                                 365 )
319 {                                                 366 {
320   if (!ratioCheckBox) return;                  << 
321   if (!width) return;                          << 
322   if (isChangingSize == true) return; // exclu << 
323                                                << 
324   if (ratioCheckBox->isChecked()){                367   if (ratioCheckBox->isChecked()){
325   isChangingSize = true;                       << 
326     QString tmp;                                  368     QString tmp;
327     width->setText(tmp.setNum(s.toInt()*origin << 369     width->setText(tmp.setNum(s.toInt()*originalWidth/originalWidth));
328   isChangingSize = false;                      << 
329   }                                               370   }
330 }                                              << 371 } 
331                                                   372 
332 G4OpenGLQtExportDialog::~G4OpenGLQtExportDialo    373 G4OpenGLQtExportDialog::~G4OpenGLQtExportDialog()
333 {                                                 374 {
334 }                                                 375 }
                                                   >> 376 
                                                   >> 377 
                                                   >> 378 #endif
335                                                   379