MythTV  master
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members

A widget for offering a range of numerical values where only the the bounding values and interval are known. More...

#include <mythuispinbox.h>

Inheritance diagram for MythUISpinBox:
Inheritance graph
[legend]
Collaboration diagram for MythUISpinBox:
Collaboration graph
[legend]

Public Member Functions

 MythUISpinBox (MythUIType *parent, const QString &name)
 
 ~MythUISpinBox () override=default
 
void SetRange (int low, int high, int step, uint pageMultiple=5)
 Set the lower and upper bounds of the spinbox, the interval and page amount. More...
 
void SetValue (int val) override
 
void SetValue (const QString &val) override
 
void AddSelection (int value, const QString &label="")
 Add a special label for a value of the spinbox, it does not need to be in the range. More...
 
QString GetValue (void) const override
 
int GetIntValue (void) const override
 
bool keyPressEvent (QKeyEvent *event) override
 Key event handler. More...
 
template<typename T >
std::enable_if_t< std::chrono::__is_duration< T >::value, T > GetDuration ()
 
template<typename T >
std::enable_if_t< std::chrono::__is_duration< T >::value, void > SetDuration (T val)
 
- Public Member Functions inherited from MythUIButtonList
 MythUIButtonList (MythUIType *parent, const QString &name)
 
 MythUIButtonList (MythUIType *parent, const QString &name, QRect area, bool showArrow=true, bool showScrollBar=false)
 
 ~MythUIButtonList () override
 
bool gestureEvent (MythGestureEvent *event) override
 Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop. More...
 
void customEvent (QEvent *event) override
 
void SetDrawFromBottom (bool draw)
 
void Reset () override
 Reset the widget to it's original state, should not reset changes made by the theme. More...
 
void Update ()
 
void SetValueByData (const QVariant &data)
 
QVariant GetDataValue () const
 
MythRect GetButtonArea (void) const
 
void SetItemCurrent (MythUIButtonListItem *item)
 
void SetItemCurrent (int current, int topPos=-1)
 
MythUIButtonListItemGetItemCurrent () const
 
MythUIButtonListItemGetItemFirst () const
 
MythUIButtonListItemGetItemNext (MythUIButtonListItem *item) const
 
MythUIButtonListItemGetItemAt (int pos) const
 
MythUIButtonListItemGetItemByData (const QVariant &data)
 
uint ItemWidth (void)
 
uint ItemHeight (void)
 
LayoutType GetLayout () const
 
bool MoveItemUpDown (MythUIButtonListItem *item, bool up)
 
void SetAllChecked (MythUIButtonListItem::CheckState state)
 
int GetCurrentPos () const
 
int GetItemPos (MythUIButtonListItem *item) const
 
int GetTopItemPos (void) const
 
int GetCount () const
 
int GetVisibleCount ()
 
bool IsEmpty () const
 
bool MoveToNamedPosition (const QString &position_name)
 
void RemoveItem (MythUIButtonListItem *item)
 
void SetLCDTitles (const QString &title, const QString &columnList="")
 
void updateLCD (void)
 
void SetSearchFields (const QString &fields)
 
void ShowSearchDialog (void)
 
bool Find (const QString &searchStr, bool startsWith=false)
 
bool FindNext (void)
 
bool FindPrev (void)
 
void LoadInBackground (int start=0, int pageSize=20)
 
int StopLoad (void)
 
- Public Member Functions inherited from MythUIType
 MythUIType (QObject *parent, const QString &name)
 
void AddChild (MythUIType *child)
 Add a child UIType. More...
 
MythUITypeGetChild (const QString &name) const
 Get a named child of this UIType. More...
 
MythUITypeGetChildAt (QPoint p, bool recursive=true, bool focusable=true) const
 Return the first MythUIType at the given coordinates. More...
 
QList< MythUIType * > * GetAllChildren (void)
 Return a list of all child widgets. More...
 
QList< MythUIType * > GetAllDescendants (void)
 
void DeleteChild (const QString &name)
 Delete a named child of this UIType. More...
 
void DeleteChild (MythUIType *child)
 Delete the given UIType if it is a child of this UIType. More...
 
void DeleteAllChildren (void)
 Delete all child widgets. More...
 
bool NeedsRedraw (void) const
 
