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