Commit 6a49b5c2 authored by Martin Tobias Holmedahl Sandsmark's avatar Martin Tobias Holmedahl Sandsmark
Browse files

tweak the limits for showing small files

parent c171a24c
......@@ -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,
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment