summaryrefslogtreecommitdiffstats
path: root/kaffeine/src/kaffeine.h
blob: f96ebd803716d21a6d570d79c12b3071d8ce53fe (plain)
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
/*
 * kaffeine.h
 *
 * Copyright (C) 2004-2005 Jürgen Kofler <kaffeine@gmx.net>
 * Copyright (C) 2005-2006 Christophe Thommeret <hftom@free.fr>
 *
 * 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; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 */

#ifndef KAFFEINE_H
#define KAFFEINE_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <tqtimer.h>
#include <tqvbox.h>

#include <kmainwindow.h>
#include <kparts/part.h>

#include "kaffeineiface.h"

class KActionMenu;
class KCmdLineOptions;
class KRecentFilesAction;
class KToggleAction;
class KToggleFullScreenAction;

class CdWidget;
class Disc;
class DvbPanel;
class InputManager;
class KaffeinePart;
class MRL;
class PlayList;
class PlayerContainer;
class StartWindow;
class SystemTray;

extern const KCmdLineOptions cmdLineOptions[];

class Kaffeine : public KMainWindow, private KaffeineIface
{
	Q_OBJECT
  
public:
	Kaffeine();
	virtual ~Kaffeine();

	void updateArgs();

private:
	/**
	 * Use this method to load whatever file/URL you have
	 */
	void load(const TQStringList&);
	void load(const TQString&);
	/**
	  * Load urls from command line into the "NEW" playlist
	  * @returns if any url like "DVD", "VCD" was found
	  */
	bool loadTMP(const TQStringList&);

	void setDevice(const TQString& device)
	{
		m_device = device;
	}

	/*
	 * DCOP functions...
	 */
	void openURL(TQString url);
	void appendURL(TQString url);
	void play();
	void playAudioCD();
	void playVCD();
	void playDVD();
	void pause();
	void stop();
	void next();
	void previous();
	void changePlaylist();
	bool isPlaying();
	bool isVideo();
	TQString title();
	TQString artist();
	TQString album();
	TQString track();
	TQString getFileName();
	void random();
	void fullscreen();
	void minimal();
	int getLength();
	int getTimePos();
	void posPlus();
	void posMinus();
	void volUp();
	void volDown();
	void mute();
	void quit();
	void setNumber( int num );
	void dvbNewTimer( TQString name, TQString channel, TQString datetime, TQString duration );
	int dvbSNR( int device );
	void dvbOSD();
	void dvbOSDNextChannel();
	void dvbOSDPreviousChannel();
	void dvbOSDNextProgram();
	void dvbOSDPreviousProgram();
	void dvbOSDZap();
	void playDvb();

public slots:
	void slotPlay(const MRL&);
	void slotLoadURLS(const TQStringList&);
	void slotSwitchToPlayerWindow();
	void slotChangeStatusbar(const TQString&);
	void slotChangePlaylistStatus(const TQString&);
	void slotStop();
	void slotPlayUnPause();

private:
	void showEvent(TQShowEvent*);
	void hideEvent(TQHideEvent*);

