MythTV master
recordingprofile.h
Go to the documentation of this file.
1#ifndef RECORDINGPROFILE_H
2#define RECORDINGPROFILE_H
3
4#include <array>
5
8#include "mythtvexp.h"
9
10const std::array<QString,4> kAvailProfiles
11 {"Default", "Live TV", "High Quality", "Low Quality" };
12
16class V4L2util;
17
18// A parameter associated with the profile itself
20{
21 public:
23 const RecordingProfile &parentProfile,
24 const QString& name) :
25 SimpleDBStorage(_setting, "recordingprofiles", name),
26 m_parent(parentProfile)
27 {
28 }
29
30 protected:
31 QString GetWhereClause(MSqlBindings &bindings) const override; // SimpleDBStorage
32
34};
35
36class ImageSize;
37class TranscodeResize;
40
42{
43 Q_OBJECT
44 protected:
45 class ID : public AutoIncrementSetting {
46 public:
47 ID():
48 AutoIncrementSetting("recordingprofiles", "id") {
49 setVisible(false);
50 };
51 };
52
54 {
55 public:
56 explicit Name(const RecordingProfile &parent):
58 new RecordingProfileStorage(this, parent, "name"))
59 {
60 setReadOnly(true);
61 setLabel(QObject::tr("Profile name"));
62 setName("name");
63 }
64
65 ~Name() override
66 {
67 delete GetStorage();
68 }
69
70 // -=>TODO: Qt4 can't have nested classes with slots/signals
71 // Is this slot even used????
72 //public slots:
73 public:
74 void setValue(const QString &newValue) override // StandardSetting
75 {
76 bool readonly = (newValue == "Default") || (newValue == "Live TV");
77 setReadOnly(readonly);
78
80 }
82 };
83
84 public:
85 // initializers
86 explicit RecordingProfile(const QString& profName = QString());
87 ~RecordingProfile(void) override;
88 virtual void loadByID(int id);
89 virtual bool loadByType(const QString &name, const QString &cardtype,
90 const QString &videodev);
91 virtual bool loadByGroup(const QString &name, const QString &group);
92 virtual void CompleteLoad(int profileId, const QString &type,
93 const QString &name);
94 bool canDelete(void) override; // GroupSetting
95 void deleteEntry(void) override; // GroupSetting
96
97 // sets
98 void setCodecTypes();
99 void setName(const QString& newName) override // StandardSetting
100 { m_name->setValue(newName); }
101
102 // gets
103 const ImageSize& getImageSize(void) const { return *m_imageSize; }
104 int getProfileNum(void) const { return m_id->getValue().toInt(); }
105 QString getName(void) const { return m_name->getValue(); }
106 QString groupType(void) const;
107
108 // static functions
109 static QString getName(int id);
110
111 // Hardcoded DB group values
112 enum RecProfileGroup : std::uint8_t
113 {
114 AllGroups = 0,
115 SoftwareEncoderGroup = 1,
116 HardwareMPEG2Group = 2,
117 HardwareMJPEGGroup = 3,
118 HardwareHDTVGroup = 4,
119 DVBGroup = 5,
120 TranscoderGroup = 6,
121 FireWireGroup = 7,
122 USBMPEG4Group = 8,
123 FreeboxGroup = 12,
124 HDHomeRunGroup = 13,
125 CRCIGroup = 14,
126 ASIGroup = 15,
127 OCURGroup = 16,
128 CetonGroup = 17
129 };
130
131 static QMap<int, QString> GetProfiles(RecProfileGroup group = AllGroups);
132 static QMap<int, QString> GetTranscodingProfiles();
133 static void fillSelections(GroupSetting* setting,
134 int group, bool foldautodetect = false);
135
136 // constants
137 static const uint kTranscoderAutodetect = 0;
138
139 private slots:
140 void ResizeTranscode(const QString &val);
141 void SetLosslessTranscode(const QString &val);
142 void FiltersChanged(const QString &val);
143
144 private:
145 ID *m_id {nullptr};
146 Name *m_name {nullptr};
147 ImageSize *m_imageSize {nullptr};
148 TranscodeResize *m_trResize {nullptr};
149 TranscodeLossless *m_trLossless {nullptr};
150 TranscodeFilters *m_trFilters {nullptr};
151 VideoCompressionSettings *m_videoSettings {nullptr};
152 AudioCompressionSettings *m_audioSettings {nullptr};
154 bool m_isEncoder {true};
155
156 V4L2util *m_v4l2util {nullptr};
157};
158
160 public GroupSetting
161{
162 Q_OBJECT
163
164 public:
165 RecordingProfileEditor(int id, QString profName);
166 ~RecordingProfileEditor() override = default;
167
168 void Load(void) override; // StandardSetting
169
170 public slots:
171 void ShowNewProfileDialog() const;
172 void CreateNewProfile(const QString &profName);
173
174 protected:
176 QString m_labelName;
177};
178
179#endif
virtual void deleteEntry(void)
virtual bool canDelete(void)
void CreateNewProfile(const QString &profName)
~RecordingProfileEditor() override=default
void Load(void) override
RecordingProfileEditor(int id, QString profName)
RecordingProfileStorage(StandardSetting *_setting, const RecordingProfile &parentProfile, const QString &name)
QString GetWhereClause(MSqlBindings &bindings) const override
const RecordingProfile & m_parent
void setValue(const QString &newValue) override
Name(const RecordingProfile &parent)
void setName(const QString &newName) override
int getProfileNum(void) const
QString getName(void) const
const ImageSize & getImageSize(void) const
QString getName(void) const
virtual void setValue(const QString &newValue)
unsigned int uint
Definition: freesurround.h:24
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:15
const std::array< QString, 4 > kAvailProfiles