Changeset - fba32897839a
[Not reviewed]
default
0 3 0
Michael Guravage - 15 years ago 2010-10-18 20:21:44
michael.guravage@cwi.nl
Translate image fname to native format. Let QImage guess the format
from the filename's suffix. Put uninstaller in root install directory.

--
user: Michael Guravage <michael.guravage@cwi.nl>
branch 'default'
changed src/ChangeLog
changed src/VirtualLeaf-install.nsi
changed src/mainbase.cpp
3 files changed with 13 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/ChangeLog
Show inline comments
 
2010-10-18    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* mainbase.cpp (Save): QDir::toNativeSeparators(fname). Invoke
 
	save with format argument set to zero to force QImage to guess the
 
	format by looking at fileName's suffix.
 

	
 
	* VirtualLeaf-install.nsi: Put uninstaller in top directory.
 

	
 
	* VirtualLeaf.pro: MAXOSX, look for gpl3.txt in the ../doc directory.
 

	
 
	* Makefile (Makefile.libplugin): Removed -makefile qmake option.
 

	
 
	* VirtualLeaf.cpp (TIMESTEP): Removed getIterations().
 

	
 
	* mesh.h (Mesh): Removed {increment,get}Iterations().
 

	
 
	* canvas.cpp (TimeStepWrap): Replaced getIterations() with getTime().
 

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

	
 
	* mesh.h (Mesh): Added iterations. incrementIterations() and
 
	getIterations().
 

	
 
	* VirtualLeaf.cpp (Plot): Replaced local frame counter with
 
	mesh.incrementIterations().
 

	
 
	* canvas.cpp (TimeStepWrap): Replaced local counter with
 
	mesh.incrementIterations().
 

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

	
 
	* VirtualLeaf.pro: Turned debug off to make all profiles must be
src/VirtualLeaf-install.nsi
Show inline comments
 
@@ -97,49 +97,49 @@
 
!insertmacro MUI_UNPAGE_INSTFILES
 
!insertmacro MUI_UNPAGE_FINISH
 

	
 
# Language files
 
!insertmacro MUI_LANGUAGE "English"
 

	
 
# MUI end ------
 

	
 
# set the name of the installer
 
outfile "VirtualLeaf-install.exe"
 
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
 
ShowInstDetails show
 
ShowUnInstDetails show
 
 
 
# define the directory to install to
 
installDir C:\VirtualLeaf
 

	
 
# Request application privileges
 
RequestExecutionLevel user
 

	
 
section "Virtual Leaf executable"
 
  #sectionIn RO
 
  # define the output path for the Virtual Leaf executable
 
  setOutPath $INSTDIR\bin
 
  writeUninstaller $INSTDIR\bin\uninstaller.exe
 
  writeUninstaller $INSTDIR\uninstaller.exe
 
  file ..\bin\VirtualLeaf.exe
 

	
 
  # Required DLLs
 
  setOutPath $INSTDIR\bin
 

	
 
  file ..\lib\libiconv\bin\libiconv-2.dll
 
  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
 

	
 
  # Prepend the Virtual Leaf bin directory to the installers PATH
 
  ${EnvVarUpdate} $0 "PATH" "P" "HKCU" "$INSTDIR\bin"  
 
sectionEnd
 
 
src/mainbase.cpp
Show inline comments
 
@@ -8,48 +8,50 @@
 
 *  (at your option) any later version.
 
 *
 
 *  VirtualLeaf is distributed in the hope that it will be useful,
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
 *  GNU General Public License for more details.
 
 *
 
 *  You should have received a copy of the GNU General Public License
 
 *  along with the Virtual Leaf.  If not, see <http://www.gnu.org/licenses/>.
 
 *
 
 *  Copyright 2010 Roeland Merks.
 
 *
 
 */
 

	
 
#include <libxml/xpath.h>
 
#include <libxml/xmlreader.h>
 

	
 
#include "mainbase.h"
 
#include "xmlwrite.h"
 

	
 
#include <sstream>
 
#include <string>
 

	
 
#include <QLocale>
 
#include <QDir>
 
#include <QDebug>
 

	
 
static const std::string _module_id("$Id$");
 

	
 
xmlNode *MainBase::XMLViewportTree(QTransform &transform) const {
 
  
 
  QLocale standardlocale(QLocale::C);
 
  
 

	
 
  xmlNode *xmlviewport = xmlNewNode(NULL, BAD_CAST "viewport");
 
  {
 
    xmlNewProp(xmlviewport, BAD_CAST "m11", BAD_CAST standardlocale.toString(transform.m11()).toStdString().c_str() );
 
    xmlNewProp(xmlviewport, BAD_CAST "m12", BAD_CAST standardlocale.toString(transform.m12()).toStdString().c_str() );    
 
    xmlNewProp(xmlviewport, BAD_CAST "m21", BAD_CAST standardlocale.toString(transform.m21()).toStdString().c_str() );    
 
    xmlNewProp(xmlviewport, BAD_CAST "m22", BAD_CAST standardlocale.toString(transform.m22()).toStdString().c_str() );    
 
    xmlNewProp(xmlviewport, BAD_CAST "dx", BAD_CAST standardlocale.toString(transform.dx()).toStdString().c_str() );    
 
    xmlNewProp(xmlviewport, BAD_CAST "dy", BAD_CAST standardlocale.toString(transform.dy()).toStdString().c_str() );    
 
 }
 
  
 
  return xmlviewport;
 
}
 

	
 
xmlNode *MainBase::XMLSettingsTree(void) const {
 

	
 
  xmlNode *xmlsettings = xmlNewNode(NULL, BAD_CAST "settings");
 
@@ -318,46 +320,49 @@ void MainBase::XMLReadSettings(xmlNode *
 
}
 

	
 
void MainBase::Save(const char *fname, const char *format, int sizex, int sizey)
 
{
 

	
 
  Vector ll,ur;
 
  mesh.BoundingBox(ll, ur);
 

	
 
  if (QString(fname).isEmpty()) {
 
    MyWarning::warning("No output filename given. Saving nothing.\n");
 
    return;
 
  }
 

	
 
  ll*=Cell::Magnification(); ur*=Cell::Magnification();
 

	
 
  // give the leaf some space
 
  Vector border = ((ur-ll)/5.);
 

	
 
  if (!QString(format).contains("pdf", Qt::CaseInsensitive)) {
 

	
 
    QImage *image = new QImage(QSize(sizex, sizey), QImage::Format_RGB32);
 
    image->fill(QColor(Qt::white).rgb());
 
    QPainter *painter=new QPainter(image);
 
    canvas.render(painter);
 
    if (!image->save(QString(fname))) {
 
#ifdef QDEBUG
 
    qDebug() << "Native Image Filename: " << QDir::toNativeSeparators(QString(fname)) << endl;
 
#endif
 
    if (!image->save(QDir::toNativeSeparators(QString(fname)), 0, -1)) {
 
      MyWarning::warning("Image not saved successfully. Is the disk full or the extension not recognized?");
 
    };
 
    delete painter;
 
    delete image;
 
  } else {
 
    QPrinter pdf(QPrinter::HighResolution);
 
    pdf.setOutputFileName(fname);
 
    pdf.setOutputFormat(QPrinter::PdfFormat);
 
    QPainter painter(&pdf);
 
    canvas.render(&painter, QRectF(), QRectF(-5000,-5000, 10000, 10000));
 

	
 
    cerr << "Rendering to printer\n";
 
  }
 
}
 

	
 
void MainBase::CutSAM()
 
{
 
  mesh.CutAwaySAM();
 
}
 

	
 
/* finis */
0 comments (0 inline, 0 general)