vymmodel.h
author insilmaril
Wed, 25 Feb 2009 12:44:10 +0000
branchrelease-1-12-maintained
changeset 57 d045ba89798e
parent 40 394b2f297e1d
child 62 85683324f94a
permissions -rw-r--r--
Bugfix: Enabled multiple mapcenters for export to OpenOffice.org
     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 	MapCenterObj* getMapCenterNum (int i);
    35 	int countMapCenters ();
    36 
    37 	BranchObj* first();					// FIXME replaced by ModelIndex later
    38 	BranchObj* next(BranchObj *bo);		// FIXME replaced by ModelIndex later
    39 
    40     LinkableMapObj* findMapObj(QPointF,LinkableMapObj*);	// find MapObj 
    41     LinkableMapObj* findObjBySelect (const QString &s);		// find MapObj by select string
    42     LinkableMapObj* findID (const QString &s);				// find MapObj by previously set ID
    43 	QString saveToDir (const QString&,const QString&,int, const QPointF&);// Save data recursivly to tempdir
    44 
    45 
    46 ////////////////////////////////////////// View related
    47     // void updateLink();  FIXME needed?
    48     void updateRelPositions();
    49 
    50 	QRectF getTotalBBox();
    51 	void reposition();					//!< Call reposition for all MCOs
    52 	void setHideTmp (HideTmpMode mode);	
    53 	QPolygonF shape(BranchObj *bo);		//!< Returns arbitrary shape of subtree
    54 	void moveAway (LinkableMapObj *lmo);//!< Autolayout: Move all out of the way
    55 
    56 	// Animation  **experimental**
    57 private slots:
    58 	void animate();						//!< Called by timer to animate stuff
    59 public:
    60 	void startAnimation (const QPointF &start, const QPointF &dest);
    61 	void stopAnimation  (MapObj *mo);
    62 private:	
    63 	QTimer *animationTimer;
    64 	bool animationUse;
    65 	uint animationTicks;
    66 	uint animationInterval;
    67 	int timerId;				// animation timer
    68 	QList <MapObj*> animObjList;// list with animated objects
    69 
    70 ////////////////////////////////////////// Selection related 
    71 public:
    72 	LinkableMapObj* getSelection();
    73 	BranchObj* getSelectedBranch();
    74 	bool select (const QString &s);
    75 	QString getSelectString (LinkableMapObj *lmo);
    76 
    77 private:
    78 	QGraphicsScene *mapScene;
    79 	MapEditor *mapEditor;
    80 	QList <MapCenterObj*> mapCenters;
    81 	QString version;	//!< version string saved in vym file
    82 	QString author;
    83 	QString comment;
    84 	QDate date;
    85 };
    86 
    87 
    88 #endif