Skip to content

Commit

Permalink
Move example transitions from "Transitions" to "Examples/Transitions"
Browse files Browse the repository at this point in the history
  • Loading branch information
MaurycyLiebner committed May 21, 2020
1 parent b47ee87 commit c236ab7
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/shaderEffects/eWipe.gre
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<!-- You should have received a copy of the GNU General Public License -->
<!-- along with this program. If not, see <http://www.gnu.org/licenses/>. -->

<ShaderEffect name="Wipe" menuPath="Transitions">
<ShaderEffect name="Wipe" menuPath="Examples/Transitions">
<Properties>
<Property name="sharpness" type="float" min="0" max="1" step="0.01" ini="0" glValue="true"/>
<Property name="direction" type="float" min="-9999" max="9999" step="1" ini="0" glValue="true"/>
Expand Down
2 changes: 1 addition & 1 deletion examples/shaderEffects/eWipeLeft.gre
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<!-- You should have received a copy of the GNU General Public License -->
<!-- along with this program. If not, see <http://www.gnu.org/licenses/>. -->

<ShaderEffect name="Wipe Left" menuPath="Transitions">
<ShaderEffect name="Wipe Left" menuPath="Examples/Transitions">
<Properties>
<Property name="sharpness" type="float" min="0" max="1" step="0.01" ini="0" glValue="true"/>
<Property name="time" type="float" min="0" max="1" step="0.01" ini="0" glValue="true" influenceScaled="true"/>
Expand Down
2 changes: 1 addition & 1 deletion examples/shaderEffects/eWipeRight.gre
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<!-- You should have received a copy of the GNU General Public License -->
<!-- along with this program. If not, see <http://www.gnu.org/licenses/>. -->

<ShaderEffect name="Wipe Right" menuPath="Transitions">
<ShaderEffect name="Wipe Right" menuPath="Examples/Transitions">
<Properties>
<Property name="sharpness" type="float" min="0" max="1" step="0.01" ini="0" glValue="true"/>
<Property name="time" type="float" min="0" max="1" step="0.01" ini="0" glValue="true" influenceScaled="true"/>
Expand Down
5 changes: 3 additions & 2 deletions src/core/RasterEffects/rastereffectmenucreator.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ struct CORE_EXPORT RasterEffectMenuCreator {
if(path.isEmpty()) {
menu->addPlainAction<Target>(name, adder);
} else {
auto childMenu = menu->childMenu(path);
if(!childMenu) childMenu = menu->addMenu(path);
const auto pathList = path.split('/');
auto childMenu = menu->childMenu(pathList);
if(!childMenu) childMenu = menu->addMenu(pathList);
childMenu->addPlainAction<Target>(name, adder);
}
};
Expand Down
19 changes: 19 additions & 0 deletions src/core/typemenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ class CORE_EXPORT TypeMenu {
return child.get();
}

TTypeMenu * addMenu(const QStringList& titles) {
TTypeMenu* menu = this;
for(const auto& title : titles) {
const auto menuT = menu->childMenu(title);
if(menuT) menu = menuT;
else menu = menu->addMenu(title);
}
return menu;
}

TTypeMenu* childMenu(const QString& path) {
for(const auto& child : mChildMenus) {
if(child->mQMenu->title() == path)
Expand All @@ -105,6 +115,15 @@ class CORE_EXPORT TypeMenu {
return nullptr;
}

TTypeMenu* childMenu(const QStringList& path) {
TTypeMenu* menu = this;
for(const auto& subPath : path) {
menu = menu->childMenu(subPath);
if(!menu) return nullptr;
}
return menu;
}

QAction* addSeparator() {
return mQMenu->addSeparator();
}
Expand Down

0 comments on commit c236ab7

Please sign in to comment.