# HG changeset patch # User Chris Cannam # Date 1227182995 0 # Node ID 35b7cbcfc2d050d837e505b5010846f97ac578f2 # Parent f2ef0ff2e3b0673a8fb96c020edd58a9ae0cbe0a * Add more informative text to Find a Transform (particularly when none available) diff -r f2ef0ff2e3b0 -r 35b7cbcfc2d0 widgets/TransformFinder.cpp --- a/widgets/TransformFinder.cpp Wed Nov 19 21:36:33 2008 +0000 +++ b/widgets/TransformFinder.cpp Thu Nov 20 12:09:55 2008 +0000 @@ -48,7 +48,8 @@ connect(searchField, SIGNAL(textChanged(const QString &)), this, SLOT(searchTextChanged(const QString &))); - m_infoLabel = new QLabel(tr("Type in this box to search descriptions of available and known transforms")); +// m_infoLabel = new QLabel(tr("Type in this box to search descriptions of available and known transforms")); + m_infoLabel = new QLabel; mainGrid->addWidget(m_infoLabel, 1, 1); m_resultsScroll = new QScrollArea; @@ -106,6 +107,8 @@ resize(width, height); raise(); + setupBeforeSearchLabel(); + m_upToDateCount = 0; m_timer = new QTimer(this); connect(m_timer, SIGNAL(timeout()), this, SLOT(timeout())); @@ -117,6 +120,53 @@ } void +TransformFinder::setupBeforeSearchLabel() +{ + bool haveInstalled = + TransformFactory::getInstance()->haveInstalledTransforms(); + bool haveUninstalled = + TransformFactory::getInstance()->haveUninstalledTransforms(); + + m_beforeSearchLabel->setWordWrap(true); + m_beforeSearchLabel->setOpenExternalLinks(true); + m_beforeSearchLabel->setTextInteractionFlags(Qt::LinksAccessibleByMouse); + m_beforeSearchLabel->setMargin(12); + m_beforeSearchLabel->setFixedWidth(this->width() - 40); + + QString base = + tr("
Type some text into the search box to search the descriptions of:
%1
Perhaps the network connection is down, or services are responding too slowly.
Only the descriptions of installed plugins will be searched.").arg(nopull));
+ }
+ } else {
+ if (haveUninstalled) {
+ m_beforeSearchLabel->setText
+ (base +
+ tr("
%1
Only the published descriptions of Vamp feature extraction plugins will be searched.").arg(noinst));
+ } else {
+ m_beforeSearchLabel->setText
+ (base +
+ tr("
%1
%2
Perhaps the network connection is down, or services are responding too slowly.
No search results will be available.").arg(noinst).arg(nopull));
+ }
+ }
+
+ m_beforeSearchLabel->show();
+ m_resultsFrame->resize(m_resultsFrame->sizeHint());
+}
+
+void
TransformFinder::searchTextChanged(const QString &text)
{
// std::cerr << "text is " << text.toStdString() << std::endl;
@@ -163,6 +213,8 @@
m_labels[--j]->hide();
}
+ m_beforeSearchLabel->hide();
+
if (m_sortedResults.empty()) {
m_noResultsLabel->show();
m_resultsFrame->resize(m_resultsFrame->sizeHint());
diff -r f2ef0ff2e3b0 -r 35b7cbcfc2d0 widgets/TransformFinder.h
--- a/widgets/TransformFinder.h Wed Nov 19 21:36:33 2008 +0000
+++ b/widgets/TransformFinder.h Thu Nov 20 12:09:55 2008 +0000
@@ -60,6 +60,8 @@
TransformId m_selectedTransform;
QTimer *m_timer;
+ void setupBeforeSearchLabel();
+
QString m_newSearchText;
typedef std::vector