|
Lines 824-847
Link Here
|
| 824 |
QString filters; |
824 |
QString filters; |
| 825 |
QList<QByteArray> formats = QImageWriter::supportedImageFormats (); |
825 |
QList<QByteArray> formats = QImageWriter::supportedImageFormats (); |
| 826 |
for (int i = 0; i < formats.size(); ++i) { |
826 |
for (int i = 0; i < formats.size(); ++i) { |
| 827 |
filters +=formats.at(i) + ";;"; |
827 |
filters += "*." + formats.at(i) + ";;"; |
| 828 |
} |
828 |
} |
| 829 |
filters += "eps;;"; |
829 |
filters += "*.eps;;"; |
| 830 |
filters += "ps;;"; |
830 |
filters += "*.ps;;"; |
| 831 |
filters += "pdf"; |
831 |
filters += "*.pdf"; |
| 832 |
QString* selectedFormat = new QString(); |
832 |
QString* selectedFormat = new QString("*.pdf"); |
| 833 |
std::string name; |
833 |
std::string name; |
| 834 |
name = QFileDialog::getSaveFileName ( fGLWindow, |
834 |
name = QFileDialog::getSaveFileName ( fGLWindow, |
| 835 |
tr("Save as ..."), |
835 |
tr("Save as ..."), |
| 836 |
".", |
836 |
".", |
| 837 |
filters, |
837 |
filters, |
| 838 |
selectedFormat ).toStdString().c_str(); |
838 |
selectedFormat ).toStdString(); |
| 839 |
// bmp jpg jpeg png ppm xbm xpm |
839 |
// bmp jpg jpeg png ppm xbm xpm |
| 840 |
if (name.empty()) { |
840 |
if (name.empty()) { |
| 841 |
return; |
841 |
return; |
| 842 |
} |
842 |
} |
| 843 |
name += "." + selectedFormat->toStdString(); |
843 |
//name += "." + selectedFormat->toStdString(); |
| 844 |
QString format = selectedFormat->toLower(); |
844 |
//QString format = selectedFormat->toLower(); |
|
|
845 |
QString format = QString::fromStdString(name).trimmed().split('.').last().toLower(); |
| 846 |
G4cout << "Writing to file " << name << G4endl; |
| 847 |
G4cout << "Using format " << format << G4endl; |
| 845 |
setPrintFilename(name.c_str(),0); |
848 |
setPrintFilename(name.c_str(),0); |
| 846 |
G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(fGLWindow,format,fWindow->height(),fWindow->width()); |
849 |
G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(fGLWindow,format,fWindow->height(),fWindow->width()); |
| 847 |
if( exportDialog->exec()) { |
850 |
if( exportDialog->exec()) { |
|
Lines 881-887
Link Here
|
| 881 |
printEPS(); |
884 |
printEPS(); |
| 882 |
} else if (format == "pdf") { |
885 |
} else if (format == "pdf") { |
| 883 |
|
886 |
|
| 884 |
res = printPDF(name,exportDialog->getNbColor(),image); |
887 |
res = printPDF(name,3,image); |
| 885 |
|
888 |
|
| 886 |
} else if ((format == "tif") || |
889 |
} else if ((format == "tif") || |
| 887 |
(format == "tiff") || |
890 |
(format == "tiff") || |
|
Lines 896-902
Link Here
|
| 896 |
(format == "xpm")) { |
899 |
(format == "xpm")) { |
| 897 |
res = image.save(QString(name.c_str()),0,exportDialog->getSliderValue()); |
900 |
res = image.save(QString(name.c_str()),0,exportDialog->getSliderValue()); |
| 898 |
} else { |
901 |
} else { |
| 899 |
G4cerr << "This version of G4UI Could not generate the selected format" << G4endl; |
902 |
G4cerr << "This version of G4UI Could not generate the format " << format.toStdString() << G4endl; |
| 900 |
} |
903 |
} |
| 901 |
if ((format == QString("eps")) && (format == QString("ps"))) { |
904 |
if ((format == QString("eps")) && (format == QString("ps"))) { |
| 902 |
if (res == false) { |
905 |
if (res == false) { |
|
Lines 1354-1362
Link Here
|
| 1354 |
// FIXME : L. Garnier 4/12/07 |
1357 |
// FIXME : L. Garnier 4/12/07 |
| 1355 |
// This is not working, it does nothing. Image is staying in color mode |
1358 |
// This is not working, it does nothing. Image is staying in color mode |
| 1356 |
// So I have desactivate the B/W button in GUI |
1359 |
// So I have desactivate the B/W button in GUI |
| 1357 |
if ((!aImage.isGrayscale ()) &&(aInColor ==1 )) { |
1360 |
//if ((!aImage.isGrayscale ()) &&(aInColor ==1 )) { |
| 1358 |
aImage = aImage.convertToFormat ( aImage.format(), Qt::MonoOnly); |
1361 |
// aImage = aImage.convertToFormat ( aImage.format(), Qt::MonoOnly); |
| 1359 |
} |
1362 |
//} |
| 1360 |
|
1363 |
|
| 1361 |
|
1364 |
|
| 1362 |
if (aFilename.substr(aFilename.size()-3) == ".ps") { |
1365 |
if (aFilename.substr(aFilename.size()-3) == ".ps") { |