src/primitives.cpp

changeset 1064
4c7a353cf583
parent 1063
1f15c52c11f6
child 1065
c8ecddbd99e9
equal deleted inserted replaced
1063:1f15c52c11f6 1064:4c7a353cf583
187 187
188 while (not categoriesFile.atEnd()) 188 while (not categoriesFile.atEnd())
189 { 189 {
190 QString line = QString::fromUtf8(categoriesFile.readLine()).trimmed(); 190 QString line = QString::fromUtf8(categoriesFile.readLine()).trimmed();
191 191
192 if (line.length() == 0 or line[0] == '#') 192 if (line.isEmpty() or line[0] == '#')
193 continue; 193 continue;
194 194
195 int colon = line.indexOf (":"); 195 int colon = line.indexOf (":");
196 if (colon == -1) 196 if (colon == -1)
197 { 197 {
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

mercurial