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