1.1 --- a/branchobj.cpp Fri Sep 08 12:30:09 2006 +0000
1.2 +++ b/branchobj.cpp Thu Sep 14 11:38:17 2006 +0000
1.3 @@ -664,6 +664,7 @@
1.4
1.5 void BranchObj::setDockPos()
1.6 {
1.7 + // Sets childpos and parpos depending on orientation
1.8 if (getOrientation()==OrientLeftOfCenter )
1.9 {
1.10 childPos=QPoint (ornamentsBBox.bottomLeft().x(), ornamentsBBox.bottomLeft().y() );
1.11 @@ -674,6 +675,7 @@
1.12 parPos=QPoint (ornamentsBBox.bottomLeft().x(),ornamentsBBox.bottomLeft().y() );
1.13 }
1.14 }
1.15 +
1.16 LinkableMapObj* BranchObj::findMapObj(QPoint p, LinkableMapObj* excludeLMO)
1.17 {
1.18 // Search branches
1.19 @@ -1242,30 +1244,42 @@
1.20 int th = bboxTotal.height();
1.21 // TODO testing
1.22 /*
1.23 - cout << "BO::alignRelTo "<<getHeading()<<endl;
1.24 + cout << "BO::alignRelTo "<<getHeading().ascii()<<endl;
1.25 cout << " d="<<depth<<
1.26 " ref="<<ref<<
1.27 // " bbox.topLeft="<<bboxTotal.topLeft()<<
1.28 " absPos="<<absPos<<
1.29 + " relPos="<<relPos<<
1.30 + " orient="<<orientation<<
1.31 // " pad="<<topPad<<","<<botPad<<","<<leftPad<<","<<rightPad<<
1.32 - " hidden="<<hidden<<
1.33 - " th="<<th<<endl;
1.34 +// " hidden="<<hidden<<
1.35 +// " th="<<th<<
1.36 + endl;
1.37 */
1.38
1.39 - // If I am the mapcenter or a mainbranch, reposition heading
1.40 + setOrientation();
1.41 + //updateLink();
1.42 +
1.43 if (depth<2)
1.44 {
1.45 if (depth==1)
1.46 + {
1.47 + // Position relatively, if needed
1.48 + //if (useRelPos) move2RelPos (relPos.x(), relPos.y());
1.49 +
1.50 // Calc angle to mapCenter if I am a mainbranch
1.51 // needed for reordering the mainbranches clockwise
1.52 // around mapcenter
1.53 angle=getAngle (QPoint ((int)(x() - parObj->getChildPos().x() ),
1.54 (int)(y() - parObj->getChildPos().y() ) ) );
1.55 + }
1.56 }
1.57 else
1.58 {
1.59 // Align myself depending on orientation and parent, but
1.60 - // only if I am not the mainbranch or mapcenter itself
1.61 + // only if I am not a mainbranch or mapcenter itself
1.62 + LinkOrient o;
1.63 + o=parObj->getOrientation();
1.64 switch (orientation)
1.65 {
1.66 case OrientLeftOfCenter:
1.67 @@ -1311,10 +1325,13 @@
1.68 {
1.69 /* TODO testing only
1.70 if (!getHeading().isEmpty())
1.71 - cout << "BO::reposition "<<getHeading()<<endl;
1.72 + cout << "BO::reposition "<<getHeading().ascii()<<endl;
1.73 else
1.74 cout << "BO::reposition ???"<<endl;
1.75 +
1.76 + cout << " orient="<<orientation<<endl;
1.77 */
1.78 +
1.79 if (depth==0)
1.80 {
1.81 // only calculate the sizes once. If the deepest LMO
1.82 @@ -1323,6 +1340,7 @@
1.83 calcBBoxSizeWithChilds();
1.84 updateLink(); // This update is needed if the canvas is resized
1.85 // due to excessive moving of a FIO
1.86 + // FIXME really needed? reposition is also called from updateLink...
1.87
1.88 alignRelativeTo ( QPoint (absPos.x(),
1.89 absPos.y()-(bboxTotal.height()-bbox.height())/2) );
1.90 @@ -1337,6 +1355,16 @@
1.91 }
1.92 }
1.93
1.94 +void BranchObj::unsetAllRepositionRequests()
1.95 +{
1.96 + repositionRequest=false;
1.97 + BranchObj *b;
1.98 + for (b=branch.first(); b; b=branch.next() )
1.99 + {
1.100 + b->unsetAllRepositionRequests();
1.101 + }
1.102 +}
1.103 +
1.104
1.105 QRect BranchObj::getTotalBBox()
1.106 {
2.1 --- a/branchobj.h Fri Sep 08 12:30:09 2006 +0000
2.2 +++ b/branchobj.h Thu Sep 14 11:38:17 2006 +0000
2.3 @@ -113,6 +113,7 @@
2.4 virtual BranchObj* moveBranchTo (BranchObj*, int);
2.5 virtual void alignRelativeTo(const QPoint );
2.6 virtual void reposition();
2.7 + virtual void unsetAllRepositionRequests();
2.8
2.9 virtual QRect getTotalBBox(); // return BBox including childs
2.10 virtual QRect getBBoxSizeWithChilds(); // return size of BBox including childs
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/editxlinkdialog.cpp Thu Sep 14 11:38:17 2006 +0000
3.3 @@ -0,0 +1,77 @@
3.4 +#include "editxlinkdialog.h"
3.5 +
3.6 +#include <QColorDialog>
3.7 +
3.8 +EditXLinkDialog::EditXLinkDialog (QWidget *parent):QDialog (parent)
3.9 +{
3.10 + ui.setupUi (this);
3.11 +
3.12 + delink=false;
3.13 + xlo=false;
3.14 + selection=NULL;
3.15 +
3.16 + connect ( ui.widthBox, SIGNAL (valueChanged( int)), this, SLOT (widthChanged (int)));
3.17 + connect ( ui.colorButton, SIGNAL (clicked( )), this, SLOT (colorButtonPressed()));
3.18 + connect ( ui.setColorHeadingButton, SIGNAL (clicked( )), this, SLOT (setColorHeadingButtonPressed()));
3.19 + connect ( ui.deleteButton, SIGNAL (clicked( )), this, SLOT (deleteButtonPressed()));
3.20 +}
3.21 +
3.22 +void EditXLinkDialog::deleteButtonPressed()
3.23 +{
3.24 + delink=true;
3.25 + accept();
3.26 +}
3.27 +
3.28 +bool EditXLinkDialog::deleteXLink()
3.29 +{
3.30 + return delink;
3.31 +}
3.32 +
3.33 +
3.34 +void EditXLinkDialog::widthChanged( int w)
3.35 +{
3.36 + xlo->setWidth(w);
3.37 +}
3.38 +
3.39 +void EditXLinkDialog::setXLink( XLinkObj * xo)
3.40 +{
3.41 + xlo=xo;
3.42 + ui.colorButton->setPaletteBackgroundColor (xlo->getColor() );
3.43 + ui.widthBox->setValue(xlo->getWidth());
3.44 +}
3.45 +
3.46 +void EditXLinkDialog::setSelection(LinkableMapObj *s)
3.47 +{
3.48 + selection=s;
3.49 +}
3.50 +
3.51 +void EditXLinkDialog::colorButtonPressed()
3.52 +{
3.53 + if (xlo)
3.54 + {
3.55 + QColor col = QColorDialog::getColor(xlo->getColor(), this );
3.56 + if ( !col.isValid() ) return;
3.57 + xlo->setColor( col );
3.58 + ui.colorButton->setPaletteBackgroundColor (col);
3.59 + }
3.60 +}
3.61 +
3.62 +void EditXLinkDialog::setColorHeadingButtonPressed()
3.63 +{
3.64 + if (xlo)
3.65 + {
3.66 + if (selection &&
3.67 + (typeid(*selection) == typeid(BranchObj)) ||
3.68 + (typeid(*selection) == typeid(MapCenterObj)) )
3.69 + {
3.70 + QColor col=((BranchObj*)(selection))->getColor();
3.71 + xlo->setColor(col);
3.72 + ui.colorButton->setPaletteBackgroundColor (col);
3.73 + }
3.74 + }
3.75 +}
3.76 +
3.77 +bool EditXLinkDialog::useSettingsGlobal ()
3.78 +{
3.79 + return ui.useSettings->isChecked();
3.80 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/editxlinkdialog.h Thu Sep 14 11:38:17 2006 +0000
4.3 @@ -0,0 +1,29 @@
4.4 +#ifndef EDITXLINKDIALOG_H
4.5 +#define EDITXLINKDIALOG_H
4.6 +
4.7 +#include "ui_editxlinkdialog.h"
4.8 +
4.9 +class EditXLinkDialog:public QDialog
4.10 +{
4.11 + Q_OBJECT
4.12 +public:
4.13 + EditXLinkDialog (QWidget *parent=0);
4.14 + void setXLink (XLinkObj *);
4.15 + void setSelection (LinkableMapObj *);
4.16 + bool useSettingsGlobal();
4.17 + bool deleteXLink();
4.18 +
4.19 +private slots:
4.20 + void deleteButtonPressed();
4.21 + void widthChanged (int);
4.22 + void colorButtonPressed();
4.23 + void setColorHeadingButtonPressed ();
4.24 +
4.25 +private:
4.26 + Ui::EditXLinkDialog ui;
4.27 + bool delink;
4.28 + XLinkObj *xlo;
4.29 + LinkableMapObj *selection;
4.30 +};
4.31 +
4.32 +#endif // EDITXLINKDIALOG_H
5.1 --- a/editxlinkdialog.ui.h Fri Sep 08 12:30:09 2006 +0000
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,74 +0,0 @@
5.4 -/****************************************************************************
5.5 -** ui.h extension file, included from the uic-generated form implementation.
5.6 -**
5.7 -** If you wish to add, delete or rename functions or slots use
5.8 -** Qt Designer which will update this file, preserving your code. Create an
5.9 -** init() function in place of a constructor, and a destroy() function in
5.10 -** place of a destructor.
5.11 -*****************************************************************************/
5.12 -void EditXLinkDialog::init()
5.13 -{
5.14 - delink=false;
5.15 - xlo=false;
5.16 - selection=NULL;
5.17 -}
5.18 -
5.19 -void EditXLinkDialog::deleteButtonPressed()
5.20 -{
5.21 - delink=true;
5.22 - accept();
5.23 -}
5.24 -
5.25 -bool EditXLinkDialog::deleteXLink()
5.26 -{
5.27 - return delink;
5.28 -}
5.29 -
5.30 -
5.31 -void EditXLinkDialog::widthChanged( int w)
5.32 -{
5.33 - xlo->setWidth(w);
5.34 -}
5.35 -
5.36 -void EditXLinkDialog::setXLink( XLinkObj * xo)
5.37 -{
5.38 - xlo=xo;
5.39 - colorButton->setPaletteBackgroundColor (xlo->getColor() );
5.40 - widthBox->setValue(xlo->getWidth());
5.41 -}
5.42 -
5.43 -void EditXLinkDialog::setSelection(LinkableMapObj *s)
5.44 -{
5.45 - selection=s;
5.46 -}
5.47 -
5.48 -void EditXLinkDialog::colorButtonPressed()
5.49 -{
5.50 - if (xlo)
5.51 - {
5.52 - QColor col = QColorDialog::getColor(xlo->getColor(), this );
5.53 - if ( !col.isValid() ) return;
5.54 - xlo->setColor( col );
5.55 - colorButton->setPaletteBackgroundColor (col);
5.56 - }
5.57 -}
5.58 -
5.59 -void EditXLinkDialog::setColorHeadingButtonPressed()
5.60 -{
5.61 - if (xlo)
5.62 - {
5.63 - if (selection &&
5.64 - (typeid(*selection) == typeid(BranchObj)) ||
5.65 - (typeid(*selection) == typeid(MapCenterObj)) )
5.66 - {
5.67 - QColor col=((BranchObj*)(selection))->getColor();
5.68 - xlo->setColor(col);
5.69 - colorButton->setPaletteBackgroundColor (col);
5.70 - }
5.71 - }
5.72 -}
5.73 -
5.74 -bool EditXLinkDialog::useSettingsGlobal ()
5.75 -{
5.76 - return useSettings->isChecked();
5.77 -}
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/exportxhtmldialog.cpp Thu Sep 14 11:38:17 2006 +0000
6.3 @@ -0,0 +1,411 @@
6.4 +#include "exportxhtmldialog.h"
6.5 +
6.6 +#include <QFileDialog>
6.7 +#include <QMessageBox>
6.8 +#include <QTextStream>
6.9 +
6.10 +#include "options.h"
6.11 +#include "settings.h"
6.12 +
6.13 +
6.14 +extern Options options;
6.15 +extern QDir vymBaseDir;
6.16 +extern Settings settings;
6.17 +
6.18 +ExportXHTMLDialog::ExportXHTMLDialog(QWidget* parent) : QDialog(parent)
6.19 +{
6.20 + ui.setupUi(this);
6.21 +
6.22 + filepath="";
6.23 + settingsChanged=false;
6.24 + scriptProc=new Process;
6.25 +
6.26 + // signals and slots connections
6.27 + connect(ui.browseExportDirButton, SIGNAL(pressed()), this, SLOT(browseDirectoryPressed()));
6.28 + connect(ui.outputButton, SIGNAL(toggled(bool)), this, SLOT(outputButtonPressed(bool)));
6.29 + connect(ui.browseXSLButton, SIGNAL(pressed()), this, SLOT(browseXSLPressed()));
6.30 + connect(ui.browseCSSButton, SIGNAL(pressed()), this, SLOT(browseCSSPressed()));
6.31 + connect(ui.imageButton, SIGNAL(toggled(bool)), this, SLOT(imageButtonPressed(bool)));
6.32 + connect(ui.textColorButton, SIGNAL(toggled(bool)), this, SLOT(textcolorButtonPressed(bool)));
6.33 + connect(ui.lineEditDir, SIGNAL(textChanged(const QString&)), this, SLOT(dirChanged()));
6.34 + connect(ui.lineEditCSS, SIGNAL(textChanged(const QString&)), this, SLOT(cssChanged()));
6.35 + connect(ui.lineEditXSL, SIGNAL(textChanged(const QString&)), this, SLOT(xslChanged()));
6.36 + connect(ui.warningsButton, SIGNAL(toggled(bool)), this, SLOT(warningsButtonPressed(bool)));
6.37 + connect(ui.saveSettingsInMapButton, SIGNAL(toggled(bool)), this, SLOT(saveSettingsInMapButtonPressed(bool)));
6.38 + connect(ui.browsePreExportButton, SIGNAL(pressed()), this, SLOT(browsePreExportButtonPressed()));
6.39 + connect(ui.lineEditPreScript, SIGNAL(textChanged(const QString&)), this, SLOT(prescriptChanged()));
6.40 + connect(ui.lineEditPostScript, SIGNAL(textChanged(const QString&)), this, SLOT(postscriptChanged()));
6.41 + connect(ui.browsePostExportButton, SIGNAL(pressed()), this, SLOT(browsePostExportButtonPressed()));
6.42 +}
6.43 +
6.44 +
6.45 +void ExportXHTMLDialog::readSettings()
6.46 +{
6.47 +
6.48 + dir=settings.readLocalEntry (filepath,"/export/xhtml/exportDir",vymBaseDir.currentDirPath() );
6.49 + ui.lineEditDir->setText(dir);
6.50 +
6.51 + if ( settings.readLocalEntry (filepath,"/export/xhtml/useImage","yes")=="yes")
6.52 + useImage=true;
6.53 + else
6.54 + useImage=false;
6.55 + ui.imageButton->setChecked(useImage);
6.56 +
6.57 + if ( settings.readLocalEntry (filepath,"/export/xhtml/useTextColor","no")=="yes")
6.58 + useTextColor=true;
6.59 + else
6.60 + useTextColor=false;
6.61 + ui.textColorButton->setChecked(useTextColor);
6.62 +
6.63 +/* FIXME this was used in old html export, is not yet in new stylesheet
6.64 + if ( settings.readEntry ("/export/html/useHeading","no")=="yes")
6.65 + useHeading=true;
6.66 + else
6.67 + useHeading=false;
6.68 + checkBox4_2->setChecked(useHeading);
6.69 +*/
6.70 +
6.71 + if ( settings.readLocalEntry (filepath,"/export/xhtml/saveSettingsInMap","no")=="yes")
6.72 + saveSettingsInMap=true;
6.73 + else
6.74 + saveSettingsInMap=false;
6.75 + ui.saveSettingsInMapButton->setChecked(saveSettingsInMap);
6.76 +
6.77 + if ( settings.readEntry ("/export/xhtml/showWarnings","yes")=="yes")
6.78 + showWarnings=true;
6.79 + else
6.80 + showWarnings=false;
6.81 + ui.warningsButton->setChecked(showWarnings);
6.82 +
6.83 + if ( settings.readEntry ("/export/xhtml/showOutput","no")=="yes")
6.84 + showOutput=true;
6.85 + else
6.86 + showOutput=false;
6.87 + ui.outputButton->setChecked(showOutput);
6.88 +
6.89 + // For testing better use local styles
6.90 + if (options.isOn ("local"))
6.91 + {
6.92 + xsl=vymBaseDir.path()+"/styles/vym2xhtml.xsl";
6.93 + css=vymBaseDir.path()+"/styles/vym.css";
6.94 + } else
6.95 + {
6.96 + xsl=settings.readLocalEntry
6.97 + (filepath,"/export/xhtml/xsl","/usr/share/vym/styles/vym2xhtml.xsl");
6.98 + css=settings.readLocalEntry
6.99 + (filepath,"/export/xhtml/css","/usr/share/vym/styles/vym.css");
6.100 + }
6.101 + ui.lineEditXSL->setText(xsl);
6.102 + ui.lineEditCSS->setText(css);
6.103 +
6.104 + prescript=settings.readLocalEntry
6.105 + (filepath,"/export/xhtml/prescript","");
6.106 + ui.lineEditPreScript->setText (prescript);
6.107 +
6.108 + postscript=settings.readLocalEntry
6.109 + (filepath,"/export/xhtml/postscript","");
6.110 + ui.lineEditPostScript->setText (postscript);
6.111 +
6.112 + if (!prescript.isEmpty() || !postscript.isEmpty())
6.113 + {
6.114 + QMessageBox::warning( 0, tr( "Warning" ),tr(
6.115 + "The settings saved in the map "
6.116 + "would like to run scripts:\n\n"
6.117 + "%1\n\n"
6.118 + "Please check, if you really\n"
6.119 + "want to allow this in your system!").arg(prescript+" "+postscript));
6.120 +
6.121 + }
6.122 +}
6.123 +
6.124 +void ExportXHTMLDialog::dirChanged()
6.125 +{
6.126 + dir=ui.lineEditDir->text();
6.127 + if (dir.right(1)!="/")
6.128 + dir+="/";
6.129 + settingsChanged=true;
6.130 +}
6.131 +
6.132 +void ExportXHTMLDialog::browseDirectoryPressed()
6.133 +{
6.134 + QFileDialog fd( this);
6.135 + fd.setMode (QFileDialog::DirectoryOnly);
6.136 + fd.setCaption(tr("VYM - Export HTML to directory"));
6.137 + fd.setModal (true);
6.138 + fd.setDirectory (QDir::current());
6.139 + fd.show();
6.140 +
6.141 + if ( fd.exec() == QDialog::Accepted )
6.142 + {
6.143 + dir=fd.selectedFile();
6.144 + ui.lineEditDir->setText (dir );
6.145 + settingsChanged=true;
6.146 + }
6.147 +}
6.148 +
6.149 +void ExportXHTMLDialog::imageButtonPressed(bool b)
6.150 +{
6.151 + useImage=b;
6.152 + settingsChanged=true;
6.153 +}
6.154 +
6.155 +void ExportXHTMLDialog::textcolorButtonPressed(bool b)
6.156 +{
6.157 + useTextColor=b;
6.158 + settingsChanged=true;
6.159 +}
6.160 +
6.161 +void ExportXHTMLDialog::saveSettingsInMapButtonPressed(bool b)
6.162 +{
6.163 + saveSettingsInMap=b;
6.164 + settingsChanged=true;
6.165 +}
6.166 +
6.167 +void ExportXHTMLDialog::warningsButtonPressed(bool b)
6.168 +{
6.169 + showWarnings=b;
6.170 + settingsChanged=true;
6.171 +}
6.172 +
6.173 +
6.174 +void ExportXHTMLDialog::outputButtonPressed(bool b)
6.175 +{
6.176 + showOutput=b;
6.177 + settingsChanged=true;
6.178 +}
6.179 +
6.180 +void ExportXHTMLDialog::cssChanged()
6.181 +{
6.182 + css=ui.lineEditCSS->text();
6.183 + settingsChanged=true;
6.184 +}
6.185 +
6.186 +void ExportXHTMLDialog::browseCSSPressed()
6.187 +{
6.188 + QFileDialog fd( this);
6.189 + fd.setModal (true);
6.190 + fd.setFilter ("Cascading Stylesheet (*.css)");
6.191 + fd.setDirectory (QDir::current());
6.192 + fd.show();
6.193 +
6.194 + if ( fd.exec() == QDialog::Accepted )
6.195 + {
6.196 + css=fd.selectedFile();
6.197 + ui.lineEditCSS->setText (css );
6.198 + settingsChanged=true;
6.199 + }
6.200 +}
6.201 +
6.202 +void ExportXHTMLDialog::xslChanged()
6.203 +{
6.204 + xsl=ui.lineEditXSL->text();
6.205 + settingsChanged=true;
6.206 +}
6.207 +
6.208 +void ExportXHTMLDialog::prescriptChanged()
6.209 +{
6.210 + prescript=ui.lineEditPreScript->text();
6.211 + settingsChanged=true;
6.212 +}
6.213 +
6.214 +void ExportXHTMLDialog::browseXSLPressed()
6.215 +{
6.216 + QFileDialog fd( this);
6.217 + fd.setModal (true);
6.218 + fd.setFilter ("Extensible Stylesheet Language (*.xsl)");
6.219 + fd.setDirectory (QDir::current());
6.220 + fd.show();
6.221 +
6.222 + if ( fd.exec() == QDialog::Accepted )
6.223 + {
6.224 + xsl=fd.selectedFile();
6.225 + ui.lineEditXSL->setText (xsl );
6.226 + settingsChanged=true;
6.227 + }
6.228 +}
6.229 +
6.230 +void ExportXHTMLDialog::postscriptChanged()
6.231 +{
6.232 + postscript=ui.lineEditPostScript->text();
6.233 + settingsChanged=true;
6.234 +}
6.235 +
6.236 +void ExportXHTMLDialog::browsePreExportButtonPressed()
6.237 +{
6.238 + QFileDialog fd( this);
6.239 + fd.setModal (true);
6.240 + fd.setFilter ("Scripts (*.sh *.pl *.py *.php)");
6.241 + fd.setDirectory (QDir::current());
6.242 + fd.show();
6.243 +
6.244 + if ( fd.exec() == QDialog::Accepted )
6.245 + {
6.246 + prescript=fd.selectedFile();
6.247 + ui.lineEditPreScript->setText (prescript );
6.248 + settingsChanged=true;
6.249 + }
6.250 +
6.251 +}
6.252 +
6.253 +void ExportXHTMLDialog::browsePostExportButtonPressed()
6.254 +{
6.255 + QFileDialog fd( this);
6.256 + fd.setModal (true);
6.257 + fd.setFilter ("Scripts (*.sh *.pl *.py *.php)");
6.258 + fd.setDirectory (QDir::current());
6.259 + fd.show();
6.260 +
6.261 + if ( fd.exec() == QDialog::Accepted )
6.262 + {
6.263 + postscript=fd.selectedFile();
6.264 + ui.lineEditPostScript->setText (postscript );
6.265 + settingsChanged=true;
6.266 + }
6.267 +}
6.268 +
6.269 +
6.270 +void ExportXHTMLDialog::doExport (const QString &mapname)
6.271 +{
6.272 + // Save options to settings file
6.273 + // (but don't save at destructor, which
6.274 + // is called for "cancel", too)
6.275 + settings.setLocalEntry (filepath,"/export/xhtml/exportDir",dir);
6.276 + settings.setLocalEntry (filepath,"/export/xhtml/prescript",prescript);
6.277 + settings.setLocalEntry (filepath,"/export/xhtml/postscript",postscript);
6.278 +
6.279 + if (useImage)
6.280 + settings.setLocalEntry (filepath,"/export/xhtml/useImage","yes");
6.281 + else
6.282 + settings.setLocalEntry (filepath,"/export/xhtml/useImage","no");
6.283 +
6.284 + if (useTextColor)
6.285 + settings.setLocalEntry (filepath,"/export/xhtml/useTextColor","yes");
6.286 + else
6.287 + settings.setLocalEntry (filepath,"/export/xhtml/useTextColor","no");
6.288 +
6.289 + if (showWarnings)
6.290 + settings.writeEntry ("/export/xhtml/showWarnings","yes");
6.291 + else
6.292 + settings.writeEntry ("/export/xhtml/showWarnings","no");
6.293 +
6.294 + if (showOutput)
6.295 + settings.writeEntry ("/export/xhtml/showOutput","yes");
6.296 + else
6.297 + settings.writeEntry ("/export/xhtml/showOutput","no");
6.298 +
6.299 + QString ipath;
6.300 + ipath=vymBaseDir.path()+"/flags/flag-url-16x16.png";
6.301 + if (!options.isOn ("local"))
6.302 + {
6.303 + settings.setLocalEntry
6.304 + (filepath,"/export/xhtml/xsl",xsl);
6.305 + settings.setLocalEntry
6.306 + (filepath,"/export/xhtml/css",css);
6.307 + }
6.308 +
6.309 + // Provide a smaller URL-icon to improve Layout
6.310 + QPixmap pm;
6.311 + if (!pm.load(ipath,"PNG") )
6.312 + QMessageBox::warning( 0, tr( "Warning" ),tr("Could not open %1").arg(ipath));
6.313 +
6.314 +
6.315 + if(!pm.save (dir + "flags/flag-url-16x16.png","PNG"))
6.316 + QMessageBox::warning( 0, tr( "Warning" ),tr("Could not write %1").arg(ipath));
6.317 + if (!saveSettingsInMap)
6.318 + settings.clearLocal("/export/xhtml");
6.319 + else
6.320 + settings.setLocalEntry
6.321 + (filepath,"/export/xhtml/saveSettingsInMap","yes");
6.322 +
6.323 + // Copy CSS file
6.324 + QFile css_src (css);
6.325 + QFile css_dst (dir+"vym.css");
6.326 + if (!css_src.open ( QIODevice::ReadOnly))
6.327 + QMessageBox::warning( 0, tr( "Warning" ),tr("Could not open %1").arg(css));
6.328 + else
6.329 + {
6.330 + if (!css_dst.open( QIODevice::WriteOnly))
6.331 + QMessageBox::warning( 0, tr( "Warning" ), tr("Could not open %1").arg(dir+"vym.css"));
6.332 + else
6.333 + {
6.334 +
6.335 + QTextStream tsout( &css_dst);
6.336 + QTextStream tsin ( &css_src);
6.337 + QString s= tsin.read();
6.338 + tsout << s;
6.339 + css_dst.close();
6.340 + }
6.341 + css_src.close();
6.342 + }
6.343 +
6.344 + if (!prescript.isEmpty()) runScript (prescript,dir+mapname+".xml");
6.345 +
6.346 + if (useImage)
6.347 + p.addStringParam ("imagemap","images/"+mapname+".png");
6.348 + if (useTextColor)
6.349 + p.addStringParam ("use.textcolor","1");
6.350 + p.addStringParam ("mapname",mapname+".vym");
6.351 +
6.352 + p.setOutputFile (dir+mapname+".html");
6.353 + p.setInputFile (dir+mapname+".xml");
6.354 + p.setXSLFile (xsl);
6.355 + p.process();
6.356 +
6.357 + if (!postscript.isEmpty()) runScript (postscript,dir+mapname+".html");
6.358 +
6.359 +}
6.360 +
6.361 +void ExportXHTMLDialog::setFilePath(const QString &s)
6.362 +{
6.363 + filepath=s;
6.364 +}
6.365 +
6.366 +void ExportXHTMLDialog::setMapName(const QString &s)
6.367 +{
6.368 + mapname=s;
6.369 +}
6.370 +
6.371 +QString ExportXHTMLDialog::getDir()
6.372 +{
6.373 + return dir;
6.374 +}
6.375 +
6.376 +bool ExportXHTMLDialog::warnings()
6.377 +{
6.378 + return showWarnings;
6.379 +}
6.380 +
6.381 +bool ExportXHTMLDialog::hasChanged()
6.382 +{
6.383 + return settingsChanged;
6.384 +}
6.385 +
6.386 +
6.387 +void ExportXHTMLDialog::runScript(QString spath, QString fpath)
6.388 +{
6.389 + spath.replace ("%f",fpath);
6.390 + QStringList args=QStringList::split (' ',spath,false);
6.391 +
6.392 + scriptProc->clearArguments();
6.393 + scriptProc->setArguments (args);
6.394 + p.addOutput ("vym is executing: \n" + scriptProc->arguments().join(" ") );
6.395 + if (!scriptProc->start() )
6.396 + {
6.397 + QMessageBox::critical( 0, tr( "Critical Error" ),
6.398 + tr("Could not start %1").arg(spath) );
6.399 + } else
6.400 + {
6.401 + scriptProc->waitFinished();
6.402 + if (!scriptProc->normalExit() )
6.403 + QMessageBox::critical( 0, tr( "Critical Error" ),
6.404 + tr("%1 didn't exit normally").arg(spath) +
6.405 + scriptProc->getErrout() );
6.406 + else
6.407 + if (scriptProc->exitStatus()>0) showOutput=true;
6.408 +
6.409 + }
6.410 + p.addOutput ("\n");
6.411 + p.addOutput (scriptProc->getErrout());
6.412 + p.addOutput (scriptProc->getStdout());
6.413 +}
6.414 +
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/exportxhtmldialog.h Thu Sep 14 11:38:17 2006 +0000
7.3 @@ -0,0 +1,62 @@
7.4 +#ifndef EXPORTXHTMLDIALOG_H
7.5 +#define EXPORTXHTMLDIALOG_H
7.6 +
7.7 +#include "ui_exportxhtmldialog.h"
7.8 +
7.9 +class ExportXHTMLDialog:public QDialog
7.10 +{
7.11 + Q_OBJECT
7.12 +public:
7.13 + ExportXHTMLDialog(QWidget* parent = 0);
7.14 +
7.15 + virtual QString getDir();
7.16 + virtual bool warnings();
7.17 + virtual bool hasChanged();
7.18 +
7.19 +public slots:
7.20 + virtual void readSettings();
7.21 + virtual void dirChanged();
7.22 + virtual void browseDirectoryPressed();
7.23 + virtual void imageButtonPressed( bool b );
7.24 + virtual void textcolorButtonPressed( bool b );
7.25 + virtual void saveSettingsInMapButtonPressed( bool b );
7.26 + virtual void warningsButtonPressed( bool b );
7.27 + virtual void outputButtonPressed( bool b );
7.28 + virtual void cssChanged();
7.29 + virtual void browseCSSPressed();
7.30 + virtual void xslChanged();
7.31 + virtual void prescriptChanged();
7.32 + virtual void browseXSLPressed();
7.33 + virtual void postscriptChanged();
7.34 + virtual void browsePreExportButtonPressed();
7.35 + virtual void browsePostExportButtonPressed();
7.36 + virtual void doExport( const QString & mapname );
7.37 + virtual void setFilePath( const QString & s );
7.38 + virtual void setMapName( const QString & s );
7.39 +
7.40 +protected:
7.41 + bool useTextColor;
7.42 + bool showWarnings;
7.43 + QString xsl;
7.44 + QString css;
7.45 + bool useImage;
7.46 + bool showOutput;
7.47 + QString dir;
7.48 + QString filepath;
7.49 + QString prescript;
7.50 + QString postscript;
7.51 + bool settingsChanged;
7.52 + QString mapname;
7.53 + bool saveSettingsInMap;
7.54 + XSLTProc p;
7.55 + Process *scriptProc;
7.56 +
7.57 +private:
7.58 + Ui::ExportXHTMLDialog ui;
7.59 + void init();
7.60 + void destroy();
7.61 + void runScript( QString spath, QString fpath );
7.62 +
7.63 +};
7.64 +
7.65 +#endif // EXPORTXHTMLDIALOG_H
8.1 --- a/extrainfodialog.ui.h Fri Sep 08 12:30:09 2006 +0000
8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
8.3 @@ -1,39 +0,0 @@
8.4 -/****************************************************************************
8.5 -** ui.h extension file, included from the uic-generated form implementation.
8.6 -**
8.7 -** If you wish to add, delete or rename functions or slots use
8.8 -** Qt Designer which will update this file, preserving your code. Create an
8.9 -** init() function in place of a constructor, and a destroy() function in
8.10 -** place of a destructor.
8.11 -*****************************************************************************/
8.12 -
8.13 -void ExtraInfoDialog::setMapName(const QString &s)
8.14 -{
8.15 - lineEdit7->setText (s);
8.16 -}
8.17 -
8.18 -void ExtraInfoDialog::setComment (const QString &s)
8.19 -{
8.20 - textEdit4->setText (s);
8.21 -}
8.22 -
8.23 -QString ExtraInfoDialog::getComment()
8.24 -{
8.25 - return textEdit4->text();
8.26 -}
8.27 -
8.28 -
8.29 -void ExtraInfoDialog::setAuthor(const QString &s)
8.30 -{
8.31 - lineEdit2->setText (s);
8.32 -}
8.33 -
8.34 -QString ExtraInfoDialog::getAuthor()
8.35 -{
8.36 - return lineEdit2->text();
8.37 -}
8.38 -
8.39 -void ExtraInfoDialog::setStats(const QString &s)
8.40 -{
8.41 - textEdit4_2->setText (s);
8.42 -}