diff options
Diffstat (limited to 'recordings.cpp')
-rw-r--r-- | recordings.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
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 |