Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Revert files related to Filebrowser to avoid merge conflict

Abel You49a527643e39
diff --git a/toonz/sources/toonz/filebrowser.cpp b/toonz/sources/toonz/filebrowser.cpp
index 3a9a70ef6..c3c40770b 100644
--- a/toonz/sources/toonz/filebrowser.cpp
+++ b/toonz/sources/toonz/filebrowser.cpp
@@ -2170,22 +2170,6 @@ void FileBrowser::folderUp() {
//-----------------------------------------------------------------------------
-void FileBrowser::createFolder(TFilePath folderPath) {
- try {
- TSystem::mkDir(folderPath);
-
- } catch (...) {
- DVGui::error(tr("It is not possible to create the %1 folder.")
- .arg(toQString(folderPath)));
- return;
- }
-
- DvDirModel *model = DvDirModel::instance();
- QModelIndex parentFolderIndex = m_folderTreeView->currentIndex();
- model->refresh(parentFolderIndex); // TODO: be able to refresh a empty folder
- m_folderTreeView->expand(parentFolderIndex);
-}
-
void FileBrowser::newFolder() {
TFilePath parentFolder = getFolder();
if (parentFolder == TFilePath() || !TFileStatus(parentFolder).isDirectory())
@@ -2197,10 +2181,20 @@ void FileBrowser::newFolder() {
while (TFileStatus(folderPath).doesExist())
folderPath = parentFolder + (folderName + L" " + std::to_wstring(++i));
- createFolder(folderPath);
+ try {
+ TSystem::mkDir(folderPath);
+
+ } catch (...) {
+ DVGui::error(tr("It is not possible to create the %1 folder.")
+ .arg(toQString(folderPath)));
+ return;
+ }
DvDirModel *model = DvDirModel::instance();
+
QModelIndex parentFolderIndex = m_folderTreeView->currentIndex();
+ model->refresh(parentFolderIndex);
+ m_folderTreeView->expand(parentFolderIndex);
std::wstring newFolderName = folderPath.getWideName();
QModelIndex newFolderIndex =
diff --git a/toonz/sources/toonz/filebrowser.h b/toonz/sources/toonz/filebrowser.h
index 6cebb54bc..ac205f457 100644
--- a/toonz/sources/toonz/filebrowser.h
+++ b/toonz/sources/toonz/filebrowser.h
@@ -101,8 +101,6 @@ types to be displayed in the file browser.
void setHistoryDay(std::string dayDateString);
- void createFolder(TFilePath folderPath); // create a folder and do fresh
-
TFilePath getFolder() const { return m_folder; }
std::string getDayDateString() const { return m_dayDateString; }
diff --git a/toonz/sources/toonz/filebrowsermodel.cpp b/toonz/sources/toonz/filebrowsermodel.cpp
index fe9dc39e7..bb8aaf054 100644
--- a/toonz/sources/toonz/filebrowsermodel.cpp
+++ b/toonz/sources/toonz/filebrowsermodel.cpp
@@ -706,7 +706,7 @@ void DvDirVersionControlProjectNode::refreshChildren() {
DvDirModelFileFolderNode::refreshChildren();
int i;
TProjectManager *pm = TProjectManager::instance();
- auto project = std::make_shared<TProject>();
+ auto project = std::make_shared<TProject>();
project->load(getProjectPath());
for (i = 0; i < getChildCount(); i++) {
DvDirModelFileFolderNode *node =
@@ -724,7 +724,7 @@ void DvDirVersionControlProjectNode::getChildrenNames(
std::vector<std::wstring> &names) const {
DvDirVersionControlNode::getChildrenNames(names);
TProjectManager *pm = TProjectManager::instance();
- auto project = std::make_shared<TProject>();
+ auto project = std::make_shared<TProject>();
project->load(getProjectPath());
int i;
for (i = 0; i < project->getFolderCount(); i++) {
@@ -787,7 +787,7 @@ void DvDirModelProjectNode::refreshChildren() {
DvDirModelFileFolderNode::refreshChildren();
int i;
TProjectManager *pm = TProjectManager::instance();
- auto project = std::make_shared<TProject>();
+ auto project = std::make_shared<TProject>();
project->load(getProjectPath());
for (i = 0; i < getChildCount(); i++) {
DvDirModelFileFolderNode *node =
@@ -805,7 +805,7 @@ void DvDirModelProjectNode::getChildrenNames(
std::vector<std::wstring> &names) const {
DvDirModelFileFolderNode::getChildrenNames(names);
TProjectManager *pm = TProjectManager::instance();
- auto project = std::make_shared<TProject>();
+ auto project = std::make_shared<TProject>();
project->load(getProjectPath());
int i;
for (i = 0; i < project->getFolderCount(); i++) {
@@ -823,7 +823,7 @@ void DvDirModelProjectNode::getChildrenNames(
DvDirModelNode *DvDirModelProjectNode::makeChild(std::wstring name) {
if (name != L"" && name[0] == L'+') {
TProjectManager *pm = TProjectManager::instance();
- auto project = std::make_shared<TProject>();
+ auto project = std::make_shared<TProject>();
project->load(getProjectPath());
std::string folderName = ::to_string(name.substr(1));
TFilePath folderPath = project->getFolder(folderName);