MythTV  master
parentalcontrols.h
Go to the documentation of this file.
1 #ifndef PARENTALCONTROLS_H_
2 #define PARENTALCONTROLS_H_
3 
4 #include <QObject> // for moc
5 #include <QMetaType>
6 
7 #include "mythmetaexp.h"
8 
10 {
11  public:
12  enum Level { plNone = 0, plLowest = 1, plLow = 2, plMedium = 3,
13  plHigh = 4 };
14 
15  public:
16  ParentalLevel(Level pl);
17  explicit ParentalLevel(int pl);
18  ParentalLevel(const ParentalLevel &rhs);
19  ParentalLevel &operator=(const ParentalLevel &rhs);
20  ParentalLevel &operator=(Level pl);
21  ParentalLevel &operator++();
22  ParentalLevel &operator+=(int amount);
23  ParentalLevel &operator--();
24  ParentalLevel &operator-=(int amount);
25 
26  Level GetLevel() const;
27 
28  void reset() { m_hitlimit = false; }
29  bool good() const { return !m_hitlimit; }
30 
31  private:
32  Level m_level {plNone};
33  bool m_hitlimit {false};
34 };
35 
36 META_PUBLIC bool operator!=(const ParentalLevel &lhs, const ParentalLevel &rhs);
37 META_PUBLIC bool operator==(const ParentalLevel &lhs, const ParentalLevel &rhs);
38 META_PUBLIC bool operator<(const ParentalLevel &lhs, const ParentalLevel &rhs);
39 META_PUBLIC bool operator>(const ParentalLevel &lhs, const ParentalLevel &rhs);
40 META_PUBLIC bool operator<=(const ParentalLevel &lhs, const ParentalLevel &rhs);
41 META_PUBLIC bool operator>=(const ParentalLevel &lhs, const ParentalLevel &rhs);
42 
44 {
45  Q_OBJECT
46 
47  public:
49 
50  void Check(ParentalLevel::Level fromLevel, ParentalLevel::Level toLevel);
51 
52  signals:
53  void SigResultReady(bool passwordValid, ParentalLevel::Level newLevel);
54 
55  private slots:
56  void OnResultReady(bool passwordValid, ParentalLevel::Level newLevel);
57 
58  private:
59  class ParentalLevelChangeCheckerPrivate *m_private {nullptr};
60 };
61 
64 
65 #endif // PARENTALCONTROLS_H_
unsigned int slots[4]
Definition: element.c:38
META_PUBLIC bool operator>=(const ParentalLevel &lhs, const ParentalLevel &rhs)
META_PUBLIC bool operator<=(const ParentalLevel &lhs, const ParentalLevel &rhs)
META_PUBLIC bool operator==(const ParentalLevel &lhs, const ParentalLevel &rhs)
META_PUBLIC bool operator>(const ParentalLevel &lhs, const ParentalLevel &rhs)
META_PUBLIC bool operator!=(const ParentalLevel &lhs, const ParentalLevel &rhs)
Q_DECLARE_METATYPE(GrabberScript *)
bool good() const
#define META_PUBLIC
Definition: mythmetaexp.h:9
META_PUBLIC bool operator<(const ParentalLevel &lhs, const ParentalLevel &rhs)