-
Notifications
You must be signed in to change notification settings - Fork 1
/
edge.h
90 lines (73 loc) · 2.33 KB
/
edge.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/* --------------------------------------------- */
/* */
/* Copyright (C) 2021 Wolfgang Trummer */
/* Contact: [email protected] */
/* */
/* gvtree V1.9-0 */
/* */
/* git version tree browser */
/* */
/* 28. December 2021 */
/* */
/* This program is licensed under */
/* GNU GENERAL PUBLIC LICENSE */
/* Version 3, 29 June 2007 */
/* */
/* --------------------------------------------- */
#ifndef __EDGE_H__
#define __EDGE_H__
#include <QGraphicsItem>
#include "graphwidget.h"
#include "version.h"
/**
* \brief Graphics item representing the edge of the version tree/graph.
*/
class Edge : public QGraphicsItem
{
public:
/**
* \brief Constructor for an Edge
* Two nodes source and destination are linked by the Edge.
*/
Edge(class Version* _src,
class Version* _dst,
GraphWidget* _graphWidget,
bool _merge = false,
bool _info = false,
bool _fileConstraint = false,
QGraphicsItem* _parent = NULL);
enum {Type = UserType + 2};
int type() const
{
return Type;
}
Node* sourceVersion() const;
Node* destVersion() const;
void setMerge(bool _val);
bool getMerge() const;
void setInfo(bool _val);
bool getInfo() const;
void setConnectorStyle(int _val);
int getConnectorStyle() const;
void adjust();
virtual QRectF boundingRect() const;
void compareVersions();
void focusSource();
void focusDestination();
void focusNeighbourBox();
protected:
virtual QPainterPath shape() const;
virtual void paint(QPainter* _painter, const QStyleOptionGraphicsItem* _option, QWidget* _widget);
private:
class Version* source;
class Version* dest;
GraphWidget* graph;
QPointF sourcePoint;
QPointF destPoint;
qreal arrowSize;
bool merge;
bool info;
bool fileConstraint;
bool invalid;
};
#endif