1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/vymmodel.h Thu Dec 04 13:47:47 2008 +0000
1.3 @@ -0,0 +1,86 @@
1.4 +#ifndef VYMMODEL_H
1.5 +#define VYMMODEL_H
1.6 +
1.7 +#include <QGraphicsScene>
1.8 +
1.9 +#include "mapcenterobj.h"
1.10 +#include "mapeditor.h"
1.11 +
1.12 +
1.13 +/*! \brief This will later be divided into Model/View
1.14 +*/
1.15 +
1.16 +class VymModel : public QObject{
1.17 + Q_OBJECT
1.18 +
1.19 +public:
1.20 + VymModel();
1.21 + ~VymModel ();
1.22 + void clear();
1.23 + void init();
1.24 + void setMapEditor(MapEditor *me); // FIXME should not be necessary in Model/View
1.25 + MapEditor* getMapEditor();
1.26 + void setVersion(const QString &);
1.27 + void setAuthor (const QString &);
1.28 + QString getAuthor ();
1.29 + void setComment (const QString &);
1.30 + QString getComment ();
1.31 + QString getDate();
1.32 + void setScene(QGraphicsScene *s);
1.33 + QGraphicsScene *getScene();
1.34 + MapCenterObj* addMapCenter();
1.35 + MapCenterObj* addMapCenter(QPointF absPos);
1.36 + MapCenterObj* removeMapCenter(MapCenterObj *mco);
1.37 +
1.38 + BranchObj* first(); // FIXME replaced by ModelIndex later
1.39 + BranchObj* next(BranchObj *bo); // FIXME replaced by ModelIndex later
1.40 +
1.41 + LinkableMapObj* findMapObj(QPointF,LinkableMapObj*); // find MapObj
1.42 + LinkableMapObj* findObjBySelect (const QString &s); // find MapObj by select string
1.43 + LinkableMapObj* findID (const QString &s); // find MapObj by previously set ID
1.44 + QString saveToDir (const QString&,const QString&,int, const QPointF&);// Save data recursivly to tempdir
1.45 +
1.46 +
1.47 +////////////////////////////////////////// View related
1.48 + // void updateLink(); FIXME needed?
1.49 + void updateRelPositions();
1.50 +
1.51 + QRectF getTotalBBox();
1.52 + void reposition(); //!< Call reposition for all MCOs
1.53 + void setHideTmp (HideTmpMode mode);
1.54 + QPolygonF shape(BranchObj *bo); //!< Returns arbitrary shape of subtree
1.55 + void moveAway (LinkableMapObj *lmo);//!< Autolayout: Move all out of the way
1.56 +
1.57 + // Animation **experimental**
1.58 +private slots:
1.59 + void animate(); //!< Called by timer to animate stuff
1.60 +public:
1.61 + void startAnimation (const QPointF &start, const QPointF &dest);
1.62 + void stopAnimation (MapObj *mo);
1.63 +private:
1.64 + QTimer *animationTimer;
1.65 + bool animationUse;
1.66 + uint animationTicks;
1.67 + uint animationInterval;
1.68 + int timerId; // animation timer
1.69 + QList <MapObj*> animObjList;// list with animated objects
1.70 +
1.71 +////////////////////////////////////////// Selection related
1.72 +public:
1.73 + LinkableMapObj* getSelection();
1.74 + BranchObj* getSelectedBranch();
1.75 + bool select (const QString &s);
1.76 + QString getSelectString (LinkableMapObj *lmo);
1.77 +
1.78 +private:
1.79 + QGraphicsScene *mapScene;
1.80 + MapEditor *mapEditor;
1.81 + QList <MapCenterObj*> mapCenters;
1.82 + QString version; //!< version string saved in vym file
1.83 + QString author;
1.84 + QString comment;
1.85 + QDate date;
1.86 +};
1.87 +
1.88 +
1.89 +#endif