seekhelper.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef KRADIO_SEEKHELPER_H
00019 #define KRADIO_SEEKHELPER_H
00020
00021 #ifdef HAVE_CONFIG_H
00022 #include <config.h>
00023 #endif
00024
00025 #include "radiodevice_interfaces.h"
00026 #include "seekradio_interfaces.h"
00027 #include "soundstreamclient_interfaces.h"
00028 #include <kdemacros.h>
00029
00030
00031 class KDE_EXPORT SeekHelper : public IRadioDeviceClient,
00032 public ISoundStreamClient
00033 {
00034 public:
00035 typedef enum { off, searchWorse, searchBest } state_t;
00036 typedef enum { up, down } direction_t;
00037
00038 SeekHelper(ISeekRadio &parent);
00039 virtual ~SeekHelper();
00040
00041 virtual bool connectI (Interface *i);
00042 virtual bool disconnectI(Interface *i);
00043
00044 virtual void start(const SoundStreamID &id, direction_t dir);
00045 virtual void step();
00046 virtual void stop();
00047
00048 bool isRunning() const { return m_state != off; }
00049 bool isRunningUp() const { return m_state != off && m_direction == up; }
00050 bool isRunningDown() const { return m_state != off && m_direction == down; }
00051
00052
00053
00054 RECEIVERS:
00055 bool noticePowerChanged (bool , const IRadioDevice *) { return false; }
00056 bool noticeStationChanged (const RadioStation &, const IRadioDevice *) { return false; }
00057 bool noticeDescriptionChanged (const QString &, const IRadioDevice *) { return false; }
00058
00059 bool noticeRDSStateChanged (bool , const IRadioDevice *) { return false; }
00060 bool noticeRDSRadioTextChanged (const QString &, const IRadioDevice *) { return false; }
00061 bool noticeRDSStationNameChanged(const QString &, const IRadioDevice *) { return false; }
00062
00063 bool noticeCurrentSoundStreamSourceIDChanged(SoundStreamID , const IRadioDevice *) { return false; }
00064 bool noticeCurrentSoundStreamSinkIDChanged (SoundStreamID , const IRadioDevice *) { return false; }
00065
00066 protected:
00067
00068 virtual void finish();
00069
00070 virtual void abort() = 0;
00071 virtual bool isGood() const = 0;
00072 virtual bool isBetter() const = 0;
00073 virtual bool isWorse() const = 0;
00074 virtual bool bestFound() const = 0;
00075 virtual void getData() = 0;
00076 virtual void rememberBest() = 0;
00077 virtual bool nextSeekStep() = 0;
00078 virtual void applyBest() = 0;
00079
00080 protected:
00081 state_t m_state;
00082 direction_t m_direction;
00083 bool m_oldMute;
00084
00085 ISeekRadio &m_parent;
00086 SoundStreamID m_SoundStreamID;
00087 };
00088
00089 #endif
00090