void ResetNeedsRedraw (void)
 
void SetRedraw (void)
 
void SetChildNeedsRedraw (MythUIType *child)
 
bool CanTakeFocus (void) const
 Return if this widget can accept input focus. More...
 
void SetCanTakeFocus (bool set=true)
 Set whether this widget can take focus. More...
 
void SetFocusOrder (int order)
 
bool IsEnabled (void) const
 
void SetEnabled (bool enable)
 
bool MoveToTop (void)
 
bool MoveChildToTop (MythUIType *child)
 
void ActivateAnimations (MythUIAnimation::Trigger trigger)
 
QList< MythUIAnimation * > * GetAnimations (void)
 
virtual void Pulse (void)
 Pulse is called 70 times a second to trigger a single frame of an animation. More...
 
void Draw (MythPainter *p, int xoffset, int yoffset, int alphaMod=255, QRect clipRect=QRect())
 
void SetPosition (int x, int y)
 Convenience method, calls SetPosition(const MythPoint&) Override that instead to change functionality. More...
 
void SetPosition (QPoint point)
 
virtual void SetPosition (const MythPoint &point)
 
virtual MythPoint GetPosition (void) const
 
virtual void SetSize (QSize size)
 
virtual void SetMinSize (const MythPoint &size)
 Set the minimum size of this widget, for widgets which can be rescaled. More...
 
virtual QSize GetMinSize (void) const
 
virtual void SetArea (const MythRect &rect)
 
virtual void AdjustMinArea (int delta_x, int delta_y, int delta_w, int delta_h)
 Adjust the size of a sibling. More...
 
virtual void VanishSibling (void)
 
virtual void SetMinAreaParent (MythRect actual_area, MythRect allowed_area, MythUIType *child)
 Adjust the size of sibling objects within the button. More...
 
virtual void SetMinArea (const MythRect &rect)
 Set the minimum area based on the given size. More...
 
virtual MythRect GetArea (void) const
 If the object has a minimum area defined, return it, other wise return the default area. More...
 
virtual MythRect GetFullArea (void) const
 
virtual void RecalculateArea (bool recurse=true)
 
void ExpandArea (QRect rect)
 
virtual QRegion GetDirtyArea (void) const
 
bool IsVisible (bool recurse=false) const
 
virtual void SetVisible (bool visible)
 
void MoveTo (QPoint destXY, QPoint speedXY)
 
void AdjustAlpha (int mode, int alphachange, int minalpha=0, int maxalpha=255)
 
void SetAlpha (int newalpha)
 
int GetAlpha (void) const
 
virtual bool inputMethodEvent (QInputMethodEvent *event)
 Input Method event handler. More...
 
virtual void mediaEvent (MythMediaEvent *event)
 Media/Device status event handler, received from MythMediaMonitor. More...
 
MythFontPropertiesGetFont (const QString &text) const
 
bool AddFont (const QString &text, MythFontProperties *fontProp)
 
void SetHelpText (const QString &text)
 
QString GetHelpText (void) const
 
void SetXMLLocation (const QString &filename, int where)
 
QString GetXMLLocation (void) const
 
void SetXMLName (const QString &name)
 
QString GetXMLName (void) const
 
bool IsDeferredLoading (bool recurse=false) const
 
void SetDeferLoad (bool defer)
 
virtual void LoadNow (void)
 Cause images in this and child widgets to be loaded. More...
 
bool ContainsPoint (QPoint point) const
 Check if the given point falls within this widgets area. More...
 
virtual MythPainterGetPainter (void)
 
void SetPainter (MythPainter *painter)
 
void SetCentre (UIEffects::Centre centre)
 
void SetZoom (float zoom)
 
void SetHorizontalZoom (float zoom)
 
void SetVerticalZoom (float zoom)
 
void SetAngle (float angle)
 
void SetDependIsDefault (bool isDefault)
 
void SetReverseDependence (MythUIType *dependee, bool reverse)
 
void SetDependsMap (QMap< QString, QString > dependsMap)
 
QMap< QString, QString > GetDependsMap () const
 

Protected Member Functions

bool ParseElement (const QString &filename, QDomElement &element, bool showWarnings) override
 Parse the xml definition of this widget setting the state of the object accordingly. More...
 
