Chris@0
|
1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@0
|
2
|
Chris@0
|
3 /*
|
Chris@0
|
4 A waveform viewer and audio annotation editor.
|
Chris@2
|
5 Chris Cannam, Queen Mary University of London, 2005-2006
|
Chris@0
|
6
|
Chris@0
|
7 This is experimental software. Not for distribution.
|
Chris@0
|
8 */
|
Chris@0
|
9
|
Chris@0
|
10 #include "Layer.h"
|
Chris@0
|
11 #include "View.h"
|
Chris@0
|
12
|
Chris@0
|
13 #include <iostream>
|
Chris@0
|
14
|
Chris@3
|
15 #include "layer/LayerFactory.h" //!!! shouldn't be including this here -- does that suggest we need to move this into layer/ ?
|
Chris@28
|
16 #include "PlayParameterRepository.h"
|
Chris@3
|
17
|
Chris@39
|
18 Layer::Layer()
|
Chris@0
|
19 {
|
Chris@0
|
20 }
|
Chris@0
|
21
|
Chris@0
|
22 Layer::~Layer()
|
Chris@0
|
23 {
|
Chris@43
|
24 std::cerr << "Layer::~Layer(" << this << ")" << std::endl;
|
Chris@0
|
25 }
|
Chris@0
|
26
|
Chris@12
|
27 QString
|
Chris@12
|
28 Layer::getPropertyContainerIconName() const
|
Chris@12
|
29 {
|
Chris@12
|
30 return LayerFactory::instance()->getLayerIconName
|
Chris@12
|
31 (LayerFactory::instance()->getLayerType(this));
|
Chris@12
|
32 }
|
Chris@12
|
33
|
Chris@0
|
34 void
|
Chris@0
|
35 Layer::setObjectName(const QString &name)
|
Chris@0
|
36 {
|
Chris@0
|
37 QObject::setObjectName(name);
|
Chris@0
|
38 emit layerNameChanged();
|
Chris@0
|
39 }
|
Chris@15
|
40
|
Chris@3
|
41 QString
|
Chris@3
|
42 Layer::toXmlString(QString indent, QString extraAttributes) const
|
Chris@3
|
43 {
|
Chris@3
|
44 QString s;
|
Chris@3
|
45
|
Chris@3
|
46 s += indent;
|
Chris@3
|
47
|
Chris@6
|
48 s += QString("<layer id=\"%2\" type=\"%1\" name=\"%3\" model=\"%4\" %5/>\n")
|
Chris@3
|
49 .arg(LayerFactory::instance()->getLayerTypeName
|
Chris@3
|
50 (LayerFactory::instance()->getLayerType(this)))
|
Chris@4
|
51 .arg(getObjectExportId(this))
|
Chris@3
|
52 .arg(objectName())
|
Chris@4
|
53 .arg(getObjectExportId(getModel()))
|
Chris@3
|
54 .arg(extraAttributes);
|
Chris@3
|
55
|
Chris@3
|
56 return s;
|
Chris@3
|
57 }
|
Chris@0
|
58
|
Chris@28
|
59 PlayParameters *
|
Chris@29
|
60 Layer::getPlayParameters()
|
Chris@28
|
61 {
|
Chris@32
|
62 // std::cerr << "Layer (" << this << ", " << objectName().toStdString() << ")::getPlayParameters: model is "<< getModel() << std::endl;
|
Chris@28
|
63 const Model *model = getModel();
|
Chris@28
|
64 if (model) {
|
Chris@28
|
65 return PlayParameterRepository::instance()->getPlayParameters(model);
|
Chris@28
|
66 }
|
Chris@28
|
67 return 0;
|
Chris@28
|
68 }
|
Chris@28
|
69
|
Chris@29
|
70 void
|
Chris@36
|
71 Layer::showLayer(View *view, bool show)
|
Chris@29
|
72 {
|
Chris@36
|
73 setLayerDormant(view, !show);
|
Chris@29
|
74 emit layerParametersChanged();
|
Chris@29
|
75 }
|
Chris@28
|
76
|
Chris@28
|
77
|
Chris@0
|
78 #ifdef INCLUDE_MOCFILES
|
Chris@0
|
79 #include "Layer.moc.cpp"
|
Chris@0
|
80 #endif
|
Chris@0
|
81
|