Mercurial > hg > sonic-visualiser
comparison transform/TransformFactory.cpp @ 80:f4f52566e451
* Fixes to presentation and organisation of plugins (especially duplicates)
author | Chris Cannam |
---|---|
date | Fri, 15 Dec 2006 16:34:17 +0000 |
parents | bedc7517b6e8 |
children | dd11619b73ba |
comparison
equal
deleted
inserted
replaced
79:c1318aac18d2 | 80:f4f52566e451 |
---|---|
147 TransformDescriptionMap transforms; | 147 TransformDescriptionMap transforms; |
148 | 148 |
149 populateFeatureExtractionPlugins(transforms); | 149 populateFeatureExtractionPlugins(transforms); |
150 populateRealTimePlugins(transforms); | 150 populateRealTimePlugins(transforms); |
151 | 151 |
152 // disambiguate plugins with similar descriptions | 152 // disambiguate plugins with similar names |
153 | 153 |
154 std::map<QString, int> descriptions; | 154 std::map<QString, int> descriptions; |
155 std::map<QString, QString> pluginSources; | |
156 std::map<QString, QString> pluginMakers; | |
155 | 157 |
156 for (TransformDescriptionMap::iterator i = transforms.begin(); | 158 for (TransformDescriptionMap::iterator i = transforms.begin(); |
157 i != transforms.end(); ++i) { | 159 i != transforms.end(); ++i) { |
158 | 160 |
159 TransformDesc desc = i->second; | 161 TransformDesc desc = i->second; |
160 | 162 |
161 ++descriptions[desc.description]; | 163 QString td = desc.description; |
162 ++descriptions[QString("%1 [%2]").arg(desc.description).arg(desc.maker)]; | 164 QString tn = td.section(": ", 0, 0); |
165 QString pn = desc.name.section(":", 1, 1); | |
166 | |
167 if (pluginSources.find(tn) != pluginSources.end()) { | |
168 if (pluginSources[tn] != pn && pluginMakers[tn] != desc.maker) { | |
169 ++descriptions[tn]; | |
170 } | |
171 } else { | |
172 ++descriptions[tn]; | |
173 pluginSources[tn] = pn; | |
174 pluginMakers[tn] = desc.maker; | |
175 } | |
163 } | 176 } |
164 | 177 |
165 std::map<QString, int> counts; | 178 std::map<QString, int> counts; |
166 m_transforms.clear(); | 179 m_transforms.clear(); |
167 | 180 |
168 for (TransformDescriptionMap::iterator i = transforms.begin(); | 181 for (TransformDescriptionMap::iterator i = transforms.begin(); |
169 i != transforms.end(); ++i) { | 182 i != transforms.end(); ++i) { |
170 | 183 |
171 TransformDesc desc = i->second; | 184 TransformDesc desc = i->second; |
172 QString name = desc.name; | 185 QString name = desc.name; |
173 QString description = desc.description; | |
174 QString maker = desc.maker; | 186 QString maker = desc.maker; |
175 | 187 |
176 if (descriptions[description] > 1) { | 188 QString td = desc.description; |
177 description = QString("%1 [%2]").arg(description).arg(maker); | 189 QString tn = td.section(": ", 0, 0); |
178 if (descriptions[description] > 1) { | 190 QString to = td.section(": ", 1); |
179 description = QString("%1 <%2>") | 191 |
180 .arg(description).arg(++counts[description]); | 192 if (descriptions[tn] > 1) { |
181 } | 193 maker.replace(QRegExp(tr(" [\\(<].*$")), ""); |
194 tn = QString("%1 [%2]").arg(tn).arg(maker); | |
182 } | 195 } |
183 | 196 |
184 desc.description = description; | 197 if (to != "") { |
198 desc.description = QString("%1: %2").arg(tn).arg(to); | |
199 } else { | |
200 desc.description = tn; | |
201 } | |
202 | |
185 m_transforms[name] = desc; | 203 m_transforms[name] = desc; |
186 } | 204 } |
187 } | 205 } |
188 | 206 |
189 void | 207 void |