diff filestates.cpp @ 199:f16fe0db11f3

* Add "Show All Files" toggle to show ignored and clean files * Clear selection when Esc is pressed * Don't delete and recreate the filesystem watcher on stat, just update it
author Chris Cannam
date Mon, 03 Jan 2011 22:02:08 +0000
parents 5c262ac73948
children 3cc6455e58c2
line wrap: on
line diff
--- a/filestates.cpp	Mon Jan 03 14:31:22 2011 +0000
+++ b/filestates.cpp	Mon Jan 03 22:02:08 2011 +0000
@@ -27,12 +27,14 @@
 
 void FileStates::clearBuckets()
 {
+    m_clean.clear();
     m_modified.clear();
     m_added.clear();
     m_removed.clear();
     m_missing.clear();
     m_inConflict.clear();
     m_unknown.clear();
+    m_ignored.clear();
 }
 
 FileStates::State FileStates::charToState(QChar c, bool *ok)
@@ -53,6 +55,7 @@
     if (c == 'U') return InConflict;
     if (c == '?') return Unknown;
     if (c == 'C') return Clean;
+    if (c == 'I') return Ignored;
     if (ok) *ok = false;
     return Unknown;
 }
@@ -60,13 +63,14 @@
 QStringList *FileStates::stateToBucket(State s)
 {
     switch (s) {
-    case Clean: default: return 0; // not implemented yet
+    case Clean: return &m_clean; // not implemented yet
     case Modified: return &m_modified;
     case Added: return &m_added;
     case Unknown: return &m_unknown;
     case Removed: return &m_removed;
     case Missing: return &m_missing;
     case InConflict: return &m_inConflict;
+    case Ignored: return &m_ignored;
     }
 }
 
@@ -95,12 +99,12 @@
     }
 
     foreach (QString file, m_stateMap.keys()) {
-
         QStringList *bucket = stateToBucket(m_stateMap[file]);
-        bucket->push_back(file);
+        if (bucket) bucket->push_back(file);
     }
 
-    DEBUG << "FileStates: " << m_modified.size() << " modified, " << m_added.size()
+    DEBUG << "FileStates: "
+          << m_modified.size() << " modified, " << m_added.size()
           << " added, " << m_removed.size() << " removed, " << m_missing.size()
           << " missing, " << m_inConflict.size() << " in conflict, "
           << m_unknown.size() << " unknown" << endl;