further speedup during load. positions of branches are saved (again)
authorinsilmaril
Thu, 30 Apr 2009 11:52:49 +0000
changeset 762ffb95cd03156
parent 761 0301e6109702
child 763 8c028a5d9083
further speedup during load. positions of branches are saved (again)
branchitem.cpp
mapcenteritem.cpp
mapitem.cpp
mapitem.h
treeitem.h
vymmodel.cpp
     1.1 --- a/branchitem.cpp	Wed Apr 29 21:40:37 2009 +0000
     1.2 +++ b/branchitem.cpp	Thu Apr 30 11:52:49 2009 +0000
     1.3 @@ -86,6 +86,7 @@
     1.4  
     1.5  	*/
     1.6      s=beginElement ("branch" 
     1.7 +		+getAttr()
     1.8  	//	+getOrnXMLAttr() 
     1.9  	//	+scrolledAttr 
    1.10  	//	+areaAttr 
     2.1 --- a/mapcenteritem.cpp	Wed Apr 29 21:40:37 2009 +0000
     2.2 +++ b/mapcenteritem.cpp	Thu Apr 30 11:52:49 2009 +0000
     2.3 @@ -57,6 +57,7 @@
     2.4  
     2.5  	*/
     2.6      s=beginElement ("mapcenter" 
     2.7 +		+getAttr()
     2.8  	//	+getOrnXMLAttr() 
     2.9  	//	+scrolledAttr 
    2.10  	//	+areaAttr 
     3.1 --- a/mapitem.cpp	Wed Apr 29 21:40:37 2009 +0000
     3.2 +++ b/mapitem.cpp	Thu Apr 30 11:52:49 2009 +0000
     3.3 @@ -56,3 +56,25 @@
     3.4  	}
     3.5  }
     3.6  
     3.7 +QString MapItem::getAttr()
     3.8 +{
     3.9 +	switch (posMode)
    3.10 +	{
    3.11 +		case Relative:	
    3.12 +			if (lmo) pos=lmo->getRelPos();
    3.13 +			return
    3.14 +				attribut("relPosX",QString().setNum(pos.x())) +
    3.15 +				attribut("relPosY",QString().setNum(pos.y())); 
    3.16 +			break;
    3.17 +		case Absolute:	
    3.18 +			if (lmo) pos=lmo->getAbsPos();
    3.19 +			return
    3.20 +				attribut("absPosX",QString().setNum(pos.x())) +
    3.21 +				attribut("absPosY",QString().setNum(pos.y())); 
    3.22 +			break;
    3.23 +		default:
    3.24 +			return QString();
    3.25 +			break;
    3.26 +	}
    3.27 +}
    3.28 +
     4.1 --- a/mapitem.h	Wed Apr 29 21:40:37 2009 +0000
     4.2 +++ b/mapitem.h	Thu Apr 30 11:52:49 2009 +0000
     4.3 @@ -3,16 +3,19 @@
     4.4  
     4.5  #include <QPointF>
     4.6  
     4.7 +#include "xmlobj.h"
     4.8 +
     4.9  class LinkableMapObj;
    4.10  
    4.11  /*! /brief MapItem is used to store information of MapObj and inherited
    4.12     classes.
    4.13   
    4.14 -	This is done even while no QGraphicsView is availabe, e.g. on a
    4.15 -	mobile device.
    4.16 +	This is done even while no QGraphicsView is availabe. This is useful
    4.17 +	if e.g. on a small device like a cellphone te full map is not used,
    4.18 +	but just a treeview instead.
    4.19  */
    4.20  
    4.21 -class MapItem
    4.22 +class MapItem: public XMLObj
    4.23  {
    4.24  protected:
    4.25  	enum PositionMode {Unused,Absolute,Relative};
    4.26 @@ -39,6 +42,9 @@
    4.27  
    4.28  	/*! Initialize LinkableMapObj with data in MapItem */
    4.29  	virtual void initLMO();
    4.30 +
    4.31 +	/*! Return data as attributes for saving in XML */
    4.32 +	virtual QString getAttr();
    4.33  };
    4.34  
    4.35  
     5.1 --- a/treeitem.h	Wed Apr 29 21:40:37 2009 +0000
     5.2 +++ b/treeitem.h	Thu Apr 30 11:52:49 2009 +0000
     5.3 @@ -14,7 +14,7 @@
     5.4  class BranchItem;
     5.5  class VymModel;
     5.6  
     5.7 -class TreeItem:public XMLObj, public MapItem
     5.8 +class TreeItem:public MapItem
     5.9  {
    5.10  public:
    5.11  	enum Type {Undefined,MapCenter,Branch,Image};
     6.1 --- a/vymmodel.cpp	Wed Apr 29 21:40:37 2009 +0000
     6.2 +++ b/vymmodel.cpp	Thu Apr 30 11:52:49 2009 +0000
     6.3 @@ -445,6 +445,7 @@
     6.4  		bool blockSaveStateOrg=blockSaveState;
     6.5  		blockReposition=true;
     6.6  		blockSaveState=true;
     6.7 +		mapEditor->setViewportUpdateMode (QGraphicsView::NoViewportUpdate);
     6.8  		QXmlInputSource source( file);
     6.9  		QXmlSimpleReader reader;
    6.10  		reader.setContentHandler( handler );
    6.11 @@ -464,6 +465,7 @@
    6.12  		bool ok = reader.parse( source );
    6.13  		blockReposition=false;
    6.14  		blockSaveState=blockSaveStateOrg;
    6.15 +		mapEditor->setViewportUpdateMode (QGraphicsView::MinimalViewportUpdate);
    6.16  		file.close();
    6.17  		if ( ok ) 
    6.18  		{