void CopyFrom (MythUIType *base) override
 Copy this widgets state from another. More...
 
void CreateCopy (MythUIType *parent) override
 Copy the state of this widget to the one given, it must be of the same type. More...
 
bool MoveDown (MovementUnit unit=MoveItem, uint amount=0) override
 
bool MoveUp (MovementUnit unit=MoveItem, uint amount=0) override
 
void ShowEntryDialog (QString initialEntry)
 
- Protected Member Functions inherited from MythUIButtonList
void DrawSelf (MythPainter *p, int xoffset, int yoffset, int alphaMod, QRect clipRect) override
 
void Const ()
 
virtual void Init ()
 
void InsertItem (MythUIButtonListItem *item, int listPosition=-1)
 
int minButtonWidth (const MythRect &area)
 
int minButtonHeight (const MythRect &area)
 
void InitButton (int itemIdx, MythUIStateType *&realButton, MythUIButtonListItem *&buttonItem)
 
MythUIGroupPrepareButton (int buttonIdx, int itemIdx, int &selectedIdx, int &button_shift)
 
bool DistributeRow (int &first_button, int &last_button, int &first_item, int &last_item, int &selected_column, int &skip_cols, bool grow_left, bool grow_right, int **col_widths, int &row_height, int total_height, int split_height, int &col_cnt, bool &wrapped)
 
bool DistributeCols (int &first_button, int &last_button, int &first_item, int &last_item, int &selected_column, int &selected_row, int &skip_cols, int **col_widths, QList< int > &row_heights, int &top_height, int &bottom_height, bool &wrapped)
 
bool DistributeButtons (void)
 
void CalculateButtonPositions (void)
 
void CalculateArrowStates (void)
 
void SetScrollBarPosition (void)
 
void ItemVisible (MythUIButtonListItem *item)
 
void SetActive (bool active)
 
int PageUp (void)
 
int PageDown (void)
 
bool DoFind (bool doMove, bool searchForward)
 
void FindEnabledUp (MovementUnit unit)
 
void FindEnabledDown (MovementUnit unit)
 If the current item is not enabled, find the next enabled one. More...
 
virtual void CalculateVisibleItems (void)
 
virtual QPoint GetButtonPosition (int column, int row) const
 
void SetButtonArea (const MythRect &rect)
 
void Finalize (void) override
 Perform any post-xml parsing initialisation tasks. More...
 
void SanitizePosition (void)
 
- Protected Member Functions inherited from MythUIType
 ~MythUIType () override
 
void customEvent (QEvent *event) override
 
void AddFocusableChildrenToList (FocusInfoType &focusList)
 
void HandleAlphaPulse ()
 Handle one frame of an alpha (transparency) change animation. More...
 
void HandleMovementPulse ()
 Handle one frame of a movement animation. More...
 
int CalcAlpha (int alphamod) const
 
void ConnectDependants (bool recurse=false)
 

Protected Attributes

bool m_hasTemplate {false}
 
QString m_negativeTemplate
 
QString m_zeroTemplate
 
QString m_positiveTemplate
 
uint m_moveAmount {0}
 
int m_low {0}
 
int m_high {0}
 
int m_step {0}
 
- Protected Attributes inherited from MythUIButtonList
LayoutType m_layout {LayoutVertical}
 
ArrangeType m_arrange {ArrangeFixed}
 
ScrollStyle m_scrollStyle {ScrollFree}
 
WrapStyle m_wrapStyle {WrapNone}
 
int m_alignment {Qt::AlignLeft | Qt::AlignTop}
 
MythRect m_contentsRect {0, 0, 0, 0}
 
MythPoint m_searchPosition {-2,-2}
 
QString m_searchFields {"**ALL**"}
 
QString m_searchStr
 
bool m_searchStartsWith {false}
 
int m_itemWidth {0}
 
int m_itemHeight {0}
 
int m_itemHorizSpacing {0}
 
int m_itemVertSpacing {0}
 
int m_itemsVisible {0}
 
int m_maxVisible {0}
 
int m_rows {0}
 
int m_columns {0}
 
int m_leftColumns {0}
 
int m_rightColumns {0}
 
int m_topRows {0}
 
int m_bottomRows {0}
 
bool m_active {false}
 
bool m_showArrow {true}
 
