summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin T. H. Sandsmark <martin.sandsmark@kde.org>2016-08-06 16:07:50 (GMT)
committerMartin T. H. Sandsmark <martin.sandsmark@kde.org>2016-08-06 16:17:36 (GMT)
commit6a49b5c220b141f29dbff9fbc30a27b7ff320d47 (patch)
tree02a81e4ee9125b37c50e8d5ae8516747338a58e1
parentc171a24ceffa99f4b8a81dd48dbf13c993e36dad (diff)
tweak the limits for showing small files
-rw-r--r--src/part/radialMap/map.cpp62
-rw-r--r--src/part/radialMap/map.h2
2 files changed, 30 insertions, 34 deletions
diff --git a/src/part/radialMap/map.cpp b/src/part/radialMap/map.cpp
index e0a086c..cc67ebc 100644
--- a/src/part/radialMap/map.cpp
+++ b/src/part/radialMap/map.cpp
@@ -89,10 +89,10 @@ void RadialMap::Map::make(const Folder *tree, bool refresh)
// Calculate ring size limits
m_limits.resize(m_visibleDepth + 1);
- double size3 = m_root->size() * 3;
- double pi2B = PI * 2 * m_ringBreadth;
- for (unsigned int d = 0; d <= m_visibleDepth; ++d) {
- m_limits[d] = (uint)(size3 / (double)(pi2B * (d + 1))); //min is angle that gives 3px outer diameter for that depth
+ const double size = m_root->size();
+ const double pi2B = M_PI * 4 * m_ringBreadth;
+ for (uint depth = 0; depth <= m_visibleDepth; ++depth) {
+ m_limits[depth] = uint(size / double(pi2B * (depth + 1))); //min is angle that gives 3px outer diameter for that depth
}
build(tree);
@@ -154,46 +154,42 @@ bool RadialMap::Map::build(const Folder * const dir, const uint depth, uint a_st
if (dir->children() == 0) //we do fileCount rather than size to avoid chance of divide by zero later
return false;
- uint hiddenSize = 0, hiddenFileCount = 0;
+ FileSize hiddenSize = 0;
+ uint hiddenFileCount = 0;
- for (ConstIterator<File> it = dir->constIterator(); it != dir->end(); ++it)
- {
- if ((*it)->size() > m_limits[depth])
- {
- unsigned int a_len = (unsigned int)(5760 * ((double)(*it)->size() / (double)m_root->size()));
-
- Segment *s = new Segment(*it, a_start, a_len);
-
- (m_signature + depth)->append(s);
-
- if ((*it)->isFolder())
- {
- if (depth != m_visibleDepth)
- {
- //recurse
- s->m_hasHiddenChildren = build((Folder*)*it, depth + 1, a_start, a_start + a_len);
- }
- else s->m_hasHiddenChildren = true;
+ for (ConstIterator<File> it = dir->constIterator(); it != dir->end(); ++it) {
+ if ((*it)->size() < m_limits[depth] * 6) { // limit is half a degree? we want at least 3 degrees
+ hiddenSize += (*it)->size();
+ if ((*it)->isFolder()) { //**** considered virtual, but dir wouldn't count itself!
+ hiddenFileCount += static_cast<const Folder*>(*it)->children(); //need to add one to count the dir as well
}
+ ++hiddenFileCount;
+ continue;
+ }
- a_start += a_len; //**** should we add 1?
-
- } else {
-
- hiddenSize += (*it)->size();
+ unsigned int a_len = (unsigned int)(5760 * ((double)(*it)->size() / (double)m_root->size()));
- if ((*it)->isFolder()) //**** considered virtual, but dir wouldn't count itself!
- hiddenFileCount += static_cast<const Folder*>(*it)->children(); //need to add one to count the dir as well
+ Segment *s = new Segment(*it, a_start, a_len);
+ m_signature[depth].append(s);
- ++hiddenFileCount;
+ if ((*it)->isFolder()) {
+ if (depth != m_visibleDepth) {
+ //recurse
+ s->m_hasHiddenChildren = build((Folder*)*it, depth + 1, a_start, a_start + a_len);
+ } else {
+ s->m_hasHiddenChildren = true;
+ }
}
+
+ a_start += a_len; //**** should we add 1?
}
if (hiddenFileCount == dir->children() && !Config::showSmallFiles) {
return true;
- } else if ((Config::showSmallFiles && hiddenSize > m_limits[depth]) || (depth == 0 && (hiddenSize > dir->size()/8))) {
- //append a segment for unrepresented space - a "fake" segment
+ }
+ if ((depth == 0 || Config::showSmallFiles) && hiddenSize >= m_limits[depth]) {
+ //append a segment for unrepresented space - a "fake" segment
const QString s = i18np("1 file, with an average size of %2",
"%1 files, with an average size of %2",
hiddenFileCount,
diff --git a/src/part/radialMap/map.h b/src/part/radialMap/map.h
index 8ba5c7f..2bf29fa 100644
--- a/src/part/radialMap/map.h
+++ b/src/part/radialMap/map.h
@@ -71,7 +71,7 @@ private:
const Folder *m_root;
uint m_minSize;
- QVector<uint> m_limits;
+ QVector<FileSize> m_limits;
QRect m_rect;
uint m_visibleDepth; ///visible level depth of system
QPixmap m_pixmap;