added UI for editing video parameters in nodes

This commit is contained in:
itsmattkc
2021-02-20 13:27:56 +11:00
parent cc9747ede4
commit b21271534f
31 changed files with 979 additions and 455 deletions
+1
View File
@@ -22,6 +22,7 @@ add_subdirectory(generator)
add_subdirectory(input)
add_subdirectory(math)
add_subdirectory(output)
add_subdirectory(project)
set(OLIVE_SOURCES
${OLIVE_SOURCES}
+12
View File
@@ -54,6 +54,11 @@ public:
return node_children_;
}
const QVector<Node*>& default_nodes() const
{
return default_nodes_;
}
signals:
/**
* @brief Signal emitted when a Node is added to the graph
@@ -72,11 +77,18 @@ signals:
void ValueChanged(const NodeInput& input);
protected:
void AddDefaultNode(Node* n)
{
default_nodes_.append(n);
}
virtual void childEvent(QChildEvent* event) override;
private:
QVector<Node*> node_children_;
QVector<Node*> default_nodes_;
};
}
+22
View File
@@ -0,0 +1,22 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2020 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/>.
add_subdirectory(projectsettings)
set(OLIVE_SOURCES
${OLIVE_SOURCES}
PARENT_SCOPE
)
@@ -0,0 +1,22 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2020 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/>.
set(OLIVE_SOURCES
${OLIVE_SOURCES}
node/project/projectsettings/projectsettings.cpp
node/project/projectsettings/projectsettings.h
PARENT_SCOPE
)
@@ -0,0 +1,60 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2020 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 "projectsettings.h"
namespace olive {
const QString ProjectSettingsNode::kCacheSetting = QStringLiteral("cache_setting");
const QString ProjectSettingsNode::kCachePath = QStringLiteral("cache_path");
ProjectSettingsNode::ProjectSettingsNode()
{
AddInput(kCacheSetting, NodeValue::kCombo, 0, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
AddInput(kCachePath, NodeValue::kFile, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
SetInputProperty(kCachePath, QStringLiteral("directory"), true);
UpdateCachePathEnabled();
}
void ProjectSettingsNode::Retranslate()
{
SetInputName(kCacheSetting, tr("Disk Cache Location"));
SetInputName(kCachePath, tr("Disk Cache Path"));
SetComboBoxStrings(kCacheSetting, {tr("Use Default Location"), tr("Store Alongside Project"), tr("Use Custom Location")});
SetInputProperty(kCachePath, QStringLiteral("placeholder"), tr("(default)"));
}
void ProjectSettingsNode::InputValueChangedEvent(const QString &input, int element)
{
Q_UNUSED(element)
if (input == kCacheSetting) {
UpdateCachePathEnabled();
}
}
void ProjectSettingsNode::UpdateCachePathEnabled()
{
CacheSetting setting = GetCacheSetting();
SetInputProperty(kCachePath, QStringLiteral("enabled"), (setting == kCacheCustomPath));
}
}
@@ -0,0 +1,95 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2020 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 PROJECTSETTINGSNODE_H
#define PROJECTSETTINGSNODE_H
#include "node/node.h"
namespace olive {
class ProjectSettingsNode : public Node
{
Q_OBJECT
public:
ProjectSettingsNode();
virtual QString Name() const override
{
return tr("Project Settings");
}
virtual QString id() const override
{
return QStringLiteral("org.olivevideoeditor.Olive.projectsettings");
}
virtual QVector<CategoryID> Category() const override
{
return {kCategoryProject};
}
virtual QString Description() const override
{
return tr("Settings used throughout the project.");
}
virtual Node* copy() const override
{
return new ProjectSettingsNode();
}
enum CacheSetting {
kCacheUseDefaultLocation,
kCacheStoreAlongsideProject,
kCacheCustomPath
};
static const QString kCacheSetting;
static const QString kCachePath;
virtual void Retranslate() override;
CacheSetting GetCacheSetting() const
{
return static_cast<CacheSetting>(GetStandardValue(kCacheSetting).toInt());
}
QString GetCustomCachePath() const
{
return GetStandardValue(kCachePath).toString();
}
void SetCustomCachePath(const QString& s)
{
SetStandardValue(kCachePath, s);
}
protected:
virtual void InputValueChangedEvent(const QString &input, int element) override;
private:
void UpdateCachePathEnabled();
};
}
#endif // PROJECTSETTINGSNODE_H