Merge branch 'node-rework' into track-redux
This commit is contained in:
@@ -38,7 +38,7 @@ PanNode::PanNode()
|
||||
SetInputProperty(kPanningInput, QStringLiteral("max"), 1.0);
|
||||
SetInputProperty(kPanningInput, QStringLiteral("view"), FloatSlider::kPercentage);
|
||||
|
||||
SetFlags(kAudioEffect);
|
||||
SetFlag(kAudioEffect);
|
||||
SetEffectInput(kSamplesInput);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ VolumeNode::VolumeNode()
|
||||
SetInputProperty(kVolumeInput, QStringLiteral("min"), 0.0);
|
||||
SetInputProperty(kVolumeInput, QStringLiteral("view"), FloatSlider::kDecibel);
|
||||
|
||||
SetFlags(kAudioEffect);
|
||||
SetFlag(kAudioEffect);
|
||||
SetEffectInput(kSamplesInput);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ Block::Block() :
|
||||
|
||||
SetInputFlags(kEnabledInput, InputFlags(GetInputFlags(kEnabledInput) | kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
||||
|
||||
SetFlags(kDontShowInParamView);
|
||||
SetFlag(kDontShowInParamView);
|
||||
}
|
||||
|
||||
QVector<Node::CategoryID> Block::Category() const
|
||||
|
||||
@@ -38,7 +38,7 @@ SubtitleBlock::SubtitleBlock()
|
||||
SetInputFlags(kMaintainAudioPitchInput, InputFlags(GetInputFlags(kMaintainAudioPitchInput) | kInputFlagHidden));
|
||||
|
||||
// Undo block flag that hides in param view
|
||||
SetFlags(GetFlags() & ~kDontShowInParamView);
|
||||
SetFlag(kDontShowInParamView, false);
|
||||
}
|
||||
|
||||
QString SubtitleBlock::Name() const
|
||||
|
||||
@@ -47,7 +47,7 @@ TransitionBlock::TransitionBlock() :
|
||||
SetInputProperty(kCenterInput, QStringLiteral("view"), RationalSlider::kTime);
|
||||
SetInputProperty(kCenterInput, QStringLiteral("viewlock"), true);
|
||||
|
||||
SetFlags(GetFlags() & ~kDontShowInParamView);
|
||||
SetFlag(kDontShowInParamView, false);
|
||||
}
|
||||
|
||||
void TransitionBlock::Retranslate()
|
||||
|
||||
@@ -38,7 +38,7 @@ OCIOBaseNode::OCIOBaseNode() :
|
||||
connect(this, &Node::AddedToGraph, this, &OCIOBaseNode::AddedToGraph);
|
||||
connect(this, &Node::RemovedFromGraph, this, &OCIOBaseNode::RemovedFromGraph);
|
||||
|
||||
SetFlags(kVideoEffect);
|
||||
SetFlag(kVideoEffect);
|
||||
}
|
||||
|
||||
void OCIOBaseNode::AddedToGraph(Project *p)
|
||||
|
||||
@@ -51,7 +51,7 @@ CornerPinDistortNode::CornerPinDistortNode()
|
||||
gizmo_resize_handle_[2] = AddDraggableGizmo<PointGizmo>({NodeKeyframeTrackReference(NodeInput(this, kBottomRightInput), 0), NodeKeyframeTrackReference(NodeInput(this, kBottomRightInput), 1)});
|
||||
gizmo_resize_handle_[3] = AddDraggableGizmo<PointGizmo>({NodeKeyframeTrackReference(NodeInput(this, kBottomLeftInput), 0), NodeKeyframeTrackReference(NodeInput(this, kBottomLeftInput), 1)});
|
||||
|
||||
SetFlags(kVideoEffect);
|
||||
SetFlag(kVideoEffect);
|
||||
SetEffectInput(kTextureInput);
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ CropDistortNode::CropDistortNode()
|
||||
point_gizmo_[kGizmoScaleCenterLeft] = AddDraggableGizmo<PointGizmo>({kLeftInput});
|
||||
point_gizmo_[kGizmoScaleCenterRight] = AddDraggableGizmo<PointGizmo>({kRightInput});
|
||||
|
||||
SetFlags(kVideoEffect);
|
||||
SetFlag(kVideoEffect);
|
||||
SetEffectInput(kTextureInput);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ FlipDistortNode::FlipDistortNode()
|
||||
|
||||
AddInput(kVerticalInput, NodeValue::kBoolean, false);
|
||||
|
||||
SetFlags(kVideoEffect);
|
||||
SetFlag(kVideoEffect);
|
||||
SetEffectInput(kTextureInput);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ RippleDistortNode::RippleDistortNode()
|
||||
AddInput(kPositionInput, NodeValue::kVec2, QVector2D(0, 0));
|
||||
AddInput(kStretchInput, NodeValue::kBoolean, false);
|
||||
|
||||
SetFlags(kVideoEffect);
|
||||
SetFlag(kVideoEffect);
|
||||
SetEffectInput(kTextureInput);
|
||||
|
||||
gizmo_ = AddDraggableGizmo<PointGizmo>({
|
||||
|
||||
@@ -41,7 +41,7 @@ SwirlDistortNode::SwirlDistortNode()
|
||||
|
||||
AddInput(kPositionInput, NodeValue::kVec2, QVector2D(0, 0));
|
||||
|
||||
SetFlags(kVideoEffect);
|
||||
SetFlag(kVideoEffect);
|
||||
SetEffectInput(kTextureInput);
|
||||
|
||||
gizmo_ = AddDraggableGizmo<PointGizmo>({
|
||||
|
||||
@@ -48,7 +48,7 @@ TileDistortNode::TileDistortNode()
|
||||
AddInput(kMirrorXInput, NodeValue::kBoolean, false);
|
||||
AddInput(kMirrorYInput, NodeValue::kBoolean, false);
|
||||
|
||||
SetFlags(kVideoEffect);
|
||||
SetFlag(kVideoEffect);
|
||||
SetEffectInput(kTextureInput);
|
||||
|
||||
gizmo_ = AddDraggableGizmo<PointGizmo>({
|
||||
|
||||
@@ -64,7 +64,7 @@ TransformDistortNode::TransformDistortNode()
|
||||
point_gizmo_[i]->SetDragValueBehavior(PointGizmo::kAbsolute);
|
||||
}
|
||||
|
||||
SetFlags(kVideoEffect);
|
||||
SetFlag(kVideoEffect);
|
||||
SetEffectInput(kTextureInput);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ WaveDistortNode::WaveDistortNode()
|
||||
|
||||
AddInput(kVerticalInput, NodeValue::kCombo, false);
|
||||
|
||||
SetFlags(kVideoEffect);
|
||||
SetFlag(kVideoEffect);
|
||||
SetEffectInput(kTextureInput);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ OpacityEffect::OpacityEffect()
|
||||
SetInputProperty(kValueInput, QStringLiteral("min"), 0.0);
|
||||
SetInputProperty(kValueInput, QStringLiteral("max"), 1.0);
|
||||
|
||||
SetFlags(kVideoEffect);
|
||||
SetFlag(kVideoEffect);
|
||||
SetEffectInput(kTextureInput);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ BlurFilterNode::BlurFilterNode()
|
||||
|
||||
AddInput(kRepeatEdgePixelsInput, NodeValue::kBoolean, true);
|
||||
|
||||
SetFlags(kVideoEffect);
|
||||
SetFlag(kVideoEffect);
|
||||
SetEffectInput(kTextureInput);
|
||||
|
||||
radial_center_gizmo_ = AddDraggableGizmo<PointGizmo>();
|
||||
|
||||
@@ -54,7 +54,7 @@ DropShadowFilter::DropShadowFilter()
|
||||
AddInput(kFastInput, NodeValue::kBoolean, false);
|
||||
|
||||
SetEffectInput(kTextureInput);
|
||||
SetFlags(kVideoEffect);
|
||||
SetFlag(kVideoEffect);
|
||||
}
|
||||
|
||||
void DropShadowFilter::Retranslate()
|
||||
|
||||
@@ -38,7 +38,7 @@ MosaicFilterNode::MosaicFilterNode()
|
||||
AddInput(kVertInput, NodeValue::kFloat, 18.0);
|
||||
SetInputProperty(kVertInput, QStringLiteral("min"), 1.0);
|
||||
|
||||
SetFlags(kVideoEffect);
|
||||
SetFlag(kVideoEffect);
|
||||
SetEffectInput(kTextureInput);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ StrokeFilterNode::StrokeFilterNode()
|
||||
|
||||
AddInput(kInnerInput, NodeValue::kBoolean, false);
|
||||
|
||||
SetFlags(kVideoEffect);
|
||||
SetFlag(kVideoEffect);
|
||||
SetEffectInput(kTextureInput);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ NoiseGeneratorNode::NoiseGeneratorNode()
|
||||
AddInput(kColorInput, NodeValue::kBoolean, false);
|
||||
|
||||
SetEffectInput(kBaseIn);
|
||||
SetFlags(kVideoEffect);
|
||||
SetFlag(kVideoEffect);
|
||||
}
|
||||
|
||||
QString NoiseGeneratorNode::Name() const
|
||||
|
||||
@@ -32,7 +32,7 @@ GeneratorWithMerge::GeneratorWithMerge()
|
||||
{
|
||||
AddInput(kBaseInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
|
||||
SetEffectInput(kBaseInput);
|
||||
SetFlags(kVideoEffect);
|
||||
SetFlag(kVideoEffect);
|
||||
}
|
||||
|
||||
void GeneratorWithMerge::Retranslate()
|
||||
|
||||
@@ -54,7 +54,7 @@ TextGeneratorV1::TextGeneratorV1()
|
||||
|
||||
AddInput(kFontSizeInput, NodeValue::kFloat, 72.0f);
|
||||
|
||||
SetFlags(kDontShowInCreateMenu);
|
||||
SetFlag(kDontShowInCreateMenu);
|
||||
}
|
||||
|
||||
QString TextGeneratorV1::Name() const
|
||||
|
||||
@@ -56,7 +56,7 @@ TextGeneratorV2::TextGeneratorV2()
|
||||
SetStandardValue(kColorInput, QVariant::fromValue(Color(1.0f, 1.0f, 1.0)));
|
||||
SetStandardValue(kSizeInput, QVector2D(400, 300));
|
||||
|
||||
SetFlags(kDontShowInCreateMenu);
|
||||
SetFlag(kDontShowInCreateMenu);
|
||||
}
|
||||
|
||||
QString TextGeneratorV2::Name() const
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace olive {
|
||||
NodeGroup::NodeGroup() :
|
||||
output_passthrough_(nullptr)
|
||||
{
|
||||
SetFlags(kDontShowInCreateMenu);
|
||||
SetFlag(kDontShowInCreateMenu);
|
||||
}
|
||||
|
||||
QString NodeGroup::Name() const
|
||||
|
||||
@@ -47,7 +47,7 @@ ColorDifferenceKeyNode::ColorDifferenceKeyNode()
|
||||
|
||||
AddInput(kMaskOnlyInput, NodeValue::kBoolean, false);
|
||||
|
||||
SetFlags(kVideoEffect);
|
||||
SetFlag(kVideoEffect);
|
||||
SetEffectInput(kTextureInput);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ DespillNode::DespillNode()
|
||||
|
||||
AddInput(kPreserveLuminanceInput, NodeValue::kBoolean, false);
|
||||
|
||||
SetFlags(kVideoEffect);
|
||||
SetFlag(kVideoEffect);
|
||||
SetEffectInput(kTextureInput);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ MergeNode::MergeNode()
|
||||
|
||||
AddInput(kBlendIn, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
|
||||
|
||||
SetFlags(kDontShowInParamView);
|
||||
SetFlag(kDontShowInParamView);
|
||||
}
|
||||
|
||||
QString MergeNode::Name() const
|
||||
|
||||
+7
-3
@@ -103,10 +103,14 @@ void Node::Retranslate()
|
||||
SetInputName(kEnabledInput, tr("Enabled"));
|
||||
}
|
||||
|
||||
QIcon Node::icon() const
|
||||
QVariant Node::data(const DataType &d) const
|
||||
{
|
||||
// Just a meaningless default icon to be used where necessary
|
||||
return icon::New;
|
||||
if (d == ICON) {
|
||||
// Just a meaningless default icon to be used where necessary
|
||||
return icon::New;
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool Node::SetNodePositionInContext(Node *node, const QPointF &pos)
|
||||
|
||||
+18
-14
@@ -100,7 +100,8 @@ public:
|
||||
kDontShowInParamView = 0x1,
|
||||
kVideoEffect = 0x2,
|
||||
kAudioEffect = 0x4,
|
||||
kDontShowInCreateMenu = 0x8
|
||||
kDontShowInCreateMenu = 0x8,
|
||||
kIsItem = 0x10
|
||||
};
|
||||
|
||||
struct ContextPair {
|
||||
@@ -184,24 +185,23 @@ public:
|
||||
return folder_;
|
||||
}
|
||||
|
||||
virtual bool IsItem() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool IsItem() const { return flags_ & kIsItem; }
|
||||
|
||||
/**
|
||||
* @brief Function called to retranslate parameter names (should be overridden in derivatives)
|
||||
*/
|
||||
virtual void Retranslate();
|
||||
|
||||
virtual QIcon icon() const;
|
||||
enum DataType
|
||||
{
|
||||
ICON,
|
||||
DURATION,
|
||||
CREATED_TIME,
|
||||
MODIFIED_TIME,
|
||||
FREQUENCY_RATE
|
||||
};
|
||||
|
||||
virtual QString duration() const {return QString();}
|
||||
|
||||
virtual qint64 creation_time() const {return 0;}
|
||||
virtual qint64 mod_time() const {return 0;}
|
||||
|
||||
virtual QString rate() const {return QString();}
|
||||
virtual QVariant data(const DataType &d) const;
|
||||
|
||||
const QVector<QString>& inputs() const
|
||||
{
|
||||
@@ -1196,9 +1196,13 @@ protected:
|
||||
tooltip_ = s;
|
||||
}
|
||||
|
||||
void SetFlags(const uint64_t &f)
|
||||
void SetFlag(Flag f, bool on = true)
|
||||
{
|
||||
flags_ = f;
|
||||
if (on) {
|
||||
flags_ |= f;
|
||||
} else {
|
||||
flags_ &= ~f;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -61,7 +61,7 @@ ViewerOutput::ViewerOutput(bool create_buffer_inputs, bool create_default_stream
|
||||
set_default_parameters();
|
||||
}
|
||||
|
||||
SetFlags(kDontShowInParamView);
|
||||
SetFlag(kDontShowInParamView);
|
||||
|
||||
workarea_ = new TimelineWorkArea(this);
|
||||
markers_ = new TimelineMarkerList(this);
|
||||
@@ -87,56 +87,61 @@ QString ViewerOutput::Description() const
|
||||
return tr("Interface between a Viewer panel and the node system.");
|
||||
}
|
||||
|
||||
QString ViewerOutput::duration() const
|
||||
QVariant ViewerOutput::data(const DataType &d) const
|
||||
{
|
||||
rational using_timebase;
|
||||
Timecode::Display using_display = Core::instance()->GetTimecodeDisplay();
|
||||
switch (d) {
|
||||
case DURATION:
|
||||
{
|
||||
rational using_timebase;
|
||||
Timecode::Display using_display = Core::instance()->GetTimecodeDisplay();
|
||||
|
||||
// Get first enabled streams
|
||||
VideoParams video = GetFirstEnabledVideoStream();
|
||||
AudioParams audio = GetFirstEnabledAudioStream();
|
||||
SubtitleParams sub = GetFirstEnabledSubtitleStream();
|
||||
// Get first enabled streams
|
||||
VideoParams video = GetFirstEnabledVideoStream();
|
||||
AudioParams audio = GetFirstEnabledAudioStream();
|
||||
SubtitleParams sub = GetFirstEnabledSubtitleStream();
|
||||
|
||||
if (video.is_valid() && video.video_type() != VideoParams::kVideoTypeStill) {
|
||||
// Prioritize video
|
||||
using_timebase = video.frame_rate_as_time_base();
|
||||
} else if (audio.is_valid()) {
|
||||
// Use audio as a backup
|
||||
// If we're showing in a timecode, we prefer showing audio in seconds instead
|
||||
if (using_display == Timecode::kTimecodeDropFrame
|
||||
|| using_display == Timecode::kTimecodeNonDropFrame) {
|
||||
using_display = Timecode::kTimecodeSeconds;
|
||||
if (video.is_valid() && video.video_type() != VideoParams::kVideoTypeStill) {
|
||||
// Prioritize video
|
||||
using_timebase = video.frame_rate_as_time_base();
|
||||
} else if (audio.is_valid()) {
|
||||
// Use audio as a backup
|
||||
// If we're showing in a timecode, we prefer showing audio in seconds instead
|
||||
if (using_display == Timecode::kTimecodeDropFrame
|
||||
|| using_display == Timecode::kTimecodeNonDropFrame) {
|
||||
using_display = Timecode::kTimecodeSeconds;
|
||||
}
|
||||
|
||||
using_timebase = audio.sample_rate_as_time_base();
|
||||
} else if (sub.is_valid()) {
|
||||
using_timebase = OLIVE_CONFIG("DefaultSequenceFrameRate").value<rational>();
|
||||
}
|
||||
|
||||
using_timebase = audio.sample_rate_as_time_base();
|
||||
} else if (sub.is_valid()) {
|
||||
using_timebase = OLIVE_CONFIG("DefaultSequenceFrameRate").value<rational>();
|
||||
if (!using_timebase.isNull()) {
|
||||
// Return time transformed to timecode
|
||||
return QString::fromStdString(Timecode::time_to_timecode(GetLength(), using_timebase, using_display));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FREQUENCY_RATE:
|
||||
{
|
||||
VideoParams video_stream;
|
||||
|
||||
if (HasEnabledVideoStreams()
|
||||
&& (video_stream = GetFirstEnabledVideoStream()).video_type() != VideoParams::kVideoTypeStill) {
|
||||
// This is a video editor, prioritize video streams
|
||||
return tr("%1 FPS").arg(video_stream.frame_rate().toDouble());
|
||||
} else if (HasEnabledAudioStreams()) {
|
||||
// No video streams, return audio
|
||||
AudioParams audio_stream = GetFirstEnabledAudioStream();
|
||||
return tr("%1 Hz").arg(audio_stream.sample_rate());
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (using_timebase.isNull()) {
|
||||
// No timebase, return null
|
||||
return QString();
|
||||
} else {
|
||||
// Return time transformed to timecode
|
||||
return QString::fromStdString(Timecode::time_to_timecode(GetLength(), using_timebase, using_display));
|
||||
}
|
||||
}
|
||||
|
||||
QString ViewerOutput::rate() const
|
||||
{
|
||||
VideoParams video_stream;
|
||||
|
||||
if (HasEnabledVideoStreams()
|
||||
&& (video_stream = GetFirstEnabledVideoStream()).video_type() != VideoParams::kVideoTypeStill) {
|
||||
// This is a video editor, prioritize video streams
|
||||
return tr("%1 FPS").arg(video_stream.frame_rate().toDouble());
|
||||
} else if (HasEnabledAudioStreams()) {
|
||||
// No video streams, return audio
|
||||
AudioParams audio_stream = GetFirstEnabledAudioStream();
|
||||
return tr("%1 Hz").arg(audio_stream.sample_rate());
|
||||
}
|
||||
|
||||
return QString();
|
||||
return super::data(d);
|
||||
}
|
||||
|
||||
bool ViewerOutput::HasEnabledVideoStreams() const
|
||||
|
||||
@@ -53,8 +53,7 @@ public:
|
||||
virtual QVector<CategoryID> Category() const override;
|
||||
virtual QString Description() const override;
|
||||
|
||||
virtual QString duration() const override;
|
||||
virtual QString rate() const override;
|
||||
virtual QVariant data(const DataType &d) const override;
|
||||
|
||||
void set_default_parameters();
|
||||
|
||||
|
||||
@@ -34,12 +34,18 @@ const QString Folder::kChildInput = QStringLiteral("child_in");
|
||||
|
||||
Folder::Folder()
|
||||
{
|
||||
SetFlag(kIsItem);
|
||||
|
||||
AddInput(kChildInput, NodeValue::kNone, InputFlags(kInputFlagArray | kInputFlagNotKeyframable));
|
||||
}
|
||||
|
||||
QIcon Folder::icon() const
|
||||
QVariant Folder::data(const DataType &d) const
|
||||
{
|
||||
return icon::Folder;
|
||||
if (d == ICON) {
|
||||
return icon::Folder;
|
||||
}
|
||||
|
||||
return super::data(d);
|
||||
}
|
||||
|
||||
void Folder::Retranslate()
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
return tr("Organize several items into a single collection.");
|
||||
}
|
||||
|
||||
virtual QIcon icon() const override;
|
||||
virtual QVariant data(const DataType &d) const override;
|
||||
|
||||
virtual void Retranslate() override;
|
||||
|
||||
@@ -86,11 +86,6 @@ public:
|
||||
return item_children_;
|
||||
}
|
||||
|
||||
virtual bool IsItem() const override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
int index_of_child(Node* item) const
|
||||
{
|
||||
return item_children_.indexOf(item);
|
||||
|
||||
@@ -46,6 +46,8 @@ Footage::Footage(const QString &filename) :
|
||||
cancelled_(nullptr),
|
||||
total_stream_count_(0)
|
||||
{
|
||||
SetFlag(kIsItem);
|
||||
|
||||
PrependInput(kFilenameInput, NodeValue::kFile, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
||||
|
||||
Clear();
|
||||
@@ -203,26 +205,6 @@ const QString &Footage::decoder() const
|
||||
return decoder_;
|
||||
}
|
||||
|
||||
QIcon Footage::icon() const
|
||||
{
|
||||
if (valid_ && GetTotalStreamCount()) {
|
||||
// Prioritize video > audio > image
|
||||
VideoParams s = GetFirstEnabledVideoStream();
|
||||
|
||||
if (s.is_valid() && s.video_type() != VideoParams::kVideoTypeStill) {
|
||||
return icon::Video;
|
||||
} else if (HasEnabledAudioStreams()) {
|
||||
return icon::Audio;
|
||||
} else if (s.is_valid() && s.video_type() == VideoParams::kVideoTypeStill) {
|
||||
return icon::Image;
|
||||
} else if (HasEnabledSubtitleStreams()) {
|
||||
return icon::Subtitles;
|
||||
}
|
||||
}
|
||||
|
||||
return icon::Error;
|
||||
}
|
||||
|
||||
QString Footage::DescribeVideoStream(const VideoParams ¶ms)
|
||||
{
|
||||
if (params.video_type() == VideoParams::kVideoTypeStill) {
|
||||
@@ -375,26 +357,51 @@ void Footage::LoadFinishedEvent()
|
||||
}
|
||||
}
|
||||
|
||||
qint64 Footage::creation_time() const
|
||||
QVariant Footage::data(const DataType &d) const
|
||||
{
|
||||
QFileInfo info(filename());
|
||||
switch (d) {
|
||||
case CREATED_TIME:
|
||||
{
|
||||
QFileInfo info(filename());
|
||||
|
||||
if (info.exists()) {
|
||||
return QtUtils::GetCreationDate(info).toSecsSinceEpoch();
|
||||
if (info.exists()) {
|
||||
return QtUtils::GetCreationDate(info).toSecsSinceEpoch();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MODIFIED_TIME:
|
||||
{
|
||||
QFileInfo info(filename());
|
||||
|
||||
if (info.exists()) {
|
||||
return info.lastModified().toSecsSinceEpoch();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ICON:
|
||||
{
|
||||
if (valid_ && GetTotalStreamCount()) {
|
||||
// Prioritize video > audio > image
|
||||
VideoParams s = GetFirstEnabledVideoStream();
|
||||
|
||||
if (s.is_valid() && s.video_type() != VideoParams::kVideoTypeStill) {
|
||||
return icon::Video;
|
||||
} else if (HasEnabledAudioStreams()) {
|
||||
return icon::Audio;
|
||||
} else if (s.is_valid() && s.video_type() == VideoParams::kVideoTypeStill) {
|
||||
return icon::Image;
|
||||
} else if (HasEnabledSubtitleStreams()) {
|
||||
return icon::Subtitles;
|
||||
}
|
||||
}
|
||||
|
||||
return icon::Error;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
qint64 Footage::mod_time() const
|
||||
{
|
||||
QFileInfo info(filename());
|
||||
|
||||
if (info.exists()) {
|
||||
return info.lastModified().toSecsSinceEpoch();
|
||||
}
|
||||
|
||||
return 0;
|
||||
return super::data(d);
|
||||
}
|
||||
|
||||
void Footage::UpdateTooltip()
|
||||
|
||||
@@ -153,13 +153,6 @@ public:
|
||||
*/
|
||||
const QString& decoder() const;
|
||||
|
||||
virtual QIcon icon() const override;
|
||||
|
||||
virtual bool IsItem() const override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static QString DescribeVideoStream(const VideoParams& params);
|
||||
static QString DescribeAudioStream(const AudioParams& params);
|
||||
static QString DescribeSubtitleStream(const SubtitleParams& params);
|
||||
@@ -176,8 +169,7 @@ public:
|
||||
|
||||
virtual void LoadFinishedEvent() override;
|
||||
|
||||
virtual qint64 creation_time() const override;
|
||||
virtual qint64 mod_time() const override;
|
||||
virtual QVariant data(const DataType &d) const override;
|
||||
|
||||
virtual int GetTotalStreamCount() const override { return total_stream_count_; }
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ const QString Sequence::kTrackInputFormat = QStringLiteral("track_in_%1");
|
||||
|
||||
Sequence::Sequence()
|
||||
{
|
||||
SetFlag(kIsItem);
|
||||
|
||||
// Create TrackList instances
|
||||
track_lists_.resize(Track::kCount);
|
||||
|
||||
@@ -71,9 +73,13 @@ void Sequence::add_default_nodes(MultiUndoCommand* command)
|
||||
}
|
||||
}
|
||||
|
||||
QIcon Sequence::icon() const
|
||||
QVariant Sequence::data(const DataType &d) const
|
||||
{
|
||||
return icon::Sequence;
|
||||
if (d == ICON) {
|
||||
return icon::Sequence;
|
||||
}
|
||||
|
||||
return super::data(d);
|
||||
}
|
||||
|
||||
QVector<Track *> Sequence::GetUnlockedTracks() const
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
|
||||
void add_default_nodes(MultiUndoCommand *command = nullptr);
|
||||
|
||||
virtual QIcon icon() const override;
|
||||
virtual QVariant data(const DataType &d) const override;
|
||||
|
||||
const QVector<Track *> &GetTracks() const
|
||||
{
|
||||
@@ -87,11 +87,6 @@ public:
|
||||
|
||||
static const QString kTrackInputFormat;
|
||||
|
||||
virtual bool IsItem() const override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void InputConnectedEvent(const QString &input, int element, Node *output) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user