summaryrefslogtreecommitdiffstats
path: root/xbmc/pvr/PVREventLogJob.h
blob: a5f0be7fa20ca5e2f60e3a8e0fd30df6d3e7e9f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
 *  Copyright (C) 2012-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#pragma once

#include "events/EventLog.h"
#include "utils/Job.h"

#include <string>
#include <vector>

namespace PVR
{
class CPVREventLogJob : public CJob
{
public:
  CPVREventLogJob() = default;

  CPVREventLogJob(bool bNotifyUser,
                  EventLevel eLevel,
                  const std::string& label,
                  const std::string& msg,
                  const std::string& icon);

  ~CPVREventLogJob() override = default;
  const char* GetType() const override { return "pvr-eventlog-job"; }

  void AddEvent(bool bNotifyUser,
                EventLevel eLevel,
                const std::string& label,
                const std::string& msg,
                const std::string& icon);

  bool DoWork() override;

private:
  struct Event
  {
    bool m_bNotifyUser;
    EventLevel m_eLevel{EventLevel::Information};
    std::string m_label;
    std::string m_msg;
    std::string m_icon;

    Event(bool bNotifyUser,
          EventLevel elevel,
          const std::string& label,
          const std::string& msg,
          const std::string& icon)
      : m_bNotifyUser(bNotifyUser), m_eLevel(elevel), m_label(label), m_msg(msg), m_icon(icon)
    {
    }
  };

  std::vector<Event> m_events;
};
} // namespace PVR