Changeset 639
- Timestamp:
- Dec 5, 2007, 7:02:02 PM (17 years ago)
- Location:
- trunk/geant4/visualization/OpenGL
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/geant4/visualization/OpenGL/include/G4OpenGLQtExportDialog.hh
r633 r639 57 57 @param parent : parent widget 58 58 @param name : name of the saved file with extention 59 @param format : format of save file in lower case 59 60 @param height : height of the original file 60 61 @param width : width of the original file 61 62 */ 62 G4OpenGLQtExportDialog(QWidget* parent, QString name, int height =0, int width=0);63 G4OpenGLQtExportDialog(QWidget* parent, QString name, QString format, int height =0, int width=0); 63 64 64 65 /** Destroys G4OpenGLQtExportDialog */ -
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtExportDialog.cc
r638 r639 51 51 QWidget* parent 52 52 ,QString nomFich 53 ,QString format 53 54 ,int aHeight 54 55 ,int aWidth … … 75 76 76 77 77 if ( nomFich.endsWith(".jpg") ||78 nomFich.endsWith(".jpeg")) {78 if ((format == "jpg") || 79 (format == "jpeg")) { 79 80 80 81 QGroupBox *imageGroupBox = new QGroupBox(tr("Image quality"),this); … … 114 115 // This is not working for PS and PDF images, it does nothing. 115 116 // Image is staying in color mode 116 // if (( nomFich.endsWith(".ps")) || (nomFich.endsWith(".pdf")) || (nomFich.endsWith(".eps"))) {117 if ((nomFich.endsWith(".eps"))) { 118 117 // if ((format == "ps") || (format == "pdf") || (format == "eps")) { 118 119 if (format == ".eps") { 119 120 120 121 QWidget * EPSWidgetGroupBox; // widget containing group button … … 157 158 // Not implented. Should deal with alpha channel 158 159 159 // if( nomFich.endsWith(".tif") ||160 // nomFich.endsWith(".tiff") ||161 // nomFich.endsWith(".jpg") ||162 // nomFich.endsWith(".jpeg") ||163 // nomFich.endsWith(".png") ||164 // nomFich.endsWith(".xpm")) {160 // if((format == "tif") || 161 // (format == "tiff") || 162 // (format == "jpg") || 163 // (format == "jpeg") || 164 // (format == "png") || 165 // (format == "xpm")) { 165 166 166 167 // QGroupBox *transparencyGroupBox = new QGroupBox(tr("Transparency"),this); … … 186 187 QButtonGroup * sizeButtonGroupBox; // group button 187 188 QLayout *sizeGroupBoxLayout; 189 188 190 #if QT_VERSION < 0x040000 189 191 sizeButtonGroupBox = new QButtonGroup ( 2,Qt::Vertical, tr("Size"),this); -
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r638 r639 1062 1062 filters += "ps;;"; 1063 1063 filters += "pdf"; 1064 QString* selectedF ilter= new QString();1064 QString* selectedFormat = new QString(); 1065 1065 #if QT_VERSION < 0x040000 1066 1066 QString nomFich = QFileDialog::getSaveFileName ( ".", … … 1069 1069 "Save file dialog", 1070 1070 tr("Save as ..."), 1071 selectedF ilter);1071 selectedFormat ); 1072 1072 #else 1073 1073 QString nomFich = QFileDialog::getSaveFileName ( GLWindow, … … 1075 1075 ".", 1076 1076 filters, 1077 selectedF ilter);1077 selectedFormat ); 1078 1078 #endif 1079 1079 // bmp jpg jpeg png ppm xbm xpm … … 1082 1082 } 1083 1083 #if QT_VERSION < 0x040000 1084 nomFich += "."+selectedFilter->lower(); 1085 #ifdef GEANT4_QT_DEBUG 1086 printf("G4OpenGLQtViewer::name %s\n",nomFich.ascii()); 1087 #endif 1088 #else 1089 nomFich += "."+selectedFilter->toLower(); 1090 #ifdef GEANT4_QT_DEBUG 1091 printf("G4OpenGLQtViewer::name %s\n",nomFich.toStdString().c_str()); 1092 #endif 1093 #endif 1094 G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(GLWindow,nomFich,fWindow->height(),fWindow->width()); 1084 nomFich += "."+QString(selectedFormat->ascii()); 1085 QString format = selectedFormat->lower(); 1086 #else 1087 nomFich += "."+QString(selectedFormat->toStdString().c_str()); 1088 QString format = selectedFormat->toLower(); 1089 #endif 1090 G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(GLWindow,nomFich,format,fWindow->height(),fWindow->width()); 1095 1091 if( exportDialog->exec()) { 1096 1092 … … 1119 1115 image = fWindow->grabFrameBuffer(); 1120 1116 } 1121 // jpeg format 1122 if (nomFich.endsWith(".eps")) { 1117 if (format == QString("eps")) { 1123 1118 generateEPS(nomFich,exportDialog->getNbColor(),image); 1124 } else if ( nomFich.endsWith(".ps") ||nomFich.endsWith(".pdf")) {1119 } else if ((format == "ps") || (format == "pdf")) { 1125 1120 generatePS_PDF(nomFich,exportDialog->getNbColor(),image); 1126 } else if (nomFich.endsWith(".tif") || 1127 nomFich.endsWith(".tiff") || 1128 nomFich.endsWith(".jpg") || 1129 nomFich.endsWith(".jpeg") || 1130 nomFich.endsWith(".png") || 1131 nomFich.endsWith(".ppm") || 1132 nomFich.endsWith(".bmp") || 1133 nomFich.endsWith(".xbm") || 1134 nomFich.endsWith(".xpm")) { 1121 } else if ((format == "tif") || 1122 (format == "tiff") || 1123 (format == "jpg") || 1124 (format == "jpeg") || 1125 (format == "png") || 1126 (format == "pbm") || 1127 (format == "pgm") || 1128 (format == "ppm") || 1129 (format == "bmp") || 1130 (format == "xbm") || 1131 (format == "xpm")) { 1132 #if QT_VERSION < 0x040000 1133 bool res = image.save(nomFich,selectedFormat->ascii(),exportDialog->getSliderValue()); 1134 #else 1135 1135 bool res = image.save(nomFich,0,exportDialog->getSliderValue()); 1136 #endif 1136 1137 if (res == false) { 1137 1138 G4cerr << "Error while saving file...\n" << G4endl; 1138 1139 } 1139 #ifdef GEANT4_QT_DEBUG1140 printf("saving ELSE %d\n",res);1141 #endif1142 1140 } else { 1143 1141 G4cerr << "This version of G4UI Could not generate the selected format\n" << G4endl;
Note: See TracChangeset
for help on using the changeset viewer.