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 QString GetSetClause(MSqlBindings &bindings) const override; // SimpleDBStorage
25 QString GetWhereClause(MSqlBindings &bindings) const override; // SimpleDBStorage
27};
28
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
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 ~Is_default() override
54 {
55 delete GetStorage();
56 }
57
58 void edit(MythScreenType * /*screen*/) override { } // StandardSetting
59 void resultEdit(DialogCompletionEvent * /*dce*/) override { } // StandardSetting
60 };
61
63 {
64 public:
65 explicit Name(const ProfileGroup &parent) :
66 MythUITextEditSetting(new ProfileGroupStorage(this, parent, "name"))
67 {
68 setLabel(QObject::tr("Profile Group Name"));
69 }
70
71 ~Name() override
72 {
73 delete GetStorage();
74 }
75 };
76
78 {
79 public:
80 explicit HostName(const ProfileGroup &parent) :
82 "hostname"))
83 {
84 setLabel(QObject::tr("Hostname"));
85 }
86
87 ~HostName() override
88 {
89 delete GetStorage();
90 }
91 void fillSelections();
92 };
93
95 {
96 public:
97 explicit CardInfo(const ProfileGroup &parent) :
99 "cardtype"))
100 {
101 setLabel(QObject::tr("Card-Type"));
102 }
103
104 ~CardInfo() override
105 {
106 delete GetStorage();
107 }
108 };
109
110public:
111 ProfileGroup();
112
113 virtual void loadByID(int id);
114
115 static bool addMissingDynamicProfiles(void);
116 static void fillSelections(GroupSetting* setting);
117 static void getHostNames(QStringList* hostnames);
118 int getProfileNum(void) const {
119 return m_id->getValue().toInt();
120 };
121
122 int isDefault(void) const {
123 return m_isDefault->getValue().toInt();
124 };
125
126 QString getName(void) const { return m_name->getValue(); };
127 static QString getName(int group);
128 void setName(const QString& newName) override // StandardSetting
129 { m_name->setValue(newName); };
130 bool allowedGroupName(void);
131
132private:
133
134 ID *m_id {nullptr};
135 Name *m_name {nullptr};
136 HostName *m_host {nullptr};
138};
139
141 public GroupSetting
142{
143 Q_OBJECT
144
145 public:
146 ProfileGroupEditor() { setLabel(tr("Profile Group")); }
147
148 void Load(void) override; // StandardSetting
149};
150
151#endif
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
Definition: mythdialogbox.h:41
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:26
QString GetSetClause(MSqlBindings &bindings) const override
QString GetWhereClause(MSqlBindings &bindings) const override
Definition: profilegroup.cpp:9
CardInfo(const ProfileGroup &parent)
Definition: profilegroup.h:97
HostName(const ProfileGroup &parent)
Definition: profilegroup.h:80
void resultEdit(DialogCompletionEvent *) override
Definition: profilegroup.h:59
void edit(MythScreenType *) override
Definition: profilegroup.h:58
Is_default(const ProfileGroup &parent)
Definition: profilegroup.h:47
Name(const ProfileGroup &parent)
Definition: profilegroup.h:65
~Name() override
Definition: profilegroup.h:71
void setName(const QString &newName) override
Definition: profilegroup.h:128
int getProfileNum(void) const
Definition: profilegroup.h:118
bool allowedGroupName(void)
HostName * m_host
Definition: profilegroup.h:136
static void getHostNames(QStringList *hostnames)
virtual void loadByID(int id)
QString getName(void) const
Definition: profilegroup.h:126
Is_default * m_isDefault
Definition: profilegroup.h:137
static void fillSelections(GroupSetting *setting)
static bool addMissingDynamicProfiles(void)
int isDefault(void) const
Definition: profilegroup.h:122
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:11