diff 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
line wrap: on
line diff
--- a/src/filestatuswidget.cpp	Tue Feb 14 16:17:23 2012 +0000
+++ b/src/filestatuswidget.cpp	Tue Feb 14 16:48:01 2012 +0000
@@ -178,6 +178,13 @@
     return m_showAllFiles->isChecked();
 }
 
+bool FileStatusWidget::shouldShow(FileStates::State s) const
+{
+    if (shouldShowAll()) return true;
+    else return (s != FileStates::Clean &&
+                 s != FileStates::Ignored);
+}
+
 QString FileStatusWidget::labelFor(FileStates::State s, bool addHighlightExplanation)
 {
     QSettings settings;
@@ -193,11 +200,9 @@
                 .arg(m_simpleLabels[s])
                 .arg(m_descriptions[s]);
         }
-    } else {
-        return QString("<qt><b>%1</b></qt>")
-            .arg(m_simpleLabels[s]);
     }
-    settings.endGroup();
+    return QString("<qt><b>%1</b></qt>")
+        .arg(m_simpleLabels[s]);
 }
 
 void FileStatusWidget::setNoModificationsLabelText()
@@ -425,6 +430,12 @@
 
         QListWidget *w = m_stateListMap[s];
         w->clear();
+
+        if (!shouldShow(s)) {
+            w->parentWidget()->hide();
+            continue;
+        }
+
         QStringList files = m_fileStates.filesInState(s);
 
         QStringList highPriority, lowPriority;