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

Method onFileModified

trunk/win/Source/BT_SceneManager.cpp:979–1043  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

977}
978
979void SceneManager::onFileModified(QString strFileName)
980{
981 // ensure that the file actually exists
982 if (!exists(strFileName))
983 return;
984
985 assert(GetCurrentThreadId() == _threadId);
986 FileSystemActor *fsData;
987 uint fileAttr;
988 fileAttr = fsManager->getFileAttributes(strFileName);
989 bool fileIsHidden = fileAttr & Hidden;
990 for (uint i = 0; i < _bumpObjects.size(); i++)
991 {
992 BumpObject * obj = _bumpObjects[i];
993
994 // NOTE: The onFileModified operation is ONLY done on FileSystemActors and not Hard Piles.
995 // If you want to modify a HardPile, all modifications are done to its owner.
996 if (!(_bumpObjects[i]->getObjectType() == ObjectType(BumpActor, FileSystem))) continue;
997
998 // Only work on filesystem actors that do not have parents, or actors in soft piles
999 bool isFreeActor = !_bumpObjects[i]->getParent();
1000 bool isSoftPiledActor = _bumpObjects[i]->getParent() && (_bumpObjects[i]->getParent()->getObjectType() == ObjectType(BumpPile, SoftPile));
1001 if (isFreeActor || isSoftPiledActor)
1002 {
1003 fsData = (FileSystemActor *) _bumpObjects[i];
1004
1005 if (fsManager->isIdenticalPath(fsData->getFullPath(), strFileName) ||
1006 fsManager->isIdenticalPath(fsData->getShortPath(), strFileName))
1007 {
1008 fsData->setFreshnessAlphaAnim(1.0f, 150);
1009
1010 if (!GLOBAL(settings).LoadHiddenFiles && fileIsHidden)
1011 {
1012 FadeAndDeleteActor((Actor *) fsData);
1013 return;
1014 }
1015
1016 // If the file is a shortcut see if we can resolve its target
1017 if (strFileName.endsWith(".lnk", Qt::CaseInsensitive) && fsData->isFileSystemType(DeadLink))
1018 {
1019 // Attempt to try and resolve the shortcut
1020 fsData->setFilePath(strFileName);
1021 return;
1022 }
1023 else if (fsData->isFileSystemType(Thumbnail))
1024 {
1025 fsData->refreshThumbnail();
1026 return;
1027 }
1028 else if (fsData->isFileSystemType(StickyNote))
1029 {
1030 ((StickyNoteActor *) fsData)->syncStickyNoteWithFileContents();
1031 return;
1032 }
1033 return;
1034 }
1035 }
1036 }

Callers

nothing calls this directly

Calls 15

assertClass · 0.85
ObjectTypeClass · 0.85
FadeAndDeleteActorFunction · 0.85
getFileAttributesMethod · 0.80
getParentMethod · 0.80
isIdenticalPathMethod · 0.80
getFullPathMethod · 0.80
getShortPathMethod · 0.80
setFreshnessAlphaAnimMethod · 0.80
isFileSystemTypeMethod · 0.80
refreshThumbnailMethod · 0.80

Tested by

no test coverage detected