1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
|
/* This file is part of the KMPlayer application
Copyright (C) 2003 Koos Vriezen <[email protected]>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _KMPLAYER_TV_SOURCE_H_
#define _KMPLAYER_TV_SOURCE_H_
#include <qguardedptr.h>
#include <qstring.h>
#include <qframe.h>
#include "kmplayerappsource.h"
#include "kmplayerconfig.h"
#include "kmplayer.h"
const short id_node_tv_document = 40;
const short id_node_tv_device = 41;
const short id_node_tv_input = 42;
const short id_node_tv_channel = 43;
class KMPlayerPrefSourcePageTV; // source, TV
class TVDeviceScannerSource;
class KMPlayerTVSource;
class KURLRequester;
class KHistoryCombo;
class KMPlayerApp;
class QTabWidget;
class QGroupBox;
class QLineEdit;
class QCheckBox;
class KComboBox;
class KConfig;
class KMPLAYER_NO_EXPORT TVDevicePage : public QFrame {
Q_OBJECT
public:
TVDevicePage (QWidget *parent, KMPlayer::NodePtr dev);
KDE_NO_CDTOR_EXPORT ~TVDevicePage () {}
QLineEdit * name;
KURLRequester * audiodevice;
QLineEdit * sizewidth;
QLineEdit * sizeheight;
QCheckBox * noplayback;
QTabWidget * inputsTab;
KMPlayer::NodePtrW device_doc;
signals:
void deleted (TVDevicePage *);
private slots:
void slotDelete ();
};
class KMPLAYER_NO_EXPORT KMPlayerPrefSourcePageTV : public QFrame {
Q_OBJECT
public:
KMPlayerPrefSourcePageTV (QWidget *parent, KMPlayerTVSource *);
KDE_NO_CDTOR_EXPORT ~KMPlayerPrefSourcePageTV () {}
QLineEdit * driver;
KURLRequester * device;
QPushButton * scan;
QTabWidget * notebook;
protected:
void showEvent (QShowEvent *);
KMPlayerTVSource * m_tvsource;
};
class KMPLAYER_NO_EXPORT TVNode : public KMPlayer::GenericMrl {
public:
TVNode (KMPlayer::NodePtr &d, const QString &s, const char * t, short id, const QString &n=QString ());
virtual void setNodeName (const QString &);
};
/*
* Element for channels
*/
class KMPLAYER_NO_EXPORT TVChannel : public TVNode {
public:
TVChannel (KMPlayer::NodePtr & d, const QString & n, double f);
TVChannel (KMPlayer::NodePtr & d);
KDE_NO_CDTOR_EXPORT ~TVChannel () {}
void closed ();
};
/*
* Element for inputs
*/
class KMPLAYER_NO_EXPORT TVInput : public TVNode {
public:
TVInput (KMPlayer::NodePtr & d, const QString & n, int id);
TVInput (KMPlayer::NodePtr & d);
KDE_NO_CDTOR_EXPORT ~TVInput () {}
KMPlayer::NodePtr childFromTag (const QString &);
void setNodeName (const QString &);
void closed ();
};
/*
* Element for TV devices
*/
class KMPLAYER_NO_EXPORT TVDevice : public TVNode {
public:
TVDevice (KMPlayer::NodePtr & d, const QString & s);
TVDevice (KMPlayer::NodePtr & d);
~TVDevice ();
KMPlayer::NodePtr childFromTag (const QString &);
void closed ();
void childDone (KMPlayer::NodePtr child);
void setNodeName (const QString &);
bool expose () const { return false; }
void updateNodeName ();
void updateDevicePage ();
bool zombie;
QGuardedPtr <TVDevicePage> device_page;
};
class KMPLAYER_NO_EXPORT TVDocument : public FileDocument {
KMPlayerTVSource * m_source;
public:
TVDocument (KMPlayerTVSource *);
KMPlayer::NodePtr childFromTag (const QString &);
void defer ();
KDE_NO_EXPORT const char * nodeName () const { return "tvdevices"; }
void childDone (KMPlayer::NodePtr child);
};
/*
* Source form scanning TV devices
*/
class KMPLAYER_NO_EXPORT TVDeviceScannerSource : public KMPlayer::Source {
Q_OBJECT
public:
TVDeviceScannerSource (KMPlayerTVSource * src);
KDE_NO_CDTOR_EXPORT ~TVDeviceScannerSource () {};
virtual void init ();
virtual bool processOutput (const QString & line);
virtual QString filterOptions ();
virtual bool hasLength ();
virtual bool isSeekable ();
virtual bool scan (const QString & device, const QString & driver);
public slots:
virtual void activate ();
virtual void deactivate ();
virtual void play ();
virtual void stateChange (KMPlayer::Process *, KMPlayer::Process::State os, KMPlayer::Process::State ns);
signals:
void scanFinished (TVDevice * tvdevice);
private:
KMPlayerTVSource * m_tvsource;
TVDevice * m_tvdevice;
KMPlayer::Source * m_old_source;
QString m_driver;
QRegExp m_nameRegExp;
QRegExp m_sizesRegExp;
QRegExp m_inputRegExp;
};
/*
* Source form TV devices, also implementing preference page for it
*/
class KMPLAYER_NO_EXPORT KMPlayerTVSource : public KMPlayerMenuSource, public KMPlayer::PreferencesPage {
Q_OBJECT
public:
KMPlayerTVSource (KMPlayerApp * app, QPopupMenu * m);
virtual ~KMPlayerTVSource ();
virtual QString filterOptions ();
virtual bool hasLength ();
virtual bool isSeekable ();
virtual KMPlayer::NodePtr root ();
void buildMenu ();
virtual QString prettyName ();
virtual void write (KConfig *);
virtual void read (KConfig *);
virtual void sync (bool);
virtual void prefLocation (QString & item, QString & icon, QString & tab);
virtual QFrame * prefPage (QWidget * parent);
void readXML ();
public slots:
virtual void activate ();
virtual void deactivate ();
virtual void playCurrent ();
virtual void jump (KMPlayer::NodePtr e);
void menuAboutToShow ();
void menuClicked (int id);
private slots:
void slotScan ();
void slotScanFinished (TVDevice * device);
void slotDeviceDeleted (TVDevicePage *);
private:
void addTVDevicePage (TVDevice * dev, bool show=false);
void buildArguments ();
KMPlayer::NodePtrW m_cur_tvdevice;
KMPlayer::NodePtrW m_cur_tvinput;
QPopupMenu * m_channelmenu;
QString tvdriver;
KMPlayerPrefSourcePageTV * m_configpage;
TVDeviceScannerSource * scanner;
int tree_id;
bool config_read; // whether tv.xml is read
};
#endif //_KMPLAYER_TV_SOURCE_H_
|