Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add a new method to MythGenericTree to calculate the present depth in…

… the tree for a given node.
  • Loading branch information...
commit 31b500f1661bfaa3b739e9be3d7e67c1d239c51c 1 parent 46d0061
@stuartm stuartm authored
View
2  mythtv/libs/libmythdb/mythversion.h
@@ -11,7 +11,7 @@
/// Update this whenever the plug-in API changes.
/// Including changes in the libmythdb, libmyth, libmythtv, libmythav* and
/// libmythui class methods used by plug-ins.
-#define MYTH_BINARY_VERSION "0.25.20110125-1"
+#define MYTH_BINARY_VERSION "0.25.20110125-2"
/** \brief Increment this whenever the MythTV network protocol changes.
*
View
36 mythtv/libs/libmythui/mythgenerictree.cpp
@@ -186,32 +186,6 @@ void MythGenericTree::deleteNode(MythGenericTree *child)
child = NULL;
}
-int MythGenericTree::calculateDepth(int start)
-{
- int current_depth;
- current_depth = start + 1;
-
- QList<MythGenericTree*> *children = getAllChildren();
- if (children && children->count() > 0)
- {
- int found_depth;
- SortableMythGenericTreeList::Iterator it;
- MythGenericTree *child = NULL;
-
- for (it = children->begin(); it != children->end(); ++it)
- {
- child = *it;
- if (!child)
- continue;
- found_depth = child->calculateDepth(start + 1);
- if (found_depth > current_depth)
- current_depth = found_depth;
- }
- }
-
- return current_depth;
-}
-
MythGenericTree* MythGenericTree::findLeaf()
{
if (m_subnodes->count() > 0)
@@ -341,6 +315,16 @@ int MythGenericTree::siblingCount(void) const
return 1;
}
+/**
+ * \brief Establish how deep in the current tree this node lies
+ */
+int MythGenericTree::currentDepth(void)
+{
+ QList<MythGenericTree *> route = getRoute();
+
+ return (route.size() - 1);
+}
+
QList<MythGenericTree*> *MythGenericTree::getAllChildren() const
{
if (m_currentOrderingIndex == -1)
View
4 mythtv/libs/libmythui/mythgenerictree.h
@@ -81,12 +81,12 @@ class MPUBLIC MythGenericTree
void SetData(QVariant data) { m_data = data; }
const QVariant GetData(void) const { return m_data; }
- int calculateDepth(int start=0);
-
int childCount(void) const;
uint visibleChildCount() const { return m_visibleCount; }
int siblingCount(void) const;
+ int currentDepth(void);
+
void setSelectable(bool flag) { m_selectable = flag; }
bool isSelectable() const { return m_selectable; }
Please sign in to comment.
Something went wrong with that request. Please try again.