	void closeEvent(TQCloseEvent*);
	//  void dragEnterEvent(TQDragEnterEvent*);
	//  void dropEvent(TQDropEvent*);
	void mouseDoubleClickEvent(TQMouseEvent*);
	void mouseMoveEvent(TQMouseEvent*);
	void mousePressEvent(TQMouseEvent*);
	void resizeEvent(TQResizeEvent*);

private slots:
	void slotOpenFile();
	void slotQuit();
	void optionsConfigureKeys();
	void optionsConfigureToolbars();
	void applyNewToolbarConfig();
	void slotFakeKeyEvent();
	void slotChangeCaption(const TQString&);
	void slotOpenURL();
	void slotOpenDirectory();
	void slotPlaylistPlay();
	void slotNext();
	void slotRequestForCurrentTrack();
	void slotRequestForNextTrack();
	void slotRequestForPreviousTrack();
	void slotRequestForTrackNumber();
	void slotPlayRecent(const KURL&);
	void slotMetaFromPlayer(const MRL &mrl);
	void slotToggleFullscreen();
	void slotEscapeFullscreen();
	void slotToggleMinimalMode();
	void slotToggleMinimalModeFromPlayer();
	void slotTogglePlaylist();
	void slotPreferences();
	void slotOriginalAspect();
	void slotAutoresizeOff();
	void slotAutoresizeOriginal();
	void slotAutoresizeDouble();
	void slotAutoresizeTriple();
	void slotNewFrameSize(const TQSize&);
	void slotCurrentTabChanged(TQWidget*);
	void slotClearRecent();
	void slotLoadPart(const TQString&);
	void slotLoadingCanceled(const TQString&);
	void slotPlaybackFailed();
	void slotSystemTray(bool);
	void slotUseAlternateEncoding(bool);
	void slotAlternateEncoding(const TQString&);
	void slotMute();
	void slotSleepAfterPlay();
	void slotSleepAfterPlayMenu();
	void slotQuitAfterPlay();
	void slotQuitAfterPlayMenu();
	void slotQuitAfterPlaylistMenu();
	void slotSetOSDTimeout(uint);
	void slotPauseVideo(bool);
	void slotDvbClient(bool,const TQString&,int,int,const TQString&);
	void slotNumKeyInput( int );
	void slotDVBNextBack( int );

private:
	void autoresize();
	void setupAccel();
	void setupActions();
	void loadConfig();
	void saveConfig();
	void hideToolbars(bool);
	TQString askForOtherDevice(const TQString&);
	void unloadCurrentPart();

	KaffeinePart* m_mediaPart;

	InputManager *inplug;

	TQHBox *mainbox;
	TQVBox *playerWidget;
	PlayerContainer* m_playerContainer;
	PlayList* m_playlist;
	Disc *cddisc;
#ifdef HAVE_DVB
	DvbPanel *dvbPanel;
#endif
	CdWidget *dvbClient;
	StartWindow *m_startWindow;

	bool m_dvbClientEnabled;
	TQString m_dvbClientAddress;
	int m_dvbClientPort;
	int m_dvbClientInfo;
	TQString m_dvbClientShiftPath;
	SystemTray* m_systemTray;
	TQSize m_videoSize;
	bool m_noResize;
	bool m_embedSystemTray;
	bool m_sleepInfo;
	uint m_osdDuration;
	uint m_autoResizeFactor;

	bool m_useAlternateEncoding;
	TQString m_alternateEncoding;

	bool m_autoPaused;
	bool m_pauseVideo;

	bool m_haveKWin;

	bool haveXTest;
	int fakeKeycode;

	TQString m_currentPartService;

	TQString m_device;
	TQString m_filter;
	TQStringList m_engineParameters;

	KRecentFilesAction* m_recent;
	KToggleFullScreenAction* m_fullscreen;
	KToggleAction* m_minimal;
	KToggleAction* m_autoResizeOff;
	KToggleAction* m_autoResizeOriginal;
	KToggleAction* m_autoResizeDouble;
	KToggleAction* m_autoResizeTriple;
	KToggleAction* m_originalAspect;
	KToggleAction* m_toggleLayout;
	KActionMenu* m_playersMenu;
	KToggleAction* m_sleepAfterPlay;
	KToggleAction* m_quitAfterPlay;
	KToggleAction* m_quitAfterPlaylist;
	bool m_statusBarVisible;

	TQTimer m_screensaverTimer;
	TQTimer m_numKeyHideTimer;
	int m_numKey;
	TQString m_captionCache;

signals:
	void showOSD( const TQString &text, int duration, int priority );

private:
	Kaffeine(const Kaffeine &);
	Kaffeine &operator=(const Kaffeine &);
};

#endif /* KAFFEINE_H */