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"
9
10class 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 protected:
25 QString GetSetClause(MSqlBindings &bindings) const override; // SimpleDBStorage
26 QString GetWhereClause(MSqlBindings &bindings) const override; // SimpleDBStorage
27
28 private:
30};
31
33{
34 Q_DECLARE_TR_FUNCTIONS(ProfileGroup)
35
36 friend class ProfileGroupEditor;
37 protected:
38 class ID : public AutoIncrementSetting
39 {
40 public:
41 ID() : AutoIncrementSetting("profilegroups", "id")
42 {
43 setVisible(false);
44 }
45 };
46
48 {
49 public:
50 explicit Is_default(const ProfileGroup &parent) :
51 StandardSetting(new ProfileGroupStorage(this, parent, "is_default"))
52 {
53 setVisible(false);
54 }
55
56 ~Is_default() override
57 {
58 delete GetStorage();
59 }
60
61 void edit(MythScreenType * /*screen*/) override { } // StandardSetting
62 void resultEdit(DialogCompletionEvent * /*dce*/) override { } // StandardSetting
63 };
64
66 {
67 public:
68 explicit Name(const ProfileGroup &parent) :
69 MythUITextEditSetting(new ProfileGroupStorage(this, parent, "name"))
70 {
71 setLabel(QObject::tr("Profile Group Name"));
72 }
73
74 ~Name() override
75 {
76 delete GetStorage();
77 }
78 };
79
81 {
82 public:
83 explicit HostName(const ProfileGroup &parent) :
85 "hostname"))
86 {
87 setLabel(QObject::tr("Hostname"));
88 }
89
90 ~HostName() override
91 {
92 delete GetStorage();
93 }
94 void fillSelections();
95 };
96
98 {
99 public:
100 explicit CardInfo(const ProfileGroup &parent) :
102 "cardtype"))
103 {
104 setLabel(QObject::tr("Card-Type"));
105 }
106
107 ~CardInfo() override
108 {
109 delete GetStorage();
110 }
111 };
112
113public:
114 ProfileGroup();
115
116 virtual void loadByID(int id);
117
118 static bool addMissingDynamicProfiles(void);
119 static void fillSelections(GroupSetting* setting);
120 static void getHostNames(QStringList* hostnames);
121 int getProfileNum(void) const {
122 return m_id->getValue().toInt();
123 };
124
125 int isDefault(void) const {
126 return m_isDefault->getValue().toInt();
127 };
128
129 QString getName(void) const { return m_name->getValue(); };
130 static QString getName(int group);
131 void setName(const QString& newName) override // StandardSetting
132 { m_name->setValue(newName); };
133 bool allowedGroupName(void);
134
135private:
136
137 ID *m_id {nullptr};
138 Name *m_name {nullptr};
139 HostName *m_host {nullptr};
141};
142
144 public GroupSetting
145{
146 Q_OBJECT
147
148 public:
149 ProfileGroupEditor() { setLabel(tr("Profile Group")); }
150
151 void Load(void) override; // StandardSetting
152};
153
154#endif
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
Definition: mythdialogbox.h:40
Screen in which all other widgets are contained and rendered.
ProfileGroupStorage(StorageUser *_user, const ProfileGroup &_parentProfile, const QString &_name)
Definition: profilegroup.h:16
const ProfileGroup & m_parent
Definition: profilegroup.h:29
QString GetSetClause(MSqlBindings &bindings) const override
QString GetWhereClause(MSqlBindings &bindings) const override
Definition: profilegroup.cpp:9
CardInfo(const ProfileGroup &parent)
Definition: profilegroup.h:100
HostName(const ProfileGroup &parent)
Definition: profilegroup.h:83
void resultEdit(DialogCompletionEvent *) override
Definition: profilegroup.h:62
void edit(MythScreenType *) override
Definition: profilegroup.h:61
Is_default(const ProfileGroup &parent)
Definition: profilegroup.h:50
Name(const ProfileGroup &parent)
Definition: profilegroup.h:68
~Name() override
Definition: profilegroup.h:74
void setName(const QString &newName) override
Definition: profilegroup.h:131
int getProfileNum(void) const
Definition: profilegroup.h:121
bool allowedGroupName(void)
HostName * m_host
Definition: profilegroup.h:139
static void getHostNames(QStringList *hostnames)
virtual void loadByID(int id)
QString getName(void) const
Definition: profilegroup.h:129
Is_default * m_isDefault
Definition: profilegroup.h:140
static void fillSelections(GroupSetting *setting)
static bool addMissingDynamicProfiles(void)
int isDefault(void) const
Definition: profilegroup.h:125
virtual void Load(void)
void setVisible(bool visible)
virtual void setValue(const QString &newValue)
Storage * GetStorage(void) const
virtual QString getValue(void) const
virtual void setLabel(QString str)
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
Definition: mythdbcon.h:100
#define MTV_PUBLIC
Definition: mythtvexp.h:8