comparison src/filestatuswidget.cpp @ 558:d932ce55c364 find

Remove the single find widget from top, add one to each tab at the bottom instead. (Turns out you don't usually want to search for the same text in both types of widget.) Also provide sensible no-results text.
author Chris Cannam
date Mon, 27 Feb 2012 17:08:26 +0000
parents 57a7f95ef400
children 533519ebc0cb
comparison
equal deleted inserted replaced
557:57a7f95ef400 558:d932ce55c364
16 */ 16 */
17 17
18 #include "filestatuswidget.h" 18 #include "filestatuswidget.h"
19 #include "debug.h" 19 #include "debug.h"
20 #include "multichoicedialog.h" 20 #include "multichoicedialog.h"
21 #include "findwidget.h"
21 22
22 #include <QLabel> 23 #include <QLabel>
23 #include <QListWidget> 24 #include <QListWidget>
24 #include <QGridLayout> 25 #include <QGridLayout>
25 #include <QFileInfo> 26 #include <QFileInfo>
152 153
153 layout->setRowStretch(++row, 20); 154 layout->setRowStretch(++row, 20);
154 155
155 layout->addItem(new QSpacerItem(8, 8), ++row, 0); 156 layout->addItem(new QSpacerItem(8, 8), ++row, 0);
156 157
157 m_showAllFiles = new QCheckBox(tr("Show all files"), this); 158 QWidget *opts = new QWidget;
159 QGridLayout *optLayout = new QGridLayout(opts);
160 optLayout->setMargin(0);
161 layout->addWidget(opts, ++row, 0);
162
163 m_findWidget = new FindWidget(this);
164 optLayout->addWidget(m_findWidget, 0, 0, Qt::AlignLeft);
165 connect(m_findWidget, SIGNAL(findTextChanged(QString)),
166 this, SLOT(setSearchText(QString)));
167
168 m_showAllFiles = new QCheckBox(tr("Show all file states"), this);
158 m_showAllFiles->setEnabled(false); 169 m_showAllFiles->setEnabled(false);
159 layout->addWidget(m_showAllFiles, ++row, 0, Qt::AlignLeft); 170 optLayout->addWidget(m_showAllFiles, 0, 1, Qt::AlignRight);
160 171
161 QSettings settings; 172 QSettings settings;
162 m_showAllFiles->setChecked(settings.value("showall", false).toBool()); 173 m_showAllFiles->setChecked(settings.value("showall", false).toBool());
163 174
164 connect(m_showAllFiles, SIGNAL(toggled(bool)), 175 connect(m_showAllFiles, SIGNAL(toggled(bool)),
207 218
208 void FileStatusWidget::setNoModificationsLabelText() 219 void FileStatusWidget::setNoModificationsLabelText()
209 { 220 {
210 QSettings settings; 221 QSettings settings;
211 settings.beginGroup("Presentation"); 222 settings.beginGroup("Presentation");
212 if (settings.value("showhelpfultext", true).toBool()) { 223
224 if (m_searchText != "") {
225 if (!m_showAllFiles->isChecked()) {
226 m_noModificationsLabel->setText
227 (tr("<qt><b>Nothing found</b><br>None of the modified files have matching filenames.<br>Select <b>Show all file states</b> to find matches among unmodified and untracked files as well.</qt>"));
228 } else {
229 m_noModificationsLabel->setText
230 (tr("<qt><b>Nothing found</b><br>No files have matching filenames.</qt>"));
231 }
232 } else if (settings.value("showhelpfultext", true).toBool()) {
213 m_noModificationsLabel->setText 233 m_noModificationsLabel->setText
214 (tr("<qt>This area will list files in your working folder that you have changed.<br><br>At the moment you have no uncommitted changes.<br><br>To see changes previously made to the repository,<br>switch to the History tab.<br><br>%1</qt>") 234 (tr("<qt>This area will list files in your working folder that you have changed.<br><br>At the moment you have no uncommitted changes.<br><br>To see changes previously made to the repository,<br>switch to the History tab.<br><br>%1</qt>")
215 #if defined Q_OS_MAC 235 #if defined Q_OS_MAC
216 .arg(tr("To open the working folder in Finder,<br>click on the &ldquo;Local&rdquo; folder path shown above.")) 236 .arg(tr("To open the working folder in Finder,<br>click on the &ldquo;Local&rdquo; folder path shown above."))
217 #elif defined Q_OS_WIN32 237 #elif defined Q_OS_WIN32