smaller URL-icons for XHTML export
authorinsilmaril
Wed, 25 Jan 2006 09:04:00 +0000
changeset 194de97201180ea
parent 193 544a64d7cbac
child 195 98f260cfb1fe
smaller URL-icons for XHTML export
demos/todo.vym
exports.cpp
exports.h
exportxhtmldialog.ui
exportxhtmldialog.ui.h
mainwindow.cpp
mapeditor.cpp
styles/vym2xhtml.xsl
tex/vym.changelog
version.h
     1.1 Binary file demos/todo.vym has changed
     2.1 --- a/exports.cpp	Tue Jan 24 15:09:49 2006 +0000
     2.2 +++ b/exports.cpp	Wed Jan 25 09:04:00 2006 +0000
     2.3 @@ -1,3 +1,5 @@
     2.4 +#include <qmessagebox.h>
     2.5 +
     2.6  #include "exports.h"
     2.7  #include "file.h"
     2.8  #include "linkablemapobj.h"
     2.9 @@ -143,15 +145,8 @@
    2.10  
    2.11  ExportOO::ExportOO()
    2.12  {
    2.13 -	// Create tmpdir and set paths
    2.14 +	// Create tmpdir
    2.15  	tmpDir.setPath (makeUniqueDir("/tmp/vym-XXXXXX"));
    2.16 -	templateDir="exports/novell/template/";
    2.17 -	contentTemplateFile=templateDir+"content-template.xml";
    2.18 -	contentFile=tmpDir.path()+"/content.xml";
    2.19 -	pageTemplateFile=templateDir+"page-template.xml";
    2.20 -	chapterTemplateFile=templateDir+"chapter-template.xml";
    2.21 -
    2.22 -	outputFile=tmpDir.currentDirPath()+"/test.odp";
    2.23  }
    2.24  
    2.25  ExportOO::~ExportOO()
    2.26 @@ -194,7 +189,7 @@
    2.27  {
    2.28  	QString allPages;
    2.29  
    2.30 -	bool useChapters=true;
    2.31 +	bool useSections=true;
    2.32  
    2.33  	// Insert new content
    2.34  	content.replace ("<!-- INSERT TITLE -->",quotemeta(mapCenter->getHeading()));
    2.35 @@ -203,29 +198,29 @@
    2.36  	QString	onePage;
    2.37  	QString list;
    2.38  	
    2.39 -	BranchObj *chapterBO=mapCenter->getFirstBranch();
    2.40 +	BranchObj *sectionBO=mapCenter->getFirstBranch();
    2.41      int i=0;
    2.42  	BranchObj *pagesBO;
    2.43      int j=0;
    2.44  
    2.45 -	// Walk chapters
    2.46 -	while (chapterBO)
    2.47 +	// Walk sections
    2.48 +	while (sectionBO)
    2.49  	{
    2.50 -		if (useChapters)
    2.51 +		if (useSections)
    2.52  		{
    2.53 -			// Add page with chapter title
    2.54 -			onePage=chapterTemplate;
    2.55 -			onePage.replace ("<!-- INSERT PAGE HEADING -->", quotemeta(chapterBO->getHeading() ) );
    2.56 +			// Add page with section title
    2.57 +			onePage=sectionTemplate;
    2.58 +			onePage.replace ("<!-- INSERT PAGE HEADING -->", quotemeta(sectionBO->getHeading() ) );
    2.59  			allPages+=onePage;
    2.60  		} else
    2.61  		{
    2.62  			i=-2;	// only use inner loop to 
    2.63  			        // turn mainbranches into pages
    2.64 -			chapterBO=mapCenter;
    2.65 +			sectionBO=mapCenter;
    2.66  		}
    2.67  
    2.68  		// Walk mainpages
    2.69 -		pagesBO=chapterBO->getFirstBranch();
    2.70 +		pagesBO=sectionBO->getFirstBranch();
    2.71  		j=0;
    2.72  		while (pagesBO)
    2.73  		{
    2.74 @@ -236,10 +231,10 @@
    2.75  			onePage.replace ("<!-- INSERT LIST -->", list);
    2.76  			allPages+=onePage;
    2.77  			j++;
    2.78 -			pagesBO=chapterBO->getBranchNum(j);
    2.79 +			pagesBO=sectionBO->getBranchNum(j);
    2.80  		}
    2.81  		i++;
    2.82 -		chapterBO=mapCenter->getBranchNum(i);
    2.83 +		sectionBO=mapCenter->getBranchNum(i);
    2.84  	}
    2.85  	
    2.86  	content.replace ("<!-- INSERT PAGES -->",allPages);
    2.87 @@ -260,7 +255,7 @@
    2.88  	zipDir (tmpDir,outputFile);	
    2.89  }
    2.90  
    2.91 -void ExportOO::setConfigFile (const QString &cf)
    2.92 +bool ExportOO::setConfigFile (const QString &cf)
    2.93  {
    2.94  	configFile=cf;
    2.95  	int i=cf.findRev ("/");
    2.96 @@ -271,39 +266,44 @@
    2.97  	// set paths
    2.98  	templateDir=configDir+"/"+set.readEntry ("Template");
    2.99  
   2.100 -	//FIXME check if templateDir is really set, otherwise abort
   2.101 +	QDir d (templateDir);
   2.102 +	if (!d.exists())
   2.103 +	{
   2.104 +		QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Check \"%1\" in\n%2").arg("Template="+set.readEntry ("Template")).arg(configFile));
   2.105 +		return false;
   2.106 +
   2.107 +	}
   2.108  
   2.109  	contentTemplateFile=templateDir+"content-template.xml";
   2.110  	contentFile=tmpDir.path()+"/content.xml";
   2.111  	pageTemplateFile=templateDir+"page-template.xml";
   2.112 -	chapterTemplateFile=templateDir+"chapter-template.xml";
   2.113 +	sectionTemplateFile=templateDir+"section-template.xml";
   2.114  
   2.115 -	outputFile=tmpDir.currentDirPath()+"/test.odp";
   2.116 +	outputFile=tmpDir.currentDirPath()+"/vym-out.odp";
   2.117  	
   2.118  	// Copy template to tmpdir
   2.119  	system ("cp -r "+templateDir+"* "+tmpDir.path());
   2.120 -	
   2.121  
   2.122  	// Read content-template
   2.123  	if (!loadStringFromDisk (contentTemplateFile,content))
   2.124  	{
   2.125 -		qWarning ("Export::exportOO() Couldn't load from "+contentTemplateFile);
   2.126 -		return;
   2.127 +		QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not read %1").arg(contentTemplateFile));
   2.128 +		return false;
   2.129  	}
   2.130  
   2.131  	// Read page-template
   2.132  	if (!loadStringFromDisk (pageTemplateFile,pageTemplate))
   2.133  	{
   2.134 -		qWarning ("Export::exportOO() Couldn't load from "+pageTemplateFile);
   2.135 -		return;
   2.136 +		QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not read %1").arg(pageTemplateFile));
   2.137 +		return false;
   2.138  	}
   2.139  	
   2.140 -	// Read chapter-template
   2.141 -	if (!loadStringFromDisk (chapterTemplateFile,chapterTemplate))
   2.142 +	// Read section-template
   2.143 +	if (!loadStringFromDisk (sectionTemplateFile,sectionTemplate))
   2.144  	{
   2.145 -		qWarning ("Export::exportOO() Couldn't load from "+chapterTemplateFile);
   2.146 -		return;
   2.147 +		QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not read %1").arg(sectionTemplateFile));
   2.148 +		return false;
   2.149  	}
   2.150 -
   2.151 +	return true;
   2.152  }
   2.153  
     3.1 --- a/exports.h	Tue Jan 24 15:09:49 2006 +0000
     3.2 +++ b/exports.h	Wed Jan 25 09:04:00 2006 +0000
     3.3 @@ -45,11 +45,11 @@
     3.4  	ExportOO();
     3.5  	~ExportOO();
     3.6  	void exportPresentation();
     3.7 -	void setConfigFile (const QString &);
     3.8 +	bool setConfigFile (const QString &);
     3.9  private:
    3.10  	QString buildList (BranchObj*);
    3.11  	QDir tmpDir;
    3.12 -	bool useChapters;
    3.13 +	bool useSections;
    3.14  	QString configFile;
    3.15  	QString configDir;
    3.16  	QString templateDir;
    3.17 @@ -60,7 +60,7 @@
    3.18  	QString outputFile;
    3.19  	QString pageTemplate;
    3.20  	QString pageTemplateFile;
    3.21 -	QString chapterTemplate;
    3.22 -	QString chapterTemplateFile;
    3.23 +	QString sectionTemplate;
    3.24 +	QString sectionTemplateFile;
    3.25  };
    3.26  #endif
     4.1 --- a/exportxhtmldialog.ui	Tue Jan 24 15:09:49 2006 +0000
     4.2 +++ b/exportxhtmldialog.ui	Wed Jan 25 09:04:00 2006 +0000
     4.3 @@ -583,7 +583,6 @@
     4.4      <include location="global" impldecl="in implementation">qfiledialog.h</include>
     4.5      <include location="global" impldecl="in implementation">qmessagebox.h</include>
     4.6      <include location="local" impldecl="in implementation">settings.h</include>
     4.7 -    <include location="local" impldecl="in implementation">icons/flag-url.xpm</include>
     4.8      <include location="local" impldecl="in implementation">exportxhtmldialog.ui.h</include>
     4.9  </includes>
    4.10  <variables>
     5.1 --- a/exportxhtmldialog.ui.h	Tue Jan 24 15:09:49 2006 +0000
     5.2 +++ b/exportxhtmldialog.ui.h	Wed Jan 25 09:04:00 2006 +0000
     5.3 @@ -83,10 +83,10 @@
     5.4  	{
     5.5  		QMessageBox::warning( 0, tr( "Warning" ),tr(
     5.6  		"The settings saved in the map "
     5.7 -		"would like to run scripts:\n\n") +
     5.8 -		prescript +"  "+postscript +"\n\n"+
     5.9 -		tr("Please check, if you really\n"
    5.10 -		"want to allow this in your system!"));
    5.11 +		"would like to run scripts:\n\n"
    5.12 +		"%1\n\n"
    5.13 +		"Please check, if you really\n"
    5.14 +		"want to allow this in your system!").arg(prescript+"  "+postscript));
    5.15  		
    5.16  	}
    5.17  }
    5.18 @@ -272,12 +272,15 @@
    5.19  	settings.setLocalEntry 
    5.20  		(filepath,"/vym/export/xhtml/css",css);	
    5.21  
    5.22 -	//FIXME add option for url image (globe flag) here	
    5.23 -	if (true) 
    5.24 -	{	
    5.25 -		QPixmap pm (flag_url_xpm);
    5.26 -		pm.save (dir + "/flags/url.png","PNG");
    5.27 -	}
    5.28 +	// Provide a smaller URL-icon to improve Layout
    5.29 +	QPixmap pm;
    5.30 +	QString ipath="/usr/share/vym/images/flag-url-16x16.png";
    5.31 +	if (!pm.load(ipath,"PNG") )
    5.32 +		QMessageBox::warning( 0, tr( "Warning" ),tr("Could not open %1").arg(ipath));
    5.33 +		
    5.34 +		
    5.35 +	if(!pm.save (dir + "flags/url-16x16.png","PNG"))
    5.36 +		QMessageBox::warning( 0, tr( "Warning" ),tr("Could not write %1").arg(ipath));
    5.37  
    5.38  	if (!saveSettingsInMap)
    5.39  		settings.clearLocal("/vym/export/xhtml");
    5.40 @@ -289,11 +292,11 @@
    5.41  	QFile css_src (css);
    5.42  	QFile css_dst (dir+"vym.css");
    5.43  	if (!css_src.open ( IO_ReadOnly))
    5.44 -		QMessageBox::warning( 0, tr( "Warning" ),css +tr(" could not be opened!"));
    5.45 +		QMessageBox::warning( 0, tr( "Warning" ),+tr("Could not open %1").arg(css));
    5.46  	else
    5.47  	{
    5.48  		if (!css_dst.open( IO_WriteOnly))
    5.49 -			QMessageBox::warning( 0, tr( "Warning" ), dir+"vym.css" +tr(" could not be opened!"));
    5.50 +			QMessageBox::warning( 0, tr( "Warning" ), tr("Could not open!").arg(dir+"vym.css"));
    5.51  		else
    5.52  		{	
    5.53  		
    5.54 @@ -335,13 +338,13 @@
    5.55  	if (!xsltProc->start() )
    5.56  	{
    5.57  		QMessageBox::critical( 0, tr( "Critical Error" ),
    5.58 -					   tr("Couldn't start ") + xsltprocessor );
    5.59 +					   tr("Could not start %1").arg(xsltprocessor) );
    5.60  	} else
    5.61  	{
    5.62  		xsltProc->waitFinished();
    5.63  		if (!xsltProc->normalExit() )
    5.64  			QMessageBox::critical( 0, tr( "Critical Error" ),
    5.65 -			   xsltprocessor +" " +tr("didn't exit normally") +
    5.66 +			   tr("%1 didn't exit normally").arg(xsltprocessor) +
    5.67  			   xsltProc->getErrout() );
    5.68  		else
    5.69  			if (xsltProc->exitStatus()>0) showOutput=true;
    5.70 @@ -394,13 +397,13 @@
    5.71  	if (!scriptProc->start() )
    5.72  	{
    5.73  		QMessageBox::critical( 0, tr( "Critical Error" ),
    5.74 -					   tr("Couldn't start ") + spath );
    5.75 +					   tr("Couldn't start %1").arg(spath) );
    5.76  	} else
    5.77  	{
    5.78  		scriptProc->waitFinished();
    5.79  		if (!scriptProc->normalExit() )
    5.80  			QMessageBox::critical( 0, tr( "Critical Error" ),
    5.81 -			   spath +" " +tr("didn't exit normally") +
    5.82 +			   tr("%1 didn't exit normally").arg(spath) +
    5.83  			   scriptProc->getErrout() );
    5.84  		else
    5.85  			if (scriptProc->exitStatus()>0) showOutput=true;
     6.1 --- a/mainwindow.cpp	Tue Jan 24 15:09:49 2006 +0000
     6.2 +++ b/mainwindow.cpp	Wed Jan 25 09:04:00 2006 +0000
     6.3 @@ -1843,11 +1843,10 @@
     6.4  		QString fn = QFileDialog::getSaveFileName( QString::null, "Image  (*.bmp *.jpg *.pbm *.pgm *.png *.ppm *xbm *.xpm)",
     6.5  							   this );
     6.6  		if ( !fn.isEmpty() ) 
     6.7 -		{
     6.8  			currentMapEditor()->exportImage(fn,item);
     6.9 -		} else {
    6.10 +		else 
    6.11  			statusBar()->message( tr("Couldn't save %1").arg(fn), statusbarTime );
    6.12 -		}
    6.13 +		
    6.14  	}
    6.15  }
    6.16  
     7.1 --- a/mapeditor.cpp	Tue Jan 24 15:09:49 2006 +0000
     7.2 +++ b/mapeditor.cpp	Wed Jan 25 09:04:00 2006 +0000
     7.3 @@ -1147,9 +1147,8 @@
     7.4  {
     7.5  	ExportOO ex;
     7.6  	ex.setPath (fn);
     7.7 -	ex.setConfigFile(cf);
     7.8  	ex.setMapCenter(mapCenter);
     7.9 -	ex.exportPresentation();
    7.10 +	if (ex.setConfigFile(cf)) ex.exportPresentation();
    7.11  }
    7.12  
    7.13  
     8.1 --- a/styles/vym2xhtml.xsl	Tue Jan 24 15:09:49 2006 +0000
     8.2 +++ b/styles/vym2xhtml.xsl	Wed Jan 25 09:04:00 2006 +0000
     8.3 @@ -57,7 +57,7 @@
     8.4  <xsl:param name="imagemap" select="''"/>
     8.5  
     8.6  <!-- This stylesheet is able to process the following VYM version -->
     8.7 -<xsl:param name="vym.version" select="'1.7.5'"/>
     8.8 +<xsl:param name="vym.version" select="'1.7.7'"/>
     8.9  
    8.10  <!-- Should the VYM XML format be checked -->
    8.11  <xsl:param name="checkvym.version" select="1"/>
    8.12 @@ -263,21 +263,21 @@
    8.13              <xsl:choose>
    8.14                 <xsl:when test="$link.style = 'name'">
    8.15                     <a href="{$url}">
    8.16 -						<img src="{concat($image.flags.path,'url-small.png')}" border="0" alt="URL"/>
    8.17 +						<img src="{concat($image.flags.path,'url-16x16.png')}" border="0" alt="URL"/>
    8.18  						<xsl:text> </xsl:text>
    8.19  						<xsl:apply-templates/>
    8.20  					</a>
    8.21                 </xsl:when>
    8.22                 <xsl:when test="$link.style = 'url'">
    8.23  					<a href="{$url}">
    8.24 -						<img src="{concat($image.flags.path,'url-small.png')}" border="0" alt="URL"/>
    8.25 +						<img src="{concat($image.flags.path,'url-16x16.png')}" border="0" alt="URL"/>
    8.26  						<xsl:text> </xsl:text>
    8.27  						<xsl:value-of select="$url"/>
    8.28  					</a>
    8.29                 </xsl:when>
    8.30                 <xsl:when test="$link.style = 'both'">
    8.31                    <a href="{$url}">
    8.32 -						<img src="{concat($image.flags.path,'url-small.png')}" border="0" alt="URL"/>
    8.33 +						<img src="{concat($image.flags.path,'url-16x16.png')}" border="0" alt="URL"/>
    8.34  						<xsl:text> </xsl:text>
    8.35  						<xsl:apply-templates/> (<xsl:value-of select="$url"/>)
    8.36  					</a>
     9.1 --- a/tex/vym.changelog	Tue Jan 24 15:09:49 2006 +0000
     9.2 +++ b/tex/vym.changelog	Wed Jan 25 09:04:00 2006 +0000
     9.3 @@ -1,8 +1,9 @@
     9.4  -------------------------------------------------------------------
     9.5 -Tue Jan 24 16:07:53 CET 2006 - uwedr
     9.6 +Tue Jan 25 16:07:53 CET 2006 - uwedr
     9.7  
     9.8  - Version 1.7.7
     9.9  - Feature: Export to Open Office 2.x (Open Document) basically works 
    9.10 +- Feature: Export to XHTML uses smaller icon for URLs now
    9.11  
    9.12  -------------------------------------------------------------------
    9.13  Wed Jan 18 13:29:52 CET 2006 - uwedr
    10.1 --- a/version.h	Tue Jan 24 15:09:49 2006 +0000
    10.2 +++ b/version.h	Wed Jan 25 09:04:00 2006 +0000
    10.3 @@ -3,6 +3,6 @@
    10.4  
    10.5  #define __VYM "VYM"
    10.6  #define __VYM_VERSION "1.7.7"
    10.7 -#define __BUILD_DATE "January 24, 2006"
    10.8 +#define __BUILD_DATE "January 25, 2006"
    10.9  
   10.10  #endif