Skip to content

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

C

Fix wrong count of exported levels

Abel Youa7ee8c1a063d
diff --git a/toonz/sources/toonz/exportalllevelspopup.cpp b/toonz/sources/toonz/exportalllevelspopup.cpp
index 44412a3fe..8c53145ba 100644
--- a/toonz/sources/toonz/exportalllevelspopup.cpp
+++ b/toonz/sources/toonz/exportalllevelspopup.cpp
@@ -122,7 +122,7 @@ public:
ExportAllLevelsPopup::ExportAllLevelsPopup(){
setWindowModality(Qt::ApplicationModal);
setWindowTitle(QString("Exporting All Levels..."));
- //m_browser->setFolder(TApp::instance()->getCurrentScene()->getScene()->getProject()->getProjectFolder());
+ m_browser->setFolder(TApp::instance()->getCurrentScene()->getScene()->getProject()->getProjectFolder());
// Export Options Tab
m_exportOptions->m_createlevelfolder->setChecked(true);
@@ -384,26 +384,14 @@ bool ExportAllLevelsPopup::execute() {
return false;
}
- // The Export Action Done
- if (outputLevels.empty()) { // no more level to export
- QMessageBox::information(
- nullptr,
- "Export All Levels", // title
- QString::number(level_exported) + " Levels Exported", // content
- QMessageBox::Ok);
- level_exported = 0;
+ // Is The Export All Action Done?
+ if (isAllLevelsExported()) {
return true;
- } else { // move to next level
- m_nameField->setText(QString::fromStdWString(
- level_to_foldername.find(outputLevels.back()->getName())->second));
- this->setWindowTitle(QString("Exporting ") +
- getLevelTypeName(outputLevels.back()->getType()) +
- QString(" Level ") +
- QString::fromStdWString(outputLevels.back()->getName()));
}
-
- updateOnSelection();
- return false;
+ else {
+ updateOnSelection();
+ return false;
+ }
}
std::wstring ExportAllLevelsPopup::backfoldername(std::string colname,
@@ -437,25 +425,34 @@ std::wstring ExportAllLevelsPopup::backfoldername(std::string colname,
}
}
+bool ExportAllLevelsPopup::isAllLevelsExported() {
+ if (outputLevels.empty()) { // no more level to export
+ QMessageBox::information(
+ nullptr,
+ "Export All Levels", // title
+ QString::number(level_exported) + " Levels Exported", // content
+ QMessageBox::Ok);
+ level_exported = 0;
+ return true;
+ } else { // move to next level
+ m_nameField->setText(QString::fromStdWString(
+ level_to_foldername.find(outputLevels.back()->getName())->second));
+ this->setWindowTitle(
+ QString("Exporting ") +
+ getLevelTypeName(outputLevels.back()->getType()) + QString(" Level ") +
+ QString::fromStdWString(outputLevels.back()->getName()));
+ return false;
+ }
+}
+
void ExportAllLevelsPopup::skip() {
outputLevels.pop_back();
- if (outputLevels.empty()) {
- QMessageBox::information(nullptr,
- tr("Exporting All Levels..."), // title
- QString::number(level_exported) + tr("%1 Levels Exported").arg(level_exported), // content
- QMessageBox::Ok);
- level_exported = 0;
+ // Is The Export All Action Done?
+ if (isAllLevelsExported()) {
close();
- return;
} else {
- this->setWindowTitle(QString("Exporting ") +
- getLevelTypeName(outputLevels.back()->getType()) +
- QString(" Level ") +
- QString::fromStdWString(outputLevels.back()->getName()));
- m_nameField->setText(QString::fromStdWString(
- level_to_foldername.find(outputLevels.back()->getName())->second));
+ updateOnSelection();
}
- updateOnSelection();
}
QString ExportAllLevelsPopup::getLevelTypeName(int type) {
diff --git a/toonz/sources/toonz/exportalllevelspopup.h b/toonz/sources/toonz/exportalllevelspopup.h
index 6f9cb406e..2288b13f3 100644
--- a/toonz/sources/toonz/exportalllevelspopup.h
+++ b/toonz/sources/toonz/exportalllevelspopup.h
@@ -19,6 +19,7 @@ private:
ToonzScene *scene;
std::map<std::wstring ,std::wstring> level_to_foldername;
std::wstring backfoldername(std::string colname, std::wstring levelname);
+ bool isAllLevelsExported();
// Widgets
private: