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