MCPcopy Create free account
hub / github.com/bumptop/BumpTop / pileize

Method pileize

trunk/win/Source/BT_FileSystemActor.cpp:232–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230}
231
232FileSystemPile *FileSystemActor::pileize()
233{
234 StrList dirListing;
235 QString dirPath;
236 vector<Actor *> objListing;
237 FileSystemActor *obj = NULL;
238 FileSystemPile *p = NULL;
239
240 // Don't allow Piles to be created recursively
241 if (isParentType(BumpPile))
242 {
243 MessageClearPolicy clearPolicy;
244 clearPolicy.setTimeout(4);
245 scnManager->messages()->addMessage(new Message("pileize_recPiles", QT_TR_NOOP("Sorry, Items within Piles cannot be viewed as Piles at this time.\nThis feature will be implemented in a later version of BumpTop"), Message::Ok, clearPolicy));
246 return NULL;
247 }
248
249 // If this item has been pileized, then just return its pile
250 if (pileizedPile)
251 {
252 return pileizedPile;
253 }
254
255 if (isFileSystemType(Folder))
256 {
257 // Get a Directory listing of this folder
258 dirPath = getTargetPath();
259 dirListing = fsManager->getDirectoryContents(dirPath);
260
261 // Check if this Folder has anything in it
262 if (dirListing.empty())
263 {
264 MessageClearPolicy clearPolicy;
265 clearPolicy.setTimeout(4);
266 scnManager->messages()->addMessage(new Message("pileize_emptyFolder", QT_TR_NOOP("This folder is empty, so it can't be expanded to a pile"), Message::Ok, clearPolicy));
267 return NULL;
268 }
269
270 // Create a new Pile
271 p = new FileSystemPile();
272 if (p)
273 {
274 for (uint i = 0; i < dirListing.size(); i++)
275 {
276 obj = FileSystemActorFactory::createFileSystemActor(dirListing[i]);
277
278 // Create new Actors that represent each item in that directory
279 // NOTE: we need to set the initial size of the object, since we try and sync the post it
280 // in the setFilePath call, which means that it will try and fill to the dims of the
281 // object, which, in it's default size, is not visible text-wise.
282 if (_prevPileizedActorDims.contains(dirListing[i].toLower()))
283 obj->setDims(Vec3(_prevPileizedActorDims.value(dirListing[i].toLower())));
284 else
285 obj->setDims(getDims());
286 obj->setGlobalPose(getGlobalPose());
287 obj->setFilePath(dirListing[i]);
288
289 objListing.push_back(obj);

Callers 12

onDropMethod · 0.80
Key_ExpandToPileFunction · 0.80
Key_PileizeAndGridViewFunction · 0.80
unserializeActor_v1Method · 0.80
unserializeActor_v2Method · 0.80
unserializeActor_v3Method · 0.80
unserializeActor_v4Method · 0.80
unserializeActor_v5Method · 0.80
unserializeActor_v6Method · 0.80
unserializeActor_v7Method · 0.80
unserializeActor_v8Method · 0.80

Calls 15

addMessageMethod · 0.80
messagesMethod · 0.80
getDirectoryContentsMethod · 0.80
setOwnerMethod · 0.80
setTextIconMethod · 0.80
hideAndDisableMethod · 0.80
setTimeoutMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
containsMethod · 0.45
setDimsMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected