MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / onWatchedDirectoryChanged

Method onWatchedDirectoryChanged

Engine/FileSystemModel.cpp:1287–1319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1285}
1286
1287void
1288FileSystemModel::onWatchedDirectoryChanged(const QString& directory)
1289{
1290 FileSystemItemPtr item = _imp->getItemFromPath(directory);
1291
1292 if (item) {
1293 if (directory == _imp->currentRootPath) {
1294 cleanAndRefreshItem(item);
1295 } else {
1296 ///This is a sub-directory
1297 ///Clear the parent of the corresponding item
1298 FileSystemItemPtr parent = item->getParentItem();
1299 if (parent) {
1300 QModelIndex idx = index( item.get() );
1301 assert( idx.isValid() );
1302 int count = parent->childCount();
1303 if (count > 0) {
1304 beginRemoveRows(idx.parent(), 0, count - 1);
1305 parent->clearChildren();
1306 endRemoveRows();
1307 }
1308 }
1309 }
1310 }
1311
1312 QDir dir(_imp->currentRootPath);
1313 if ( !dir.exists() ) {
1314 ///The current directory has changed its name or was deleted.. just fallback the filesystem to the root-path
1315 setRootPath( QDir::rootPath() );
1316 } else {
1317 setRootPath(_imp->currentRootPath);
1318 }
1319}
1320
1321void
1322FileSystemModel::onWatchedFileChanged(const QString& file)

Callers

nothing calls this directly

Calls 7

getItemFromPathMethod · 0.80
childCountMethod · 0.80
parentMethod · 0.80
clearChildrenMethod · 0.80
getParentItemMethod · 0.45
getMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected