Vuo  2.0.3
VuoCommandSetTriggerThrottling.cc
Go to the documentation of this file.
1 
11 #include "VuoCommandCommon.hh"
12 #include "VuoCompilerPort.hh"
13 #include "VuoEditorComposition.hh"
14 #include "VuoEditorWindow.hh"
15 
20  enum VuoPortClass::EventThrottling eventThrottling,
21  VuoEditorWindow *window)
22  : VuoCommandCommon(window)
23 {
24  setText(QApplication::translate("VuoEditorWindow", "Set Throttling"));
25  this->window = window;
26  this->revertedSnapshot = window->getComposition()->takeSnapshot();
27 
28  // Start of command content.
29  {
30  port->setEventThrottling(eventThrottling);
31  }
32  // End of command content.
33 
34  this->updatedSnapshot = window->getComposition()->takeSnapshot();
35 
36  VuoCompilerPort *cp = dynamic_cast<VuoCompilerPort *>(port->getCompiler());
37  setDescription("Set throttling for %s to %s",
38  cp ? cp->getIdentifier().c_str() : "?",
39  eventThrottling == VuoPortClass::EventThrottling_Enqueue ? "enqueue" : "drop");
40 }
41 
46 {
48 }
49 
54 {
56 
57  window->resetCompositionWithSnapshot(revertedSnapshot);
58  window->coalesceSnapshots(updatedSnapshot, revertedSnapshot);
60 }
61 
66 {
68 
69  window->resetCompositionWithSnapshot(updatedSnapshot);
70  window->coalesceSnapshots(revertedSnapshot, updatedSnapshot);
72 }