bool m_showScrollBar {true}
 
MythUIScrollBarm_scrollBar {nullptr}
 
MythUIStateTypem_upArrow {nullptr}
 
MythUIStateTypem_downArrow {nullptr}
 
MythUIStateTypem_buttontemplate {nullptr}
 
QVector< MythUIStateType * > m_buttonList
 
QMap< int, MythUIButtonListItem * > m_buttonToItem
 
QHash< QString, QString > m_actionRemap
 
bool m_initialized {false}
 
bool m_needsUpdate {false}
 
bool m_clearing {false}
 
int m_selPosition {0}
 
int m_topPosition {0}
 
int m_itemCount {0}
 
bool m_keepSelAtBottom {false}
 
QList< MythUIButtonListItem * > m_itemList
 
int m_nextItemLoaded {0}
 
bool m_drawFromBottom {false}
 
QString m_lcdTitle
 
QStringList m_lcdColumns
 
- Protected Attributes inherited from MythUIType
QList< MythUIType * > m_childrenList
 
QMap< QString, QString > m_dependsMap
 
QList< QPair< MythUIType *, bool > > m_dependsValue
 
QList< int > m_dependOperator
 
bool m_visible {true}
 
bool m_hasFocus {false}
 
bool m_canHaveFocus {false}
 
bool m_enabled {true}
 
bool m_enableInitiator {false}
 
bool m_initiator {false}
 
bool m_vanish {false}
 
bool m_vanished {false}
 
bool m_isDependDefault {false}
 
QMap< MythUIType *, boolm_reverseDepend
 
int m_focusOrder {0}
 
MythRect m_area {0,0,0,0}
 
MythRect m_minArea {0,0,0,0}
 
MythPoint m_minSize
 
QRegion m_dirtyRegion {0,0,0,0}
 
bool m_needsRedraw {false}
 
UIEffects m_effects
 
int m_alphaChangeMode {0}
 
int m_alphaChange {0}
 
int m_alphaMin {0}
 
int m_alphaMax {255}
 
bool m_moving {false}
 
QPoint m_xyDestination {0,0}
 
QPoint m_xySpeed {0,0}
 
FontMapm_fonts {nullptr}
 
MythUITypem_parent {nullptr}
 
MythPainterm_painter {nullptr}
 
QList< MythUIAnimation * > m_animations
 
QString m_helptext
 
QString m_xmlName
 
QString m_xmlLocation
 
bool m_deferload {false}
 
QColor m_borderColor {Qt::black}
 

Additional Inherited Members

- Public Types inherited from MythUIButtonList
enum  MovementUnit {
  MoveItem, MoveColumn, MoveRow, MovePage,
  MoveMax, MoveMid, MoveByAmount
}
 
enum  LayoutType { LayoutVertical, LayoutHorizontal, LayoutGrid }
 
- Public Slots inherited from MythUIButtonList
void Select ()
 
void Deselect ()
 
void ToggleEnabled ()
 
- Public Slots inherited from MythUIType
void LoseFocus ()
 
bool TakeFocus ()
 
void Activate ()
 
void Hide (void)
 
void Show (void)
 
void Refresh (void)
 
void UpdateDependState (bool isDefault)
 
void UpdateDependState (MythUIType *dependee, bool isDefault)
 
- Signals inherited from MythUIButtonList
void itemSelected (MythUIButtonListItem *item)
 
void itemClicked (MythUIButtonListItem *item)
 
void itemVisible (MythUIButtonListItem *item)
 
void itemLoaded (MythUIButtonListItem *item)
 
- Signals inherited from MythUIType
void RequestUpdate ()
 
void RequestRegionUpdate (const QRect &)
 
void TakingFocus ()
 
void LosingFocus ()
 
void VisibilityChanged (bool Visible)
 
void Showing ()
 
void Hiding ()
 
void Enabling ()
 
void Disabling ()
 
void FinishedMoving ()
 
void FinishedFading ()
 
void DependChanged (bool isDefault)
 
- Static Public Member Functions inherited from XMLParseBase
static QString getFirstText (QDomElement &element)
 
static bool parseBool (const QString &text)
 
static bool parseBool (QDomElement &element)
 
static MythPoint parsePoint (const QString &text, bool normalize=true)
 
