Vuo 2.4.4
Loading...
Searching...
No Matches
VuoPortPopover.hh
Go to the documentation of this file.
1
10#pragma once
11
12#include <dispatch/dispatch.h>
13#include <VuoImageResize.h>
15class VuoPort;
16
20class VuoPortPopover : public QTextBrowser
21{
22 Q_OBJECT
23public:
24 explicit VuoPortPopover(VuoPort *port, VuoEditorComposition *composition, QWidget *parent=0);
26
27 // Style
28 bool getDetached();
29 void detach();
30
31signals:
32 void popoverClosedForPort(string portID);
33 void popoverDetachedFromPort(string portID);
35
36public slots:
37 void setWindowLevel(bool top);
38 void setWindowLevelAndVisibility(bool top);
39 void setCompositionRunning(bool running, bool resetDataValue=true);
41 void updateDataValueImmediately(QString value);
42 void updateLastEventTimeAndDataValue(bool event, bool data, QString value);
44
45protected:
46 void mousePressEvent(QMouseEvent *event);
47 void mouseMoveEvent(QMouseEvent * event);
48 void mouseReleaseEvent(QMouseEvent * event);
49 void closeEvent(QCloseEvent *event);
50 void resizeEvent(QResizeEvent *event);
51
52private slots:
53 void updateStyle();
54 void helpButtonClicked();
55
56private:
57 static const int maxPopoverContentWidth;
58 static const int maxPopoverImageWidth;
59 static const int maxPopoverImageHeight;
60 static const qreal minTextUpdateInterval;
61 static const int eventHistoryMaxSize;
62 static const int noEventObserved;
63 static const int noDisplayableEventTime;
64 static const string noDataValueObserved;
65 static const string noDisplayableDataValue;
66
67 // Port attributes affecting text contents
68 string portID;
69 VuoEditorComposition *composition;
70 string cachedDataValue;
71 qint64 timeOfLastEvent;
72 qint64 timeOfLastUpdate;
73 bool compositionRunning;
74 QQueue<qint64> eventHistory;
75 unsigned int eventCount;
76 unsigned int droppedEventCount;
77 bool allEventsBlocked;
78 bool someEventsBlocked;
79
80 // Style
81 bool isDetached;
82
83 QTimer *refreshTextTimer;
84 dispatch_queue_t popoverTextQueue;
85
86 VuoImageResize imageResize;
87 QString mostRecentImage;
88
89 void updateTextAndResizeThreadUnsafe();
90 void updateTextThreadUnsafe(bool includeEventIndicator=false);
91 QString generateImageCode();
92 void resetRefreshTextInterval();
93 bool refreshTextTimerFiredSinceLastReset;
94 QString generatePortPopoverText(bool includeEventIndicator=false);
95
96 static double getEventIntervalMean(QQueue<qint64> timestamps);
97 static double getEventIntervalStdDev(QQueue<qint64> timestamps);
98
99 // User interaction
100 bool dragInProgress;
101 QPoint positionBeforeDrag;
102};