00001 #ifndef RECORDINGPROFILE_H
00002 #define RECORDINGPROFILE_H
00003
00004 #include "mythtvexp.h"
00005 #include "settings.h"
00006 #include "mythdbcon.h"
00007 #include "mythwidgets.h"
00008
00009 const QString availProfiles[] =
00010 {"Default", "Live TV", "High Quality", "Low Quality", "" };
00011
00012 class RecordingProfile;
00013 class VideoCompressionSettings;
00014 class AudioCompressionSettings;
00015
00016
00017 class RecordingProfileStorage : public SimpleDBStorage
00018 {
00019 protected:
00020 RecordingProfileStorage(Setting *_setting,
00021 const RecordingProfile &parentProfile,
00022 QString name) :
00023 SimpleDBStorage(_setting, "recordingprofiles", name),
00024 m_parent(parentProfile)
00025 {
00026 _setting->setName(name);
00027 }
00028
00029 virtual QString GetWhereClause(MSqlBindings &bindings) const;
00030
00031 const RecordingProfile &m_parent;
00032 };
00033
00034 class ImageSize;
00035 class TranscodeResize;
00036 class TranscodeLossless;
00037 class TranscodeFilters;
00038
00039 class MTV_PUBLIC RecordingProfile : public QObject, public ConfigurationWizard
00040 {
00041 Q_OBJECT
00042 protected:
00043 class ID : public AutoIncrementDBSetting {
00044 public:
00045 ID():
00046 AutoIncrementDBSetting("recordingprofiles", "id") {
00047 setVisible(false);
00048 };
00049
00050
00051 virtual QWidget* configWidget(ConfigurationGroup *cg,
00052 QWidget* parent = NULL,
00053 const char* widgetName = NULL) {
00054 (void)cg; (void)parent; (void)widgetName;
00055 return NULL;
00056 };
00057 };
00058
00059 class Name: public LineEditSetting, public RecordingProfileStorage
00060 {
00061 public:
00062 Name(const RecordingProfile &parent):
00063 LineEditSetting(this, false),
00064 RecordingProfileStorage(this, parent, "name")
00065 {
00066 setEnabled(false);
00067 setLabel(QObject::tr("Profile name"));
00068 }
00069
00070
00071
00072
00073 public:
00074 virtual void setValue(const QString &newValue)
00075 {
00076 bool editable = (newValue != "Default") && (newValue != "Live TV");
00077 setRW(editable);
00078 setEnabled(editable);
00079
00080 LineEditSetting::setValue(newValue);
00081 }
00082 };
00083
00084 public:
00085
00086 RecordingProfile(QString profName = QString());
00087 virtual void loadByID(int id);
00088 virtual bool loadByType(const QString &name, const QString &cardtype);
00089 virtual bool loadByGroup(const QString &name, const QString &group);
00090 virtual void CompleteLoad(int profileId, const QString &type,
00091 const QString &name);
00092 virtual DialogCode exec(void);
00093
00094
00095 void setCodecTypes();
00096 void setName(const QString& newName)
00097 { name->setValue(newName); }
00098
00099
00100 const ImageSize& getImageSize(void) const { return *imageSize; }
00101 int getProfileNum(void) const { return id->intValue(); }
00102 QString getName(void) const { return name->getValue(); }
00103 QString groupType(void) const;
00104
00105
00106 static QString getName(int id);
00107 static QMap<int, QString> listProfiles(int group);
00108 static void fillSelections(SelectSetting* setting,
00109 int group, bool foldautodetect = false);
00110
00111
00112 static const uint TranscoderAutodetect = 0;
00113 static const int TranscoderGroup = 6;
00114
00115 private slots:
00116 void ResizeTranscode(bool resize);
00117 void SetLosslessTranscode(bool lossless);
00118 void FiltersChanged(const QString &val);
00119
00120 private:
00121 ID *id;
00122 Name *name;
00123 ImageSize *imageSize;
00124 TranscodeResize *tr_resize;
00125 TranscodeLossless *tr_lossless;
00126 TranscodeFilters *tr_filters;
00127 VideoCompressionSettings *videoSettings;
00128 AudioCompressionSettings *audioSettings;
00129 QString profileName;
00130 bool isEncoder;
00131 };
00132
00133 class RecordingProfileEditor :
00134 public QObject, public ConfigurationDialog
00135 {
00136 Q_OBJECT
00137
00138 public:
00139 RecordingProfileEditor(int id, QString profName);
00140
00141 virtual DialogCode exec(void);
00142 virtual void Load(void);
00143 virtual void Save(void) { }
00144 virtual void Save(QString ) { }
00145
00146 protected slots:
00147 void open(int id);
00148
00149 protected:
00150 ListBoxSetting *listbox;
00151 int group;
00152 QString labelName;
00153 };
00154
00155 #endif