Vuo
2.0.2
editor
VuoCommandSetMetadata.cc
Go to the documentation of this file.
1
10
#include "
VuoCommandCommon.hh
"
11
#include "
VuoCommandSetMetadata.hh
"
12
#include "
VuoComposition.hh
"
13
#include "
VuoCompositionMetadata.hh
"
14
#include "
VuoCompositionMetadataPanel.hh
"
15
#include "
VuoEditorComposition.hh
"
16
#include "
VuoEditorUtilities.hh
"
17
#include "
VuoEditorWindow.hh
"
18
#include "
VuoEditor.hh
"
19
#include "
VuoCompiler.hh
"
20
#include "
VuoSubcompositionMessageRouter.hh
"
21
25
VuoCommandSetMetadata::VuoCommandSetMetadata
(
VuoCompositionMetadata
*metadata,
VuoEditorWindow
*window)
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
40
int
VuoCommandSetMetadata::id
()
const
41
{
42
return
VuoCommandCommon::setMetadataCommandID
;
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
62
void
VuoCommandSetMetadata::undo
()
63
{
64
VuoCommandCommon_undo
;
65
66
updateDefaultCompositionName(revertedMetadata);
67
68
window->
getComposition
()->
getBase
()->
setMetadata
(revertedMetadata,
false
);
69
70
window->
getMetadataPanel
()->
update
();
71
window->
getCurrentNodeLibrary
()->
displayPopoverInPane
(window->
getMetadataPanel
());
72
73
window->
getComposition
()->
updateCompositionsThatContainThisSubcomposition
(window->
getComposition
()->
takeSnapshot
());
74
}
75
79
void
VuoCommandSetMetadata::redo
()
80
{
81
VuoCommandCommon_redo
;
82
83
updateDefaultCompositionName(updatedMetadata);
84
85
window->
getComposition
()->
getBase
()->
setMetadata
(updatedMetadata,
false
);
86
87
window->
getMetadataPanel
()->
update
();
88
window->
getCurrentNodeLibrary
()->
displayPopoverInPane
(window->
getMetadataPanel
());
89
90
window->
getComposition
()->
updateCompositionsThatContainThisSubcomposition
(window->
getComposition
()->
takeSnapshot
());
91
}
Generated on Thu Mar 19 2020 23:15:57 for Vuo by
1.8.17