Changeset 13930 for trunk/qt/file-tree.cc
- Timestamp:
- Feb 1, 2013, 10:40:08 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt/file-tree.cc
r13929 r13930 11 11 */ 12 12 13 #include <algorithm> 13 14 #include <cassert> 14 15 … … 188 189 #include <iostream> 189 190 190 bool 191 std::pair<int,int> 191 192 FileTreeItem :: update (const QString& name, 192 193 bool wanted, … … 195 196 bool updateFields) 196 197 { 197 bool changed = false; 198 int changed_count = 0; 199 int changed_fields[3]; 198 200 199 201 if (myName != name) … … 203 205 204 206 myName = name; 205 changed = true;207 changed_fields[changed_count++] = COL_NAME; 206 208 } 207 209 … … 209 211 { 210 212 if (myHaveSize != haveSize) 211 { 212 myHaveSize = haveSize; 213 changed = true; 214 } 213 myHaveSize = haveSize; 215 214 216 215 if (updateFields) … … 219 218 { 220 219 myIsWanted = wanted; 221 changed = true;220 changed_fields[changed_count++] = COL_WANTED; 222 221 } 223 222 … … 225 224 { 226 225 myPriority = priority; 227 changed = true;226 changed_fields[changed_count++] = COL_PRIORITY; 228 227 } 229 228 } 230 229 } 231 230 231 std::pair<int,int> changed (-1, -1); 232 if (changed_count > 0) 233 { 234 std::sort (changed_fields, changed_fields+changed_count); 235 changed.first = changed_fields[0]; 236 changed.second = changed_fields [changed_count-1]; 237 std::cerr << "changed.first " << changed.first << " changed.second " << changed.second << std::endl; 238 } 232 239 return changed; 233 240 } … … 567 574 568 575 return ret; 569 }570 571 void572 FileTreeModel :: itemChanged (FileTreeItem * item)573 {574 dataChanged (indexOf(item, FIRST_VISIBLE_COLUMN), indexOf(item, LAST_VISIBLE_COLUMN));575 576 } 576 577 … … 596 597 { 597 598 const QString token = tokens.takeLast(); 598 if (item->update (token, wanted, priority, have, updateFields)) 599 itemChanged (item); 599 const std::pair<int,int> changed = item->update (token, wanted, priority, have, updateFields); 600 if (changed.first >= 0) 601 dataChanged (indexOf (item, changed.first), indexOf (item, changed.second)); 600 602 item = item->parent(); 601 603 } … … 633 635 assert (item->totalSize() == totalSize); 634 636 635 if (item->update (item->name(), wanted, priority, have, added || updateFields)) 636 itemChanged (item); 637 const std::pair<int,int> changed = item->update (item->name(), wanted, priority, have, added || updateFields); 638 if (changed.first >= 0) 639 dataChanged (indexOf (item, changed.first), indexOf (item, changed.second)); 637 640 } 638 641 }
Note: See TracChangeset
for help on using the changeset viewer.