Olive
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Signals | Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
EffectUI Class Reference

The EffectUI class. More...

#include <effectui.h>

Inheritance diagram for EffectUI:
CollapsibleWidget

Signals

void CutRequested ()
 Cut signal. More...
 
void CopyRequested ()
 Copy signal. More...
 
- Signals inherited from CollapsibleWidget
void deselect_others (QWidget *)
 
void visibleChanged (bool)
 

Public Member Functions

 EffectUI (Effect *e)
 EffectUI Constructor. More...
 
void AddAdditionalEffect (Effect *e)
 Attach additional effects to this UI. More...
 
EffectGetEffect ()
 Get the primary Effect that this UI object was created for. More...
 
int GetRowY (int row, QWidget *mapToWidget)
 Get the Y position of a given row. More...
 
void UpdateFromEffect ()
 Update widgets with the current Effect's values. More...
 
bool IsAttachedToClip (Clip *c)
 Check if a given Clip has an Effect referenced by this EffectUI. More...
 
- Public Member Functions inherited from CollapsibleWidget
 CollapsibleWidget (QWidget *parent=nullptr)
 
void SetContents (QWidget *c)
 
QString Title ()
 
void SetTitle (const QString &)
 
bool IsFocused ()
 
bool IsExpanded ()
 
void SetExpanded (bool s)
 
bool IsSelected ()
 

Private Slots

void show_context_menu (const QPoint &)
 Slot for titlebar's right-click signal to show a context menu for extra Effect functions. More...
 

Private Member Functions

QWidget * Widget (int row, int field)
 Retrieve the QWidget corresponding a specific EffectField. More...
 
void AttachKeyframeNavigationToRow (EffectRow *row, KeyframeNavigator *nav)
 Attach a KeyframeNavigator object to an EffectRow. More...
 

Private Attributes

Effecteffect_
 Internal reference to the Effect this object was constructed around. More...
 
QVector< Effect * > additional_effects_
 Internal array of additional Effect objects attached to this UI. More...
 
QGridLayout * layout_
 Layout for UI widgets. More...
 
QVector< QVector< QWidget * > > widgets_
 Grid array of QWidgets corresponding to the Effect's rows and fields. More...
 
QVector< QLabel * > labels_
 Array of QLabel objects corresponding to each row's name(). More...
 
QVector< KeyframeNavigator * > keyframe_navigators_
 Array of KeyframeNavigator objects corresponding to each row. More...
 

Additional Inherited Members

- Public Slots inherited from CollapsibleWidget
void header_click (bool s, bool deselect)
 
- Protected Attributes inherited from CollapsibleWidget
QCheckBox * enabled_check
 
CollapsibleWidgetHeadertitle_bar
 
QWidget * contents
 

Detailed Description

The EffectUI class.

EffectUI is a complete QWidget-based representation of an Effect that can be added to any Qt layout. It overrides CollapsibleWidget (meaning the Effect can be collapsed to just a titlebar to save space). The titlebar is automatically set to the Effect's name and the contents are composed of a grid layout (QGridLayout) corresponding to the Effect's EffectRow and EffectField children.

Many EffectUIs can be created from a single Effect, and many Effects can be attached to a single EffectUI (provided the Effects are all the same type). Neither gains ownership of each other and deleting an EffectUI without any other work is perfectly safe (deleting an Effect with an open EffectUI however, is not).

Constructor & Destructor Documentation

EffectUI::EffectUI ( Effect e)

EffectUI Constructor.

Creates a QWidget-based UI representation of an Effect.

Parameters
eThe Effect to make a UI of. It must be a valid object.

Member Function Documentation

void EffectUI::AddAdditionalEffect ( Effect e)

Attach additional effects to this UI.

Olive allows users to modify several effects (of the same type) with one UI representation. To do this, you can add any amount of extra Effect objects using this function and the UI will attach all of its UI functions to that Effect as well without creating any new QWidgets.

