From 56ee60245ab9e4e1f6111d44b66cb325b667ed5c Mon Sep 17 00:00:00 2001 From: shun-iwasawa <shun-iwasawa@users.noreply.github.com> Date: Oct 18 2018 05:45:09 +0000 Subject: search for special folders tree (#2312) --- diff --git a/toonz/sources/toonz/filebrowsermodel.cpp b/toonz/sources/toonz/filebrowsermodel.cpp index b739367..2702e60 100644 --- a/toonz/sources/toonz/filebrowsermodel.cpp +++ b/toonz/sources/toonz/filebrowsermodel.cpp @@ -1061,16 +1061,19 @@ void DvDirModelRootNode::refreshChildren() { child = new DvDirModelSpecialFileFolderNode(this, L"My Documents", getMyDocumentsPath()); child->setPixmap(svgToPixmap(":Resources/my_documents.svg")); + m_specialNodes.push_back(child); addChild(child); child = new DvDirModelSpecialFileFolderNode(this, L"Desktop", getDesktopPath()); child->setPixmap(svgToPixmap(":Resources/desktop.svg")); + m_specialNodes.push_back(child); addChild(child); child = new DvDirModelSpecialFileFolderNode( this, L"Library", ToonzFolder::getLibraryFolder()); child->setPixmap(svgToPixmap(":Resources/library.svg")); + m_specialNodes.push_back(child); addChild(child); addChild(new DvDirModelHistoryNode(this)); @@ -1191,6 +1194,12 @@ DvDirModelNode *DvDirModelRootNode::getNodeByPath(const TFilePath &path) { if (node) return node; } + // check for the special folders (My Documents / Desktop / Library) + for (DvDirModelSpecialFileFolderNode *specialNode : m_specialNodes) { + DvDirModelNode *node = specialNode->getNodeByPath(path); + if (node) return node; + } + // it could be a regular folder, somewhere in the file system if (m_myComputerNode) { for (i = 0; i < m_myComputerNode->getChildCount(); i++) { diff --git a/toonz/sources/toonz/filebrowsermodel.h b/toonz/sources/toonz/filebrowsermodel.h index 31a4bdf..5680591 100644 --- a/toonz/sources/toonz/filebrowsermodel.h +++ b/toonz/sources/toonz/filebrowsermodel.h @@ -311,6 +311,7 @@ class DvDirModelRootNode final : public DvDirModelNode { DvDirModelNetworkNode *m_networkNode; DvDirModelProjectNode *m_sandboxProjectNode; DvDirModelSceneFolderNode *m_sceneFolderNode; + std::vector<DvDirModelSpecialFileFolderNode *> m_specialNodes; void add(std::wstring name, const TFilePath &path);