static MythPoint parsePoint (QDomElement &element, bool normalize=true)
 
static QSize parseSize (const QString &text, bool normalize=true)
 
static QSize parseSize (QDomElement &element, bool normalize=true)
 
static MythRect parseRect (const QString &text, bool normalize=true)
 
static MythRect parseRect (QDomElement &element, bool normalize=true)
 
static int parseAlignment (const QString &text)
 
static int parseAlignment (QDomElement &element)
 
static QBrush parseGradient (const QDomElement &element)
 
static QString parseText (QDomElement &element)
 
static MythUITypeGetGlobalObjectStore (void)
 
static void ClearGlobalObjectStore (void)
 
static void ParseChildren (const QString &filename, QDomElement &element, MythUIType *parent, bool showWarnings)
 
static MythUITypeParseUIType (const QString &filename, QDomElement &element, const QString &type, MythUIType *parent, MythScreenType *screen, bool showWarnings, QMap< QString, QString > &parentDependsMap)
 
static bool WindowExists (const QString &xmlfile, const QString &windowname)
 
static bool LoadWindowFromXML (const QString &xmlfile, const QString &windowname, MythUIType *parent)
 
static bool LoadBaseTheme (void)
 
static bool LoadBaseTheme (const QString &baseTheme)
 
static bool CopyWindowFromBase (const QString &windowname, MythScreenType *win)
 
- Protected Types inherited from MythUIButtonList
enum  ScrollStyle { ScrollFree, ScrollCenter, ScrollGroupCenter }
 
enum  ArrangeType { ArrangeFixed, ArrangeFill, ArrangeSpread, ArrangeStack }
 
enum  WrapStyle {
  WrapCaptive = -1, WrapNone = 0, WrapSelect, WrapItems,
  WrapFlowing
}
 
- Static Protected Member Functions inherited from MythUIType
static int NormX (int width)
 
static int NormY (int height)
 

Detailed Description

A widget for offering a range of numerical values where only the the bounding values and interval are known.

Where a list of specific values is required instead, then use MythUIButtonList instead.

Definition at line 16 of file mythuispinbox.h.

Constructor & Destructor Documentation

◆ MythUISpinBox()

MythUISpinBox::MythUISpinBox ( MythUIType parent,
const QString &  name 
)
inline

Definition at line 20 of file mythuispinbox.h.

Referenced by CreateCopy().

◆ ~MythUISpinBox()

MythUISpinBox::~MythUISpinBox ( )
overridedefault

Member Function Documentation

◆ SetRange()

void MythUISpinBox::SetRange ( int  low,
int  high,
int  step,
uint  pageMultiple = 5 
)

Set the lower and upper bounds of the spinbox, the interval and page amount.

Parameters
lowThe lowest value
highThe highest value
stepThe interval between displayed values e.g. sequence 0,5,10,15 would have have step value of 5
pageMultipleThe number of list items to move by when PAGEUP and PAGEDOWN input actions are used

Definition at line 26 of file mythuispinbox.cpp.

Referenced by RatingSettings::Create(), VisualizationSettings::Create(), MetadataSettings::Create(), ManualSchedule::Create(), SmartPlaylistEditor::Create(), SourceSetup::Create(), SmartPLDateDialog::Create(), MetadataOptions::Create(), RecMetadataEdit::Create(), EditMetadataDialog::fillWidgets(), SchedOptMixin::Load(), StoreOptMixin::Load(), CustomPriority::loadData(), GlobalSetup::loadData(), CriteriaRowEditor::operatorChanged(), and MythSpinBoxDialog::SetRange().

◆ SetValue() [1/2]

void MythUISpinBox::SetValue ( int  val)
inlineoverridevirtual

◆ SetValue() [2/2]

void MythUISpinBox::SetValue ( const QString &  val)
inlineoverridevirtual

Reimplemented from MythUIButtonList.

Definition at line 28 of file mythuispinbox.h.

◆ AddSelection()

void MythUISpinBox::AddSelection ( int  value,
const QString &  label = "" 
)

Add a special label for a value of the spinbox, it does not need to be in the range.

Parameters
labelThe text displayed
valueThe value associated to this label

Definition at line 96 of file mythuispinbox.cpp.

Referenced by MythSpinBoxDialog::AddSelection().