Parameters
eThe Effect to add to this UI object.
void EffectUI::AttachKeyframeNavigationToRow ( EffectRow row,
KeyframeNavigator nav 
)
private

Attach a KeyframeNavigator object to an EffectRow.

Internal function for connecting a KeyframeNavigator UI object to an EffectRow.

Parameters
rowThe EffectRow object.
navThe KeyframeNavigator object.
void EffectUI::CopyRequested ( )
signal

Copy signal.

Emitted when the user selects Copy from the right-click context menu.

void EffectUI::CutRequested ( )
signal

Cut signal.

Emitted when the user selects Cut from the right-click context menu.

Effect * EffectUI::GetEffect ( )

Get the primary Effect that this UI object was created for.

Returns

The Effect object passed to the constructor when creating this EffectUI.

int EffectUI::GetRowY ( int  row,
QWidget *  mapToWidget 
)

Get the Y position of a given row.

Retrieve the on-screen Y position of the attached Effect's EffectRow at a given index. This is primarily used for displaying UI elements that align with the the row's on-screen widgets (e.g. keyframes in the EffectControls panel).

The Y value provided is specifically the center point of the row's name label. It gets mapped to a provided QWidget object so it can be used locally by that QWidget without further modification.

Parameters
rowThe index of the EffectRow to retrieve the Y position of.
mapToWidgetThe widget to map the Y value to.
Returns

The row's Y position.

bool EffectUI::IsAttachedToClip ( Clip c)

Check if a given Clip has an Effect referenced by this EffectUI.

Olive allows users to modify several effects (of the same type) with one UI representation. The behavior is if multiple clips are selected that have effects of the same type, all those Effects can be modified by the same EffectUI object. However this behavior is undesirable if a single Clip has more than one of the same type of Effect (e.g. two or more blurs). In this scenario, the user will most likely expect two separate UI objects for each of these effects individually, rather than consolidating them into one UI object.

To address this, EffectControls will check this function to determine if this EffectUI already references an Effect of this type from this Clip. If it does, it's assumed a new EffectUI should be made rather than consolidating that Effect into the same EffectUI.

Parameters
cThe Clip to determine whether an Effect of this type is already referenced by this EffectUI.
Returns

True is an Effect from this Clip is already attached to this EffectUI.

void EffectUI::show_context_menu ( const QPoint &  pos)
privateslot

Slot for titlebar's right-click signal to show a context menu for extra Effect functions.

void EffectUI::UpdateFromEffect ( )

Update widgets with the current Effect's values.

When the Timeline playhead moves, the current values in the Effect might change if its fields are keyframed. In order to visually update these values on the UI, this function should be called. It will loop through all fields of all attached effects and update them to the value at the current Timeline playhead.

Currently this function is called by update_ui() which is also responsible for updating other parts of the UI like the Timeline and Viewer so they all get updated together.

QWidget * EffectUI::Widget ( int  row,
int  field 
)
private

Retrieve the QWidget corresponding a specific EffectField.

Convenience function equivalent to widgets_.at(row).at(field).

Parameters
rowEffectRow index to retrieve field QWidget from
fieldEffectField index to retrieve QWidget from
Returns

The QWidget at this row and field index.

Member Data Documentation

QVector<Effect*> EffectUI::additional_effects_
private

Internal array of additional Effect objects attached to this UI.

Effect* EffectUI::effect_
private

Internal reference to the Effect this object was constructed around.

QVector<KeyframeNavigator*> EffectUI::keyframe_navigators_
private

Array of KeyframeNavigator objects corresponding to each row.

QVector<QLabel*> EffectUI::labels_
private

Array of QLabel objects corresponding to each row's name().

QGridLayout* EffectUI::layout_
private

Layout for UI widgets.

QVector< QVector<QWidget*> > EffectUI::widgets_
private

Grid array of QWidgets corresponding to the Effect's rows and fields.


The documentation for this class was generated from the following files: