kradio4  r778
seekhelper.h
Go to the documentation of this file.
1 /***************************************************************************
2  seekhelper.h - description
3  -------------------
4  begin : Sam Mai 10 2003
5  copyright : (C) 2003 by Martin Witte
6  email : emw-kradio@nocabal.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 #ifndef KRADIO_SEEKHELPER_H
19 #define KRADIO_SEEKHELPER_H
20 
21 #ifdef HAVE_CONFIG_H
22 #include <config.h>
23 #endif
24 
25 #include "radiodevice_interfaces.h"
26 #include "seekradio_interfaces.h"
27 #include "soundstreamclient_interfaces.h"
28 #include <kdemacros.h>
29 
30 
31 class KDE_EXPORT SeekHelper : public IRadioDeviceClient,
32  public ISoundStreamClient
33 {
34 public:
35  typedef enum { off, searchWorse, searchBest } state_t;
36  typedef enum { up, down } direction_t;
37 
38  SeekHelper(ISeekRadio &parent);
39  virtual ~SeekHelper();
40 
41  virtual bool connectI (Interface *i);
42  virtual bool disconnectI(Interface *i);
43 
44  virtual void start(const SoundStreamID &id, direction_t dir);
45  virtual void step();
46  virtual void stop();
47 
48  bool isRunning() const { return m_state != off; }
49  bool isRunningUp() const { return m_state != off && m_direction == up; }
50  bool isRunningDown() const { return m_state != off && m_direction == down; }
51 
52 
53 // IRadioDeviceClient
54 RECEIVERS:
55  bool noticePowerChanged (bool /*on*/, const IRadioDevice */*sender*/) { return false; }
56  bool noticeStationChanged (const RadioStation &, const IRadioDevice */*sender*/) { return false; }
57  bool noticeDescriptionChanged (const QString &, const IRadioDevice */*sender*/) { return false; }
58 
59  bool noticeRDSStateChanged (bool /*enabled*/, const IRadioDevice */*sender*/) { return false; }
60  bool noticeRDSRadioTextChanged (const QString &/*s*/, const IRadioDevice */*sender*/) { return false; }
61  bool noticeRDSStationNameChanged(const QString &/*s*/, const IRadioDevice */*sender*/) { return false; }
62 
63  bool noticeCurrentSoundStreamSourceIDChanged(SoundStreamID /*id*/, const IRadioDevice */*sender*/) { return false; }
64  bool noticeCurrentSoundStreamSinkIDChanged (SoundStreamID /*id*/, const IRadioDevice */*sender*/) { return false; }
65 
66 protected:
67 
68  virtual void finish();
69 
70  virtual void abort() = 0;
71  virtual bool isGood() const = 0;
72  virtual bool isBetter() const = 0;
73  virtual bool isWorse() const = 0;
74  virtual bool bestFound() const = 0;
75  virtual void getData() = 0;
76  virtual void rememberBest() = 0;
77  virtual bool nextSeekStep() = 0;
78  virtual void applyBest() = 0;
79 
80 protected:
83  bool m_oldMute;
84 
85  ISeekRadio &m_parent;
87 };
88 
89 #endif
90 
RECEIVERS const IRadioDevice *bool noticeStationChanged(const RadioStation &, const IRadioDevice *)
Definition: seekhelper.h:56
bool isRunning() const
Definition: seekhelper.h:48
bool noticeRDSRadioTextChanged(const QString &, const IRadioDevice *)
Definition: seekhelper.h:60
bool noticeCurrentSoundStreamSourceIDChanged(SoundStreamID, const IRadioDevice *)
Definition: seekhelper.h:63
bool noticeRDSStateChanged(bool, const IRadioDevice *)
Definition: seekhelper.h:59
bool isRunningUp() const
Definition: seekhelper.h:49
SoundStreamID m_SoundStreamID
Definition: seekhelper.h:86
bool noticeDescriptionChanged(const QString &, const IRadioDevice *)
Definition: seekhelper.h:57
ISeekRadio & m_parent
Definition: seekhelper.h:85
bool noticeRDSStationNameChanged(const QString &, const IRadioDevice *)
Definition: seekhelper.h:61
bool noticeCurrentSoundStreamSinkIDChanged(SoundStreamID, const IRadioDevice *)
Definition: seekhelper.h:64
state_t m_state
Definition: seekhelper.h:81
direction_t m_direction
Definition: seekhelper.h:82
bool isRunningDown() const
Definition: seekhelper.h:50
bool m_oldMute
Definition: seekhelper.h:83