| 230 | } |
| 231 | |
| 232 | FileSystemPile *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); |
no test coverage detected