MythTV  master
profilegroup.h
Go to the documentation of this file.
1 #ifndef PROFILEGROUP_H
2 #define PROFILEGROUP_H
3 
4 #include <QString>
5 #include <QCoreApplication>
6 
7 #include "mythtvexp.h"
8 #include "standardsettings.h"
9 #include "mythwidgets.h"
10 
11 class ProfileGroup;
12 
13 // A parameter associated with the profile itself
15 {
16  public:
18  const ProfileGroup &_parentProfile,
19  QString _name) :
20  SimpleDBStorage(_user, "profilegroups", _name),
21  m_parent(_parentProfile)
22  {
23  }
24 
25  QString GetSetClause(MSqlBindings &bindings) const override; // SimpleDBStorage
26  QString GetWhereClause(MSqlBindings &bindings) const override; // SimpleDBStorage
28 };
29 
30 class ProfileGroup : public GroupSetting
31 {
32  Q_DECLARE_TR_FUNCTIONS(ProfileGroup)
33 
34  friend class ProfileGroupEditor;
35  protected:
36  class ID : public AutoIncrementSetting
37  {
38  public:
39  ID() : AutoIncrementSetting("profilegroups", "id")
40  {
41  setVisible(false);
42  }
43  };
44 
45  class Is_default : public StandardSetting
46  {
47  public:
48  explicit Is_default(const ProfileGroup &parent) :
49  StandardSetting(new ProfileGroupStorage(this, parent, "is_default"))
50  {
51  setVisible(false);
52  }
53 
54  void edit(MythScreenType * /*screen*/) override { } // StandardSetting
55  void resultEdit(DialogCompletionEvent * /*dce*/) override { } // StandardSetting
56  };
57 
58  class Name : public MythUITextEditSetting
59  {
60  public:
61  explicit Name(const ProfileGroup &parent) :
62  MythUITextEditSetting(new ProfileGroupStorage(this, parent, "name"))
63  {
64  setLabel(QObject::tr("Profile Group Name"));
65  }
66  };
67 
69  {
70  public:
71  explicit HostName(const ProfileGroup &parent) :
73  "hostname"))
74  {
75  setLabel(QObject::tr("Hostname"));
76  }
77  void fillSelections();
78  };
79 
81  {
82  public:
83  explicit CardInfo(const ProfileGroup &parent) :
85  "cardtype"))
86  {
87  setLabel(QObject::tr("Card-Type"));
88  }
89  };
90 
91 public:
92  ProfileGroup();
93 
94  virtual void loadByID(int id);
95 
96  static bool addMissingDynamicProfiles(void);
97  static void fillSelections(GroupSetting* setting);
98  static void getHostNames(QStringList* hostnames);
99  int getProfileNum(void) const {
100  return id->getValue().toInt();
101  };
102 
103  int isDefault(void) const {
104  return is_default->getValue().toInt();
105  };
106 
107  QString getName(void) const { return name->getValue(); };
108  static QString getName(int group);
109  void setName(const QString& newName) override // StandardSetting
110  { name->setValue(newName); };
111  bool allowedGroupName(void);
112 
113 private:
114 
115  ID* id;
119 };
120 
122  public GroupSetting
123 {
124  Q_OBJECT
125 
126  public:
127  ProfileGroupEditor() { setLabel(tr("Profile Group")); }
128 
129  void Load(void) override; // StandardSetting
130 };
131 
132 #endif
static void getHostNames(QStringList *hostnames)
void resultEdit(DialogCompletionEvent *) override
Definition: profilegroup.h:55
void setName(const QString &newName) override
Definition: profilegroup.h:109
virtual void Load(void)
QString getName(void) const
Definition: profilegroup.h:107
ProfileGroupStorage(StorageUser *_user, const ProfileGroup &_parentProfile, QString _name)
Definition: profilegroup.h:17
virtual void loadByID(int id)
bool allowedGroupName(void)
HostName(const ProfileGroup &parent)
Definition: profilegroup.h:71
QString GetSetClause(MSqlBindings &bindings) const override
QString GetWhereClause(MSqlBindings &bindings) const override
Definition: profilegroup.cpp:8
virtual QString getValue(void) const
const ProfileGroup & m_parent
Definition: profilegroup.h:27
static bool addMissingDynamicProfiles(void)
CardInfo(const ProfileGroup &parent)
Definition: profilegroup.h:83
static void fillSelections(GroupSetting *setting)
#define MTV_PUBLIC
Definition: mythtvexp.h:15
virtual void setLabel(QString str)
Is_default(const ProfileGroup &parent)
Definition: profilegroup.h:48
HostName * host
Definition: profilegroup.h:117
int getProfileNum(void) const
Definition: profilegroup.h:99
Name(const ProfileGroup &parent)
Definition: profilegroup.h:61
void edit(MythScreenType *) override
Definition: profilegroup.h:54
void setVisible(bool visible)
Is_default * is_default
Definition: profilegroup.h:118
int isDefault(void) const
Definition: profilegroup.h:103
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
Definition: mythdbcon.h:98
Screen in which all other widgets are contained and rendered.
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
Definition: mythdialogbox.h:37
virtual void setValue(const QString &newValue)