MythTV  master
programinfoupdater.h
Go to the documentation of this file.
1 #ifndef _PROGRAM_INFO_UPDATER_H_
2 #define _PROGRAM_INFO_UPDATER_H_
3 
4 // C++ headers
5 #include <cstdint> // for [u]int[32,64]_t
6 #include <vector>
7 
8 // Qt headers
9 #include <QWaitCondition>
10 #include <QDateTime>
11 #include <QRunnable>
12 #include <QMutex>
13 #include <QHash>
14 
15 // Myth
16 #include "mythexp.h"
17 
18 typedef enum PIAction {
23 } PIAction;
24 
26 {
27  public:
28  PIKeyAction(uint recordedid, PIAction a) :
29  m_recordedid(recordedid), m_action(a) { }
30 
33 
34  bool operator==(const PIKeyAction &other) const
35  {
36  return (m_recordedid == other.m_recordedid);
37  }
38 };
39 
41 {
42  public:
43  PIKeyData(PIAction a, uint64_t f) : m_action(a), m_filesize(f) { }
45  uint64_t m_filesize;
46 };
47 
48 class MPUBLIC ProgramInfoUpdater : public QRunnable
49 {
50  public:
51  ProgramInfoUpdater() { setAutoDelete(false); }
52 
53  void insert(uint recordedid,
54  PIAction action, uint64_t filesize = 0ULL);
55  void run(void) override; // QRunnable
56 
57  private:
58  QMutex m_lock;
59  QWaitCondition m_moreWork;
60  bool m_isRunning {false};
61  std::vector<PIKeyAction> m_needsAddDelete;
62  QHash<uint,PIKeyData> m_needsUpdate;
63 };
64 
65 #endif // _PROGRAM_INFO_UPDATER_H_
QWaitCondition m_moreWork
bool operator==(const PIKeyAction &other) const
#define MPUBLIC
Definition: mythexp.h:10
PIKeyData(PIAction a, uint64_t f)
unsigned int uint
Definition: compat.h:140
QHash< uint, PIKeyData > m_needsUpdate
static int run(MythMediaDevice *dev=nullptr, bool startRandomShow=false)
PIKeyAction(uint recordedid, PIAction a)
uint64_t m_filesize
PIAction m_action
std::vector< PIKeyAction > m_needsAddDelete