Mercurial > hg > svgui
comparison widgets/TransformFinder.cpp @ 450:35b7cbcfc2d0
* Add more informative text to Find a Transform (particularly when none
available)
author | Chris Cannam |
---|---|
date | Thu, 20 Nov 2008 12:09:55 +0000 |
parents | f2ef0ff2e3b0 |
children | 129d1e82a94e |
comparison
equal
deleted
inserted
replaced
449:f2ef0ff2e3b0 | 450:35b7cbcfc2d0 |
---|---|
46 QLineEdit *searchField = new QLineEdit; | 46 QLineEdit *searchField = new QLineEdit; |
47 mainGrid->addWidget(searchField, 0, 1); | 47 mainGrid->addWidget(searchField, 0, 1); |
48 connect(searchField, SIGNAL(textChanged(const QString &)), | 48 connect(searchField, SIGNAL(textChanged(const QString &)), |
49 this, SLOT(searchTextChanged(const QString &))); | 49 this, SLOT(searchTextChanged(const QString &))); |
50 | 50 |
51 m_infoLabel = new QLabel(tr("Type in this box to search descriptions of available and known transforms")); | 51 // m_infoLabel = new QLabel(tr("Type in this box to search descriptions of available and known transforms")); |
52 m_infoLabel = new QLabel; | |
52 mainGrid->addWidget(m_infoLabel, 1, 1); | 53 mainGrid->addWidget(m_infoLabel, 1, 1); |
53 | 54 |
54 m_resultsScroll = new QScrollArea; | 55 m_resultsScroll = new QScrollArea; |
55 mainGrid->addWidget(m_resultsScroll, 2, 0, 1, 2); | 56 mainGrid->addWidget(m_resultsScroll, 2, 0, 1, 2); |
56 mainGrid->setRowStretch(2, 10); | 57 mainGrid->setRowStretch(2, 10); |
104 } | 105 } |
105 | 106 |
106 resize(width, height); | 107 resize(width, height); |
107 raise(); | 108 raise(); |
108 | 109 |
110 setupBeforeSearchLabel(); | |
111 | |
109 m_upToDateCount = 0; | 112 m_upToDateCount = 0; |
110 m_timer = new QTimer(this); | 113 m_timer = new QTimer(this); |
111 connect(m_timer, SIGNAL(timeout()), this, SLOT(timeout())); | 114 connect(m_timer, SIGNAL(timeout()), this, SLOT(timeout())); |
112 m_timer->start(30); | 115 m_timer->start(30); |
113 } | 116 } |
114 | 117 |
115 TransformFinder::~TransformFinder() | 118 TransformFinder::~TransformFinder() |
116 { | 119 { |
120 } | |
121 | |
122 void | |
123 TransformFinder::setupBeforeSearchLabel() | |
124 { | |
125 bool haveInstalled = | |
126 TransformFactory::getInstance()->haveInstalledTransforms(); | |
127 bool haveUninstalled = | |
128 TransformFactory::getInstance()->haveUninstalledTransforms(); | |
129 | |
130 m_beforeSearchLabel->setWordWrap(true); | |
131 m_beforeSearchLabel->setOpenExternalLinks(true); | |
132 m_beforeSearchLabel->setTextInteractionFlags(Qt::LinksAccessibleByMouse); | |
133 m_beforeSearchLabel->setMargin(12); | |
134 m_beforeSearchLabel->setFixedWidth(this->width() - 40); | |
135 | |
136 QString base = | |
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>"); | |
138 | |
139 QString nopull = | |
140 tr("<b>Unable to retrieve published descriptions from network!</b>"); | |
141 | |
142 QString noinst = | |
143 tr("<b>No plugins are currently installed!</b>"); | |
144 | |
145 if (haveInstalled) { | |
146 if (haveUninstalled) { | |
147 m_beforeSearchLabel->setText(base); | |
148 } else { | |
149 m_beforeSearchLabel->setText | |
150 (base + | |
151 tr("<p>%1<br>Perhaps the network connection is down, or services are responding too slowly.<br>Only the descriptions of installed plugins will be searched.").arg(nopull)); | |
152 } | |
153 } else { | |
154 if (haveUninstalled) { | |
155 m_beforeSearchLabel->setText | |
156 (base + | |
157 tr("<p>%1<br>Only the published descriptions of Vamp feature extraction plugins will be searched.").arg(noinst)); | |
158 } else { | |
159 m_beforeSearchLabel->setText | |
160 (base + | |
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)); | |
162 } | |
163 } | |
164 | |
165 m_beforeSearchLabel->show(); | |
166 m_resultsFrame->resize(m_resultsFrame->sizeHint()); | |
117 } | 167 } |
118 | 168 |
119 void | 169 void |
120 TransformFinder::searchTextChanged(const QString &text) | 170 TransformFinder::searchTextChanged(const QString &text) |
121 { | 171 { |
161 | 211 |
162 for (int j = m_labels.size(); j > m_sortedResults.size(); ) { | 212 for (int j = m_labels.size(); j > m_sortedResults.size(); ) { |
163 m_labels[--j]->hide(); | 213 m_labels[--j]->hide(); |
164 } | 214 } |
165 | 215 |
216 m_beforeSearchLabel->hide(); | |
217 | |
166 if (m_sortedResults.empty()) { | 218 if (m_sortedResults.empty()) { |
167 m_noResultsLabel->show(); | 219 m_noResultsLabel->show(); |
168 m_resultsFrame->resize(m_resultsFrame->sizeHint()); | 220 m_resultsFrame->resize(m_resultsFrame->sizeHint()); |
169 } else { | 221 } else { |
170 m_noResultsLabel->hide(); | 222 m_noResultsLabel->hide(); |