2 * Copyright (C) 2015-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
11 #include "events/IEvent.h"
12 #include "threads/CriticalSection.h"
18 #define NOTIFICATION_DISPLAY_TIME 5000
19 #define NOTIFICATION_MESSAGE_TIME 1000
21 typedef std::vector
<EventPtr
> Events
;
26 CEventLog() = default;
27 CEventLog(const CEventLog
&) = delete;
28 CEventLog
& operator=(CEventLog
const&) = delete;
29 ~CEventLog() = default;
31 const Events
& Get() const;
32 Events
Get(EventLevel level
, bool includeHigherLevels
= false) const;
33 EventPtr
Get(const std::string
& eventIdentifier
) const;
35 void Add(const EventPtr
& event
);
36 void Add(const EventPtr
& event
, bool withNotification
, bool withSound
= true);
37 void AddWithNotification(const EventPtr
& event
,
38 unsigned int displayTime
= NOTIFICATION_DISPLAY_TIME
,
39 unsigned int messageTime
= NOTIFICATION_MESSAGE_TIME
,
40 bool withSound
= true);
41 void AddWithNotification(const EventPtr
& event
, bool withSound
);
42 void Remove(const EventPtr
& event
);
43 void Remove(const std::string
& eventIdentifier
);
45 void Clear(EventLevel level
, bool includeHigherLevels
= false);
47 bool Execute(const std::string
& eventIdentifier
);
49 static std::string
EventLevelToString(EventLevel level
);
50 static EventLevel
EventLevelFromString(const std::string
& level
);
52 void ShowFullEventLog(EventLevel level
= EventLevel::Basic
, bool includeHigherLevels
= true);
55 void SendMessage(const EventPtr
& event
, int message
);
57 typedef std::vector
<EventPtr
> EventsList
;
58 typedef std::map
<std::string
, EventPtr
> EventsMap
;
60 EventsMap m_eventsMap
;
61 mutable CCriticalSection m_critical
;