vymmodel.h
author insilmaril
Tue Jun 03 08:34:56 2008 +0000 (2008-06-03)
changeset 710 e2c23e0cefc0
parent 684 5f9a2771680d
child 721 12958f987bcf
permissions -rw-r--r--
Workaround for unreadable file with Qt 4.4
     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 : public QObject{
    14 	Q_OBJECT
    15 
    16 public:
    17 	VymModel();
    18 	~VymModel ();
    19     void clear();
    20     void init();
    21 	void setMapEditor(MapEditor *me);	// FIXME should not be necessary in Model/View
    22 	MapEditor* getMapEditor();
    23 	void setVersion(const  QString &);
    24 	void setAuthor  (const QString &);
    25 	QString getAuthor ();
    26 	void setComment (const QString &);
    27 	QString getComment ();
    28 	QString getDate();
    29 	void setScene(QGraphicsScene *s);
    30 	QGraphicsScene *getScene();
    31 	MapCenterObj* addMapCenter();
    32 	MapCenterObj* addMapCenter(QPointF absPos);
    33 	MapCenterObj* removeMapCenter(MapCenterObj *mco);
    34 
    35 	BranchObj* first();					// FIXME replaced by ModelIndex later
    36 	BranchObj* next(BranchObj *bo);		// FIXME replaced by ModelIndex later
    37 
    38     LinkableMapObj* findMapObj(QPointF,LinkableMapObj*);	// find MapObj 
    39     LinkableMapObj* findObjBySelect (const QString &s);		// find MapObj by select string
    40     LinkableMapObj* findID (const QString &s);				// find MapObj by previously set ID
    41 	QString saveToDir (const QString&,const QString&,int, const QPointF&);// Save data recursivly to tempdir
    42 
    43 
    44 ////////////////////////////////////////// View related
    45     // void updateLink();  FIXME needed?
    46     void updateRelPositions();
    47 
    48 	QRectF getTotalBBox();
    49 	void reposition();					//!< Call reposition for all MCOs
    50 	void setHideTmp (HideTmpMode mode);	
    51 	QPolygonF shape(BranchObj *bo);		//!< Returns arbitrary shape of subtree
    52 	void moveAway (LinkableMapObj *lmo);//!< Autolayout: Move all out of the way
    53 
    54 	// Animation  **experimental**
    55 private slots:
    56 	void animate();						//!< Called by timer to animate stuff
    57 public:
    58 	void startAnimation(const QPointF &start, const QPointF &dest);
    59 private:	
    60 	QTimer *animationTimer;
    61 	bool animationUse;
    62 	uint animationTicks;
    63 	uint animationInterval;
    64 	int timerId;				// animation timer
    65 	QList <MapObj*> animObjList;// list with animated objects
    66 
    67 ////////////////////////////////////////// Selection related 
    68 public:
    69 	LinkableMapObj* getSelection();
    70 	BranchObj* getSelectedBranch();
    71 	bool select (const QString &s);
    72 	QString getSelectString (LinkableMapObj *lmo);
    73 
    74 private:
    75 	QGraphicsScene *mapScene;
    76 	MapEditor *mapEditor;
    77 	QList <MapCenterObj*> mapCenters;
    78 	QString version;	//!< version string saved in vym file
    79 	QString author;
    80 	QString comment;
    81 	QDate date;
    82 };
    83 
    84 
    85 #endif