Changeset - 98a2c6cae168
[Not reviewed]
default
0 3 0
Michael Guravage - 15 years ago 2010-11-30 10:51:27
michael.guravage@cwi.nl
Install imageformats folder alongside Windows executable.
Solicit supported image formats for file dialogue filter.

--
user: Michael Guravage <michael.guravage@cwi.nl>
branch 'default'
changed src/ChangeLog
changed src/VirtualLeaf-install-windows.nsi
changed src/canvas.cpp
3 files changed with 41 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/ChangeLog
Show inline comments
 
2010-11-30    <guravage@petitdru.sen.cwi.nl>
 

	
 
	* VirtualLeaf-install-windows.nsi: Include imageformats folder
 
	alongside executable.
 

	
 
	* canvas.cpp (snapshot): PNG is the default image format.
 

	
 
2010-11-29    <guravage@petitdru.sen.cwi.nl>
 

	
 
	* canvas.cpp (snapshot): Query and display supported snapshot file
 
	formats.
 

	
 
	* VirtualLeaf-install-windows.nsi: To facilitate debugging I added
 
	the debug versions of all the windows DLLs.
 

	
 
2010-10-19    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* mainbase.cpp (Save): Use format specified in function prototype.
 

	
 
	* VirtualLeaf.cpp (Plot): Render PNG instead of JPEG. Write image
 
	and XML files dependent only on getTime().
src/VirtualLeaf-install-windows.nsi
Show inline comments
 
@@ -128,13 +128,12 @@ section "Virtual Leaf executable"
 
  file ..\lib\libxml2\lib\libxml2.dll
 
  file ..\lib\libz\bin\zlib1.dll
 

	
 
  # Is the pegging of these DLLs to a specific QT version a problem?
 
  file C:\Qt\2010.02.1\mingw\bin\mingwm10.dll
 
  file C:\Qt\2010.02.1\mingw\bin\libgcc_s_dw2-1.dll
 

	
 
  file C:\Qt\2010.02.1\qt\bin\Qt3Support4.dll
 
  file C:\Qt\2010.02.1\qt\bin\QtCore4.dll
 
  file C:\Qt\2010.02.1\qt\bin\QtGui4.dll
 
  file C:\Qt\2010.02.1\qt\bin\QtNetwork4.dll
 
  file C:\Qt\2010.02.1\qt\bin\QtSql4.dll
 
  file C:\Qt\2010.02.1\qt\bin\QtXml4.dll
 
@@ -143,13 +142,25 @@ section "Virtual Leaf executable"
 
  ${EnvVarUpdate} $0 "PATH" "P" "HKCU" "$INSTDIR\bin"  
 

	
 
  # create a shortcut named "VirtualLeaf" in the start menu programs directory
 
  # point the new shortcut at the program VirtualLeaf
 
  createShortCut "$SMPROGRAMS\VirtualLeaf.lnk" "$INSTDIR\bin\VirtualLeaf.exe"
 
sectionEnd
 
 
 

	
 
section "Image Formats"
 
  # define the output path for the Qt Image Formats
 
  setOutPath $INSTDIR\bin\imageformats
 
  file C:\Qt\2010.02.1\qt\plugins\imageformats\qgif4.dll
 
  file C:\Qt\2010.02.1\qt\plugins\imageformats\qico4.dll
 
  file C:\Qt\2010.02.1\qt\plugins\imageformats\qjpeg4.dll
 
  file C:\Qt\2010.02.1\qt\plugins\imageformats\qmng4.dll
 
  file C:\Qt\2010.02.1\qt\plugins\imageformats\qsvg4.dll
 
  file C:\Qt\2010.02.1\qt\plugins\imageformats\qtiff4.dll
 
sectionEnd
 

	
 

	
 
section "Virtual Leaf plugins"
 
  # define the output path for the Virtual Leaf models
 
  setOutPath $INSTDIR\bin\models
 
  file ..\bin\models\*
 
sectionEnd
 

	
src/canvas.cpp
Show inline comments
 
@@ -44,12 +44,13 @@
 
#include <q3filedialog.h>
 
#include <QGraphicsItem>
 
#include <QList>
 
#include <QDir>
 
#include <QFileInfo>
 
#include <QDebug>
 
#include <QImageWriter>
 

	
 
#include <set>
 

	
 
//Added by qt3to4:
 
#include <Q3ValueList>
 
#include <Q3PopupMenu>
 
@@ -725,29 +726,38 @@ void Main::saveStateXML()
 

	
 

	
 

	
 
void Main::snapshot()
 
{
 

	
 
#ifdef QDEBUG
 
  qDebug() << "Supported Image Formats: " << QImageWriter::supportedImageFormats() << endl;
 
#endif
 

	
 
  stopSimulation();
 
  Q3FileDialog *fd = new Q3FileDialog( this, "Save snapshot", TRUE );
 
  fd->setDir(par.datadir);
 
  fd->setMode( Q3FileDialog::AnyFile );
 
  fd->setFilter( "Image files (*.pdf *.png *.jpg *.tif)");
 

	
 
  QString supported_file_formats = " .pdf";
 
  foreach (QString format, QImageWriter::supportedImageFormats()){
 
    supported_file_formats += (" ." + format);
 
  }
 

	
 
  fd->setFilter("Image files (" + supported_file_formats + " )");
 

	
 
  QString fileName;
 

	
 
  if ( fd->exec() == QDialog::Accepted ) {
 
    fileName = fd->selectedFile();
 
    
 
    // extract extension from filename
 
    QFileInfo fi(fileName);
 
    QString extension = fi.suffix();
 
    
 
    if (extension.isEmpty()) {
 
      extension = "jpg";
 
      extension = "png";
 
      fileName += ".";
 
      fileName += extension;
 
    }
 
    
 
    
 
    if ( QFile::exists( fileName ) &&
0 comments (0 inline, 0 general)