search for special folders tree (#2312)
This commit is contained in:
parent
f889997cee
commit
56ee60245a
2 changed files with 10 additions and 0 deletions
|
@ -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++) {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue