File indexing completed on 2024-04-14 04:49:09

0001 /*
0002     SPDX-FileCopyrightText: 2003 Joonas Koivunen <rzei@mbnet.fi>
0003     SPDX-FileCopyrightText: 2003 Koos Vriezen <koos.vriezen@xs4all.nl>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef _KMPlayerPREF_H_
0009 #define _KMPlayerPREF_H_
0010 
0011 #include "config-kmplayer.h"
0012 
0013 #include <KPageDialog>
0014 #include <QMap>
0015 
0016 #include "kmplayerplaylist.h"
0017 
0018 class QTabWidget;
0019 class QCheckBox;
0020 class QComboBox;
0021 class QLabel;
0022 class QLineEdit;
0023 class QRadioButton;
0024 class QSlider;
0025 class QSpinBox;
0026 class QColor;
0027 class QButtonGroup;
0028 class QListWidget;
0029 class KHistoryCombo;
0030 class KComboBox;
0031 class KUrlRequester;
0032 class KColorButton;
0033 class KPageWidgetItem;
0034 
0035 namespace KMPlayer {
0036 
0037 class PrefGeneralPageGeneral;   // general, general
0038 class PrefSourcePageURL;        // source, url
0039 class PrefRecordPage;           // recording
0040 class RecorderPage;                     // base recorder
0041 class PrefMEncoderPage;         // mencoder
0042 class PrefMPlayerDumpstreamPage; // mplayer -dumpstream
0043 class PrefFFMpegPage;           // ffmpeg
0044 class PrefXinePage;             // xine url:record
0045 class PrefGeneralPageLooks;     // general, looks
0046 class PrefGeneralPageOutput;    // general, output
0047 class PrefOPPagePostProc;   // outputplugins, postproc
0048 class PartBase;
0049 class Source;
0050 class Settings;
0051 class PreferencesPage;
0052 class OutputDriver;
0053 class ColorSetting;
0054 class FontSetting;
0055 
0056 class Preferences : public KPageDialog
0057 {
0058     Q_OBJECT
0059 public:
0060 
0061     Preferences(PartBase *, Settings *);
0062     ~Preferences() override;
0063 
0064     PrefGeneralPageGeneral      *m_GeneralPageGeneral;
0065     PrefSourcePageURL           *m_SourcePageURL;
0066     PrefRecordPage              *m_RecordPage;
0067     PrefMEncoderPage            *m_MEncoderPage;
0068     PrefMPlayerDumpstreamPage   *m_MPlayerDumpstreamPage;
0069 #ifdef KMPLAYER_WITH_XINE
0070     PrefXinePage                *m_XinePage;
0071 #warning foo
0072 #endif
0073     PrefFFMpegPage              *m_FFMpegPage;
0074     PrefGeneralPageLooks        *m_GeneralPageLooks;
0075     PrefGeneralPageOutput       *m_GeneralPageOutput;
0076     PrefOPPagePostProc      *m_OPPagePostproc;
0077     void setDefaults();
0078     void setPage (const char *);
0079     void addPrefPage (PreferencesPage *);
0080     void removePrefPage (PreferencesPage *);
0081 
0082     RecorderPage * recorders;
0083     QMap<QString, QTabWidget *> entries;
0084 public Q_SLOTS:
0085     void confirmDefaults();
0086 private:
0087     KPageWidgetItem *m_record_item;
0088     KPageWidgetItem *m_url_item;
0089 };
0090 
0091 class PrefGeneralPageGeneral : public QWidget
0092 {
0093     Q_OBJECT
0094 public:
0095     PrefGeneralPageGeneral(QWidget *parent, Settings *);
0096     ~PrefGeneralPageGeneral() override {}
0097 
0098     QCheckBox *keepSizeRatio;
0099     QCheckBox * autoResize;
0100     QButtonGroup* sizesChoice;
0101     QCheckBox *dockSysTray;
0102     QCheckBox *loop;
0103     QCheckBox *showConfigButton;
0104     QCheckBox *showPlaylistButton;
0105     QCheckBox *showRecordButton;
0106     QCheckBox *showBroadcastButton;
0107     QCheckBox *framedrop;
0108     QCheckBox *adjustvolume;
0109     QCheckBox *adjustcolors;
0110 
0111     QSpinBox *seekTime;
0112 };
0113 
0114 class PrefGeneralPageLooks : public QWidget {
0115     Q_OBJECT
0116 public:
0117     PrefGeneralPageLooks (QWidget *parent, Settings *);
0118     ~PrefGeneralPageLooks () override {}
0119     QComboBox *colorscombo;
0120     KColorButton *colorbutton;
0121     QComboBox *fontscombo;
0122     QPushButton *fontbutton;
0123 public Q_SLOTS:
0124     void colorItemChanged (int);
0125     void colorCanged (const QColor &);
0126     void fontItemChanged (int);
0127     void fontClicked ();
0128 private:
0129     ColorSetting * colors;
0130     FontSetting * fonts;
0131 };
0132 
0133 class PrefSourcePageURL : public QWidget
0134 {
0135     Q_OBJECT
0136 public:
0137     PrefSourcePageURL (QWidget *parent);
0138     ~PrefSourcePageURL () override {}
0139 
0140     KUrlRequester * url;
0141     //KHistoryCombo * url;
0142     KComboBox * urllist;
0143     KUrlRequester * sub_url;
0144     KComboBox * sub_urllist;
0145     QListWidget* backend;
0146     QCheckBox * clicktoplay;
0147     QCheckBox * grabhref;
0148     QLineEdit * prefBitRate;
0149     QLineEdit * maxBitRate;
0150     bool changed;
0151 private Q_SLOTS:
0152     void slotBrowse ();
0153     void slotTextChanged (const QString &);
0154 };
0155 
0156 
0157 class PrefRecordPage : public QWidget
0158 {
0159     Q_OBJECT
0160 public:
0161     PrefRecordPage (QWidget *parent, PartBase *, RecorderPage *, int len);
0162     ~PrefRecordPage () override;
0163 
0164     KUrlRequester * url;
0165     QButtonGroup* recorder;
0166     QButtonGroup* replay;
0167     QSpinBox* replaytime;
0168     QLabel * source;
0169 protected:
0170     void showEvent (QShowEvent *) override;
0171 public Q_SLOTS:
0172     void replayClicked (int id);
0173     void recorderClicked (int id);
0174 private Q_SLOTS:
0175     void slotRecord ();
0176     void recording (bool);
0177 private:
0178     PartBase * m_player;
0179     RecorderPage *m_recorders;
0180     QPushButton * recordButton;
0181     QString source_url;
0182     int m_recorders_length;
0183 };
0184 
0185 class RecorderPage : public QWidget
0186 {
0187     Q_OBJECT
0188 public:
0189     RecorderPage (QWidget *parent, PartBase *);
0190     ~RecorderPage () override {}
0191     virtual void startRecording () {}
0192     virtual QString name () = 0;
0193     virtual const char * recorderName () = 0;
0194     RecorderPage * next;
0195 protected:
0196     PartBase *m_player;
0197 };
0198 
0199 class PrefMEncoderPage : public RecorderPage
0200 {
0201     Q_OBJECT
0202 public:
0203     PrefMEncoderPage (QWidget *parent, PartBase *);
0204     ~PrefMEncoderPage () override {}
0205 
0206     void startRecording () override;
0207     QString name () override;
0208     const char * recorderName () override { return "mencoder"; }
0209 
0210     QLineEdit * arguments;
0211     QButtonGroup* format;
0212 public Q_SLOTS:
0213     void formatClicked (int id);
0214 private:
0215 };
0216 
0217 class PrefMPlayerDumpstreamPage : public RecorderPage {
0218 public:
0219     PrefMPlayerDumpstreamPage (QWidget *parent, PartBase *);
0220     ~PrefMPlayerDumpstreamPage () override {}
0221 
0222     QString name () override;
0223     const char * recorderName () override { return "mplayerdumpstream"; }
0224 };
0225 
0226 #ifdef KMPLAYER_WITH_XINE
0227 class PrefXinePage : public RecorderPage {
0228 public:
0229     PrefXinePage (QWidget *parent, PartBase *);
0230     ~PrefXinePage () {}
0231 
0232     QString name ();
0233     const char * recorderName () { return "xine"; }
0234 };
0235 #endif
0236 
0237 class PrefFFMpegPage : public RecorderPage
0238 {
0239     Q_OBJECT
0240 public:
0241     PrefFFMpegPage (QWidget *parent, PartBase *);
0242     ~PrefFFMpegPage () override {}
0243 
0244     void startRecording () override;
0245     QString name () override;
0246     const char * recorderName () override { return "ffmpeg"; }
0247 
0248     QLineEdit * arguments;
0249     QButtonGroup* format;
0250 private:
0251 };
0252 
0253 
0254 class PrefGeneralPageOutput : public QWidget
0255 {
0256     Q_OBJECT
0257 public:
0258     PrefGeneralPageOutput (QWidget *parent, OutputDriver * ad, OutputDriver * vd);
0259     ~PrefGeneralPageOutput() override {}
0260 
0261     QListWidget* videoDriver;
0262     QListWidget* audioDriver;
0263 };
0264 
0265 class PrefOPPagePostProc : public QWidget
0266 {
0267     Q_OBJECT
0268 public:
0269     PrefOPPagePostProc(QWidget *parent = nullptr);
0270     ~PrefOPPagePostProc() override {}
0271 
0272     QCheckBox* postProcessing;
0273     QCheckBox* disablePPauto;
0274     QTabWidget* PostprocessingOptions;
0275 
0276     QRadioButton* defaultPreset;
0277     QRadioButton* customPreset;
0278     QRadioButton* fastPreset;
0279 
0280     QCheckBox* HzDeblockFilter;
0281     QCheckBox* VtDeblockFilter;
0282     QCheckBox* DeringFilter;
0283     QCheckBox* HzDeblockAQuality;
0284     QCheckBox* VtDeblockAQuality;
0285     QCheckBox* DeringAQuality;
0286 
0287     QCheckBox* AutolevelsFilter;
0288     QCheckBox* AutolevelsFullrange;
0289     QCheckBox* HzDeblockCFiltering;
0290     QCheckBox* VtDeblockCFiltering;
0291     QCheckBox* DeringCFiltering;
0292     QCheckBox* TmpNoiseFilter;
0293     QSlider* TmpNoiseSlider;
0294 
0295     QCheckBox* LinBlendDeinterlacer;
0296     QCheckBox* CubicIntDeinterlacer;
0297     QCheckBox* LinIntDeinterlacer;
0298     QCheckBox* MedianDeinterlacer;
0299     QCheckBox* FfmpegDeinterlacer;
0300 };
0301 
0302 } // namespace
0303 
0304 #endif // _KMPlayerPREF_H_