Mercurial > hg > svcore
comparison data/model/Model.cpp @ 384:6f6ab834449d spectrogram-cache-rejig
* Merge from trunk
author | Chris Cannam |
---|---|
date | Wed, 27 Feb 2008 11:59:42 +0000 |
parents | 1afaf98dbf11 |
children |
comparison
equal
deleted
inserted
replaced
337:a6fab10ff9e6 | 384:6f6ab834449d |
---|---|
23 | 23 |
24 const int Model::COMPLETION_UNKNOWN = -1; | 24 const int Model::COMPLETION_UNKNOWN = -1; |
25 | 25 |
26 Model::~Model() | 26 Model::~Model() |
27 { | 27 { |
28 // std::cerr << "Model::~Model(" << this << ")" << std::endl; | 28 std::cerr << "Model::~Model(" << this << ")" << std::endl; |
29 | 29 |
30 if (!m_aboutToDelete) { | 30 if (!m_aboutToDelete) { |
31 std::cerr << "NOTE: Model::~Model(" << this << ", \"" | 31 std::cerr << "NOTE: Model::~Model(" << this << ", \"" |
32 << objectName().toStdString() << "\"): Model deleted " | 32 << objectName().toStdString() << "\"): Model deleted " |
33 << "with no aboutToDelete notification" << std::endl; | 33 << "with no aboutToDelete notification" << std::endl; |
64 } | 64 } |
65 | 65 |
66 void | 66 void |
67 Model::aboutToDelete() | 67 Model::aboutToDelete() |
68 { | 68 { |
69 std::cerr << "Model(" << this << ")::aboutToDelete()" << std::endl; | |
70 | |
69 if (m_aboutToDelete) { | 71 if (m_aboutToDelete) { |
70 std::cerr << "WARNING: Model(" << this << ", \"" | 72 std::cerr << "WARNING: Model(" << this << ", \"" |
71 << objectName().toStdString() << "\")::aboutToDelete: " | 73 << objectName().toStdString() << "\")::aboutToDelete: " |
72 << "aboutToDelete called more than once for the same model" | 74 << "aboutToDelete called more than once for the same model" |
73 << std::endl; | 75 << std::endl; |
98 const Model * | 100 const Model * |
99 Model::getAlignmentReference() const | 101 Model::getAlignmentReference() const |
100 { | 102 { |
101 if (!m_alignment) { | 103 if (!m_alignment) { |
102 if (m_sourceModel) return m_sourceModel->getAlignmentReference(); | 104 if (m_sourceModel) return m_sourceModel->getAlignmentReference(); |
103 return this; | 105 return 0; |
104 } | 106 } |
105 return m_alignment->getReferenceModel(); | 107 return m_alignment->getReferenceModel(); |
106 } | 108 } |
107 | 109 |
108 size_t | 110 size_t |
111 if (!m_alignment) { | 113 if (!m_alignment) { |
112 if (m_sourceModel) return m_sourceModel->alignToReference(frame); | 114 if (m_sourceModel) return m_sourceModel->alignToReference(frame); |
113 else return frame; | 115 else return frame; |
114 } | 116 } |
115 size_t refFrame = m_alignment->toReference(frame); | 117 size_t refFrame = m_alignment->toReference(frame); |
116 //!!! this should be totally wrong, but because alignToReference and | 118 const Model *m = m_alignment->getReferenceModel(); |
117 // alignFromReference are the wrong way around, it's right... *sigh* | 119 if (m && refFrame > m->getEndFrame()) refFrame = m->getEndFrame(); |
118 if (refFrame > getEndFrame()) refFrame = getEndFrame(); | |
119 return refFrame; | 120 return refFrame; |
120 } | 121 } |
121 | 122 |
122 size_t | 123 size_t |
123 Model::alignFromReference(size_t refFrame) const | 124 Model::alignFromReference(size_t refFrame) const |
125 if (!m_alignment) { | 126 if (!m_alignment) { |
126 if (m_sourceModel) return m_sourceModel->alignFromReference(refFrame); | 127 if (m_sourceModel) return m_sourceModel->alignFromReference(refFrame); |
127 else return refFrame; | 128 else return refFrame; |
128 } | 129 } |
129 size_t frame = m_alignment->fromReference(refFrame); | 130 size_t frame = m_alignment->fromReference(refFrame); |
131 if (frame > getEndFrame()) frame = getEndFrame(); | |
130 return frame; | 132 return frame; |
131 } | 133 } |
132 | 134 |
133 int | 135 int |
134 Model::getAlignmentCompletion() const | 136 Model::getAlignmentCompletion() const |
146 | 148 |
147 QString | 149 QString |
148 Model::getTitle() const | 150 Model::getTitle() const |
149 { | 151 { |
150 if (m_sourceModel) return m_sourceModel->getTitle(); | 152 if (m_sourceModel) return m_sourceModel->getTitle(); |
153 else return ""; | |
151 } | 154 } |
152 | 155 |
153 QString | 156 QString |
154 Model::getMaker() const | 157 Model::getMaker() const |
155 { | 158 { |
156 if (m_sourceModel) return m_sourceModel->getMaker(); | 159 if (m_sourceModel) return m_sourceModel->getMaker(); |
160 else return ""; | |
161 } | |
162 | |
163 QString | |
164 Model::getLocation() const | |
165 { | |
166 if (m_sourceModel) return m_sourceModel->getLocation(); | |
167 else return ""; | |
157 } | 168 } |
158 | 169 |
159 void | 170 void |
160 Model::toXml(QTextStream &stream, QString indent, | 171 Model::toXml(QTextStream &stream, QString indent, |
161 QString extraAttributes) const | 172 QString extraAttributes) const |