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