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