# HG changeset patch # User insilmaril # Date 1138179840 0 # Node ID de97201180ea8d4002f9045f5155ed1d1e4c4067 # Parent 544a64d7cbac2f6edebc6f4f5562e9a95aa386fe smaller URL-icons for XHTML export diff -r 544a64d7cbac -r de97201180ea demos/todo.vym Binary file demos/todo.vym has changed diff -r 544a64d7cbac -r de97201180ea exports.cpp --- a/exports.cpp Tue Jan 24 15:09:49 2006 +0000 +++ b/exports.cpp Wed Jan 25 09:04:00 2006 +0000 @@ -1,3 +1,5 @@ +#include + #include "exports.h" #include "file.h" #include "linkablemapobj.h" @@ -143,15 +145,8 @@ ExportOO::ExportOO() { - // Create tmpdir and set paths + // Create tmpdir tmpDir.setPath (makeUniqueDir("/tmp/vym-XXXXXX")); - templateDir="exports/novell/template/"; - contentTemplateFile=templateDir+"content-template.xml"; - contentFile=tmpDir.path()+"/content.xml"; - pageTemplateFile=templateDir+"page-template.xml"; - chapterTemplateFile=templateDir+"chapter-template.xml"; - - outputFile=tmpDir.currentDirPath()+"/test.odp"; } ExportOO::~ExportOO() @@ -194,7 +189,7 @@ { QString allPages; - bool useChapters=true; + bool useSections=true; // Insert new content content.replace ("",quotemeta(mapCenter->getHeading())); @@ -203,29 +198,29 @@ QString onePage; QString list; - BranchObj *chapterBO=mapCenter->getFirstBranch(); + BranchObj *sectionBO=mapCenter->getFirstBranch(); int i=0; BranchObj *pagesBO; int j=0; - // Walk chapters - while (chapterBO) + // Walk sections + while (sectionBO) { - if (useChapters) + if (useSections) { - // Add page with chapter title - onePage=chapterTemplate; - onePage.replace ("", quotemeta(chapterBO->getHeading() ) ); + // Add page with section title + onePage=sectionTemplate; + onePage.replace ("", quotemeta(sectionBO->getHeading() ) ); allPages+=onePage; } else { i=-2; // only use inner loop to // turn mainbranches into pages - chapterBO=mapCenter; + sectionBO=mapCenter; } // Walk mainpages - pagesBO=chapterBO->getFirstBranch(); + pagesBO=sectionBO->getFirstBranch(); j=0; while (pagesBO) { @@ -236,10 +231,10 @@ onePage.replace ("", list); allPages+=onePage; j++; - pagesBO=chapterBO->getBranchNum(j); + pagesBO=sectionBO->getBranchNum(j); } i++; - chapterBO=mapCenter->getBranchNum(i); + sectionBO=mapCenter->getBranchNum(i); } content.replace ("",allPages); @@ -260,7 +255,7 @@ zipDir (tmpDir,outputFile); } -void ExportOO::setConfigFile (const QString &cf) +bool ExportOO::setConfigFile (const QString &cf) { configFile=cf; int i=cf.findRev ("/"); @@ -271,39 +266,44 @@ // set paths templateDir=configDir+"/"+set.readEntry ("Template"); - //FIXME check if templateDir is really set, otherwise abort + QDir d (templateDir); + if (!d.exists()) + { + QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Check \"%1\" in\n%2").arg("Template="+set.readEntry ("Template")).arg(configFile)); + return false; + + } contentTemplateFile=templateDir+"content-template.xml"; contentFile=tmpDir.path()+"/content.xml"; pageTemplateFile=templateDir+"page-template.xml"; - chapterTemplateFile=templateDir+"chapter-template.xml"; + sectionTemplateFile=templateDir+"section-template.xml"; - outputFile=tmpDir.currentDirPath()+"/test.odp"; + outputFile=tmpDir.currentDirPath()+"/vym-out.odp"; // Copy template to tmpdir system ("cp -r "+templateDir+"* "+tmpDir.path()); - // Read content-template if (!loadStringFromDisk (contentTemplateFile,content)) { - qWarning ("Export::exportOO() Couldn't load from "+contentTemplateFile); - return; + QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not read %1").arg(contentTemplateFile)); + return false; } // Read page-template if (!loadStringFromDisk (pageTemplateFile,pageTemplate)) { - qWarning ("Export::exportOO() Couldn't load from "+pageTemplateFile); - return; + QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not read %1").arg(pageTemplateFile)); + return false; } - // Read chapter-template - if (!loadStringFromDisk (chapterTemplateFile,chapterTemplate)) + // Read section-template + if (!loadStringFromDisk (sectionTemplateFile,sectionTemplate)) { - qWarning ("Export::exportOO() Couldn't load from "+chapterTemplateFile); - return; + QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not read %1").arg(sectionTemplateFile)); + return false; } - + return true; } diff -r 544a64d7cbac -r de97201180ea exports.h --- a/exports.h Tue Jan 24 15:09:49 2006 +0000 +++ b/exports.h Wed Jan 25 09:04:00 2006 +0000 @@ -45,11 +45,11 @@ ExportOO(); ~ExportOO(); void exportPresentation(); - void setConfigFile (const QString &); + bool setConfigFile (const QString &); private: QString buildList (BranchObj*); QDir tmpDir; - bool useChapters; + bool useSections; QString configFile; QString configDir; QString templateDir; @@ -60,7 +60,7 @@ QString outputFile; QString pageTemplate; QString pageTemplateFile; - QString chapterTemplate; - QString chapterTemplateFile; + QString sectionTemplate; + QString sectionTemplateFile; }; #endif diff -r 544a64d7cbac -r de97201180ea exportxhtmldialog.ui --- a/exportxhtmldialog.ui Tue Jan 24 15:09:49 2006 +0000 +++ b/exportxhtmldialog.ui Wed Jan 25 09:04:00 2006 +0000 @@ -583,7 +583,6 @@ qfiledialog.h qmessagebox.h settings.h - icons/flag-url.xpm exportxhtmldialog.ui.h diff -r 544a64d7cbac -r de97201180ea exportxhtmldialog.ui.h --- a/exportxhtmldialog.ui.h Tue Jan 24 15:09:49 2006 +0000 +++ b/exportxhtmldialog.ui.h Wed Jan 25 09:04:00 2006 +0000 @@ -83,10 +83,10 @@ { QMessageBox::warning( 0, tr( "Warning" ),tr( "The settings saved in the map " - "would like to run scripts:\n\n") + - prescript +" "+postscript +"\n\n"+ - tr("Please check, if you really\n" - "want to allow this in your system!")); + "would like to run scripts:\n\n" + "%1\n\n" + "Please check, if you really\n" + "want to allow this in your system!").arg(prescript+" "+postscript)); } } @@ -272,12 +272,15 @@ settings.setLocalEntry (filepath,"/vym/export/xhtml/css",css); - //FIXME add option for url image (globe flag) here - if (true) - { - QPixmap pm (flag_url_xpm); - pm.save (dir + "/flags/url.png","PNG"); - } + // Provide a smaller URL-icon to improve Layout + QPixmap pm; + QString ipath="/usr/share/vym/images/flag-url-16x16.png"; + if (!pm.load(ipath,"PNG") ) + QMessageBox::warning( 0, tr( "Warning" ),tr("Could not open %1").arg(ipath)); + + + if(!pm.save (dir + "flags/url-16x16.png","PNG")) + QMessageBox::warning( 0, tr( "Warning" ),tr("Could not write %1").arg(ipath)); if (!saveSettingsInMap) settings.clearLocal("/vym/export/xhtml"); @@ -289,11 +292,11 @@ QFile css_src (css); QFile css_dst (dir+"vym.css"); if (!css_src.open ( IO_ReadOnly)) - QMessageBox::warning( 0, tr( "Warning" ),css +tr(" could not be opened!")); + QMessageBox::warning( 0, tr( "Warning" ),+tr("Could not open %1").arg(css)); else { if (!css_dst.open( IO_WriteOnly)) - QMessageBox::warning( 0, tr( "Warning" ), dir+"vym.css" +tr(" could not be opened!")); + QMessageBox::warning( 0, tr( "Warning" ), tr("Could not open!").arg(dir+"vym.css")); else { @@ -335,13 +338,13 @@ if (!xsltProc->start() ) { QMessageBox::critical( 0, tr( "Critical Error" ), - tr("Couldn't start ") + xsltprocessor ); + tr("Could not start %1").arg(xsltprocessor) ); } else { xsltProc->waitFinished(); if (!xsltProc->normalExit() ) QMessageBox::critical( 0, tr( "Critical Error" ), - xsltprocessor +" " +tr("didn't exit normally") + + tr("%1 didn't exit normally").arg(xsltprocessor) + xsltProc->getErrout() ); else if (xsltProc->exitStatus()>0) showOutput=true; @@ -394,13 +397,13 @@ if (!scriptProc->start() ) { QMessageBox::critical( 0, tr( "Critical Error" ), - tr("Couldn't start ") + spath ); + tr("Couldn't start %1").arg(spath) ); } else { scriptProc->waitFinished(); if (!scriptProc->normalExit() ) QMessageBox::critical( 0, tr( "Critical Error" ), - spath +" " +tr("didn't exit normally") + + tr("%1 didn't exit normally").arg(spath) + scriptProc->getErrout() ); else if (scriptProc->exitStatus()>0) showOutput=true; diff -r 544a64d7cbac -r de97201180ea mainwindow.cpp --- a/mainwindow.cpp Tue Jan 24 15:09:49 2006 +0000 +++ b/mainwindow.cpp Wed Jan 25 09:04:00 2006 +0000 @@ -1843,11 +1843,10 @@ QString fn = QFileDialog::getSaveFileName( QString::null, "Image (*.bmp *.jpg *.pbm *.pgm *.png *.ppm *xbm *.xpm)", this ); if ( !fn.isEmpty() ) - { currentMapEditor()->exportImage(fn,item); - } else { + else statusBar()->message( tr("Couldn't save %1").arg(fn), statusbarTime ); - } + } } diff -r 544a64d7cbac -r de97201180ea mapeditor.cpp --- a/mapeditor.cpp Tue Jan 24 15:09:49 2006 +0000 +++ b/mapeditor.cpp Wed Jan 25 09:04:00 2006 +0000 @@ -1147,9 +1147,8 @@ { ExportOO ex; ex.setPath (fn); - ex.setConfigFile(cf); ex.setMapCenter(mapCenter); - ex.exportPresentation(); + if (ex.setConfigFile(cf)) ex.exportPresentation(); } diff -r 544a64d7cbac -r de97201180ea styles/vym2xhtml.xsl --- a/styles/vym2xhtml.xsl Tue Jan 24 15:09:49 2006 +0000 +++ b/styles/vym2xhtml.xsl Wed Jan 25 09:04:00 2006 +0000 @@ -57,7 +57,7 @@ - + @@ -263,21 +263,21 @@ - URL + URL - URL + URL - URL + URL () diff -r 544a64d7cbac -r de97201180ea tex/vym.changelog --- a/tex/vym.changelog Tue Jan 24 15:09:49 2006 +0000 +++ b/tex/vym.changelog Wed Jan 25 09:04:00 2006 +0000 @@ -1,8 +1,9 @@ ------------------------------------------------------------------- -Tue Jan 24 16:07:53 CET 2006 - uwedr +Tue Jan 25 16:07:53 CET 2006 - uwedr - Version 1.7.7 - Feature: Export to Open Office 2.x (Open Document) basically works +- Feature: Export to XHTML uses smaller icon for URLs now ------------------------------------------------------------------- Wed Jan 18 13:29:52 CET 2006 - uwedr diff -r 544a64d7cbac -r de97201180ea version.h --- a/version.h Tue Jan 24 15:09:49 2006 +0000 +++ b/version.h Wed Jan 25 09:04:00 2006 +0000 @@ -3,6 +3,6 @@ #define __VYM "VYM" #define __VYM_VERSION "1.7.7" -#define __BUILD_DATE "January 24, 2006" +#define __BUILD_DATE "January 25, 2006" #endif