MythTV  master
recordingprofile.h
Go to the documentation of this file.
1 #ifndef RECORDINGPROFILE_H
2 #define RECORDINGPROFILE_H
3 
4 #include <array>
5 
6 #include "mythtvexp.h"
7 #include "standardsettings.h"
8 #include "mythdbcon.h"
9 
10 const std::array<QString,4> kAvailProfiles
11  {"Default", "Live TV", "High Quality", "Low Quality" };
12 
13 class RecordingProfile;
16 class 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 
36 class ImageSize;
37 class TranscodeResize;
38 class TranscodeLossless;
39 class TranscodeFilters;
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  // -=>TODO: Qt4 can't have nested classes with slots/signals
66  // Is this slot even used????
67  //public slots:
68  public:
69  void setValue(const QString &newValue) override // StandardSetting
70  {
71  bool readonly = (newValue == "Default") || (newValue == "Live TV");
72  setReadOnly(readonly);
73 
75  }
77  };
78 
79  public:
80  // initializers
81  explicit RecordingProfile(const QString& profName = QString());
82  ~RecordingProfile(void) override;
83  virtual void loadByID(int id);
84  virtual bool loadByType(const QString &name, const QString &cardtype,
85  const QString &videodev);
86  virtual bool loadByGroup(const QString &name, const QString &group);
87  virtual void CompleteLoad(int profileId, const QString &type,
88  const QString &name);
89  bool canDelete(void) override; // GroupSetting
90  void deleteEntry(void) override; // GroupSetting
91 
92  // sets
93  void setCodecTypes();
94  void setName(const QString& newName) override // StandardSetting
95  { m_name->setValue(newName); }
96 
97  // gets
98  const ImageSize& getImageSize(void) const { return *m_imageSize; }
99  int getProfileNum(void) const { return m_id->getValue().toInt(); }
100  QString getName(void) const { return m_name->getValue(); }
101  QString groupType(void) const;
102 
103  // static functions
104  static QString getName(int id);
105 
106  // Hardcoded DB group values
108  {
109  AllGroups = 0,
110  SoftwareEncoderGroup = 1,
111  HardwareMPEG2Group = 2,
112  HardwareMJPEGGroup = 3,
113  HardwareHDTVGroup = 4,
114  DVBGroup = 5,
115  TranscoderGroup = 6,
116  FireWireGroup = 7,
117  USBMPEG4Group = 8,
118  FreeboxGroup = 12,
119  HDHomeRunGroup = 13,
120  CRCIGroup = 14,
121  ASIGroup = 15,
122  OCURGroup = 16,
123  CetonGroup = 17
124  };
125 
126  static QMap<int, QString> GetProfiles(RecProfileGroup group = AllGroups);
127  static QMap<int, QString> GetTranscodingProfiles();
128  static void fillSelections(GroupSetting* setting,
129  int group, bool foldautodetect = false);
130 
131  // constants
132  static const uint kTranscoderAutodetect = 0;
133 
134  private slots:
135  void ResizeTranscode(const QString &val);
136  void SetLosslessTranscode(const QString &val);
137  void FiltersChanged(const QString &val);
138 
139  private:
140  ID *m_id {nullptr};
141  Name *m_name {nullptr};
142  ImageSize *m_imageSize {nullptr};
143  TranscodeResize *m_trResize {nullptr};
144  TranscodeLossless *m_trLossless {nullptr};
145  TranscodeFilters *m_trFilters {nullptr};
146  VideoCompressionSettings *m_videoSettings {nullptr};
147  AudioCompressionSettings *m_audioSettings {nullptr};
148  QString m_profileName;
149  bool m_isEncoder {true};
150 
151  V4L2util *m_v4l2util {nullptr};
152 };
153 
155  public GroupSetting
156 {
157  Q_OBJECT
158 
159  public:
160  RecordingProfileEditor(int id, QString profName);
161  ~RecordingProfileEditor() override = default;
162 
163  void Load(void) override; // StandardSetting
164 
165  public slots:
166  void ShowNewProfileDialog() const;
167  void CreateNewProfile(const QString &profName);
168 
169  protected:
170  int m_group;
171  QString m_labelName;
172 };
173 
174 #endif
RecordingProfile::Name::setValue
void setValue(const QString &newValue) override
Definition: recordingprofile.h:69
MSqlBindings
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
Definition: mythdbcon.h:98
RecordingProfile::m_profileName
QString m_profileName
Definition: recordingprofile.h:148
kAvailProfiles
const std::array< QString, 4 > kAvailProfiles
Definition: recordingprofile.h:11
StandardSetting::setValue
virtual void setValue(const QString &newValue)
Definition: standardsettings.cpp:169
AudioCompressionSettings
Definition: recordingprofile.cpp:398
RecordingProfile::RecProfileGroup
RecProfileGroup
Definition: recordingprofile.h:107
TranscodeLossless
Definition: recordingprofile.cpp:1206
TranscodeResize
Definition: recordingprofile.cpp:1192
RecordingProfileEditor::ShowNewProfileDialog
void ShowNewProfileDialog() const
Definition: recordingprofile.cpp:1675
mythtvexp.h
mythdbcon.h
RecordingProfileStorage::RecordingProfileStorage
RecordingProfileStorage(StandardSetting *_setting, const RecordingProfile &parentProfile, const QString &name)
Definition: recordingprofile.h:22
RecordingProfileStorage::m_parent
const RecordingProfile & m_parent
Definition: recordingprofile.h:33
RecordingProfileStorage::GetWhereClause
QString GetWhereClause(MSqlBindings &bindings) const override
Definition: recordingprofile.cpp:11
RecordingProfile::getName
QString getName(void) const
Definition: recordingprofile.h:100
SimpleDBStorage
Definition: mythstorage.h:55
TranscodeFilters
Definition: recordingprofile.cpp:1267
StandardSetting::getName
QString getName(void) const
Definition: standardsettings.h:41
RecordingProfileEditor::m_group
int m_group
Definition: recordingprofile.h:170
GroupSetting::deleteEntry
virtual void deleteEntry(void)
Definition: standardsettings.h:449
VideoCompressionSettings
Definition: recordingprofile.cpp:894
RecordingProfileEditor::~RecordingProfileEditor
~RecordingProfileEditor() override=default
RecordingProfileEditor::Load
void Load(void) override
Definition: recordingprofile.cpp:1665
RecordingProfileEditor::CreateNewProfile
void CreateNewProfile(const QString &profName)
Definition: recordingprofile.cpp:1693
uint
unsigned int uint
Definition: compat.h:144
AutoIncrementSetting
Definition: standardsettings.h:127
GroupSetting::canDelete
virtual bool canDelete(void)
Definition: standardsettings.h:448
RecordingProfileEditor
Definition: recordingprofile.h:154
standardsettings.h
MTV_PUBLIC
#define MTV_PUBLIC
Definition: mythtvexp.h:15
RecordingProfile::Name
Definition: recordingprofile.h:53
RecordingProfile::getProfileNum
int getProfileNum(void) const
Definition: recordingprofile.h:99
RecordingProfile::getImageSize
const ImageSize & getImageSize(void) const
Definition: recordingprofile.h:98
RecordingProfileEditor::m_labelName
QString m_labelName
Definition: recordingprofile.h:171
MythUITextEditSetting
Definition: standardsettings.h:146
V4L2util
Definition: v4l2util.h:16
ImageSize
Definition: recordingprofile.cpp:1283
RecordingProfile::ID::ID
ID()
Definition: recordingprofile.h:47
RecordingProfile::ID
Definition: recordingprofile.h:45
RecordingProfile::setName
void setName(const QString &newName) override
Definition: recordingprofile.h:94
StandardSetting
Definition: standardsettings.h:29
RecordingProfile::Name::Name
Name(const RecordingProfile &parent)
Definition: recordingprofile.h:56
RecordingProfile
Definition: recordingprofile.h:41
RecordingProfileEditor::RecordingProfileEditor
RecordingProfileEditor(int id, QString profName)
Definition: recordingprofile.cpp:1658
RecordingProfileStorage
Definition: recordingprofile.h:19
GroupSetting
Definition: standardsettings.h:435