OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
VersionGraph.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
11
12namespace ot {
13
14 class VersionGraphItem;
15
17 Q_OBJECT
18 public:
20 NoConfigFlags = 0 << 0,
21 IgnoreActivateRequestOnReadOnly = 1 << 0,
22 IgnoreSelectionHandlingOnReadOnly = 1 << 1
23 };
25
27 virtual ~VersionGraph();
28
29 void setupFromConfig(const VersionGraphCfg& _config);
30
31 void clear(void);
32
33 bool isCurrentVersionEndOfBranch(void) const;
34 bool isVersionEndOfBranch(const std::string& _versionName) const;
35
36 void setVersionGraphConfig(VersionGraphConfig _config, bool _active = true) { m_configFlags.setFlag(_config, _active); };
37 void setVersionGraphConfigFlags(const VersionGraphConfigFlags& _flags) { m_configFlags = _flags; };
38 const VersionGraphConfigFlags& getVersionGraphConfigFlags(void) const { return m_configFlags; };
39
40 Q_SIGNALS:
42 void versionSelected(const std::string& _versionName);
43 void versionActivateRequest(const std::string& _versionName);
44
45 public Q_SLOTS:
46 void slotSelectionChanged(void);
47 void slotCenterOnActiveVersion(void);
48 void slotGraphicsItemDoubleClicked(const ot::GraphicsItem* _item);
49
50 protected:
51 virtual void showEvent(QShowEvent* _event) override;
52 virtual void paintEvent(QPaintEvent* _event) override;
53
54 private:
55 typedef std::list<VersionGraphItem*> VersionsList;
56
57 void updateVersionPositions(void);
58 QRectF calculateFittedViewportRect(void) const;
59 VersionGraphItem* findVersion(const std::string& _versionName);
60 VersionGraphItem* findExistingParentVersionOfBranchLeave(const std::string& _branchLeaveName);
61 const VersionGraphItem* findVersion(const std::string& _versionName) const;
62 VersionGraphItem* findVersion(const std::string& _versionName, VersionsList*& _list, VersionsList::const_iterator& _iterator);
63 const VersionGraphItem* findVersion(const std::string& _versionName, const VersionsList*& _list, VersionsList::const_iterator& _iterator) const;
64 const VersionsList* findBranch(const std::string& _branchName) const;
65 void highlightVersion(const std::string& _versionName);
66
67 bool m_updateItemPositionRequired;
68 QRectF m_lastViewportRect;
69 std::string m_activeVersion;
70 std::string m_activeVersionBranch;
71
72 std::list<VersionsList> m_branches;
73
74 VersionGraphConfigFlags m_configFlags;
75 };
76
77}
78
#define OT_ADD_FLAG_FUNCTIONS(___enumName)
Will add the default bitwise operations for the provided private 32/64 bit bitfield....
Definition Flags.h:129
#define OT_WIDGETS_API_EXPORT
Definition OTWidgetsAPIExport.h:12
The Flags class is a wrapper around a enum that allows bitwise operations (flags)....
Definition Flags.h:214
Base class for all OpenTwin GraphicsItems GraphicsItems should be created by the GraphicsFactory and ...
Definition GraphicsItem.h:35
View widget used to display GraphicsItems Note that the View creates its own scene.
Definition GraphicsView.h:37
Definition VersionGraphCfg.h:16
Definition VersionGraph.h:16
VersionGraphConfig
Definition VersionGraph.h:19
void versionActivateRequest(const std::string &_versionName)
void setVersionGraphConfig(VersionGraphConfig _config, bool _active=true)
Definition VersionGraph.h:36
const VersionGraphConfigFlags & getVersionGraphConfigFlags(void) const
Definition VersionGraph.h:38
void versionDeselected(void)
void versionSelected(const std::string &_versionName)
void setVersionGraphConfigFlags(const VersionGraphConfigFlags &_flags)
Definition VersionGraph.h:37
Flags< VersionGraphConfig > VersionGraphConfigFlags
Definition VersionGraph.h:24
Definition VersionGraphItem.h:19
Definition Connector.h:8