mainwindow.cpp
changeset 802 f076fdec767d
parent 800 959bd133cd1a
child 803 338ebdc9b947
     1.1 --- a/mainwindow.cpp	Fri Oct 02 09:40:57 2009 +0000
     1.2 +++ b/mainwindow.cpp	Fri Oct 02 13:24:55 2009 +0000
     1.3 @@ -138,10 +138,6 @@
     1.4  	connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag()));
     1.5  	connect (textEditor, SIGNAL (windowClosed() ), this, SLOT (updateActions()));
     1.6  
     1.7 -	// Connect HistoryWindow, so that we can update flags
     1.8 -	connect (historyWindow, SIGNAL (windowClosed() ), this, SLOT (updateActions()));
     1.9 -
    1.10 -
    1.11  	// Initialize script editor
    1.12  	scriptEditor = new SimpleScriptEditor();
    1.13  	scriptEditor->move (50,50);
    1.14 @@ -1066,7 +1062,7 @@
    1.15      a = new QAction(tr( "Antialiasing","View action" ),this );
    1.16  	a->setStatusTip ( tr( "Antialiasing" ));
    1.17  	a->setToggleAction(true);
    1.18 -	a->setOn (settings.value("/mainwindow/view/AntiAlias",true).toBool());
    1.19 +	a->setChecked (settings.value("/mainwindow/view/AntiAlias",true).toBool());
    1.20  	viewMenu->addAction (a);
    1.21      connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleAntiAlias() ) );
    1.22  	actionViewToggleAntiAlias=a;
    1.23 @@ -1074,7 +1070,7 @@
    1.24      a = new QAction(tr( "Smooth pixmap transformations","View action" ),this );
    1.25  	a->setStatusTip (a->text());
    1.26  	a->setToggleAction(true);
    1.27 -	a->setOn (settings.value("/mainwindow/view/SmoothPixmapTransformation",true).toBool());
    1.28 +	a->setChecked (settings.value("/mainwindow/view/SmoothPixmapTransformation",true).toBool());
    1.29  	viewMenu->addAction (a);
    1.30      connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleSmoothPixmap() ) );
    1.31  	actionViewToggleSmoothPixmapTransform=a;
    1.32 @@ -1108,7 +1104,7 @@
    1.33      a->setStatusTip ( tr( "Use modifier to color branches" ));
    1.34  	a->setToggleAction(true);
    1.35  	a->addTo (tb);
    1.36 -	a->setOn(true);
    1.37 +	a->setChecked(true);
    1.38  	actionModModeColor=a;
    1.39  	
    1.40      a= new QAction( QPixmap(iconPath+"modecopy.png"), tr( "Use modifier to copy","Mode modifier" ), actionGroupModModes );
    1.41 @@ -1399,7 +1395,7 @@
    1.42      a = new QAction( tr( "Autosave","Settings action"), this);
    1.43      a->setStatusTip( tr( "Autosave"));
    1.44  	a->setToggleAction(true);
    1.45 -	a->setOn ( settings.value ("/mainwindow/autosave/use",false).toBool());
    1.46 +	a->setChecked ( settings.value ("/mainwindow/autosave/use",false).toBool());
    1.47      connect( a, SIGNAL( triggered() ), this, SLOT( settingsAutosaveToggle() ) );
    1.48  	settingsMenu->addAction (a);
    1.49  	actionSettingsAutosaveToggle=a;
    1.50 @@ -1413,7 +1409,7 @@
    1.51      a = new QAction( tr( "Write backup file on save","Settings action"), this);
    1.52      a->setStatusTip( tr( "Write backup file on save"));
    1.53  	a->setToggleAction(true);
    1.54 -	a->setOn ( settings.value ("/mainwindow/writeBackupFile",false).toBool());
    1.55 +	a->setChecked ( settings.value ("/mainwindow/writeBackupFile",false).toBool());
    1.56      connect( a, SIGNAL( triggered() ), this, SLOT( settingsWriteBackupFileToggle() ) );
    1.57  	settingsMenu->addAction (a);
    1.58  	actionSettingsWriteBackupFile=a;
    1.59 @@ -1423,28 +1419,28 @@
    1.60      a = new QAction( tr( "Edit branch after adding it","Settings action" ), this );
    1.61      a->setStatusTip( tr( "Edit branch after adding it" ));
    1.62  	a->setToggleAction(true);
    1.63 -	a->setOn ( settings.value ("/mapeditor/editmode/autoEditNewBranch",true).toBool());
    1.64 +	a->setChecked ( settings.value ("/mapeditor/editmode/autoEditNewBranch",true).toBool());
    1.65  	settingsMenu->addAction (a);
    1.66  	actionSettingsAutoEditNewBranch=a;
    1.67  
    1.68      a= new QAction( tr( "Select branch after adding it","Settings action" ), this );
    1.69      a->setStatusTip( tr( "Select branch after adding it" ));
    1.70  	a->setToggleAction(true);
    1.71 -	a->setOn ( settings.value ("/mapeditor/editmode/autoSelectNewBranch",false).toBool() );
    1.72 +	a->setChecked ( settings.value ("/mapeditor/editmode/autoSelectNewBranch",false).toBool() );
    1.73  	settingsMenu->addAction (a);
    1.74  	actionSettingsAutoSelectNewBranch=a;
    1.75  	
    1.76      a= new QAction(tr( "Select existing heading","Settings action" ), this);
    1.77      a->setStatusTip( tr( "Select heading before editing" ));
    1.78  	a->setToggleAction(true);
    1.79 -	a->setOn ( settings.value ("/mapeditor/editmode/autoSelectText",true).toBool() );
    1.80 +	a->setChecked ( settings.value ("/mapeditor/editmode/autoSelectText",true).toBool() );
    1.81  	settingsMenu->addAction (a);
    1.82  	actionSettingsAutoSelectText=a;
    1.83  	
    1.84      a= new QAction( tr( "Delete key","Settings action" ), this);
    1.85      a->setStatusTip( tr( "Delete key for deleting branches" ));
    1.86  	a->setToggleAction(true);
    1.87 -	a->setOn ( settings.value ("/mapeditor/editmode/useDelKey",true).toBool() );
    1.88 +	a->setChecked ( settings.value ("/mapeditor/editmode/useDelKey",true).toBool() );
    1.89  	settingsMenu->addAction (a);
    1.90      connect( a, SIGNAL( triggered() ), this, SLOT( settingsToggleDelKey() ) );
    1.91  	actionSettingsUseDelKey=a;
    1.92 @@ -1452,21 +1448,21 @@
    1.93      a= new QAction( tr( "Exclusive flags","Settings action" ), this);
    1.94      a->setStatusTip( tr( "Use exclusive flags in flag toolbars" ));
    1.95  	a->setToggleAction(true);
    1.96 -	a->setOn ( settings.value ("/mapeditor/editmode/useFlagGroups",true).toBool() );
    1.97 +	a->setChecked ( settings.value ("/mapeditor/editmode/useFlagGroups",true).toBool() );
    1.98  	settingsMenu->addAction (a);
    1.99  	actionSettingsUseFlagGroups=a;
   1.100  	
   1.101      a= new QAction( tr( "Use hide flags","Settings action" ), this);
   1.102      a->setStatusTip( tr( "Use hide flag during exports " ));
   1.103  	a->setToggleAction(true);
   1.104 -	a->setOn ( settings.value ("/export/useHideExport",true).toBool() );
   1.105 +	a->setChecked ( settings.value ("/export/useHideExport",true).toBool() );
   1.106  	settingsMenu->addAction (a);
   1.107  	actionSettingsUseHideExport=a;
   1.108  
   1.109      a = new QAction( tr( "Animation","Settings action"), this);
   1.110      a->setStatusTip( tr( "Animation"));
   1.111  	a->setToggleAction(true);
   1.112 -	a->setOn (settings.value("/animation/use",false).toBool() );
   1.113 +	a->setChecked (settings.value("/animation/use",true).toBool() );
   1.114      connect( a, SIGNAL( triggered() ), this, SLOT( settingsToggleAnimation() ) );
   1.115  	settingsMenu->addAction (a);
   1.116  	actionSettingsUseAnimation=a;
   1.117 @@ -2992,7 +2988,7 @@
   1.118  	if (m)
   1.119      {
   1.120  		m->setMapLinkStyle("StyleLine");
   1.121 -        actionFormatLinkStyleLine->setOn(true);
   1.122 +        actionFormatLinkStyleLine->setChecked(true);
   1.123      }
   1.124  }
   1.125  
   1.126 @@ -3002,7 +2998,7 @@
   1.127  	if (m)
   1.128      {
   1.129  		m->setMapLinkStyle("StyleParabel");
   1.130 -        actionFormatLinkStyleParabel->setOn(true);
   1.131 +        actionFormatLinkStyleParabel->setChecked(true);
   1.132      }
   1.133  }
   1.134  
   1.135 @@ -3012,7 +3008,7 @@
   1.136  	if (m)
   1.137      {
   1.138  		m->setMapLinkStyle("StylePolyLine");
   1.139 -        actionFormatLinkStylePolyLine->setOn(true);
   1.140 +        actionFormatLinkStylePolyLine->setChecked(true);
   1.141      }
   1.142  }
   1.143  
   1.144 @@ -3022,7 +3018,7 @@
   1.145  	if (m)
   1.146      {
   1.147  		m->setMapLinkStyle("StylePolyParabel");
   1.148 -        actionFormatLinkStylePolyParabel->setOn(true);
   1.149 +        actionFormatLinkStylePolyParabel->setChecked(true);
   1.150      }
   1.151  }
   1.152  
   1.153 @@ -3327,6 +3323,11 @@
   1.154  
   1.155  void Main::updateActions()
   1.156  {
   1.157 +	// updateActions is also called when satellites are closed	//FIXME-2 doesn't update immediatly, e.g. historyWindow is still visible, when "close" is pressed
   1.158 +	actionViewToggleNoteEditor->setChecked (textEditor->isVisible());
   1.159 +	actionViewToggleHistoryWindow->setChecked (historyWindow->isVisible());
   1.160 +	actionViewTogglePropertyWindow->setChecked (branchPropertyWindow->isVisible());
   1.161 +
   1.162  	VymModel  *m =currentModel();
   1.163  	if (m) 
   1.164  	{
   1.165 @@ -3337,16 +3338,16 @@
   1.166  		switch (m->getMapLinkStyle())
   1.167  		{
   1.168  			case LinkableMapObj::Line: 
   1.169 -				actionFormatLinkStyleLine->setOn(true);
   1.170 +				actionFormatLinkStyleLine->setChecked(true);
   1.171  				break;
   1.172  			case LinkableMapObj::Parabel:
   1.173 -				actionFormatLinkStyleParabel->setOn(true);
   1.174 +				actionFormatLinkStyleParabel->setChecked(true);
   1.175  				break;
   1.176  			case LinkableMapObj::PolyLine:	
   1.177 -				actionFormatLinkStylePolyLine->setOn(true);
   1.178 +				actionFormatLinkStylePolyLine->setChecked(true);
   1.179  				break;
   1.180  			case LinkableMapObj::PolyParabel:	
   1.181 -				actionFormatLinkStylePolyParabel->setOn(true);
   1.182 +				actionFormatLinkStylePolyParabel->setChecked(true);
   1.183  				break;
   1.184  			default:
   1.185  				break;
   1.186 @@ -3370,15 +3371,10 @@
   1.187  		actionFilePrint->setEnabled (false);
   1.188  	}
   1.189  
   1.190 -	// updateActions is also called when NoteEditor is closed
   1.191 -	actionViewToggleNoteEditor->setOn (textEditor->isVisible());
   1.192 -	actionViewToggleHistoryWindow->setOn (historyWindow->isVisible());
   1.193 -	actionViewTogglePropertyWindow->setOn (branchPropertyWindow->isVisible());
   1.194 -
   1.195  	if (m && m->getMapLinkColorHint()==LinkableMapObj::HeadingColor) 
   1.196 -		actionFormatLinkColorHint->setOn(true);
   1.197 +		actionFormatLinkColorHint->setChecked(true);
   1.198  	else	
   1.199 -		actionFormatLinkColorHint->setOn(false);
   1.200 +		actionFormatLinkColorHint->setChecked(false);
   1.201  
   1.202  
   1.203  	if (m && m->hasChanged() )
   1.204 @@ -3403,7 +3399,7 @@
   1.205  		{
   1.206  			if (selbi || selti->getType()==TreeItem::Image)
   1.207  			{
   1.208 -				actionFormatHideLinkUnselected->setOn (((MapItem*)selti)->getHideLinkUnselected());
   1.209 +				actionFormatHideLinkUnselected->setChecked (((MapItem*)selti)->getHideLinkUnselected());
   1.210  				actionFormatHideLinkUnselected->setEnabled (true);
   1.211  			}
   1.212  
   1.213 @@ -3435,9 +3431,9 @@
   1.214  				// System Flags
   1.215  				actionToggleScroll->setEnabled (true);
   1.216  				if ( selbi->isScrolled() )
   1.217 -					actionToggleScroll->setOn(true);
   1.218 +					actionToggleScroll->setChecked(true);
   1.219  				else	
   1.220 -					actionToggleScroll->setOn(false);
   1.221 +					actionToggleScroll->setChecked(false);
   1.222  
   1.223  				if ( selti->getURL().isEmpty() )
   1.224  				{
   1.225 @@ -3471,7 +3467,7 @@
   1.226  				actionSortChildren->setEnabled (true);
   1.227  
   1.228  				actionToggleHideExport->setEnabled (true);	
   1.229 -				actionToggleHideExport->setOn (selbi->hideInExport() );	
   1.230 +				actionToggleHideExport->setChecked (selbi->hideInExport() );	
   1.231  
   1.232  				actionCopy->setEnabled (true);	
   1.233  				actionCut->setEnabled (true);	
   1.234 @@ -3489,7 +3485,7 @@
   1.235  				actionOpenVymLink->setEnabled (false);
   1.236  				actionDeleteVymLink->setEnabled (false);	
   1.237  				actionToggleHideExport->setEnabled (true);	
   1.238 -				actionToggleHideExport->setOn (selti->hideInExport() );	
   1.239 +				actionToggleHideExport->setChecked (selti->hideInExport() );	
   1.240  
   1.241  
   1.242  				actionCopy->setEnabled (true);
   1.243 @@ -3547,14 +3543,14 @@
   1.244  {
   1.245  	textEditor->setShowWithMain(true);
   1.246  	textEditor->show();
   1.247 -	actionViewToggleNoteEditor->setOn (true);
   1.248 +	actionViewToggleNoteEditor->setChecked (true);
   1.249  }
   1.250  
   1.251  void Main::windowHideNoteEditor()
   1.252  {
   1.253  	textEditor->setShowWithMain(false);
   1.254  	textEditor->hide();
   1.255 -	actionViewToggleNoteEditor->setOn (false);
   1.256 +	actionViewToggleNoteEditor->setChecked (false);
   1.257  }
   1.258  
   1.259  void Main::setScript (const QString &script)