diff -r 62d621e3e550 -r 5ecd0462f76b mainwindow.cpp --- a/mainwindow.cpp Mon Mar 15 15:32:37 2010 +0000 +++ b/mainwindow.cpp Thu Mar 18 11:31:02 2010 +0000 @@ -272,6 +272,7 @@ settings.setValue( "/version/builddate", vymBuildDate ); settings.setValue( "/mainwindow/autosave/use",actionSettingsAutosaveToggle->isOn() ); + settings.setValue ("/mainwindow/autoLayout/use",actionSettingsAutoLayoutToggle->isOn() ); settings.setValue( "/mapeditor/editmode/autoSelectNewBranch",actionSettingsAutoSelectNewBranch->isOn() ); settings.setValue( "/mainwindow/writeBackupFile",actionSettingsWriteBackupFile->isOn() ); settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoSelectText->isOn() ); @@ -666,16 +667,6 @@ // 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); - switchboard.addConnection(a,tr("Edit","Shortcut group")); - 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 @@ -684,6 +675,7 @@ addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBefore() ) ); actionListBranches.append(a); + actionAddBranchBefore=a; // Add branch above a = new QAction(tr( "Add branch above","Edit menu" ), this); @@ -1214,7 +1206,7 @@ a = new QAction( QPixmap(iconPath+"viewshowsel.png"), tr( "Show selection","View action" ), this); a->setStatusTip (tr( "Show selection" )); - a->setShortcut(Qt::CTRL + Qt::Key_Period); + a->setShortcut(Qt::Key_Period); switchboard.addConnection(a,tr("View shortcuts","Shortcut group")); a->addTo( tb ); viewMenu->addAction (a); @@ -1332,28 +1324,25 @@ // Create System Flags QToolBar *tb=NULL; - Flag *flag=new Flag;; - flag->setVisible(true); - - flag->load(flagsPath+"flag-note.png"); + Flag *flag=new Flag(flagsPath+"flag-note.png"); setupFlag (flag,tb,"system-note",tr("Note","SystemFlag")); - flag->load(flagsPath+"flag-url.png"); + flag=new Flag(flagsPath+"flag-url.png"); setupFlag (flag,tb,"system-url",tr("URL to Document ","SystemFlag")); - flag->load(flagsPath+"flag-url-bugzilla-novell.png"); + flag=new Flag(flagsPath+"flag-url-bugzilla-novell.png"); setupFlag (flag,tb,"system-url-bugzilla-novell",tr("URL to Bugzilla ","SystemFlag")); - flag->load(flagsPath+"flag-vymlink.png"); + flag=new Flag(flagsPath+"flag-vymlink.png"); setupFlag (flag,tb,"system-vymLink",tr("Link to another vym map","SystemFlag")); - flag->load(flagsPath+"flag-scrolled-right.png"); + flag=new Flag(flagsPath+"flag-scrolled-right.png"); setupFlag (flag,tb,"system-scrolledright",tr("subtree is scrolled","SystemFlag")); - flag->load(flagsPath+"flag-tmpUnscrolled-right.png"); + flag=new Flag(flagsPath+"flag-tmpUnscrolled-right.png"); setupFlag (flag,tb,"system-tmpUnscrolledRight",tr("subtree is temporary scrolled","SystemFlag")); - flag->load(flagsPath+"flag-hideexport.png"); + flag=new Flag(flagsPath+"flag-hideexport.png"); setupFlag (flag,tb,"system-hideInExport",tr("Hide object in exported maps","SystemFlag")); // Create Standard Flags @@ -1361,170 +1350,189 @@ tb->setObjectName ("standardFlagTB"); standardFlagsMaster->setToolBar (tb); - flag->load(flagsPath+"flag-exclamationmark.png"); + flag=new Flag(flagsPath+"flag-exclamationmark.png"); flag->setGroup("standard-mark"); setupFlag (flag,tb,"exclamationmark",tr("Take care!","Standardflag")); - flag->load(flagsPath+"flag-questionmark.png"); + flag=new Flag(flagsPath+"flag-questionmark.png"); flag->setGroup("standard-mark"); setupFlag (flag,tb,"questionmark",tr("Really?","Standardflag")); - flag->load(flagsPath+"flag-hook-green.png"); + flag=new Flag(flagsPath+"flag-hook-green.png"); flag->setGroup("standard-status"); setupFlag (flag,tb,"hook-green",tr("Status - ok,done","Standardflag")); - flag->load(flagsPath+"flag-wip.png"); + flag=new Flag(flagsPath+"flag-wip.png"); flag->setGroup("standard-status"); setupFlag (flag,tb,"wip",tr("Status - work in progress","Standardflag")); - flag->load(flagsPath+"flag-cross-red.png"); + flag=new Flag(flagsPath+"flag-cross-red.png"); flag->setGroup("standard-status"); setupFlag (flag,tb,"cross-red",tr("Status - missing, not started","Standardflag")); flag->unsetGroup(); - flag->load(flagsPath+"flag-stopsign.png"); + flag=new Flag(flagsPath+"flag-stopsign.png"); setupFlag (flag,tb,"stopsign",tr("This won't work!","Standardflag")); - flag->load(flagsPath+"flag-smiley-good.png"); + flag=new Flag(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=new Flag(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=new Flag(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"); + flag=new Flag(flagsPath+"flag-kalarm.png"); setupFlag (flag,tb,"clock",tr("Time critical","Standardflag")); - flag->load(flagsPath+"flag-phone.png"); + flag=new Flag(flagsPath+"flag-phone.png"); setupFlag (flag,tb,"phone",tr("Call...","Standardflag")); - flag->load(flagsPath+"flag-lamp.png"); + flag=new Flag(flagsPath+"flag-lamp.png"); setupFlag (flag,tb,"lamp",tr("Idea!","Standardflag")); - flag->load(flagsPath+"flag-arrow-up.png"); + flag=new Flag(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=new Flag(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=new Flag(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=new Flag(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=new Flag(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=new Flag(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"); + flag=new Flag(flagsPath+"flag-rose.png"); setupFlag (flag,tb,"rose",tr("Rose","Standardflag")); - flag->load(flagsPath+"flag-heart.png"); + flag=new Flag(flagsPath+"flag-heart.png"); setupFlag (flag,tb,"heart",tr("I just love...","Standardflag")); - flag->load(flagsPath+"flag-present.png"); + flag=new Flag(flagsPath+"flag-present.png"); setupFlag (flag,tb,"present",tr("Surprise!","Standardflag")); - flag->load(flagsPath+"flag-flash.png"); + flag=new Flag(flagsPath+"flag-flash.png"); setupFlag (flag,tb,"flash",tr("Dangerous","Standardflag")); // Original: xsldbg_output.png - flag->load(flagsPath+"flag-info.png"); + flag=new Flag(flagsPath+"flag-info.png"); setupFlag (flag,tb,"info",tr("Info","Standardflag")); // Original khelpcenter.png - flag->load(flagsPath+"flag-lifebelt.png"); + flag=new Flag(flagsPath+"flag-lifebelt.png"); setupFlag (flag,tb,"lifebelt",tr("This will help","Standardflag")); // Freemind flags + flag=new Flag(flagsPath+"freemind/warning.png"); 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)); + flag=new Flag(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"); + flag=new Flag(flagsPath+"freemind/back.png"); + flag->setVisible(false); setupFlag (flag,tb,"freemind-back",tr("Back","Freemind-Flag")); - flag->load(flagsPath+"freemind/forward.png"); + flag=new Flag(flagsPath+"freemind/forward.png"); + flag->setVisible(false); setupFlag (flag,tb,"freemind-forward",tr("forward","Freemind-Flag")); - flag->load(flagsPath+"freemind/attach.png"); + flag=new Flag(flagsPath+"freemind/attach.png"); + flag->setVisible(false); setupFlag (flag,tb,"freemind-attach",tr("Look here","Freemind-Flag")); - flag->load(flagsPath+"freemind/clanbomber.png"); + flag=new Flag(flagsPath+"freemind/clanbomber.png"); + flag->setVisible(false); setupFlag (flag,tb,"freemind-clanbomber",tr("Dangerous","Freemind-Flag")); - flag->load(flagsPath+"freemind/desktopnew.png"); + flag=new Flag(flagsPath+"freemind/desktopnew.png"); + flag->setVisible(false); setupFlag (flag,tb,"freemind-desktopnew",tr("Don't flagrget","Freemind-Flag")); - flag->load(flagsPath+"freemind/flag.png"); + flag=new Flag(flagsPath+"freemind/flag.png"); + flag->setVisible(false); setupFlag (flag,tb,"freemind-flag",tr("Flag","Freemind-Flag")); - flag->load(flagsPath+"freemind/gohome.png"); + flag=new Flag(flagsPath+"freemind/gohome.png"); + flag->setVisible(false); setupFlag (flag,tb,"freemind-gohome",tr("Home","Freemind-Flag")); - - flag->load(flagsPath+"freemind/kaddressbook.png"); + flag=new Flag(flagsPath+"freemind/kaddressbook.png"); + flag->setVisible(false); setupFlag (flag,tb,"freemind-kaddressbook",tr("Telephone","Freemind-Flag")); - flag->load(flagsPath+"freemind/knotify.png"); + flag=new Flag(flagsPath+"freemind/knotify.png"); + flag->setVisible(false); setupFlag (flag,tb,"freemind-knotify",tr("Music","Freemind-Flag")); - flag->load(flagsPath+"freemind/korn.png"); + flag=new Flag(flagsPath+"freemind/korn.png"); + flag->setVisible(false); setupFlag (flag,tb,"freemind-korn",tr("Mailbox","Freemind-Flag")); - flag->load(flagsPath+"freemind/mail.png"); + flag=new Flag(flagsPath+"freemind/mail.png"); + flag->setVisible(false); setupFlag (flag,tb,"freemind-mail",tr("Maix","Freemind-Flag")); - flag->load(flagsPath+"freemind/password.png"); + flag=new Flag(flagsPath+"freemind/password.png"); + flag->setVisible(false); setupFlag (flag,tb,"freemind-password",tr("Password","Freemind-Flag")); - flag->load(flagsPath+"freemind/pencil.png"); + flag=new Flag(flagsPath+"freemind/pencil.png"); + flag->setVisible(false); setupFlag (flag,tb,"freemind-pencil",tr("To be improved","Freemind-Flag")); - flag->load(flagsPath+"freemind/stop.png"); + flag=new Flag(flagsPath+"freemind/stop.png"); + flag->setVisible(false); setupFlag (flag,tb,"freemind-stop",tr("Stop","Freemind-Flag")); - flag->load(flagsPath+"freemind/wizard.png"); + flag=new Flag(flagsPath+"freemind/wizard.png"); + flag->setVisible(false); setupFlag (flag,tb,"freemind-wizard",tr("Magic","Freemind-Flag")); - flag->load(flagsPath+"freemind/xmag.png"); + flag=new Flag(flagsPath+"freemind/xmag.png"); + flag->setVisible(false); setupFlag (flag,tb,"freemind-xmag",tr("To be discussed","Freemind-Flag")); - flag->load(flagsPath+"freemind/bell.png"); + flag=new Flag(flagsPath+"freemind/bell.png"); + flag->setVisible(false); setupFlag (flag,tb,"freemind-bell",tr("Reminder","Freemind-Flag")); - flag->load(flagsPath+"freemind/bookmark.png"); + flag=new Flag(flagsPath+"freemind/bookmark.png"); + flag->setVisible(false); setupFlag (flag,tb,"freemind-bookmark",tr("Excellent","Freemind-Flag")); - flag->load(flagsPath+"freemind/penguin.png"); + flag= new Flag(flagsPath+"freemind/penguin.png"); + flag->setVisible(false); setupFlag (flag,tb,"freemind-penguin",tr("Linux","Freemind-Flag")); - flag->load(flagsPath+"freemind/licq.png"); + flag=new Flag (flagsPath+"freemind/licq.png"); + flag->setVisible(false); setupFlag (flag,tb,"freemind-licq",tr("Sweet","Freemind-Flag")); } @@ -1672,6 +1680,8 @@ settingsMenu->addAction (a); actionSettingsUseHideExport=a; + settingsMenu->addSeparator(); + a = new QAction( tr( "Animation","Settings action"), this); a->setStatusTip( tr( "Animation")); a->setToggleAction(true); @@ -1679,6 +1689,15 @@ connect( a, SIGNAL( triggered() ), this, SLOT( settingsToggleAnimation() ) ); settingsMenu->addAction (a); actionSettingsUseAnimation=a; + + a = new QAction( tr( "Automatic layout","Settings action"), this); + a->setStatusTip( tr( "Automatic layout")); + a->setToggleAction(true); + a->setChecked ( settings.value ("/mainwindow/autoLayout/use",true).toBool()); + connect( a, SIGNAL( triggered() ), this, SLOT( settingsAutoLayoutToggle() ) ); + settingsMenu->addAction (a); + actionSettingsAutoLayoutToggle=a; + } // Test Actions @@ -1740,8 +1759,6 @@ // Context Menus void Main::setupContextMenus() { - QAction*a; - // Context Menu for branch or mapcenter branchContextMenu =new QMenu (this); branchContextMenu->addAction (actionViewTogglePropertyWindow); @@ -1810,7 +1827,7 @@ // Context menu for floatimage floatimageContextMenu =new QMenu (this); - a= new QAction (tr ("Save image","Context action"),this); + QAction *a= new QAction (tr ("Save image","Context action"),this); connect (a, SIGNAL (triggered()), this, SLOT (editSaveImage())); floatimageContextMenu->addAction (a); @@ -3405,13 +3422,13 @@ void Main::viewZoomIn() { MapEditor *me=currentMapEditor(); - if (me) me->setZoomFactorTarget (me->getZoomFactorTarget()*1.25); + if (me) me->setZoomFactorTarget (me->getZoomFactorTarget()*1.15); } void Main::viewZoomOut() { MapEditor *me=currentMapEditor(); - if (me) me->setZoomFactorTarget (me->getZoomFactorTarget()*0.75); + if (me) me->setZoomFactorTarget (me->getZoomFactorTarget()*0.85); } void Main::viewCenter() @@ -3503,6 +3520,11 @@ settings.setValue ("/mainwindow/autosave/ms",i * 1000); } +void Main::settingsAutoLayoutToggle() +{ + settings.setValue ("/mainwindow/autoLayout/use",actionSettingsAutosaveToggle->isOn() ); +} + void Main::settingsWriteBackupFileToggle() { settings.setValue ("/mainwindow/writeBackupFile",actionSettingsWriteBackupFile->isOn() );