# HG changeset patch # User insilmaril # Date 1270822562 0 # Node ID b98c1793bb8b42c3e60cbd3696d63d8fda19e2ab # Parent c48bb42fb9779038d99f57e75501d04b6d6fa2f0 XHTML export obsoleted by HTML export diff -r c48bb42fb977 -r b98c1793bb8b branchitem.cpp --- a/branchitem.cpp Wed Apr 07 10:45:24 2010 +0000 +++ b/branchitem.cpp Fri Apr 09 14:16:02 2010 +0000 @@ -101,13 +101,6 @@ } else areaAttr=""; - // Provide an ID for a branch makes export to XHTML easier - QString idAttr; - if (xlinkCount()>0) - idAttr=attribut ("id",model->getSelectString(this)); - else - idAttr=""; - QString elementName; if (parentItem==rootItem) elementName="mapcenter"; @@ -119,7 +112,6 @@ +getGeneralAttr() +scrolledAttr // +areaAttr // FIXME-4 not needed anymore. Wait until end of 2010 before removing... - +idAttr +getIncludeImageAttr() ); incIndent(); diff -r c48bb42fb977 -r b98c1793bb8b exportxhtmldialog.cpp --- a/exportxhtmldialog.cpp Wed Apr 07 10:45:24 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,418 +0,0 @@ -#include "exportxhtmldialog.h" - -#include -#include -#include - -#include "options.h" -#include "settings.h" - - -extern Options options; -extern QDir vymBaseDir; -extern Settings settings; -extern bool debug; - -ExportXHTMLDialog::ExportXHTMLDialog(QWidget* parent) : QDialog(parent) -{ - ui.setupUi(this); - - filepath=""; - settingsChanged=false; - scriptProc=new Process; - - // signals and slots connections - connect(ui.browseExportDirButton, SIGNAL(pressed()), this, SLOT(browseDirectoryPressed())); - connect(ui.outputButton, SIGNAL(toggled(bool)), this, SLOT(outputButtonPressed(bool))); - connect(ui.browseXSLButton, SIGNAL(pressed()), this, SLOT(browseXSLPressed())); - connect(ui.browseCSSButton, SIGNAL(pressed()), this, SLOT(browseCSSPressed())); - connect(ui.imageButton, SIGNAL(toggled(bool)), this, SLOT(imageButtonPressed(bool))); - connect(ui.textColorButton, SIGNAL(toggled(bool)), this, SLOT(textcolorButtonPressed(bool))); - connect(ui.lineEditDir, SIGNAL(textChanged(const QString&)), this, SLOT(dirChanged())); - connect(ui.lineEditCSS, SIGNAL(textChanged(const QString&)), this, SLOT(cssChanged())); - connect(ui.lineEditXSL, SIGNAL(textChanged(const QString&)), this, SLOT(xslChanged())); - connect(ui.warningsButton, SIGNAL(toggled(bool)), this, SLOT(warningsButtonPressed(bool))); - connect(ui.saveSettingsInMapButton, SIGNAL(toggled(bool)), this, SLOT(saveSettingsInMapButtonPressed(bool))); - connect(ui.browsePreExportButton, SIGNAL(pressed()), this, SLOT(browsePreExportButtonPressed())); - connect(ui.lineEditPreScript, SIGNAL(textChanged(const QString&)), this, SLOT(prescriptChanged())); - connect(ui.lineEditPostScript, SIGNAL(textChanged(const QString&)), this, SLOT(postscriptChanged())); - connect(ui.browsePostExportButton, SIGNAL(pressed()), this, SLOT(browsePostExportButtonPressed())); -} - - -void ExportXHTMLDialog::readSettings() -{ - - dir=settings.readLocalEntry (filepath,"/export/xhtml/exportDir",vymBaseDir.currentDirPath() ); - ui.lineEditDir->setText(dir); - - if ( settings.readLocalEntry (filepath,"/export/xhtml/useImage","yes")=="yes") - useImage=true; - else - useImage=false; - ui.imageButton->setChecked(useImage); - - if ( settings.readLocalEntry (filepath,"/export/xhtml/useTextColor","no")=="yes") - useTextColor=true; - else - useTextColor=false; - ui.textColorButton->setChecked(useTextColor); - -/* TODO this was used in old html export, is not yet in new stylesheet - if ( settings.readEntry ("/export/html/useHeading","no")=="yes") - useHeading=true; - else - useHeading=false; - checkBox4_2->setChecked(useHeading); -*/ - - if ( settings.readLocalEntry (filepath,"/export/xhtml/saveSettingsInMap","no")=="yes") - saveSettingsInMap=true; - else - saveSettingsInMap=false; - ui.saveSettingsInMapButton->setChecked(saveSettingsInMap); - - if ( settings.readEntry ("/export/xhtml/showWarnings","yes")=="yes") - showWarnings=true; - else - showWarnings=false; - ui.warningsButton->setChecked(showWarnings); - - if ( settings.readEntry ("/export/xhtml/showOutput","no")=="yes") - showOutput=true; - else - showOutput=false; - ui.outputButton->setChecked(showOutput); - - // For testing better use local styles - const QString defxsl(vymBaseDir.path() + "/styles/vym2xhtml.xsl"); - const QString defcss(vymBaseDir.path() + "/styles/vym.css"); - if (options.isOn ("local")) - { - xsl=defxsl; - css=defcss; - } else - { - xsl=settings.readLocalEntry - (filepath,"/export/xhtml/xsl",defxsl); - css=settings.readLocalEntry - (filepath,"/export/xhtml/css",defcss); - } - ui.lineEditXSL->setText(xsl); - ui.lineEditCSS->setText(css); - - prescript=settings.readLocalEntry - (filepath,"/export/xhtml/prescript",""); - ui.lineEditPreScript->setText (prescript); - - postscript=settings.readLocalEntry - (filepath,"/export/xhtml/postscript",""); - ui.lineEditPostScript->setText (postscript); - - if (!prescript.isEmpty() || !postscript.isEmpty()) - { - QMessageBox::warning( 0, tr( "Warning" ),tr( - "The settings saved in the map " - "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::setDir(const QString &d) -{ - dir=d; - if (dir.right(1)!="/") dir+="/"; -} - -void ExportXHTMLDialog::dirChanged() -{ - setDir (ui.lineEditDir->text()); - settingsChanged=true; -} - -void ExportXHTMLDialog::browseDirectoryPressed() -{ - QFileDialog fd( this); - fd.setMode (QFileDialog::DirectoryOnly); - fd.setCaption(tr("VYM - Export HTML to directory")); - fd.setModal (true); - fd.setDirectory (QDir::current()); - fd.show(); - - if ( fd.exec() == QDialog::Accepted ) - { - dir=fd.selectedFile(); - ui.lineEditDir->setText (dir ); - settingsChanged=true; - } -} - -void ExportXHTMLDialog::imageButtonPressed(bool b) -{ - useImage=b; - settingsChanged=true; -} - -void ExportXHTMLDialog::textcolorButtonPressed(bool b) -{ - useTextColor=b; - settingsChanged=true; -} - -void ExportXHTMLDialog::saveSettingsInMapButtonPressed(bool b) -{ - saveSettingsInMap=b; - settingsChanged=true; -} - -void ExportXHTMLDialog::warningsButtonPressed(bool b) -{ - showWarnings=b; - settingsChanged=true; -} - - -void ExportXHTMLDialog::outputButtonPressed(bool b) -{ - showOutput=b; - settingsChanged=true; -} - -void ExportXHTMLDialog::cssChanged() -{ - css=ui.lineEditCSS->text(); - settingsChanged=true; -} - -void ExportXHTMLDialog::browseCSSPressed() -{ - QFileDialog fd( this); - fd.setModal (true); - fd.setFilter ("Cascading Stylesheet (*.css)"); - fd.setDirectory (QDir::current()); - fd.show(); - - if ( fd.exec() == QDialog::Accepted ) - { - css=fd.selectedFile(); - ui.lineEditCSS->setText (css ); - settingsChanged=true; - } -} - -void ExportXHTMLDialog::xslChanged() -{ - xsl=ui.lineEditXSL->text(); - settingsChanged=true; -} - -void ExportXHTMLDialog::prescriptChanged() -{ - prescript=ui.lineEditPreScript->text(); - settingsChanged=true; -} - -void ExportXHTMLDialog::browseXSLPressed() -{ - QFileDialog fd( this); - fd.setModal (true); - fd.setFilter ("Extensible Stylesheet Language (*.xsl)"); - fd.setDirectory (QDir::current()); - fd.show(); - - if ( fd.exec() == QDialog::Accepted ) - { - xsl=fd.selectedFile(); - ui.lineEditXSL->setText (xsl ); - settingsChanged=true; - } -} - -void ExportXHTMLDialog::postscriptChanged() -{ - postscript=ui.lineEditPostScript->text(); - settingsChanged=true; -} - -void ExportXHTMLDialog::browsePreExportButtonPressed() -{ - QFileDialog fd( this); - fd.setModal (true); - fd.setFilter ("Scripts (*.sh *.pl *.py *.php)"); - fd.setDirectory (QDir::current()); - fd.show(); - - if ( fd.exec() == QDialog::Accepted ) - { - prescript=fd.selectedFile(); - ui.lineEditPreScript->setText (prescript ); - settingsChanged=true; - } - -} - -void ExportXHTMLDialog::browsePostExportButtonPressed() -{ - QFileDialog fd( this); - fd.setModal (true); - fd.setFilter ("Scripts (*.sh *.pl *.py *.php)"); - fd.setDirectory (QDir::current()); - fd.show(); - - if ( fd.exec() == QDialog::Accepted ) - { - postscript=fd.selectedFile(); - ui.lineEditPostScript->setText (postscript ); - settingsChanged=true; - } -} - - -void ExportXHTMLDialog::doExport (const QString &mapname) -{ - - // Save options to settings file - // (but don't save at destructor, which - // is called for "cancel", too) - settings.setLocalEntry (filepath,"/export/xhtml/exportDir",dir); - settings.setLocalEntry (filepath,"/export/xhtml/prescript",prescript); - settings.setLocalEntry (filepath,"/export/xhtml/postscript",postscript); - - if (useImage) - settings.setLocalEntry (filepath,"/export/xhtml/useImage","yes"); - else - settings.setLocalEntry (filepath,"/export/xhtml/useImage","no"); - - if (useTextColor) - settings.setLocalEntry (filepath,"/export/xhtml/useTextColor","yes"); - else - settings.setLocalEntry (filepath,"/export/xhtml/useTextColor","no"); - - if (showWarnings) - settings.writeEntry ("/export/xhtml/showWarnings","yes"); - else - settings.writeEntry ("/export/xhtml/showWarnings","no"); - - if (showOutput) - settings.writeEntry ("/export/xhtml/showOutput","yes"); - else - settings.writeEntry ("/export/xhtml/showOutput","no"); - - QString ipath; - ipath=vymBaseDir.path()+"/flags/flag-url-16x16.png"; - if (!options.isOn ("local")) - { - settings.setLocalEntry - (filepath,"/export/xhtml/xsl",xsl); - settings.setLocalEntry - (filepath,"/export/xhtml/css",css); - } - - if (!saveSettingsInMap) - settings.clearLocal("/export/xhtml"); - else - settings.setLocalEntry - (filepath,"/export/xhtml/saveSettingsInMap","yes"); - - // 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)); - - // Copy CSS file - QFile css_src (css); - QFile css_dst (dir+"vym.css"); - if (!css_src.open ( QIODevice::ReadOnly)) - QMessageBox::warning( 0, tr( "Warning" ),tr("Could not open %1").arg(css)); - else - { - if (!css_dst.open( QIODevice::WriteOnly)) - QMessageBox::warning( 0, tr( "Warning" ), tr("Could not open %1").arg(dir+"vym.css")); - else - { - - QTextStream tsout( &css_dst); - QTextStream tsin ( &css_src); - QString s= tsin.read(); - tsout << s; - css_dst.close(); - } - css_src.close(); - } - - if (!prescript.isEmpty()) runScript (prescript,dir+mapname+".xml"); - - if (useImage) - p.addStringParam ("imagemap","images/"+mapname+".png"); - if (useTextColor) - p.addStringParam ("use.textcolor","1"); - p.addStringParam ("mapname",mapname+".vym"); - - p.setOutputFile (dir+mapname+".html"); - p.setInputFile (dir+mapname+".xml"); - p.setXSLFile (xsl); - p.process(); - - if (!postscript.isEmpty()) runScript (postscript,dir+mapname+".html"); - -} - -void ExportXHTMLDialog::setFilePath(const QString &s) -{ - filepath=s; -} - -void ExportXHTMLDialog::setMapName(const QString &s) -{ - mapname=s; -} - -QString ExportXHTMLDialog::getDir() -{ - return dir; -} - -bool ExportXHTMLDialog::warnings() -{ - return showWarnings; -} - -bool ExportXHTMLDialog::hasChanged() -{ - return settingsChanged; -} - - -void ExportXHTMLDialog::runScript(QString spath, QString fpath) -{ - spath.replace ("%f",fpath); - QStringList args=QStringList::split (' ',spath,false); - - p.addOutput ("vym is executing: \n" + spath+" "+args.join(" ") ); - scriptProc->start (spath,args); - if (!scriptProc->waitForStarted() ) - { - QMessageBox::critical( 0, tr( "Critical Error" ), - tr("Could not start %1").arg(spath) ); - } else - { - if (!scriptProc->waitForFinished()) - QMessageBox::critical( 0, tr( "Critical Error" ), - tr("%1 didn't exit normally").arg(spath) + - scriptProc->getErrout() ); - else - if (scriptProc->exitStatus()>0) showOutput=true; - - } - p.addOutput ("\n"); - p.addOutput (scriptProc->getErrout()); - p.addOutput (scriptProc->getStdout()); -} - diff -r c48bb42fb977 -r b98c1793bb8b exportxhtmldialog.h --- a/exportxhtmldialog.h Wed Apr 07 10:45:24 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -#ifndef EXPORTXHTMLDIALOG_H -#define EXPORTXHTMLDIALOG_H - -#include "ui_exportxhtmldialog.h" - -/*! \brief Dialog to export a map as XHTML document - -This is an overloaded QDialog with various settings needed to call -convert the vym.xml to a XHTML document. -The conversion itself is done by calling xsltproc. -*/ - -class ExportXHTMLDialog:public QDialog -{ - Q_OBJECT -public: - ExportXHTMLDialog(QWidget* parent = 0); - - virtual QString getDir(); - virtual bool warnings(); - virtual bool hasChanged(); - -public slots: - virtual void readSettings(); - virtual void setDir (const QString&); - virtual void dirChanged(); - virtual void browseDirectoryPressed(); - virtual void imageButtonPressed( bool b ); - virtual void textcolorButtonPressed( bool b ); - virtual void saveSettingsInMapButtonPressed( bool b ); - virtual void warningsButtonPressed( bool b ); - virtual void outputButtonPressed( bool b ); - virtual void cssChanged(); - virtual void browseCSSPressed(); - virtual void xslChanged(); - virtual void prescriptChanged(); - virtual void browseXSLPressed(); - virtual void postscriptChanged(); - virtual void browsePreExportButtonPressed(); - virtual void browsePostExportButtonPressed(); - virtual void doExport( const QString & mapname ); - virtual void setFilePath( const QString & s ); - virtual void setMapName( const QString & s ); - -protected: - bool useTextColor; - bool showWarnings; - QString xsl; - QString css; - bool useImage; - bool showOutput; - QString dir; - QString filepath; - QString prescript; - QString postscript; - bool settingsChanged; - QString mapname; - bool saveSettingsInMap; - XSLTProc p; - Process *scriptProc; - -private: - Ui::ExportXHTMLDialog ui; - void init(); - void destroy(); - void runScript( QString spath, QString fpath ); - -}; - -#endif // EXPORTXHTMLDIALOG_H diff -r c48bb42fb977 -r b98c1793bb8b highlighter.cpp --- a/highlighter.cpp Wed Apr 07 10:45:24 2010 +0000 +++ b/highlighter.cpp Fri Apr 09 14:16:02 2010 +0000 @@ -51,7 +51,6 @@ << "\\bexportAO\\b" << "\\bexportASCII\\b" << "\\bexportImage\\b" - << "\\bexportXHTML\\b" << "\\bexportXML\\b" << "\\bimportDir\\b" << "\\blinkTo\\b" diff -r c48bb42fb977 -r b98c1793bb8b mainwindow.cpp --- a/mainwindow.cpp Wed Apr 07 10:45:24 2010 +0000 +++ b/mainwindow.cpp Fri Apr 09 14:16:02 2010 +0000 @@ -475,17 +475,11 @@ a = new QAction( "Webpage (HTML)...",this ); a->setShortcut (Qt::ALT + Qt::Key_X); //Export HTML - a->setStatusTip ( tr( "Export as %1","status tip file menu").arg(tr(" webpage (XHTML)","status tip file menu"))); + a->setStatusTip ( tr( "Export as %1","status tip file menu").arg(tr(" webpage (HTML)","status tip file menu"))); switchboard.addConnection(a,tr("File","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( fileExportHTML() ) ); fileExportMenu->addAction (a); - a = new QAction( "Webpage (XHTML)...",this ); //Export XHTML - - //a->setShortcut (Qt::ALT + Qt::SHIFT + Qt::Key_X); a->setStatusTip ( tr( "Export as %1","status tip file menu").arg(tr(" webpage (XHTML)","status tip file menu"))); - connect( a, SIGNAL( triggered() ), this, SLOT( fileExportXHTML() ) ); - fileExportMenu->addAction (a); - a = new QAction( "Text (A&O report)...", this); a->setStatusTip ( tr( "Export as %1").arg("A&O report "+tr("(still experimental)" ))); switchboard.addConnection(a,tr("File","Shortcut group")); @@ -2448,13 +2442,6 @@ if (m) m->exportHTML(); } - -void Main::fileExportXHTML() -{ - VymModel *m=currentModel(); - if (m) m->exportXHTML(); -} - void Main::fileExportImage() { VymModel *m=currentModel(); diff -r c48bb42fb977 -r b98c1793bb8b mainwindow.h --- a/mainwindow.h Wed Apr 07 10:45:24 2010 +0000 +++ b/mainwindow.h Fri Apr 09 14:16:02 2010 +0000 @@ -100,7 +100,6 @@ void fileImportDir(); void fileExportXML(); void fileExportHTML(); - void fileExportXHTML(); void fileExportImage(); void fileExportAO(); void fileExportASCII(); diff -r c48bb42fb977 -r b98c1793bb8b version.h --- a/version.h Wed Apr 07 10:45:24 2010 +0000 +++ b/version.h Fri Apr 09 14:16:02 2010 +0000 @@ -4,10 +4,10 @@ #include #define __VYM_NAME "VYM" -#define __VYM_VERSION "1.13.2" +#define __VYM_VERSION "1.13.3" //#define __VYM_CODENAME "Codename: RC-1" #define __VYM_CODENAME "Codename: development version, not for production!" -#define __VYM_BUILD_DATE "2010-03-30" +#define __VYM_BUILD_DATE "2010-04-09" bool checkVersion(const QString &); diff -r c48bb42fb977 -r b98c1793bb8b vym.changelog --- a/vym.changelog Wed Apr 07 10:45:24 2010 +0000 +++ b/vym.changelog Fri Apr 09 14:16:02 2010 +0000 @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Apr 9 16:12:55 CEST 2010 - vym@insilmaril.de + +- Feature: XHTML export obsoleted by HTML export + ------------------------------------------------------------------- Wed Apr 7 12:01:25 CEST 2010 - vym@insilmaril.de diff -r c48bb42fb977 -r b98c1793bb8b vym.pro --- a/vym.pro Wed Apr 07 10:45:24 2010 +0000 +++ b/vym.pro Fri Apr 09 14:16:02 2010 +0000 @@ -46,7 +46,6 @@ exportoofiledialog.h \ exporthtmldialog.h\ exporthtmldialog.h\ - exportxhtmldialog.h\ exports.h \ extrainfodialog.h \ file.h \ @@ -117,7 +116,6 @@ exportoofiledialog.cpp \ exports.cpp \ exporthtmldialog.cpp \ - exportxhtmldialog.cpp \ extrainfodialog.cpp \ file.cpp \ findwidget.cpp \ @@ -175,7 +173,6 @@ attributewidget.ui \ branchpropwindow.ui \ exporthtmldialog.ui \ - exportxhtmldialog.ui \ extrainfodialog.ui \ editxlinkdialog.ui \ historywindow.ui \ diff -r c48bb42fb977 -r b98c1793bb8b vymmodel.cpp --- a/vymmodel.cpp Wed Apr 07 10:45:24 2010 +0000 +++ b/vymmodel.cpp Fri Apr 09 14:16:02 2010 +0000 @@ -10,7 +10,6 @@ #include "editxlinkdialog.h" #include "exports.h" #include "exporthtmldialog.h" -#include "exportxhtmldialog.h" #include "file.h" #include "findresultmodel.h" #include "geometry.h" // for addBBox @@ -3473,21 +3472,6 @@ exportImage (fname,false,format); } ///////////////////////////////////////////////////////////////////// - } else if (com=="exportXHTML") - { - QString fname=""; - ok=true; - if (parser.parCount()>=2) - // Hey, we even have a filename - fname=parser.parString(ok,1); - if (!ok) - { - parser.setError (Aborted,"Could not read filename"); - } else - { - exportXHTML (fname,false); - } - ///////////////////////////////////////////////////////////////////// } else if (com=="exportXML") { QString fname=""; @@ -4371,48 +4355,6 @@ ex.doExport(useDialog); } -void VymModel::exportXHTML (const QString &dir, bool askForName) -{ - ExportXHTMLDialog dia(NULL); - dia.setFilePath (filePath ); - dia.setMapName (mapName ); - dia.readSettings(); - if (dir!="") dia.setDir (dir); - - bool ok=true; - - if (askForName) - { - if (dia.exec()!=QDialog::Accepted) - ok=false; - else - { - QDir d (dia.getDir()); - // Check, if warnings should be used before overwriting - // the output directory - if (d.exists() && d.count()>0) - { - WarningDialog warn; - warn.showCancelButton (true); - warn.setText(QString( - "The directory %1 is not empty.\n" - "Do you risk to overwrite some of its contents?").arg(d.path() )); - warn.setCaption("Warning: Directory not empty"); - warn.setShowAgainName("mainwindow/overwrite-dir-xhtml"); - - if (warn.exec()!=QDialog::Accepted) ok=false; - } - } - } - - if (ok) - { - exportXML (dia.getDir(),false ); - dia.doExport(mapName ); - //if (dia.hasChanged()) setChanged(); - } -} - void VymModel::exportOOPresentation(const QString &fn, const QString &cf) { ExportOO ex; diff -r c48bb42fb977 -r b98c1793bb8b vymmodel.h --- a/vymmodel.h Wed Apr 07 10:45:24 2010 +0000 +++ b/vymmodel.h Fri Apr 09 14:16:02 2010 +0000 @@ -450,7 +450,6 @@ /*! Export as HTML to directory */ void exportHTML(const QString& dir="", bool useDialog=true); - void exportXHTML(const QString& dir="", bool askForName=true); /*! Export as OpenOfficeOrg presentation */ void exportOOPresentation(const QString &,const QString &);