summaryrefslogtreecommitdiffstats
path: root/kicker-applets/mediacontrol/mediacontrol.h
blob: ab1cec52acdeade9d22776a4207c50e9334bc53d (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
/***************************************************************************
                         main file of mediacontrol applet
                             -------------------
    begin                : Tue Apr 25 11:53:11 CEST 2000
    copyright            : (C) 2000-2005 by Stefan Gehn
    email                : metz {AT} gehn {DOT} net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef MEDIACONTROL_H
#define MEDIACONTROL_H

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

#include <klocale.h>
#include <kpanelapplet.h>
#include <kdebug.h>
#include <kstandarddirs.h>
#include <kaboutdata.h>
#include <kaboutapplication.h>

#include <palette.h>

// used everywhere :)
#include <tqstring.h>

#include "playerInterface.h"
#include "configfrontend.h"
#include "mediacontroliface.h"
#include "simplebutton.h"

#define MEDIACONTROL_VERSION "0.4"

class MCSlider;
class KPopupMenu;
class KInstance;
class MediaControlConfig;
class KAboutData;
class MediaControlToolTip;

// =============================================================================

class TrayButton : public SimpleButton
{
	Q_OBJECT
  TQ_OBJECT

	public:
		TrayButton(TQWidget* parent, const char* name);
		virtual ~TrayButton() {}
		void setIconSet(const TQIconSet &iconSet);
};

// =============================================================================

class MediaControl : public KPanelApplet, virtual public MediaControlIface
{
	Q_OBJECT
  TQ_OBJECT

	public:
		MediaControl(const TQString&, Type, int ,TQWidget * = 0, const char * = 0);
		virtual ~MediaControl();

		int widthForHeight(int height) const;
		int heightForWidth(int width) const;
		void dragEnterEvent(TQDragEnterEvent* event);
		void dropEvent(TQDropEvent* event);
		virtual void reparseConfig();

	public slots:
		void about();
		void preferences();
		void reportBug();

	private:
		KInstance *mInstance;
		KAboutData *mAboutData;
		DCOPClient *_dcopClient;
		PlayerInterface *_player;
		ConfigFrontend *_configFrontend;
		MediaControlConfig *_prefsDialog;
		TrayButton *prev_button;  // GoTo Previous Playlist-Item
		TrayButton *playpause_button;  // Start/Pause playing
		TrayButton *stop_button;  // Stop the music
		TrayButton *next_button;  // GoTo Next Playlist-Item
		MCSlider *time_slider;
		int mLastLen, mLastTime, mLastStatus;
		KPopupMenu *rmbMenu;

		virtual void mousePressEvent(TQMouseEvent* e);
		virtual void moveEvent(TQMoveEvent*);
		virtual void paletteChange(const TQPalette&);
		virtual void resizeEvent(TQResizeEvent*);
		virtual bool eventFilter(TQObject *watched, TQEvent *e);

		friend class MediaControlToolTip;
		MediaControlToolTip *slider_tooltip;

	private slots:
		void setSliderPosition(int len, int time);
		void slotIconChanged();
		void disableAll();
		void enableAll();
		void slotClosePrefsDialog();
		void slotPrefsDialogClosing();
		void slotConfigChanged();
		void adjustTime(int);
		void slotPlayingStatusChanged(int status);

	signals:
		void newJumpToTime(int);
};
#endif