vymmodel.h
author insilmaril
Mon Oct 06 12:28:25 2008 +0000 (2008-10-06)
branchrelease-1-12-maintained
changeset 51 b2224ebf331f
child 57 d045ba89798e
permissions -rw-r--r--
added moligaloo to translators list
     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 	void stopAnimation  (MapObj *mo);
    60 private:	
    61 	QTimer *animationTimer;
    62 	bool animationUse;
    63 	uint animationTicks;
    64 	uint animationInterval;
    65 	int timerId;				// animation timer
    66 	QList <MapObj*> animObjList;// list with animated objects
    67 
    68 ////////////////////////////////////////// Selection related 
    69 public:
    70 	LinkableMapObj* getSelection();
    71 	BranchObj* getSelectedBranch();
    72 	bool select (const QString &s);
    73 	QString getSelectString (LinkableMapObj *lmo);
    74 
    75 private:
    76 	QGraphicsScene *mapScene;
    77 	MapEditor *mapEditor;
    78 	QList <MapCenterObj*> mapCenters;
    79 	QString version;	//!< version string saved in vym file
    80 	QString author;
    81 	QString comment;
    82 	QDate date;
    83 };
    84 
    85 
    86 #endif