konverter.kdevelop: cvs/konverter/src/app/XineEngine/postfilter.h Source File

Main Page | Class List | Directories | File List

# postfilter.h

    00001 /***************************************************************************
    00002                            postfilter.h -
    00003                 Wrapper for xine's postprocessing filters.
    00004                              -------------------
    00005     begin                : Son Dez 7 2003
    00006     revision             : $Revision: 1.1.1.1 $
    00007     last modified        : $Date: 2005/06/24 13:18:33 $ by $Author: marco $
    00008     copyright            : (C) 2003-2005 by Juergen Kofler, Miguel Freitas
    00009     email                : kaffeine@gmx.net
    00010  ***************************************************************************/
    00011
    00012 /***************************************************************************
    00013  *                                                                         *
    00014  *   This program is free software; you can redistribute it and/or modify  *
    00015  *   it under the terms of the GNU General Public License as published by  *
    00016  *   the Free Software Foundation; either version 2 of the License, or     *
    00017  *   (at your option) any later version.                                   *
    00018  *                                                                         *
    00019  ***************************************************************************/
    00020
    00021 #ifndef POSTFILTER_H
    00022 #define POSTFILTER_H
    00023
    00024 /* forward declaration */
    00025 class QWidget;
    00026 class QObject;
    00027 class QString;
    00028 class QGroupBox;
    00029 class QTextEdit;
    00030 class KPushButton;
    00031
    00032 #include <klineedit.h>
    00033 #include <knuminput.h>
    00034 #include <kcombobox.h>
    00035 #include <kdialogbase.h>
    00036
    00037 #include <qcheckbox.h>
    00038
    00039 #include <xine.h>
    00040
    00041
    00042 class PostFilterParameter : public QObject
    00043 {
    00044   Q_OBJECT
    00045 public:
    00046   PostFilterParameter(const QString& name, int offset, QWidget* parent)
    00047                       : QObject(parent, name), m_offset(offset)
    00048   {}
    00049   ~PostFilterParameter() {};
    00050
    00051   virtual void setValue( const QString& ) = 0;
    00052   virtual QString getValue() = 0;
    00053   virtual QWidget *getWidget() = 0;
    00054
    00055 protected:
    00056   int m_offset;
    00057 };
    00058
    00059
    00060 class PostFilterParameterInt : public PostFilterParameter
    00061 {
    00062   Q_OBJECT
    00063 public:
    00064   PostFilterParameterInt(const QString& name, int offset, int value, int min, int max, QWidget* parent);
    00065   ~PostFilterParameterInt() {};
    00066
    00067   void setValue( const QString &value )
    00068     { int i = value.toInt(); m_numInput->setValue(i); slotIntValue(i); }
    00069   QString getValue()
    00070     { QString s; s.sprintf("%d", m_numInput->value()); return s; }
    00071   QWidget *getWidget() { return m_numInput; }
    00072
    00073 signals:
    00074   void signalIntValue( int, int );
    00075
    00076 public slots:
    00077   void slotIntValue(int val) { emit signalIntValue(m_offset, val); }
    00078
    00079 private:
    00080   KIntNumInput* m_numInput;
    00081 };
    00082
    00083
    00084 class PostFilterParameterDouble : public PostFilterParameter
    00085 {
    00086   Q_OBJECT
    00087 public:
    00088   PostFilterParameterDouble(const QString& name, int offset, double value, double min, double max, QWidget* parent);
    00089   ~PostFilterParameterDouble() {};
    00090
    00091   void setValue( const QString &value )
    00092     { double d = value.toDouble(); m_numInput->setValue(d); slotDoubleValue(d); }
    00093   QString getValue()
    00094     { QString s; s.sprintf("%lf",m_numInput->value()); return s; }
    00095   QWidget *getWidget() { return m_numInput; }
    00096
    00097 signals:
    00098   void signalDoubleValue(int, double);
    00099
    00100 public slots:
    00101   void slotDoubleValue(double val) { emit signalDoubleValue(m_offset, val); }
    00102
    00103 private:
    00104   KDoubleNumInput* m_numInput;
    00105 };
    00106
    00107
    00108 class PostFilterParameterChar : public PostFilterParameter
    00109 {
    00110   Q_OBJECT
    00111 public:
    00112   PostFilterParameterChar(const QString& name, int offset, char *value, int size, QWidget* parent);
    00113   ~PostFilterParameterChar() {};
    00114
    00115   void setValue(const QString &value)
    00116     { m_charInput->setText(value); slotCharValue(value); }
    00117   QString getValue() { return m_charInput->text(); }
    00118   QWidget *getWidget() { return m_charInput; }
    00119
    00120 signals:
    00121   void signalCharValue(int, const QString&);
    00122
    00123 public slots:
    00124   void slotCharValue(const QString& val) { emit signalCharValue(m_offset, val); }
    00125
    00126 private:
    00127   KLineEdit* m_charInput;
    00128 };
    00129
    00130
    00131 class PostFilterParameterCombo : public PostFilterParameter
    00132 {
    00133   Q_OBJECT
    00134 public:
    00135   PostFilterParameterCombo(const QString& name, int offset, int value, char **enums, QWidget* parent);
    00136   ~PostFilterParameterCombo() {};
    00137
    00138   void setValue(const QString &value) { m_comboBox->setCurrentItem(value); slotIntValue(m_comboBox->currentItem()); }
    00139   QString getValue() { return m_comboBox->currentText(); }
    00140   QWidget *getWidget() { return m_comboBox; }
    00141
    00142 signals:
    00143   void signalIntValue(int, int);
    00144
    00145 public slots:
    00146   void slotIntValue(int val) { emit signalIntValue(m_offset, val); }
    00147
    00148 private:
    00149   KComboBox* m_comboBox;
    00150 };
    00151
    00152
    00153 class PostFilterParameterBool : public PostFilterParameter
    00154 {
    00155   Q_OBJECT
    00156 public:
    00157   PostFilterParameterBool(const QString& name, int offset, bool value, QWidget* parent);
    00158   ~PostFilterParameterBool() {};
    00159
    00160   void setValue(const QString &value)
    00161     { bool b = (bool)value.toInt(); m_checkBox->setChecked(b); slotBoolValue(b); }
    00162   QString getValue()
    00163     { QString s; s.sprintf("%d",(int)m_checkBox->isOn()); return s; }
    00164   QWidget *getWidget() { return m_checkBox; }
    00165
    00166 signals:
    00167   void signalIntValue(int, int);
    00168
    00169 public slots:
    00170   void slotBoolValue(bool val) { emit signalIntValue(m_offset, (int)val); }
    00171
    00172 private:
    00173   QCheckBox* m_checkBox;
    00174 };
    00175
    00176
    00177 class PostFilterHelp : public KDialogBase
    00178 {
    00179   Q_OBJECT
    00180 public:
    00181   PostFilterHelp(QWidget *parent=0, const char *name=0, const char *text=0);
    00182   ~PostFilterHelp();
    00183
    00184 private:
    00185   QTextEdit *m_textEdit;
    00186 };
    00187
    00188
    00189 class PostFilter : public QObject
    00190 {
    00191    Q_OBJECT
    00192 public:
    00193    PostFilter(const QString& name, xine_t* engine, xine_audio_port_t* audioDriver,
    00194               xine_video_port_t* videoDriver, QWidget *parent);
    00195   ~PostFilter();
    00196
    00197   xine_post_in_t* getInput() const;
    00198   xine_post_out_t* getOutput() const;
    00199   void setConfig(const QString &);
    00200   QString getConfig();
    00201
    00202
    00203 signals:
    00204   void signalDeleteMe( PostFilter* me );
    00205
    00206
    00207 private slots:
    00208   void slotDeletePressed() { emit signalDeleteMe(this); }
    00209   void slotApplyIntValue(int offset, int val);
    00210   void slotApplyDoubleValue(int offset, double val);
    00211   void slotApplyCharValue(int offset, const QString& val);
    00212   void slotHelpPressed();
    00213
    00214 private:
    00215   xine_t* m_xineEngine;
    00216   xine_post_t* m_xinePost;
    00217   xine_post_api_t* m_xinePostAPI;
    00218   xine_post_api_descr_t* m_xinePostDescr;
    00219   xine_post_api_parameter_t* m_xinePostParameter;
    00220   char* m_data;
    00221
    00222   QGroupBox* m_groupBox;
    00223   QString m_filterName;
    00224
    00225   QPtrList<PostFilterParameter> m_parameterList;
    00226 };
    00227
    00228 #endif