Changeset View
Changeset View
Standalone View
Standalone View
krusader/DiskUsage/radialMap/builder.cpp
Show First 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | 100 | { | |||
---|---|---|---|---|---|
103 | if (dir->fileCount() == 0) //we do fileCount rather than size to avoid chance of divide by zero later | 103 | if (dir->fileCount() == 0) //we do fileCount rather than size to avoid chance of divide by zero later | ||
104 | return false; | 104 | return false; | ||
105 | 105 | | |||
106 | FileSize hiddenSize = 0; | 106 | FileSize hiddenSize = 0; | ||
107 | uint hiddenFileCount = 0; | 107 | uint hiddenFileCount = 0; | ||
108 | 108 | | |||
109 | for (ConstIterator<File> it = dir->constIterator(); it != dir->end(); ++it) { | 109 | for (ConstIterator<File> it = dir->constIterator(); it != dir->end(); ++it) { | ||
110 | if ((*it)->size() > m_limits[depth]) { | 110 | if ((*it)->size() > m_limits[depth]) { | ||
111 | unsigned int a_len = (unsigned int)(5760 * ((double)(*it)->size() / (double)m_root->size())); | 111 | auto a_len = (unsigned int)(5760 * ((double)(*it)->size() / (double)m_root->size())); | ||
112 | 112 | | |||
113 | Segment *s = new Segment(*it, a_start, a_len); | 113 | auto *s = new Segment(*it, a_start, a_len); | ||
114 | 114 | | |||
115 | (m_signature + depth)->append(s); | 115 | (m_signature + depth)->append(s); | ||
116 | 116 | | |||
117 | if ((*it)->isDir()) { | 117 | if ((*it)->isDir()) { | ||
118 | if (depth != *m_depth) { | 118 | if (depth != *m_depth) { | ||
119 | //recurse | 119 | //recurse | ||
120 | s->m_hasHiddenChildren = build((Directory*) * it, depth + 1, a_start, a_start + a_len); | 120 | s->m_hasHiddenChildren = build((Directory*) * it, depth + 1, a_start, a_start + a_len); | ||
121 | } else s->m_hasHiddenChildren = true; | 121 | } else s->m_hasHiddenChildren = true; | ||
122 | } | 122 | } | ||
123 | 123 | | |||
124 | a_start += a_len; //**** should we add 1? | 124 | a_start += a_len; //**** should we add 1? | ||
125 | 125 | | |||
126 | } else { | 126 | } else { | ||
127 | 127 | | |||
128 | hiddenSize += (*it)->size(); | 128 | hiddenSize += (*it)->size(); | ||
129 | 129 | | |||
130 | if ((*it)->isDir()) //**** considered virtual, but dir wouldn't count itself! | 130 | if ((*it)->isDir()) //**** considered virtual, but dir wouldn't count itself! | ||
131 | hiddenFileCount += static_cast<const Directory*>(*it)->fileCount(); //need to add one to count the dir as well | 131 | hiddenFileCount += dynamic_cast<const Directory*>(*it)->fileCount(); //need to add one to count the dir as well | ||
132 | 132 | | |||
133 | ++hiddenFileCount; | 133 | ++hiddenFileCount; | ||
134 | } | 134 | } | ||
135 | } | 135 | } | ||
136 | 136 | | |||
137 | if (hiddenFileCount == dir->fileCount() && !Config::showSmallFiles) | 137 | if (hiddenFileCount == dir->fileCount() && !Config::showSmallFiles) | ||
138 | 138 | | |||
139 | return true; | 139 | return true; | ||
Show All 10 Lines |