kodi
PVREventLogJob.h
1 /*
2  * Copyright (C) 2012-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "events/EventLog.h"
12 #include "utils/Job.h"
13 
14 #include <string>
15 #include <vector>
16 
17 namespace PVR
18 {
19 class CPVREventLogJob : public CJob
20 {
21 public:
22  CPVREventLogJob() = default;
23 
24  CPVREventLogJob(bool bNotifyUser,
25  EventLevel eLevel,
26  const std::string& label,
27  const std::string& msg,
28  const std::string& icon);
29 
30  ~CPVREventLogJob() override = default;
31  const char* GetType() const override { return "pvr-eventlog-job"; }
32 
33  void AddEvent(bool bNotifyUser,
34  EventLevel eLevel,
35  const std::string& label,
36  const std::string& msg,
37  const std::string& icon);
38 
39  bool DoWork() override;
40 
41 private:
42  struct Event
43  {
44  bool m_bNotifyUser;
45  EventLevel m_eLevel{EventLevel::Information};
46  std::string m_label;
47  std::string m_msg;
48  std::string m_icon;
49 
50  Event(bool bNotifyUser,
51  EventLevel elevel,
52  const std::string& label,
53  const std::string& msg,
54  const std::string& icon)
55  : m_bNotifyUser(bNotifyUser), m_eLevel(elevel), m_label(label), m_msg(msg), m_icon(icon)
56  {
57  }
58  };
59 
60  std::vector<Event> m_events;
61 };
62 } // namespace PVR
Definition: PVREventLogJob.h:19
Base class for jobs that are executed asynchronously.
Definition: Job.h:109
Definition: ContextMenuManager.h:24
bool DoWork() override
Main workhorse function of CJob instances.
Definition: PVREventLogJob.cpp:37
const char * GetType() const override
Function that returns the type of job.
Definition: PVREventLogJob.h:31