comparison 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
comparison
equal deleted inserted replaced
198:4adbd5c9c15d 199:f16fe0db11f3
25 { 25 {
26 } 26 }
27 27
28 void FileStates::clearBuckets() 28 void FileStates::clearBuckets()
29 { 29 {
30 m_clean.clear();
30 m_modified.clear(); 31 m_modified.clear();
31 m_added.clear(); 32 m_added.clear();
32 m_removed.clear(); 33 m_removed.clear();
33 m_missing.clear(); 34 m_missing.clear();
34 m_inConflict.clear(); 35 m_inConflict.clear();
35 m_unknown.clear(); 36 m_unknown.clear();
37 m_ignored.clear();
36 } 38 }
37 39
38 FileStates::State FileStates::charToState(QChar c, bool *ok) 40 FileStates::State FileStates::charToState(QChar c, bool *ok)
39 { 41 {
40 // Note that InConflict does not correspond to a stat char -- it's 42 // Note that InConflict does not correspond to a stat char -- it's
51 if (c == 'R') return Removed; 53 if (c == 'R') return Removed;
52 if (c == '!') return Missing; 54 if (c == '!') return Missing;
53 if (c == 'U') return InConflict; 55 if (c == 'U') return InConflict;
54 if (c == '?') return Unknown; 56 if (c == '?') return Unknown;
55 if (c == 'C') return Clean; 57 if (c == 'C') return Clean;
58 if (c == 'I') return Ignored;
56 if (ok) *ok = false; 59 if (ok) *ok = false;
57 return Unknown; 60 return Unknown;
58 } 61 }
59 62
60 QStringList *FileStates::stateToBucket(State s) 63 QStringList *FileStates::stateToBucket(State s)
61 { 64 {
62 switch (s) { 65 switch (s) {
63 case Clean: default: return 0; // not implemented yet 66 case Clean: return &m_clean; // not implemented yet
64 case Modified: return &m_modified; 67 case Modified: return &m_modified;
65 case Added: return &m_added; 68 case Added: return &m_added;
66 case Unknown: return &m_unknown; 69 case Unknown: return &m_unknown;
67 case Removed: return &m_removed; 70 case Removed: return &m_removed;
68 case Missing: return &m_missing; 71 case Missing: return &m_missing;
69 case InConflict: return &m_inConflict; 72 case InConflict: return &m_inConflict;
73 case Ignored: return &m_ignored;
70 } 74 }
71 } 75 }
72 76
73 void FileStates::parseStates(QString text) 77 void FileStates::parseStates(QString text)
74 { 78 {
93 QString file = line.right(line.length() - 2); 97 QString file = line.right(line.length() - 2);
94 m_stateMap[file] = s; 98 m_stateMap[file] = s;
95 } 99 }
96 100
97 foreach (QString file, m_stateMap.keys()) { 101 foreach (QString file, m_stateMap.keys()) {
98
99 QStringList *bucket = stateToBucket(m_stateMap[file]); 102 QStringList *bucket = stateToBucket(m_stateMap[file]);
100 bucket->push_back(file); 103 if (bucket) bucket->push_back(file);
101 } 104 }
102 105
103 DEBUG << "FileStates: " << m_modified.size() << " modified, " << m_added.size() 106 DEBUG << "FileStates: "
107 << m_modified.size() << " modified, " << m_added.size()
104 << " added, " << m_removed.size() << " removed, " << m_missing.size() 108 << " added, " << m_removed.size() << " removed, " << m_missing.size()
105 << " missing, " << m_inConflict.size() << " in conflict, " 109 << " missing, " << m_inConflict.size() << " in conflict, "
106 << m_unknown.size() << " unknown" << endl; 110 << m_unknown.size() << " unknown" << endl;
107 } 111 }
108 112