summaryrefslogtreecommitdiffstats
path: root/plugins/gui-docking-menu/docking.h
blob: 404abd964652b7a834852c35106ff7e8a1ae7d23 (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
/***************************************************************************
                          docking.h  -  description
                             -------------------
    begin                : Mon Jan 14 2002
    copyright            : (C) 2001, 2002 by Frank Schwanz, Ernst Martin Witte
    email                : [email protected], [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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef KRADIO_DOCKING_H
#define KRADIO_DOCKING_H

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

#include <ksystemtray.h>
#include <tqpixmap.h>
#include <tqptrdict.h>

#include "../../src/include/timecontrol_interfaces.h"
#include "../../src/include/radio_interfaces.h"
#include "../../src/include/radiodevicepool_interfaces.h"
#include "../../src/include/stationselection_interfaces.h"
#include "../../src/include/plugins.h"
#include "../../src/include/soundstreamclient_interfaces.h"

enum LeftClickAction { lcaShowHide = 0, lcaPowerOnOff = 1 };

class RadioDocking : public KSystemTray,
                     public PluginBase,
                     public IRadioClient,
                     public ITimeControlClient,
                     public IRadioDevicePoolClient,
                     public IStationSelection,
                     public ISoundStreamClient
{
TQ_OBJECT
  
public:
    RadioDocking (const TQString &name);
    virtual ~RadioDocking();

    virtual bool connectI (Interface *);
    virtual bool disconnectI (Interface *);

    virtual TQString pluginClassName() const { return "RadioDocking"; }

    virtual const TQString &name() const { return PluginBase::name(); }
    virtual       TQString &name()       { return PluginBase::name(); }


    // PluginBase

public:
    virtual void   saveState (TDEConfig *) const;
    virtual void   restoreState (TDEConfig *);

    virtual ConfigPageInfo  createConfigurationPage();
    virtual AboutPageInfo   createAboutPage();


    // IStationSelection

RECEIVERS:
    bool setStationSelection(const TQStringList &sl);

ANSWERS:
    const TQStringList & getStationSelection () const { return m_stationIDs; }


    // IRadioDevicePoolClient

RECEIVERS:
    bool noticeActiveDeviceChanged(IRadioDevice *)  { return false; }
    bool noticeDevicesChanged(const TQPtrList<IRadioDevice> &)  { return false; }
    bool noticeDeviceDescriptionChanged(const TQString &) { return false; }

    // ITimeControlClient

RECEIVERS:
    bool noticeAlarmsChanged(const AlarmVector &)   { return false; }
    bool noticeAlarm(const Alarm &)                 { return false; }
    bool noticeNextAlarmChanged(const Alarm *);
    bool noticeCountdownStarted(const TQDateTime &/*end*/);
    bool noticeCountdownStopped();
    bool noticeCountdownZero();
    bool noticeCountdownSecondsChanged(int n);


    // IRadioClient

RECEIVERS:
    bool noticePowerChanged(bool on);
    bool noticeStationChanged (const RadioStation &, int idx);
    bool noticeStationsChanged(const StationList &sl);
    bool noticePresetFileChanged(const TQString &/*f*/)           { return false; }

    bool noticeCurrentSoundStreamIDChanged(SoundStreamID /*id*/) { return false; }

    // ISoundStreamClient

RECEIVERS:
    void noticeConnectedI (ISoundStreamServer *s, bool pointer_valid);

    bool startRecordingWithFormat(SoundStreamID /*id*/,
                      const SoundFormat &/*proposed_format*/,
                      SoundFormat       &/*real_format*/);
    bool stopRecording(SoundStreamID /*id*/);

    bool noticeSoundStreamChanged(SoundStreamID id);


protected slots:

    void slotSeekFwd();
    void slotSeekBkwd();

    void slotPower();
    void slotPause();
    void slotSleepCountdown();
    void slotShowAbout();

    void slotMenuItemActivated(int id);
    void slotRecordingMenu(int i);

protected:
    void mousePressEvent( TQMouseEvent *e );

    void buildContextMenu();
    void buildRecordingMenu();
    void buildStationList();

    void noticeWidgetPluginShown(WidgetPluginBase *, bool shown);
    void noticePluginsChanged(const PluginList &);

    void showEvent(TQShowEvent *) {}  // do nothing, original implementation adds "Quit" menu item

    void ShowHideWidgetPlugins();

    void dragEnterEvent(TQDragEnterEvent* event);
    void dropEvent(TQDropEvent* event);

public:

    LeftClickAction getLeftClickAction() const { return m_leftClickAction; }
    void            setLeftClickAction(LeftClickAction action);

signals:
    void sigLeftClickActionChanged(LeftClickAction action);

protected:

    TDEPopupMenu  *m_menu;
    TDEPopupMenu  *m_pluginMenu;
    TDEPopupMenu  *m_recordingMenu;
    TQStringList  m_stationIDs;

    // menu Item IDs
    int             m_titleID;
    int             m_alarmID;
    int             m_recordingID;
    int             m_powerID;
    int             m_pauseID;
    int             m_sleepID;
    int             m_seekfwID;
    int             m_seekbwID;
    TQValueList<int> m_stationMenuIDs;

    TQMap<WidgetPluginBase *, int>  m_widgetPluginIDs;

    int                            m_NextRecordingMenuID;
    TQMap<int, SoundStreamID>       m_MenuID2StreamID;
    TQMap<SoundStreamID, int>       m_StreamID2MenuID;

    LeftClickAction                m_leftClickAction;

    TQMap<TQString, bool>            m_widgetsShownCache;
};


#endif