From 8f9342e733730ac36f296140367e7b6b21d941c6 Mon Sep 17 00:00:00 2001 From: Dieter Hametner Date: Sat, 6 Jan 2007 02:24:11 +0000 Subject: added recordings_items.ecpp; Updated html structure for recordings --- recordings.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'recordings.cpp') diff --git a/recordings.cpp b/recordings.cpp index 08dd4cc..8290f80 100644 --- a/recordings.cpp +++ b/recordings.cpp @@ -4,12 +4,18 @@ namespace vdrlive { + RecordingsTree::RecordingsTree* RecordingsTree::globalInstance = 0; + RecordingsTree::RecordingsTree() : m_maxLevel(0), m_root(new RecordingsItemDir()), m_recordingsLock(&Recordings) { + if (globalInstance != 0) { + // TODO: report ERROR and fail. + } + for ( cRecording* recording = Recordings.First(); recording != 0; recording = Recordings.Next( recording ) ) { if (m_maxLevel < recording->HierarchyLevels()) { m_maxLevel = recording->HierarchyLevels(); @@ -39,10 +45,17 @@ namespace vdrlive { } } while (pos != string::npos); } + + globalInstance = this; } RecordingsTree::~RecordingsTree() { + if (globalInstance != this) + { + // TODO: report ERROR and fail + } + globalInstance = 0; } RecordingsTree::RecordingsItem::RecordingsItem() : @@ -84,4 +97,13 @@ namespace vdrlive { return m_recording->start; } + RecordingsTree& LiveRecordingsTree() + { + if (RecordingsTree::globalInstance == 0) + { + // TODO: report ERROR and fail! + } + return *RecordingsTree::globalInstance; + } + } // namespace vdrlive -- cgit v1.2.3