vymmodel.h
author insilmaril
Fri Feb 01 16:59:09 2008 +0000 (2008-02-01)
changeset 668 b63ff428c781
parent 652 700553af9ca5
child 684 5f9a2771680d
permissions -rw-r--r--
Added simplified chinese by Shaodong
     1 #ifndef VYMMODEL_H
     2 #define VYMMODEL_H
     3 
     4 #include <QGraphicsScene>
     5 
     6 #include "mapcenterobj.h"
     7 #include "mapeditor.h"
     8 
     9 
    10 /*! \brief This will later be divided into Model/View
    11 */
    12 
    13 class VymModel{
    14 public:
    15 	VymModel();
    16 	~VymModel ();
    17     void clear();
    18     void init();
    19 	void setMapEditor(MapEditor *me);	// FIXME should not be necessary in Model/View
    20 	MapEditor* getMapEditor();
    21 	void setVersion(const  QString &);
    22 	void setAuthor  (const QString &);
    23 	QString getAuthor ();
    24 	void setComment (const QString &);
    25 	QString getComment ();
    26 	QString getDate();
    27 	void setScene(QGraphicsScene *s);
    28 	QGraphicsScene *getScene();
    29 	MapCenterObj* addMapCenter();
    30 	MapCenterObj* removeMapCenter(MapCenterObj *mco);
    31 
    32 	BranchObj* first();					// FIXME replaced by ModelIndex later
    33 	BranchObj* next(BranchObj *bo);		// FIXME replaced by ModelIndex later
    34 
    35     LinkableMapObj* findMapObj(QPointF,LinkableMapObj*);	// find MapObj 
    36     LinkableMapObj* findObjBySelect (const QString &s);		// find MapObj by select string
    37     LinkableMapObj* findID (const QString &s);				// find MapObj by previously set ID
    38 	QString saveToDir (const QString&,const QString&,int, const QPointF&);// Save data recursivly to tempdir
    39 
    40 
    41 ////////////////////////////////////////// View related
    42     // void updateLink();  FIXME needed?
    43     void updateRelPositions();
    44 
    45 	QRectF getTotalBBox();
    46 	void reposition();					//!< Call reposition for all MCOs
    47 	void setHideTmp (HideTmpMode mode);	
    48 	QPolygonF shape(BranchObj *bo);		//!< Returns arbitrary shape of subtree
    49 	void moveAway (LinkableMapObj *lmo);//!< Autolayout: Move all out of the way
    50 
    51 ////////////////////////////////////////// Selection related 
    52 	LinkableMapObj* getSelection();
    53 	BranchObj* getSelectedBranch();
    54 	bool select (const QString &s);
    55 	QString getSelectString (LinkableMapObj *lmo);
    56 
    57 private:
    58 	QGraphicsScene *mapScene;
    59 	MapEditor *mapEditor;
    60 	QList <MapCenterObj*> mapCenters;
    61 	QString version;	//!< version string saved in vym file
    62 	QString author;
    63 	QString comment;
    64 	QDate date;
    65 };
    66 
    67 
    68 #endif