You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
168 lines
6.0 KiB
168 lines
6.0 KiB
15 years ago
|
/***************************************************************************
|
||
|
radio.h - description
|
||
|
-------------------
|
||
|
begin : Sat March 29 2003
|
||
|
copyright : (C) 2003 by Klas Kalass, Ernst Martin Witte
|
||
|
email : klas@kde.org, witte@kawo1.rwth-aachen.de
|
||
|
***************************************************************************/
|
||
|
|
||
|
/***************************************************************************
|
||
|
* *
|
||
|
* 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_RADIO_H
|
||
|
#define KRADIO_RADIO_H
|
||
|
|
||
|
#ifdef HAVE_CONFIG_H
|
||
|
#include <config.h>
|
||
|
#endif
|
||
|
|
||
|
|
||
|
#include "../../src/include/radio_interfaces.h"
|
||
|
#include "../../src/include/radiodevicepool_interfaces.h"
|
||
|
#include "../../src/include/radiodevice_interfaces.h"
|
||
|
#include "../../src/include/timecontrol_interfaces.h"
|
||
|
#include "../../src/include/soundstreamclient_interfaces.h"
|
||
|
#include "../../src/include/stationlist.h"
|
||
|
#include "../../src/include/plugins.h"
|
||
|
|
||
|
/**
|
||
|
* The main Radio class, which is used as the interface of the radio functionality
|
||
|
* to the GUI parts of the application
|
||
|
* @author Klas Kalass, Ernst Martin Witte
|
||
|
*/
|
||
|
|
||
|
/////////////////////////////////////////////////////////////////////////////
|
||
|
|
||
|
/* A class, that is able to manage more than one radio device, one of those
|
||
|
is active at a time. This class behaves represents the active device,
|
||
|
the active devices can be changed either by selecting a station or by
|
||
|
explicitly changing the devices.
|
||
|
|
||
|
At any time a valid active device exists as long as any device is connected.
|
||
|
|
||
|
*/
|
||
|
|
||
|
class Radio : public PluginBase,
|
||
|
public IRadio,
|
||
|
public IRadioDevicePool,
|
||
|
public IRadioDeviceClient,
|
||
|
public ITimeControlClient,
|
||
|
public ISoundStreamClient
|
||
|
{
|
||
|
public:
|
||
14 years ago
|
Radio(const TQString &name);
|
||
15 years ago
|
~Radio();
|
||
|
|
||
|
|
||
|
// PluginBase
|
||
|
|
||
|
public:
|
||
12 years ago
|
virtual void saveState (TDEConfig *) const;
|
||
|
virtual void restoreState (TDEConfig *);
|
||
15 years ago
|
|
||
14 years ago
|
virtual TQString pluginClassName() const { return "Radio"; }
|
||
15 years ago
|
|
||
14 years ago
|
virtual const TQString &name() const { return PluginBase::name(); }
|
||
|
virtual TQString &name() { return PluginBase::name(); }
|
||
15 years ago
|
|
||
|
virtual ConfigPageInfo createConfigurationPage();
|
||
|
virtual AboutPageInfo createAboutPage();
|
||
|
|
||
|
virtual void aboutToQuit();
|
||
|
|
||
|
// IRadio methods
|
||
|
|
||
|
RECEIVERS:
|
||
|
bool powerOn() { return sendPowerOn() > 0; }
|
||
|
bool powerOff() { return sendPowerOff() > 0; }
|
||
|
bool activateStation(const RadioStation &rs);
|
||
|
bool activateStation(int index);
|
||
|
bool setStations(const StationList &sl);
|
||
14 years ago
|
bool setPresetFile(const TQString &presetFile);
|
||
15 years ago
|
|
||
|
ANSWERS:
|
||
|
bool isPowerOn() const { return queryIsPowerOn(); }
|
||
|
bool isPowerOff() const { return queryIsPowerOff(); }
|
||
|
const RadioStation & getCurrentStation() const { return queryCurrentStation(); }
|
||
|
int getStationIdx(const RadioStation &) const;
|
||
|
int getCurrentStationIdx() const;
|
||
|
const StationList & getStations() const { return m_stationList; }
|
||
14 years ago
|
const TQString & getPresetFile() const { return m_presetFile; }
|
||
15 years ago
|
|
||
|
SoundStreamID getCurrentSoundStreamID() const;
|
||
|
|
||
|
|
||
|
public:
|
||
|
bool connectI (Interface *i);
|
||
|
bool disconnectI (Interface *i);
|
||
|
|
||
|
void noticeConnectedI (IRadioDeviceClient::cmplInterface *i, bool pointer_valid);
|
||
|
void noticeDisconnectI(IRadioDeviceClient::cmplInterface *i, bool pointer_valid);
|
||
|
|
||
|
// IRadioDevicePool methods
|
||
|
|
||
|
RECEIVERS:
|
||
|
bool setActiveDevice(IRadioDevice *rd, bool keepPower = true);
|
||
|
|
||
|
ANSWERS:
|
||
|
IRadioDevice * getActiveDevice() const;
|
||
14 years ago
|
const TQPtrList<IRadioDevice> & getDevices() const;
|
||
|
const TQString & getDeviceDescription() const;
|
||
15 years ago
|
|
||
|
|
||
|
|
||
|
// IRadioDeviceClient methods, even sending methods overwritten
|
||
|
// to provide "1-of-N" functionality
|
||
|
|
||
|
SENDERS:
|
||
|
IF_SENDER ( sendPowerOn() )
|
||
|
IF_SENDER ( sendPowerOff() )
|
||
|
IF_SENDER ( sendActivateStation (const RadioStation &rs) )
|
||
|
|
||
13 years ago
|
QUERIES:
|
||
|
IF_QUERY ( bool queryIsPowerOn() )
|
||
|
IF_QUERY ( bool queryIsPowerOff() )
|
||
|
IF_QUERY ( const RadioStation & queryCurrentStation() )
|
||
|
IF_QUERY ( const TQString & queryDescription() )
|
||
|
IF_QUERY ( SoundStreamID queryCurrentSoundStreamID() )
|
||
15 years ago
|
|
||
|
RECEIVERS:
|
||
|
virtual bool noticePowerChanged (bool on, const IRadioDevice *sender = NULL);
|
||
|
virtual bool noticeStationChanged (const RadioStation &rs, const IRadioDevice *sender = NULL);
|
||
14 years ago
|
virtual bool noticeDescriptionChanged (const TQString &, const IRadioDevice *sender = NULL);
|
||
15 years ago
|
|
||
|
virtual bool noticeCurrentSoundStreamIDChanged(SoundStreamID id, const IRadioDevice *sender = NULL);
|
||
|
|
||
|
// ITimeControlClient
|
||
|
|
||
|
RECEIVERS:
|
||
|
bool noticeAlarmsChanged(const AlarmVector &) { return false; } // ignore
|
||
|
bool noticeAlarm(const Alarm &);
|
||
|
bool noticeNextAlarmChanged(const Alarm *) { return false; } // ignore
|
||
14 years ago
|
bool noticeCountdownStarted(const TQDateTime &/*end*/){ return false; } // ignore
|
||
15 years ago
|
bool noticeCountdownStopped() { return false; } // ignore
|
||
|
bool noticeCountdownZero();
|
||
|
bool noticeCountdownSecondsChanged(int /*n*/) { return false; } // ignore
|
||
|
|
||
|
// ISoundStreamClient
|
||
|
|
||
|
RECEIVERS:
|
||
|
|
||
|
// ...
|
||
|
|
||
|
protected:
|
||
|
|
||
14 years ago
|
TQString m_presetFile;
|
||
15 years ago
|
StationList m_stationList;
|
||
|
IRadioDevice *m_activeDevice;
|
||
|
};
|
||
|
|
||
|
|
||
|
#endif
|