src/ldtypes.cpp

changeset 527
47c068f2e7e3
parent 522
afa691788bdb
child 528
e38d199ef9aa
equal deleted inserted replaced
526:b29b6fc45ba9 527:47c068f2e7e3
342 } 342 }
343 343
344 // ============================================================================= 344 // =============================================================================
345 // ----------------------------------------------------------------------------- 345 // -----------------------------------------------------------------------------
346 void LDObject::moveObjects (QList<LDObject*> objs, const bool up) 346 void LDObject::moveObjects (QList<LDObject*> objs, const bool up)
347 { if (objs.size() == 0) 347 { if (objs.isEmpty())
348 return; 348 return;
349 349
350 // If we move down, we need to iterate the array in reverse order. 350 // If we move down, we need to iterate the array in reverse order.
351 const long start = up ? 0 : (objs.size() - 1); 351 const long start = up ? 0 : (objs.size() - 1);
352 const long end = up ? objs.size() : -1; 352 const long end = up ? objs.size() : -1;
395 // ----------------------------------------------------------------------------- 395 // -----------------------------------------------------------------------------
396 str LDObject::objectListContents (const QList<LDObject*>& objs) 396 str LDObject::objectListContents (const QList<LDObject*>& objs)
397 { bool firstDetails = true; 397 { bool firstDetails = true;
398 str text = ""; 398 str text = "";
399 399
400 if (objs.size() == 0) 400 if (objs.isEmpty())
401 return "nothing"; // :) 401 return "nothing"; // :)
402 402
403 for (long i = 0; i < LDObject::NumTypes; ++i) 403 for (long i = 0; i < LDObject::NumTypes; ++i)
404 { LDObject::Type objType = (LDObject::Type) i; 404 { LDObject::Type objType = (LDObject::Type) i;
405 int count = 0; 405 int count = 0;
414 if (!firstDetails) 414 if (!firstDetails)
415 text += ", "; 415 text += ", ";
416 416
417 str noun = fmt ("%1%2", typeName (objType), plural (count)); 417 str noun = fmt ("%1%2", typeName (objType), plural (count));
418 418
419 // Plural of "vertex" is "vertices". Stupid English. 419 // Plural of "vertex" is "vertices", correct that
420
420 if (objType == LDObject::Vertex && count != 1) 421 if (objType == LDObject::Vertex && count != 1)
421 noun = "vertices"; 422 noun = "vertices";
422 423
423 text += fmt ("%1 %2", count, noun); 424 text += fmt ("%1 %2", count, noun);
424 firstDetails = false; 425 firstDetails = false;

mercurial