# HG changeset patch # User Chris Cannam # Date 1224002195 0 # Node ID 4711b400f9760dc44bc8e9e4038e9edac5044f99 # Parent bcaeb2ba9b74ab61bea101d40b8fe5daa5799bbb * Add beginnings of capability to search plugins that are not yet installed -- lots more work to do here, though diff -r bcaeb2ba9b74 -r 4711b400f976 widgets/TransformFinder.cpp --- a/widgets/TransformFinder.cpp Fri Oct 10 16:03:48 2008 +0000 +++ b/widgets/TransformFinder.cpp Tue Oct 14 16:36:35 2008 +0000 @@ -131,7 +131,7 @@ std::cerr << results.size() << " result(s)..." << std::endl; - std::set sorted; + std::set sorted; sorted.clear(); for (TransformFactory::SearchResults::const_iterator j = results.begin(); j != results.end(); ++j) { @@ -139,7 +139,7 @@ } m_sortedResults.clear(); - for (std::set::const_iterator j = sorted.end(); + for (std::set::const_iterator j = sorted.end(); j != sorted.begin(); ) { --j; m_sortedResults.push_back(*j); @@ -147,7 +147,7 @@ } if (m_sortedResults.empty()) m_selectedTransform = ""; - else m_selectedTransform = m_sortedResults.begin()->transform; + else m_selectedTransform = m_sortedResults.begin()->key; m_upToDateCount = 0; @@ -164,18 +164,29 @@ int i = m_upToDateCount; - std::cerr << "sorted size = " << m_sortedResults.size() << std::endl; +// std::cerr << "sorted size = " << m_sortedResults.size() << std::endl; - TransformDescription desc = - TransformFactory::getInstance()->getTransformDescription - (m_sortedResults[i].transform); + TransformDescription desc; + TransformId tid = m_sortedResults[i].key; + TransformFactory *factory = TransformFactory::getInstance(); + TransformFactory::TransformInstallStatus status = + factory->getTransformInstallStatus(tid); + QString suffix; + + if (status == TransformFactory::TransformInstalled) { + desc = factory->getTransformDescription(tid); + } else { + desc = factory->getUninstalledTransformDescription(tid); + suffix = tr(" (not installed)"); + } QString labelText; - labelText += tr("%1
") - .arg(XmlExportable::encodeEntities(desc.name)); + labelText += tr("%1%2
") + .arg(XmlExportable::encodeEntities(desc.name)) + .arg(suffix); labelText += "..."; - for (TransformFactory::Match::FragmentMap::const_iterator k = + for (TextMatcher::Match::FragmentMap::const_iterator k = m_sortedResults[i].fragments.begin(); k != m_sortedResults[i].fragments.end(); ++k) { labelText += k->second; @@ -184,16 +195,28 @@ labelText += tr(""); QString selectedText; - selectedText += tr("%1
") - .arg(XmlExportable::encodeEntities(desc.name)); - selectedText += tr("%1") - .arg(XmlExportable::encodeEntities(desc.longDescription)); + selectedText += tr("%1%2
") + .arg(XmlExportable::encodeEntities + (desc.name == "" ? desc.identifier : desc.name)) + .arg(suffix); + + if (desc.longDescription != "") { + selectedText += tr("%1") + .arg(XmlExportable::encodeEntities(desc.longDescription)); + } else if (desc.description != "") { + selectedText += tr("%1") + .arg(XmlExportable::encodeEntities(desc.description)); + } selectedText += tr("
"); - selectedText += tr("      — Plugin type: %1
") - .arg(XmlExportable::encodeEntities(desc.type)); - selectedText += tr("      — Category: %1
") - .arg(XmlExportable::encodeEntities(desc.category)); + if (desc.type != "") { + selectedText += tr("      — Plugin type: %1
") + .arg(XmlExportable::encodeEntities(desc.type)); + } + if (desc.category != "") { + selectedText += tr("      — Category: %1
") + .arg(XmlExportable::encodeEntities(desc.category)); + } selectedText += tr("      — System identifier: %1") .arg(XmlExportable::encodeEntities(desc.identifier)); selectedText += tr("
"); diff -r bcaeb2ba9b74 -r 4711b400f976 widgets/TransformFinder.h --- a/widgets/TransformFinder.h Fri Oct 10 16:03:48 2008 +0000 +++ b/widgets/TransformFinder.h Tue Oct 14 16:36:35 2008 +0000 @@ -56,7 +56,7 @@ QTimer *m_timer; QString m_newSearchText; - typedef std::vector SortedResults; + typedef std::vector SortedResults; SortedResults m_sortedResults; int m_upToDateCount; };