comparison src/filestatuswidget.cpp @ 542:7829da6abe97 fswatcher

Provide all tracked files to the fs watcher, so now we get updates properly -- requires moving the "what should we display?" logic for show-all-files toggle from main window to file status widget, but it's probably better there anyway
author Chris Cannam
date Tue, 14 Feb 2012 16:48:01 +0000
parents 896b7903e8f2
children a1d210c767ab
comparison
equal deleted inserted replaced
541:0a16db274f2c 542:7829da6abe97
176 bool FileStatusWidget::shouldShowAll() const 176 bool FileStatusWidget::shouldShowAll() const
177 { 177 {
178 return m_showAllFiles->isChecked(); 178 return m_showAllFiles->isChecked();
179 } 179 }
180 180
181 bool FileStatusWidget::shouldShow(FileStates::State s) const
182 {
183 if (shouldShowAll()) return true;
184 else return (s != FileStates::Clean &&
185 s != FileStates::Ignored);
186 }
187
181 QString FileStatusWidget::labelFor(FileStates::State s, bool addHighlightExplanation) 188 QString FileStatusWidget::labelFor(FileStates::State s, bool addHighlightExplanation)
182 { 189 {
183 QSettings settings; 190 QSettings settings;
184 settings.beginGroup("Presentation"); 191 settings.beginGroup("Presentation");
185 if (settings.value("showhelpfultext", true).toBool()) { 192 if (settings.value("showhelpfultext", true).toBool()) {
191 } else { 198 } else {
192 return QString("<qt><b>%1</b><br>%2</qt>") 199 return QString("<qt><b>%1</b><br>%2</qt>")
193 .arg(m_simpleLabels[s]) 200 .arg(m_simpleLabels[s])
194 .arg(m_descriptions[s]); 201 .arg(m_descriptions[s]);
195 } 202 }
196 } else { 203 }
197 return QString("<qt><b>%1</b></qt>") 204 return QString("<qt><b>%1</b></qt>")
198 .arg(m_simpleLabels[s]); 205 .arg(m_simpleLabels[s]);
199 }
200 settings.endGroup();
201 } 206 }
202 207
203 void FileStatusWidget::setNoModificationsLabelText() 208 void FileStatusWidget::setNoModificationsLabelText()
204 { 209 {
205 QSettings settings; 210 QSettings settings;
423 428
424 foreach (FileStates::State s, m_stateListMap.keys()) { 429 foreach (FileStates::State s, m_stateListMap.keys()) {
425 430
426 QListWidget *w = m_stateListMap[s]; 431 QListWidget *w = m_stateListMap[s];
427 w->clear(); 432 w->clear();
433
434 if (!shouldShow(s)) {
435 w->parentWidget()->hide();
436 continue;
437 }
438
428 QStringList files = m_fileStates.filesInState(s); 439 QStringList files = m_fileStates.filesInState(s);
429 440
430 QStringList highPriority, lowPriority; 441 QStringList highPriority, lowPriority;
431 442
432 foreach (QString file, files) { 443 foreach (QString file, files) {