◆ GetValue()

QString MythUISpinBox::GetValue ( void  ) const
inlineoverridevirtual

◆ GetIntValue()

int MythUISpinBox::GetIntValue ( void  ) const
inlineoverridevirtual

◆ keyPressEvent()

bool MythUISpinBox::keyPressEvent ( QKeyEvent *  event)
overridevirtual

Key event handler.

Parameters
eventKeypress event

Reimplemented from MythUIButtonList.

Definition at line 215 of file mythuispinbox.cpp.

◆ GetDuration()

template<typename T >
std::enable_if_t<std::chrono::__is_duration<T>::value, T> MythUISpinBox::GetDuration ( )
inline

◆ SetDuration()

template<typename T >
std::enable_if_t<std::chrono::__is_duration<T>::value, void> MythUISpinBox::SetDuration ( val)
inline

Definition at line 43 of file mythuispinbox.h.

Referenced by SourceSetup::sourceListItemSelected().

◆ ParseElement()

bool MythUISpinBox::ParseElement ( const QString &  filename,
QDomElement &  element,
bool  showWarnings 
)
overrideprotectedvirtual

Parse the xml definition of this widget setting the state of the object accordingly.

Reimplemented from MythUIButtonList.

Definition at line 127 of file mythuispinbox.cpp.

◆ CopyFrom()

void MythUISpinBox::CopyFrom ( MythUIType base)
overrideprotectedvirtual

Copy this widgets state from another.

Reimplemented from MythUIButtonList.

Definition at line 193 of file mythuispinbox.cpp.

◆ CreateCopy()

void MythUISpinBox::CreateCopy ( MythUIType parent)
overrideprotectedvirtual

Copy the state of this widget to the one given, it must be of the same type.

Reimplemented from MythUIButtonList.

Definition at line 184 of file mythuispinbox.cpp.

◆ MoveDown()

bool MythUISpinBox::MoveDown ( MovementUnit  unit = MoveItem,
uint  amount = 0 
)
overrideprotectedvirtual

Reimplemented from MythUIButtonList.

Definition at line 154 of file mythuispinbox.cpp.

◆ MoveUp()

bool MythUISpinBox::MoveUp ( MovementUnit  unit = MoveItem,
uint  amount = 0 
)
overrideprotectedvirtual

Reimplemented from MythUIButtonList.

Definition at line 169 of file mythuispinbox.cpp.

◆ ShowEntryDialog()

void MythUISpinBox::ShowEntryDialog ( QString  initialEntry)
protected

Definition at line 269 of file mythuispinbox.cpp.

Referenced by keyPressEvent().

Member Data Documentation

◆ m_hasTemplate

bool MythUISpinBox::m_hasTemplate {false}
protected

Definition at line 56 of file mythuispinbox.h.

Referenced by CopyFrom(), keyPressEvent(), ParseElement(), and SetRange().

◆ m_negativeTemplate

QString MythUISpinBox::m_negativeTemplate
protected

Definition at line 57 of file mythuispinbox.h.

Referenced by CopyFrom(), ParseElement(), and SetRange().

◆ m_zeroTemplate

QString MythUISpinBox::m_zeroTemplate
protected

Definition at line 58 of file mythuispinbox.h.

Referenced by CopyFrom(), ParseElement(), and SetRange().

◆ m_positiveTemplate

QString MythUISpinBox::m_positiveTemplate
protected

Definition at line 59 of file mythuispinbox.h.

Referenced by CopyFrom(), ParseElement(), and SetRange().

◆ m_moveAmount

uint MythUISpinBox::m_moveAmount {0}
protected

Definition at line 61 of file mythuispinbox.h.

Referenced by MoveDown(), MoveUp(), and SetRange().

◆ m_low

int MythUISpinBox::m_low {0}
protected

Definition at line 62 of file mythuispinbox.h.

Referenced by SetRange(), and ShowEntryDialog().

◆ m_high

int MythUISpinBox::m_high {0}
protected

Definition at line 63 of file mythuispinbox.h.

Referenced by SetRange(), and ShowEntryDialog().

◆ m_step

int MythUISpinBox::m_step {0}
protected

Definition at line 64 of file mythuispinbox.h.

Referenced by SetRange(), and ShowEntryDialog().


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