source: trunk/geant4/visualization/OpenGL/src/G4OpenGLQtExportDialog.cc @ 582

Last change on this file since 582 was 582, checked in by garnier, 17 years ago

r605@mac-90108: laurentgarnier | 2007-09-21 15:20:26 +0200
ajout de la boite de dialog a l export des fichiers. En test

  • Property svn:mime-type set to text/cpp
File size: 4.7 KB
Line 
1//
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//
27// $Id: G4OpenGLQtExportDialog.cc,v 0.1 2007/09/20 15:18:20 garnier $
28// GEANT4 tag $Name: geant4-08-02-patch-01 $
29//
30//
31
32#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
33
34#include "G4OpenGLQtExportDialog.hh"
35
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 <qimage.h>
45
46G4OpenGLQtExportDialog::G4OpenGLQtExportDialog(
47 QWidget* parent
48,QString nomFich )
49  : QDialog( parent )
50{
51  setWindowTitle( tr( " Export options" ));
52 
53  QGroupBox *groupBox1 = new QGroupBox(tr("Image quality"));
54  QVBoxLayout *vbox1 = new QVBoxLayout;
55 
56  if(nomFich.endsWith(".jpg")) {
57   
58    QWidget *sliderBox = new QWidget;
59    QHBoxLayout *hSlider = new QHBoxLayout;
60    //    qualityLabel =  new QLabel( tr( "Image quality" ) );
61    //    vbox1->addWidget(qualityLabel);
62    qualitySlider= new QSlider(Qt::Horizontal);
63    qualitySlider->setMinimum(0);
64    qualitySlider->setMaximum(100);
65    qualitySlider->setTickPosition(QSlider::TicksBelow);
66    qualitySlider->setValue(60);
67    hSlider->addWidget(new QLabel("low"));
68    hSlider->addWidget(qualitySlider);
69    hSlider->addWidget(new QLabel("Maximum"));
70    sliderBox->setLayout(hSlider);
71    vbox1->addWidget(sliderBox);
72  }
73 
74  if(nomFich.endsWith(".eps")) {
75    // balck and white / colour
76    // background
77    // size ?
78    ;
79  }
80
81  if(nomFich.endsWith(".tif") ||
82     nomFich.endsWith(".tiff") ||
83     nomFich.endsWith(".jpg") ||
84     nomFich.endsWith(".png") ||
85     nomFich.endsWith(".xpm")) {
86    boxTransparency = new QCheckBox( "boxTransparency" );
87    boxTransparency->setText( "Save transparency" );
88    boxTransparency->setChecked( false );
89    boxTransparency->setEnabled(false);
90    vbox1->addWidget(boxTransparency);
91  }
92
93  groupBox1->setLayout(vbox1);
94
95  QGroupBox *groupBox2 = new QGroupBox();
96  QHBoxLayout *hbox2 = new QHBoxLayout;
97
98  buttonOk = new QPushButton( tr( "&OK" ) );
99  buttonOk->setAutoDefault( TRUE );
100  buttonOk->setDefault( TRUE );
101  hbox2->addWidget(buttonOk);
102
103  buttonCancel = new QPushButton( tr( "&Cancel" ) );
104  buttonCancel->setAutoDefault( TRUE );
105  hbox2->addWidget(buttonCancel);
106
107  groupBox2->setLayout(hbox2);
108  QVBoxLayout* vlayout = new QVBoxLayout();
109  vlayout->addWidget(groupBox1);
110  vlayout->addWidget(groupBox2);
111
112  setLayout(vlayout);
113
114  // signals and slots connections
115  connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
116  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
117}
118
119
120void G4OpenGLQtExportDialog::enableTransparency(int)
121{
122  QString type = boxFormat->currentText().toLower();
123
124  if (type == "tif" || type == "tiff" || type == "png" || type == "xpm")
125    boxTransparency->setEnabled(true);
126}
127
128int G4OpenGLQtExportDialog::getSliderValue()
129{
130  return qualitySlider->value();
131}
132
133void G4OpenGLQtExportDialog::enableTransparency()
134{
135  QString type = f_type.toLower();
136
137  if (type == "tif" || type == "tiff" || type == "png" || type == "xpm")
138    boxTransparency->setEnabled(true);
139}
140
141
142G4OpenGLQtExportDialog::~G4OpenGLQtExportDialog()
143{
144}
145
146
147#endif
Note: See TracBrowser for help on using the repository browser.