Changeset 656 for trunk


Ignore:
Timestamp:
Dec 11, 2007, 5:25:54 PM (17 years ago)
Author:
garnier
Message:

tickets #101 corrige

Location:
trunk/geant4/visualization/OpenGL
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLQtExportDialog.hh

    r652 r656  
    4747
    4848/** The G4OpenGLQtExportDialog class provide a Dialog displaying differents options
    49   for each file format
    50  */
     49    for each file format
     50*/
    5151class G4OpenGLQtExportDialog : public QDialog
    5252{
    5353  Q_OBJECT
    5454
    55 public:
     55 public:
    5656  /** Construct a G4OpenGLQtExportDialog
    5757      @param parent : parent widget
    58       @param name : name of the saved file with extention
    5958      @param format : format of save file in lower case
    6059      @param height : height of the original file
    6160      @param width : width of the original file
    6261  */
    63   G4OpenGLQtExportDialog(QWidget* parent, QString name, QString format, int height =0, int width=0);
     62  G4OpenGLQtExportDialog(QWidget* parent, QString format, int height =0, int width=0);
    6463
    6564  /** Destroys G4OpenGLQtExportDialog */
     
    7069
    7170  /** return the new width for file if format has a width widget, instead return
    72 the original value */
     71      the original value */
    7372  int getWidth();
    7473
    7574  /** return the new height for file if format has a height widget, instead return
    76 the original value  */
     75      the original value  */
    7776  int getHeight();
    7877
     
    8685  bool getVectorEPS();
    8786
    88 public slots:
     87            public slots:
    8988
    90 /** Called by a clic on modify/original size button.This will
    91     invert buttons and hide/unhide size
    92 */
    93   void changeSizeBox(); 
     89            /** Called by a clic on modify/original size button.This will
     90                invert buttons and hide/unhide size
     91            */
     92            void changeSizeBox(); 
     93
     94  /** Called by a clic on vectorEPS check box.If vectorEPS checkBox is checked,
     95      it will enable change size buttons. Else it will disable them.
     96  */
     97  void changeVectorEPS();
    9498
    9599  /** Called by changing value in height lineEdit. If ratio is keep, will also change the width
     
    101105  void textHeightChanged(const QString &);
    102106
    103 private:
     107 private:
    104108  QString f_name, f_type, f_dir;
    105109  QLabel* qualityLabel;
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLQtViewer.hh

    r652 r656  
    132132  void toggleAux(bool);
    133133  void toggleFullScreen(bool);
    134 #if QT_VERSION >= 0x040000
     134  // Only use for Qt>4.0
    135135  void dialogClosed();
    136 #endif
    137136};
    138137
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtExportDialog.cc

    r655 r656  
    5050G4OpenGLQtExportDialog::G4OpenGLQtExportDialog(
    5151 QWidget* parent
    52 ,QString nomFich
    5352,QString format
    5453 ,int aHeight
     
    103102//   }
    104103
     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
    105110  // size box
    106111
     
    231236  globalVLayout->addWidget(sizeWidget);
    232237
    233   if ((format == "jpg") ||
    234       (format == "jpeg")) {
    235    
    236     QGroupBox *imageGroupBox = new QGroupBox(tr("Image quality"),this);
    237     QHBoxLayout *hSliderLayout = new QHBoxLayout(imageGroupBox);
    238     hSliderLayout->setMargin (15);
    239 
    240     qualitySlider= new QSlider(Qt::Horizontal,imageGroupBox);
    241 #if QT_VERSION < 0x040000
    242     qualitySlider->setMinValue(0);
    243     qualitySlider->setMaxValue(100);
    244     qualitySlider->setTickmarks(QSlider::Below);
    245 #else
    246     qualitySlider->setMinimum(0);
    247     qualitySlider->setMaximum(100);
    248     qualitySlider->setTickPosition(QSlider::TicksBelow);
    249 #endif
    250     qualitySlider->setValue(60);
    251     hSliderLayout->addWidget(new QLabel("Low ",imageGroupBox));
    252     hSliderLayout->addWidget(qualitySlider);
    253     hSliderLayout->addWidget(new QLabel(" Maximum",imageGroupBox));
    254    
    255 #if QT_VERSION >= 0x040000
    256     imageGroupBox->setLayout(hSliderLayout);
    257 #endif
    258 
    259 #if QT_VERSION >= 0x040000
    260     imageGroupBox->setLayout(hSliderLayout);
    261 #endif
    262 
    263     globalVLayout->addWidget(imageGroupBox);
    264   }
    265 
    266 
    267   // FIXME : L. Garnier 4/12/07
    268   // This is not working for PS and PDF images, it does nothing.
    269   // Image is staying in color mode
    270   //  if ((format == "ps") || (format == "pdf") || (format == "eps")) {
    271 
    272238 if (format == "eps") {
    273239
    274     QWidget * EPSWidgetGroupBox; // widget containing group button
    275     QVBoxLayout *EPSGroupBoxLayout;
    276 
    277 #if QT_VERSION < 0x040000
     240   QGroupBox *EPSWidgetGroupBox = new QGroupBox(tr("EPS options"),this); // widget containing group button
     241
     242
     243#if QT_VERSION < 0x040000
     244
     245    EPSWidgetGroupBox->setInsideMargin (15);
    278246
    279247    //    QButtonGroup * EPSColorButtonGroupBox = new QButtonGroup( 2,Qt::Vertical, tr("EPS options"),this);
     
    288256
    289257    vectorEPSCheckBox = new QCheckBox( "Vector EPS File",EPSWidgetGroupBox);
    290     EPSWidgetGroupBox->add(vectorEPSCheckBox);
    291 
    292 #else
    293      EPSWidgetGroupBox = new QGroupBox(tr("EPS options"));
    294 //     EPSGroupBoxLayout = new QVBoxLayout(EPSWidgetGroupBox);
    295 //     EPSGroupBoxLayout->setMargin (15);
     258
     259#else
     260    QVBoxLayout * EPSGroupBoxLayout = new QVBoxLayout(EPSWidgetGroupBox);
     261     EPSGroupBoxLayout->setMargin (15);
    296262
    297263//     colorButton = new QRadioButton("Color",EPSWidgetGroupBox);
     
    315281   
    316282    globalVLayout->addWidget(EPSWidgetGroupBox);
    317 
     283    connect( vectorEPSCheckBox, SIGNAL( clicked() ), this, SLOT( changeVectorEPS()) );
     284
     285  }
     286
     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);
     293
     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#if QT_VERSION >= 0x040000
     314    imageGroupBox->setLayout(hSliderLayout);
     315#endif
     316
     317    globalVLayout->addWidget(imageGroupBox);
    318318  }
    319319
     
    393393
    394394
     395void G4OpenGLQtExportDialog::changeVectorEPS()
     396{
     397  if (!vectorEPSCheckBox) return;
     398  if (vectorEPSCheckBox->isChecked()) {
     399#if QT_VERSION < 0x040000
     400    original->setEnabled ( true );
     401    modify->setEnabled ( true );
     402#else
     403    original->show();
     404    modify->show();
     405#endif
     406    changeSizeBox();
     407  } else {
     408#if QT_VERSION < 0x040000
     409    original->setEnabled ( false );
     410    modify->setEnabled ( false );
     411    ratioCheckBox->setEnabled ( false );
     412    heightWidget->setEnabled ( false );
     413    widthWidget->setEnabled ( false );
     414#else
     415    original->hide();
     416    modify->hide();
     417    ratioCheckBox->hide();
     418    heightWidget->hide();
     419    widthWidget->hide();
     420#endif
     421  }
     422}
     423
     424
    395425void G4OpenGLQtExportDialog::changeSizeBox()
    396426{
     
    432462  if (ratioCheckBox->isChecked()){
    433463    QString tmp;
    434     width->setText(tmp.setNum(s.toInt()*originalHeight/originalHeight));
     464    height->setText(tmp.setNum(s.toInt()*originalHeight/originalWidth));
    435465  }
    436466}
     
    445475  if (ratioCheckBox->isChecked()){
    446476    QString tmp;
    447     width->setText(tmp.setNum(s.toInt()*originalWidth/originalWidth));
     477    width->setText(tmp.setNum(s.toInt()*originalWidth/originalHeight));
    448478  }
    449479}
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc

    r655 r656  
    10871087  QString format = selectedFormat->toLower();
    10881088#endif
    1089   G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(GLWindow,nomFich,format,fWindow->height(),fWindow->width());
     1089  G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(GLWindow,format,fWindow->height(),fWindow->width());
    10901090  if(  exportDialog->exec()) {
    10911091
     
    11511151    } else {
    11521152#if QT_VERSION < 0x040000
    1153       G4cerr << "File "<<nomFich.ascii()<<" saved \n" << G4endl;
    1154 #else
    1155       G4cerr << "File "<<nomFich.toStdString().c_str()<<" saved \n" << G4endl;
     1153      G4cout << "File "<<nomFich.ascii()<<" has been saved \n" << G4endl;
     1154#else
     1155      G4cout << "File "<<nomFich.toStdString().c_str()<<" has been saved \n" << G4endl;
    11561156#endif
    11571157    }
     
    13261326  glRenderMode (GL_FEEDBACK);
    13271327 
    1328 #ifdef GEANT4_QT_DEBUG
    1329   printf("generateVectorEPS::  AVANt DRAWVIEW !!======================== \n");
    1330 #endif
    13311328  glViewport (0, 0, aWidth,aHeight);
    13321329  DrawView();
    13331330
    1334 #ifdef GEANT4_QT_DEBUG
    1335   printf("generateVectorEPS::  APREs DRAWVIEW !!======================== \n");
    1336 #endif
    13371331  returned = glRenderMode (GL_RENDER);
    13381332 
Note: See TracChangeset for help on using the changeset viewer.