Go to the documentation of this file.
35 if (onesel && !twosel)
64 : m_text(
std::move(a_string)),
66 m_selectable(selectable_flag)
87 bool selectable_flag,
bool visible)
90 an_int, selectable_flag);
91 new_node->SetVisible(visible);
96 const QString &sortText,
int an_int,
bool
97 selectable_flag,
bool visible)
100 an_int, selectable_flag);
101 new_node->SetVisible(visible);
102 new_node->SetSortText(sortText);
167 for (
int i = 0; i < route_of_branches.count(); i++)
172 bool foundit =
false;
173 QList<MythGenericTree*>::iterator it;
181 for (it = children->begin(); it != children->end(); ++it)
186 if (child->
getInt() == route_of_branches[i])
215 QList<int> routeByID;
217 routeByID.push_front(
getInt());
222 routeByID.push_front(parent->
getInt());
229 QStringList routeByString;
231 routeByString.push_front(
GetText());
236 routeByString.push_front(parent->
GetText());
238 return routeByString;
243 QList<MythGenericTree*> route;
245 route.push_front(
this);
250 route.push_front(parent);
272 QList<MythGenericTree *> route =
getRoute();
274 return (route.size() - 1);
298 for (
auto *child : qAsConst(*list))
300 if (child->IsVisible())
317 else if (onlyVisible)
322 return selectedChild;
330 LOG(VB_GENERAL, LOG_ERR,
"Top level can't become selected child");
343 if (position < number_up)
381 if (children && children->count() > 0)
383 SortableMythGenericTreeList::Iterator it;
386 for (it = children->begin(); it != children->end(); ++it)
391 if (child->
GetText() == a_name)
402 if (children && children->count() > 0)
404 SortableMythGenericTreeList::Iterator it;
407 for (it = children->begin(); it != children->end(); ++it)
412 if (child->
getInt() == an_int)
425 if (children && children->count() > 0)
427 SortableMythGenericTreeList::Iterator it;
430 for (it = children->begin(); it != children->end(); ++it)
444 QList<MythGenericTree*>::iterator it;
447 while ((child = *it) !=
nullptr)
504 item->SetData(QVariant::fromValue(
this));
513 item->setDrawArrow(
true);
519 const QString &state)
524 textprop.
text = text;
525 textprop.
state = state;
537 const QString &state)
539 InfoMap::const_iterator map_it = infoMap.begin();
540 while (map_it != infoMap.end())
543 textprop.
text = (*map_it);
544 textprop.
state = state;
564 if (!result.isEmpty())
599 if (!result.isEmpty())
636 if (!result.isEmpty())
640 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
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