Ignore:
Timestamp:
Sep 26, 2007, 12:17:26 PM (17 years ago)
Author:
garnier
Message:

r610@mac-90108: laurentgarnier | 2007-09-25 16:54:15 +0200
boite de dialogue presque ok, reste plus qu a connecter

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

Legend:

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

    r584 r585  
    5656
    5757  int getSliderValue();
     58  int getWidth();
     59  int getHeight();
    5860
    5961public slots:
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLQtViewer.hh

    r579 r585  
    7878  void createPopupMenu();
    7979  void createRadioAction(QAction *,QAction *, const std::string&,unsigned int a=1);
     80  void rescaleImage(int, int);
    8081 
    8182  QMenu *fContextMenu;
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtExportDialog.cc

    r584 r585  
    5757  originalWidth = aWidth;
    5858  originalHeight = aHeight;
    59   printf("height %d width %d\n",aHeight,aWidth); 
    6059
    6160  // global layout
     
    6362
    6463 
    65   if(nomFich.endsWith(".jpg")) {
     64  if (nomFich.endsWith(".jpg") ||
     65      nomFich.endsWith(".jepg")) {
    6666   
    6767    QGroupBox *imageGroupBox = new QGroupBox(tr("Image quality"));
     
    101101    BW->setChecked( false );
    102102   
    103     connect( color, SIGNAL( clicked() ), BW, SLOT( toggle() ) );
    104     connect( BW, SIGNAL( clicked() ), color, SLOT( toggle() ) );
     103    connect( color, SIGNAL( toggled(bool) ), BW, SLOT( setChecked(bool) ) );
     104    connect( BW, SIGNAL( toggled(bool) ), color, SLOT( setChecked(bool) ) );
    105105
    106106
     
    157157  ratioCheckBox->setVisible(modify->isChecked());
    158158
    159   connect( original, SIGNAL( clicked() ), modify, SLOT( toogle() ) );
    160   connect( modify, SIGNAL( clicked() ), original, SLOT( toogle() ) );
     159  connect( original, SIGNAL( toggled(bool) ), modify, SLOT( setChecked(bool) ) );
     160  connect( modify, SIGNAL( toggled(bool) ), original, SLOT( setChecked(bool) ) );
    161161  connect( modify, SIGNAL( toggled(bool) ), this, SLOT( changeSizeBox(bool) ) );
    162162
     
    179179  widthWidget = new QWidget;
    180180
    181   widthLineLayout->addWidget(new QLabel("Width"));
     181  widthLineLayout->addWidget(new QLabel("Width "));
    182182  width = new QLineEdit(tmp.setNum(originalWidth));
    183183  width->setMaxLength(5);
     
    225225}
    226226
     227int G4OpenGLQtExportDialog::getHeight()
     228{
     229  return height->text().toInt();
     230}
     231
     232int G4OpenGLQtExportDialog::getWidth()
     233{
     234  return width->text().toInt();
     235}
     236
     237
    227238void G4OpenGLQtExportDialog::changeSizeBox(bool aChange)
    228239{
     
    236247 )
    237248{
    238   printf("new Width : %s\n",s.toStdString().c_str());
    239249  if (ratioCheckBox->isChecked()){
    240250    QString tmp;
     
    247257)
    248258{
    249   printf("new Height : %s\n",s.toStdString().c_str());
    250259  if (ratioCheckBox->isChecked()){
    251260    QString tmp;
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc

    r583 r585  
    116116//////////////////////////////////////////////////////////////////////////////
    117117void G4OpenGLQtViewer::CreateMainWindow (
    118                                          QGLWidget* glWidget
    119                                          )
     118 QGLWidget* glWidget
     119)
    120120//////////////////////////////////////////////////////////////////////////////
    121121//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
     
    676676  nomFich += "."+selectedFilter->toLower();
    677677  printf("G4OpenGLQtViewer::name %s\n",nomFich.toStdString().c_str());
    678   if(nomFich.endsWith(".eps")) {
    679     G4cerr << "This version of G4UI Could not generate EPS." << G4endl;
    680   } else if(nomFich.endsWith(".jpg") || nomFich.endsWith(".jpeg")) {
    681     G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(GLWindow,nomFich,fWindow->height(),fWindow->width());
    682     int res = exportDialog->exec();
    683     printf("G4OpenGLQtViewer::actionCreateEPS() --%d-- quality:\n",res);
    684     fWindow->grabFrameBuffer().save(nomFich);
    685   } else {
    686     fWindow->grabFrameBuffer().save(nomFich);
    687     // grabFrameBuffer() :: Returns an image of the frame buffer. If withAlpha is true the alpha channel is included.
     678  G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(GLWindow,nomFich,fWindow->height(),fWindow->width());
     679  if(  exportDialog->exec()) {
     680   
     681    printf("rescaling before\n");
     682    QPixmap * pixmap = new QPixmap(fWindow->renderPixmap (exportDialog->getWidth(),exportDialog->getHeight() )) ;//fWindow->grabFrameBuffer();
     683    printf("rescaling after\n");
     684     
     685    if ((exportDialog->getWidth() !=fWindow->width()) ||
     686         (exportDialog->getWidth() !=fWindow->width())) {
     687
     688      //      rescaleImage(exportDialog->getWidth(),exportDialog->getHeight());// re-scale image
     689      printf("rescaling\n");
     690    }
     691   
     692    // jpeg format
     693    if (nomFich.endsWith(".jpg") ||
     694        nomFich.endsWith(".jpeg")) {
     695      // grabFrameBuffer() :: Returns an image of the frame buffer. If withAlpha is true the alpha channel is included.
     696      pixmap->save(nomFich,0,exportDialog->getSliderValue());
     697      printf("saving jpeg quality : %d\n",exportDialog->getSliderValue());
     698    } else if (nomFich.endsWith(".eps")) {
     699      printf("saving EPS\n");
     700    } else if (nomFich.endsWith(".tif") ||
     701               nomFich.endsWith(".tiff") ||
     702               nomFich.endsWith(".jpg") ||
     703               nomFich.endsWith(".png") ||
     704               nomFich.endsWith(".bmp") ||
     705               nomFich.endsWith(".xpm")) {
     706      pixmap->save(nomFich,0,exportDialog->getSliderValue());
     707      printf("saving ELSE\n");
     708    } else {
     709      G4cerr << "This version of G4UI Could not generate the selected format" << G4endl;
     710    }
     711   
     712  } else { // cancel selected
     713    return;
    688714  }
    689715 
     
    910936}
    911937
    912 
     938void G4OpenGLQtViewer::rescaleImage(
     939 int aWidth
     940,int aHeight
     941){
     942  printf("");
     943}
    913944#endif
Note: See TracChangeset for help on using the changeset viewer.