434 QString root = roots[type]; |
434 QString root = roots[type]; |
435 QString numberString = (type == Ring or type == Cone) ? format ("%1", ringNumber) : ""; |
435 QString numberString = (type == Ring or type == Cone) ? format ("%1", ringNumber) : ""; |
436 |
436 |
437 // Truncate the root if necessary (7-16rin4.dat for instance). |
437 // Truncate the root if necessary (7-16rin4.dat for instance). |
438 // However, always keep the root at least 2 characters. |
438 // However, always keep the root at least 2 characters. |
439 int extra = (frac.length() + numberString.length() + root.length()) - 8; |
439 int extra = (length(frac) + length(numberString) + length(root)) - 8; |
440 root.chop(qBound(0, extra, 2)); |
440 root.chop(qBound(0, extra, 2)); |
441 |
441 |
442 // Stick them all together and return the result. |
442 // Stick them all together and return the result. |
443 return prefix + frac + root + numberString + ".dat"; |
443 return prefix + frac + root + numberString + ".dat"; |
444 } |
444 } |
579 QObject(parent), |
579 QObject(parent), |
580 HierarchyElement(parent), |
580 HierarchyElement(parent), |
581 m_manager(parent), |
581 m_manager(parent), |
582 m_iterator(LDPaths::primitivesDir(), QDirIterator::Subdirectories) |
582 m_iterator(LDPaths::primitivesDir(), QDirIterator::Subdirectories) |
583 { |
583 { |
584 m_basePathLength = LDPaths::primitivesDir().absolutePath().length(); |
584 m_basePathLength = length(LDPaths::primitivesDir().absolutePath()); |
585 print("Scanning primitives..."); |
585 print("Scanning primitives..."); |
586 } |
586 } |
587 |
587 |
588 /* |
588 /* |
589 * PrimitiveScanner :: scannedPrimitives |
589 * PrimitiveScanner :: scannedPrimitives |