Go to the documentation of this file.
35 if (onesel && !twosel)
64 : m_text(std::move(a_string)),
67 m_selectable(selectable_flag)
86 bool selectable_flag,
bool visible)
89 an_int, selectable_flag);
90 new_node->SetVisible(visible);
95 const QString &sortText,
int an_int,
bool
96 selectable_flag,
bool visible)
99 an_int, selectable_flag);
100 new_node->SetVisible(visible);
101 new_node->SetSortText(sortText);
166 for (
int i = 0; i < route_of_branches.count(); i++)
171 bool foundit =
false;
172 QList<MythGenericTree*>::iterator it;
180 for (it = children->begin(); it != children->end(); ++it)
185 if (child->
getInt() == route_of_branches[i])
214 QList<int> routeByID;
216 routeByID.push_front(
getInt());
221 routeByID.push_front(parent->
getInt());
228 QStringList routeByString;
230 routeByString.push_front(
GetText());
235 routeByString.push_front(parent->
GetText());
237 return routeByString;
242 QList<MythGenericTree*> route;
244 route.push_front(
this);
249 route.push_front(parent);
271 QList<MythGenericTree *> route =
getRoute();
273 return (route.size() - 1);
297 for (
auto *child : std::as_const(*list))
299 if (child->IsVisible())
316 else if (onlyVisible)
321 return selectedChild;
329 LOG(VB_GENERAL, LOG_ERR,
"Top level can't become selected child");
342 if (position < number_up)
380 if (children && children->count() > 0)
382 SortableMythGenericTreeList::Iterator it;
385 for (it = children->begin(); it != children->end(); ++it)
390 if (child->
GetText() == a_name)
401 if (children && children->count() > 0)
403 SortableMythGenericTreeList::Iterator it;
406 for (it = children->begin(); it != children->end(); ++it)
411 if (child->
getInt() == an_int)
424 if (children && children->count() > 0)
426 SortableMythGenericTreeList::Iterator it;
429 for (it = children->begin(); it != children->end(); ++it)
443 QList<MythGenericTree*>::iterator it;
446 while ((child = *it) !=
nullptr)
503 item->SetData(QVariant::fromValue(
this));
512 item->setDrawArrow(
true);
518 const QString &state)
523 textprop.
text = text;
524 textprop.
state = state;
536 const QString &state)
538 InfoMap::const_iterator map_it = infoMap.begin();
539 while (map_it != infoMap.end())
542 textprop.
text = (*map_it);
543 textprop.
state = state;
563 if (!result.isEmpty())
598 if (!result.isEmpty())
635 if (!result.isEmpty())
639 InfoMap::const_iterator it =
m_states.find(name);
void Sort(SortType stype, int attributeIndex=0)
QString GetSortText() const
std::shared_ptr< MythSortHelper > getMythSortHelper(void)
Get a pointer to the MythSortHelper singleton.
QString GetText(const QString &name="") const
void setParent(MythGenericTree *a_parent)
static int sortBySelectable(MythGenericTree *one, MythGenericTree *two)
void SetTextFromMap(const InfoMap &infoMap, const QString &state="")
virtual ~MythGenericTree()
void setSelectedChild(MythGenericTree *a_node)
uint visibleChildCount() const
int currentDepth(void)
Establish how deep in the current tree this node lies.
void SetImageCb(mgtCbFn fn, void *data)
void SetImageFromMap(const InfoMap &infoMap)
void SetTextCb(mgtCbFn fn, void *data)
MythGenericTree * getChildByName(const QString &a_name) const
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
void DisplayStateFromMap(const InfoMap &infoMap)
static bool sortByString(MythGenericTree *one, MythGenericTree *two)
bool isSelectable() const
QString GetImage(const QString &name="") const
void SetStateCb(mgtCbFn fn, void *data)
QString(*)(const QString &name, void *data) mgtCbFn
QHash< QString, QString > InfoMap
MythGenericTree * getChildAt(uint reference) const
MythGenericTree * addNode(const QString &a_string, int an_int=0, bool selectable_flag=false, bool visible=true)
MythGenericTree * getSelectedChild(bool onlyVisible=false) const
QString doTitle(const QString &title) const
Create the sortable form of an title string.
QStringList getRouteByString(void)
void SetImage(const QString &filename, const QString &name="")
int childCount(void) const
MythGenericTree * prevSibling(int number_up)
MythGenericTree * nextSibling(int number_down)
MythGenericTree * m_parent
virtual MythUIButtonListItem * CreateListButton(MythUIButtonList *list)
MythGenericTree(QString a_string="", int an_int=0, bool selectable_flag=false)
MythGenericTree * getVisibleChildAt(uint reference) const
void SetAttributeIndex(int index)
void SetVisible(bool visible)
QList< MythGenericTree * > * getAllChildren() const
MythGenericTree * findNode(QList< int > route_of_branches)
int siblingCount(void) const
void DetachParent(void)
Detach this node/branch from it's parent without deleting it, it can then be reattached elsewhere or ...
QString GetState(const QString &name="") const
SortableMythGenericTreeList()=default
void deleteNode(MythGenericTree *child)
void removeNode(MythGenericTree *child)
MythGenericTree * getParent(void) const
MythGenericTree * findLeaf()
void DisplayState(const QString &state, const QString &name="")
QList< MythGenericTree * > getRoute(void)
MythGenericTree * getChildById(int an_int) const
MythGenericTree * m_selectedSubnode
QList< int > getRouteById(void)
void SetText(const QString &text, const QString &name="", const QString &state="")
int getChildPosition(MythGenericTree *child) const
void SetSortType(SortType stype)
void MoveItemUpDown(MythGenericTree *item, bool flag)
void ensureSortFields(void)
void becomeSelectedChild(void)
SortableMythGenericTreeList * m_subnodes
QMap< QString, TextProperties > m_strings