Vuo 2.4.4
Loading...
Searching...
No Matches
VuoPublishedPortSidebar.hh
Go to the documentation of this file.
1
10#pragma once
11
12class VuoCable;
14class VuoPort;
17class VuoRendererPort;
19
20namespace Ui
21{
23}
24
28class VuoPublishedPortSidebar : public QDockWidget
29{
30 Q_OBJECT
31public:
32 explicit VuoPublishedPortSidebar(QWidget *parent, VuoEditorComposition *composition, bool isInput, bool enableProtocolChanges=true);
34 void concludePublishedCableDrag(QMouseEvent *event, VuoCable *cableInProgress, bool cableInProgressWasNew);
36 QAction * getRemoveProtocolAction();
37 VuoRendererPublishedPort * getPublishedPortUnderCursorForEvent(QMouseEvent *event, qreal tolerance=0, bool limitPortCollisionRange=false);
40 static QColor getActiveProtocolPortColor(int protocolIndex, bool isInput);
42 void limitAllowedPortTypes(const set<string> &allowedPortTypes);
43 void limitInitialTypeOptions(bool limit);
44
45signals:
46 void newPublishedPortRequested(string typeName, bool isInput);
51 void portPublicationRequestedViaDropBox(VuoPort *port, bool forceEventOnlyPublication, bool useUndoStackMacro);
52 void portPublicationRequestedViaSidebarPort(VuoPort *internalPort, VuoPublishedPort *externalPort, bool forceEventOnlyPublication, VuoPort *portToSpecialize, string specializedTypeName, string typecastToInsert, bool useUndoStackMacro);
53 void componentsRemoved(QList<QGraphicsItem *> removedComponents, string commandDescription="Remove");
55 void publishedPortsReordered(vector<VuoPublishedPort *> publishedPorts, bool isInput);
56 void undoStackMacroBeginRequested(QString commandName);
58 void closed();
59
60public slots:
61 void updatePortList();
62 void highlightEligibleDropLocations(VuoRendererPort *internalFixedPort, bool eventOnlyConnection);
64 void externalMoveEvent();
65 void updateHoverHighlighting(QMouseEvent *event, qreal tolerance=0);
67
68private slots:
69 void populatePortTypeMenus();
70 void expandPortTypeMenu();
71 void newPublishedPortTypeSelected();
72 void updateColor(bool isDark);
73
74protected:
75 void contextMenuEvent(QContextMenuEvent *event);
76 void mouseMoveEvent(QMouseEvent *event);
77 void mousePressEvent(QMouseEvent *event);
78 void dragEnterEvent(QDragEnterEvent *event);
79 void dropEvent(QDropEvent *event);
80 void closeEvent(QCloseEvent *event);
81
82private:
83 Ui::VuoPublishedPortSidebar *ui;
84 VuoEditorComposition *composition;
85
86 QMenu *contextMenuPortOptions;
87 QMenu *menuChangeProtocol;
88 QMenu *menuAddPort;
89 QMenu *menuNonListType;
90 QMenu *menuListType;
91
92 QMenu *contextMenuRemoveProtocol;
93 QAction *contextMenuActionRemoveProtocol;
94
95 bool isInput;
96 bool menuSelectionInProgress;
97 bool limitTypeMenuOptions;
98 set<string> allowedPortTypes;
99
100 bool canListPublishedPortAliasFor(VuoRendererPort *port);
101 bool isPublishedPortDropBoxUnderCursorForEvent(QMouseEvent *event);
102 bool isActiveProtocolLabelUnderCursorForEvent(QContextMenuEvent *event);
103 void appendPublishedPortToList(VuoPublishedPort *port, bool select);
104 static QColor getActiveProtocolHeadingColor(int protocolIndex, bool isInput);
105 void showPublishedPortDetailsEditor(VuoRendererPublishedPort *port);
106 void populatePortTypeMenu(QMenu *menu, bool lists, bool limitInitialOptions);
107
108#ifdef VUO_PRO
109#include "pro/VuoPublishedPortSidebar_Pro.hh"
110#endif
111};