# HG changeset patch # User insilmaril # Date 1267095832 0 # Node ID 36eb4b8f409e9198d02f6fef7ca4397855b53d2e # Parent 0bba81dde1bc14dd29c7a041551a8beb047ed3d4 Added dialog for HTML export. Grouping in Switchboard shortcuts diff -r 0bba81dde1bc -r 36eb4b8f409e exporthtmldialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/exporthtmldialog.cpp Thu Feb 25 11:03:52 2010 +0000 @@ -0,0 +1,368 @@ +#include "exporthtmldialog.h" + +#include +#include +#include + +#include "options.h" +#include "settings.h" +#include "warningdialog.h" + + +extern Options options; +extern QDir vymBaseDir; +extern Settings settings; +extern bool debug; + +ExportHTMLDialog::ExportHTMLDialog(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.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.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 ExportHTMLDialog::readSettings() +{ + + dir=settings.readLocalEntry (filepath,"/export/html/exportDir",vymBaseDir.currentDirPath() ); + ui.lineEditDir->setText(dir); + + if ( settings.readLocalEntry (filepath,"/export/html/useImage","yes")=="yes") + useImage=true; + else + useImage=false; + ui.imageButton->setChecked(useImage); + + if ( settings.readLocalEntry (filepath,"/export/html/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/html/saveSettingsInMap","no")=="yes") + saveSettingsInMap=true; + else + saveSettingsInMap=false; + ui.saveSettingsInMapButton->setChecked(saveSettingsInMap); + + if ( settings.readEntry ("/export/html/showOutput","no")=="yes") + showOutput=true; + else + showOutput=false; + ui.outputButton->setChecked(showOutput); + + // For testing better use local styles + const QString defcss(vymBaseDir.path() + "/styles/vym.css"); + if (options.isOn ("local")) + { + css=defcss; + } else + { + css=settings.readLocalEntry + (filepath,"/export/html/css",defcss); + } + ui.lineEditCSS->setText(css); + + prescript=settings.readLocalEntry + (filepath,"/export/html/prescript",""); + ui.lineEditPreScript->setText (prescript); + + postscript=settings.readLocalEntry + (filepath,"/export/html/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 ExportHTMLDialog::setDir(const QString &d) +{ + dir=d; + if (dir.right(1)!="/") dir+="/"; +} + +void ExportHTMLDialog::dirChanged() +{ + setDir (ui.lineEditDir->text()); + settingsChanged=true; +} + +void ExportHTMLDialog::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 ) + { + QDir dir=fd.selectedFile(); + ui.lineEditDir->setText (dir.path() ); + settingsChanged=true; + } +} + +void ExportHTMLDialog::imageButtonPressed(bool b) +{ + useImage=b; + settingsChanged=true; +} + +void ExportHTMLDialog::textcolorButtonPressed(bool b) +{ + useTextColor=b; + settingsChanged=true; +} + +void ExportHTMLDialog::saveSettingsInMapButtonPressed(bool b) +{ + saveSettingsInMap=b; + settingsChanged=true; +} + +void ExportHTMLDialog::warningsButtonPressed(bool b) +{ + showWarnings=b; + settingsChanged=true; +} + + +void ExportHTMLDialog::outputButtonPressed(bool b) +{ + showOutput=b; + settingsChanged=true; +} + +void ExportHTMLDialog::cssChanged() +{ + css=ui.lineEditCSS->text(); + settingsChanged=true; +} + +QString ExportHTMLDialog::getCSSPath() +{ + return css; +} + +void ExportHTMLDialog::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 ExportHTMLDialog::prescriptChanged() +{ + prescript=ui.lineEditPreScript->text(); + settingsChanged=true; +} + +void ExportHTMLDialog::postscriptChanged() +{ + postscript=ui.lineEditPostScript->text(); + settingsChanged=true; +} + +void ExportHTMLDialog::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 ExportHTMLDialog::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 ExportHTMLDialog::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/html/exportDir",dir); + settings.setLocalEntry (filepath,"/export/html/prescript",prescript); + settings.setLocalEntry (filepath,"/export/html/postscript",postscript); + + if (useImage) + settings.setLocalEntry (filepath,"/export/html/useImage","yes"); + else + settings.setLocalEntry (filepath,"/export/html/useImage","no"); + + if (useTextColor) + settings.setLocalEntry (filepath,"/export/html/useTextColor","yes"); + else + settings.setLocalEntry (filepath,"/export/html/useTextColor","no"); + + if (showWarnings) + settings.writeEntry ("/export/html/showWarnings","yes"); + else + settings.writeEntry ("/export/html/showWarnings","no"); + + if (showOutput) + settings.writeEntry ("/export/html/showOutput","yes"); + else + settings.writeEntry ("/export/html/showOutput","no"); + + QString ipath; + ipath=vymBaseDir.path()+"/flags/flag-url-16x16.png"; + if (!options.isOn ("local")) + { + settings.setLocalEntry + (filepath,"/export/html/css",css); + } + + if (!saveSettingsInMap) + settings.clearLocal("/export/html"); + else + settings.setLocalEntry + (filepath,"/export/html/saveSettingsInMap","yes"); + + // Provide a smaller URL-icon to improve Layout //FIXME-1 + 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 (!prescript.isEmpty()) runScript (prescript,dir+mapname+".xml"); + + /* FIXME-1 + 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.process(); + */ + + if (!postscript.isEmpty()) runScript (postscript,dir+mapname+".html"); + +} + +void ExportHTMLDialog::setFilePath(const QString &s) +{ + filepath=s; +} + +void ExportHTMLDialog::setMapName(const QString &s) +{ + mapname=s; +} + +QString ExportHTMLDialog::getDir() +{ + return dir; +} + +bool ExportHTMLDialog::warnings() +{ + return showWarnings; +} + +bool ExportHTMLDialog::hasChanged() +{ + return settingsChanged; +} + + +void ExportHTMLDialog::runScript(QString spath, QString fpath) +{ + spath.replace ("%f",fpath); + QStringList args=QStringList::split (' ',spath,false); + + //FIXME-1 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; + + } + /* FIXME-1 + p.addOutput ("\n"); + p.addOutput (scriptProc->getErrout()); + p.addOutput (scriptProc->getStdout()); + */ +} + diff -r 0bba81dde1bc -r 36eb4b8f409e exporthtmldialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/exporthtmldialog.h Thu Feb 25 11:03:52 2010 +0000 @@ -0,0 +1,66 @@ +#ifndef EXPORTHTMLDIALOG_H +#define EXPORTHTMLDIALOG_H + +#include "ui_exporthtmldialog.h" + +/*! \brief Dialog to export a map as HTML document + +This is an overloaded QDialog with various settings needed to call +convert the vym.xml to a HTML document. +*/ + +class ExportHTMLDialog:public QDialog +{ + Q_OBJECT +public: + ExportHTMLDialog(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 QString getCSSPath(); + virtual void browseCSSPressed(); + virtual void prescriptChanged(); + 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 css; + bool useImage; + bool showOutput; + QString dir; + QString filepath; + QString prescript; + QString postscript; + bool settingsChanged; + QString mapname; + bool saveSettingsInMap; + Process *scriptProc; + +private: + Ui::ExportHTMLDialog ui; + void init(); + void destroy(); + void runScript( QString spath, QString fpath ); + +}; + +#endif // EXPORTHTMLDIALOG_H diff -r 0bba81dde1bc -r 36eb4b8f409e exporthtmldialog.ui --- a/exporthtmldialog.ui Fri Feb 19 13:47:03 2010 +0000 +++ b/exporthtmldialog.ui Thu Feb 25 11:03:52 2010 +0000 @@ -1,321 +1,457 @@ - -ExportHTMLDialog -Uwe Drechsel - - - ExportHTMLDialog - - - - 0 - 0 - 375 - 346 - - - - Export HTML - - - false - - - - unnamed + + + ExportHTMLDialog + + + + 0 + 0 + 684 + 471 + + + + + 0 + 0 + + + + + 0 + 130 + + + + Export HTML + + + + + + 6 + + + 0 + + + + + + 0 + 0 + + + + Export to directory: + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + Browse + + + + + + + + + + 0 + 0 + + + + + 0 + 200 + + + + Options + + + + + 20 + 20 + 220 + 106 + + + + + + + + 0 + 0 + + + + Include image + + + + + + + + 0 + 0 + + + + Colored headings in text + + + + + + + + 0 + 0 + + + + Save settings in map + + + + + + + + 0 + 0 + + + + show output of external scripts + + + + + + + + + + + + 0 + 0 + + + + Stylesheets + + + Qt::Vertical + + + + 11 + + + 6 + + + + + 6 - - - layout33 - - - - unnamed - - - - textLabel1 - - - Directory: - - - - - lineEdit1 - - - - - browseButton - - - Browse - - - - - - - buttonGroup2 - - - - 3 - 5 - 0 - 0 - - - - - 0 - 230 - - - - Options - - - - unnamed - - - - checkBox4 - - - Include image of map - - - - - checkBox5_2 - - - create image only - - - - - checkBox5 - - - use WIKI style - - - - - checkBox4_2 - - - use heading for URLs (instead of link target) - - - - - checkBox6 - - - use image of earth to mark URLs in text - - - - - checkBox7 - - - use default CSS file - - - - - checkBox3 - - - - 1 - 0 - 0 - 0 - - - - show output of external scripts - - - - - - - spacer6 - - - Vertical - - - Expanding - - - - 21 - 60 - - - - - - layout17 - - - - unnamed - - - - spacer5 - - - Horizontal - - - Expanding - - - - 61 - 21 - - - - - - pushButton4 - - - Export - - - true - - - - - pushButton5 - - - Cancel - - - - - - - - - pushButton5 - pressed() - ExportHTMLDialog - reject() - - - pushButton4 - clicked() - ExportHTMLDialog - accept() - - - browseButton - pressed() - ExportHTMLDialog - browseDirectory() - - - checkBox4 - toggled(bool) - ExportHTMLDialog - includeImage(bool) - - - checkBox5 - toggled(bool) - ExportHTMLDialog - useWIKIpressed(bool) - - - lineEdit1 - textChanged(const QString&) - ExportHTMLDialog - dirChanged() - - - checkBox3 - toggled(bool) - ExportHTMLDialog - showOut(bool) - - - checkBox4_2 - toggled(bool) - ExportHTMLDialog - useHeadingPressed(bool) - - - checkBox5_2 - toggled(bool) - ExportHTMLDialog - imgOnly(bool) - - - checkBox6 - toggled(bool) - ExportHTMLDialog - useURLImagePressed(bool) - - - - showtextdialog.h - qprocess.h - iostream - settings.h - qfiledialog.h - qmessagebox.h - file.h - icons/flag-url.xpm - exporthtmldialog.ui.h - - - QString css; - QString xsl; - QString scriptpath; - QString stylepath; - QString dir; - bool image; - bool wikistyle; - QString script; - bool showOutput; - QProcess *proc; - ShowTextDialog *dia; - bool imageOnly; - bool useHeading; - bool useURLImage; - - - browseDirectory() - useWIKIpressed( bool b ) - includeImage( bool b ) - imgOnly( bool b ) - useHeadingPressed( bool b ) - useURLImagePressed( bool b ) - showOut( bool b ) - dirChanged() - doExport( const QString & mapname ) - getDir() - readOutput() - - - init() - destroy() - - - - + + 0 + + + + + + 0 + 0 + + + + + 125 + 0 + + + + CSS: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + 0 + 0 + + + + Browse + + + + + + + + + + + + + 0 + 0 + + + + Scripts + + + Qt::Vertical + + + + 11 + + + 6 + + + + + 6 + + + 0 + + + + + + 0 + 0 + + + + + 125 + 0 + + + + Before export: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + 0 + 0 + + + + Browse + + + + + + + + + 6 + + + 0 + + + + + + 0 + 0 + + + + + 125 + 0 + + + + QFrame::NoFrame + + + After Export: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + 0 + 0 + + + + Browse + + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::MinimumExpanding + + + + 20 + 41 + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 61 + 21 + + + + + + + + Cancel + + + + + + + Export + + + true + + + + + + + + + qPixmapFromMimeSource + + + Q3GroupBox + QGroupBox +
Qt3Support/Q3GroupBox
+ 1 +
+
+ + xsltproc.h + process.h + + + + + cancelButton + clicked() + ExportHTMLDialog + reject() + + + 459 + 443 + + + 256 + 233 + + + + + exportButton + clicked() + ExportHTMLDialog + accept() + + + 368 + 443 + + + 256 + 233 + + + + + diff -r 0bba81dde1bc -r 36eb4b8f409e exports.cpp --- a/exports.cpp Fri Feb 19 13:47:03 2010 +0000 +++ b/exports.cpp Thu Feb 25 11:03:52 2010 +0000 @@ -8,6 +8,7 @@ #include "warningdialog.h" #include "xsltproc.h" + extern Main *mainWindow; extern QDir vymBaseDir; extern QString vymName; @@ -344,14 +345,11 @@ QString s; QString curIndent(""); int i; - BranchObj *bo; //FIXME-3 still needed? BranchItem *cur=NULL; BranchItem *prev=NULL; cur=model->nextBranch (cur,prev); while (cur) { - bo=(BranchObj*)(cur->getLMO()); - if (!cur->hasHiddenExportParent() ) { // If necessary, write note @@ -487,6 +485,8 @@ noSingulars=true; frameURLs=true; useMapColors=true; + cssFileName="vym.css"; + cssOriginalPath=""; // Is set in VymModel, based on default setting in ExportHTMLDialog if (model &&model->getMapEditor()) offset=model->getMapEditor()->getTotalBBox().topLeft(); @@ -590,8 +590,37 @@ return r; } +void ExportHTML::setCSSPath(const QString &p) +{ + cssOriginalPath=p; +} + void ExportHTML::doExport() { + //FIXME-1 check for errors// Copy CSS file + QFile css_src (cssOriginalPath); + QFile css_dst (outDir.path()+"/"+cssFileName); + if (!css_src.open ( QIODevice::ReadOnly)) + QMessageBox::warning( 0, QObject::tr( "Warning","ExportHTML" ),QObject::tr("Could not open %1","ExportHTML").arg(cssOriginalPath)); + else + { + if (!css_dst.open( QIODevice::WriteOnly)) + QMessageBox::warning( 0, QObject::tr( "Warning" ), QObject::tr("Could not open %1").arg(css_dst.fileName())); + else + { + + QTextStream tsout( &css_dst); + QTextStream tsin ( &css_src); + QString s= tsin.read(); + tsout << s; + css_dst.close(); + } + css_src.close(); + } + + + + // Open file for writing QFile file (outputFile); if ( !file.open( QIODevice::WriteOnly ) ) { @@ -604,7 +633,7 @@ // Write header ts<<""+model->getMapName()<<""; - ts<<" \n"; + ts<<" \n"; // Include image ts<<"
getMapName()<<".png\" usemap='#imagemap'>
\n"; diff -r 0bba81dde1bc -r 36eb4b8f409e exports.h --- a/exports.h Fri Feb 19 13:47:03 2010 +0000 +++ b/exports.h Thu Feb 25 11:03:52 2010 +0000 @@ -100,11 +100,14 @@ ExportHTML(); ExportHTML(VymModel *m); virtual void init(); + virtual void setCSSPath(const QString &path); virtual void doExport(); private: QString getBranchText(BranchItem *); QString buildList (BranchItem *); QString imageMap; + QString cssFileName; + QString cssOriginalPath; bool frameURLs; bool noSingulars; diff -r 0bba81dde1bc -r 36eb4b8f409e exportxhtmldialog.ui --- a/exportxhtmldialog.ui Fri Feb 19 13:47:03 2010 +0000 +++ b/exportxhtmldialog.ui Thu Feb 25 11:03:52 2010 +0000 @@ -1,7 +1,8 @@ - + + ExportXHTMLDialog - - + + 0 0 @@ -9,50 +10,41 @@ 523 - + 0 130 - + Export XHTML - + - - + + 6 - - 0 - - - 0 - - - 0 - - + 0 - - - + + + 0 0 - + Export to directory: - - - + + + 0 0 @@ -60,14 +52,14 @@ - - - + + + 0 0 - + Browse @@ -75,46 +67,27 @@ - - - + + + 0 0 - + 0 160 - + Options - + Qt::Vertical - - - - 22 - 156 - 521 - 21 - - - - - 0 - 0 - - - - show output of external scripts - - - - + + 20 30 @@ -122,189 +95,166 @@ 104 - - + + 6 - - 0 - - - 0 - - - 0 - - + 0 - - + + Include image - - + + Colored headings in text - - + + Save settings in map - - + + show warnings of xslt processor + + + + + 0 + 0 + + + + show output of external scripts + + + + + + - - + + Stylesheets - + Qt::Vertical - - + + 11 - - 11 - - - 11 - - - 11 - - + 6 - - 6 - - - - + + + 6 - - 0 - - - 0 - - - 0 - - + 0 - - - + + + 0 0 - + 125 0 - + XSL: - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - + - - - + + + 0 0 - + Browse - - - + + + 6 - - 0 - - - 0 - - - 0 - - + 0 - - - + + + 0 0 - + 125 0 - + CSS: - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - + - - - + + + 0 0 - + Browse @@ -315,143 +265,113 @@ - - + + Scripts - + Qt::Vertical - - + + 11 - - 11 - - - 11 - - - 11 - - + 6 - - 6 - - - - + + + 6 - - 0 - - - 0 - - - 0 - - + 0 - - - + + + 0 0 - + 125 0 - + Before export: - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - + - - - + + + 0 0 - + Browse - - - + + + 6 - - 0 - - - 0 - - - 0 - - + 0 - - - + + + 0 0 - + 125 0 - + QFrame::NoFrame - + After Export: - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - + - - - + + + 0 0 - + Browse @@ -463,13 +383,13 @@ - + Qt::Vertical - + QSizePolicy::MinimumExpanding - + 20 41 @@ -478,16 +398,16 @@ - + - + Qt::Horizontal - + QSizePolicy::Expanding - + 61 21 @@ -496,18 +416,18 @@ - - + + Cancel - - + + Export - + true @@ -516,7 +436,7 @@ - + qPixmapFromMimeSource @@ -533,8 +453,8 @@ - xsltproc.h - process.h + xsltproc.h + process.h @@ -544,11 +464,11 @@ ExportXHTMLDialog reject() - + 459 443 - + 256 233 @@ -560,11 +480,11 @@ ExportXHTMLDialog accept() - + 368 443 - + 256 233 diff -r 0bba81dde1bc -r 36eb4b8f409e flagrow.cpp --- a/flagrow.cpp Fri Feb 19 13:47:03 2010 +0000 +++ b/flagrow.cpp Thu Feb 25 11:03:52 2010 +0000 @@ -46,7 +46,7 @@ } -bool FlagRow::isActive (const QString &name) //FIXME-2 regression +bool FlagRow::isActive (const QString &name) { QString n; foreach (n,activeNames) diff -r 0bba81dde1bc -r 36eb4b8f409e geometry.cpp --- a/geometry.cpp Fri Feb 19 13:47:03 2010 +0000 +++ b/geometry.cpp Thu Feb 25 11:03:52 2010 +0000 @@ -48,6 +48,11 @@ return false; } +qreal distance (const QPointF &p, const QPointF &q) +{ + return sqrt (p.x()*q.x() + p.y()*q.y()); +} + Vector::Vector ():QPointF () { } diff -r 0bba81dde1bc -r 36eb4b8f409e geometry.h --- a/geometry.h Fri Feb 19 13:47:03 2010 +0000 +++ b/geometry.h Thu Feb 25 11:03:52 2010 +0000 @@ -5,6 +5,7 @@ QRectF addBBox(QRectF r1, QRectF r2); bool isInBox(const QPointF &p, const QRectF &box); +qreal distance (const QPointF &p, const QPointF &q); class Vector:public QPointF diff -r 0bba81dde1bc -r 36eb4b8f409e main.cpp --- a/main.cpp Fri Feb 19 13:47:03 2010 +0000 +++ b/main.cpp Thu Feb 25 11:03:52 2010 +0000 @@ -202,7 +202,7 @@ #endif //m.resize(m.sizeHint()); - m.setIcon (QPixmap (iconPath+"vym-48x48.png")); + m.setIcon (QPixmap (iconPath+"vym.png")); m.show(); m.fileNew(); // Paint Mainwindow first time diff -r 0bba81dde1bc -r 36eb4b8f409e mainwindow.cpp --- a/mainwindow.cpp Fri Feb 19 13:47:03 2010 +0000 +++ b/mainwindow.cpp Thu Feb 25 11:03:52 2010 +0000 @@ -205,6 +205,8 @@ setupSettingsActions(); setupContextMenus(); setupMacros(); + if (debug) switchboard.print(); + if (settings.value( "/mainwindow/showTestMenu",false).toBool()) setupTestActions(); setupHelpActions(); @@ -341,6 +343,7 @@ a = new QAction(QPixmap( iconPath+"filenew.png"), tr( "&New map","File menu" ),this); a->setStatusTip ( tr( "New map","Status tip File menu" ) ); a->setShortcut ( Qt::CTRL + Qt::Key_N ); //New map + switchboard.addConnection(a,tr("File","Shortcut group")); a->addTo( tb ); fileMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( fileNew() ) ); @@ -348,6 +351,7 @@ a = new QAction(QPixmap( iconPath+"filenewcopy.png"), tr( "&Copy to new map","File menu" ),this); a->setStatusTip ( tr( "Copy selection to mapcenter of a new map","Status tip File menu" ) ); a->setShortcut ( Qt::CTRL +Qt::SHIFT + Qt::Key_N ); //New map + switchboard.addConnection(a,tr("File","Shortcut group")); fileMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( fileNewCopy() ) ); actionFileNewCopy=a; @@ -355,6 +359,7 @@ a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Open..." ,"File menu"),this); a->setStatusTip (tr( "Open","Status tip File menu" ) ); a->setShortcut ( Qt::CTRL + Qt::Key_O ); //Open map + switchboard.addConnection(a,tr("File","Shortcut group")); a->addTo( tb ); fileMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( fileLoad() ) ); @@ -365,6 +370,7 @@ a = new QAction( QPixmap( iconPath+"filesave.png"), tr( "&Save...","File menu" ), this); a->setStatusTip ( tr( "Save","Status tip file menu" )); a->setShortcut (Qt::CTRL + Qt::Key_S ); //Save map + switchboard.addConnection(a,tr("File","Shortcut group")); a->addTo( tb ); fileMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( fileSave() ) ); @@ -372,6 +378,7 @@ a = new QAction( QPixmap(iconPath+"filesaveas.png"), tr( "Save &As...","File menu" ), this); a->setStatusTip (tr( "Save &As","Status tip file menu" ) ); + switchboard.addConnection(a,tr("File","Shortcut group")); fileMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( fileSaveAs() ) ); @@ -381,12 +388,14 @@ a = new QAction(tr("KDE 3 Bookmarks"), this); a->setStatusTip ( tr( "Import %1","Status tip file menu" ).arg(tr("KDE 3 bookmarks"))); + switchboard.addConnection(a,tr("File","Shortcut group")); a->addTo (fileImportMenu); connect( a, SIGNAL( triggered() ), this, SLOT( fileImportKDE3Bookmarks() ) ); a = new QAction(tr("KDE 4 Bookmarks"), this); a->setStatusTip ( tr( "Import %1","Status tip file menu" ).arg(tr("KDE 4 bookmarks"))); a->addTo (fileImportMenu); + switchboard.addConnection(a,tr("File","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( fileImportKDE4Bookmarks() ) ); if (settings.value( "/mainwindow/showTestMenu",false).toBool()) @@ -394,21 +403,25 @@ a = new QAction( QPixmap(), tr("Firefox Bookmarks","File menu"),this); a->setStatusTip (tr( "Import %1","Status tip file menu").arg(tr("Firefox Bookmarks" ) )); a->addTo (fileImportMenu); + switchboard.addConnection(a,tr("File","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( fileImportFirefoxBookmarks() ) ); } a = new QAction("Freemind...",this); a->setStatusTip ( tr( "Import %1","status tip file menu").arg(" Freemind") ); + switchboard.addConnection(a,tr("File","Shortcut group")); fileImportMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( fileImportFreemind() ) ); a = new QAction("Mind Manager...",this); a->setStatusTip ( tr( "Import %1","status tip file menu").arg(" Mind Manager") ); + switchboard.addConnection(a,tr("File","Shortcut group")); fileImportMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( fileImportMM() ) ); a = new QAction( tr( "Import Dir%1","File menu").arg("..."), this); a->setStatusTip (tr( "Import directory structure (experimental)","status tip file menu" ) ); + switchboard.addConnection(a,tr("File","Shortcut group")); fileImportMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( fileImportDir() ) ); @@ -416,17 +429,20 @@ a = new QAction( tr("Image%1","File export menu").arg("..."), this); a->setStatusTip( tr( "Export map as image","status tip file menu" )); + switchboard.addConnection(a,tr("File","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( fileExportImage() ) ); fileExportMenu->addAction (a); a = new QAction( "Open Office...", this); a->setStatusTip( tr( "Export in Open Document Format used e.g. in Open Office ","status tip file menu" )); + switchboard.addConnection(a,tr("File","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( fileExportOOPresentation() ) ); fileExportMenu->addAction (a); 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"))); + switchboard.addConnection(a,tr("File","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( fileExportHTML() ) ); fileExportMenu->addAction (a); @@ -438,41 +454,49 @@ 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")); connect( a, SIGNAL( triggered() ), this, SLOT( fileExportAO() ) ); fileExportMenu->addAction (a); a = new QAction( "Text (ASCII)...", this); a->setStatusTip ( tr( "Export as %1").arg("ASCII "+tr("(still experimental)" ))); + switchboard.addConnection(a,tr("File","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( fileExportASCII() ) ); fileExportMenu->addAction (a); a = new QAction( "Spreadsheet (CSV)...", this); a->setStatusTip ( tr( "Export as %1").arg("CSV "+tr("(still experimental)" ))); + switchboard.addConnection(a,tr("File","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( fileExportCSV() ) ); fileExportMenu->addAction (a); a = new QAction( tr("KDE 3 Bookmarks","File menu"), this); a->setStatusTip( tr( "Export as %1").arg(tr("KDE 3 Bookmarks" ))); + switchboard.addConnection(a,tr("File","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( fileExportKDE3Bookmarks() ) ); fileExportMenu->addAction (a); a = new QAction( tr("KDE 4 Bookmarks","File menu"), this); a->setStatusTip( tr( "Export as %1").arg(tr("KDE 4 Bookmarks" ))); + switchboard.addConnection(a,tr("File","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( fileExportKDE4Bookmarks() ) ); fileExportMenu->addAction (a); a = new QAction( "Taskjuggler...", this ); a->setStatusTip( tr( "Export as %1").arg("Taskjuggler "+tr("(still experimental)" ))); + switchboard.addConnection(a,tr("File","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( fileExportTaskjuggler() ) ); fileExportMenu->addAction (a); a = new QAction( "LaTeX...", this); a->setStatusTip( tr( "Export as %1").arg("LaTeX "+tr("(still experimental)" ))); + switchboard.addConnection(a,tr("File","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( fileExportLaTeX() ) ); fileExportMenu->addAction (a); a = new QAction( "XML..." , this ); a->setStatusTip (tr( "Export as %1").arg("XML")); + switchboard.addConnection(a,tr("File","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( fileExportXML() ) ); fileExportMenu->addAction (a); @@ -482,6 +506,7 @@ a->setStatusTip ( tr( "Print" ,"File menu") ); a->setShortcut (Qt::CTRL + Qt::Key_P ); //Print map a->addTo( tb ); + switchboard.addConnection(a,tr("File","Shortcut group")); fileMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( filePrint() ) ); actionFilePrint=a; @@ -489,12 +514,14 @@ a = new QAction( QPixmap(iconPath+"fileclose.png"), tr( "&Close Map","File menu" ), this); a->setStatusTip (tr( "Close Map" ) ); a->setShortcut (Qt::CTRL + Qt::Key_W ); //Close map + switchboard.addConnection(a,tr("File","Shortcut group")); fileMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( fileCloseMap() ) ); a = new QAction(QPixmap(iconPath+"exit.png"), tr( "E&xit","File menu")+" "+vymName, this); a->setStatusTip ( tr( "Exit")+" "+vymName ); a->setShortcut (Qt::CTRL + Qt::Key_Q ); //Quit vym + switchboard.addConnection(a,tr("File","Shortcut group")); fileMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( fileExitVYM() ) ); } @@ -515,6 +542,7 @@ a->setStatusTip (tr( "Undo" ) ); a->setShortcut ( Qt::CTRL + Qt::Key_Z ); //Undo last action a->setEnabled (false); + switchboard.addConnection(a,tr("Edit","Shortcut group")); tb->addAction (a); editMenu->addAction (a); actionUndo=a; @@ -522,6 +550,7 @@ a = new QAction( QPixmap( iconPath+"redo.png"), tr( "&Redo","Edit menu" ), this); a->setStatusTip (tr( "Redo" )); a->setShortcut (Qt::CTRL + Qt::Key_Y ); //Redo last action + switchboard.addConnection(a,tr("Edit","Shortcut group")); tb->addAction (a); editMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editRedo() ) ); @@ -532,6 +561,7 @@ a->setStatusTip ( tr( "Copy" ) ); a->setShortcut (Qt::CTRL + Qt::Key_C ); //Copy a->setEnabled (false); + switchboard.addConnection(a,tr("Edit","Shortcut group")); tb->addAction (a); editMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editCopy() ) ); @@ -542,6 +572,7 @@ a->setShortcut (Qt::CTRL + Qt::Key_X ); //Cut a->setEnabled (false); tb->addAction (a); + switchboard.addConnection(a,tr("Edit","Shortcut group")); editMenu->addAction (a); actionCut=a; connect( a, SIGNAL( triggered() ), this, SLOT( editCut() ) ); @@ -552,6 +583,7 @@ a->setShortcut ( Qt::CTRL + Qt::Key_V ); //Paste a->setEnabled (false); tb->addAction (a); + switchboard.addConnection(a,tr("Edit","Shortcut group")); editMenu->addAction (a); actionPaste=a; @@ -560,6 +592,7 @@ a->setStatusTip (tr( "Delete Selection" )); a->setShortcut ( Qt::Key_Delete); //Delete selection a->setShortcutContext (Qt::WindowShortcut); + switchboard.addConnection(a,tr("Edit","Shortcut group")); addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteSelection() ) ); actionDelete=a; @@ -568,6 +601,7 @@ a= new QAction(tr( "Add attribute" ), this); a->setShortcut ( Qt::Key_Q); a->setShortcutContext (Qt::WindowShortcut); + switchboard.addConnection(a,tr("Edit","Shortcut group")); addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editAddAttribute() ) ); actionAddAttribute= a; @@ -577,6 +611,7 @@ a= new QAction(QPixmap(iconPath+"newmapcenter.png"),tr( "Add mapcenter","Canvas context menu" ), this); a->setShortcut ( Qt::Key_M); a->setShortcutContext (Qt::WindowShortcut); + switchboard.addConnection(a,tr("Edit","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( editAddMapCenter() ) ); //actionListBranches.append(a); tb->addAction (a); @@ -588,11 +623,13 @@ alt->setStatusTip ( tr( "Add a branch as child of selection" )); alt->setShortcut (Qt::Key_A); //Add branch alt->setShortcutContext (Qt::WindowShortcut); + switchboard.addConnection(alt,tr("Edit","Shortcut group")); addAction (alt); connect( alt, SIGNAL( triggered() ), this, SLOT( editNewBranch() ) ); a = new QAction(QPixmap(iconPath+"newbranch.png"), tr( "Add branch as child","Edit menu" ), this); a->setStatusTip ( tr( "Add a branch as child of selection" )); a->setShortcut (Qt::Key_Insert); //Add branch + switchboard.addConnection(a,tr("Edit","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranch() ) ); actionListBranches.append(a); #if defined (Q_OS_MACX) @@ -610,6 +647,7 @@ a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" )); a->setShortcut (Qt::ALT + Qt::Key_Insert ); //Insert branch a->setShortcutContext (Qt::WindowShortcut); + switchboard.addConnection(a,tr("Edit","Shortcut group")); addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBefore() ) ); a->setEnabled (false); @@ -619,6 +657,7 @@ a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" )); a->setShortcut ( Qt::ALT + Qt::Key_A ); //Insert branch a->setShortcutContext (Qt::WindowShortcut); + switchboard.addConnection(a,tr("Edit","Shortcut group")); addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBefore() ) ); actionListBranches.append(a); @@ -628,6 +667,7 @@ a->setStatusTip ( tr( "Add a branch above selection" )); a->setShortcut (Qt::SHIFT+Qt::Key_Insert ); //Add branch above a->setShortcutContext (Qt::WindowShortcut); + switchboard.addConnection(a,tr("Edit","Shortcut group")); addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchAbove() ) ); a->setEnabled (false); @@ -637,6 +677,7 @@ a->setStatusTip ( tr( "Add a branch above selection" )); a->setShortcut (Qt::SHIFT+Qt::Key_A ); //Add branch above a->setShortcutContext (Qt::WindowShortcut); + switchboard.addConnection(a,tr("Edit","Shortcut group")); addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchAbove() ) ); actionListBranches.append(a); @@ -646,6 +687,7 @@ a->setStatusTip ( tr( "Add a branch below selection" )); a->setShortcut (Qt::CTRL +Qt::Key_Insert ); //Add branch below a->setShortcutContext (Qt::WindowShortcut); + switchboard.addConnection(a,tr("Edit","Shortcut group")); addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBelow() ) ); a->setEnabled (false); @@ -655,6 +697,7 @@ a->setStatusTip ( tr( "Add a branch below selection" )); a->setShortcut (Qt::CTRL +Qt::Key_A ); // Add branch below a->setShortcutContext (Qt::WindowShortcut); + switchboard.addConnection(a,tr("Edit","Shortcut group")); addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBelow() ) ); actionListBranches.append(a); @@ -663,6 +706,7 @@ a->setStatusTip ( tr( "Move branch up" ) ); a->setShortcut (Qt::Key_PageUp ); // Move branch up a->setEnabled (false); + switchboard.addConnection(a,tr("Edit","Shortcut group")); tb->addAction (a); editMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editMoveUp() ) ); @@ -673,6 +717,7 @@ a->setStatusTip (tr( "Move branch down" ) ); a->setShortcut ( Qt::Key_PageDown ); // Move branch down a->setEnabled (false); + switchboard.addConnection(a,tr("Edit","Shortcut group")); tb->addAction (a); editMenu->addAction (a); actionMoveDown=a; @@ -680,6 +725,7 @@ a = new QAction(QPixmap(), tr( "&Detach","Context menu" ),this); a->setStatusTip ( tr( "Detach branch and use as mapcenter","Context menu" ) ); a->setShortcut ( Qt::Key_D ); // Detach branch + switchboard.addConnection(a,tr("Edit","Shortcut group")); editMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editDetach() ) ); actionDetach=a; @@ -688,6 +734,7 @@ connect( a, SIGNAL( activated() ), this, SLOT( editSortChildren() ) ); a->setEnabled (true); a->addTo( tb ); + switchboard.addConnection(a,tr("Edit","Shortcut group")); editMenu->addAction (a); actionSortChildren=a; @@ -695,12 +742,14 @@ connect( a, SIGNAL( activated() ), this, SLOT( editSortBackChildren() ) ); a->setEnabled (true); a->addTo( tb ); + switchboard.addConnection(a,tr("Edit","Shortcut group")); editMenu->addAction (a); actionSortBackChildren=a; alt = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch","Edit menu" ), this); alt->setShortcut ( Qt::Key_S ); // Scroll branch alt->setStatusTip (tr( "Scroll branch" )); + switchboard.addConnection(alt,tr("Edit","Shortcut group")); connect( alt, SIGNAL( triggered() ), this, SLOT( editToggleScroll() ) ); #if defined(Q_OS_MACX) actionToggleScroll=alt; @@ -719,6 +768,7 @@ a = new QAction( QPixmap(), tr( "Expand all branches","Edit menu" ), this); a->setShortcut ( Qt::SHIFT + Qt::Key_X ); // Expand all branches a->setStatusTip (tr( "Expand all branches" )); + switchboard.addConnection(a,tr("Edit","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( editExpandAll() ) ); actionExpandAll=a; actionExpandAll->setEnabled (false); @@ -730,6 +780,7 @@ a = new QAction( QPixmap(), tr( "Expand one level","Edit menu" ), this); a->setShortcut ( Qt::Key_Greater ); // Expand one level in tree editor + switchboard.addConnection(a,tr("Edit","Shortcut group")); a->setStatusTip (tr( "Expand one level in tree editor" )); connect( a, SIGNAL( triggered() ), this, SLOT( editExpandOneLevel() ) ); a->setEnabled (false); @@ -742,6 +793,7 @@ a = new QAction( QPixmap(), tr( "Collapse one level","Edit menu" ), this); a->setShortcut ( Qt::Key_Less); // Collapse one level in tree editor + switchboard.addConnection(a,tr("Edit","Shortcut group")); a->setStatusTip (tr( "Collapse one level in tree editor" )); connect( a, SIGNAL( triggered() ), this, SLOT( editCollapseOneLevel() ) ); a->setEnabled (false); @@ -754,6 +806,7 @@ a = new QAction( tr( "Unscroll children","Edit menu" ), this); a->setStatusTip (tr( "Unscroll all scrolled branches in selected subtree" )); + switchboard.addConnection(a,tr("Edit","Shortcut group")); editMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editUnscrollChildren() ) ); @@ -762,12 +815,14 @@ a = new QAction( QPixmap(iconPath+"find.png"), tr( "Find...","Edit menu"), this); a->setStatusTip (tr( "Find" ) ); a->setShortcut (Qt::CTRL + Qt::Key_F ); //Find + switchboard.addConnection(a,tr("Edit","Shortcut group")); editMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editOpenFindWidget() ) ); a = new QAction( tr( "Find duplicate URLs","Edit menu"), this); //a->setStatusTip (tr( "Find" ) ); a->setShortcut (Qt::SHIFT + Qt::Key_F); //Find duplicate URLs + switchboard.addConnection(a,tr("Edit","Shortcut group")); if (settings.value( "/mainwindow/showTestMenu",false).toBool() ) editMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editFindDuplicateURLs() ) ); @@ -776,7 +831,7 @@ a = new QAction( QPixmap(flagsPath+"flag-url.png"), tr( "Open URL","Edit menu" ), this); a->setShortcut (Qt::SHIFT + Qt::Key_U ); - a->setShortcut (tr( "Open URL" )); + switchboard.addConnection(a,tr("Edit","Shortcut group")); tb->addAction (a); addAction(a); connect( a, SIGNAL( triggered() ), this, SLOT( editOpenURL() ) ); @@ -785,6 +840,7 @@ a = new QAction( tr( "Open URL in new tab","Edit menu" ), this); a->setStatusTip (tr( "Open URL in new tab" )); //a->setShortcut (Qt::CTRL+Qt::Key_U ); + switchboard.addConnection(a,tr("Edit","Shortcut group")); addAction(a); connect( a, SIGNAL( triggered() ), this, SLOT( editOpenURLTab() ) ); actionOpenURLTab=a; @@ -792,6 +848,7 @@ a = new QAction( tr( "Open all URLs in subtree (including scrolled branches)","Edit menu" ), this); a->setStatusTip (tr( "Open all URLs in subtree (including scrolled branches)" )); a->setShortcut ( Qt::CTRL + Qt::Key_U ); + switchboard.addConnection(a,tr("Edit","Shortcut group")); addAction(a); actionListBranches.append(a); connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleVisURLTabs() ) ); @@ -799,6 +856,7 @@ a = new QAction( tr( "Open all URLs in subtree","Edit menu" ), this); a->setStatusTip (tr( "Open all URLs in subtree" )); + switchboard.addConnection(a,tr("Edit","Shortcut group")); addAction(a); actionListBranches.append(a); connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleURLTabs() ) ); @@ -808,6 +866,7 @@ a->setStatusTip ( tr( "Edit URL" ) ); a->setShortcut ( Qt::Key_U ); a->setShortcutContext (Qt::WindowShortcut); + switchboard.addConnection(a,tr("Edit","Shortcut group")); actionListBranches.append(a); addAction(a); connect( a, SIGNAL( triggered() ), this, SLOT( editURL() ) ); @@ -817,6 +876,7 @@ a->setStatusTip ( tr( "Edit local URL" ) ); //a->setShortcut (Qt::SHIFT + Qt::Key_U ); a->setShortcutContext (Qt::WindowShortcut); + switchboard.addConnection(a,tr("Edit","Shortcut group")); actionListBranches.append(a); addAction(a); connect( a, SIGNAL( triggered() ), this, SLOT( editLocalURL() ) ); @@ -825,6 +885,7 @@ a = new QAction( tr( "Use heading for URL","Edit menu" ), this); a->setStatusTip ( tr( "Use heading of selected branch as URL" )); a->setEnabled (false); + switchboard.addConnection(a,tr("Edit","Shortcut group")); actionListBranches.append(a); connect( a, SIGNAL( triggered() ), this, SLOT( editHeading2URL() ) ); actionHeading2URL=a; @@ -835,6 +896,7 @@ actionListBranches.append(a); a->setShortcut ( Qt::Key_B ); a->setShortcutContext (Qt::WindowShortcut); + switchboard.addConnection(a,tr("Edit","Shortcut group")); addAction(a); connect( a, SIGNAL( triggered() ), this, SLOT( editBugzilla2URL() ) ); actionBugzilla2URL=a; @@ -845,6 +907,7 @@ actionListBranches.append(a); a->setShortcut ( Qt::Key_B + Qt::SHIFT); a->setShortcutContext (Qt::WindowShortcut); + switchboard.addConnection(a,tr("Edit","Shortcut group")); addAction(a); connect( a, SIGNAL( triggered() ), this, SLOT( getBugzillaData() ) ); actionGetBugzillaData=a; @@ -852,6 +915,7 @@ a = new QAction(tr( "Create URL to Novell FATE","Edit menu" ), this); a->setStatusTip ( tr( "Create URL to Novell FATE" )); a->setEnabled (false); + switchboard.addConnection(a,tr("Edit","Shortcut group")); actionListBranches.append(a); connect( a, SIGNAL( triggered() ), this, SLOT( editFATE2URL() ) ); actionFATE2URL=a; @@ -860,12 +924,14 @@ a->setStatusTip ( tr( "Jump to another vym map, if needed load it first" )); tb->addAction (a); a->setEnabled (false); + switchboard.addConnection(a,tr("Edit","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( editOpenVymLink() ) ); actionOpenVymLink=a; a = new QAction(QPixmap(), tr( "Open all vym links in subtree","Edit menu" ), this); a->setStatusTip ( tr( "Open all vym links in subtree" )); a->setEnabled (false); + switchboard.addConnection(a,tr("Edit","Shortcut group")); actionListBranches.append(a); connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleVymLinks() ) ); actionOpenMultipleVymLinks=a; @@ -874,6 +940,7 @@ a = new QAction(tr( "Edit vym link...","Edit menu" ), this); a->setEnabled (false); a->setStatusTip ( tr( "Edit link to another vym map" )); + switchboard.addConnection(a,tr("Edit","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( editVymLink() ) ); actionListBranches.append(a); actionVymLink=a; @@ -881,6 +948,7 @@ a = new QAction(tr( "Delete vym link","Edit menu" ),this); a->setStatusTip ( tr( "Delete link to another vym map" )); a->setEnabled (false); + switchboard.addConnection(a,tr("Edit","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteVymLink() ) ); actionDeleteVymLink=a; @@ -890,6 +958,7 @@ a->setToggleAction(true); tb->addAction (a); a->setEnabled (false); + switchboard.addConnection(a,tr("Edit","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( editToggleHideExport() ) ); actionToggleHideExport=a; @@ -899,6 +968,7 @@ actionListBranches.append(a); a->setShortcut ( Qt::Key_T ); // Add timestamp a->setShortcutContext (Qt::WindowShortcut); + switchboard.addConnection(a,tr("Edit","Shortcut group")); addAction(a); connect( a, SIGNAL( triggered() ), this, SLOT( editAddTimestamp() ) ); actionAddTimestamp=a; @@ -906,6 +976,7 @@ a = new QAction(tr( "Edit Map Info...","Edit menu" ),this); a->setStatusTip ( tr( "Edit Map Info" )); a->setEnabled (true); + switchboard.addConnection(a,tr("Edit","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( editMapInfo() ) ); actionMapInfo=a; @@ -914,12 +985,14 @@ a->setStatusTip (tr( "Add map at selection" )); connect( a, SIGNAL( triggered() ), this, SLOT( editImportAdd() ) ); a->setEnabled (false); + switchboard.addConnection(a,tr("Edit","Shortcut group")); actionListBranches.append(a); actionImportAdd=a; // Import at selection (replacing selection) a = new QAction( tr( "Add map (replace)","Edit menu" ), this); a->setStatusTip (tr( "Replace selection with map" )); + switchboard.addConnection(a,tr("Edit","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( editImportReplace() ) ); a->setEnabled (false); actionListBranches.append(a); @@ -930,6 +1003,7 @@ a->setStatusTip (tr( "Save selection" )); connect( a, SIGNAL( triggered() ), this, SLOT( editSaveBranch() ) ); a->setEnabled (false); + switchboard.addConnection(a,tr("Edit","Shortcut group")); actionListBranches.append(a); actionSaveBranch=a; @@ -939,6 +1013,7 @@ a->setShortcut (Qt::ALT + Qt::Key_Delete ); connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteKeepChildren() ) ); a->setEnabled (false); + switchboard.addConnection(a,tr("Edit","Shortcut group")); addAction (a); actionListBranches.append(a); actionDeleteKeepChildren=a; @@ -947,6 +1022,7 @@ a = new QAction( tr( "Remove children","Edit menu" ), this); a->setStatusTip (tr( "Remove children of branch" )); a->setShortcut (Qt::SHIFT + Qt::Key_Delete ); + switchboard.addConnection(a,tr("Edit","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteChildren() ) ); a->setEnabled (false); actionListBranches.append(a); @@ -954,6 +1030,7 @@ a = new QAction( tr( "Add Image...","Edit menu" ), this); a->setStatusTip (tr( "Add Image" )); + switchboard.addConnection(a,tr("Edit","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( editLoadImage() ) ); actionLoadImage=a; @@ -962,6 +1039,7 @@ a->setShortcut ( Qt::CTRL + Qt::Key_I ); //Property window a->setShortcutContext (Qt::WindowShortcut); a->setToggleAction (true); + switchboard.addConnection(a,tr("View shortcuts","Shortcut group")); addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( windowToggleProperty() ) ); actionViewTogglePropertyWindow=a; @@ -1090,34 +1168,36 @@ tb->setObjectName ("viewTB"); QMenu *viewMenu = menuBar()->addMenu ( tr( "&View" )); - Switchboard switchboard; //FIXME-2 testing... QAction *a; a = new QAction(QPixmap(iconPath+"viewmag-reset.png"), tr( "reset Zoom","View action" ), this); a->setStatusTip ( tr( "Zoom reset" ) ); a->setShortcut (Qt::CTRL + Qt::Key_0); // Reset zoom - switchboard.addConnection(a,"CTRL+0"); + switchboard.addConnection(a,tr("View shortcuts","Shortcut group")); a->addTo( tb ); viewMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT(viewZoomReset() ) ); a = new QAction( QPixmap(iconPath+"viewmag+.png"), tr( "Zoom in","View action" ), this); a->setStatusTip (tr( "Zoom in" )); - switchboard.addConnection(a,"CTRL++"); + a->setShortcut(Qt::CTRL + Qt::Key_Plus); + switchboard.addConnection(a,tr("View shortcuts","Shortcut group")); a->addTo( tb ); viewMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT(viewZoomIn() ) ); a = new QAction( QPixmap(iconPath+"viewmag-.png"), tr( "Zoom out","View action" ), this); a->setStatusTip (tr( "Zoom out" )); - switchboard.addConnection(a,"CTRL+-"); + a->setShortcut(Qt::CTRL + Qt::Key_Minus); + switchboard.addConnection(a,tr("View shortcuts","Shortcut group")); a->addTo( tb ); viewMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( viewZoomOut() ) ); a = new QAction( QPixmap(iconPath+"viewshowsel.png"), tr( "Show selection","View action" ), this); a->setStatusTip (tr( "Show selection" )); - switchboard.addConnection(a,"."); + a->setShortcut(Qt::CTRL + Qt::Key_Period); + switchboard.addConnection(a,tr("View shortcuts","Shortcut group")); a->addTo( tb ); viewMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( viewCenter() ) ); @@ -1127,6 +1207,7 @@ a = new QAction(QPixmap(flagsPath+"flag-note.png"), tr( "Show Note Editor","View action" ),this); a->setStatusTip ( tr( "Show Note Editor" )); a->setShortcut ( Qt::CTRL + Qt::Key_E ); // Toggle Note Editor + switchboard.addConnection(a,tr("View shortcuts","Shortcut group")); a->setToggleAction(true); a->addTo( tb ); viewMenu->addAction (a); @@ -1135,7 +1216,8 @@ a = new QAction(QPixmap(), tr( "Show tree editor","View action" ),this); a->setStatusTip ( tr( "Show tree editor" )); - a->setShortcut ( Qt::CTRL + Qt::Key_T ); // Toggle Note Editor // FIXME-3 originally: color subtree + a->setShortcut ( Qt::CTRL + Qt::Key_T ); // Toggle Tree Editor // FIXME-3 originally: color subtree + switchboard.addConnection(a,tr("View shortcuts","Shortcut group")); a->setToggleAction(true); a->addTo( tb ); viewMenu->addAction (a); @@ -1145,6 +1227,7 @@ a = new QAction(QPixmap(iconPath+"history.png"), tr( "History Window","View action" ),this ); a->setStatusTip ( tr( "Show History Window" )); a->setShortcut ( Qt::CTRL + Qt::Key_H ); // Toggle history window + switchboard.addConnection(a,tr("View shortcuts","Shortcut group")); a->setToggleAction(true); a->addTo( tb ); viewMenu->addAction (a); @@ -1159,6 +1242,7 @@ a->setStatusTip ( tr( "Antialiasing" )); a->setToggleAction(true); a->setChecked (settings.value("/mainwindow/view/AntiAlias",true).toBool()); + switchboard.addConnection(a,tr("View shortcuts","Shortcut group")); viewMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleAntiAlias() ) ); actionViewToggleAntiAlias=a; @@ -1167,6 +1251,7 @@ a->setStatusTip (a->text()); a->setToggleAction(true); a->setChecked (settings.value("/mainwindow/view/SmoothPixmapTransformation",true).toBool()); + switchboard.addConnection(a,tr("View shortcuts","Shortcut group")); viewMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleSmoothPixmap() ) ); actionViewToggleSmoothPixmapTransform=a; @@ -1174,16 +1259,16 @@ a = new QAction(tr( "Next Map","View action" ), this); a->setStatusTip (a->text()); a->setShortcut (Qt::ALT + Qt::Key_N ); + switchboard.addConnection(a,tr("View shortcuts","Shortcut group")); viewMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT(windowNextEditor() ) ); a = new QAction (tr( "Previous Map","View action" ), this ); a->setStatusTip (a->text()); a->setShortcut (Qt::ALT + Qt::Key_P ); + switchboard.addConnection(a,tr("View shortcuts","Shortcut group")); viewMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT(windowPreviousEditor() ) ); - - if (debug) switchboard.print(); } // Mode Actions @@ -1199,6 +1284,7 @@ actionGroupModModes->setExclusive (true); a= new QAction( QPixmap(iconPath+"modecolor.png"), tr( "Use modifier to color branches","Mode modifier" ), actionGroupModModes); a->setShortcut (Qt::Key_J); + switchboard.addConnection(a,tr("Modes","Shortcut group")); a->setStatusTip ( tr( "Use modifier to color branches" )); a->setToggleAction(true); a->addTo (tb); @@ -1207,6 +1293,7 @@ a= new QAction( QPixmap(iconPath+"modecopy.png"), tr( "Use modifier to copy","Mode modifier" ), actionGroupModModes ); a->setShortcut( Qt::Key_K); + switchboard.addConnection(a,tr("Modes","Shortcut group")); a->setStatusTip( tr( "Use modifier to copy" )); a->setToggleAction(true); a->addTo (tb); @@ -1214,6 +1301,7 @@ a= new QAction(QPixmap(iconPath+"modelink.png"), tr( "Use modifier to draw xLinks","Mode modifier" ), actionGroupModModes ); a->setShortcut (Qt::Key_L); + switchboard.addConnection(a,tr("Modes","Shortcut group")); a->setStatusTip( tr( "Use modifier to draw xLinks" )); a->setToggleAction(true); a->addTo (tb); @@ -1458,12 +1546,14 @@ a = new QAction( "Start TCPserver for MapEditor",this); //a->setStatusTip ( "Set application to open pdf files")); //a->setShortcut ( Qt::ALT + Qt::Key_T ); //New TCP server + switchboard.addConnection(a,tr("Network shortcuts","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( networkStartServer() ) ); netMenu->addAction (a); a = new QAction( "Connect MapEditor to server",this); //a->setStatusTip ( "Set application to open pdf files")); a->setShortcut ( Qt::ALT + Qt::Key_C ); // Connect to server + switchboard.addConnection(a,tr("Network shortcuts","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( networkConnect() ) ); netMenu->addAction (a); } @@ -1582,17 +1672,20 @@ a = new QAction( "Test function 1" , this); a->setStatusTip( "Call test function 1" ); a->setShortcut (Qt::SHIFT + Qt::Key_T); // Test function 1 + switchboard.addConnection(a,tr("Test shortcuts","Shortcut group")); testMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( testFunction1() ) ); a = new QAction( "Test function 2" , this); a->setStatusTip( "Call test function 2" ); a->setShortcut (Qt::ALT + Qt::Key_T); // Test function 2 + switchboard.addConnection(a,tr("Test shortcuts","Shortcut group")); testMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( testFunction2() ) ); a = new QAction( "Command" , this); a->setStatusTip( "Enter command to call in editor" ); + switchboard.addConnection(a,tr("Test shortcuts","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( testCommand() ) ); testMenu->addAction (a); } @@ -1605,11 +1698,13 @@ QAction *a; a = new QAction( tr( "Open VYM Documentation (pdf) ","Help action" ), this ); a->setStatusTip( tr( "Open VYM Documentation (pdf)" )); + switchboard.addConnection(a,tr("Help shortcuts","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( helpDoc() ) ); helpMenu->addAction (a); a = new QAction( tr( "Open VYM example maps ","Help action" ), this ); a->setStatusTip( tr( "Open VYM example maps " )); + switchboard.addConnection(a,tr("Help shortcuts","Shortcut group")); connect( a, SIGNAL( triggered() ), this, SLOT( helpDemo() ) ); helpMenu->addAction (a); @@ -1758,6 +1853,7 @@ macroActions[i] = new QAction(this); macroActions[i]->setData(i); addAction (macroActions[i]); + //switchboard.addConnection(macroActions[i],tr("Macro shortcuts","Shortcut group")); connect(macroActions[i], SIGNAL(triggered()), this, SLOT(callMacro())); } diff -r 0bba81dde1bc -r 36eb4b8f409e mainwindow.h --- a/mainwindow.h Fri Feb 19 13:47:03 2010 +0000 +++ b/mainwindow.h Thu Feb 25 11:03:52 2010 +0000 @@ -11,6 +11,7 @@ #include "file.h" #include "historywindow.h" #include "mapeditor.h" +#include "shortcuts.h" #include "simplescripteditor.h" #include "texteditor.h" #include "vymview.h" @@ -280,6 +281,8 @@ QAction *macroActions[12]; QStringList macro; + Switchboard switchboard; + QAction* actionFileNewCopy; QAction* actionFileSave; QAction* actionFilePrint; diff -r 0bba81dde1bc -r 36eb4b8f409e mapeditor.cpp --- a/mapeditor.cpp Fri Feb 19 13:47:03 2010 +0000 +++ b/mapeditor.cpp Thu Feb 25 11:03:52 2010 +0000 @@ -1527,7 +1527,10 @@ } // Draw the original link, before selection was moved around - if (settings.value("/animation/use",true).toBool() && seli->depth()>1) + if (settings.value("/animation/use",true).toBool() + && seli->depth()>1 +// && distance (lmosel->getRelPos(),movingObj_orgRelPos)<3 + ) { lmosel->setRelPos(); // calc relPos first for starting point diff -r 0bba81dde1bc -r 36eb4b8f409e shortcuts.cpp --- a/shortcuts.cpp Fri Feb 19 13:47:03 2010 +0000 +++ b/shortcuts.cpp Thu Feb 25 11:03:52 2010 +0000 @@ -1,8 +1,11 @@ -#include "shortcuts.h" +#include +#include #include using namespace std; +#include "shortcuts.h" + ///////////////////////////////////////////////////////////////// // Shortcut ///////////////////////////////////////////////////////////////// @@ -17,20 +20,24 @@ { } -void Switchboard::addConnection (QAction *a, const QString &desc) +void Switchboard::addConnection (QAction *a, const QString &group) { - QKeySequence ks=QKeySequence::fromString (desc); - actions.append (a); - if (!desc.isEmpty()) keys.append (new QKeySequence (ks)); - if (a) a->setShortcut (ks); + actions.insert(group,a); } void Switchboard::print () { - for (int i=0;ishortcut().toString().toStdString(); - cout << " Action: " <text().toStdString(); + cout <<"Group: "< values=actions.values(g); + for (int i=0;itext().left(30),30) + .arg(values.at(i)->shortcut().toString()).toStdString()< keys; - QList actions; + QMultiMap actions; }; #endif diff -r 0bba81dde1bc -r 36eb4b8f409e version.h --- a/version.h Fri Feb 19 13:47:03 2010 +0000 +++ b/version.h Thu Feb 25 11:03:52 2010 +0000 @@ -7,7 +7,7 @@ #define __VYM_VERSION "1.13.0" //#define __VYM_CODENAME "Codename: RC-1" #define __VYM_CODENAME "Codename: development version, not for production!" -#define __VYM_BUILD_DATE "2010-02-19" +#define __VYM_BUILD_DATE "2010-02-22" bool checkVersion(const QString &); diff -r 0bba81dde1bc -r 36eb4b8f409e vym.pro --- a/vym.pro Fri Feb 19 13:47:03 2010 +0000 +++ b/vym.pro Thu Feb 25 11:03:52 2010 +0000 @@ -44,6 +44,8 @@ bugagent.h \ editxlinkdialog.h \ exportoofiledialog.h \ + exporthtmldialog.h\ + exporthtmldialog.h\ exportxhtmldialog.h\ exports.h \ extrainfodialog.h \ @@ -111,6 +113,7 @@ editxlinkdialog.cpp \ exportoofiledialog.cpp \ exports.cpp \ + exporthtmldialog.cpp \ exportxhtmldialog.cpp \ extrainfodialog.cpp \ file.cpp \ @@ -165,6 +168,7 @@ FORMS = \ attributewidget.ui \ branchpropwindow.ui \ + exporthtmldialog.ui \ exportxhtmldialog.ui \ extrainfodialog.ui \ editxlinkdialog.ui \ diff -r 0bba81dde1bc -r 36eb4b8f409e vymmodel.cpp --- a/vymmodel.cpp Fri Feb 19 13:47:03 2010 +0000 +++ b/vymmodel.cpp Thu Feb 25 11:03:52 2010 +0000 @@ -9,6 +9,7 @@ #include "bugagent.h" #include "editxlinkdialog.h" #include "exports.h" +#include "exporthtmldialog.h" #include "exportxhtmldialog.h" #include "file.h" #include "geometry.h" // for addBBox @@ -4259,7 +4260,7 @@ void VymModel::exportHTML (const QString &dir, bool askForName) //FIXME-2 own dialogue missing and also option to save settings in map { - ExportXHTMLDialog dia(NULL); + ExportHTMLDialog dia(NULL); dia.setFilePath (filePath ); dia.setMapName (mapName ); dia.readSettings(); @@ -4297,11 +4298,11 @@ ExportHTML ex (this); ex.setFile (d.path()+"/"+mapName+".html"); - cout << "VM::exportHTML writing "<stop(); BranchObj *bo; @@ -4723,6 +4724,7 @@ void VymModel::startAnimation(BranchObj *bo, const QPointF &start, const QPointF &dest) { + qDebug()<<"Start animation for "<getTreeItem()<getTreeItem()->depth()>0) {