# HG changeset patch # User insilmaril # Date 1259162842 0 # Node ID b163492fda1732f324eb7a831c7edfc52f696d22 # Parent f9f7922989d8b35c37cf5e0f3cd34acdf63762d2 First version of new FindWidget instead of extra floating dialog diff -r f9f7922989d8 -r b163492fda17 findwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/findwidget.cpp Wed Nov 25 15:27:22 2009 +0000 @@ -0,0 +1,66 @@ +#include +#include +#include + +#include "findwidget.h" + + +extern QString vymName; + +FindWidget::FindWidget(QWidget* parent) +{ + QVBoxLayout* mainLayout = new QVBoxLayout; + QHBoxLayout *row2Layout = new QHBoxLayout; + + // Create Buttons + cancelbutton = new QPushButton; + cancelbutton->setText(tr("Cancel")); + cancelbutton->setShortcut (Qt::Key_Escape); + connect ( cancelbutton, SIGNAL( clicked() ), this, SLOT( cancelPressed() ) ); + + // Create LineEdit (here QComboBox) + findcombo = new QComboBox; + findcombo->setMinimumWidth(250); + findcombo->setEditable(true); + connect ( findcombo, SIGNAL( highlighted(int) ), + this, SLOT( nextPressed() ) ); + connect ( findcombo, SIGNAL( textChanged(const QString &) ), + this, SLOT( findTextChanged(const QString&) ) ); + + nextbutton = new QPushButton; + nextbutton->setText (tr("Next","Find widget")); + //nextbutton->setDefault (true); + //nextbutton->setShortcut (Qt::Key_Return); + connect ( nextbutton, SIGNAL( clicked() ), this, SLOT( nextPressed() ) ); + + row2Layout->addWidget (cancelbutton); + row2Layout->addWidget(findcombo); + row2Layout->addWidget(nextbutton); + + mainLayout->addLayout (row2Layout); + + setLayout (mainLayout); +} + +void FindWidget::popup() +{ + show(); + findcombo->lineEdit()->selectAll(); + findcombo->setFocus(); +} + +void FindWidget::cancelPressed() +{ + hide(); +} + +void FindWidget::nextPressed() +{ + emit (nextButton(findcombo->currentText() ) ); +} + +void FindWidget::findTextChanged(const QString&) +{ + emit (somethingChanged() ); +} + diff -r f9f7922989d8 -r b163492fda17 findwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/findwidget.h Wed Nov 25 15:27:22 2009 +0000 @@ -0,0 +1,36 @@ +#ifndef FINDWIDGET_H +#define FINDWIDGET_H + +#include +#include +#include +#include +#include + + +class FindWidget: public QWidget +{ + Q_OBJECT + +public: + FindWidget (QWidget* parent=0); + +public slots: + void popup(); + void cancelPressed(); + void nextPressed(); + void findTextChanged(const QString&); + +signals: + void nextButton(QString); + void somethingChanged(); + +private: + QGroupBox *findbox; + QComboBox *findcombo; + QPushButton *nextbutton; + QPushButton *cancelbutton; +}; + +#endif + diff -r f9f7922989d8 -r b163492fda17 mainwindow.cpp --- a/mainwindow.cpp Wed Nov 25 10:58:21 2009 +0000 +++ b/mainwindow.cpp Wed Nov 25 15:27:22 2009 +0000 @@ -32,10 +32,10 @@ // clashes with the one in Win32 API. typedef struct _PROCESS_INFORMATION { -long hProcess; -long hThread; -long dwProcessId; -long dwThreadId; + long hProcess; + long hThread; + long dwProcessId; + long dwThreadId; } PROCESS_INFORMATION, *LPPROCESS_INFORMATION; #endif @@ -83,1769 +83,1759 @@ Main::Main(QWidget* parent, const char* name, Qt::WFlags f) : QMainWindow(parent,name,f) { -mainWindow=this; - -setCaption ("VYM - View Your Mind"); - -// Load window settings -#if defined(Q_OS_WIN32) -if (settings.value("/mainwindow/geometry/maximized", false).toBool()) -{ - setWindowState(Qt::WindowMaximized); -} -else -#endif -{ - 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(); - + mainWindow=this; + + setCaption ("VYM - View Your Mind"); + + // Load window settings + #if defined(Q_OS_WIN32) + if (settings.value("/mainwindow/geometry/maximized", false).toBool()) + { + setWindowState(Qt::WindowMaximized); + } + else + #endif + { + 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 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_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(); + #if defined(Q_OS_MACX) + s=settings.value (p,"/usr/bin/open").toString(); + #else - s=settings.value (p,"mozilla").toString(); + #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 #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(); - #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(); + settings.setValue( p,s); + + // application to open PDFs + p="/mainwindow/readerPDF"; + #if defined(Q_OS_LINUX) + s=settings.value (p,"xdg-open").toString(); #else - s=settings.value (p,"acroread").toString(); + #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 #endif - #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(); + 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 -#if defined(Q_OS_WIN32) -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)); + // Save Settings + #if defined(Q_OS_WIN32) + 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)); } 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"))); -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" ) )); + 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( 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() ) ); + 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 (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( editOpenFindWidget() ) ); + + 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); -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); - + QAction*a; + + // Context Menu for branch or mapcenter + branchContextMenu =new QMenu (this); + branchContextMenu->addAction (actionViewTogglePropertyWindow); 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() ) + + // 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 * ) ) ); + + + // 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) { - 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 * ) ) ); - - -// 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(); + 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; - -///////////////////////////////////// -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:"); + 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:"); } void Main::fileNewCopy() { -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); -} + 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) + 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) { - if (vymViews.at(i)->getModel()->getFilePath() == fn) + // Check, if map is already loaded + int i=0; + while (i<=tabWidget->count() -1) { - // 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() ) + if (vymViews.at(i)->getModel()->getFilePath() == fn) { - case QMessageBox::Yes: - // end loop and load anyway - i=tabWidget->count(); - break; - case QMessageBox::Cancel: - // do nothing - return aborted; - break; + // 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++; } - i++; } -} - -int tabIndex=tabWidget->currentPageIndex(); + + int tabIndex=tabWidget->currentPageIndex(); // Try to load map if ( !fn.isEmpty() ) @@ -2489,35 +2479,10 @@ if (m) m->cut(); } -void Main::editOpenFindWindow() -{ - findWindow->popup(); - findWindow->raise(); - findWindow->setActiveWindow(); -} - -void Main::editFind(QString s) +void Main::editOpenFindWidget() { VymModel *m=currentModel(); - if (m) - { - bool cs=false; - BranchItem *bi=m->findText(s, cs); - if (bi) - { - statusBar()->message( "Found: " + bi->getHeading(), statusbarTime ); - } else - { - QMessageBox::information( findWindow, tr( "VYM -Information:" ), - tr("No matches found for \"%1\"").arg(s)); - } - } -} - -void Main::editFindChanged() -{ // Notify editor, to abort the current find process - VymModel *m=currentModel(); - if (m) m->findReset(); + if (m) m->emitShowFindWidget(); } void Main::openTabs(QStringList urls) diff -r f9f7922989d8 -r b163492fda17 mainwindow.h --- a/mainwindow.h Wed Nov 25 10:58:21 2009 +0000 +++ b/mainwindow.h Wed Nov 25 15:27:22 2009 +0000 @@ -9,7 +9,6 @@ #include "extrainfodialog.h" #include "flag.h" #include "file.h" -#include "findwindow.h" #include "historywindow.h" #include "mapeditor.h" #include "simplescripteditor.h" @@ -117,9 +116,7 @@ void editCopy(); void editPaste(); void editCut(); - void editOpenFindWindow(); - void editFind(QString); - void editFindChanged(); + void editOpenFindWidget(); private: void openTabs(QStringList); public slots: @@ -248,7 +245,6 @@ private: QTabWidget *tabWidget; - FindWindow *findWindow; QProcess *procBrowser; //FIXME-2 remove this... qint64 *browserPID; diff -r f9f7922989d8 -r b163492fda17 version.h --- a/version.h Wed Nov 25 10:58:21 2009 +0000 +++ b/version.h Wed Nov 25 15:27:22 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-24" +#define __VYM_BUILD_DATE "2009-11-25" bool checkVersion(const QString &); diff -r f9f7922989d8 -r b163492fda17 vym.pro --- a/vym.pro Wed Nov 25 10:58:21 2009 +0000 +++ b/vym.pro Wed Nov 25 15:27:22 2009 +0000 @@ -48,7 +48,7 @@ exports.h \ extrainfodialog.h \ file.h \ - findwindow.h \ + findwidget.h \ flag.h \ flagobj.h \ flagrowobj.h \ @@ -113,7 +113,7 @@ exportxhtmldialog.cpp \ extrainfodialog.cpp \ file.cpp \ - findwindow.cpp \ + findwidget.cpp \ flag.cpp \ flagobj.cpp \ flagrow.cpp \ diff -r f9f7922989d8 -r b163492fda17 vymmodel.cpp --- a/vymmodel.cpp Wed Nov 25 10:58:21 2009 +0000 +++ b/vymmodel.cpp Wed Nov 25 15:27:22 2009 +0000 @@ -1630,6 +1630,11 @@ EOFind=false; } +void VymModel::emitShowFindWidget() +{ + emit (showFindWidget()); +} + void VymModel::setScene (QGraphicsScene *s) { mapScene=s; diff -r f9f7922989d8 -r b163492fda17 vymmodel.h --- a/vymmodel.h Wed Nov 25 10:58:21 2009 +0000 +++ b/vymmodel.h Wed Nov 25 15:27:22 2009 +0000 @@ -265,7 +265,11 @@ public: BranchItem* findText(QString,bool); // Find object void findReset(); // Reset Search + void emitShowFindWidget(); // Tell views to show FindWidget +signals: + void showFindWidget(); +public: void setURL(const QString &url); QString getURL(); // returns URL of selection or "" QStringList getURLs(); // returns URLs of subtree diff -r f9f7922989d8 -r b163492fda17 vymview.cpp --- a/vymview.cpp Wed Nov 25 10:58:21 2009 +0000 +++ b/vymview.cpp Wed Nov 25 15:27:22 2009 +0000 @@ -4,6 +4,7 @@ using namespace std; #include "branchitem.h" +#include "findwidget.h" #include "mainwindow.h" #include "mapeditor.h" #include "treeeditor.h" @@ -15,6 +16,9 @@ { model=m; + // Create findWidget + findWidget=new FindWidget (this); + // Create TreeView treeEditor=new TreeEditor (model); //treeEditor->setModel ((QAbstractItemModel*)model); @@ -34,6 +38,18 @@ mapEditor=model->getMapEditor(); if (!mapEditor) mapEditor=new MapEditor (model); + // Create Layout + QVBoxLayout* mainLayout = new QVBoxLayout (this); + QSplitter *splitter= new QSplitter; + + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + //sizePolicy.setHorizontalStretch(0); + //sizePolicy.setVerticalStretch(0); + //sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth()); + splitter->setSizePolicy(sizePolicy); + mainLayout->addWidget (splitter); + mainLayout->addWidget (findWidget); + // Connect selections // Proxymodel changed @@ -89,18 +105,27 @@ model, SIGNAL (showSelection() ), this, SLOT (showSelection() ) ); + // Find + connect ( + model, SIGNAL (showFindWidget() ), + this, SLOT (showFindWidget() ) ); + + connect ( + findWidget, SIGNAL (nextButton (QString) ), + this, SLOT (findNext(QString) ) ); + mapEditor->setAntiAlias (mainWindow->isAliased()); mapEditor->setSmoothPixmap(mainWindow->hasSmoothPixmapTransform()); - addWidget (treeEditor); - addWidget (mapEditor); + splitter->addWidget (treeEditor); + splitter->addWidget (mapEditor); // Set geometry QList widths; widths<<200; widths<<600; - setSizes(widths); + splitter->setSizes(widths); } VymView::~VymView() @@ -262,3 +287,24 @@ mapEditor->scrollTo ( ix); // FIXME-3 also called from MapEditor::updateSelection... } +void VymView::showFindWidget() +{ + findWidget->show(); +} + +void VymView::findNext (QString s) +{ + bool cs=false; + BranchItem *bi=model->findText(s, cs); + if (bi) + { + //statusBar()->message( "Found: " + bi->getHeading(), statusbarTime ); + cout << "VV::Found!\n"; + } else + { + cout << "VV::Nothing found!\n"; + //QMessageBox::information( findWindow, tr( "VYM -Information:" ), + // tr("No matches found for \"%1\"").arg(s)); + } + +} diff -r f9f7922989d8 -r b163492fda17 vymview.h --- a/vymview.h Wed Nov 25 10:58:21 2009 +0000 +++ b/vymview.h Wed Nov 25 15:27:22 2009 +0000 @@ -2,16 +2,16 @@ #define VYMVIEW_H #include -#include - +#include class VymModel; class MapEditor; class TreeEditor; +class FindWidget; class QTreeView; -class VymView : public QSplitter +class VymView:public QWidget { Q_OBJECT public: @@ -28,6 +28,8 @@ void expandOneLevel (); void collapseOneLevel (); void showSelection (); + void showFindWidget(); + void findNext (QString s); private: VymModel *model; @@ -35,6 +37,7 @@ QItemSelectionModel *proxySelModel; QItemSelectionModel *selModel; MapEditor *mapEditor; + FindWidget *findWidget; };