# HG changeset patch # User insilmaril # Date 1259146701 0 # Node ID f9f7922989d8b35c37cf5e0f3cd34acdf63762d2 # Parent 2a33304714baca715e5ca93a8d19597b4b47cd99 Added demos/vym-contribute.vym, fixes for selecting items diff -r 2a33304714ba -r f9f7922989d8 adaptormodel.cpp --- a/adaptormodel.cpp Tue Nov 17 08:24:59 2009 +0000 +++ b/adaptormodel.cpp Wed Nov 25 10:58:21 2009 +0000 @@ -5,6 +5,8 @@ #include "vymmodel.h" +extern QString vymInstanceName; + AdaptorModel::AdaptorModel(QObject *obj) : QDBusAbstractAdaptor(obj) { @@ -60,3 +62,16 @@ model->setHeading(s); } +QDBusVariant AdaptorModel::getInstanceName() +{ + return QDBusVariant (vymInstanceName); +} + +QDBusVariant AdaptorModel::execute (const QString &s) +{ + if (model) + return QDBusVariant (model->runScript (s)); + else + return QDBusVariant ("No model."); +} + diff -r 2a33304714ba -r f9f7922989d8 adaptormodel.h --- a/adaptormodel.h Tue Nov 17 08:24:59 2009 +0000 +++ b/adaptormodel.h Wed Nov 25 10:58:21 2009 +0000 @@ -30,6 +30,8 @@ QDBusVariant query(const QString &query); QDBusVariant getHeading(); void setHeading (const QString &s); + QDBusVariant getInstanceName(); + QDBusVariant execute (const QString &s); Q_SIGNALS: // SIGNALS void crashed(); diff -r 2a33304714ba -r f9f7922989d8 demos/vym-contribute.vym Binary file demos/vym-contribute.vym has changed diff -r 2a33304714ba -r f9f7922989d8 exports.cpp --- a/exports.cpp Tue Nov 17 08:24:59 2009 +0000 +++ b/exports.cpp Wed Nov 25 10:58:21 2009 +0000 @@ -125,6 +125,111 @@ } //////////////////////////////////////////////////////////////////////// +ExportAO::ExportAO() +{ + filter="TXT (*.txt)"; + caption=vymName+ " -" +QObject::tr("Export as ASCII")+" "+QObject::tr("(still experimental)"); +} + +void ExportAO::doExport() +{ + QFile file (outputFile); + if ( !file.open( QIODevice::WriteOnly ) ) + { + qWarning ("ExportAO::doExport couldn't open "+outputFile); + return; + } + QTextStream ts( &file ); // use LANG decoding here... + + // Main loop over all branches + QString s; + QString curIndent; + int i; + BranchItem *cur=NULL; + BranchItem *prev=NULL; + + QString colString; + QColor col; + + cur=model->nextBranch (cur,prev); + while (cur) + { + if (cur->getType()==TreeItem::Branch || cur->getType()==TreeItem::MapCenter) + { + // Make indentstring + curIndent=""; + for (i=0;idepth()-1;i++) curIndent+= indentPerDepth; + + if (!cur->hasHiddenExportParent() ) + { + col=cur->getHeadingColor(); + if (col==QColor (255,0,0)) + colString="[R]"; + else if (col==QColor (217,81,0)) + colString="[O]"; + else if (col==QColor (0,85,0)) + colString="[G]"; + else + colString="[?]"; + switch (cur->depth()) + { + case 0: + //ts << underline (cur->getHeading(),QString("=")); + //ts << "\n"; + break; + case 1: + //ts << "\n"; + //ts << (underline ( cur->getHeading(), QString("-") ) ); + //ts << "\n"; + break; + case 2: // Main heading + ts << "\n"; + ts << underline ( cur->getHeading(), QString("=") ); + ts << "\n\n"; + break; + case 3: // Achievement, Bonus, Objective ... + ts << underline ( cur->getHeading(), "-"); + ts << "\n\n"; + break; + case 4: // That's the item we need to know + ts << (curIndent + "* " + colString+" "+ cur->getHeading()); + if (cur->isActiveStandardFlag ("hook-green")) + ts << " [DONE] "; + else if (cur->isActiveStandardFlag ("clock")) + ts << " [WIP] "; + else if (cur->isActiveStandardFlag ("cross-red")) + ts << " [NOT STARTED] "; + ts << "\n"; + default: + break; + ts << (curIndent + "- " + cur->getHeading()); + ts << "\n"; + break; + } + + // If necessary, write note + if (!cur->getNoteObj().isEmpty()) + { + curIndent +=" | "; + s=cur->getNoteASCII( curIndent, 80); + ts << s; + } + } + } + cur=model->nextBranch(cur,prev); + } + file.close(); +} + +QString ExportAO::underline (const QString &text, const QString &line) +{ + QString r=text + "\n"; + for (int j=0;jsetText( tr("Text to find:")); row1Layout->addWidget( label ); - + */ // Create LineEdit (here QComboBox) QHBoxLayout *row2Layout = new QHBoxLayout; findcombo = new QComboBox; - findcombo->setMinimumWidth(150); + findcombo->setMinimumWidth(250); findcombo->setEditable(true); connect ( findcombo, SIGNAL( highlighted(int) ), this, SLOT( findPressed() ) ); @@ -35,17 +36,17 @@ row2Layout->addWidget(findcombo); // Create Buttons - QHBoxLayout *row3Layout = new QHBoxLayout; + //QHBoxLayout *row3Layout = new QHBoxLayout; clearbutton = new QPushButton; clearbutton->setText(tr("Clear")); connect ( clearbutton, SIGNAL( clicked() ), this, SLOT( clearLineEdit() ) ); - row3Layout->addWidget (clearbutton); + row2Layout->addWidget (clearbutton); cancelbutton = new QPushButton; cancelbutton->setText(tr("Cancel")); cancelbutton->setShortcut (Qt::Key_Escape); connect ( cancelbutton, SIGNAL( clicked() ), this, SLOT( cancelPressed() ) ); - row3Layout->addWidget (cancelbutton); + row2Layout->addWidget (cancelbutton); findbutton = new QPushButton; findbutton->setText (tr("Find")); @@ -53,12 +54,12 @@ findbutton->setShortcut (Qt::Key_Return); connect ( findbutton, SIGNAL( clicked() ), this, SLOT( findPressed() ) ); - row3Layout->addStretch(2); - row3Layout->addWidget(findbutton); + //row2Layout->addStretch(2); + row2Layout->addWidget(findbutton); mainLayout->addLayout (row1Layout); mainLayout->addLayout (row2Layout); - mainLayout->addLayout (row3Layout); + //mainLayout->addLayout (row3Layout); setLayout (mainLayout); } diff -r 2a33304714ba -r f9f7922989d8 findwindow.h --- a/findwindow.h Tue Nov 17 08:24:59 2009 +0000 +++ b/findwindow.h Wed Nov 25 10:58:21 2009 +0000 @@ -9,7 +9,7 @@ #include -class FindWindow : public QGroupBox +class FindWindow : public QWidget { Q_OBJECT diff -r 2a33304714ba -r f9f7922989d8 highlighter.cpp --- a/highlighter.cpp Tue Nov 17 08:24:59 2009 +0000 +++ b/highlighter.cpp Wed Nov 25 10:58:21 2009 +0000 @@ -48,6 +48,7 @@ << "\\bdelete\\b" << "\\bdeleteKeepChilds\\b" << "\\bdeleteChilds\\b" + << "\\bexportAO\\b" << "\\bexportASCII\\b" << "\\bexportImage\\b" << "\\bexportXHTML\\b" diff -r 2a33304714ba -r f9f7922989d8 main.cpp --- a/main.cpp Tue Nov 17 08:24:59 2009 +0000 +++ b/main.cpp Wed Nov 25 10:58:21 2009 +0000 @@ -71,7 +71,7 @@ options.add ("debug", Option::Switch, "d", "debug"); options.add ("version", Option::Switch, "v","version"); options.add ("local", Option::Switch, "l", "local"); - options.add ("name", Option::Switch, "n", "name"); + options.add ("name", Option::String, "n", "name"); options.add ("help", Option::Switch, "h", "help"); options.add ("quit", Option::Switch, "q", "quit"); options.add ("run", Option::String, "r", "run"); @@ -104,7 +104,13 @@ // Register for DBUS if (debug) cout << "PID="<move (50,50); - - connect( scriptEditor, SIGNAL( runScript ( QString ) ), - this, SLOT( runScript( QString ) ) ); - - - // Initialize Find window - findWindow=new FindWindow(NULL); - findWindow->move (x(),y()+70); - connect (findWindow, SIGNAL( findButton(QString) ), - this, SLOT(editFind(QString) ) ); - connect (findWindow, SIGNAL( somethingChanged() ), - this, SLOT(editFindChanged() ) ); - - // Initialize some settings, which are platform dependant - QString p,s; - - // application to open URLs - p="/mainwindow/readerURL"; - #if defined(Q_OS_LINUX) - s=settings.value (p,"xdg-open").toString(); +{ + resize (settings.value("/mainwindow/geometry/size", QSize (800,600)).toSize()); + move (settings.value("/mainwindow/geometry/pos", QPoint(300,100)).toPoint()); +} + +// Sometimes we may need to remember old selections +prevSelection=""; + +// Default color +currentColor=Qt::black; + +// Create unique temporary directory +bool ok; +tmpVymDir=makeTmpDir (ok,"vym"); +if (!ok) +{ + qWarning ("Mainwindow: Could not create temporary directory, failed to start vym"); + exit (1); +} +if (debug) qDebug (QString("vym tmpDir=%1").arg(tmpVymDir) ); + +// Create direcctory for clipboard +clipboardDir=tmpVymDir+"/clipboard"; +clipboardFile="map.xml"; +QDir d(clipboardDir); +d.mkdir (clipboardDir,true); +makeSubDirs (clipboardDir); +clipboardEmpty=true; + +browserPID=new qint64; +*browserPID=0; + +// Satellite windows ////////////////////////////////////////// +// history window +historyWindow=new HistoryWindow(); +connect (historyWindow, SIGNAL (windowClosed() ), this, SLOT (updateActions())); + +// properties window +branchPropertyWindow = new BranchPropertyWindow(); +connect (branchPropertyWindow, SIGNAL (windowClosed() ), this, SLOT (updateActions())); + +// Connect TextEditor, so that we can update flags if text changes +connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag())); +connect (textEditor, SIGNAL (windowClosed() ), this, SLOT (updateActions())); + +// Initialize script editor +scriptEditor = new SimpleScriptEditor(); +scriptEditor->move (50,50); + +connect( scriptEditor, SIGNAL( runScript ( QString ) ), + this, SLOT( runScript( QString ) ) ); + + +// Initialize Find window +findWindow=new FindWindow(NULL); +findWindow->move (x(),y()+70); +connect (findWindow, SIGNAL( findButton(QString) ), + this, SLOT(editFind(QString) ) ); +connect (findWindow, SIGNAL( somethingChanged() ), + this, SLOT(editFindChanged() ) ); + +// Initialize some settings, which are platform dependant +QString p,s; + + // application to open URLs + p="/mainwindow/readerURL"; + #if defined(Q_OS_LINUX) + s=settings.value (p,"xdg-open").toString(); + #else + #if defined(Q_OS_MACX) + s=settings.value (p,"/usr/bin/open").toString(); + #else - #if defined(Q_OS_MACX) - s=settings.value (p,"/usr/bin/open").toString(); - - #else - #if defined(Q_OS_WIN32) - // Assume that system has been set up so that - // Explorer automagically opens up the URL - // in the user's preferred browser. - s=settings.value (p,"explorer").toString(); - #else - s=settings.value (p,"mozilla").toString(); - #endif + #if defined(Q_OS_WIN32) + // Assume that system has been set up so that + // Explorer automagically opens up the URL + // in the user's preferred browser. + s=settings.value (p,"explorer").toString(); + #else + s=settings.value (p,"mozilla").toString(); #endif #endif - settings.setValue( p,s); - - // application to open PDFs - p="/mainwindow/readerPDF"; - #if defined(Q_OS_LINUX) - s=settings.value (p,"xdg-open").toString(); + #endif + settings.setValue( p,s); + + // application to open PDFs + p="/mainwindow/readerPDF"; + #if defined(Q_OS_LINUX) + s=settings.value (p,"xdg-open").toString(); + #else + #if defined(Q_OS_MACX) + s=settings.value (p,"/usr/bin/open").toString(); + #elif defined(Q_OS_WIN32) + s=settings.value (p,"acrord32").toString(); #else - #if defined(Q_OS_MACX) - s=settings.value (p,"/usr/bin/open").toString(); - #elif defined(Q_OS_WIN32) - s=settings.value (p,"acrord32").toString(); - #else - s=settings.value (p,"acroread").toString(); - #endif + s=settings.value (p,"acroread").toString(); #endif - settings.setValue( p,s); - - // width of xLinksMenu - xLinkMenuWidth=60; - - // Create tab widget which holds the maps - tabWidget= new QTabWidget (this); - connect( tabWidget, SIGNAL( currentChanged( QWidget * ) ), - this, SLOT( editorChanged( QWidget * ) ) ); - - setCentralWidget(tabWidget); - - setupFileActions(); - setupEditActions(); - setupFormatActions(); - setupViewActions(); - setupModeActions(); - setupFlagActions(); - setupNetworkActions(); - setupSettingsActions(); - setupContextMenus(); - setupMacros(); - if (settings.value( "/mainwindow/showTestMenu",false).toBool()) setupTestActions(); - setupHelpActions(); - - // Status bar and progress bar there - statusBar(); - progressMax=0; - progressBar=new QProgressBar; - progressBar->hide(); - statusBar()->addPermanentWidget(progressBar); - - restoreState (settings.value("/mainwindow/state",0).toByteArray()); - - updateGeometry(); + #endif + settings.setValue( p,s); + +// width of xLinksMenu +xLinkMenuWidth=60; + +// Create tab widget which holds the maps +tabWidget= new QTabWidget (this); +connect( tabWidget, SIGNAL( currentChanged( QWidget * ) ), + this, SLOT( editorChanged( QWidget * ) ) ); + +setCentralWidget(tabWidget); + +setupFileActions(); +setupEditActions(); +setupFormatActions(); +setupViewActions(); +setupModeActions(); +setupFlagActions(); +setupNetworkActions(); +setupSettingsActions(); +setupContextMenus(); +setupMacros(); +if (settings.value( "/mainwindow/showTestMenu",false).toBool()) setupTestActions(); +setupHelpActions(); + +// Status bar and progress bar there +statusBar(); +progressMax=0; +progressBar=new QProgressBar; +progressBar->hide(); +statusBar()->addPermanentWidget(progressBar); + +restoreState (settings.value("/mainwindow/state",0).toByteArray()); + +updateGeometry(); } Main::~Main() { - // Save Settings +// Save Settings #if defined(Q_OS_WIN32) - settings.setValue ("/mainwindow/geometry/maximized", isMaximized()); +settings.setValue ("/mainwindow/geometry/maximized", isMaximized()); #endif - settings.setValue ("/mainwindow/geometry/size", size()); - settings.setValue ("/mainwindow/geometry/pos", pos()); - settings.setValue ("/mainwindow/state",saveState(0)); - - settings.setValue ("/mainwindow/view/AntiAlias",actionViewToggleAntiAlias->isOn()); - settings.setValue ("/mainwindow/view/SmoothPixmapTransform",actionViewToggleSmoothPixmapTransform->isOn()); - settings.setValue( "/version/version", vymVersion ); - settings.setValue( "/version/builddate", vymBuildDate ); - - settings.setValue( "/mainwindow/autosave/use",actionSettingsAutosaveToggle->isOn() ); - settings.setValue( "/mapeditor/editmode/autoSelectNewBranch",actionSettingsAutoSelectNewBranch->isOn() ); - settings.setValue( "/mainwindow/writeBackupFile",actionSettingsWriteBackupFile->isOn() ); - settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoSelectText->isOn() ); - settings.setValue( "/mapeditor/editmode/autoEditNewBranch",actionSettingsAutoEditNewBranch->isOn() ); - settings.setValue( "/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() ); - settings.setValue( "/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() ); - settings.setValue( "/export/useHideExport",actionSettingsUseHideExport->isOn() ); - - //TODO save scriptEditor settings - - // call the destructors - delete textEditor; - delete historyWindow; - delete branchPropertyWindow; - delete progressBar; - - // Remove temporary directory - removeDir (QDir(tmpVymDir)); +settings.setValue ("/mainwindow/geometry/size", size()); +settings.setValue ("/mainwindow/geometry/pos", pos()); +settings.setValue ("/mainwindow/state",saveState(0)); + +settings.setValue ("/mainwindow/view/AntiAlias",actionViewToggleAntiAlias->isOn()); +settings.setValue ("/mainwindow/view/SmoothPixmapTransform",actionViewToggleSmoothPixmapTransform->isOn()); +settings.setValue( "/version/version", vymVersion ); +settings.setValue( "/version/builddate", vymBuildDate ); + +settings.setValue( "/mainwindow/autosave/use",actionSettingsAutosaveToggle->isOn() ); +settings.setValue( "/mapeditor/editmode/autoSelectNewBranch",actionSettingsAutoSelectNewBranch->isOn() ); +settings.setValue( "/mainwindow/writeBackupFile",actionSettingsWriteBackupFile->isOn() ); +settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoSelectText->isOn() ); +settings.setValue( "/mapeditor/editmode/autoEditNewBranch",actionSettingsAutoEditNewBranch->isOn() ); +settings.setValue( "/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() ); +settings.setValue( "/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() ); +settings.setValue( "/export/useHideExport",actionSettingsUseHideExport->isOn() ); + +//TODO save scriptEditor settings + +// call the destructors +delete textEditor; +delete historyWindow; +delete branchPropertyWindow; +delete progressBar; + +// Remove temporary directory +removeDir (QDir(tmpVymDir)); } void Main::loadCmdLine() { - /* TODO draw some kind of splashscreen while loading... - if (qApp->argc()>1) - { - } - */ - - QStringList flist=options.getFileList(); - QStringList::Iterator it=flist.begin(); - - while (it !=flist.end() ) - { - fileLoad (*it, NewMap); - *it++; - } +/* TODO draw some kind of splashscreen while loading... +if (qApp->argc()>1) +{ +} +*/ + +QStringList flist=options.getFileList(); +QStringList::Iterator it=flist.begin(); + +while (it !=flist.end() ) +{ + fileLoad (*it, NewMap); + *it++; +} } void Main::statusMessage(const QString &s) { - // Surpress messages while progressbar during - // load is active - if (progressMin==progressMax) - statusBar()->message( s); +// Surpress messages while progressbar during +// load is active +if (progressMin==progressMax) + statusBar()->message( s); } void Main::setProgressMinimum (int min) { - progressBar->setMinimum(min); - progressMin=min; +progressBar->setMinimum(min); +progressMin=min; } void Main::setProgressMaximum (int max) { - progressBar->setMaximum(max); - progressMax=max; - if (max>0) - { - statusBar()->addPermanentWidget(progressBar); - progressBar->show(); - } +progressBar->setMaximum(max); +progressMax=max; +if (max>0) +{ + statusBar()->addPermanentWidget(progressBar); + progressBar->show(); +} } void Main::setProgressValue (int v) { - progressBar->setValue (v); +progressBar->setValue (v); } void Main::removeProgressBar() { - if (progressMax>0) - statusBar()->removeWidget(progressBar); - progressMax=progressMin=0; +if (progressMax>0) + statusBar()->removeWidget(progressBar); +progressMax=progressMin=0; } void Main::closeEvent (QCloseEvent* ) { - fileExitVYM(); +fileExitVYM(); } // File Actions void Main::setupFileActions() { - QMenu *fileMenu = menuBar()->addMenu ( tr ("&Map") ); - QToolBar *tb = addToolBar( tr ("&Map") ); - tb->setObjectName ("mapTB"); - - QAction *a; - 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 - a->addTo( tb ); - fileMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( fileNew() ) ); - - 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 - fileMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( fileNewCopy() ) ); - actionFileNewCopy=a; - - 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 - a->addTo( tb ); - fileMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( fileLoad() ) ); - - fileLastMapsMenu = fileMenu->addMenu (tr("Open Recent","File menu")); - fileMenu->addSeparator(); - - 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 - a->addTo( tb ); - fileMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( fileSave() ) ); - actionFileSave=a; - - a = new QAction( QPixmap(iconPath+"filesaveas.png"), tr( "Save &As...","File menu" ), this); - a->setStatusTip (tr( "Save &As","Status tip file menu" ) ); - fileMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( fileSaveAs() ) ); - - fileMenu->addSeparator(); - - fileImportMenu = fileMenu->addMenu (tr("Import","File menu")); - - a = new QAction(tr("KDE 3 Bookmarks"), this); - a->setStatusTip ( tr( "Import %1","Status tip file menu" ).arg(tr("KDE 3 bookmarks"))); +QMenu *fileMenu = menuBar()->addMenu ( tr ("&Map") ); +QToolBar *tb = addToolBar( tr ("&Map") ); +tb->setObjectName ("mapTB"); + +QAction *a; +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 +a->addTo( tb ); +fileMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( fileNew() ) ); + +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 +fileMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( fileNewCopy() ) ); +actionFileNewCopy=a; + +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 +a->addTo( tb ); +fileMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( fileLoad() ) ); + +fileLastMapsMenu = fileMenu->addMenu (tr("Open Recent","File menu")); +fileMenu->addSeparator(); + +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 +a->addTo( tb ); +fileMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( fileSave() ) ); +actionFileSave=a; + +a = new QAction( QPixmap(iconPath+"filesaveas.png"), tr( "Save &As...","File menu" ), this); +a->setStatusTip (tr( "Save &As","Status tip file menu" ) ); +fileMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( fileSaveAs() ) ); + +fileMenu->addSeparator(); + +fileImportMenu = fileMenu->addMenu (tr("Import","File menu")); + +a = new QAction(tr("KDE 3 Bookmarks"), this); +a->setStatusTip ( tr( "Import %1","Status tip file menu" ).arg(tr("KDE 3 bookmarks"))); +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); +connect( a, SIGNAL( triggered() ), this, SLOT( fileImportKDE4Bookmarks() ) ); + +if (settings.value( "/mainwindow/showTestMenu",false).toBool()) +{ + 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); - 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); - connect( a, SIGNAL( triggered() ), this, SLOT( fileImportKDE4Bookmarks() ) ); - - if (settings.value( "/mainwindow/showTestMenu",false).toBool()) - { - 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); - connect( a, SIGNAL( triggered() ), this, SLOT( fileImportFirefoxBookmarks() ) ); - } - - a = new QAction("Freemind...",this); - a->setStatusTip ( tr( "Import %1","status tip file menu").arg(" Freemind") ); - 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") ); - 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" ) ); - fileImportMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( fileImportDir() ) ); - - fileExportMenu = fileMenu->addMenu (tr("Export","File menu")); - - a = new QAction( tr("Image%1","File export menu").arg("..."), this); - a->setStatusTip( tr( "Export map as image","status tip file menu" )); - 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" )); - connect( a, SIGNAL( triggered() ), this, SLOT( fileExportOOPresentation() ) ); - fileExportMenu->addAction (a); - - a = new QAction( "Webpage (XHTML)...",this ); - a->setShortcut (Qt::ALT + Qt::Key_X); //Export XHTML - a->setStatusTip ( tr( "Export as %1","status tip file menu").arg(tr(" webpage (XHTML)","status tip file menu"))); - connect( a, SIGNAL( triggered() ), this, SLOT( fileExportXHTML() ) ); - fileExportMenu->addAction (a); - - a = new QAction( "Text (ASCII)...", this); - a->setStatusTip ( tr( "Export as %1").arg("ASCII "+tr("(still experimental)" ))); - 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)" ))); - 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" ))); - 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" ))); - 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)" ))); - 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)" ))); - connect( a, SIGNAL( triggered() ), this, SLOT( fileExportLaTeX() ) ); - fileExportMenu->addAction (a); - - a = new QAction( "XML..." , this ); - a->setStatusTip (tr( "Export as %1").arg("XML")); - connect( a, SIGNAL( triggered() ), this, SLOT( fileExportXML() ) ); - fileExportMenu->addAction (a); - - fileMenu->addSeparator(); - - a = new QAction(QPixmap( iconPath+"fileprint.png"), tr( "&Print")+QString("..."), this); - a->setStatusTip ( tr( "Print" ,"File menu") ); - a->setShortcut (Qt::CTRL + Qt::Key_P ); //Print map - a->addTo( tb ); - fileMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( filePrint() ) ); - actionFilePrint=a; - - 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 - 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 - fileMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( fileExitVYM() ) ); + connect( a, SIGNAL( triggered() ), this, SLOT( fileImportFirefoxBookmarks() ) ); +} + +a = new QAction("Freemind...",this); +a->setStatusTip ( tr( "Import %1","status tip file menu").arg(" Freemind") ); +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") ); +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" ) ); +fileImportMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( fileImportDir() ) ); + +fileExportMenu = fileMenu->addMenu (tr("Export","File menu")); + +a = new QAction( tr("Image%1","File export menu").arg("..."), this); +a->setStatusTip( tr( "Export map as image","status tip file menu" )); +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" )); +connect( a, SIGNAL( triggered() ), this, SLOT( fileExportOOPresentation() ) ); +fileExportMenu->addAction (a); + +a = new QAction( "Webpage (XHTML)...",this ); +a->setShortcut (Qt::ALT + Qt::Key_X); //Export XHTML +a->setStatusTip ( tr( "Export as %1","status tip file menu").arg(tr(" webpage (XHTML)","status tip file menu"))); +connect( a, SIGNAL( triggered() ), this, SLOT( fileExportXHTML() ) ); +fileExportMenu->addAction (a); + +a = new QAction( "Text (A&O report)...", this); +a->setStatusTip ( tr( "Export as %1").arg("A&O report "+tr("(still experimental)" ))); +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)" ))); +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)" ))); +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" ))); +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" ))); +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)" ))); +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)" ))); +connect( a, SIGNAL( triggered() ), this, SLOT( fileExportLaTeX() ) ); +fileExportMenu->addAction (a); + +a = new QAction( "XML..." , this ); +a->setStatusTip (tr( "Export as %1").arg("XML")); +connect( a, SIGNAL( triggered() ), this, SLOT( fileExportXML() ) ); +fileExportMenu->addAction (a); + +fileMenu->addSeparator(); + +a = new QAction(QPixmap( iconPath+"fileprint.png"), tr( "&Print")+QString("..."), this); +a->setStatusTip ( tr( "Print" ,"File menu") ); +a->setShortcut (Qt::CTRL + Qt::Key_P ); //Print map +a->addTo( tb ); +fileMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( filePrint() ) ); +actionFilePrint=a; + +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 +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 +fileMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( fileExitVYM() ) ); } //Edit Actions void Main::setupEditActions() { - QToolBar *tb = addToolBar( tr ("&Actions toolbar","Toolbar name") ); - tb->setLabel( "Edit Actions" ); - tb->setObjectName ("actionsTB"); - QMenu *editMenu = menuBar()->addMenu( tr("&Edit","Edit menu") ); - - QAction *a; - QAction *alt; - a = new QAction( QPixmap( iconPath+"undo.png"), tr( "&Undo","Edit menu" ),this); - connect( a, SIGNAL( triggered() ), this, SLOT( editUndo() ) ); - a->setStatusTip (tr( "Undo" ) ); - a->setShortcut ( Qt::CTRL + Qt::Key_Z ); //Undo last action - a->setEnabled (false); - tb->addAction (a); - editMenu->addAction (a); - actionUndo=a; - - 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 - tb->addAction (a); - editMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( editRedo() ) ); - actionRedo=a; - - editMenu->addSeparator(); - a = new QAction(QPixmap( iconPath+"editcopy.png"), tr( "&Copy","Edit menu" ), this); - a->setStatusTip ( tr( "Copy" ) ); - a->setShortcut (Qt::CTRL + Qt::Key_C ); //Copy - a->setEnabled (false); - tb->addAction (a); - editMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( editCopy() ) ); - actionCopy=a; - - a = new QAction(QPixmap( iconPath+"editcut.png" ), tr( "Cu&t","Edit menu" ), this); - a->setStatusTip ( tr( "Cut" ) ); - a->setShortcut (Qt::CTRL + Qt::Key_X ); //Cut - a->setEnabled (false); - tb->addAction (a); - editMenu->addAction (a); - actionCut=a; - connect( a, SIGNAL( triggered() ), this, SLOT( editCut() ) ); - - a = new QAction(QPixmap( iconPath+"editpaste.png"), tr( "&Paste","Edit menu" ),this); - connect( a, SIGNAL( triggered() ), this, SLOT( editPaste() ) ); - a->setStatusTip ( tr( "Paste" ) ); - a->setShortcut ( Qt::CTRL + Qt::Key_V ); //Paste - a->setEnabled (false); - tb->addAction (a); - editMenu->addAction (a); - actionPaste=a; - - // Shortcut to delete selection - a = new QAction( tr( "Delete Selection","Edit menu" ),this); - a->setStatusTip (tr( "Delete Selection" )); - a->setShortcut ( Qt::Key_Delete); //Delete selection - a->setShortcutContext (Qt::WindowShortcut); - addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteSelection() ) ); - actionDelete=a; - - // Shortcut to add attribute - a= new QAction(tr( "Add attribute" ), this); - a->setShortcut ( Qt::Key_Q); - a->setShortcutContext (Qt::WindowShortcut); - addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( editAddAttribute() ) ); - actionAddAttribute= a; - - - // Shortcut to add mapcenter - a= new QAction(QPixmap(iconPath+"newmapcenter.png"),tr( "Add mapcenter","Canvas context menu" ), this); - a->setShortcut ( Qt::Key_M); - a->setShortcutContext (Qt::WindowShortcut); - connect( a, SIGNAL( triggered() ), this, SLOT( editAddMapCenter() ) ); - //actionListBranches.append(a); - tb->addAction (a); - actionAddMapCenter = a; - - - // Shortcut to add branch - alt = new QAction(QPixmap(iconPath+"newbranch.png"), tr( "Add branch as child","Edit menu" ), this); - alt->setStatusTip ( tr( "Add a branch as child of selection" )); - alt->setShortcut (Qt::Key_A); //Add branch - alt->setShortcutContext (Qt::WindowShortcut); - 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 - connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranch() ) ); - actionListBranches.append(a); - #if defined (Q_OS_MACX) - // In OSX show different shortcut in menues, the keys work indepently always - actionAddBranch=alt; - #else - actionAddBranch=a; - #endif - editMenu->addAction (actionAddBranch); - tb->addAction (actionAddBranch); - - - // Add branch by inserting it at selection - a = new QAction(tr( "Add branch (insert)","Edit menu" ), this); - 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); - addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBefore() ) ); - a->setEnabled (false); - actionListBranches.append(a); - actionAddBranchBefore=a; - a = new QAction(tr( "Add branch (insert)","Edit menu" ),this); - 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); - addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBefore() ) ); - actionListBranches.append(a); - - // Add branch above - a = new QAction(tr( "Add branch above","Edit menu" ), this); - a->setStatusTip ( tr( "Add a branch above selection" )); - a->setShortcut (Qt::SHIFT+Qt::Key_Insert ); //Add branch above - a->setShortcutContext (Qt::WindowShortcut); - addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchAbove() ) ); - a->setEnabled (false); - actionListBranches.append(a); - actionAddBranchAbove=a; - a = new QAction(tr( "Add branch above","Edit menu" ), this); - a->setStatusTip ( tr( "Add a branch above selection" )); - a->setShortcut (Qt::SHIFT+Qt::Key_A ); //Add branch above - a->setShortcutContext (Qt::WindowShortcut); - addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchAbove() ) ); - actionListBranches.append(a); - - // Add branch below - a = new QAction(tr( "Add branch below","Edit menu" ), this); - a->setStatusTip ( tr( "Add a branch below selection" )); - a->setShortcut (Qt::CTRL +Qt::Key_Insert ); //Add branch below - a->setShortcutContext (Qt::WindowShortcut); - addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBelow() ) ); - a->setEnabled (false); - actionListBranches.append(a); - actionAddBranchBelow=a; - a = new QAction(tr( "Add branch below","Edit menu" ), this); - a->setStatusTip ( tr( "Add a branch below selection" )); - a->setShortcut (Qt::CTRL +Qt::Key_A ); // Add branch below - a->setShortcutContext (Qt::WindowShortcut); - addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBelow() ) ); - actionListBranches.append(a); - - a = new QAction(QPixmap(iconPath+"up.png" ), tr( "Move up","Edit menu" ), this); - a->setStatusTip ( tr( "Move branch up" ) ); - a->setShortcut (Qt::Key_PageUp ); // Move branch up - a->setEnabled (false); - tb->addAction (a); - editMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( editMoveUp() ) ); - actionMoveUp=a; - - a = new QAction( QPixmap( iconPath+"down.png"), tr( "Move down","Edit menu" ),this); - connect( a, SIGNAL( triggered() ), this, SLOT( editMoveDown() ) ); - a->setStatusTip (tr( "Move branch down" ) ); - a->setShortcut ( Qt::Key_PageDown ); // Move branch down - a->setEnabled (false); - tb->addAction (a); - editMenu->addAction (a); - actionMoveDown=a; - - 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 - editMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( editDetach() ) ); - actionDetach=a; - - a = new QAction( QPixmap(iconPath+"editsort.png" ), tr( "Sort children","Edit menu" ), this ); - connect( a, SIGNAL( activated() ), this, SLOT( editSortChildren() ) ); - a->setEnabled (true); - a->addTo( tb ); - editMenu->addAction (a); - actionSortChildren=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" )); - connect( alt, SIGNAL( triggered() ), this, SLOT( editToggleScroll() ) ); - #if defined(Q_OS_MACX) - actionToggleScroll=alt; - #else - actionToggleScroll=a; - #endif - actionToggleScroll->setEnabled (false); - actionToggleScroll->setToggleAction(true); - tb->addAction (actionToggleScroll); - editMenu->addAction ( actionToggleScroll); - editMenu->addAction (actionToggleScroll); - addAction (a); - addAction (alt); - actionListBranches.append(actionToggleScroll); - - 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" )); - connect( a, SIGNAL( triggered() ), this, SLOT( editExpandAll() ) ); - actionExpandAll=a; - actionExpandAll->setEnabled (false); - actionExpandAll->setToggleAction(false); - //tb->addAction (actionExpandAll); - editMenu->addAction ( actionExpandAll); - addAction (a); - actionListBranches.append(actionExpandAll); - - a = new QAction( QPixmap(), tr( "Expand one level","Edit menu" ), this); - a->setShortcut ( Qt::Key_Greater ); // Expand one level in tree editor - a->setStatusTip (tr( "Expand one level in tree editor" )); - connect( a, SIGNAL( triggered() ), this, SLOT( editExpandOneLevel() ) ); - a->setEnabled (false); - a->setToggleAction(false); - actionExpandOneLevel=a; - //tb->addAction (a); - editMenu->addAction ( a); - addAction (a); - actionListBranches.append(a); - - a = new QAction( QPixmap(), tr( "Collapse one level","Edit menu" ), this); - a->setShortcut ( Qt::Key_Less); // Collapse one level in tree editor - a->setStatusTip (tr( "Collapse one level in tree editor" )); - connect( a, SIGNAL( triggered() ), this, SLOT( editCollapseOneLevel() ) ); - a->setEnabled (false); - a->setToggleAction(false); - actionCollapseOneLevel=a; - //tb->addAction (a); - editMenu->addAction ( a); - addAction (a); - actionListBranches.append(a); - - a = new QAction( tr( "Unscroll children","Edit menu" ), this); - a->setStatusTip (tr( "Unscroll all scrolled branches in selected subtree" )); - editMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( editUnscrollChildren() ) ); - - editMenu->addSeparator(); - - a = new QAction( QPixmap(iconPath+"find.png"), tr( "Find...","Edit menu"), this); - a->setStatusTip (tr( "Find" ) ); - a->setShortcut (Qt::CTRL + Qt::Key_F ); //Find - editMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( editOpenFindWindow() ) ); - - editMenu->addSeparator(); - - 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" )); - tb->addAction (a); - addAction(a); - connect( a, SIGNAL( triggered() ), this, SLOT( editOpenURL() ) ); - actionOpenURL=a; - - 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 ); - addAction(a); - connect( a, SIGNAL( triggered() ), this, SLOT( editOpenURLTab() ) ); - actionOpenURLTab=a; - - a = new QAction( tr( "Open all URLs in subtree","Edit menu" ), this); - a->setStatusTip (tr( "Open all URLs in subtree" )); - a->setShortcut ( Qt::CTRL + Qt::Key_U ); - addAction(a); - actionListBranches.append(a); - connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleURLTabs() ) ); - actionOpenMultipleURLTabs=a; - - a = new QAction(QPixmap(), tr( "Edit URL...","Edit menu"), this); - a->setStatusTip ( tr( "Edit URL" ) ); - a->setShortcut ( Qt::Key_U ); - a->setShortcutContext (Qt::WindowShortcut); - actionListBranches.append(a); - addAction(a); - connect( a, SIGNAL( triggered() ), this, SLOT( editURL() ) ); - actionURL=a; - - a = new QAction(QPixmap(), tr( "Edit local URL...","Edit menu"), this); - a->setStatusTip ( tr( "Edit local URL" ) ); - //a->setShortcut (Qt::SHIFT + Qt::Key_U ); - a->setShortcutContext (Qt::WindowShortcut); - actionListBranches.append(a); - addAction(a); - connect( a, SIGNAL( triggered() ), this, SLOT( editLocalURL() ) ); - actionLocalURL=a; - - a = new QAction( tr( "Use heading for URL","Edit menu" ), this); - a->setStatusTip ( tr( "Use heading of selected branch as URL" )); - a->setEnabled (false); - actionListBranches.append(a); - connect( a, SIGNAL( triggered() ), this, SLOT( editHeading2URL() ) ); - actionHeading2URL=a; - - a = new QAction(tr( "Create URL to Novell Bugzilla","Edit menu" ), this); - a->setStatusTip ( tr( "Create URL to Novell Bugzilla" )); - a->setEnabled (false); - actionListBranches.append(a); - a->setShortcut ( Qt::Key_B ); - a->setShortcutContext (Qt::WindowShortcut); - addAction(a); - connect( a, SIGNAL( triggered() ), this, SLOT( editBugzilla2URL() ) ); - actionBugzilla2URL=a; - - a = new QAction(tr( "Create URL to Novell FATE","Edit menu" ), this); - a->setStatusTip ( tr( "Create URL to Novell FATE" )); - a->setEnabled (false); - actionListBranches.append(a); - connect( a, SIGNAL( triggered() ), this, SLOT( editFATE2URL() ) ); - actionFATE2URL=a; - - a = new QAction(QPixmap(flagsPath+"flag-vymlink.png"), tr( "Open linked map","Edit menu" ), this); - a->setStatusTip ( tr( "Jump to another vym map, if needed load it first" )); - tb->addAction (a); - a->setEnabled (false); - 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); - actionListBranches.append(a); - connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleVymLinks() ) ); - actionOpenMultipleVymLinks=a; - - - a = new QAction(tr( "Edit vym link...","Edit menu" ), this); - a->setEnabled (false); - a->setStatusTip ( tr( "Edit link to another vym map" )); - connect( a, SIGNAL( triggered() ), this, SLOT( editVymLink() ) ); - actionListBranches.append(a); - actionVymLink=a; - - a = new QAction(tr( "Delete vym link","Edit menu" ),this); - a->setStatusTip ( tr( "Delete link to another vym map" )); - a->setEnabled (false); - connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteVymLink() ) ); - actionDeleteVymLink=a; - - a = new QAction(QPixmap(flagsPath+"flag-hideexport.png"), tr( "Hide in exports","Edit menu" ), this); - a->setStatusTip ( tr( "Hide object in exports" ) ); - a->setShortcut (Qt::Key_H ); - a->setToggleAction(true); - tb->addAction (a); - a->setEnabled (false); - connect( a, SIGNAL( triggered() ), this, SLOT( editToggleHideExport() ) ); - actionToggleHideExport=a; - - a = new QAction(tr( "Add timestamp","Edit menu" ), this); - a->setStatusTip ( tr( "Add timestamp" )); - a->setEnabled (false); - actionListBranches.append(a); - a->setShortcut ( Qt::Key_T ); // Add timestamp - a->setShortcutContext (Qt::WindowShortcut); - addAction(a); - connect( a, SIGNAL( triggered() ), this, SLOT( editAddTimestamp() ) ); - actionAddTimestamp=a; - - a = new QAction(tr( "Edit Map Info...","Edit menu" ),this); - a->setStatusTip ( tr( "Edit Map Info" )); - a->setEnabled (true); - connect( a, SIGNAL( triggered() ), this, SLOT( editMapInfo() ) ); - actionMapInfo=a; - - // Import at selection (adding to selection) - a = new QAction( tr( "Add map (insert)","Edit menu" ),this); - a->setStatusTip (tr( "Add map at selection" )); - connect( a, SIGNAL( triggered() ), this, SLOT( editImportAdd() ) ); - a->setEnabled (false); - 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" )); - connect( a, SIGNAL( triggered() ), this, SLOT( editImportReplace() ) ); - a->setEnabled (false); - actionListBranches.append(a); - actionImportReplace=a; - - // Save selection - a = new QAction( tr( "Save selection","Edit menu" ), this); - a->setStatusTip (tr( "Save selection" )); - connect( a, SIGNAL( triggered() ), this, SLOT( editSaveBranch() ) ); - a->setEnabled (false); - actionListBranches.append(a); - actionSaveBranch=a; - - // Only remove branch, not its children - a = new QAction(tr( "Remove only branch ","Edit menu" ), this); - a->setStatusTip ( tr( "Remove only branch and keep its children" )); - a->setShortcut (Qt::ALT + Qt::Key_Delete ); - connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteKeepChildren() ) ); - a->setEnabled (false); - addAction (a); - actionListBranches.append(a); - actionDeleteKeepChildren=a; - - // Only remove children of a branch - a = new QAction( tr( "Remove children","Edit menu" ), this); - a->setStatusTip (tr( "Remove children of branch" )); - a->setShortcut (Qt::SHIFT + Qt::Key_Delete ); - connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteChildren() ) ); - a->setEnabled (false); - actionListBranches.append(a); - actionDeleteChildren=a; - - a = new QAction( tr( "Add Image...","Edit menu" ), this); - a->setStatusTip (tr( "Add Image" )); - connect( a, SIGNAL( triggered() ), this, SLOT( editLoadImage() ) ); - actionLoadImage=a; - - a = new QAction( tr( "Property window","Dialog to edit properties of selection" )+QString ("..."), this); - a->setStatusTip (tr( "Set properties for selection" )); - a->setShortcut ( Qt::CTRL + Qt::Key_I ); //Property window - a->setShortcutContext (Qt::WindowShortcut); - a->setToggleAction (true); - addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( windowToggleProperty() ) ); - actionViewTogglePropertyWindow=a; +QToolBar *tb = addToolBar( tr ("&Actions toolbar","Toolbar name") ); +tb->setLabel( "Edit Actions" ); +tb->setObjectName ("actionsTB"); +QMenu *editMenu = menuBar()->addMenu( tr("&Edit","Edit menu") ); + +QAction *a; +QAction *alt; +a = new QAction( QPixmap( iconPath+"undo.png"), tr( "&Undo","Edit menu" ),this); +connect( a, SIGNAL( triggered() ), this, SLOT( editUndo() ) ); +a->setStatusTip (tr( "Undo" ) ); +a->setShortcut ( Qt::CTRL + Qt::Key_Z ); //Undo last action +a->setEnabled (false); +tb->addAction (a); +editMenu->addAction (a); +actionUndo=a; + +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 +tb->addAction (a); +editMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( editRedo() ) ); +actionRedo=a; + +editMenu->addSeparator(); +a = new QAction(QPixmap( iconPath+"editcopy.png"), tr( "&Copy","Edit menu" ), this); +a->setStatusTip ( tr( "Copy" ) ); +a->setShortcut (Qt::CTRL + Qt::Key_C ); //Copy +a->setEnabled (false); +tb->addAction (a); +editMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( editCopy() ) ); +actionCopy=a; + +a = new QAction(QPixmap( iconPath+"editcut.png" ), tr( "Cu&t","Edit menu" ), this); +a->setStatusTip ( tr( "Cut" ) ); +a->setShortcut (Qt::CTRL + Qt::Key_X ); //Cut +a->setEnabled (false); +tb->addAction (a); +editMenu->addAction (a); +actionCut=a; +connect( a, SIGNAL( triggered() ), this, SLOT( editCut() ) ); + +a = new QAction(QPixmap( iconPath+"editpaste.png"), tr( "&Paste","Edit menu" ),this); +connect( a, SIGNAL( triggered() ), this, SLOT( editPaste() ) ); +a->setStatusTip ( tr( "Paste" ) ); +a->setShortcut ( Qt::CTRL + Qt::Key_V ); //Paste +a->setEnabled (false); +tb->addAction (a); +editMenu->addAction (a); +actionPaste=a; + +// Shortcut to delete selection +a = new QAction( tr( "Delete Selection","Edit menu" ),this); +a->setStatusTip (tr( "Delete Selection" )); +a->setShortcut ( Qt::Key_Delete); //Delete selection +a->setShortcutContext (Qt::WindowShortcut); +addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteSelection() ) ); +actionDelete=a; + +// Shortcut to add attribute +a= new QAction(tr( "Add attribute" ), this); +a->setShortcut ( Qt::Key_Q); +a->setShortcutContext (Qt::WindowShortcut); +addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( editAddAttribute() ) ); +actionAddAttribute= a; + + +// Shortcut to add mapcenter +a= new QAction(QPixmap(iconPath+"newmapcenter.png"),tr( "Add mapcenter","Canvas context menu" ), this); +a->setShortcut ( Qt::Key_M); +a->setShortcutContext (Qt::WindowShortcut); +connect( a, SIGNAL( triggered() ), this, SLOT( editAddMapCenter() ) ); +//actionListBranches.append(a); +tb->addAction (a); +actionAddMapCenter = a; + + +// Shortcut to add branch +alt = new QAction(QPixmap(iconPath+"newbranch.png"), tr( "Add branch as child","Edit menu" ), this); +alt->setStatusTip ( tr( "Add a branch as child of selection" )); +alt->setShortcut (Qt::Key_A); //Add branch +alt->setShortcutContext (Qt::WindowShortcut); +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 +connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranch() ) ); +actionListBranches.append(a); +#if defined (Q_OS_MACX) + // In OSX show different shortcut in menues, the keys work indepently always + actionAddBranch=alt; +#else + actionAddBranch=a; +#endif +editMenu->addAction (actionAddBranch); +tb->addAction (actionAddBranch); + + +// Add branch by inserting it at selection +a = new QAction(tr( "Add branch (insert)","Edit menu" ), this); +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); +addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBefore() ) ); +a->setEnabled (false); +actionListBranches.append(a); +actionAddBranchBefore=a; +a = new QAction(tr( "Add branch (insert)","Edit menu" ),this); +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); +addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBefore() ) ); +actionListBranches.append(a); + +// Add branch above +a = new QAction(tr( "Add branch above","Edit menu" ), this); +a->setStatusTip ( tr( "Add a branch above selection" )); +a->setShortcut (Qt::SHIFT+Qt::Key_Insert ); //Add branch above +a->setShortcutContext (Qt::WindowShortcut); +addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchAbove() ) ); +a->setEnabled (false); +actionListBranches.append(a); +actionAddBranchAbove=a; +a = new QAction(tr( "Add branch above","Edit menu" ), this); +a->setStatusTip ( tr( "Add a branch above selection" )); +a->setShortcut (Qt::SHIFT+Qt::Key_A ); //Add branch above +a->setShortcutContext (Qt::WindowShortcut); +addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchAbove() ) ); +actionListBranches.append(a); + +// Add branch below +a = new QAction(tr( "Add branch below","Edit menu" ), this); +a->setStatusTip ( tr( "Add a branch below selection" )); +a->setShortcut (Qt::CTRL +Qt::Key_Insert ); //Add branch below +a->setShortcutContext (Qt::WindowShortcut); +addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBelow() ) ); +a->setEnabled (false); +actionListBranches.append(a); +actionAddBranchBelow=a; +a = new QAction(tr( "Add branch below","Edit menu" ), this); +a->setStatusTip ( tr( "Add a branch below selection" )); +a->setShortcut (Qt::CTRL +Qt::Key_A ); // Add branch below +a->setShortcutContext (Qt::WindowShortcut); +addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBelow() ) ); +actionListBranches.append(a); + +a = new QAction(QPixmap(iconPath+"up.png" ), tr( "Move up","Edit menu" ), this); +a->setStatusTip ( tr( "Move branch up" ) ); +a->setShortcut (Qt::Key_PageUp ); // Move branch up +a->setEnabled (false); +tb->addAction (a); +editMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( editMoveUp() ) ); +actionMoveUp=a; + +a = new QAction( QPixmap( iconPath+"down.png"), tr( "Move down","Edit menu" ),this); +connect( a, SIGNAL( triggered() ), this, SLOT( editMoveDown() ) ); +a->setStatusTip (tr( "Move branch down" ) ); +a->setShortcut ( Qt::Key_PageDown ); // Move branch down +a->setEnabled (false); +tb->addAction (a); +editMenu->addAction (a); +actionMoveDown=a; + +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 +editMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( editDetach() ) ); +actionDetach=a; + +a = new QAction( QPixmap(iconPath+"editsort.png" ), tr( "Sort children","Edit menu" ), this ); +connect( a, SIGNAL( activated() ), this, SLOT( editSortChildren() ) ); +a->setEnabled (true); +a->addTo( tb ); +editMenu->addAction (a); +actionSortChildren=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" )); +connect( alt, SIGNAL( triggered() ), this, SLOT( editToggleScroll() ) ); +#if defined(Q_OS_MACX) + actionToggleScroll=alt; +#else + actionToggleScroll=a; +#endif +actionToggleScroll->setEnabled (false); +actionToggleScroll->setToggleAction(true); +tb->addAction (actionToggleScroll); +editMenu->addAction ( actionToggleScroll); +editMenu->addAction (actionToggleScroll); +addAction (a); +addAction (alt); +actionListBranches.append(actionToggleScroll); + +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" )); +connect( a, SIGNAL( triggered() ), this, SLOT( editExpandAll() ) ); +actionExpandAll=a; +actionExpandAll->setEnabled (false); +actionExpandAll->setToggleAction(false); +//tb->addAction (actionExpandAll); +editMenu->addAction ( actionExpandAll); +addAction (a); +actionListBranches.append(actionExpandAll); + +a = new QAction( QPixmap(), tr( "Expand one level","Edit menu" ), this); +a->setShortcut ( Qt::Key_Greater ); // Expand one level in tree editor +a->setStatusTip (tr( "Expand one level in tree editor" )); +connect( a, SIGNAL( triggered() ), this, SLOT( editExpandOneLevel() ) ); +a->setEnabled (false); +a->setToggleAction(false); +actionExpandOneLevel=a; +//tb->addAction (a); +editMenu->addAction ( a); +addAction (a); +actionListBranches.append(a); + +a = new QAction( QPixmap(), tr( "Collapse one level","Edit menu" ), this); +a->setShortcut ( Qt::Key_Less); // Collapse one level in tree editor +a->setStatusTip (tr( "Collapse one level in tree editor" )); +connect( a, SIGNAL( triggered() ), this, SLOT( editCollapseOneLevel() ) ); +a->setEnabled (false); +a->setToggleAction(false); +actionCollapseOneLevel=a; +//tb->addAction (a); +editMenu->addAction ( a); +addAction (a); +actionListBranches.append(a); + +a = new QAction( tr( "Unscroll children","Edit menu" ), this); +a->setStatusTip (tr( "Unscroll all scrolled branches in selected subtree" )); +editMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( editUnscrollChildren() ) ); + +editMenu->addSeparator(); + +a = new QAction( QPixmap(iconPath+"find.png"), tr( "Find...","Edit menu"), this); +a->setStatusTip (tr( "Find" ) ); +a->setShortcut (Qt::CTRL + Qt::Key_F ); //Find +editMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( editOpenFindWindow() ) ); + +editMenu->addSeparator(); + +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" )); +tb->addAction (a); +addAction(a); +connect( a, SIGNAL( triggered() ), this, SLOT( editOpenURL() ) ); +actionOpenURL=a; + +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 ); +addAction(a); +connect( a, SIGNAL( triggered() ), this, SLOT( editOpenURLTab() ) ); +actionOpenURLTab=a; + +a = new QAction( tr( "Open all URLs in subtree","Edit menu" ), this); +a->setStatusTip (tr( "Open all URLs in subtree" )); +a->setShortcut ( Qt::CTRL + Qt::Key_U ); +addAction(a); +actionListBranches.append(a); +connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleURLTabs() ) ); +actionOpenMultipleURLTabs=a; + +a = new QAction(QPixmap(), tr( "Edit URL...","Edit menu"), this); +a->setStatusTip ( tr( "Edit URL" ) ); +a->setShortcut ( Qt::Key_U ); +a->setShortcutContext (Qt::WindowShortcut); +actionListBranches.append(a); +addAction(a); +connect( a, SIGNAL( triggered() ), this, SLOT( editURL() ) ); +actionURL=a; + +a = new QAction(QPixmap(), tr( "Edit local URL...","Edit menu"), this); +a->setStatusTip ( tr( "Edit local URL" ) ); +//a->setShortcut (Qt::SHIFT + Qt::Key_U ); +a->setShortcutContext (Qt::WindowShortcut); +actionListBranches.append(a); +addAction(a); +connect( a, SIGNAL( triggered() ), this, SLOT( editLocalURL() ) ); +actionLocalURL=a; + +a = new QAction( tr( "Use heading for URL","Edit menu" ), this); +a->setStatusTip ( tr( "Use heading of selected branch as URL" )); +a->setEnabled (false); +actionListBranches.append(a); +connect( a, SIGNAL( triggered() ), this, SLOT( editHeading2URL() ) ); +actionHeading2URL=a; + +a = new QAction(tr( "Create URL to Novell Bugzilla","Edit menu" ), this); +a->setStatusTip ( tr( "Create URL to Novell Bugzilla" )); +a->setEnabled (false); +actionListBranches.append(a); +a->setShortcut ( Qt::Key_B ); +a->setShortcutContext (Qt::WindowShortcut); +addAction(a); +connect( a, SIGNAL( triggered() ), this, SLOT( editBugzilla2URL() ) ); +actionBugzilla2URL=a; + +a = new QAction(tr( "Create URL to Novell FATE","Edit menu" ), this); +a->setStatusTip ( tr( "Create URL to Novell FATE" )); +a->setEnabled (false); +actionListBranches.append(a); +connect( a, SIGNAL( triggered() ), this, SLOT( editFATE2URL() ) ); +actionFATE2URL=a; + +a = new QAction(QPixmap(flagsPath+"flag-vymlink.png"), tr( "Open linked map","Edit menu" ), this); +a->setStatusTip ( tr( "Jump to another vym map, if needed load it first" )); +tb->addAction (a); +a->setEnabled (false); +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); +actionListBranches.append(a); +connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleVymLinks() ) ); +actionOpenMultipleVymLinks=a; + + +a = new QAction(tr( "Edit vym link...","Edit menu" ), this); +a->setEnabled (false); +a->setStatusTip ( tr( "Edit link to another vym map" )); +connect( a, SIGNAL( triggered() ), this, SLOT( editVymLink() ) ); +actionListBranches.append(a); +actionVymLink=a; + +a = new QAction(tr( "Delete vym link","Edit menu" ),this); +a->setStatusTip ( tr( "Delete link to another vym map" )); +a->setEnabled (false); +connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteVymLink() ) ); +actionDeleteVymLink=a; + +a = new QAction(QPixmap(flagsPath+"flag-hideexport.png"), tr( "Hide in exports","Edit menu" ), this); +a->setStatusTip ( tr( "Hide object in exports" ) ); +a->setShortcut (Qt::Key_H ); +a->setToggleAction(true); +tb->addAction (a); +a->setEnabled (false); +connect( a, SIGNAL( triggered() ), this, SLOT( editToggleHideExport() ) ); +actionToggleHideExport=a; + +a = new QAction(tr( "Add timestamp","Edit menu" ), this); +a->setStatusTip ( tr( "Add timestamp" )); +a->setEnabled (false); +actionListBranches.append(a); +a->setShortcut ( Qt::Key_T ); // Add timestamp +a->setShortcutContext (Qt::WindowShortcut); +addAction(a); +connect( a, SIGNAL( triggered() ), this, SLOT( editAddTimestamp() ) ); +actionAddTimestamp=a; + +a = new QAction(tr( "Edit Map Info...","Edit menu" ),this); +a->setStatusTip ( tr( "Edit Map Info" )); +a->setEnabled (true); +connect( a, SIGNAL( triggered() ), this, SLOT( editMapInfo() ) ); +actionMapInfo=a; + +// Import at selection (adding to selection) +a = new QAction( tr( "Add map (insert)","Edit menu" ),this); +a->setStatusTip (tr( "Add map at selection" )); +connect( a, SIGNAL( triggered() ), this, SLOT( editImportAdd() ) ); +a->setEnabled (false); +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" )); +connect( a, SIGNAL( triggered() ), this, SLOT( editImportReplace() ) ); +a->setEnabled (false); +actionListBranches.append(a); +actionImportReplace=a; + +// Save selection +a = new QAction( tr( "Save selection","Edit menu" ), this); +a->setStatusTip (tr( "Save selection" )); +connect( a, SIGNAL( triggered() ), this, SLOT( editSaveBranch() ) ); +a->setEnabled (false); +actionListBranches.append(a); +actionSaveBranch=a; + +// Only remove branch, not its children +a = new QAction(tr( "Remove only branch ","Edit menu" ), this); +a->setStatusTip ( tr( "Remove only branch and keep its children" )); +a->setShortcut (Qt::ALT + Qt::Key_Delete ); +connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteKeepChildren() ) ); +a->setEnabled (false); +addAction (a); +actionListBranches.append(a); +actionDeleteKeepChildren=a; + +// Only remove children of a branch +a = new QAction( tr( "Remove children","Edit menu" ), this); +a->setStatusTip (tr( "Remove children of branch" )); +a->setShortcut (Qt::SHIFT + Qt::Key_Delete ); +connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteChildren() ) ); +a->setEnabled (false); +actionListBranches.append(a); +actionDeleteChildren=a; + +a = new QAction( tr( "Add Image...","Edit menu" ), this); +a->setStatusTip (tr( "Add Image" )); +connect( a, SIGNAL( triggered() ), this, SLOT( editLoadImage() ) ); +actionLoadImage=a; + +a = new QAction( tr( "Property window","Dialog to edit properties of selection" )+QString ("..."), this); +a->setStatusTip (tr( "Set properties for selection" )); +a->setShortcut ( Qt::CTRL + Qt::Key_I ); //Property window +a->setShortcutContext (Qt::WindowShortcut); +a->setToggleAction (true); +addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( windowToggleProperty() ) ); +actionViewTogglePropertyWindow=a; } // Format Actions void Main::setupFormatActions() { - QMenu *formatMenu = menuBar()->addMenu (tr ("F&ormat","Format menu")); - - QToolBar *tb = addToolBar( tr("Format Actions","Format Toolbar name")); - tb->setObjectName ("formatTB"); - QAction *a; - QPixmap pix( 16,16); - pix.fill (Qt::black); - a= new QAction(pix, tr( "Set &Color" )+QString("..."), this); - a->setStatusTip ( tr( "Set Color" )); - connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectColor() ) ); - a->addTo( tb ); - formatMenu->addAction (a); - actionFormatColor=a; - a= new QAction( QPixmap(iconPath+"formatcolorpicker.png"), tr( "Pic&k color","Edit menu" ), this); - a->setStatusTip (tr( "Pick color\nHint: You can pick a color from another branch and color using CTRL+Left Button" ) ); - a->setShortcut (Qt::CTRL + Qt::Key_K ); - connect( a, SIGNAL( triggered() ), this, SLOT( formatPickColor() ) ); - a->setEnabled (false); - a->addTo( tb ); - formatMenu->addAction (a); - actionListBranches.append(a); - actionFormatPickColor=a; - - a= new QAction(QPixmap(iconPath+"formatcolorbranch.png"), tr( "Color &branch","Edit menu" ), this); - a->setStatusTip ( tr( "Color branch" ) ); - a->setShortcut (Qt::CTRL + Qt::Key_B); - connect( a, SIGNAL( triggered() ), this, SLOT( formatColorBranch() ) ); - a->setEnabled (false); - a->addTo( tb ); - formatMenu->addAction (a); - actionListBranches.append(a); - actionFormatColorSubtree=a; - - a= new QAction(QPixmap(iconPath+"formatcolorsubtree.png"), tr( "Color sub&tree","Edit menu" ), this); - a->setStatusTip ( tr( "Color Subtree" )); - //FIXME-2 switch back to that a->setShortcut (Qt::CTRL + Qt::Key_T); // Color subtree - connect( a, SIGNAL( triggered() ), this, SLOT( formatColorSubtree() ) ); - a->setEnabled (false); - formatMenu->addAction (a); - a->addTo( tb ); - actionListBranches.append(a); - actionFormatColorSubtree=a; - - formatMenu->addSeparator(); - actionGroupFormatLinkStyles=new QActionGroup ( this); - actionGroupFormatLinkStyles->setExclusive (true); - a= new QAction( tr( "Linkstyle Line" ), actionGroupFormatLinkStyles); - a->setStatusTip (tr( "Line" )); - a->setToggleAction(true); - connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStyleLine() ) ); - formatMenu->addAction (a); - actionFormatLinkStyleLine=a; - a= new QAction( tr( "Linkstyle Curve" ), actionGroupFormatLinkStyles); - a->setStatusTip (tr( "Line" )); - a->setToggleAction(true); - connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStyleParabel() ) ); - formatMenu->addAction (a); - actionFormatLinkStyleParabel=a; - a= new QAction( tr( "Linkstyle Thick Line" ), actionGroupFormatLinkStyles ); - a->setStatusTip (tr( "PolyLine" )); - a->setToggleAction(true); - connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStylePolyLine() ) ); - formatMenu->addAction (a); - actionFormatLinkStylePolyLine=a; - a= new QAction( tr( "Linkstyle Thick Curve" ), actionGroupFormatLinkStyles); - a->setStatusTip (tr( "PolyParabel" ) ); - a->setToggleAction(true); - a->setChecked (true); - connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStylePolyParabel() ) ); - formatMenu->addAction (a); - actionFormatLinkStylePolyParabel=a; - - a = new QAction( tr( "Hide link if object is not selected","Branch attribute" ), this); - a->setStatusTip (tr( "Hide link" )); - a->setToggleAction(true); - connect( a, SIGNAL( triggered() ), this, SLOT( formatHideLinkUnselected() ) ); - actionFormatHideLinkUnselected=a; - - formatMenu->addSeparator(); - a= new QAction( tr( "&Use color of heading for link","Branch attribute" ), this); - a->setStatusTip (tr( "Use same color for links and headings" )); - a->setToggleAction(true); - connect( a, SIGNAL( triggered() ), this, SLOT( formatToggleLinkColorHint() ) ); - formatMenu->addAction (a); - actionFormatLinkColorHint=a; - - pix.fill (Qt::white); - a= new QAction( pix, tr( "Set &Link Color"+QString("...") ), this ); - a->setStatusTip (tr( "Set Link Color" )); - formatMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectLinkColor() ) ); - actionFormatLinkColor=a; - - a= new QAction( pix, tr( "Set &Selection Color"+QString("...") ), this ); - a->setStatusTip (tr( "Set Selection Color" )); - formatMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectSelectionColor() ) ); - actionFormatSelectionColor=a; - - a= new QAction( pix, tr( "Set &Background Color" )+QString("..."), this ); - a->setStatusTip (tr( "Set Background Color" )); - formatMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectBackColor() ) ); - actionFormatBackColor=a; - - a= new QAction( pix, tr( "Set &Background image" )+QString("..."), this ); - a->setStatusTip (tr( "Set Background image" )); - formatMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectBackImage() ) ); - actionFormatBackImage=a; +QMenu *formatMenu = menuBar()->addMenu (tr ("F&ormat","Format menu")); + +QToolBar *tb = addToolBar( tr("Format Actions","Format Toolbar name")); +tb->setObjectName ("formatTB"); +QAction *a; +QPixmap pix( 16,16); +pix.fill (Qt::black); +a= new QAction(pix, tr( "Set &Color" )+QString("..."), this); +a->setStatusTip ( tr( "Set Color" )); +connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectColor() ) ); +a->addTo( tb ); +formatMenu->addAction (a); +actionFormatColor=a; +a= new QAction( QPixmap(iconPath+"formatcolorpicker.png"), tr( "Pic&k color","Edit menu" ), this); +a->setStatusTip (tr( "Pick color\nHint: You can pick a color from another branch and color using CTRL+Left Button" ) ); +a->setShortcut (Qt::CTRL + Qt::Key_K ); +connect( a, SIGNAL( triggered() ), this, SLOT( formatPickColor() ) ); +a->setEnabled (false); +a->addTo( tb ); +formatMenu->addAction (a); +actionListBranches.append(a); +actionFormatPickColor=a; + +a= new QAction(QPixmap(iconPath+"formatcolorbranch.png"), tr( "Color &branch","Edit menu" ), this); +a->setStatusTip ( tr( "Color branch" ) ); +a->setShortcut (Qt::CTRL + Qt::Key_B); +connect( a, SIGNAL( triggered() ), this, SLOT( formatColorBranch() ) ); +a->setEnabled (false); +a->addTo( tb ); +formatMenu->addAction (a); +actionListBranches.append(a); +actionFormatColorSubtree=a; + +a= new QAction(QPixmap(iconPath+"formatcolorsubtree.png"), tr( "Color sub&tree","Edit menu" ), this); +a->setStatusTip ( tr( "Color Subtree" )); +//FIXME-2 switch back to that a->setShortcut (Qt::CTRL + Qt::Key_T); // Color subtree +connect( a, SIGNAL( triggered() ), this, SLOT( formatColorSubtree() ) ); +a->setEnabled (false); +formatMenu->addAction (a); +a->addTo( tb ); +actionListBranches.append(a); +actionFormatColorSubtree=a; + +formatMenu->addSeparator(); +actionGroupFormatLinkStyles=new QActionGroup ( this); +actionGroupFormatLinkStyles->setExclusive (true); +a= new QAction( tr( "Linkstyle Line" ), actionGroupFormatLinkStyles); +a->setStatusTip (tr( "Line" )); +a->setToggleAction(true); +connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStyleLine() ) ); +formatMenu->addAction (a); +actionFormatLinkStyleLine=a; +a= new QAction( tr( "Linkstyle Curve" ), actionGroupFormatLinkStyles); +a->setStatusTip (tr( "Line" )); +a->setToggleAction(true); +connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStyleParabel() ) ); +formatMenu->addAction (a); +actionFormatLinkStyleParabel=a; +a= new QAction( tr( "Linkstyle Thick Line" ), actionGroupFormatLinkStyles ); +a->setStatusTip (tr( "PolyLine" )); +a->setToggleAction(true); +connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStylePolyLine() ) ); +formatMenu->addAction (a); +actionFormatLinkStylePolyLine=a; +a= new QAction( tr( "Linkstyle Thick Curve" ), actionGroupFormatLinkStyles); +a->setStatusTip (tr( "PolyParabel" ) ); +a->setToggleAction(true); +a->setChecked (true); +connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStylePolyParabel() ) ); +formatMenu->addAction (a); +actionFormatLinkStylePolyParabel=a; + +a = new QAction( tr( "Hide link if object is not selected","Branch attribute" ), this); +a->setStatusTip (tr( "Hide link" )); +a->setToggleAction(true); +connect( a, SIGNAL( triggered() ), this, SLOT( formatHideLinkUnselected() ) ); +actionFormatHideLinkUnselected=a; + +formatMenu->addSeparator(); +a= new QAction( tr( "&Use color of heading for link","Branch attribute" ), this); +a->setStatusTip (tr( "Use same color for links and headings" )); +a->setToggleAction(true); +connect( a, SIGNAL( triggered() ), this, SLOT( formatToggleLinkColorHint() ) ); +formatMenu->addAction (a); +actionFormatLinkColorHint=a; + +pix.fill (Qt::white); +a= new QAction( pix, tr( "Set &Link Color"+QString("...") ), this ); +a->setStatusTip (tr( "Set Link Color" )); +formatMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectLinkColor() ) ); +actionFormatLinkColor=a; + +a= new QAction( pix, tr( "Set &Selection Color"+QString("...") ), this ); +a->setStatusTip (tr( "Set Selection Color" )); +formatMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectSelectionColor() ) ); +actionFormatSelectionColor=a; + +a= new QAction( pix, tr( "Set &Background Color" )+QString("..."), this ); +a->setStatusTip (tr( "Set Background Color" )); +formatMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectBackColor() ) ); +actionFormatBackColor=a; + +a= new QAction( pix, tr( "Set &Background image" )+QString("..."), this ); +a->setStatusTip (tr( "Set Background image" )); +formatMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectBackImage() ) ); +actionFormatBackImage=a; } // View Actions void Main::setupViewActions() { - QToolBar *tb = addToolBar( tr("View Actions","View Toolbar name") ); - tb->setLabel( "View Actions" ); - tb->setObjectName ("viewTB"); - QMenu *viewMenu = menuBar()->addMenu ( tr( "&View" )); - - Switchboard switchboard; //FIXME-1 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"); - 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->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->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->addTo( tb ); - viewMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( viewCenter() ) ); - - viewMenu->addSeparator(); - - 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 - a->setToggleAction(true); - a->addTo( tb ); - viewMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleNoteEditor() ) ); - actionViewToggleNoteEditor=a; - - 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 - a->setToggleAction(true); - a->addTo( tb ); - viewMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleHistory() ) ); - actionViewToggleHistoryWindow=a; - - viewMenu->addAction (actionViewTogglePropertyWindow); - - viewMenu->addSeparator(); - - a = new QAction(tr( "Antialiasing","View action" ),this ); - a->setStatusTip ( tr( "Antialiasing" )); - a->setToggleAction(true); - a->setChecked (settings.value("/mainwindow/view/AntiAlias",true).toBool()); - viewMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleAntiAlias() ) ); - actionViewToggleAntiAlias=a; - - a = new QAction(tr( "Smooth pixmap transformations","View action" ),this ); - a->setStatusTip (a->text()); - a->setToggleAction(true); - a->setChecked (settings.value("/mainwindow/view/SmoothPixmapTransformation",true).toBool()); - viewMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleSmoothPixmap() ) ); - actionViewToggleSmoothPixmapTransform=a; - - a = new QAction(tr( "Next Map","View action" ), this); - a->setStatusTip (a->text()); - a->setShortcut (Qt::ALT + Qt::Key_N ); - 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 ); - viewMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT(windowPreviousEditor() ) ); - - switchboard.print(); +QToolBar *tb = addToolBar( tr("View Actions","View Toolbar name") ); +tb->setLabel( "View Actions" ); +tb->setObjectName ("viewTB"); +QMenu *viewMenu = menuBar()->addMenu ( tr( "&View" )); + +Switchboard switchboard; //FIXME-1 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"); +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->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->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->addTo( tb ); +viewMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( viewCenter() ) ); + +viewMenu->addSeparator(); + +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 +a->setToggleAction(true); +a->addTo( tb ); +viewMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleNoteEditor() ) ); +actionViewToggleNoteEditor=a; + +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 +a->setToggleAction(true); +a->addTo( tb ); +viewMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleHistory() ) ); +actionViewToggleHistoryWindow=a; + +viewMenu->addAction (actionViewTogglePropertyWindow); + +viewMenu->addSeparator(); + +a = new QAction(tr( "Antialiasing","View action" ),this ); +a->setStatusTip ( tr( "Antialiasing" )); +a->setToggleAction(true); +a->setChecked (settings.value("/mainwindow/view/AntiAlias",true).toBool()); +viewMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleAntiAlias() ) ); +actionViewToggleAntiAlias=a; + +a = new QAction(tr( "Smooth pixmap transformations","View action" ),this ); +a->setStatusTip (a->text()); +a->setToggleAction(true); +a->setChecked (settings.value("/mainwindow/view/SmoothPixmapTransformation",true).toBool()); +viewMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleSmoothPixmap() ) ); +actionViewToggleSmoothPixmapTransform=a; + +a = new QAction(tr( "Next Map","View action" ), this); +a->setStatusTip (a->text()); +a->setShortcut (Qt::ALT + Qt::Key_N ); +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 ); +viewMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT(windowPreviousEditor() ) ); + +switchboard.print(); } // Mode Actions void Main::setupModeActions() { - //QPopupMenu *menu = new QPopupMenu( this ); - //menuBar()->insertItem( tr( "&Mode (using modifiers)" ), menu ); - - QToolBar *tb = addToolBar( tr ("Modes when using modifiers","Modifier Toolbar name") ); - tb->setObjectName ("modesTB"); - QAction *a; - actionGroupModModes=new QActionGroup ( this); - actionGroupModModes->setExclusive (true); - a= new QAction( QPixmap(iconPath+"modecolor.png"), tr( "Use modifier to color branches","Mode modifier" ), actionGroupModModes); - a->setShortcut (Qt::Key_J); - a->setStatusTip ( tr( "Use modifier to color branches" )); - a->setToggleAction(true); - a->addTo (tb); - a->setChecked(true); - actionModModeColor=a; - - a= new QAction( QPixmap(iconPath+"modecopy.png"), tr( "Use modifier to copy","Mode modifier" ), actionGroupModModes ); - a->setShortcut( Qt::Key_K); - a->setStatusTip( tr( "Use modifier to copy" )); - a->setToggleAction(true); - a->addTo (tb); - actionModModeCopy=a; - - a= new QAction(QPixmap(iconPath+"modelink.png"), tr( "Use modifier to draw xLinks","Mode modifier" ), actionGroupModModes ); - a->setShortcut (Qt::Key_L); - a->setStatusTip( tr( "Use modifier to draw xLinks" )); - a->setToggleAction(true); - a->addTo (tb); - actionModModeXLink=a; +//QPopupMenu *menu = new QPopupMenu( this ); +//menuBar()->insertItem( tr( "&Mode (using modifiers)" ), menu ); + +QToolBar *tb = addToolBar( tr ("Modes when using modifiers","Modifier Toolbar name") ); +tb->setObjectName ("modesTB"); +QAction *a; +actionGroupModModes=new QActionGroup ( this); +actionGroupModModes->setExclusive (true); +a= new QAction( QPixmap(iconPath+"modecolor.png"), tr( "Use modifier to color branches","Mode modifier" ), actionGroupModModes); +a->setShortcut (Qt::Key_J); +a->setStatusTip ( tr( "Use modifier to color branches" )); +a->setToggleAction(true); +a->addTo (tb); +a->setChecked(true); +actionModModeColor=a; + +a= new QAction( QPixmap(iconPath+"modecopy.png"), tr( "Use modifier to copy","Mode modifier" ), actionGroupModModes ); +a->setShortcut( Qt::Key_K); +a->setStatusTip( tr( "Use modifier to copy" )); +a->setToggleAction(true); +a->addTo (tb); +actionModModeCopy=a; + +a= new QAction(QPixmap(iconPath+"modelink.png"), tr( "Use modifier to draw xLinks","Mode modifier" ), actionGroupModModes ); +a->setShortcut (Qt::Key_L); +a->setStatusTip( tr( "Use modifier to draw xLinks" )); +a->setToggleAction(true); +a->addTo (tb); +actionModModeXLink=a; } // Flag Actions void Main::setupFlagActions() { - // Create System Flags - QToolBar *tb=NULL; - - Flag *flag=new Flag;; - flag->setVisible(true); - - flag->load(QPixmap(flagsPath+"flag-note.png")); - setupFlag (flag,tb,"system-note",tr("Note","SystemFlag")); - - flag->load(QPixmap(flagsPath+"flag-url.png")); - setupFlag (flag,tb,"system-url",tr("URL to Document ","SystemFlag")); - - flag->load(QPixmap(flagsPath+"flag-vymlink.png")); - setupFlag (flag,tb,"system-vymLink",tr("Link to another vym map","SystemFlag")); - - flag->load(QPixmap(flagsPath+"flag-scrolled-right.png")); - setupFlag (flag,tb,"system-scrolledright",tr("subtree is scrolled","SystemFlag")); - - flag->load(QPixmap(flagsPath+"flag-tmpUnscrolled-right.png")); - setupFlag (flag,tb,"system-tmpUnscrolledRight",tr("subtree is temporary scrolled","SystemFlag")); - - flag->load(QPixmap(flagsPath+"flag-hideexport.png")); - setupFlag (flag,tb,"system-hideInExport",tr("Hide object in exported maps","SystemFlag")); - - // Create Standard Flags - tb=addToolBar (tr ("Standard Flags","Standard Flag Toolbar")); - tb->setObjectName ("standardFlagTB"); - standardFlagsMaster->setToolBar (tb); - - flag->load(flagsPath+"flag-exclamationmark.png"); - flag->setGroup("standard-mark"); - setupFlag (flag,tb,"exclamationmark",tr("Take care!","Standardflag")); - - flag->load(flagsPath+"flag-questionmark.png"); - flag->setGroup("standard-mark"); - setupFlag (flag,tb,"questionmark",tr("Really?","Standardflag")); - - flag->load(flagsPath+"flag-hook-green.png"); - flag->setGroup("standard-hook"); - setupFlag (flag,tb,"hook-green",tr("ok!","Standardflag")); - - flag->load(flagsPath+"flag-cross-red.png"); - flag->setGroup("standard-hook"); - setupFlag (flag,tb,"cross-red",tr("Not ok!","Standardflag")); - flag->unsetGroup(); - - flag->load(flagsPath+"flag-stopsign.png"); - setupFlag (flag,tb,"stopsign",tr("This won't work!","Standardflag")); - - flag->load(flagsPath+"flag-smiley-good.png"); - flag->setGroup("standard-smiley"); - setupFlag (flag,tb,"smiley-good",tr("Good","Standardflag")); - - flag->load(flagsPath+"flag-smiley-sad.png"); - flag->setGroup("standard-smiley"); - setupFlag (flag,tb,"smiley-sad",tr("Bad","Standardflag")); - - flag->load(flagsPath+"flag-smiley-omg.png"); - flag->setGroup("standard-smiley"); - setupFlag (flag,tb,"smiley-omb",tr("Oh no!","Standardflag")); - // Original omg.png (in KDE emoticons) - flag->unsetGroup(); - - flag->load(flagsPath+"flag-kalarm.png"); - setupFlag (flag,tb,"clock",tr("Time critical","Standardflag")); - - flag->load(flagsPath+"flag-phone.png"); - setupFlag (flag,tb,"phone",tr("Call...","Standardflag")); - - flag->load(flagsPath+"flag-lamp.png"); - setupFlag (flag,tb,"lamp",tr("Idea!","Standardflag")); - - flag->load(flagsPath+"flag-arrow-up.png"); - flag->setGroup("standard-arrow"); - setupFlag (flag,tb,"arrow-up",tr("Important","Standardflag")); - - flag->load(flagsPath+"flag-arrow-down.png"); - flag->setGroup("standard-arrow"); - setupFlag (flag,tb,"arrow-down",tr("Unimportant","Standardflag")); - - flag->load(flagsPath+"flag-arrow-2up.png"); - flag->setGroup("standard-arrow"); - setupFlag (flag,tb,"2arrow-up",tr("Very important!","Standardflag")); - - flag->load(flagsPath+"flag-arrow-2down.png"); - flag->setGroup("standard-arrow"); - setupFlag (flag,tb,"2arrow-down",tr("Very unimportant!","Standardflag")); - flag->unsetGroup(); - - flag->load(flagsPath+"flag-thumb-up.png"); - flag->setGroup("standard-thumb"); - setupFlag (flag,tb,"thumb-up",tr("I like this","Standardflag")); - - flag->load(flagsPath+"flag-thumb-down.png"); - flag->setGroup("standard-thumb"); - setupFlag (flag,tb,"thumb-down",tr("I do not like this","Standardflag")); - flag->unsetGroup(); - - flag->load(flagsPath+"flag-rose.png"); - setupFlag (flag,tb,"rose",tr("Rose","Standardflag")); - - flag->load(flagsPath+"flag-heart.png"); - setupFlag (flag,tb,"heart",tr("I just love...","Standardflag")); - - flag->load(flagsPath+"flag-present.png"); - setupFlag (flag,tb,"present",tr("Surprise!","Standardflag")); - - flag->load(flagsPath+"flag-flash.png"); - setupFlag (flag,tb,"flash",tr("Dangerous","Standardflag")); - - // Original: xsldbg_output.png - flag->load(flagsPath+"flag-info.png"); - setupFlag (flag,tb,"info",tr("Info","Standardflag")); - - // Original khelpcenter.png - flag->load(flagsPath+"flag-lifebelt.png"); - setupFlag (flag,tb,"lifebelt",tr("This will help","Standardflag")); - - // Freemind flags - flag->setVisible(false); - flag->load(flagsPath+"freemind/warning.png"); - setupFlag (flag,tb, "freemind-warning",tr("Important","Freemind-Flag")); - - for (int i=1; i<8; i++) - { - flag->load(flagsPath+QString("freemind/priority-%1.png").arg(i)); - setupFlag (flag,tb, QString("freemind-priority-%1").arg(i),tr("Priority","Freemind-Flag")); - } - - flag->load(flagsPath+"freemind/back.png"); - setupFlag (flag,tb,"freemind-back",tr("Back","Freemind-Flag")); - - flag->load(flagsPath+"freemind/forward.png"); - setupFlag (flag,tb,"freemind-forward",tr("forward","Freemind-Flag")); - - flag->load(flagsPath+"freemind/attach.png"); - setupFlag (flag,tb,"freemind-attach",tr("Look here","Freemind-Flag")); - - flag->load(flagsPath+"freemind/clanbomber.png"); - setupFlag (flag,tb,"freemind-clanbomber",tr("Dangerous","Freemind-Flag")); - - flag->load(flagsPath+"freemind/desktopnew.png"); - setupFlag (flag,tb,"freemind-desktopnew",tr("Don't flagrget","Freemind-Flag")); - - flag->load(flagsPath+"freemind/flag.png"); - setupFlag (flag,tb,"freemind-flag",tr("Flag","Freemind-Flag")); - - - flag->load(flagsPath+"freemind/gohome.png"); - setupFlag (flag,tb,"freemind-gohome",tr("Home","Freemind-Flag")); - - - flag->load(flagsPath+"freemind/kaddressbook.png"); - setupFlag (flag,tb,"freemind-kaddressbook",tr("Telephone","Freemind-Flag")); - - flag->load(flagsPath+"freemind/knotify.png"); - setupFlag (flag,tb,"freemind-knotify",tr("Music","Freemind-Flag")); - - flag->load(flagsPath+"freemind/korn.png"); - setupFlag (flag,tb,"freemind-korn",tr("Mailbox","Freemind-Flag")); - - flag->load(flagsPath+"freemind/mail.png"); - setupFlag (flag,tb,"freemind-mail",tr("Maix","Freemind-Flag")); - - flag->load(flagsPath+"freemind/password.png"); - setupFlag (flag,tb,"freemind-password",tr("Password","Freemind-Flag")); - - flag->load(flagsPath+"freemind/pencil.png"); - setupFlag (flag,tb,"freemind-pencil",tr("To be improved","Freemind-Flag")); - - flag->load(flagsPath+"freemind/stop.png"); - setupFlag (flag,tb,"freemind-stop",tr("Stop","Freemind-Flag")); - - flag->load(flagsPath+"freemind/wizard.png"); - setupFlag (flag,tb,"freemind-wizard",tr("Magic","Freemind-Flag")); - - flag->load(flagsPath+"freemind/xmag.png"); - setupFlag (flag,tb,"freemind-xmag",tr("To be discussed","Freemind-Flag")); - - flag->load(flagsPath+"freemind/bell.png"); - setupFlag (flag,tb,"freemind-bell",tr("Reminder","Freemind-Flag")); - - flag->load(flagsPath+"freemind/bookmark.png"); - setupFlag (flag,tb,"freemind-bookmark",tr("Excellent","Freemind-Flag")); - - flag->load(flagsPath+"freemind/penguin.png"); - setupFlag (flag,tb,"freemind-penguin",tr("Linux","Freemind-Flag")); - - flag->load(flagsPath+"freemind/licq.png"); - setupFlag (flag,tb,"freemind-licq",tr("Sweet","Freemind-Flag")); +// Create System Flags +QToolBar *tb=NULL; + +Flag *flag=new Flag;; +flag->setVisible(true); + +flag->load(QPixmap(flagsPath+"flag-note.png")); +setupFlag (flag,tb,"system-note",tr("Note","SystemFlag")); + +flag->load(QPixmap(flagsPath+"flag-url.png")); +setupFlag (flag,tb,"system-url",tr("URL to Document ","SystemFlag")); + +flag->load(QPixmap(flagsPath+"flag-vymlink.png")); +setupFlag (flag,tb,"system-vymLink",tr("Link to another vym map","SystemFlag")); + +flag->load(QPixmap(flagsPath+"flag-scrolled-right.png")); +setupFlag (flag,tb,"system-scrolledright",tr("subtree is scrolled","SystemFlag")); + +flag->load(QPixmap(flagsPath+"flag-tmpUnscrolled-right.png")); +setupFlag (flag,tb,"system-tmpUnscrolledRight",tr("subtree is temporary scrolled","SystemFlag")); + +flag->load(QPixmap(flagsPath+"flag-hideexport.png")); +setupFlag (flag,tb,"system-hideInExport",tr("Hide object in exported maps","SystemFlag")); + +// Create Standard Flags +tb=addToolBar (tr ("Standard Flags","Standard Flag Toolbar")); +tb->setObjectName ("standardFlagTB"); +standardFlagsMaster->setToolBar (tb); + +flag->load(flagsPath+"flag-exclamationmark.png"); +flag->setGroup("standard-mark"); +setupFlag (flag,tb,"exclamationmark",tr("Take care!","Standardflag")); + +flag->load(flagsPath+"flag-questionmark.png"); +flag->setGroup("standard-mark"); +setupFlag (flag,tb,"questionmark",tr("Really?","Standardflag")); + +flag->load(flagsPath+"flag-hook-green.png"); +flag->setGroup("standard-hook"); +setupFlag (flag,tb,"hook-green",tr("ok!","Standardflag")); + +flag->load(flagsPath+"flag-cross-red.png"); +flag->setGroup("standard-hook"); +setupFlag (flag,tb,"cross-red",tr("Not ok!","Standardflag")); +flag->unsetGroup(); + +flag->load(flagsPath+"flag-stopsign.png"); +setupFlag (flag,tb,"stopsign",tr("This won't work!","Standardflag")); + +flag->load(flagsPath+"flag-smiley-good.png"); +flag->setGroup("standard-smiley"); +setupFlag (flag,tb,"smiley-good",tr("Good","Standardflag")); + +flag->load(flagsPath+"flag-smiley-sad.png"); +flag->setGroup("standard-smiley"); +setupFlag (flag,tb,"smiley-sad",tr("Bad","Standardflag")); + +flag->load(flagsPath+"flag-smiley-omg.png"); +flag->setGroup("standard-smiley"); +setupFlag (flag,tb,"smiley-omb",tr("Oh no!","Standardflag")); +// Original omg.png (in KDE emoticons) +flag->unsetGroup(); + +flag->load(flagsPath+"flag-kalarm.png"); +setupFlag (flag,tb,"clock",tr("Time critical","Standardflag")); + +flag->load(flagsPath+"flag-phone.png"); +setupFlag (flag,tb,"phone",tr("Call...","Standardflag")); + +flag->load(flagsPath+"flag-lamp.png"); +setupFlag (flag,tb,"lamp",tr("Idea!","Standardflag")); + +flag->load(flagsPath+"flag-arrow-up.png"); +flag->setGroup("standard-arrow"); +setupFlag (flag,tb,"arrow-up",tr("Important","Standardflag")); + +flag->load(flagsPath+"flag-arrow-down.png"); +flag->setGroup("standard-arrow"); +setupFlag (flag,tb,"arrow-down",tr("Unimportant","Standardflag")); + +flag->load(flagsPath+"flag-arrow-2up.png"); +flag->setGroup("standard-arrow"); +setupFlag (flag,tb,"2arrow-up",tr("Very important!","Standardflag")); + +flag->load(flagsPath+"flag-arrow-2down.png"); +flag->setGroup("standard-arrow"); +setupFlag (flag,tb,"2arrow-down",tr("Very unimportant!","Standardflag")); +flag->unsetGroup(); + +flag->load(flagsPath+"flag-thumb-up.png"); +flag->setGroup("standard-thumb"); +setupFlag (flag,tb,"thumb-up",tr("I like this","Standardflag")); + +flag->load(flagsPath+"flag-thumb-down.png"); +flag->setGroup("standard-thumb"); +setupFlag (flag,tb,"thumb-down",tr("I do not like this","Standardflag")); +flag->unsetGroup(); + +flag->load(flagsPath+"flag-rose.png"); +setupFlag (flag,tb,"rose",tr("Rose","Standardflag")); + +flag->load(flagsPath+"flag-heart.png"); +setupFlag (flag,tb,"heart",tr("I just love...","Standardflag")); + +flag->load(flagsPath+"flag-present.png"); +setupFlag (flag,tb,"present",tr("Surprise!","Standardflag")); + +flag->load(flagsPath+"flag-flash.png"); +setupFlag (flag,tb,"flash",tr("Dangerous","Standardflag")); + +// Original: xsldbg_output.png +flag->load(flagsPath+"flag-info.png"); +setupFlag (flag,tb,"info",tr("Info","Standardflag")); + +// Original khelpcenter.png +flag->load(flagsPath+"flag-lifebelt.png"); +setupFlag (flag,tb,"lifebelt",tr("This will help","Standardflag")); + +// Freemind flags +flag->setVisible(false); +flag->load(flagsPath+"freemind/warning.png"); +setupFlag (flag,tb, "freemind-warning",tr("Important","Freemind-Flag")); + +for (int i=1; i<8; i++) +{ + flag->load(flagsPath+QString("freemind/priority-%1.png").arg(i)); + setupFlag (flag,tb, QString("freemind-priority-%1").arg(i),tr("Priority","Freemind-Flag")); +} + +flag->load(flagsPath+"freemind/back.png"); +setupFlag (flag,tb,"freemind-back",tr("Back","Freemind-Flag")); + +flag->load(flagsPath+"freemind/forward.png"); +setupFlag (flag,tb,"freemind-forward",tr("forward","Freemind-Flag")); + +flag->load(flagsPath+"freemind/attach.png"); +setupFlag (flag,tb,"freemind-attach",tr("Look here","Freemind-Flag")); + +flag->load(flagsPath+"freemind/clanbomber.png"); +setupFlag (flag,tb,"freemind-clanbomber",tr("Dangerous","Freemind-Flag")); + +flag->load(flagsPath+"freemind/desktopnew.png"); +setupFlag (flag,tb,"freemind-desktopnew",tr("Don't flagrget","Freemind-Flag")); + +flag->load(flagsPath+"freemind/flag.png"); +setupFlag (flag,tb,"freemind-flag",tr("Flag","Freemind-Flag")); + + +flag->load(flagsPath+"freemind/gohome.png"); +setupFlag (flag,tb,"freemind-gohome",tr("Home","Freemind-Flag")); + + +flag->load(flagsPath+"freemind/kaddressbook.png"); +setupFlag (flag,tb,"freemind-kaddressbook",tr("Telephone","Freemind-Flag")); + +flag->load(flagsPath+"freemind/knotify.png"); +setupFlag (flag,tb,"freemind-knotify",tr("Music","Freemind-Flag")); + +flag->load(flagsPath+"freemind/korn.png"); +setupFlag (flag,tb,"freemind-korn",tr("Mailbox","Freemind-Flag")); + +flag->load(flagsPath+"freemind/mail.png"); +setupFlag (flag,tb,"freemind-mail",tr("Maix","Freemind-Flag")); + +flag->load(flagsPath+"freemind/password.png"); +setupFlag (flag,tb,"freemind-password",tr("Password","Freemind-Flag")); + +flag->load(flagsPath+"freemind/pencil.png"); +setupFlag (flag,tb,"freemind-pencil",tr("To be improved","Freemind-Flag")); + +flag->load(flagsPath+"freemind/stop.png"); +setupFlag (flag,tb,"freemind-stop",tr("Stop","Freemind-Flag")); + +flag->load(flagsPath+"freemind/wizard.png"); +setupFlag (flag,tb,"freemind-wizard",tr("Magic","Freemind-Flag")); + +flag->load(flagsPath+"freemind/xmag.png"); +setupFlag (flag,tb,"freemind-xmag",tr("To be discussed","Freemind-Flag")); + +flag->load(flagsPath+"freemind/bell.png"); +setupFlag (flag,tb,"freemind-bell",tr("Reminder","Freemind-Flag")); + +flag->load(flagsPath+"freemind/bookmark.png"); +setupFlag (flag,tb,"freemind-bookmark",tr("Excellent","Freemind-Flag")); + +flag->load(flagsPath+"freemind/penguin.png"); +setupFlag (flag,tb,"freemind-penguin",tr("Linux","Freemind-Flag")); + +flag->load(flagsPath+"freemind/licq.png"); +setupFlag (flag,tb,"freemind-licq",tr("Sweet","Freemind-Flag")); } void Main::setupFlag (Flag *flag, QToolBar *tb, const QString &name, const QString &tooltip) { - flag->setName(name); - flag->setToolTip (tooltip); - QAction *a; - if (tb) - { - a=new QAction (flag->getPixmap(),name,this); - // StandardFlag - tb->addAction (a); - flag->setAction (a); - a->setVisible (flag->isVisible()); - a->setCheckable(true); - a->setObjectName(name); - a->setToolTip(tooltip); - connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); - standardFlagsMaster->addFlag (flag); - } else - { - // SystemFlag - systemFlagsMaster->addFlag (flag); - } +flag->setName(name); +flag->setToolTip (tooltip); +QAction *a; +if (tb) +{ + a=new QAction (flag->getPixmap(),name,this); + // StandardFlag + tb->addAction (a); + flag->setAction (a); + a->setVisible (flag->isVisible()); + a->setCheckable(true); + a->setObjectName(name); + a->setToolTip(tooltip); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); + standardFlagsMaster->addFlag (flag); +} else +{ + // SystemFlag + systemFlagsMaster->addFlag (flag); +} } // Network Actions void Main::setupNetworkActions() { - if (!settings.value( "/mainwindow/showTestMenu",false).toBool() ) - return; - QMenu *netMenu = menuBar()->addMenu( "Network" ); - - QAction *a; - - 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 - 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 - connect( a, SIGNAL( triggered() ), this, SLOT( networkConnect() ) ); - netMenu->addAction (a); +if (!settings.value( "/mainwindow/showTestMenu",false).toBool() ) + return; +QMenu *netMenu = menuBar()->addMenu( "Network" ); + +QAction *a; + +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 +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 +connect( a, SIGNAL( triggered() ), this, SLOT( networkConnect() ) ); +netMenu->addAction (a); } - + // Settings Actions void Main::setupSettingsActions() { - QMenu *settingsMenu = menuBar()->addMenu( tr( "&Settings" )); - - QAction *a; - - a = new QAction( tr( "Set application to open pdf files","Settings action"), this); - a->setStatusTip ( tr( "Set application to open pdf files")); - connect( a, SIGNAL( triggered() ), this, SLOT( settingsPDF() ) ); - settingsMenu->addAction (a); - - a = new QAction( tr( "Set application to open external links","Settings action"), this); - a->setStatusTip( tr( "Set application to open external links")); - connect( a, SIGNAL( triggered() ), this, SLOT( settingsURL() ) ); - settingsMenu->addAction (a); - - a = new QAction( tr( "Set path for macros","Settings action")+"...", this); - a->setStatusTip( tr( "Set path for macros")); - connect( a, SIGNAL( triggered() ), this, SLOT( settingsMacroDir() ) ); - settingsMenu->addAction (a); - - a = new QAction( tr( "Set number of undo levels","Settings action")+"...", this); - a->setStatusTip( tr( "Set number of undo levels")); - connect( a, SIGNAL( triggered() ), this, SLOT( settingsUndoLevels() ) ); - settingsMenu->addAction (a); - - settingsMenu->addSeparator(); - - a = new QAction( tr( "Autosave","Settings action"), this); - a->setStatusTip( tr( "Autosave")); - a->setToggleAction(true); - a->setChecked ( settings.value ("/mainwindow/autosave/use",false).toBool()); - connect( a, SIGNAL( triggered() ), this, SLOT( settingsAutosaveToggle() ) ); - settingsMenu->addAction (a); - actionSettingsAutosaveToggle=a; - - a = new QAction( tr( "Autosave time","Settings action")+"...", this); - a->setStatusTip( tr( "Autosave time")); - connect( a, SIGNAL( triggered() ), this, SLOT( settingsAutosaveTime() ) ); - settingsMenu->addAction (a); - actionSettingsAutosaveTime=a; - - a = new QAction( tr( "Write backup file on save","Settings action"), this); - a->setStatusTip( tr( "Write backup file on save")); - a->setToggleAction(true); - a->setChecked ( settings.value ("/mainwindow/writeBackupFile",false).toBool()); - connect( a, SIGNAL( triggered() ), this, SLOT( settingsWriteBackupFileToggle() ) ); - settingsMenu->addAction (a); - actionSettingsWriteBackupFile=a; - - settingsMenu->addSeparator(); - - a = new QAction( tr( "Edit branch after adding it","Settings action" ), this ); - a->setStatusTip( tr( "Edit branch after adding it" )); - a->setToggleAction(true); - a->setChecked ( settings.value ("/mapeditor/editmode/autoEditNewBranch",true).toBool()); - settingsMenu->addAction (a); - actionSettingsAutoEditNewBranch=a; - - a= new QAction( tr( "Select branch after adding it","Settings action" ), this ); - a->setStatusTip( tr( "Select branch after adding it" )); - a->setToggleAction(true); - a->setChecked ( settings.value ("/mapeditor/editmode/autoSelectNewBranch",false).toBool() ); - settingsMenu->addAction (a); - actionSettingsAutoSelectNewBranch=a; - - a= new QAction(tr( "Select existing heading","Settings action" ), this); - a->setStatusTip( tr( "Select heading before editing" )); - a->setToggleAction(true); - a->setChecked ( settings.value ("/mapeditor/editmode/autoSelectText",true).toBool() ); - settingsMenu->addAction (a); - actionSettingsAutoSelectText=a; - - a= new QAction( tr( "Delete key","Settings action" ), this); - a->setStatusTip( tr( "Delete key for deleting branches" )); - a->setToggleAction(true); - a->setChecked ( settings.value ("/mapeditor/editmode/useDelKey",true).toBool() ); - settingsMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( settingsToggleDelKey() ) ); - actionSettingsUseDelKey=a; - - a= new QAction( tr( "Exclusive flags","Settings action" ), this); - a->setStatusTip( tr( "Use exclusive flags in flag toolbars" )); - a->setToggleAction(true); - a->setChecked ( settings.value ("/mapeditor/editmode/useFlagGroups",true).toBool() ); - settingsMenu->addAction (a); - actionSettingsUseFlagGroups=a; - - a= new QAction( tr( "Use hide flags","Settings action" ), this); - a->setStatusTip( tr( "Use hide flag during exports " )); - a->setToggleAction(true); - a->setChecked ( settings.value ("/export/useHideExport",true).toBool() ); - settingsMenu->addAction (a); - actionSettingsUseHideExport=a; - - a = new QAction( tr( "Animation","Settings action"), this); - a->setStatusTip( tr( "Animation")); - a->setToggleAction(true); - a->setChecked (settings.value("/animation/use",true).toBool() ); - connect( a, SIGNAL( triggered() ), this, SLOT( settingsToggleAnimation() ) ); - settingsMenu->addAction (a); - actionSettingsUseAnimation=a; +QMenu *settingsMenu = menuBar()->addMenu( tr( "&Settings" )); + +QAction *a; + +a = new QAction( tr( "Set application to open pdf files","Settings action"), this); +a->setStatusTip ( tr( "Set application to open pdf files")); +connect( a, SIGNAL( triggered() ), this, SLOT( settingsPDF() ) ); +settingsMenu->addAction (a); + +a = new QAction( tr( "Set application to open external links","Settings action"), this); +a->setStatusTip( tr( "Set application to open external links")); +connect( a, SIGNAL( triggered() ), this, SLOT( settingsURL() ) ); +settingsMenu->addAction (a); + +a = new QAction( tr( "Set path for macros","Settings action")+"...", this); +a->setStatusTip( tr( "Set path for macros")); +connect( a, SIGNAL( triggered() ), this, SLOT( settingsMacroDir() ) ); +settingsMenu->addAction (a); + +a = new QAction( tr( "Set number of undo levels","Settings action")+"...", this); +a->setStatusTip( tr( "Set number of undo levels")); +connect( a, SIGNAL( triggered() ), this, SLOT( settingsUndoLevels() ) ); +settingsMenu->addAction (a); + +settingsMenu->addSeparator(); + +a = new QAction( tr( "Autosave","Settings action"), this); +a->setStatusTip( tr( "Autosave")); +a->setToggleAction(true); +a->setChecked ( settings.value ("/mainwindow/autosave/use",false).toBool()); +connect( a, SIGNAL( triggered() ), this, SLOT( settingsAutosaveToggle() ) ); +settingsMenu->addAction (a); +actionSettingsAutosaveToggle=a; + +a = new QAction( tr( "Autosave time","Settings action")+"...", this); +a->setStatusTip( tr( "Autosave time")); +connect( a, SIGNAL( triggered() ), this, SLOT( settingsAutosaveTime() ) ); +settingsMenu->addAction (a); +actionSettingsAutosaveTime=a; + +a = new QAction( tr( "Write backup file on save","Settings action"), this); +a->setStatusTip( tr( "Write backup file on save")); +a->setToggleAction(true); +a->setChecked ( settings.value ("/mainwindow/writeBackupFile",false).toBool()); +connect( a, SIGNAL( triggered() ), this, SLOT( settingsWriteBackupFileToggle() ) ); +settingsMenu->addAction (a); +actionSettingsWriteBackupFile=a; + +settingsMenu->addSeparator(); + +a = new QAction( tr( "Edit branch after adding it","Settings action" ), this ); +a->setStatusTip( tr( "Edit branch after adding it" )); +a->setToggleAction(true); +a->setChecked ( settings.value ("/mapeditor/editmode/autoEditNewBranch",true).toBool()); +settingsMenu->addAction (a); +actionSettingsAutoEditNewBranch=a; + +a= new QAction( tr( "Select branch after adding it","Settings action" ), this ); +a->setStatusTip( tr( "Select branch after adding it" )); +a->setToggleAction(true); +a->setChecked ( settings.value ("/mapeditor/editmode/autoSelectNewBranch",false).toBool() ); +settingsMenu->addAction (a); +actionSettingsAutoSelectNewBranch=a; + +a= new QAction(tr( "Select existing heading","Settings action" ), this); +a->setStatusTip( tr( "Select heading before editing" )); +a->setToggleAction(true); +a->setChecked ( settings.value ("/mapeditor/editmode/autoSelectText",true).toBool() ); +settingsMenu->addAction (a); +actionSettingsAutoSelectText=a; + +a= new QAction( tr( "Delete key","Settings action" ), this); +a->setStatusTip( tr( "Delete key for deleting branches" )); +a->setToggleAction(true); +a->setChecked ( settings.value ("/mapeditor/editmode/useDelKey",true).toBool() ); +settingsMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( settingsToggleDelKey() ) ); +actionSettingsUseDelKey=a; + +a= new QAction( tr( "Exclusive flags","Settings action" ), this); +a->setStatusTip( tr( "Use exclusive flags in flag toolbars" )); +a->setToggleAction(true); +a->setChecked ( settings.value ("/mapeditor/editmode/useFlagGroups",true).toBool() ); +settingsMenu->addAction (a); +actionSettingsUseFlagGroups=a; + +a= new QAction( tr( "Use hide flags","Settings action" ), this); +a->setStatusTip( tr( "Use hide flag during exports " )); +a->setToggleAction(true); +a->setChecked ( settings.value ("/export/useHideExport",true).toBool() ); +settingsMenu->addAction (a); +actionSettingsUseHideExport=a; + +a = new QAction( tr( "Animation","Settings action"), this); +a->setStatusTip( tr( "Animation")); +a->setToggleAction(true); +a->setChecked (settings.value("/animation/use",true).toBool() ); +connect( a, SIGNAL( triggered() ), this, SLOT( settingsToggleAnimation() ) ); +settingsMenu->addAction (a); +actionSettingsUseAnimation=a; } // Test Actions void Main::setupTestActions() { - QMenu *testMenu = menuBar()->addMenu( tr( "&Test" )); - - QAction *a; - a = new QAction( "Test function 1" , this); - a->setStatusTip( "Call test function 1" ); - a->setShortcut (Qt::CTRL + Qt::Key_T); // Test function 1 //FIXME-2 originally: color subtree - 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::SHIFT + Qt::Key_T); // Test function 2 - testMenu->addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( testFunction2() ) ); - - a = new QAction( "Command" , this); - a->setStatusTip( "Enter command to call in editor" ); - connect( a, SIGNAL( triggered() ), this, SLOT( testCommand() ) ); - testMenu->addAction (a); +QMenu *testMenu = menuBar()->addMenu( tr( "&Test" )); + +QAction *a; +a = new QAction( "Test function 1" , this); +a->setStatusTip( "Call test function 1" ); +a->setShortcut (Qt::CTRL + Qt::Key_T); // Test function 1 //FIXME-2 originally: color subtree +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::SHIFT + Qt::Key_T); // Test function 2 +testMenu->addAction (a); +connect( a, SIGNAL( triggered() ), this, SLOT( testFunction2() ) ); + +a = new QAction( "Command" , this); +a->setStatusTip( "Enter command to call in editor" ); +connect( a, SIGNAL( triggered() ), this, SLOT( testCommand() ) ); +testMenu->addAction (a); } // Help Actions void Main::setupHelpActions() { - QMenu *helpMenu = menuBar()->addMenu ( tr( "&Help","Help menubar entry" )); - - QAction *a; - a = new QAction( tr( "Open VYM Documentation (pdf) ","Help action" ), this ); - a->setStatusTip( tr( "Open VYM Documentation (pdf)" )); - 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 " )); - connect( a, SIGNAL( triggered() ), this, SLOT( helpDemo() ) ); - helpMenu->addAction (a); - - a = new QAction( tr( "About VYM","Help action" ), this); - a->setStatusTip( tr( "About VYM")+vymName); - connect( a, SIGNAL( triggered() ), this, SLOT( helpAbout() ) ); - helpMenu->addAction (a); - - a = new QAction( tr( "About QT","Help action" ), this); - a->setStatusTip( tr( "Information about QT toolkit" )); - connect( a, SIGNAL( triggered() ), this, SLOT( helpAboutQT() ) ); - helpMenu->addAction (a); +QMenu *helpMenu = menuBar()->addMenu ( tr( "&Help","Help menubar entry" )); + +QAction *a; +a = new QAction( tr( "Open VYM Documentation (pdf) ","Help action" ), this ); +a->setStatusTip( tr( "Open VYM Documentation (pdf)" )); +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 " )); +connect( a, SIGNAL( triggered() ), this, SLOT( helpDemo() ) ); +helpMenu->addAction (a); + +a = new QAction( tr( "About VYM","Help action" ), this); +a->setStatusTip( tr( "About VYM")+vymName); +connect( a, SIGNAL( triggered() ), this, SLOT( helpAbout() ) ); +helpMenu->addAction (a); + +a = new QAction( tr( "About QT","Help action" ), this); +a->setStatusTip( tr( "Information about QT toolkit" )); +connect( a, SIGNAL( triggered() ), this, SLOT( helpAboutQT() ) ); +helpMenu->addAction (a); } // Context Menus void Main::setupContextMenus() { - QAction*a; - - // Context Menu for branch or mapcenter - branchContextMenu =new QMenu (this); - branchContextMenu->addAction (actionViewTogglePropertyWindow); +QAction*a; + +// Context Menu for branch or mapcenter +branchContextMenu =new QMenu (this); +branchContextMenu->addAction (actionViewTogglePropertyWindow); +branchContextMenu->addSeparator(); + + // Submenu "Add" + branchAddContextMenu =branchContextMenu->addMenu (tr("Add")); + branchAddContextMenu->addAction (actionPaste ); + branchAddContextMenu->addAction ( actionAddMapCenter ); + branchAddContextMenu->addAction ( actionAddBranch ); + branchAddContextMenu->addAction ( actionAddBranchBefore ); + branchAddContextMenu->addAction ( actionAddBranchAbove); + branchAddContextMenu->addAction ( actionAddBranchBelow ); + branchAddContextMenu->addSeparator(); + branchAddContextMenu->addAction ( actionImportAdd ); + branchAddContextMenu->addAction ( actionImportReplace ); + + // Submenu "Remove" + branchRemoveContextMenu =branchContextMenu->addMenu (tr ("Remove","Context menu name")); + branchRemoveContextMenu->addAction (actionCut); + branchRemoveContextMenu->addAction ( actionDelete ); + branchRemoveContextMenu->addAction ( actionDeleteKeepChildren ); + branchRemoveContextMenu->addAction ( actionDeleteChildren ); + + +actionSaveBranch->addTo( branchContextMenu ); +actionFileNewCopy->addTo (branchContextMenu ); +actionDetach->addTo (branchContextMenu ); + +branchContextMenu->addSeparator(); +branchContextMenu->addAction ( actionLoadImage); + +// Submenu for Links (URLs, vymLinks) +branchLinksContextMenu =new QMenu (this); + branchContextMenu->addSeparator(); - - // Submenu "Add" - branchAddContextMenu =branchContextMenu->addMenu (tr("Add")); - branchAddContextMenu->addAction (actionPaste ); - branchAddContextMenu->addAction ( actionAddMapCenter ); - branchAddContextMenu->addAction ( actionAddBranch ); - branchAddContextMenu->addAction ( actionAddBranchBefore ); - branchAddContextMenu->addAction ( actionAddBranchAbove); - branchAddContextMenu->addAction ( actionAddBranchBelow ); - branchAddContextMenu->addSeparator(); - branchAddContextMenu->addAction ( actionImportAdd ); - branchAddContextMenu->addAction ( actionImportReplace ); - - // Submenu "Remove" - branchRemoveContextMenu =branchContextMenu->addMenu (tr ("Remove","Context menu name")); - branchRemoveContextMenu->addAction (actionCut); - branchRemoveContextMenu->addAction ( actionDelete ); - branchRemoveContextMenu->addAction ( actionDeleteKeepChildren ); - branchRemoveContextMenu->addAction ( actionDeleteChildren ); - - - actionSaveBranch->addTo( branchContextMenu ); - actionFileNewCopy->addTo (branchContextMenu ); - actionDetach->addTo (branchContextMenu ); - - branchContextMenu->addSeparator(); - branchContextMenu->addAction ( actionLoadImage); - - // Submenu for Links (URLs, vymLinks) - branchLinksContextMenu =new QMenu (this); - - branchContextMenu->addSeparator(); - branchLinksContextMenu=branchContextMenu->addMenu(tr("References (URLs, vymLinks, ...)","Context menu name")); - branchLinksContextMenu->addAction ( actionOpenURL ); - branchLinksContextMenu->addAction ( actionOpenURLTab ); - branchLinksContextMenu->addAction ( actionOpenMultipleURLTabs ); - branchLinksContextMenu->addAction ( actionURL ); - branchLinksContextMenu->addAction ( actionLocalURL ); - branchLinksContextMenu->addAction ( actionHeading2URL ); - branchLinksContextMenu->addAction ( actionBugzilla2URL ); - if (settings.value( "/mainwindow/showTestMenu",false).toBool() ) - { - branchLinksContextMenu->addAction ( actionFATE2URL ); - } - branchLinksContextMenu->addSeparator(); - branchLinksContextMenu->addAction ( actionOpenVymLink ); - branchLinksContextMenu->addAction ( actionOpenMultipleVymLinks ); - branchLinksContextMenu->addAction ( actionVymLink ); - branchLinksContextMenu->addAction ( actionDeleteVymLink ); - - - // Context Menu for XLinks in a branch menu - // This will be populated "on demand" in MapEditor::updateActions - branchContextMenu->addSeparator(); - branchXLinksContextMenuEdit =branchContextMenu->addMenu (tr ("Edit XLink","Context menu name")); - branchXLinksContextMenuFollow =branchContextMenu->addMenu (tr ("Follow XLink","Context menu name")); - connect( branchXLinksContextMenuFollow, SIGNAL( triggered(QAction *) ), this, SLOT( editFollowXLink(QAction * ) ) ); - connect( branchXLinksContextMenuEdit, SIGNAL( triggered(QAction *) ), this, SLOT( editEditXLink(QAction * ) ) ); - + branchLinksContextMenu=branchContextMenu->addMenu(tr("References (URLs, vymLinks, ...)","Context menu name")); + branchLinksContextMenu->addAction ( actionOpenURL ); + branchLinksContextMenu->addAction ( actionOpenURLTab ); + branchLinksContextMenu->addAction ( actionOpenMultipleURLTabs ); + branchLinksContextMenu->addAction ( actionURL ); + branchLinksContextMenu->addAction ( actionLocalURL ); + branchLinksContextMenu->addAction ( actionHeading2URL ); + branchLinksContextMenu->addAction ( actionBugzilla2URL ); + if (settings.value( "/mainwindow/showTestMenu",false).toBool() ) + { + branchLinksContextMenu->addAction ( actionFATE2URL ); + } + branchLinksContextMenu->addSeparator(); + branchLinksContextMenu->addAction ( actionOpenVymLink ); + branchLinksContextMenu->addAction ( actionOpenMultipleVymLinks ); + branchLinksContextMenu->addAction ( actionVymLink ); + branchLinksContextMenu->addAction ( actionDeleteVymLink ); - // Context menu for floatimage - floatimageContextMenu =new QMenu (this); - a= new QAction (tr ("Save image","Context action"),this); - connect (a, SIGNAL (triggered()), this, SLOT (editSaveImage())); - floatimageContextMenu->addAction (a); - - floatimageContextMenu->addSeparator(); - actionCopy->addTo( floatimageContextMenu ); - actionCut->addTo( floatimageContextMenu ); - - floatimageContextMenu->addSeparator(); - floatimageContextMenu->addAction ( actionFormatHideLinkUnselected ); - - - // Context menu for canvas - canvasContextMenu =new QMenu (this); - actionAddMapCenter->addTo( canvasContextMenu ); - actionMapInfo->addTo( canvasContextMenu ); - canvasContextMenu->insertSeparator(); - actionGroupFormatLinkStyles->addTo( canvasContextMenu ); - canvasContextMenu->insertSeparator(); - actionFormatLinkColorHint->addTo( canvasContextMenu ); - actionFormatLinkColor->addTo( canvasContextMenu ); - actionFormatSelectionColor->addTo( canvasContextMenu ); - actionFormatBackColor->addTo( canvasContextMenu ); - // actionFormatBackImage->addTo( canvasContextMenu ); //FIXME-4 makes vym too slow: postponed for later version - - // Menu for last opened files - // Create actions - for (int i = 0; i < MaxRecentFiles; ++i) - { - recentFileActions[i] = new QAction(this); - recentFileActions[i]->setVisible(false); - fileLastMapsMenu->addAction(recentFileActions[i]); - connect(recentFileActions[i], SIGNAL(triggered()), - this, SLOT(fileLoadRecent())); - } - setupRecentMapsMenu(); + +// Context Menu for XLinks in a branch menu +// This will be populated "on demand" in MapEditor::updateActions +branchContextMenu->addSeparator(); +branchXLinksContextMenuEdit =branchContextMenu->addMenu (tr ("Edit XLink","Context menu name")); +branchXLinksContextMenuFollow =branchContextMenu->addMenu (tr ("Follow XLink","Context menu name")); +connect( branchXLinksContextMenuFollow, SIGNAL( triggered(QAction *) ), this, SLOT( editFollowXLink(QAction * ) ) ); +connect( branchXLinksContextMenuEdit, SIGNAL( triggered(QAction *) ), this, SLOT( editEditXLink(QAction * ) ) ); + + +// Context menu for floatimage +floatimageContextMenu =new QMenu (this); +a= new QAction (tr ("Save image","Context action"),this); +connect (a, SIGNAL (triggered()), this, SLOT (editSaveImage())); +floatimageContextMenu->addAction (a); + +floatimageContextMenu->addSeparator(); +actionCopy->addTo( floatimageContextMenu ); +actionCut->addTo( floatimageContextMenu ); + +floatimageContextMenu->addSeparator(); +floatimageContextMenu->addAction ( actionFormatHideLinkUnselected ); + + +// Context menu for canvas +canvasContextMenu =new QMenu (this); +actionAddMapCenter->addTo( canvasContextMenu ); +actionMapInfo->addTo( canvasContextMenu ); +canvasContextMenu->insertSeparator(); +actionGroupFormatLinkStyles->addTo( canvasContextMenu ); +canvasContextMenu->insertSeparator(); +actionFormatLinkColorHint->addTo( canvasContextMenu ); +actionFormatLinkColor->addTo( canvasContextMenu ); +actionFormatSelectionColor->addTo( canvasContextMenu ); +actionFormatBackColor->addTo( canvasContextMenu ); +// actionFormatBackImage->addTo( canvasContextMenu ); //FIXME-4 makes vym too slow: postponed for later version + +// Menu for last opened files +// Create actions +for (int i = 0; i < MaxRecentFiles; ++i) +{ + recentFileActions[i] = new QAction(this); + recentFileActions[i]->setVisible(false); + fileLastMapsMenu->addAction(recentFileActions[i]); + connect(recentFileActions[i], SIGNAL(triggered()), + this, SLOT(fileLoadRecent())); +} +setupRecentMapsMenu(); } void Main::setupRecentMapsMenu() { - QStringList files = settings.value("/mainwindow/recentFileList").toStringList(); - - int numRecentFiles = qMin(files.size(), (int)MaxRecentFiles); - - for (int i = 0; i < numRecentFiles; ++i) { - QString text = tr("&%1 %2").arg(i + 1).arg(files[i]); - recentFileActions[i]->setText(text); - recentFileActions[i]->setData(files[i]); - recentFileActions[i]->setVisible(true); - } - for (int j = numRecentFiles; j < MaxRecentFiles; ++j) - recentFileActions[j]->setVisible(false); +QStringList files = settings.value("/mainwindow/recentFileList").toStringList(); + +int numRecentFiles = qMin(files.size(), (int)MaxRecentFiles); + +for (int i = 0; i < numRecentFiles; ++i) { + QString text = tr("&%1 %2").arg(i + 1).arg(files[i]); + recentFileActions[i]->setText(text); + recentFileActions[i]->setData(files[i]); + recentFileActions[i]->setVisible(true); +} +for (int j = numRecentFiles; j < MaxRecentFiles; ++j) + recentFileActions[j]->setVisible(false); } void Main::setupMacros() { - for (int i = 0; i <= 11; i++) - { - macroActions[i] = new QAction(this); - macroActions[i]->setData(i); - addAction (macroActions[i]); - connect(macroActions[i], SIGNAL(triggered()), - this, SLOT(callMacro())); - } - macroActions[0]->setShortcut ( Qt::Key_F1 ); - macroActions[1]->setShortcut ( Qt::Key_F2 ); - macroActions[2]->setShortcut ( Qt::Key_F3 ); - macroActions[3]->setShortcut ( Qt::Key_F4 ); - macroActions[4]->setShortcut ( Qt::Key_F5 ); - macroActions[5]->setShortcut ( Qt::Key_F6 ); - macroActions[6]->setShortcut ( Qt::Key_F7 ); - macroActions[7]->setShortcut ( Qt::Key_F8 ); - macroActions[8]->setShortcut ( Qt::Key_F9 ); - macroActions[9]->setShortcut ( Qt::Key_F10 ); - macroActions[10]->setShortcut ( Qt::Key_F11 ); - macroActions[11]->setShortcut ( Qt::Key_F12 ); +for (int i = 0; i <= 11; i++) +{ + macroActions[i] = new QAction(this); + macroActions[i]->setData(i); + addAction (macroActions[i]); + connect(macroActions[i], SIGNAL(triggered()), + this, SLOT(callMacro())); +} +macroActions[0]->setShortcut ( Qt::Key_F1 ); +macroActions[1]->setShortcut ( Qt::Key_F2 ); +macroActions[2]->setShortcut ( Qt::Key_F3 ); +macroActions[3]->setShortcut ( Qt::Key_F4 ); +macroActions[4]->setShortcut ( Qt::Key_F5 ); +macroActions[5]->setShortcut ( Qt::Key_F6 ); +macroActions[6]->setShortcut ( Qt::Key_F7 ); +macroActions[7]->setShortcut ( Qt::Key_F8 ); +macroActions[8]->setShortcut ( Qt::Key_F9 ); +macroActions[9]->setShortcut ( Qt::Key_F10 ); +macroActions[10]->setShortcut ( Qt::Key_F11 ); +macroActions[11]->setShortcut ( Qt::Key_F12 ); } void Main::hideEvent (QHideEvent * ) { - if (!textEditor->isMinimized() ) textEditor->hide(); +if (!textEditor->isMinimized() ) textEditor->hide(); } void Main::showEvent (QShowEvent * ) { - if (actionViewToggleNoteEditor->isOn()) textEditor->showNormal(); +if (actionViewToggleNoteEditor->isOn()) textEditor->showNormal(); } MapEditor* Main::currentMapEditor() const { - if ( tabWidget->currentPage()) - return vymViews.at(tabWidget->currentIndex())->getMapEditor(); - return NULL; +if ( tabWidget->currentPage()) + return vymViews.at(tabWidget->currentIndex())->getMapEditor(); +return NULL; } VymModel* Main::currentModel() const { - if ( tabWidget->currentPage()) - return vymViews.at(tabWidget->currentIndex())->getModel(); - return NULL; +if ( tabWidget->currentPage()) + return vymViews.at(tabWidget->currentIndex())->getModel(); +return NULL; } void Main::editorChanged(QWidget *) { - // Unselect all possibly selected objects - // (Important to update note editor) - VymModel *m; - for (int i=0;i<=tabWidget->count() -1;i++) - { - m= vymViews.at(i)->getModel(); - if (m) m->unselect(); - } - m=currentModel(); - if (m) m->reselect(); - - // Update actions to in menus and toolbars according to editor - updateActions(); +// Unselect all possibly selected objects +// (Important to update note editor) +VymModel *m; +for (int i=0;i<=tabWidget->count() -1;i++) +{ + m= vymViews.at(i)->getModel(); + if (m) m->unselect(); +} +m=currentModel(); +if (m) m->reselect(); + +// Update actions to in menus and toolbars according to editor +updateActions(); } void Main::fileNew() { - VymModel *vm=new VymModel; - +VymModel *vm=new VymModel; + +///////////////////////////////////// new ModelTest(vm, this); //FIXME-3 - - - VymView *vv=new VymView (vm); - vymViews.append (vv); - tabWidget->addTab (vv,tr("unnamed","MainWindow: name for new and empty file")); - tabWidget->setCurrentIndex (vymViews.count() ); - vv->initFocus(); - - // Create MapCenter for empty map - vm->addMapCenter(); - vm->makeDefault(); - - // For the very first map we do not have flagrows yet... - vm->select("mc:"); +///////////////////////////////////// + + +VymView *vv=new VymView (vm); +vymViews.append (vv); +tabWidget->addTab (vv,tr("unnamed","MainWindow: name for new and empty file")); +tabWidget->setCurrentIndex (vymViews.count() ); +vv->initFocus(); + +// Create MapCenter for empty map +vm->addMapCenter(); +vm->makeDefault(); + +// For the very first map we do not have flagrows yet... +vm->select("mc:"); } void Main::fileNewCopy() { - QString fn="unnamed"; - VymModel *srcModel=currentModel(); - if (srcModel) +QString fn="unnamed"; +VymModel *srcModel=currentModel(); +if (srcModel) +{ + srcModel->copy(); + fileNew(); + VymModel *dstModel=vymViews.last()->getModel(); + dstModel->select("mc:"); + dstModel->load (clipboardDir+"/"+clipboardFile,ImportReplace, VymMap); +} +} + +ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode, const FileType &ftype) +{ +ErrorCode err=success; + +// fn is usually the archive, mapfile the file after uncompressing +QString mapfile; + +// Make fn absolute (needed for unzip) +fn=QDir (fn).absPath(); + +VymModel *vm; + +if (lmode==NewMap) +{ + // Check, if map is already loaded + int i=0; + while (i<=tabWidget->count() -1) { - srcModel->copy(); - fileNew(); - VymModel *dstModel=vymViews.last()->getModel(); - dstModel->select("mc:"); - dstModel->load (clipboardDir+"/"+clipboardFile,ImportReplace, VymMap); + if (vymViews.at(i)->getModel()->getFilePath() == fn) + { + // Already there, ask for confirmation + QMessageBox mb( vymName, + tr("The map %1\nis already opened." + "Opening the same map in multiple editors may lead \n" + "to confusion when finishing working with vym." + "Do you want to").arg(fn), + QMessageBox::Warning, + QMessageBox::Yes | QMessageBox::Default, + QMessageBox::Cancel | QMessageBox::Escape, + QMessageBox::NoButton); + mb.setButtonText( QMessageBox::Yes, tr("Open anyway") ); + mb.setButtonText( QMessageBox::Cancel, tr("Cancel")); + switch( mb.exec() ) + { + case QMessageBox::Yes: + // end loop and load anyway + i=tabWidget->count(); + break; + case QMessageBox::Cancel: + // do nothing + return aborted; + break; + } + } + i++; } } -ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode, const FileType &ftype) -{ - ErrorCode err=success; - - // fn is usually the archive, mapfile the file after uncompressing - QString mapfile; - - // Make fn absolute (needed for unzip) - fn=QDir (fn).absPath(); - - VymModel *vm; - - if (lmode==NewMap) - { - // Check, if map is already loaded - int i=0; - while (i<=tabWidget->count() -1) - { - if (vymViews.at(i)->getModel()->getFilePath() == fn) - { - // Already there, ask for confirmation - QMessageBox mb( vymName, - tr("The map %1\nis already opened." - "Opening the same map in multiple editors may lead \n" - "to confusion when finishing working with vym." - "Do you want to").arg(fn), - QMessageBox::Warning, - QMessageBox::Yes | QMessageBox::Default, - QMessageBox::Cancel | QMessageBox::Escape, - QMessageBox::NoButton); - mb.setButtonText( QMessageBox::Yes, tr("Open anyway") ); - mb.setButtonText( QMessageBox::Cancel, tr("Cancel")); - switch( mb.exec() ) - { - case QMessageBox::Yes: - // end loop and load anyway - i=tabWidget->count(); - break; - case QMessageBox::Cancel: - // do nothing - return aborted; - break; - } - } - i++; - } - } - - int tabIndex=tabWidget->currentPageIndex(); +int tabIndex=tabWidget->currentPageIndex(); // Try to load map if ( !fn.isEmpty() ) @@ -2231,6 +2238,12 @@ if (m) m->exportImage(); } +void Main::fileExportAO() +{ + VymModel *m=currentModel(); + if (m) m->exportAO(); +} + void Main::fileExportASCII() { VymModel *m=currentModel(); @@ -2382,13 +2395,16 @@ vymViews.removeAt (tabWidget->currentIndex() ); tabWidget->removeTab (tabWidget->currentIndex() ); - // Remove mapEditor/model FIXME-5 + // Remove mapEditor/model FIXME-3 Huh? seems to work now... // Better would be delete (me), but then we could have a Qt error: // "QObject: Do not delete object, 'MapEditor', during its event handler!" // So we only remove data now and call deconstructor when vym closes later // this needs to be moved to vymview... me->clear(); // some model->clear is needed to free up memory ... + delete (m->getMapEditor()); + delete (m); + updateActions(); } } diff -r 2a33304714ba -r f9f7922989d8 mainwindow.h --- a/mainwindow.h Tue Nov 17 08:24:59 2009 +0000 +++ b/mainwindow.h Wed Nov 25 10:58:21 2009 +0000 @@ -97,6 +97,7 @@ void fileExportXML(); void fileExportXHTML(); void fileExportImage(); + void fileExportAO(); void fileExportASCII(); void fileExportCSV(); void fileExportLaTeX(); diff -r 2a33304714ba -r f9f7922989d8 mapeditor.cpp --- a/mapeditor.cpp Tue Nov 17 08:24:59 2009 +0000 +++ b/mapeditor.cpp Wed Nov 25 10:58:21 2009 +0000 @@ -998,11 +998,11 @@ void MapEditor::mousePressEvent(QMouseEvent* e) { -cout << "ME::mousePressed\n"; +//cout << "ME::mousePressed\n"; //FIXME-3 // Ignore right clicks, these will go to context menus if (e->button() == Qt::RightButton ) { - cout << " ME::ignoring right mouse event...\n"; + //cout << " ME::ignoring right mouse event...\n"; e->ignore(); return; } @@ -1010,7 +1010,7 @@ //Ignore clicks while editing heading if (model->isSelectionBlocked() ) { - cout << " ME::ignoring other mouse event...\n"; + //cout << " ME::ignoring other mouse event...\n"; e->ignore(); return; } @@ -1622,6 +1622,8 @@ QList treeItemsNew; QList treeItemsOld; + QModelIndex newIndex; + bool do_reposition=false; QModelIndex ix; @@ -1670,6 +1672,8 @@ QModelIndex ix=newsel.indexes().first(); if (ix.isValid() ) { + newIndex=ix; + // Temporary unscroll if necessary TreeItem *ti= static_cast(ix.internalPointer()); if (ti->isBranchLikeType() ) @@ -1686,7 +1690,6 @@ ((MapItem*)ti)->getLMO()->updateVisibility(); } } - // FIXME-3 cout << "ME::updateSel doRepos="<reposition(); // Reduce rectangles diff -r 2a33304714ba -r f9f7922989d8 tex/vym.changelog --- a/tex/vym.changelog Tue Nov 17 08:24:59 2009 +0000 +++ b/tex/vym.changelog Wed Nov 25 10:58:21 2009 +0000 @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Nov 24 22:34:42 CET 2009 - vym@insilmaril.de + +- Bugfix: Automatic scrolling to new selected items didn't work + reliable when item had scrolled parents + ------------------------------------------------------------------- Wed Nov 11 10:32:29 CET 2009 - vym@insilmaril.de diff -r 2a33304714ba -r f9f7922989d8 texteditor.cpp --- a/texteditor.cpp Tue Nov 17 08:24:59 2009 +0000 +++ b/texteditor.cpp Wed Nov 25 10:58:21 2009 +0000 @@ -64,11 +64,11 @@ varFont.fromString( settings.value ("/satellite/noteeditor/fonts/varFont", - "Nimbus Sans l,14,-1,5,48,0,0,0,0,0").toString() + "Nimbus Sans l,10,-1,5,48,0,0,0,0,0").toString() ); fixedFont.fromString (settings.value( "/satellite/noteeditor/fonts/fixedFont", - "Courier,12,-1,5,48,0,0,0,1,0").toString() + "Courier,10-1,5,48,0,0,0,1,0").toString() ); QString s=settings.value ("/satellite/noteeditor/fonts/fonthintDefault","variable").toString(); if (s == "fixed") diff -r 2a33304714ba -r f9f7922989d8 version.h --- a/version.h Tue Nov 17 08:24:59 2009 +0000 +++ b/version.h Wed Nov 25 10:58:21 2009 +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 "2009-11-16" +#define __VYM_BUILD_DATE "2009-11-24" bool checkVersion(const QString &); diff -r 2a33304714ba -r f9f7922989d8 vymmodel.cpp --- a/vymmodel.cpp Tue Nov 17 08:24:59 2009 +0000 +++ b/vymmodel.cpp Wed Nov 25 10:58:21 2009 +0000 @@ -53,7 +53,7 @@ VymModel::VymModel() { -// cout << "Const VymModel\n"; + //cout << "Const VymModel\n"; init(); rootItem->setModel (this); } @@ -61,7 +61,7 @@ VymModel::~VymModel() { - cout << "Destr VymModel\n"; + //cout << "Destr VymModel\n"; autosaveTimer->stop(); fileChangedTimer->stop(); clear(); @@ -3233,6 +3233,21 @@ deleteChildren(); } ///////////////////////////////////////////////////////////////////// + } else if (com=="exportAO") + { + QString fname=""; + ok=true; + if (parser.parCount()>=1) + // Hey, we even have a filename + fname=parser.parString(ok,0); + if (!ok) + { + parser.setError (Aborted,"Could not read filename"); + } else + { + exportAO (fname,false); + } + ///////////////////////////////////////////////////////////////////// } else if (com=="exportASCII") { QString fname=""; @@ -3982,7 +3997,7 @@ return returnValue; } -void VymModel::runScript (QString script) +QVariant VymModel::runScript (const QString &script) { parser.setScript (script); parser.runScript(); @@ -3995,6 +4010,7 @@ if (!noErr) //FIXME-3 need dialog box here cout << "VM::runScript aborted:\n"<setFocus(); } -void VymView::changeSelection (const QItemSelection &newsel, const QItemSelection &oldsel) +void VymView::changeSelection (const QItemSelection &newsel, const QItemSelection &oldsel) { - // Notify mainwindow to update satellites like NoteEditor, if needed (model==currenModel...) - mainWindow->changeSelection (model,newsel,oldsel); // FIXME-5 maybe connect VymModel <-> MainWindow directly? - // would require to also get current model in mainWindow + //cout << "VV::changeSelection newsel.count="<