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