# HG changeset patch
# User insilmaril
# Date 1141731120 0
# Node ID 654ad4b03c5ae645476e3fc223eb96c2be8ab29f
# Parent 38ad83f1d4ce8a83182e75c207355c2f8656933a
Added xsl for Taskjuggler Export by Matt
diff -r 38ad83f1d4ce -r 654ad4b03c5a aboutdialog.cpp
--- a/aboutdialog.cpp Wed Mar 01 14:39:05 2006 +0000
+++ b/aboutdialog.cpp Tue Mar 07 11:32:00 2006 +0000
@@ -41,13 +41,12 @@
""
"
Credits "
""
+ "- Matt from www.satbp.com for Taskjuggler export
"
"- Jakob Hilmer for image drag and drop, "About vym" window patch
"
"- Thomas Schraitle for the stylesheet used for XHTML-export
"
"- Debianization by Christoph Thielecke and Steffen Joeris
"
- "- Clemens Kraus for stylesheets and script used for HTML-export "
+ "
- Clemens Kraus for HTML-export "
"(www.clemens-kraus.de)
"
- "- Alexander Johannesen for providing stylesheets from his xsiteable project "
- "(www.shelter.nu/xsiteable/xsiteable.html).
"
"- Ken Wimer and Olaf Hering for Mac support
"
"
"
"");
diff -r 38ad83f1d4ce -r 654ad4b03c5a demos/todo.vym
Binary file demos/todo.vym has changed
diff -r 38ad83f1d4ce -r 654ad4b03c5a exports.cpp
--- a/exports.cpp Wed Mar 01 14:39:05 2006 +0000
+++ b/exports.cpp Tue Mar 07 11:32:00 2006 +0000
@@ -1,3 +1,4 @@
+#include
#include
#include "exports.h"
@@ -5,12 +6,23 @@
#include "linkablemapobj.h"
#include "misc.h"
#include "mainwindow.h"
+#include "xsltproc.h"
extern Main *mainWindow;
+extern QDir vymBaseDir;
+
ExportBase::ExportBase()
{
indentPerDepth=" ";
+ // Create tmpdir
+ tmpDir.setPath (makeUniqueDir("/tmp/vym-XXXXXX"));
+}
+
+ExportBase::~ExportBase()
+{
+ // Remove tmpdir
+ removeDir (tmpDir);
}
void ExportBase::setDir(const QString &p)
@@ -28,6 +40,57 @@
mapCenter=mc;
}
+void ExportBase::setCaption (const QString &s)
+{
+ caption=s;
+}
+
+void ExportBase::addFilter(const QString &s)
+{
+ filter=s;
+}
+
+bool ExportBase::execDialog()
+{
+ if (mapCenter && mapCenter->getMapEditor())
+ {
+ QFileDialog *fd=new QFileDialog( mapCenter->getMapEditor(), caption);
+ fd->addFilter (filter);
+ fd->setCaption(caption);
+ fd->setMode( QFileDialog::AnyFile );
+ fd->show();
+
+ if ( fd->exec() == QDialog::Accepted )
+ {
+ if (QFile (fd->selectedFile()).exists() )
+ {
+ QMessageBox mb( __VYM,
+ QObject::tr("The file %1 exists already.\nDo you want to overwrite it?").arg(fd->selectedFile()),
+ QMessageBox::Warning,
+ QMessageBox::Yes | QMessageBox::Default,
+ QMessageBox::Cancel | QMessageBox::Escape,
+ QMessageBox::NoButton );
+ mb.setButtonText( QMessageBox::Yes, QObject::tr("Overwrite") );
+ mb.setButtonText( QMessageBox::No, QObject::tr("Cancel"));
+ ExportBase ex;
+ switch( mb.exec() )
+ {
+ case QMessageBox::Yes:
+ // save
+ break;;
+ case QMessageBox::Cancel:
+ // return, do nothing
+ return false;
+ break;
+ }
+ }
+ outputFile=fd->selectedFile();
+ return true;
+ }
+ }
+ return false;
+}
+
QString ExportBase::getSectionString(BranchObj *bostart)
{
// Make prefix like "2.5.3" for "bo:2,bo:5,bo:3"
@@ -46,13 +109,13 @@
return r + " ";
}
-void ExportBase::exportXML()
+void ExportASCII::doExport()
{
QFile file (outputFile);
if ( !file.open( IO_WriteOnly ) )
{
// FIXME experimental, testing
- cout << "ExportBase::exportXML couldn't open "<getMapEditor();
+ if (me)
+ {
+ me->exportXML(tmpDir.path());
+ //FIXME testing
+ cout << "tmpDir="<getMapName()+".xml");
+ p.setOutputFile (outputFile);
+ p.setXSLFile (vymBaseDir.path()+"/styles/vym2taskjuggler.xsl");
+ p.process();
+ }
+
+}
+
+void ExportLaTeX::doExport()
{
// Exports a map to a LaTex file.
// This file needs to be included
@@ -149,14 +231,10 @@
ExportOO::ExportOO()
{
useSections=false;
- // Create tmpdir
- tmpDir.setPath (makeUniqueDir("/tmp/vym-XXXXXX"));
}
ExportOO::~ExportOO()
{
- // Remove tmpdir
- removeDir (tmpDir);
}
QString ExportOO::buildList (BranchObj *current)
diff -r 38ad83f1d4ce -r 654ad4b03c5a exports.h
--- a/exports.h Wed Mar 01 14:39:05 2006 +0000
+++ b/exports.h Tue Mar 07 11:32:00 2006 +0000
@@ -14,28 +14,49 @@
{
public:
ExportBase();
- void setDir(const QString &);
- void setFile(const QString &);
- void setMapCenter (MapCenterObj*);
- void setIndentPerDepth (QString);
+ virtual ~ExportBase();
+ virtual void setDir(const QString &);
+ virtual void setFile(const QString &);
+ virtual void setMapCenter (MapCenterObj*);
+ virtual void setCaption(const QString &);
+ virtual void addFilter (const QString &);
+ virtual bool execDialog();
protected:
- QString getSectionString (BranchObj*);
-public:
- void exportXML();
+ virtual QString getSectionString (BranchObj*);
-protected:
QDir tmpDir;
QString outputDir;
QString outputFile;
MapCenterObj *mapCenter;
QString indentPerDepth;
+ QString caption;
+ QString filter;
};
///////////////////////////////////////////////////////////////////////
+class ExportASCII:public ExportBase
+{
+public:
+ virtual void doExport();
+};
+
+///////////////////////////////////////////////////////////////////////
+class ExportXMLBase:public ExportBase
+{
+};
+
+///////////////////////////////////////////////////////////////////////
+class ExportTaskjuggler:public ExportXMLBase
+{
+public:
+ virtual void doExport();
+};
+
+///////////////////////////////////////////////////////////////////////
class ExportLaTeX:public ExportBase
{
public:
- void exportLaTeX();
+ virtual void doExport();
};
///////////////////////////////////////////////////////////////////////
diff -r 38ad83f1d4ce -r 654ad4b03c5a imports.cpp
--- a/imports.cpp Wed Mar 01 14:39:05 2006 +0000
+++ b/imports.cpp Tue Mar 07 11:32:00 2006 +0000
@@ -20,8 +20,7 @@
ImportBase::~ImportBase()
{
// Remove tmpdir
- // FIXME just testing!
- //removeDir (tmpDir);
+ removeDir (tmpDir);
}
void ImportBase::setDir(const QString &p)
diff -r 38ad83f1d4ce -r 654ad4b03c5a mainwindow.cpp
--- a/mainwindow.cpp Wed Mar 01 14:39:05 2006 +0000
+++ b/mainwindow.cpp Tue Mar 07 11:32:00 2006 +0000
@@ -64,6 +64,7 @@
#include "aboutdialog.h"
#include "exporthtmldialog.h"
#include "exportoofiledialog.h"
+#include "exports.h"
#include "exportxhtmldialog.h"
#include "file.h"
#include "flagrowobj.h"
@@ -627,14 +628,14 @@
actionListBranches.append(a);
// Import at selection (adding to selection)
- a = new QAction( tr( "Add map at selection" ),tr( "Import (add)" ), 0, this, "importAdd" );
+ a = new QAction( tr( "Add map at selection" ),tr( "Add map (insert)" ), 0, this, "importAdd" );
connect( a, SIGNAL( activated() ), this, SLOT( editImportAdd() ) );
a->setEnabled (false);
actionListBranches.append(a);
actionEditImportAdd=a;
// Import at selection (replacing selection)
- a = new QAction( tr( "Replace selection with map" ),tr( "Import (replace)" ), 0, this, "importReplace" );
+ a = new QAction( tr( "Replace selection with map" ),tr( "Add map (replace)" ), 0, this, "importReplace" );
connect( a, SIGNAL( activated() ), this, SLOT( editImportReplace() ) );
a->setEnabled (false);
actionListBranches.append(a);
@@ -1170,16 +1171,24 @@
floatimageContextMenu->insertSeparator();
actionFormatHideLinkUnselected->addTo( floatimageContextMenu );
+ exportMenu->insertItem ( tr("Export as Image"),exportImageFormatMenu);
+
a = new QAction( tr( "Export in Open Document Format used e.g. in Open Office " ), QPixmap(), "Open Office"+QString("..."), 0, this, "exportOOPresentation" );
connect( a, SIGNAL( activated() ), this, SLOT( fileExportOOPresentation() ) );
a->addTo (exportMenu);
- exportMenu->insertItem ( tr("Export as Image"),exportImageFormatMenu);
+ a = new QAction( tr( "Export as webpage (XHTML)" ), QPixmap(), "Webpage (XHTML)...", ALT + Key_X, this, "exportXHTML" );
+ connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) );
+ a->addTo( exportMenu );
- a = new QAction( tr( "Export as ASCII")+" "+tr("(still experimental)" ), QPixmap(), "ASCII...", 0, this, "exportASCII" );
+ a = new QAction( tr( "Export as ASCII")+" "+tr("(still experimental)" ), QPixmap(), "Text (ASCII)...", 0, this, "exportASCII" );
connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
a->addTo( exportMenu );
+ a = new QAction( tr( "Export as Taskjuggler")+" "+tr("(still experimental)" ), QPixmap(), "Taskjuggler...", 0, this, "exportTJ" );
+ connect( a, SIGNAL( activated() ), this, SLOT( fileExportTaskjuggler() ) );
+ a->addTo( exportMenu );
+
a = new QAction( tr( "Export as LaTeX")+" "+tr("(still experimental)" ), QPixmap(), "LaTeX...", 0, this, "exportLaTeX" );
connect( a, SIGNAL( activated() ), this, SLOT( fileExportLaTeX() ) );
a->addTo( exportMenu );
@@ -1195,10 +1204,6 @@
a->addTo( exportMenu );
}
- a = new QAction( tr( "Export as XHTML" ), QPixmap(), "XHTML...", ALT + Key_X, this, "exportXHTML" );
- connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) );
- a->addTo( exportMenu );
-
// Context menu for canvas
canvasContextMenu =new QPopupMenu (this);
@@ -1905,24 +1910,48 @@
void Main::fileExportASCII()
{
if (currentMapEditor())
- currentMapEditor()->exportASCII();
+ {
+ ExportASCII ex;
+ ex.setMapCenter(currentMapEditor()->getMapCenter());
+ ex.addFilter ("TXT (*.txt)");
+ ex.setCaption(__VYM " -" +tr("Export as ASCII")+" "+tr("(still experimental)"));
+ if (ex.execDialog() ) ex.doExport();
+ }
}
void Main::fileExportLaTeX()
{
if (currentMapEditor())
- currentMapEditor()->exportLaTeX();
+ {
+ ExportLaTeX ex;
+ ex.setMapCenter(currentMapEditor()->getMapCenter());
+ ex.addFilter ("Tex (*.tex)");
+ ex.setCaption(__VYM " -" +tr("Export as LaTeX")+" "+tr("(still experimental)"));
+ if (ex.execDialog() ) ex.doExport();
+ }
+}
+
+void Main::fileExportTaskjuggler()
+{
+ ExportTaskjuggler ex;
+ if (currentMapEditor())
+ {
+ ex.setMapCenter (currentMapEditor()->getMapCenter() );
+ ex.setCaption ( __VYM " - "+tr("Export to")+" Taskjuggler"+tr("(still experimental)"));
+ ex.addFilter ("Taskjuggler (*.tj)");
+ if (ex.execDialog()) ex.doExport();
+ }
}
void Main::fileExportOOPresentation()
{
- ExportOOFileDialog *fd=new ExportOOFileDialog( this,__VYM " - "+tr("Export to Open Office"));
+ ExportOOFileDialog *fd=new ExportOOFileDialog( this,__VYM " - "+tr("Export to")+" Open Office");
// FIXME add extra info in dialog
//ImagePreview *p =new ImagePreview (fd);
//fd->setContentsPreviewEnabled( TRUE );
//fd->setContentsPreview( p, p );
//fd->setPreviewMode( QFileDialog::Contents );
- fd->setCaption(__VYM " - " +tr("Export to Open Office"));
+ fd->setCaption(__VYM " - " +tr("Export to")+" Open Office");
//fd->setDir (lastImageDir);
fd->show();
diff -r 38ad83f1d4ce -r 654ad4b03c5a mainwindow.h
--- a/mainwindow.h Wed Mar 01 14:39:05 2006 +0000
+++ b/mainwindow.h Tue Mar 07 11:32:00 2006 +0000
@@ -74,6 +74,7 @@
void fileExportImage(int);
void fileExportASCII();
void fileExportLaTeX();
+ void fileExportTaskjuggler();
void fileExportOOPresentation();
void fileCloseMap();
void filePrint();
diff -r 38ad83f1d4ce -r 654ad4b03c5a mapeditor.cpp
--- a/mapeditor.cpp Wed Mar 01 14:39:05 2006 +0000
+++ b/mapeditor.cpp Tue Mar 07 11:32:00 2006 +0000
@@ -1059,89 +1059,6 @@
pix.save(fn, exportImageFormatMenu->text(item) );
}
-void MapEditor::exportASCII()
-{
- // TODO still experimental
- ExportBase ex;
- ex.setMapCenter(mapCenter);
-
- QFileDialog *fd=new QFileDialog( this, __VYM " - " +tr("Export as ASCII"));
- fd->addFilter ("TXT (*.txt)");
- fd->setCaption(__VYM " -" +tr("Export as ASCII")+" "+tr("(still experimental)"));
- fd->setMode( QFileDialog::AnyFile );
- fd->show();
-
- if ( fd->exec() == QDialog::Accepted )
- {
- if (QFile (fd->selectedFile()).exists() )
- {
- QMessageBox mb( __VYM,
- tr("The file %1 exists already.\nDo you want to overwrite it?").arg(fd->selectedFile()),
- QMessageBox::Warning,
- QMessageBox::Yes | QMessageBox::Default,
- QMessageBox::Cancel | QMessageBox::Escape,
- QMessageBox::NoButton );
-
- mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
- mb.setButtonText( QMessageBox::No, tr("Cancel"));
- ExportBase ex;
- switch( mb.exec() )
- {
- case QMessageBox::Yes:
- // save
- break;;
- case QMessageBox::Cancel:
- // return, do nothing
- return;
- break;
- }
- }
- ex.setFile(fd->selectedFile() );
- ex.exportXML();
- }
-}
-
-void MapEditor::exportLaTeX()
-{
- // TODO still experimental
- QFileDialog *fd=new QFileDialog( this, __VYM " - " +tr("Export as LaTeX"));
- fd->addFilter ("TEX (*.tex)");
- fd->setCaption(__VYM " - " + tr("Export as LaTeX")+" "+tr("(still experimental)"));
- fd->setMode( QFileDialog::AnyFile );
- fd->show();
-
- if ( fd->exec() == QDialog::Accepted )
- {
- if (QFile (fd->selectedFile()).exists() )
- {
- QMessageBox mb( "VYM",
- tr("The file %1\nexists already. Do you want to overwrite it?").arg(fd->selectedFile()),
- QMessageBox::Warning,
- QMessageBox::Yes | QMessageBox::Default,
- QMessageBox::Cancel | QMessageBox::Escape,
- QMessageBox::NoButton );
-
- mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
- mb.setButtonText( QMessageBox::No, tr("Cancel"));
- ExportLaTeX ex;
- switch( mb.exec() )
- {
- case QMessageBox::Yes:
- // save
- break;;
- case QMessageBox::Cancel:
- // do nothing
- return;
- break;
- }
- }
- ExportLaTeX ex;
- ex.setFile (fd->selectedFile() );
- ex.setMapCenter(mapCenter);
- ex.exportLaTeX();
- }
-}
-
void MapEditor::exportOOPresentation(const QString &fn, const QString &cf)
{
ExportOO ex;
@@ -2181,6 +2098,7 @@
{
saveState(selection);// TODO undoCommand
((BranchObj*)selection)->toggleStandardFlag (f,actionSettingsUseFlagGroups);
+ adjustCanvasSize();
}
}
diff -r 38ad83f1d4ce -r 654ad4b03c5a mapeditor.h
--- a/mapeditor.h Wed Mar 01 14:39:05 2006 +0000
+++ b/mapeditor.h Tue Mar 07 11:32:00 2006 +0000
@@ -71,8 +71,6 @@
public:
void exportImage (QString fn); // export as PNG
void exportImage (QString fn, int); // export in given format
- void exportASCII();
- void exportLaTeX();
void exportOOPresentation(const QString &,const QString &);
void exportXML(const QString&); // export to directory
void clear(); // clear map
diff -r 38ad83f1d4ce -r 654ad4b03c5a version.h
--- a/version.h Wed Mar 01 14:39:05 2006 +0000
+++ b/version.h Tue Mar 07 11:32:00 2006 +0000
@@ -3,6 +3,6 @@
#define __VYM "VYM"
#define __VYM_VERSION "1.7.10"
-#define __BUILD_DATE "March 1, 2006"
+#define __BUILD_DATE "March 7, 2006"
#endif