vymLinks working again
authorinsilmaril
Tue, 07 Jul 2009 11:21:27 +0000
changeset 780fe839bdfd10c
parent 779 1fb50e79661c
child 781 6cbf3c9cbd21
vymLinks working again
branchitem.cpp
branchitem.h
floatimageobj.cpp
floatimageobj.h
floatobj.cpp
floatobj.h
imageitem.cpp
linkablemapobj.cpp
linkablemapobj.h
mapeditor.cpp
treeitem.cpp
vymmodel.cpp
xml-vym.cpp
     1.1 --- a/branchitem.cpp	Tue Jul 07 09:34:24 2009 +0000
     1.2 +++ b/branchitem.cpp	Tue Jul 07 11:21:27 2009 +0000
     1.3 @@ -158,43 +158,6 @@
     1.4  {
     1.5  }
     1.6  
     1.7 -void BranchItem::setVymLink(QString s)
     1.8 -{
     1.9 -	if (!s.isEmpty())
    1.10 -	{
    1.11 -		// We need the relative (from loading) 
    1.12 -		// or absolute path (from User event)
    1.13 -		// and build the absolute path.
    1.14 -		// Note: If we have relative, use path of
    1.15 -		// current map to build absolute path
    1.16 -		QDir d(s);
    1.17 -		if (!d.path().startsWith ("/"))
    1.18 -		{
    1.19 -			QString p=model->getDestPath();
    1.20 -			int i=p.findRev("/",-1);
    1.21 -			d.setPath(p.left(i)+"/"+s);
    1.22 -			d.convertToAbs();
    1.23 -		}
    1.24 -		vymLink=d.path();
    1.25 -		//FIXME-2 systemFlags->activate("vymLink");
    1.26 -	}	
    1.27 -	else	
    1.28 -	{
    1.29 -		//FIXME-2 systemFlags->deactivate("vymLink");
    1.30 -		vymLink="";
    1.31 -	}	
    1.32 -	/* FIXME-2
    1.33 -	calcBBoxSize();			// recalculate bbox
    1.34 -    positionBBox();			// rearrange contents
    1.35 -	forceReposition();
    1.36 -	*/
    1.37 -}
    1.38 -
    1.39 -QString BranchItem::getVymLink()
    1.40 -{
    1.41 -	return vymLink;
    1.42 -}
    1.43 -
    1.44  void BranchItem::setHeadingColor (QColor color)
    1.45  {
    1.46  	TreeItem::setHeadingColor (color);
     2.1 --- a/branchitem.h	Tue Jul 07 09:34:24 2009 +0000
     2.2 +++ b/branchitem.h	Tue Jul 07 11:21:27 2009 +0000
     2.3 @@ -1,7 +1,6 @@
     2.4  #ifndef BRANCHITEM_H
     2.5  #define BRANCHITEM_H
     2.6  
     2.7 -//#include "treeitem.h"
     2.8  #include "mapitem.h"
     2.9  
    2.10  
    2.11 @@ -22,12 +21,6 @@
    2.12  
    2.13  	virtual void updateVisibility();
    2.14  
    2.15 -protected:
    2.16 -	QString vymLink;
    2.17 -public:	
    2.18 -	virtual void setVymLink (QString);
    2.19 -    virtual QString getVymLink ();
    2.20 -
    2.21  	virtual void setHeadingColor (QColor color); //!Overloaded from TreeItem to update QGraphicsView
    2.22  
    2.23  protected:	
     3.1 --- a/floatimageobj.cpp	Tue Jul 07 09:34:24 2009 +0000
     3.2 +++ b/floatimageobj.cpp	Tue Jul 07 11:21:27 2009 +0000
     3.3 @@ -44,7 +44,6 @@
     3.4  	clickBox.setSize (QSizeF(icon->boundingRect().width(), icon->boundingRect().height()));filename="";
     3.5  	originalFilename="no original name available";
     3.6  	filetype="";
     3.7 -	saveInMap=true;
     3.8  	useRelPos=true;
     3.9  
    3.10  	//Hide flags
    3.11 @@ -58,7 +57,6 @@
    3.12  	filetype=other->filetype;
    3.13  	filename=other->filename;
    3.14  	originalFilename=other->originalFilename;
    3.15 -	saveInMap=other->saveInMap;
    3.16      positionBBox();
    3.17  }
    3.18  
     4.1 --- a/floatimageobj.h	Tue Jul 07 09:34:24 2009 +0000
     4.2 +++ b/floatimageobj.h	Tue Jul 07 11:21:27 2009 +0000
     4.3 @@ -36,7 +36,6 @@
     4.4  
     4.5  protected:
     4.6  	ImageObj *icon;
     4.7 -	bool saveInMap;
     4.8  	QString filetype;
     4.9  	QString filename;
    4.10  	QString originalFilename;
     5.1 --- a/floatobj.cpp	Tue Jul 07 09:34:24 2009 +0000
     5.2 +++ b/floatobj.cpp	Tue Jul 07 11:21:27 2009 +0000
     5.3 @@ -34,7 +34,6 @@
     5.4  using namespace std;
     5.5  void FloatObj::init () 
     5.6  {
     5.7 -	floatExport=true;
     5.8  	zPlane=Z_ICON;
     5.9  	setLinkStyle (LinkableMapObj::Parabel);
    5.10  	//FIXME-2 setHideLinkUnselected(true);
    5.11 @@ -57,16 +56,6 @@
    5.12  	return zPlane;
    5.13  }
    5.14  
    5.15 -void FloatObj::setFloatExport(const bool& b)
    5.16 -{
    5.17 -	floatExport=b;
    5.18 -}
    5.19 -
    5.20 -bool FloatObj::getFloatExport()
    5.21 -{
    5.22 -	return floatExport;
    5.23 -}
    5.24 -
    5.25  void FloatObj::move (double x, double y)
    5.26  {
    5.27  	MapObj::move(x,y);
     6.1 --- a/floatobj.h	Tue Jul 07 09:34:24 2009 +0000
     6.2 +++ b/floatobj.h	Tue Jul 07 11:21:27 2009 +0000
     6.3 @@ -18,8 +18,6 @@
     6.4  	virtual bool load (const QString&)=0;
     6.5  	virtual void setZValue(const int&);		// set zPlane
     6.6  	virtual int zValue();
     6.7 -	virtual void setFloatExport (const bool &);
     6.8 -	virtual bool getFloatExport ();
     6.9  
    6.10  	virtual void move (double,double);
    6.11  	virtual void move (QPointF);
    6.12 @@ -30,7 +28,6 @@
    6.13  	virtual QRectF getBBoxSizeWithChildren();	// return size of BBox including children  
    6.14  
    6.15  protected:
    6.16 -	bool floatExport;
    6.17  	int zPlane;
    6.18  };
    6.19  
     7.1 --- a/imageitem.cpp	Tue Jul 07 09:34:24 2009 +0000
     7.2 +++ b/imageitem.cpp	Tue Jul 07 11:21:27 2009 +0000
     7.3 @@ -103,29 +103,7 @@
     7.4  
     7.5  	saveCounter++;
     7.6  	
     7.7 -	/* FIXME-3 QString useOrientAttr;
     7.8 -	if (useOrientation)
     7.9 -		useOrientAttr=attribut ("useOrientation","true");
    7.10 -	else	
    7.11 -		useOrientAttr=attribut ("useOrientation","false");
    7.12 -		*/
    7.13 -		
    7.14 -	/*FIXME-3 QString saveInMapAttr;
    7.15 -	if (saveInMap)
    7.16 -		saveInMapAttr=attribut ("saveInMap","true");
    7.17 -	else	
    7.18 -		
    7.19 -		saveInMapAttr=attribut ("saveInMap","false");
    7.20 -		*/
    7.21 -
    7.22 -	/* FIXME-3 QString exportAttr;
    7.23 -	if (floatExport)
    7.24 -		exportAttr=attribut ("floatExport","true");
    7.25 -	else	
    7.26 -		exportAttr=attribut ("floatExport","false");
    7.27 -	*/	
    7.28 -
    7.29 -
    7.30 +	
    7.31  	QString zAttr=attribut ("zValue",QString().setNum(zValue));
    7.32  	QString url;
    7.33  
    7.34 @@ -139,9 +117,6 @@
    7.35      return singleElement ("floatimage",  
    7.36  		getMapAttr() 
    7.37  		+getGeneralAttr()
    7.38 -//		+useOrientAttr 
    7.39 -//		+saveInMapAttr 
    7.40 -//		+exportAttr  
    7.41  		+zAttr  
    7.42  		+attribut ("href",QString ("file:")+url)
    7.43  		+nameAttr
     8.1 --- a/linkablemapobj.cpp	Tue Jul 07 09:34:24 2009 +0000
     8.2 +++ b/linkablemapobj.cpp	Tue Jul 07 11:21:27 2009 +0000
     8.3 @@ -86,7 +86,6 @@
     8.4  	// Rel Positions
     8.5  	relPos=QPointF(0,0);
     8.6  	useRelPos=false;
     8.7 -	useOrientation=true;
     8.8  
     8.9  	// Crossreference to treemodel
    8.10  	treeItem=NULL;
    8.11 @@ -99,7 +98,6 @@
    8.12      setLinkStyle(other->style);
    8.13      setLinkColor (other->linkcolor);
    8.14  	relPos=other->relPos;
    8.15 -	useOrientation=other->useOrientation;
    8.16  	treeItem=other->treeItem;
    8.17  }
    8.18  
    8.19 @@ -552,15 +550,6 @@
    8.20      return parPos;
    8.21  }
    8.22  
    8.23 -void LinkableMapObj::setUseOrientation (const bool &b)
    8.24 -{	
    8.25 -	if (useOrientation!=b)
    8.26 -	{
    8.27 -		useOrientation=b;
    8.28 -		requestReposition();
    8.29 -	}	
    8.30 -}
    8.31 -
    8.32  LinkableMapObj::Orientation LinkableMapObj::getOrientation()
    8.33  {
    8.34      return orientation;
     9.1 --- a/linkablemapobj.h	Tue Jul 07 09:34:24 2009 +0000
     9.2 +++ b/linkablemapobj.h	Tue Jul 07 11:21:27 2009 +0000
     9.3 @@ -70,8 +70,6 @@
     9.4  	virtual void setRelPos();				// set relPos to current parentPos
     9.5  	virtual void setRelPos(const QPointF&);	
     9.6  	virtual QPointF getRelPos();
     9.7 -	virtual void setUseOrientation (const bool &);
     9.8 -
     9.9  
    9.10  	virtual qreal getTopPad();
    9.11  	virtual qreal getLeftPad();
    9.12 @@ -147,7 +145,6 @@
    9.13  
    9.14  	QPointF	 relPos;				// position relative to childPos of parent
    9.15  	bool useRelPos;
    9.16 -	bool useOrientation;
    9.17  
    9.18  	TreeItem *treeItem;				// Crossrefence to treemodel
    9.19  };
    10.1 --- a/mapeditor.cpp	Tue Jul 07 09:34:24 2009 +0000
    10.2 +++ b/mapeditor.cpp	Tue Jul 07 11:21:27 2009 +0000
    10.3 @@ -703,7 +703,7 @@
    10.4  				else	
    10.5  					mainWindow->editOpenURL();
    10.6  			}	
    10.7 -			else if (foname=="vymLink")
    10.8 +			else if (foname=="system-vymLink")
    10.9  			{
   10.10  				mainWindow->editOpenVymLink();
   10.11  				// tabWidget may change, better return now
    11.1 --- a/treeitem.cpp	Tue Jul 07 09:34:24 2009 +0000
    11.2 +++ b/treeitem.cpp	Tue Jul 07 11:21:27 2009 +0000
    11.3 @@ -689,10 +689,14 @@
    11.4  
    11.5  QString TreeItem::getGeneralAttr()
    11.6  {
    11.7 +	QString s;
    11.8  	if (hideExport)
    11.9 -		 return attribut("hideInExport","true");
   11.10 -	else
   11.11 -		return QString();
   11.12 +		 s+=attribut("hideInExport","true");
   11.13 +	if (!url.isEmpty())
   11.14 +		s+=attribut ("url",url);
   11.15 +	if (!vymLink.isEmpty())
   11.16 +		s+=attribut ("vymLink",vymLink);
   11.17 +	return s;	
   11.18  }
   11.19  
   11.20  
    12.1 --- a/vymmodel.cpp	Tue Jul 07 09:34:24 2009 +0000
    12.2 +++ b/vymmodel.cpp	Tue Jul 07 11:21:27 2009 +0000
    12.3 @@ -2641,13 +2641,13 @@
    12.4  void VymModel::setVymLink (const QString &s)	// FIXME-3 no savestate?
    12.5  {
    12.6  	// Internal function, no saveState needed
    12.7 -	BranchItem *bi=getSelectedBranchItem();
    12.8 -	if (bi)
    12.9 +	TreeItem *selti=getSelectedItem();
   12.10 +	if (selti)
   12.11  	{
   12.12 -		bi->setVymLink(s);
   12.13 +		selti->setVymLink(s);
   12.14  		reposition();
   12.15 -		updateActions();
   12.16 -		//emitSelectionChanged();
   12.17 +		emitDataHasChanged (selti);
   12.18 +		emitShowSelection();
   12.19  	}
   12.20  }
   12.21  
    13.1 --- a/xml-vym.cpp	Tue Jul 07 09:34:24 2009 +0000
    13.2 +++ b/xml-vym.cpp	Tue Jul 07 11:21:27 2009 +0000
    13.3 @@ -418,7 +418,7 @@
    13.4  
    13.5  bool parseVYMHandler::readOOAttr (const QXmlAttributes& a)
    13.6  {
    13.7 -	if (lastMI)	//FIXME-1  below lastBranch is used, not lastMI. So it might not work for images
    13.8 +	if (lastMI)
    13.9  	{
   13.10  		bool okx,oky;
   13.11  		float x,y;
   13.12 @@ -429,7 +429,7 @@
   13.13  				x=a.value("relPosX").toFloat (&okx);
   13.14  				y=a.value("relPosY").toFloat (&oky);
   13.15  				if (okx && oky  )
   13.16 -					lastBranch->setRelPos (QPointF(x,y));
   13.17 +					lastMI->setRelPos (QPointF(x,y));
   13.18  				else
   13.19  					return false;   // Couldn't read relPos
   13.20  			}           
   13.21 @@ -441,21 +441,21 @@
   13.22  				x=a.value("absPosX").toFloat (&okx);
   13.23  				y=a.value("absPosY").toFloat (&oky);
   13.24  				if (okx && oky  )
   13.25 -					lastBranch->setAbsPos (QPointF(x,y));
   13.26 +					lastMI->setAbsPos (QPointF(x,y));
   13.27  				else
   13.28  					return false;   // Couldn't read absPos
   13.29  			}           
   13.30  		}           
   13.31  		//if (!a.value( "id").isEmpty() ) 
   13.32 -		//	lastBranch->setID (a.value ("id"));
   13.33 +		//	lastMI->setID (a.value ("id"));		// FIXME-3
   13.34  			
   13.35  		if (!a.value( "url").isEmpty() ) 
   13.36 -			lastBranch->setURL (a.value ("url"));
   13.37 +			lastMI->setURL (a.value ("url"));
   13.38  		if (!a.value( "vymLink").isEmpty() ) 
   13.39 -			lastBranch->setVymLink (a.value ("vymLink"));
   13.40 +			lastMI->setVymLink (a.value ("vymLink"));
   13.41  		if (!a.value( "hideInExport").isEmpty() ) 
   13.42  			if (a.value("hideInExport")=="true")
   13.43 -				lastBranch->setHideInExport(true);
   13.44 +				lastMI->setHideInExport(true);
   13.45  
   13.46  		if (!a.value( "hideLink").isEmpty()) 
   13.47  		{
   13.48 @@ -504,16 +504,8 @@
   13.49  {
   13.50  	lastMI=lastImage;
   13.51  	
   13.52 -	//if (!readOOAttr(a)) return false;
   13.53 +	//if (!readOOAttr(a)) return false;   FIXME-3
   13.54  
   13.55 -	/* FIXME-1 if (!a.value( "useOrientation").isEmpty() ) 
   13.56 -	{
   13.57 -		if (a.value ("useOrientation") =="true")
   13.58 -			lastImage->setUseOrientation (true);
   13.59 -		else	
   13.60 -			lastImage->setUseOrientation (false);
   13.61 -	}	
   13.62 -	*/
   13.63  	if (!a.value( "href").isEmpty() )
   13.64  	{
   13.65  		// Load Image