Vuo  2.0.3
VuoCommandSetPublishedPortName.cc
Go to the documentation of this file.
1 
10 #include "VuoCommandCommon.hh"
12 #include "VuoCompilerPort.hh"
13 #include "VuoEditorComposition.hh"
14 #include "VuoEditorWindow.hh"
15 
20  : VuoCommandCommon(window)
21 {
22  setText(QApplication::translate("VuoEditorWindow", "Set Published Port Name"));
23  this->window = window;
24  this->revertedSnapshot = window->getComposition()->takeSnapshot();
25 
26  string oldPortName = port->getBase()->getClass()->getName();
27 
28  // Start of command content.
29  {
30  window->getComposition()->setPublishedPortName(port, name);
31  }
32  // End of command content.
33 
34  this->updatedSnapshot = window->getComposition()->takeSnapshot();
35 
36  setDescription("Rename published port %s to %s",
37  oldPortName.c_str(),
38  name.c_str());
39 }
40 
45 {
47 }
48 
53 {
55 
56  window->resetCompositionWithSnapshot(revertedSnapshot);
57  window->coalesceSnapshots(updatedSnapshot, revertedSnapshot);
58 
59  setText(QApplication::translate("VuoEditorWindow", "Set Published Port Name"));
60 }
61 
66 {
68 
69  window->resetCompositionWithSnapshot(updatedSnapshot);
70  window->coalesceSnapshots(revertedSnapshot, updatedSnapshot);
71 
72  setText(QApplication::translate("VuoEditorWindow", "Set Published Port Name"));
73 }