completed node 'add' menu

This commit is contained in:
itsmattkc
2019-12-13 02:55:09 +11:00
parent 5b0513efed
commit 934eea5f40
9 changed files with 70 additions and 82 deletions
-2
View File
@@ -38,8 +38,6 @@ set(OLIVE_SOURCES
node/inputarray.cpp
node/keyframe.h
node/keyframe.cpp
node/menu.h
node/menu.cpp
node/node.h
node/node.cpp
node/output.h
+8 -6
View File
@@ -13,6 +13,8 @@
#include "output/track/track.h"
#include "output/viewer/viewer.h"
QList<Node*> NodeFactory::library_;
void NodeFactory::Initialize()
{
Destroy();
@@ -40,7 +42,7 @@ Menu *NodeFactory::CreateMenu()
QStringList path = n->Category().split('/');
QMenu* destination = menu;
Menu* destination = menu;
// Find destination menu based on category hierarchy
foreach (const QString& dir_name, path) {
@@ -53,8 +55,8 @@ Menu *NodeFactory::CreateMenu()
bool found_cat = false;
QList<QAction*> menu_actions = destination->actions();
foreach (QAction* action, menu_actions) {
if (action->text() == dir_name && action->menu()) {
destination = action->menu();
if (action->menu() && action->menu()->title() == dir_name) {
destination = static_cast<Menu*>(action->menu());
found_cat = true;
break;
}
@@ -62,14 +64,14 @@ Menu *NodeFactory::CreateMenu()
// Create menu here if it doesn't exist
if (!found_cat) {
Menu* new_category = new Menu();
destination->addMenu(new_category);
Menu* new_category = new Menu(dir_name);
destination->InsertAlphabetically(new_category);
destination = new_category;
}
}
// Add entry to menu
QAction* a = destination->addAction(n->Name());
QAction* a = destination->InsertAlphabetically(n->Name());
a->setToolTip(n->Description());
}
+5 -7
View File
@@ -10,18 +10,18 @@ class NodeFactory
{
public:
enum InternalID {
kAlphaOverBlend,
kViewerOutput,
kClipBlock,
kGapBlock,
kAlphaOverBlend,
kSolidGenerator,
kAudioInput,
kTransformDistort,
kTransitionBlock,
kOpacity,
kTransformDistort,
kSolidGenerator,
kVideoInput,
kAudioInput,
kTimelineOutput,
kTrackOutput,
kViewerOutput,
// Count value
kInternalNodeCount
@@ -33,8 +33,6 @@ public:
static void Destroy();
static void Create(const Entry& create_info);
static Menu* CreateMenu();
private:
-28
View File
@@ -1,28 +0,0 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include "menu.h"
#include "blend/alphaover/alphaover.h"
NodeMenu::NodeMenu(QWidget *parent) :
QMenu(parent)
{
}
-38
View File
@@ -1,38 +0,0 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef NODEMENU_H
#define NODEMENU_H
#include <QMenu>
#include "node.h"
class NodeMenu : public QMenu
{
public:
NodeMenu(QWidget* parent = nullptr);
private:
};
#endif // NODEMENU_H