18 #include "base/XmlExportable.h" 19 #include "transform/TransformFactory.h" 22 #include <QVBoxLayout> 23 #include <QGridLayout> 26 #include <QDialogButtonBox> 27 #include <QScrollArea> 28 #include <QApplication> 29 #include <QDesktopWidget> 38 setWindowTitle(tr(
"Find a Transform"));
40 QGridLayout *mainGrid =
new QGridLayout;
41 mainGrid->setVerticalSpacing(0);
44 mainGrid->addWidget(
new QLabel(tr(
"Find:")), 0, 0);
46 QLineEdit *searchField =
new QLineEdit;
47 mainGrid->addWidget(searchField, 0, 1);
48 connect(searchField, SIGNAL(textChanged(
const QString &)),
57 mainGrid->setRowStretch(2, 10);
59 QDialogButtonBox *bb =
new QDialogButtonBox(QDialogButtonBox::Ok |
60 QDialogButtonBox::Cancel);
61 mainGrid->addWidget(bb, 3, 0, 1, 2);
62 connect(bb, SIGNAL(accepted()),
this, SLOT(accept()));
63 connect(bb, SIGNAL(rejected()),
this, SLOT(reject()));
67 palette.setColor(QPalette::Window, palette.color(QPalette::Base));
85 QAction *
up =
new QAction(tr(
"Up"),
this);
86 up->setShortcut(tr(
"Up"));
87 connect(
up, SIGNAL(triggered()),
this, SLOT(
up()));
90 QAction *
down =
new QAction(tr(
"Down"),
this);
91 down->setShortcut(tr(
"Down"));
92 connect(
down, SIGNAL(triggered()),
this, SLOT(
down()));
95 QDesktopWidget *desktop = QApplication::desktop();
96 QRect available = desktop->availableGeometry();
98 int width = available.width() / 2;
99 int height = available.height() / 2;
101 if (available.height() > 500) height = 450;
104 if (available.width() > 650) width = 600;
107 resize(width, height);
126 TransformFactory::getInstance()->haveInstalledTransforms();
127 bool haveUninstalled =
128 TransformFactory::getInstance()->haveUninstalledTransforms();
137 tr(
"<p>Type some text into the search box to search the descriptions of:<ul><li>All currently installed <a href=\"http://www.vamp-plugins.org/\">Vamp</a> audio feature extraction plugins</li><li>All currently installed <a href=\"http://www.ladspa.org/\">LADSPA</a> audio effects plugins</li><li>Vamp plugins that are not currently installed but that have descriptions published via the semantic web</li></ul>");
140 tr(
"<b>Unable to retrieve published descriptions from network!</b>");
143 tr(
"<b>No plugins are currently installed!</b>");
146 if (haveUninstalled) {
151 tr(
"<p>%1<br>Perhaps the network connection is down, services are responding too slowly, or a processing problem has occurred.<br>Only the descriptions of installed plugins will be searched.").arg(nopull));
154 if (haveUninstalled) {
157 tr(
"<p>%1<br>Only the published descriptions of Vamp feature extraction plugins will be searched.").arg(noinst));
161 tr(
"<p>%1<br>%2<br>Perhaps the network connection is down, or services are responding too slowly.<br>No search results will be available.").arg(noinst).arg(nopull));
186 QStringList keywords = text.split(
' ', QString::SkipEmptyParts);
187 TransformFactory::SearchResults results =
188 TransformFactory::getInstance()->search(keywords);
192 std::set<TextMatcher::Match> sorted;
194 for (TransformFactory::SearchResults::const_iterator j = results.begin();
195 j != results.end(); ++j) {
196 sorted.insert(j->second);
200 for (std::set<TextMatcher::Match>::const_iterator j = sorted.end();
201 j != sorted.begin(); ) {
227 (tr(
"Found %n description(s) containing <b>%1</b>, showing the first %2 only",
231 (tr(
"Found %n description(s) containing <b>%1</b>",
232 0, sorted.size()).arg(text));
246 TransformDescription desc;
248 TransformFactory *factory = TransformFactory::getInstance();
249 TransformFactory::TransformInstallStatus status =
250 factory->getTransformInstallStatus(tid);
253 if (status == TransformFactory::TransformInstalled) {
254 desc = factory->getTransformDescription(tid);
256 desc = factory->getUninstalledTransformDescription(tid);
257 suffix = tr(
"<i> (not installed)</i>");
261 labelText += tr(
"%1%2<br><small>")
262 .arg(XmlExportable::encodeEntities(desc.name))
266 for (TextMatcher::Match::FragmentMap::const_iterator k =
269 labelText += k->second;
272 labelText += tr(
"</small>");
274 QString selectedText;
275 selectedText += tr(
"<b>%1</b>%2<br>")
276 .arg(XmlExportable::encodeEntities
277 (desc.name ==
"" ? desc.identifier : desc.name))
280 if (desc.longDescription !=
"") {
281 selectedText += tr(
"<small>%1</small>")
282 .arg(XmlExportable::encodeEntities(desc.longDescription));
283 }
else if (desc.description !=
"") {
284 selectedText += tr(
"<small>%1</small>")
285 .arg(XmlExportable::encodeEntities(desc.description));
288 selectedText += tr(
"<small>");
289 if (desc.type != TransformDescription::UnknownType) {
290 selectedText += tr(
"<br> — Plugin type: %1")
291 .arg(XmlExportable::encodeEntities(factory->getTransformTypeName(desc.type)));
293 if (desc.category !=
"") {
294 selectedText += tr(
"<br> — Category: %1")
295 .arg(XmlExportable::encodeEntities(desc.category));
297 selectedText += tr(
"<br> — System identifier: %1")
298 .arg(XmlExportable::encodeEntities(desc.identifier));
299 if (desc.infoUrl !=
"") {
300 selectedText += tr(
"<br> — More information: <a href=\"%1\">%1</a>")
303 selectedText += tr(
"</small>");
308 connect(label, SIGNAL(selectionChanged()),
this,
310 connect(label, SIGNAL(doubleClicked()),
this,
312 QPalette palette = label->palette();
313 label->setPalette(palette);
317 m_labels[i]->setObjectName(desc.identifier);
318 m_labels[i]->setFixedWidth(this->width() - 40);
319 m_labels[i]->setUnselectedText(labelText);
322 m_labels[i]->setSelectedText(selectedText);
339 QObject *s = sender();
341 for (
int i = 0; i < (int)
m_labels.size(); ++i) {
342 if (!
m_labels[i]->isVisible())
continue;
353 cerr <<
"selectedLabelChanged: selected transform is now \"" 361 if (TransformFactory::getInstance()->getTransformInstallStatus
363 TransformFactory::TransformInstalled) {
377 for (
int i = 0; i < (int)
m_labels.size(); ++i) {
378 if (!
m_labels[i]->isVisible())
continue;
393 for (
int i = 0; i < (int)
m_labels.size(); ++i) {
394 if (!
m_labels[i]->isVisible())
continue;