35 if (onesel && !twosel)
68 : m_text(std::move(a_string)),
71 m_selectable(selectable_flag)
90 bool selectable_flag,
bool visible)
93 an_int, selectable_flag);
94 new_node->SetVisible(visible);
99 const QString &sortText,
int an_int,
bool
100 selectable_flag,
bool visible)
103 an_int, selectable_flag);
104 new_node->SetVisible(visible);
105 new_node->SetSortText(sortText);
170 for (
int i = 0; i < route_of_branches.count(); i++)
175 bool foundit =
false;
176 QList<MythGenericTree*>::iterator it;
184 for (it = children->begin(); it != children->end(); ++it)
189 if (child->
getInt() == route_of_branches[i])
218 QList<int> routeByID;
220 routeByID.push_front(
getInt());
225 routeByID.push_front(parent->
getInt());
232 QStringList routeByString;
234 routeByString.push_front(
GetText());
239 routeByString.push_front(parent->
GetText());
241 return routeByString;
246 QList<MythGenericTree*> route;
248 route.push_front(
this);
253 route.push_front(parent);
275 QList<MythGenericTree *> route =
getRoute();
277 return (route.size() - 1);
301 for (
auto *child : std::as_const(*list))
303 if (child->IsVisible())
320 else if (onlyVisible)
325 return selectedChild;
333 LOG(VB_GENERAL, LOG_ERR,
"Top level can't become selected child");
346 if (position < number_up)
384 if (children && children->count() > 0)
386 SortableMythGenericTreeList::Iterator it;
389 for (it = children->begin(); it != children->end(); ++it)
394 if (child->
GetText() == a_name)
405 if (children && children->count() > 0)
407 SortableMythGenericTreeList::Iterator it;
410 for (it = children->begin(); it != children->end(); ++it)
415 if (child->
getInt() == an_int)
428 if (children && children->count() > 0)
430 SortableMythGenericTreeList::Iterator it;
433 for (it = children->begin(); it != children->end(); ++it)
447 QList<MythGenericTree*>::iterator it;
450 while ((child = *it) !=
nullptr)
507 item->SetData(QVariant::fromValue(
this));
516 item->setDrawArrow(
true);
522 const QString &state)
527 textprop.
text = text;
528 textprop.
state = state;
540 const QString &state)
542 InfoMap::const_iterator map_it = infoMap.begin();
543 while (map_it != infoMap.end())
546 textprop.
text = (*map_it);
547 textprop.
state = state;
567 if (!result.isEmpty())
602 if (!result.isEmpty())
639 if (!result.isEmpty())
643 InfoMap::const_iterator it =
m_states.find(name);
MythGenericTree * getVisibleChildAt(uint reference) const
MythGenericTree * m_parent
bool isSelectable() const
MythGenericTree * findLeaf()
QString GetText(const QString &name="") const
void setParent(MythGenericTree *a_parent)
void SetImageFromMap(const InfoMap &infoMap)
int currentDepth(void)
Establish how deep in the current tree this node lies.
void setSelectedChild(MythGenericTree *a_node)
MythGenericTree * getParent(void) const
void SetImageCb(mgtCbFn fn, void *data)
SortableMythGenericTreeList * m_subnodes
void SetText(const QString &text, const QString &name="", const QString &state="")
void SetVisible(bool visible)
int siblingCount(void) const
void ensureSortFields(void)
MythGenericTree * addNode(const QString &a_string, int an_int=0, bool selectable_flag=false, bool visible=true)
MythGenericTree * getChildById(int an_int) const
void removeNode(MythGenericTree *child)
void SetImage(const QString &filename, const QString &name="")
MythGenericTree(QString a_string="", int an_int=0, bool selectable_flag=false)
QMap< QString, TextProperties > m_strings
MythGenericTree * prevSibling(int number_up)
void DisplayStateFromMap(const InfoMap &infoMap)
QStringList getRouteByString(void)
virtual MythUIButtonListItem * CreateListButton(MythUIButtonList *list)
QList< int > getRouteById(void)
MythGenericTree * getChildAt(uint reference) const
void SetTextFromMap(const InfoMap &infoMap, const QString &state="")
MythGenericTree * findNode(QList< int > route_of_branches)
QString GetState(const QString &name="") const
void deleteNode(MythGenericTree *child)
int childCount(void) const
MythGenericTree * getSelectedChild(bool onlyVisible=false) const
void SetStateCb(mgtCbFn fn, void *data)
virtual ~MythGenericTree()
uint visibleChildCount() const
void becomeSelectedChild(void)
void DisplayState(const QString &state, const QString &name="")
MythGenericTree * getChildByName(const QString &a_name) const
void MoveItemUpDown(MythGenericTree *item, bool flag)
QList< MythGenericTree * > getRoute(void)
void SetTextCb(mgtCbFn fn, void *data)
QList< MythGenericTree * > * getAllChildren() const
void DetachParent(void)
Detach this node/branch from it's parent without deleting it, it can then be reattached elsewhere or ...
MythGenericTree * m_selectedSubnode
QString GetImage(const QString &name="") const
int getChildPosition(MythGenericTree *child) const
MythGenericTree * nextSibling(int number_down)
QString GetSortText() const
static bool sortByString(const MythGenericTree *one, const MythGenericTree *two)
void SetSortType(SortType stype)
void SetAttributeIndex(int index)
void Sort(SortType stype, int attributeIndex=0)
static int sortBySelectable(const MythGenericTree *one, const MythGenericTree *two)
SortableMythGenericTreeList()=default
QString(*)(const QString &name, void *data) mgtCbFn
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
std::shared_ptr< MythSortHelper > getMythSortHelper(void)
Get a pointer to the MythSortHelper singleton.
QHash< QString, QString > InfoMap