~ubuntu-branches/ubuntu/utopic/kradio/utopic

« back to all changes in this revision

Viewing changes to kradio3/src/radiodevice_interfaces.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Marc 'HE' Brockschmidt
  • Date: 2008-03-16 19:00:02 UTC
  • mfrom: (3.1.2 gutsy)
  • Revision ID: james.westby@ubuntu.com-20080316190002-sdjqu8cahhx7c6tk
Tags: 0.1.1.1~20061112-3.1
* Non-maintainer upload.
* Fix gcc-4.3 FTBFS, patch by Kibi (Closes: #455390)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                          radiodevice_interfaces.cpp  -  description
 
3
                             -------------------
 
4
    begin                : Sam Apr 19 2003
 
5
    copyright            : (C) 2003 by Martin Witte
 
6
    email                : witte@kawo1.rwth-aachen.de
 
7
 ***************************************************************************/
 
8
 
 
9
/***************************************************************************
 
10
 *                                                                         *
 
11
 *   This program is free software; you can redistribute it and/or modify  *
 
12
 *   it under the terms of the GNU General Public License as published by  *
 
13
 *   the Free Software Foundation; either version 2 of the License, or     *
 
14
 *   (at your option) any later version.                                   *
 
15
 *                                                                         *
 
16
 ***************************************************************************/
 
17
 
 
18
 
 
19
#include "include/radiodevice_interfaces.h"
 
20
#include "include/radiostation.h"
 
21
 
 
22
#include <kurl.h>
 
23
 
 
24
// IRadioDevice
 
25
 
 
26
IF_IMPL_SENDER  (  IRadioDevice::notifyPowerChanged(bool on),
 
27
                   noticePowerChanged(on, this)                                );
 
28
IF_IMPL_SENDER  (  IRadioDevice::notifyStationChanged (const RadioStation &s),
 
29
                   noticeStationChanged (s, this)                              );
 
30
IF_IMPL_SENDER  (  IRadioDevice::notifyDescriptionChanged (const QString&s),
 
31
                   noticeDescriptionChanged (s, this)                          );
 
32
IF_IMPL_SENDER  (  IRadioDevice::notifyCurrentSoundStreamIDChanged(SoundStreamID id),
 
33
                   noticeCurrentSoundStreamIDChanged(id, this)                 );
 
34
 
 
35
// IRadioDeviceClient
 
36
 
 
37
IF_IMPL_SENDER  (  IRadioDeviceClient::sendPower(bool on),
 
38
                   setPower(on)                                   );
 
39
IF_IMPL_SENDER  (  IRadioDeviceClient::sendPowerOn(),
 
40
                   powerOn()                                      );
 
41
IF_IMPL_SENDER  (  IRadioDeviceClient::sendPowerOff(),
 
42
                   powerOff()                                     );
 
43
IF_IMPL_SENDER  (  IRadioDeviceClient::sendActivateStation(const RadioStation &rs),
 
44
                   activateStation(rs)                            );
 
45
 
 
46
IF_IMPL_QUERY   (  bool IRadioDeviceClient::queryIsPowerOn(),
 
47
                   isPowerOn(),
 
48
                   false                     );
 
49
IF_IMPL_QUERY   (  bool IRadioDeviceClient::queryIsPowerOff(),
 
50
                   isPowerOff(),
 
51
                   true                      );
 
52
IF_IMPL_QUERY   (  const RadioStation  &  IRadioDeviceClient::queryCurrentStation(),
 
53
                   getCurrentStation(),
 
54
                   undefinedRadioStation     );
 
55
 
 
56
static QString IRadioDeviceClient_unknown("unknown");
 
57
IF_IMPL_QUERY   (  const QString       &  IRadioDeviceClient::queryDescription(),
 
58
                   getDescription(),
 
59
                   IRadioDeviceClient_unknown                   );
 
60
 
 
61
IF_IMPL_QUERY   (  SoundStreamID IRadioDeviceClient::queryCurrentSoundStreamID(),
 
62
                   getCurrentSoundStreamID(),
 
63
                   SoundStreamID::InvalidID  );
 
64
 
 
65
void IRadioDeviceClient::noticeConnectedI    (cmplInterface *c, bool pointer_valid)
 
66
{
 
67
    noticePowerChanged(queryIsPowerOn());
 
68
    noticeStationChanged(queryCurrentStation(), pointer_valid ? c : NULL);
 
69
    noticeDescriptionChanged(queryDescription(), pointer_valid ? c : NULL);
 
70
}
 
71
 
 
72
void IRadioDeviceClient::noticeDisconnectedI    (cmplInterface *c, bool pointer_valid)
 
73
{
 
74
    noticePowerChanged(queryIsPowerOn());
 
75
    noticeStationChanged(queryCurrentStation(), pointer_valid ? c : NULL);
 
76
    noticeDescriptionChanged(queryDescription(), pointer_valid ? c : NULL);
 
77
}
 
78
 
 
79
 
 
80
 
 
81
 
 
82
/* Deprecated
 
83
// IRadioSound
 
84
 
 
85
IF_IMPL_SENDER  (  IRadioSound::notifyVolumeChanged(float v),
 
86
                   noticeVolumeChanged(v)                   )
 
87
IF_IMPL_SENDER  (  IRadioSound::notifyTrebleChanged(float v),
 
88
                   noticeTrebleChanged(v)                   )
 
89
IF_IMPL_SENDER  (  IRadioSound::notifyBassChanged(float v),
 
90
                   noticeBassChanged(v)                     )
 
91
IF_IMPL_SENDER  (  IRadioSound::notifyBalanceChanged(float v),
 
92
                   noticeBalanceChanged(v)                  )
 
93
IF_IMPL_SENDER  (  IRadioSound::notifySignalQualityChanged(float q),
 
94
                   noticeSignalQualityChanged(q)            )
 
95
IF_IMPL_SENDER  (  IRadioSound::notifySignalQualityBoolChanged(bool good),
 
96
                   noticeSignalQualityChanged(good)         )
 
97
IF_IMPL_SENDER  (  IRadioSound::notifySignalMinQualityChanged(float q),
 
98
                   noticeSignalMinQualityChanged(q)         )
 
99
IF_IMPL_SENDER  (  IRadioSound::notifyStereoChanged(bool  s),
 
100
                   noticeStereoChanged(s)                   )
 
101
IF_IMPL_SENDER  (  IRadioSound::notifyMuted(bool m),
 
102
                   noticeMuted(m)                           )
 
103
 
 
104
// IRadioSoundClient
 
105
 
 
106
IF_IMPL_SENDER  (  IRadioSoundClient::sendVolume (float v),
 
107
                   setVolume (v)                            )
 
108
IF_IMPL_SENDER  (  IRadioSoundClient::sendTreble (float v),
 
109
                   setTreble (v)                            )
 
110
IF_IMPL_SENDER  (  IRadioSoundClient::sendBass (float v),
 
111
                   setBass (v)                              )
 
112
IF_IMPL_SENDER  (  IRadioSoundClient::sendBalance (float v),
 
113
                   setBalance (v)                           )
 
114
IF_IMPL_SENDER  (  IRadioSoundClient::sendMute (bool mute),
 
115
                   mute (mute)                              )
 
116
IF_IMPL_SENDER  (  IRadioSoundClient::sendUnmute (bool unmute),
 
117
                   unmute (unmute)                          )
 
118
IF_IMPL_SENDER  (  IRadioSoundClient::sendSignalMinQuality (float q),
 
119
                   setSignalMinQuality (q)                  )
 
120
IF_IMPL_SENDER  (  IRadioSoundClient::sendStereo(bool s),
 
121
                   setStereo(s)                             )
 
122
 
 
123
IF_IMPL_QUERY   (  float  IRadioSoundClient::queryVolume(),
 
124
                   getVolume(),
 
125
                   0.0            )
 
126
IF_IMPL_QUERY   (  float  IRadioSoundClient::queryTreble(),
 
127
                   getTreble(),
 
128
                   0.0            )
 
129
IF_IMPL_QUERY   (  float  IRadioSoundClient::queryBass(),
 
130
                   getBass(),
 
131
                   0.0            )
 
132
IF_IMPL_QUERY   (  float  IRadioSoundClient::queryBalance(),
 
133
                   getBalance(),
 
134
                   0.0            )
 
135
IF_IMPL_QUERY   (  float  IRadioSoundClient::querySignalQuality(),
 
136
                   getSignalQuality(),
 
137
                   0.0      )
 
138
IF_IMPL_QUERY   (  float  IRadioSoundClient::querySignalMinQuality(),
 
139
                   getSignalMinQuality(),
 
140
                   0.75     )
 
141
IF_IMPL_QUERY   (  bool   IRadioSoundClient::queryHasGoodQuality(),
 
142
                   hasGoodQuality(),
 
143
                   false              )
 
144
IF_IMPL_QUERY   (  bool   IRadioSoundClient::queryIsStereo(),
 
145
                   isStereo(),
 
146
                   false              )
 
147
IF_IMPL_QUERY   (  bool   IRadioSoundClient::queryIsMuted(),
 
148
                   isMuted(),
 
149
                   true               )
 
150
 
 
151
 
 
152
void IRadioSoundClient::noticeConnectedI    (cmplInterface *, bool pointer_valid)
 
153
{
 
154
    noticeVolumeChanged          (queryVolume());
 
155
    noticeTrebleChanged          (queryTreble());
 
156
    noticeBassChanged            (queryBass());
 
157
    noticeBalanceChanged         (queryBalance());
 
158
    noticeSignalQualityChanged   (querySignalQuality());
 
159
    noticeSignalQualityChanged   (queryHasGoodQuality());
 
160
    noticeSignalMinQualityChanged(querySignalMinQuality());
 
161
    noticeStereoChanged          (queryIsStereo());
 
162
    noticeMuted                  (queryIsMuted());
 
163
}
 
164
 
 
165
 
 
166
void IRadioSoundClient::noticeDisconnectedI   (cmplInterface *, bool pointer_valid)
 
167
{
 
168
    noticeVolumeChanged          (queryVolume());
 
169
    noticeTrebleChanged          (queryTreble());
 
170
    noticeBassChanged            (queryBass());
 
171
    noticeBalanceChanged         (queryBalance());
 
172
    noticeSignalQualityChanged   (querySignalQuality());
 
173
    noticeSignalQualityChanged   (queryHasGoodQuality());
 
174
    noticeSignalMinQualityChanged(querySignalMinQuality());
 
175
    noticeStereoChanged          (queryIsStereo());
 
176
    noticeMuted                  (queryIsMuted());
 
177
}
 
178
 
 
179
*/
 
180
 
 
181
 
 
182
 
 
183
// ISeekRadio
 
184
 
 
185
IF_IMPL_SENDER  (  ISeekRadio::notifySeekStarted (bool up),
 
186
                   noticeSeekStarted (up)                         );
 
187
IF_IMPL_SENDER  (  ISeekRadio::notifySeekStopped (),
 
188
                   noticeSeekStopped ()                           );
 
189
IF_IMPL_SENDER  (  ISeekRadio::notifySeekFinished (const RadioStation &s, bool goodQuality),
 
190
                   noticeSeekFinished (s, goodQuality)            );
 
191
IF_IMPL_SENDER  (  ISeekRadio::notifyProgress (float f),
 
192
                   noticeProgress (f)                             );
 
193
 
 
194
 
 
195
// ISeekRadioClient
 
196
 
 
197
IF_IMPL_SENDER  (  ISeekRadioClient::sendToBeginning(),
 
198
                   toBeginning()                                  );
 
199
IF_IMPL_SENDER  (  ISeekRadioClient::sendToEnd(),
 
200
                   toEnd()                                        );
 
201
IF_IMPL_SENDER  (  ISeekRadioClient::sendStartSeek (bool up),
 
202
                   startSeek (up)                                 );
 
203
IF_IMPL_SENDER  (  ISeekRadioClient::sendStartSeekUp(),
 
204
                   startSeekUp()                                  );
 
205
IF_IMPL_SENDER  (  ISeekRadioClient::sendStartSeekDown(),
 
206
                   startSeekDown()                                );
 
207
IF_IMPL_SENDER  (  ISeekRadioClient::sendStopSeek(),
 
208
                   stopSeek()                                     );
 
209
 
 
210
IF_IMPL_QUERY   (  bool ISeekRadioClient::queryIsSeekRunning(),
 
211
                   isSeekRunning(),
 
212
                   false                                          );
 
213
IF_IMPL_QUERY   (  bool ISeekRadioClient::queryIsSeekUpRunning(),
 
214
                   isSeekUpRunning(),
 
215
                   false                                          );
 
216
IF_IMPL_QUERY   (  bool ISeekRadioClient::queryIsSeekDownRunning(),
 
217
                   isSeekDownRunning(),
 
218
                   false                                          );
 
219
IF_IMPL_QUERY   (  float ISeekRadioClient::queryProgress(),
 
220
                   getProgress(),
 
221
                   1.0                                            );
 
222
 
 
223
 
 
224
void ISeekRadioClient::noticeConnectedI    (cmplInterface *, bool /*pointer_valid*/)
 
225
{
 
226
    if (queryIsSeekRunning()) {
 
227
        noticeSeekStarted(queryIsSeekUpRunning());
 
228
    } else {
 
229
        noticeSeekStopped();
 
230
    }
 
231
    noticeProgress(queryProgress());
 
232
}
 
233
 
 
234
 
 
235
void ISeekRadioClient::noticeDisconnectedI   (cmplInterface *, bool /*pointer_valid*/)
 
236
{
 
237
    noticeSeekStopped();
 
238
    noticeProgress(queryProgress());
 
239
}
 
240
 
 
241
 
 
242
// IFrequencyRadio
 
243
 
 
244
IF_IMPL_SENDER  (  IFrequencyRadio::notifyFrequencyChanged(float f, const RadioStation *s),
 
245
                   noticeFrequencyChanged(f, s)                   )
 
246
IF_IMPL_SENDER  (  IFrequencyRadio::notifyMinMaxFrequencyChanged(float min, float max),
 
247
                   noticeMinMaxFrequencyChanged(min, max)         )
 
248
IF_IMPL_SENDER  (  IFrequencyRadio::notifyDeviceMinMaxFrequencyChanged(float min, float max),
 
249
                   noticeDeviceMinMaxFrequencyChanged(min, max)         )
 
250
IF_IMPL_SENDER  (  IFrequencyRadio::notifyScanStepChanged(float s),
 
251
                    noticeScanStepChanged(s)                      )
 
252
 
 
253
// IFrequencyRadioClient
 
254
 
 
255
IF_IMPL_SENDER  (  IFrequencyRadioClient::sendFrequency(float f),
 
256
                   setFrequency(f)                                )
 
257
IF_IMPL_SENDER  (  IFrequencyRadioClient::sendMinFrequency(float mf),
 
258
                   setMinFrequency(mf)                            )
 
259
IF_IMPL_SENDER  (  IFrequencyRadioClient::sendMaxFrequency(float mf),
 
260
                   setMaxFrequency(mf)                            )
 
261
IF_IMPL_SENDER  (  IFrequencyRadioClient::sendScanStep(float s),
 
262
                   setScanStep(s)                                 )
 
263
 
 
264
IF_IMPL_QUERY   (  float IFrequencyRadioClient::queryFrequency(),
 
265
                   getFrequency(),
 
266
                   0                                              )
 
267
IF_IMPL_QUERY   (  float IFrequencyRadioClient::queryMinFrequency(),
 
268
                   getMinFrequency(),
 
269
                   0                                              )
 
270
IF_IMPL_QUERY   (  float IFrequencyRadioClient::queryMinDeviceFrequency(),
 
271
                   getMinDeviceFrequency(),
 
272
                   0                                              )
 
273
IF_IMPL_QUERY   (  float IFrequencyRadioClient::queryMaxFrequency(),
 
274
                   getMaxFrequency(),
 
275
                   0                                              )
 
276
IF_IMPL_QUERY   (  float IFrequencyRadioClient::queryMaxDeviceFrequency(),
 
277
                   getMaxDeviceFrequency(),
 
278
                   0                                              )
 
279
IF_IMPL_QUERY   (  float IFrequencyRadioClient::queryScanStep(),
 
280
                   getScanStep(),
 
281
                   0.05                                           )
 
282
 
 
283
void IFrequencyRadioClient::noticeConnectedI    (cmplInterface *, bool /*pointer_valid*/)
 
284
{
 
285
    noticeFrequencyChanged(queryFrequency(), NULL);
 
286
    noticeMinMaxFrequencyChanged(queryMinFrequency(), queryMaxFrequency());
 
287
    noticeDeviceMinMaxFrequencyChanged(queryMinDeviceFrequency(), queryMaxDeviceFrequency());
 
288
    noticeScanStepChanged(queryScanStep());
 
289
}
 
290
 
 
291
 
 
292
void IFrequencyRadioClient::noticeDisconnectedI   (cmplInterface *, bool /*pointer_valid*/)
 
293
{
 
294
    noticeFrequencyChanged(queryFrequency(), NULL);
 
295
    noticeMinMaxFrequencyChanged(queryMinFrequency(), queryMaxFrequency());
 
296
    noticeDeviceMinMaxFrequencyChanged(queryMinDeviceFrequency(), queryMaxDeviceFrequency());
 
297
    noticeScanStepChanged(queryScanStep());
 
298
}
 
299
 
 
300
 
 
301
 
 
302
// IInternetRadio
 
303
 
 
304
IF_IMPL_SENDER  (  IInternetRadio::notifyURLChanged(const KURL &u),
 
305
                   noticeURLChanged(u)                            )
 
306
 
 
307
// IInternetRadioClient
 
308
 
 
309
IF_IMPL_SENDER  (  IInternetRadioClient::sendURL(const KURL &url),
 
310
                   setURL(url)                                    )
 
311
 
 
312
 
 
313
static KURL emptyURL;
 
314
 
 
315
IF_IMPL_QUERY   (  const KURL &IInternetRadioClient::queryURL(),
 
316
                   getURL(),
 
317
                   emptyURL                                       )
 
318
 
 
319
void IInternetRadioClient::noticeConnectedI    (cmplInterface *, bool /*pointer_valid*/)
 
320
{
 
321
    noticeURLChanged(queryURL());
 
322
}
 
323
 
 
324
 
 
325
void IInternetRadioClient::noticeDisconnectedI (cmplInterface *, bool /*pointer_valid*/)
 
326
{
 
327
    noticeURLChanged(queryURL());
 
328
}
 
329
 
 
330