From f74da5b97feecc3aa76326995f179a8d8d918182 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Sun, 17 Oct 2021 00:12:36 -0400 Subject: [PATCH] Fix missing returns --- toonz/sources/include/toonzqt/styleeditor.h | 2 +- toonz/sources/toonz/graphwidget.cpp | 3 +- toonz/sources/toonzqt/styleeditor.cpp | 49 ++++++++++++--------- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/toonz/sources/include/toonzqt/styleeditor.h b/toonz/sources/include/toonzqt/styleeditor.h index d3353393..c6b4fa2a 100644 --- a/toonz/sources/include/toonzqt/styleeditor.h +++ b/toonz/sources/include/toonzqt/styleeditor.h @@ -925,7 +925,7 @@ public: void editStyleSetName(StyleChooserPage *styleSetPage); void renameStyleSet(StyleChooserPage *styleSetPage, QString newName); - std::vector getStyleSetList(StylePageType pageType); + std::vector *getStyleSetList(StylePageType pageType); void setUpdated(TFilePath setPath); TFilePath getSetStyleFolder(QString setName); diff --git a/toonz/sources/toonz/graphwidget.cpp b/toonz/sources/toonz/graphwidget.cpp index b211f164..8d7df000 100644 --- a/toonz/sources/toonz/graphwidget.cpp +++ b/toonz/sources/toonz/graphwidget.cpp @@ -318,8 +318,7 @@ QPointF GraphWidget::getInvertedPoint(QPointF p) { y *= 0.5; } - else - return QPointF(x, height() - y); + return QPointF(x, height() - y); } //----------------------------------------------------------------------------- diff --git a/toonz/sources/toonzqt/styleeditor.cpp b/toonz/sources/toonzqt/styleeditor.cpp index ed97c11a..ecbb0386 100644 --- a/toonz/sources/toonzqt/styleeditor.cpp +++ b/toonz/sources/toonzqt/styleeditor.cpp @@ -2282,7 +2282,7 @@ void StyleChooserPage::contextMenuEvent(QContextMenuEvent *event) { QMenu *menu = new QMenu(this); QAction *action; - std::vector styleSets = + std::vector *styleSets = m_editor->getStyleSetList(m_pageType); if (m_editor->isSelecting()) { @@ -2307,8 +2307,8 @@ void StyleChooserPage::contextMenuEvent(QContextMenuEvent *event) { menu->addAction(action); QMenu *styleSetMenu = new QMenu(tr("Copy Selected to Style Set..."), this); - for (int i = 1; i < styleSets.size(); i++) { - StyleChooserPage *page = styleSets[i]; + for (int i = 1; i < styleSets->size(); i++) { + StyleChooserPage *page = styleSets->at(i); QAction *subAction = new QAction(page->getStyleSetName()); subAction->setData(page->getStyleSetName()); connect(subAction, SIGNAL(triggered()), m_editor, @@ -2318,12 +2318,12 @@ void StyleChooserPage::contextMenuEvent(QContextMenuEvent *event) { subAction->setDisabled(true); styleSetMenu->addAction(subAction); } - if (styleSets.size() < 2) styleSetMenu->setDisabled(true); + if (styleSets->size() < 2) styleSetMenu->setDisabled(true); menu->addMenu(styleSetMenu); styleSetMenu = new QMenu(tr("Move Selected to Style Set..."), this); - for (int i = 1; i < styleSets.size(); i++) { - StyleChooserPage *page = styleSets[i]; + for (int i = 1; i < styleSets->size(); i++) { + StyleChooserPage *page = styleSets->at(i); QAction *subAction = new QAction(page->getStyleSetName()); subAction->setData(page->getStyleSetName()); connect(subAction, SIGNAL(triggered()), m_editor, @@ -2333,7 +2333,7 @@ void StyleChooserPage::contextMenuEvent(QContextMenuEvent *event) { subAction->setDisabled(true); styleSetMenu->addAction(subAction); } - if (styleSets.size() < 2 || m_pageType == StylePageType::VectorGenerated) + if (styleSets->size() < 2 || m_pageType == StylePageType::VectorGenerated) styleSetMenu->setDisabled(true); menu->addMenu(styleSetMenu); @@ -2341,8 +2341,8 @@ void StyleChooserPage::contextMenuEvent(QContextMenuEvent *event) { action->setText(tr("Remove Selected from Sets")); connect(action, SIGNAL(triggered()), m_editor, SLOT(onRemoveSelectedStyleFromSet())); - for (int i = 1; i < styleSets.size(); i++) { - StyleChooserPage *page = styleSets[i]; + for (int i = 1; i < styleSets->size(); i++) { + StyleChooserPage *page = styleSets->at(i); if (page->getSelection().size() && (page->isExternal() || page->getPageType() == StylePageType::VectorGenerated)) { @@ -2377,8 +2377,8 @@ void StyleChooserPage::contextMenuEvent(QContextMenuEvent *event) { menu->addAction(action); QMenu *styleSetMenu = new QMenu(tr("Copy to Style Set..."), this); - for (int i = 1; i < styleSets.size(); i++) { - StyleChooserPage *page = styleSets[i]; + for (int i = 1; i < styleSets->size(); i++) { + StyleChooserPage *page = styleSets->at(i); QAction *subAction = new QAction(page->getStyleSetName()); subAction->setData(page->getStyleSetName()); connect(subAction, SIGNAL(triggered()), this, SLOT(onCopyStyleToSet())); @@ -2389,13 +2389,13 @@ void StyleChooserPage::contextMenuEvent(QContextMenuEvent *event) { } if (m_currentIndex == 0 || (m_pageType == StylePageType::Texture && m_currentIndex == getChipCount() - 1) || - styleSets.size() <= 2) + styleSets->size() <= 2) styleSetMenu->setDisabled(true); menu->addMenu(styleSetMenu); styleSetMenu = new QMenu(tr("Move to Style Set..."), this); - for (int i = 1; i < styleSets.size(); i++) { - StyleChooserPage *page = styleSets[i]; + for (int i = 1; i < styleSets->size(); i++) { + StyleChooserPage *page = styleSets->at(i); QAction *subAction = new QAction(page->getStyleSetName()); subAction->setData(page->getStyleSetName()); connect(subAction, SIGNAL(triggered()), this, SLOT(onMoveStyleToSet())); @@ -2406,7 +2406,7 @@ void StyleChooserPage::contextMenuEvent(QContextMenuEvent *event) { } if (m_currentIndex == 0 || (m_pageType == StylePageType::Texture && m_currentIndex == getChipCount() - 1) || - m_pageType == StylePageType::VectorGenerated || styleSets.size() <= 2) + m_pageType == StylePageType::VectorGenerated || styleSets->size() <= 2) styleSetMenu->setDisabled(true); menu->addMenu(styleSetMenu); @@ -2506,12 +2506,17 @@ bool StyleChooserPage::copyFilesToStyleFolder(TFilePathSet srcFiles, bool StyleChooserPage::deleteFilesFromStyleFolder(TFilePathSet targetFiles) { if (targetFiles.empty()) return false; + bool filesDeleted = false; + TFilePathSet::iterator it; for (it = targetFiles.begin(); it != targetFiles.end(); it++) try { - if (!TSystem::doesExistFileOrLevel(*it)) return false; + if (!TSystem::doesExistFileOrLevel(*it)) continue; TSystem::deleteFile(*it); + filesDeleted = true; } catch (...) { } + + return filesDeleted; } //***************************************************************************** @@ -6806,16 +6811,20 @@ void StyleEditor::renameStyleSet(StyleChooserPage *styleSetPage, //----------------------------------------------------------------------------- -std::vector StyleEditor::getStyleSetList( +std::vector *StyleEditor::getStyleSetList( StylePageType pageType) { + std::vector *pages; + if (pageType == StylePageType::Texture) - return m_texturePages; + pages = &m_texturePages; else if (pageType == StylePageType::VectorBrush || pageType == StylePageType::VectorCustom || pageType == StylePageType::VectorGenerated) - return m_vectorPages; + pages = &m_vectorPages; else if (pageType == StylePageType::Raster) - return m_rasterPages; + pages = &m_rasterPages; + + return pages; } bool StyleEditor::isStyleNameValid(QString name, StylePageType pageType,