kradio4 r778
|
00001 /*************************************************************************** 00002 frequencyseekhelper.h - description 00003 ------------------- 00004 begin : Fre Mai 9 2003 00005 copyright : (C) 2003 by Martin Witte 00006 email : emw-kradio@nocabal.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef KRADIO_FREQUENCY_SEEKHELPER_H 00019 #define KRADIO_FREQUENCY_SEEKHELPER_H 00020 00021 #ifdef HAVE_CONFIG_H 00022 #include <config.h> 00023 #endif 00024 00025 #include <QtCore/QObject> 00026 #include <QtCore/QTimer> 00027 //#include "radiodevice_interfaces.h" 00028 #include "frequencyradio_interfaces.h" 00029 #include "seekhelper.h" 00030 #include <kdemacros.h> 00031 00032 class KDE_EXPORT FrequencySeekHelper : public QObject, 00033 public SeekHelper, 00034 public IFrequencyRadioClient 00035 { 00036 Q_OBJECT 00037 public: 00038 00039 FrequencySeekHelper(ISeekRadio &parent); 00040 virtual ~FrequencySeekHelper(); 00041 00042 // IFrequencyRadioClient 00043 RECEIVERS: 00044 bool noticeFrequencyChanged(float /*f*/, const FrequencyRadioStation */*s*/) { return false; } 00045 bool noticeMinMaxFrequencyChanged(float /*min*/, float /*max*/) { return false; } 00046 bool noticeDeviceMinMaxFrequencyChanged(float /*min*/, float /*max*/){ return false; } 00047 bool noticeScanStepChanged(float /*s*/) { return false; } 00048 00049 public: 00050 00051 virtual bool connectI (Interface *i); 00052 virtual bool disconnectI(Interface *i); 00053 00054 virtual void start(const SoundStreamID &, direction_t dir); 00055 00056 public slots: 00057 00058 virtual void step() { SeekHelper::step(); } 00059 00060 protected: 00061 virtual void abort(); 00062 virtual bool isGood() const; 00063 virtual bool isBetter() const; 00064 virtual bool isWorse() const; 00065 virtual bool bestFound() const; 00066 virtual void getData(); 00067 virtual void rememberBest(); 00068 virtual bool nextSeekStep(); 00069 virtual void applyBest(); 00070 00071 protected: 00072 QTimer *m_timer; 00073 00074 float m_currentSignal, m_oldSignal; 00075 bool m_goodSignal; 00076 float m_currentFrequency, m_oldFrequency; 00077 float m_bestFrequency; 00078 }; 00079 00080 #endif