diff -r 7a96bd401351 -r f4c37956d28d exportxhtmldialog.ui.h --- a/exportxhtmldialog.ui.h Sun Jan 30 12:58:47 2005 +0000 +++ b/exportxhtmldialog.ui.h Tue Aug 15 11:43:21 2006 +0000 @@ -1,3 +1,6 @@ +//Added by qt3to4: +#include +#include /**************************************************************************** ** ui.h extension file, included from the uic-generated form implementation. ** @@ -9,22 +12,22 @@ extern Settings settings; +extern QDir vymBaseDir; +extern Options options; void ExportXHTMLDialog::init() { - dia=new ShowTextDialog (); - xsltprocessor="xsltproc"; filepath=""; settingsChanged=false; + scriptProc=new Process; } void ExportXHTMLDialog::readSettings() { - dir=settings.readLocalEntry (filepath,"/vym/export/xhtml/exportDir","./" ); + dir=settings.readLocalEntry (filepath,"/vym/export/xhtml/exportDir",vymBaseDir.currentDirPath() ); lineEditDir->setText(dir); - if ( settings.readLocalEntry (filepath,"/vym/export/xhtml/useImage","yes")=="yes") useImage=true; else @@ -63,12 +66,19 @@ showOutput=false; outputButton->setChecked(showOutput); - xsl=settings.readLocalEntry - (filepath,"/vym/export/xhtml/xsl","/usr/share/vym/styles/vym2xhtml.xsl"); + // For testing better use local styles + if (options.isOn ("local")) + { + xsl=vymBaseDir.path()+"/styles/vym2xhtml.xsl"; + css=vymBaseDir.path()+"/styles/vym.css"; + } else + { + xsl=settings.readLocalEntry + (filepath,"/vym/export/xhtml/xsl","/usr/share/vym/styles/vym2xhtml.xsl"); + css=settings.readLocalEntry + (filepath,"/vym/export/xhtml/css","/usr/share/vym/styles/vym.css"); + } lineEditXSL->setText(xsl); - - css=settings.readLocalEntry - (filepath,"/vym/export/xhtml/css","/usr/share/vym/styles/vym.css"); lineEditCSS->setText(css); prescript=settings.readLocalEntry @@ -83,17 +93,16 @@ { 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)); } } void ExportXHTMLDialog::destroy() { - delete (dia); } void ExportXHTMLDialog::dirChanged() @@ -106,8 +115,8 @@ void ExportXHTMLDialog::browseDirectoryPressed() { - QFileDialog fd( this, tr("VYM - Export HTML to directory")); - fd.setMode (QFileDialog::DirectoryOnly); + Q3FileDialog fd( this, tr("VYM - Export HTML to directory")); + fd.setMode (Q3FileDialog::DirectoryOnly); fd.setCaption(tr("VYM - Export HTML to directory")); fd.setModal (true); fd.show(); @@ -159,7 +168,7 @@ void ExportXHTMLDialog::browseCSSPressed() { - QFileDialog fd( this, tr("VYM - Path to CSS file")); + Q3FileDialog fd( this, tr("VYM - Path to CSS file")); fd.setModal (true); fd.addFilter ("Cascading Stylesheet (*.css)"); fd.show(); @@ -186,9 +195,9 @@ void ExportXHTMLDialog::browseXSLPressed() { - QFileDialog fd( this, tr("VYM - Path to XSL file")); + Q3FileDialog fd( this, tr("VYM - Path to XSL file")); fd.setModal (true); - fd.addFilter ("Extensible Styleshee Language (*.xsl)"); + fd.addFilter ("Extensible Stylesheet Language (*.xsl)"); fd.show(); if ( fd.exec() == QDialog::Accepted ) @@ -207,7 +216,7 @@ void ExportXHTMLDialog::browsePreExportButtonPressed() { - QFileDialog fd( this, tr("VYM - Path to pre export script")); + Q3FileDialog fd( this, tr("VYM - Path to pre export script")); fd.setModal (true); fd.addFilter ("Scripts (*.sh *.pl *.py *.php)"); fd.show(); @@ -223,7 +232,7 @@ void ExportXHTMLDialog::browsePostExportButtonPressed() { - QFileDialog fd( this, tr("VYM - Path to post export script")); + Q3FileDialog fd( this, tr("VYM - Path to post export script")); fd.setModal (true); fd.addFilter ("Scripts (*.sh *.pl *.py *.php)"); fd.show(); @@ -243,7 +252,6 @@ // (but don't save at destructor, which // is called for "cancel", too) settings.setLocalEntry (filepath,"/vym/export/xhtml/exportDir",dir); - settings.setLocalEntry (filepath,"/vym/export/xhtml/prescript",prescript); settings.setLocalEntry (filepath,"/vym/export/xhtml/postscript",postscript); @@ -266,19 +274,25 @@ settings.writeEntry ("/vym/export/xhtml/showOutput","yes"); else settings.writeEntry ("/vym/export/xhtml/showOutput","no"); - - settings.setLocalEntry - (filepath,"/vym/export/xhtml/xsl",xsl); - 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"); + QString ipath; + ipath=vymBaseDir.path()+"/flags/flag-url-16x16.png"; + if (!options.isOn ("local")) + { + settings.setLocalEntry + (filepath,"/vym/export/xhtml/xsl",xsl); + settings.setLocalEntry + (filepath,"/vym/export/xhtml/css",css); } + // Provide a smaller URL-icon to improve Layout + QPixmap pm; + if (!pm.load(ipath,"PNG") ) + QMessageBox::warning( 0, tr( "Warning" ),tr("Could not open %1").arg(ipath)); + + + if(!pm.save (dir + "flags/flag-url-16x16.png","PNG")) + QMessageBox::warning( 0, tr( "Warning" ),tr("Could not write %1").arg(ipath)); if (!saveSettingsInMap) settings.clearLocal("/vym/export/xhtml"); else @@ -288,12 +302,12 @@ // Copy CSS file 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!")); + if (!css_src.open ( QIODevice::ReadOnly)) + 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!")); + if (!css_dst.open( QIODevice::WriteOnly)) + QMessageBox::warning( 0, tr( "Warning" ), tr("Could not open %1").arg(dir+"vym.css")); else { @@ -308,52 +322,19 @@ if (!prescript.isEmpty()) runScript (prescript,dir+mapname+".xml"); - Process *xsltProc=new Process (); - xsltProc->clearArguments(); - xsltProc->addArgument (xsltprocessor); if (useImage) - { - xsltProc->addArgument ("--stringparam"); - xsltProc->addArgument ("imagemap"); - xsltProc->addArgument ("images/"+mapname+".png"); - } + p.addStringParam ("imagemap","images/"+mapname+".png"); if (useTextColor) - { - xsltProc->addArgument ("--stringparam"); - xsltProc->addArgument ("use.textcolor"); - xsltProc->addArgument ("1"); - } - xsltProc->addArgument ("--stringparam"); - xsltProc->addArgument ("mapname"); - xsltProc->addArgument (mapname+".vym"); + p.addStringParam ("use.textcolor","1"); + p.addStringParam ("mapname",mapname+".vym"); - xsltProc->addArgument ("--output"); - xsltProc->addArgument (dir+mapname+".html"); - xsltProc->addArgument (xsl); - xsltProc->addArgument (dir+mapname+".xml"); - dia->append ("vym is executing: \n" + xsltProc->arguments().join(" ") ); - if (!xsltProc->start() ) - { - QMessageBox::critical( 0, tr( "Critical Error" ), - tr("Couldn't start ") + xsltprocessor ); - } else - { - xsltProc->waitFinished(); - if (!xsltProc->normalExit() ) - QMessageBox::critical( 0, tr( "Critical Error" ), - xsltprocessor +" " +tr("didn't exit normally") + - xsltProc->getErrout() ); - else - if (xsltProc->exitStatus()>0) showOutput=true; - - } - dia->append ("\n"); - dia->append (xsltProc->getErrout()); - dia->append (xsltProc->getStdout()); - + p.setOutputFile (dir+mapname+".html"); + p.setInputFile (dir+mapname+".xml"); + p.setXSLFile (xsl); + p.process(); + if (!postscript.isEmpty()) runScript (postscript,dir+mapname+".html"); - if (showOutput) dia->exec(); } void ExportXHTMLDialog::setFilePath(const QString &s) @@ -387,26 +368,25 @@ spath.replace ("%f",fpath); QStringList args=QStringList::split (' ',spath,false); - Process *scriptProc=new Process (); scriptProc->clearArguments(); scriptProc->setArguments (args); - dia->append ("vym is executing: \n" + scriptProc->arguments().join(" ") ); + p.addOutput ("vym is executing: \n" + scriptProc->arguments().join(" ") ); if (!scriptProc->start() ) { QMessageBox::critical( 0, tr( "Critical Error" ), - tr("Couldn't start ") + spath ); + tr("Could not 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; } - dia->append ("\n"); - dia->append (scriptProc->getErrout()); - dia->append (scriptProc->getStdout()); + p.addOutput ("\n"); + p.addOutput (scriptProc->getErrout()); + p.addOutput (scriptProc->getStdout()); }