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

Method resetCompletly

Engine/FileSystemModel.cpp:1022–1076  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1020}
1021
1022void
1023FileSystemModel::resetCompletly(bool rebuild)
1024{
1025 {
1026 QMutexLocker k(&_imp->mappingMutex);
1027 _imp->itemsMap.clear();
1028 }
1029
1030 if (_imp->rootItem) {
1031 beginResetModel();
1032
1033 ///Wipe all the file-system loaded by clearing all children of drives
1034 for (int i = 0; i < _imp->rootItem->childCount(); ++i) {
1035 FileSystemItemPtr child = _imp->rootItem->childAt(i);
1036 if (child) {
1037 child->clearChildren();
1038 }
1039 }
1040 _imp->rootItem->clearChildren();
1041 _imp->rootItem.reset();
1042 endResetModel();
1043 }
1044
1045
1046 FileSystemModelPtr model = shared_from_this();
1047
1048 if (rebuild) {
1049 _imp->rootItem = FileSystemItem::create(model, true, QString(), QString(), SequenceParsing::SequenceFromFilesPtr(), QDateTime(), 0);
1050 _imp->registerItem(_imp->rootItem);
1051
1052 QFileInfoList drives = QDir::drives();
1053
1054 ///Fetch all drives by default
1055 Q_FOREACH(const QFileInfo &drive, drives) {
1056 QString driveName;
1057
1058#ifdef __NATRON_WIN32__
1059 // for drives, there is no filename
1060 driveName = drive.canonicalPath();
1061#else
1062 driveName = generateChildAbsoluteName( _imp->rootItem.get(), drive.fileName() );
1063#endif
1064
1065 FileSystemItemPtr child = FileSystemItem::create(model, true, //isDir
1066 driveName, //drives have canonical path
1067 driveName,
1068 SequenceParsing::SequenceFromFilesPtr(),
1069 drive.lastModified(),
1070 drive.size(),
1071 _imp->rootItem);
1072 _imp->registerItem(child);
1073 _imp->rootItem->addChild(child);
1074 }
1075 }
1076} // FileSystemModel::resetCompletly
1077
1078bool
1079FileSystemModel::isSequenceModeEnabled() const

Callers 1

~SequenceFileDialogMethod · 0.80

Calls 8

QDateTimeClass · 0.85
childCountMethod · 0.80
childAtMethod · 0.80
clearChildrenMethod · 0.80
registerItemMethod · 0.80
QStringClass · 0.70
clearMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected