better transition labelling in effect controls

This commit is contained in:
itsmattkc
2019-03-15 12:55:28 +11:00
parent 1f21fdac8a
commit f1bc01ec72
4 changed files with 45 additions and 5 deletions
+9
View File
@@ -102,6 +102,15 @@ bool Clip::IsActiveAt(long timecode)
&& timecode - timeline_in(true) + clip_in(true) < media_length();
}
bool Clip::IsSelected(bool containing)
{
if (this->sequence == nullptr) {
return false;
}
return this->sequence->IsClipSelected(this, containing);
}
const QColor &Clip::color()
{
return color_;
+1
View File
@@ -59,6 +59,7 @@ public:
ClipPtr copy(Sequence *s);
bool IsActiveAt(long timecode);
bool IsSelected(bool containing = true);
const QColor& color();
void set_color(int r, int g, int b);
+2 -2
View File
@@ -48,8 +48,8 @@ public:
Effect* GetSelectedGizmo();
bool IsClipSelected(int clip_index, bool containing);
bool IsClipSelected(Clip* clip, bool containing);
bool IsClipSelected(int clip_index, bool containing = true);
bool IsClipSelected(Clip* clip, bool containing = true);
bool IsTransitionSelected(Transition* t);
QVector<Selection> selections;
+33 -3
View File
@@ -20,11 +20,41 @@ EffectUI::EffectUI(Effect* e) :
// If this effect is actually a transition
if (e->meta->type == EFFECT_TYPE_TRANSITION) {
Transition* t = static_cast<Transition*>(e);
// Since effects can have two clip attachments, find out which one is selected
Clip* selected_clip = t->parent_clip;
bool both_selected = false;
// Check if this is a shared transition
if (t->secondary_clip != nullptr) {
// Check which clips are selected
if (t->secondary_clip->IsSelected()) {
selected_clip = t->secondary_clip;
if (t->parent_clip->IsSelected()) {
// Both clips are selected
both_selected = true;
}
} else if (!t->parent_clip->IsSelected()) {
// Neither are selected, but the naming scheme (no "opening" or "closing" modifier) will be the same
both_selected = true;
}
}
// See if the transition is the clip's opening or closing transition and label it accordingly
if (e->parent_clip->opening_transition.get() == e) {
effect_name = tr("%1 (Opening)").arg(e->name);
if (both_selected) {
effect_name = t->name;
} else if (selected_clip->opening_transition.get() == t) {
effect_name = tr("%1 (Opening)").arg(t->name);
} else {
effect_name = tr("%1 (Closing)").arg(e->name);
effect_name = tr("%1 (Closing)").arg(t->name);
}
} else {