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

The LabelSlider class. More...

#include <labelslider.h>

Inheritance diagram for LabelSlider:

Public Types

enum  DisplayType { Normal, FrameNumber, Percent, Decibel }
 

Public Slots

void SetMinimum (double v)
 Set the minimum value. More...
 
void SetMaximum (double v)
 Set the maximum value. More...
 

Signals

void valueChanged (double d)
 valueChanged signal More...
 
void clicked ()
 clicked signal More...
 

Public Member Functions

 LabelSlider (QWidget *parent=nullptr)
 
void SetValue (double v)
 Set the value. More...
 
void SetDefault (double v)
 Set the default value. More...
 
double value ()
 Returns the internal value as a double. More...
 
void SetDisplayType (const DisplayType &type)
 Sets the way to display the value. More...
 
bool IsDragging ()
 Returns whether the user is currently dragging. More...
 
void SetColor (QString c=nullptr)
 Set the display color. More...
 
void SetFrameRate (double d)
 Set the display frame rate. More...
 
void SetDecimalPlaces (int places)
 Set how many decimal places to show for a floating-point number. More...
 

Protected Member Functions

void mousePressEvent (QMouseEvent *ev)
 
void mouseMoveEvent (QMouseEvent *ev)
 
void mouseReleaseEvent (QMouseEvent *ev)
 

Private Slots

void ShowContextMenu (const QPoint &pos)
 Context menu slot to be connected to QWidget::customContextMenuRequested(const QPoint&) More...
 
void ResetToDefault ()
 Slot to reset current value to the default value. More...
 
void ShowDialog ()
 Show prompt asking for value. More...
 

Private Member Functions

QString ValueToString ()
 Convert the internal value to a displayed string according to display_type More...
 
void SetDefaultCursor ()
 Internal function to set the standard cursor (usually SizeHorCursor) More...
 
void SetActiveCursor ()
 Internal function to set the cursor while dragging (usually NoCursor aka invisible) More...
 

Private Attributes

double default_value
 
double internal_value
 
double drag_start_value
 
int decimal_places
 
bool min_enabled
 
double min_value
 
bool max_enabled
 
double max_value
 
bool drag_start
 
bool drag_proc
 
int drag_start_x
 
int drag_start_y
 
bool set
 
DisplayType display_type
 
double frame_rate
 

Detailed Description

The LabelSlider class.

A UI element that shows a number and can be dragged to increase/decrease its value or clicked to enter a specific one.

Member Enumeration Documentation

Enumerator
Normal 
FrameNumber 
Percent 
Decibel 

Constructor & Destructor Documentation

LabelSlider::LabelSlider ( QWidget *  parent = nullptr)

Member Function Documentation

void LabelSlider::clicked ( )
signal

clicked signal

Emitted if the user clicks on the LabelSlider in any way

bool LabelSlider::IsDragging ( )

Returns whether the user is currently dragging.

Returns
TRUE if the user is dragging, FALSE if not.
void LabelSlider::mouseMoveEvent ( QMouseEvent *  ev)
protected
void LabelSlider::mousePressEvent ( QMouseEvent *  ev)
protected
void LabelSlider::mouseReleaseEvent ( QMouseEvent *  ev)
protected
void LabelSlider::ResetToDefault ( )
privateslot

Slot to reset current value to the default value.

void LabelSlider::SetActiveCursor ( )
private

Internal function to set the cursor while dragging (usually NoCursor aka invisible)

void LabelSlider::SetColor ( QString  c = nullptr)

Set the display color.

Parameters
cColor to set to
void LabelSlider::SetDecimalPlaces ( int  places)

Set how many decimal places to show for a floating-point number.

Defaults to 1

void LabelSlider::SetDefault ( double  v)

Set the default value.

If a default value is set, alt+clicking the LabelSlider will return to the default value.

Parameters
vValue to set as default
void LabelSlider::SetDefaultCursor ( )
private

Internal function to set the standard cursor (usually SizeHorCursor)

void LabelSlider::SetDisplayType ( const DisplayType type)

Sets the way to display the value.

  • LABELSLIDER_NORMAL - Shows the value as a normal number
  • LABELSLIDER_FRAMENUMBER - Shows the number as a timecode according to config.timecode_view. By default, will render hh:mm:ss:ff
  • LABELSLIDER_PERCENT - Shows the number as a percentage. 1.0 becomes "100%", 0.5 becomes 50%, etc.
  • LABELSLIDER_DECIBLE - Shows the number as a decibel. 1.0 becomes "0 dB", 2.0 becomes roughly "6 dB", 0.5 becomes roughly "-6 dB", etc.
Parameters
typeThe display type to set to.
void LabelSlider::SetFrameRate ( double  d)

Set the display frame rate.

If the display_type is set to LABELSLIDER_FRAMENUMBER, this function sets how many frames per second the timecode will be in.

Parameters
d
void LabelSlider::SetMaximum ( double  v)
slot

Set the maximum value.

If a maximum value is set, the value will never go above it. If the user manually sets a value higher than the maximum, it will automatically snap to the maximum.

Parameters
vValue to set as maximum
void LabelSlider::SetMinimum ( double  v)
slot

Set the minimum value.

If a minimum value is set, the value will never go below it. If the user manually sets a value lower than the minimum, it will automatically snap to the minimum.

Parameters
vValue to set as minimum
void LabelSlider::SetValue ( double  v)

Set the value.

Parameters
vValue to set to.
userSetTRUE if this was called through a user action, FALSE if this was called through some other way. The only difference is TRUE will emit a signal (valueChanged()) indicating that the value has changed, and FALSE will not.
void LabelSlider::ShowContextMenu ( const QPoint &  pos)
privateslot

Context menu slot to be connected to QWidget::customContextMenuRequested(const QPoint&)

Parameters
posCurrent cursor position
void LabelSlider::ShowDialog ( )
privateslot

Show prompt asking for value.

Triggered when the user clicks on the LabelSlider without dragging or triggers right click > Edit. Will show an input dialog asking for a new value to be entered manually. Asks for units in the selected display type and converts them back to the internal value type.

double LabelSlider::value ( )

Returns the internal value as a double.

Returns
The internal value. This will not respect the display_type, i.e. 100% will return as 1.0, 12dB will return as 400%, and a timecode will return as a frame number.
void LabelSlider::valueChanged ( double  d)
signal

valueChanged signal

Emitted if the value changed at it was instigated by the user.

QString LabelSlider::ValueToString ( )
private

Convert the internal value to a displayed string according to display_type

Returns
The internal value as a string

Member Data Documentation

int LabelSlider::decimal_places
private
double LabelSlider::default_value
private
DisplayType LabelSlider::display_type
private
bool LabelSlider::drag_proc
private
bool LabelSlider::drag_start
private
double LabelSlider::drag_start_value
private
int LabelSlider::drag_start_x
private
int LabelSlider::drag_start_y
private
double LabelSlider::frame_rate
private
double LabelSlider::internal_value
private
bool LabelSlider::max_enabled
private
double LabelSlider::max_value
private
bool LabelSlider::min_enabled
private
double LabelSlider::min_value
private
bool LabelSlider::set
private

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