1 /**
2  * Copyright (C) 2003 Joonas Koivunen <rzei@mbnet.fi>
3  * Copyright (C) 2003 Koos Vriezen <koos.vriezen@xs4all.nl>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB.  If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef _KMPlayerPREF_H_
22 #define _KMPlayerPREF_H_
23 
24 #include "config-kmplayer.h"
25 
26 #include "kmplayer_def.h"
27 
28 #include <kpagedialog.h>
29 #include <qmap.h>
30 
31 #include "kmplayerplaylist.h"
32 
33 class QTabWidget;
34 class QCheckBox;
35 class QComboBox;
36 class QLabel;
37 class QLineEdit;
38 class QRadioButton;
39 class QSlider;
40 class QSpinBox;
41 class QColor;
42 class QButtonGroup;
43 class QListWidget;
44 class KHistoryCombo;
45 class KComboBox;
46 class KUrlRequester;
47 class KColorButton;
48 class KPageWidgetItem;
49 
50 namespace KMPlayer {
51 
52 class PrefGeneralPageGeneral;   // general, general
53 class PrefSourcePageURL;        // source, url
54 class PrefRecordPage;           // recording
55 class RecorderPage;                     // base recorder
56 class PrefMEncoderPage;         // mencoder
57 class PrefMPlayerDumpstreamPage; // mplayer -dumpstream
58 class PrefFFMpegPage;           // ffmpeg
59 class PrefXinePage;             // xine url:record
60 class PrefGeneralPageLooks;     // general, looks
61 class PrefGeneralPageOutput;	// general, output
62 class PrefOPPagePostProc;	// outputplugins, postproc
63 class PartBase;
64 class Source;
65 class Settings;
66 class PreferencesPage;
67 class OutputDriver;
68 class ColorSetting;
69 class FontSetting;
70 
71 class KMPLAYER_NO_EXPORT Preferences : public KPageDialog
72 {
73     Q_OBJECT
74 public:
75 
76     Preferences(PartBase *, Settings *);
77     ~Preferences();
78 
79     PrefGeneralPageGeneral      *m_GeneralPageGeneral;
80     PrefSourcePageURL           *m_SourcePageURL;
81     PrefRecordPage              *m_RecordPage;
82     PrefMEncoderPage            *m_MEncoderPage;
83     PrefMPlayerDumpstreamPage   *m_MPlayerDumpstreamPage;
84 #ifdef KMPLAYER_WITH_XINE
85     PrefXinePage                *m_XinePage;
86 #warning foo
87 #endif
88     PrefFFMpegPage              *m_FFMpegPage;
89     PrefGeneralPageLooks        *m_GeneralPageLooks;
90     PrefGeneralPageOutput       *m_GeneralPageOutput;
91     PrefOPPagePostProc		*m_OPPagePostproc;
92     void setDefaults();
93     void setPage (const char *);
94     void addPrefPage (PreferencesPage *);
95     void removePrefPage (PreferencesPage *);
96 
97     RecorderPage * recorders;
98     QMap<QString, QTabWidget *> entries;
99 public slots:
100     void confirmDefaults();
101 private:
102     KPageWidgetItem *m_record_item;
103     KPageWidgetItem *m_url_item;
104 };
105 
106 class KMPLAYER_NO_EXPORT PrefGeneralPageGeneral : public QWidget
107 {
108     Q_OBJECT
109 public:
110     PrefGeneralPageGeneral(QWidget *parent, Settings *);
~PrefGeneralPageGeneral()111     ~PrefGeneralPageGeneral() {}
112 
113     QCheckBox *keepSizeRatio;
114     QCheckBox * autoResize;
115     QButtonGroup* sizesChoice;
116     QCheckBox *dockSysTray;
117     QCheckBox *loop;
118     QCheckBox *showConfigButton;
119     QCheckBox *showPlaylistButton;
120     QCheckBox *showRecordButton;
121     QCheckBox *showBroadcastButton;
122     QCheckBox *framedrop;
123     QCheckBox *adjustvolume;
124     QCheckBox *adjustcolors;
125 
126     QSpinBox *seekTime;
127 };
128 
129 class KMPLAYER_NO_EXPORT PrefGeneralPageLooks : public QWidget {
130     Q_OBJECT
131 public:
132     PrefGeneralPageLooks (QWidget *parent, Settings *);
~PrefGeneralPageLooks()133     ~PrefGeneralPageLooks () {}
134     QComboBox *colorscombo;
135     KColorButton *colorbutton;
136     QComboBox *fontscombo;
137     QPushButton *fontbutton;
138 public slots:
139     void colorItemChanged (int);
140     void colorCanged (const QColor &);
141     void fontItemChanged (int);
142     void fontClicked ();
143 private:
144     ColorSetting * colors;
145     FontSetting * fonts;
146 };
147 
148 class KMPLAYER_NO_EXPORT PrefSourcePageURL : public QWidget
149 {
150     Q_OBJECT
151 public:
152     PrefSourcePageURL (QWidget *parent);
~PrefSourcePageURL()153     ~PrefSourcePageURL () {}
154 
155     KUrlRequester * url;
156     //KHistoryCombo * url;
157     KComboBox * urllist;
158     KUrlRequester * sub_url;
159     KComboBox * sub_urllist;
160     QListWidget* backend;
161     QCheckBox * clicktoplay;
162     QCheckBox * grabhref;
163     QLineEdit * prefBitRate;
164     QLineEdit * maxBitRate;
165     bool changed;
166 private slots:
167     void slotBrowse ();
168     void slotTextChanged (const QString &);
169 };
170 
171 
172 class KMPLAYER_NO_EXPORT PrefRecordPage : public QWidget
173 {
174     Q_OBJECT
175 public:
176     PrefRecordPage (QWidget *parent, PartBase *, RecorderPage *, int len);
177     ~PrefRecordPage ();
178 
179     KUrlRequester * url;
180     QButtonGroup* recorder;
181     QButtonGroup* replay;
182     QSpinBox* replaytime;
183     QLabel * source;
184 protected:
185     void showEvent (QShowEvent *);
186 public slots:
187     void replayClicked (int id);
188     void recorderClicked (int id);
189 private slots:
190     void slotRecord ();
191     void recording (bool);
192 private:
193     PartBase * m_player;
194     RecorderPage *m_recorders;
195     QPushButton * recordButton;
196     QString source_url;
197     int m_recorders_length;
198 };
199 
200 class KMPLAYER_NO_EXPORT RecorderPage : public QWidget
201 {
202     Q_OBJECT
203 public:
204     RecorderPage (QWidget *parent, PartBase *);
~RecorderPage()205     virtual ~RecorderPage () {}
startRecording()206     virtual void startRecording () {}
207     virtual QString name () = 0;
208     virtual const char * recorderName () = 0;
209     RecorderPage * next;
210 protected:
211     PartBase *m_player;
212 };
213 
214 class KMPLAYER_NO_EXPORT PrefMEncoderPage : public RecorderPage
215 {
216     Q_OBJECT
217 public:
218     PrefMEncoderPage (QWidget *parent, PartBase *);
~PrefMEncoderPage()219     ~PrefMEncoderPage () {}
220 
221     virtual void startRecording ();
222     QString name ();
recorderName()223     const char * recorderName () { return "mencoder"; }
224 
225     QLineEdit * arguments;
226     QButtonGroup* format;
227 public slots:
228     void formatClicked (int id);
229 private:
230 };
231 
232 class KMPLAYER_NO_EXPORT PrefMPlayerDumpstreamPage : public RecorderPage {
233 public:
234     PrefMPlayerDumpstreamPage (QWidget *parent, PartBase *);
~PrefMPlayerDumpstreamPage()235     ~PrefMPlayerDumpstreamPage () {}
236 
237     QString name ();
recorderName()238     const char * recorderName () { return "mplayerdumpstream"; }
239 };
240 
241 #ifdef KMPLAYER_WITH_XINE
242 class KMPLAYER_NO_EXPORT PrefXinePage : public RecorderPage {
243 public:
244     PrefXinePage (QWidget *parent, PartBase *);
~PrefXinePage()245     ~PrefXinePage () {}
246 
247     QString name ();
recorderName()248     const char * recorderName () { return "xine"; }
249 };
250 #endif
251 
252 class KMPLAYER_NO_EXPORT PrefFFMpegPage : public RecorderPage
253 {
254     Q_OBJECT
255 public:
256     PrefFFMpegPage (QWidget *parent, PartBase *);
~PrefFFMpegPage()257     ~PrefFFMpegPage () {}
258 
259     virtual void startRecording ();
260     QString name ();
recorderName()261     const char * recorderName () { return "ffmpeg"; }
262 
263     QLineEdit * arguments;
264     QButtonGroup* format;
265 private:
266 };
267 
268 
269 class KMPLAYER_NO_EXPORT PrefGeneralPageOutput : public QWidget
270 {
271     Q_OBJECT
272 public:
273     PrefGeneralPageOutput (QWidget *parent, OutputDriver * ad, OutputDriver * vd);
~PrefGeneralPageOutput()274     ~PrefGeneralPageOutput() {}
275 
276     QListWidget* videoDriver;
277     QListWidget* audioDriver;
278 };
279 
280 class KMPLAYER_NO_EXPORT PrefOPPagePostProc : public QWidget
281 {
282     Q_OBJECT
283 public:
284     PrefOPPagePostProc(QWidget *parent = 0);
~PrefOPPagePostProc()285     ~PrefOPPagePostProc() {}
286 
287     QCheckBox* postProcessing;
288     QCheckBox* disablePPauto;
289     QTabWidget* PostprocessingOptions;
290 
291     QRadioButton* defaultPreset;
292     QRadioButton* customPreset;
293     QRadioButton* fastPreset;
294 
295     QCheckBox* HzDeblockFilter;
296     QCheckBox* VtDeblockFilter;
297     QCheckBox* DeringFilter;
298     QCheckBox* HzDeblockAQuality;
299     QCheckBox* VtDeblockAQuality;
300     QCheckBox* DeringAQuality;
301 
302     QCheckBox* AutolevelsFilter;
303     QCheckBox* AutolevelsFullrange;
304     QCheckBox* HzDeblockCFiltering;
305     QCheckBox* VtDeblockCFiltering;
306     QCheckBox* DeringCFiltering;
307     QCheckBox* TmpNoiseFilter;
308     QSlider* TmpNoiseSlider;
309 
310     QCheckBox* LinBlendDeinterlacer;
311     QCheckBox* CubicIntDeinterlacer;
312     QCheckBox* LinIntDeinterlacer;
313     QCheckBox* MedianDeinterlacer;
314     QCheckBox* FfmpegDeinterlacer;
315 };
316 
317 } // namespace
318 
319 #endif // _KMPlayerPREF_H_
320