Vuo  2.0.3
VuoCommandSetMetadata.cc
Go to the documentation of this file.
1 
10 #include "VuoCommandCommon.hh"
11 #include "VuoCommandSetMetadata.hh"
12 #include "VuoComposition.hh"
15 #include "VuoEditorComposition.hh"
16 #include "VuoEditorUtilities.hh"
17 #include "VuoEditorWindow.hh"
18 #include "VuoEditor.hh"
19 #include "VuoCompiler.hh"
21 
26  : VuoCommandCommon(window)
27 {
28  setText(QApplication::translate("VuoEditorWindow", "Set Metadata"));
29  this->window = window;
30 
31  this->revertedMetadata = new VuoCompositionMetadata(*window->getComposition()->getBase()->getMetadata());
32  this->updatedMetadata = metadata;
33 
34  setDescription("Set metadata to:\n%s", metadata->toCompositionHeader().c_str());
35 }
36 
41 {
43 }
44 
50 void VuoCommandSetMetadata::updateDefaultCompositionName(VuoCompositionMetadata *metadata)
51 {
52  if (! window->windowFilePath().isEmpty())
53  {
54  string defaultName = VuoEditorComposition::getDefaultNameForPath( window->windowFilePath().toStdString() );
55  metadata->setDefaultName(defaultName);
56  }
57 }
58 
63 {
65 
66  updateDefaultCompositionName(revertedMetadata);
67 
68  window->getComposition()->getBase()->setMetadata(revertedMetadata, false);
69 
70  window->getMetadataPanel()->update();
72 
74 }
75 
80 {
82 
83  updateDefaultCompositionName(updatedMetadata);
84 
85  window->getComposition()->getBase()->setMetadata(updatedMetadata, false);
86 
87  window->getMetadataPanel()->update();
89 
91 }