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",
|
child = new DvDirModelSpecialFileFolderNode(this, L"My Documents",
|
||||||
getMyDocumentsPath());
|
getMyDocumentsPath());
|
||||||
child->setPixmap(svgToPixmap(":Resources/my_documents.svg"));
|
child->setPixmap(svgToPixmap(":Resources/my_documents.svg"));
|
||||||
|
m_specialNodes.push_back(child);
|
||||||
addChild(child);
|
addChild(child);
|
||||||
|
|
||||||
child =
|
child =
|
||||||
new DvDirModelSpecialFileFolderNode(this, L"Desktop", getDesktopPath());
|
new DvDirModelSpecialFileFolderNode(this, L"Desktop", getDesktopPath());
|
||||||
child->setPixmap(svgToPixmap(":Resources/desktop.svg"));
|
child->setPixmap(svgToPixmap(":Resources/desktop.svg"));
|
||||||
|
m_specialNodes.push_back(child);
|
||||||
addChild(child);
|
addChild(child);
|
||||||
|
|
||||||
child = new DvDirModelSpecialFileFolderNode(
|
child = new DvDirModelSpecialFileFolderNode(
|
||||||
this, L"Library", ToonzFolder::getLibraryFolder());
|
this, L"Library", ToonzFolder::getLibraryFolder());
|
||||||
child->setPixmap(svgToPixmap(":Resources/library.svg"));
|
child->setPixmap(svgToPixmap(":Resources/library.svg"));
|
||||||
|
m_specialNodes.push_back(child);
|
||||||
addChild(child);
|
addChild(child);
|
||||||
|
|
||||||
addChild(new DvDirModelHistoryNode(this));
|
addChild(new DvDirModelHistoryNode(this));
|
||||||
|
@ -1191,6 +1194,12 @@ DvDirModelNode *DvDirModelRootNode::getNodeByPath(const TFilePath &path) {
|
||||||
if (node) return node;
|
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
|
// it could be a regular folder, somewhere in the file system
|
||||||
if (m_myComputerNode) {
|
if (m_myComputerNode) {
|
||||||
for (i = 0; i < m_myComputerNode->getChildCount(); i++) {
|
for (i = 0; i < m_myComputerNode->getChildCount(); i++) {
|
||||||
|
|
|
@ -311,6 +311,7 @@ class DvDirModelRootNode final : public DvDirModelNode {
|
||||||
DvDirModelNetworkNode *m_networkNode;
|
DvDirModelNetworkNode *m_networkNode;
|
||||||
DvDirModelProjectNode *m_sandboxProjectNode;
|
DvDirModelProjectNode *m_sandboxProjectNode;
|
||||||
DvDirModelSceneFolderNode *m_sceneFolderNode;
|
DvDirModelSceneFolderNode *m_sceneFolderNode;
|
||||||
|
std::vector<DvDirModelSpecialFileFolderNode *> m_specialNodes;
|
||||||
|
|
||||||
void add(std::wstring name, const TFilePath &path);
|
void add(std::wstring name, const TFilePath &path);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue