summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/aboutwidget.h149
-rw-r--r--src/include/alarm.h104
-rw-r--r--src/include/debug-profiler.h112
-rw-r--r--src/include/errorlog-interfaces.h64
-rw-r--r--src/include/fileringbuffer.h71
-rw-r--r--src/include/frequencyradiostation.h83
-rw-r--r--src/include/frequencyseekhelper.h78
-rw-r--r--src/include/gui_list_helper.h174
-rw-r--r--src/include/interfaces.h714
-rw-r--r--src/include/internetradiostation.h75
-rw-r--r--src/include/multibuffer.h65
-rw-r--r--src/include/plugin_configuration_dialog.h75
-rw-r--r--src/include/pluginmanager-configuration.h61
-rw-r--r--src/include/pluginmanager.h148
-rw-r--r--src/include/plugins.h192
-rw-r--r--src/include/radio_interfaces.h117
-rw-r--r--src/include/radiodevice_interfaces.h353
-rw-r--r--src/include/radiodevicepool_interfaces.h75
-rw-r--r--src/include/radiostation-config.h82
-rw-r--r--src/include/radiostation-listview.h84
-rw-r--r--src/include/radiostation.h164
-rw-r--r--src/include/ringbuffer.h58
-rw-r--r--src/include/seekhelper.h83
-rw-r--r--src/include/sound_metadata.h50
-rw-r--r--src/include/soundformat.h75
-rw-r--r--src/include/soundstreamclient_interfaces.h372
-rw-r--r--src/include/soundstreamid.h63
-rw-r--r--src/include/standardscandialog.h101
-rw-r--r--src/include/station-drag-object.h39
-rw-r--r--src/include/stationlist.h159
-rw-r--r--src/include/stationlistmetadata.h55
-rw-r--r--src/include/stationlistxmlhandler.h85
-rw-r--r--src/include/stationselection_interfaces.h67
-rw-r--r--src/include/stationselector.h100
-rw-r--r--src/include/tderadioapp.h121
-rw-r--r--src/include/tderadioversion.h23
-rw-r--r--src/include/timecontrol_interfaces.h106
-rw-r--r--src/include/utils.h47
-rw-r--r--src/include/widgetplugins.h75
39 files changed, 4719 insertions, 0 deletions
diff --git a/src/include/aboutwidget.h b/src/include/aboutwidget.h
new file mode 100644
index 0000000..a0b3fe7
--- /dev/null
+++ b/src/include/aboutwidget.h
@@ -0,0 +1,149 @@
+/***************************************************************************
+ aboutwidget.h - description
+ -------------------
+ begin : Sa Sep 13 2003
+ copyright : (C) 2003 by Martin Witte
+ email : 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_ABOUT_WIDGET_H
+#define KRADIO_ABOUT_WIDGET_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include <tqwidget.h>
+
+/* Unfortunately KDE doesn't provide the class TDEAboutContainerBase
+ to public programming, so we have to copy most of that code into
+ an own class :(
+*/
+
+class TQFrame;
+class TDEAboutContainer;
+class TQTabWidget;
+class TQVBoxLayout;
+class TDEAboutData;
+
+#include <tqlabel.h>
+
+// copied (and renamed) from kaboutdialog_private.h
+// original: KImageTrackLabel
+
+class TDERadioImageTrackLabel : public TQLabel
+{
+ Q_OBJECT
+
+
+ public:
+ enum MouseMode
+ {
+ MousePress = 1,
+ MouseRelease,
+ MouseDoubleClick,
+ MouseMove
+ };
+
+ public:
+ TDERadioImageTrackLabel( TQWidget * parent, const char * name=0, WFlags f=0 );
+
+ signals:
+ void mouseTrack( int mode, const TQMouseEvent *e );
+
+ protected:
+ virtual void mousePressEvent( TQMouseEvent *e );
+ virtual void mouseReleaseEvent( TQMouseEvent *e );
+ virtual void mouseDoubleClickEvent( TQMouseEvent *e );
+ virtual void mouseMoveEvent ( TQMouseEvent *e );
+};
+
+// copied (and renamed) from kaboutdialog_private.h
+// original: TDEAboutContainerBase
+
+class TDERadioAboutWidget : public TQWidget
+{
+ Q_OBJECT
+
+
+ public:
+ enum LayoutType
+ {
+ AbtPlain = 0x0001,
+ AbtTabbed = 0x0002,
+ AbtTitle = 0x0004,
+ AbtImageLeft = 0x0008,
+ AbtImageRight = 0x0010,
+ AbtImageOnly = 0x0020,
+ AbtProduct = 0x0040,
+ AbtKDEStandard = AbtTabbed|AbtTitle|AbtImageLeft,
+ AbtAppStandard = AbtTabbed|AbtTitle|AbtProduct,
+ AbtImageAndTitle = AbtPlain|AbtTitle|AbtImageOnly
+ };
+
+ public:
+ TDERadioAboutWidget(const TDEAboutData &abtData, int layoutType, TQWidget *parent = 0, char *name = 0);
+ virtual void show( void );
+ virtual TQSize sizeHint( void ) const;
+
+ void setAboutData(const TDEAboutData &abtData);
+
+ void setTitle( const TQString &title );
+ void setImage( const TQString &fileName );
+ void setImageBackgroundColor( const TQColor &color );
+ void setImageFrame( bool state );
+ void setProduct( const TQString &appName, const TQString &version,
+ const TQString &author, const TQString &year );
+
+ TQFrame *addTextPage( const TQString &title, const TQString &text,
+ bool richText=false, int numLines=10 );
+ TQFrame *addLicensePage( const TQString &title, const TQString &text,
+ int numLines=10 );
+ TDEAboutContainer *addContainerPage( const TQString &title,
+ int childAlignment = AlignCenter, int innerAlignment = AlignCenter );
+ TDEAboutContainer *addScrolledContainerPage( const TQString &title,
+ int childAlignment = AlignCenter, int innerAlignment = AlignCenter );
+
+ TQFrame *addEmptyPage( const TQString &title );
+
+ TDEAboutContainer *addContainer( int childAlignment, int innerAlignment );
+
+ public slots:
+ virtual void slotMouseTrack( int mode, const TQMouseEvent *e );
+ virtual void slotUrlClick( const TQString &url );
+ virtual void slotMailClick( const TQString &name, const TQString &address );
+
+ protected:
+ virtual void fontChange( const TQFont &oldFont );
+
+ signals:
+ void mouseTrack( int mode, const TQMouseEvent *e );
+ void urlClick( const TQString &url );
+ void mailClick( const TQString &name, const TQString &address );
+
+ private:
+ TQMemArray<TQWidget*> mContainerList;
+
+ TQVBoxLayout *mTopLayout;
+ TDERadioImageTrackLabel *mImageLabel;
+ TQLabel *mTitleLabel;
+ TQLabel *mIconLabel;
+ TQLabel *mVersionLabel;
+ TQLabel *mAuthorLabel;
+ TQFrame *mImageFrame;
+ TQTabWidget *mPageTab;
+ TQFrame *mPlainSpace;
+};
+
+
+#endif
diff --git a/src/include/alarm.h b/src/include/alarm.h
new file mode 100644
index 0000000..14b4abc
--- /dev/null
+++ b/src/include/alarm.h
@@ -0,0 +1,104 @@
+/***************************************************************************
+ alarm.h - description
+ -------------------
+ begin : Mon Feb 4 2002
+ copyright : (C) 2002 by Martin Witte / Frank Schwanz
+ email : witte@kawo1.rwth-aachen.de / schwanz@fh-brandenburg.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_ALARM_H
+#define KRADIO_ALARM_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tqdatetime.h>
+#include <vector>
+
+/**
+ *@author Martin Witte
+ */
+
+class Alarm
+{
+public:
+
+ enum AlarmType { StartPlaying, StopPlaying, StartRecording, StopRecording };
+
+protected:
+ TQDateTime m_time;
+
+ bool m_daily;
+ int m_weekdayMask;
+
+ bool m_enabled;
+ TQString m_stationID;
+ float m_volumePreset; // < 0: disabled
+
+ AlarmType m_type;
+
+ int m_ID;
+
+ static int m_LastID;
+
+public:
+ Alarm();
+ Alarm(const TQDateTime &time, bool daily, bool enabled);
+ Alarm(const Alarm &);
+ ~Alarm();
+
+ bool isEnabled() const { return m_enabled; }
+ bool isDaily() const { return m_daily; }
+ int weekdayMask() const { return m_weekdayMask; }
+ TQDateTime alarmTime () const { return m_time; }
+ TQDateTime nextAlarm (bool ignoreEnable = false) const;
+ const TQString &stationID () const { return m_stationID; }
+ float volumePreset () const { return m_volumePreset; }
+ AlarmType alarmType() const { return m_type; }
+
+ int ID() const { return m_ID; }
+
+ void setEnabled (bool enable = true) { m_enabled = enable; }
+ void setDaily (bool d = true) { m_daily = d; }
+ void setWeekdayMask(int m = 0x7F) { m_weekdayMask = m; }
+ void setDate (const TQDate &d) { m_time.setDate(d); }
+ void setTime (const TQTime &d) { m_time.setTime(d); }
+ void setVolumePreset(float v) { m_volumePreset = v; }
+ void setStationID(const TQString &id) { m_stationID = id;}
+ void setAlarmType(AlarmType t) { m_type = t; }
+
+
+ bool operator == (const Alarm &x) const {
+ return
+ m_time == x.m_time &&
+ m_daily == x.m_daily &&
+ m_weekdayMask == x.m_weekdayMask &&
+ m_enabled == x.m_enabled &&
+ m_stationID == x.m_stationID &&
+ m_volumePreset == x.m_volumePreset &&
+ m_type == x.m_type &&
+ m_ID == x.m_ID;
+ }
+ bool operator != (const Alarm &x) const { return ! operator == (x); }
+
+};
+
+using namespace std;
+
+typedef vector<Alarm> AlarmVector;
+typedef AlarmVector::iterator iAlarmVector;
+typedef AlarmVector::const_iterator ciAlarmVector;
+
+
+
+#endif
diff --git a/src/include/debug-profiler.h b/src/include/debug-profiler.h
new file mode 100644
index 0000000..7ceb50d
--- /dev/null
+++ b/src/include/debug-profiler.h
@@ -0,0 +1,112 @@
+/***************************************************************************
+ debug-profiler.h - description
+ -------------------
+ begin : Sat May 28 2005
+ copyright : (C) 2005 by Martin Witte
+ email : 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_DEBUG_PROFILER_H
+#define KRADIO_DEBUG_PROFILER_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tqstring.h>
+#include <tqmap.h>
+
+#if (defined __i386__) || (defined __x86_64__)
+static __inline__ unsigned long long int rdtsc()
+{
+ unsigned int a, d;
+ asm volatile("rdtsc" : "=a" (a), "=d" (d));
+ return ((unsigned long long)a) | (((unsigned long long)d) << 32);
+}
+#else
+static __inline__ unsigned long long int rdtsc()
+{
+ return 0UL;
+}
+#endif
+
+class Profiler
+{
+public:
+ Profiler();
+ virtual ~Profiler();
+
+ void startProfile(const TQString &descr);
+ void stopProfile (const TQString &descr);
+
+ void printData();
+
+protected:
+
+ virtual long long getCounter() const = 0;
+
+ void stopInternalCounter();
+ void startInternalCounter();
+
+ long long m_internalCounter;
+ long long m_tmpStartVal;
+
+ struct profile_data
+ {
+ profile_data(long long start = 0) :
+ startCounter(start), accumulatedCounter(0), callCounter(0),
+ minCounter(0x7FFFFFFFFFFFFFFFll), maxCounter(0) {}
+ long long startCounter;
+ long long accumulatedCounter;
+ long long callCounter;
+ long long minCounter;
+ long long maxCounter;
+ };
+
+ TQMap<TQString, profile_data> m_ProfileData;
+};
+
+
+class TimeProfiler : public Profiler
+{
+protected:
+ long long getCounter() const { return rdtsc(); }
+};
+
+
+class MemProfiler : public Profiler
+{
+protected:
+ long long getCounter() const;
+};
+
+
+extern TimeProfiler global_time_profiler;
+extern MemProfiler global_mem_profiler;
+
+
+
+class BlockProfiler
+{
+public:
+ BlockProfiler(const TQString &descr);
+ ~BlockProfiler();
+
+ void stop();
+
+protected:
+ TQString m_Description;
+};
+
+
+
+#endif
diff --git a/src/include/errorlog-interfaces.h b/src/include/errorlog-interfaces.h
new file mode 100644
index 0000000..85d5926
--- /dev/null
+++ b/src/include/errorlog-interfaces.h
@@ -0,0 +1,64 @@
+/***************************************************************************
+ errorlog-interfaces.h - description
+ -------------------
+ begin : Sa Sep 13 2003
+ copyright : (C) 2003 by Martin Witte
+ email : 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_ERRORLOG_INTERFACES_H
+#define KRADIO_ERRORLOG_INTERFACES_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "interfaces.h"
+
+INTERFACE(IErrorLog, IErrorLogClient)
+{
+public :
+ IErrorLog();
+ virtual ~IErrorLog();
+
+RECEIVERS:
+ IF_RECEIVER( logError (const TQString &) )
+ IF_RECEIVER( logWarning(const TQString &) )
+ IF_RECEIVER( logInfo (const TQString &) )
+ IF_RECEIVER( logDebug (const TQString &) )
+};
+
+
+INTERFACE(IErrorLogClient, IErrorLog)
+{
+public :
+ IF_CON_DESTRUCTOR(IErrorLogClient, -1)
+
+public:
+ IF_SENDER ( sendLogError (const TQString &) )
+ IF_SENDER ( sendLogWarning(const TQString &) )
+ IF_SENDER ( sendLogInfo (const TQString &) )
+ IF_SENDER ( sendLogDebug (const TQString &) )
+
+ void logError (const TQString &s) const { sendLogError(s); }
+ void logWarning(const TQString &s) const { sendLogWarning(s); }
+ void logInfo (const TQString &s) const { sendLogInfo(s); }
+ void logDebug (const TQString &s) const { sendLogDebug(s); }
+
+ static void staticLogError (const TQString &s);
+ static void staticLogWarning(const TQString &s);
+ static void staticLogInfo (const TQString &s);
+ static void staticLogDebug (const TQString &s);
+};
+
+
+#endif
diff --git a/src/include/fileringbuffer.h b/src/include/fileringbuffer.h
new file mode 100644
index 0000000..2978bec
--- /dev/null
+++ b/src/include/fileringbuffer.h
@@ -0,0 +1,71 @@
+/***************************************************************************
+ ringbuffer.h - description
+ -------------------
+ begin : Sun March 21 2004
+ copyright : (C) 2004 by Martin Witte
+ email : 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_FILE_RING_BUFFER_H
+#define _KRADIO_FILE_RING_BUFFER_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tqstring.h>
+#include <stdio.h>
+
+class FileRingBuffer
+{
+public:
+ FileRingBuffer(const TQString &filename, TQ_UINT64 max_size);
+ ~FileRingBuffer();
+
+ bool resize(const TQString &filename, TQ_UINT64 new_max_size);
+
+ size_t addData (const char *src, size_t size);
+ size_t takeData(char *dst, size_t size);
+ TQ_UINT64 removeData(TQ_UINT64 size);
+
+ const TQString &getFileName () const { return m_FileName; }
+ TQ_UINT64 getMaxSize() const { return m_MaxSize; }
+ TQ_UINT64 getRealSize() const { return m_RealSize; }
+ TQ_UINT64 getFillSize() const { return m_FillSize; }
+ TQ_UINT64 getFreeSize() const { return (m_Start + m_FillSize > m_RealSize) ? m_RealSize - m_FillSize : m_MaxSize - m_FillSize; }
+
+ void clear();
+
+ bool error() const { return m_error; }
+ const TQString &errorString() const { return m_errorString; }
+
+protected:
+ TQ_UINT64 getFreeSpace(TQ_UINT64 &size); // returns position in file + size
+ TQ_UINT64 removeFreeSpace(TQ_UINT64 size);
+
+ TQ_UINT64 getData(TQ_UINT64 &size); // returns position in file + size
+
+
+ int m_FileIdx;
+ TQString m_BaseFileName;
+ TQString m_FileName;
+ FILE *m_File;
+ TQ_UINT64 m_Start;
+ TQ_UINT64 m_MaxSize;
+ TQ_UINT64 m_RealSize;
+ TQ_UINT64 m_FillSize;
+
+ TQString m_errorString;
+ bool m_error;
+};
+
+#endif
diff --git a/src/include/frequencyradiostation.h b/src/include/frequencyradiostation.h
new file mode 100644
index 0000000..75c6ecd
--- /dev/null
+++ b/src/include/frequencyradiostation.h
@@ -0,0 +1,83 @@
+/***************************************************************************
+ frequencyradiostation.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_FREQUENCYRADIOSTATION_H
+#define KRADIO_FREQUENCYRADIOSTATION_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "radiostation.h"
+
+/**
+ * @author Klas Kalass, Ernst Martin Witte
+ */
+
+
+// Kopenhagener Wellenplan: 300kHz
+#define STATION_FREQ_INTERVAL_FM 0.3
+
+// Kopenhagener Wellenplan: 9kHz
+#define STATION_FREQ_INTERVAL_AM 0.009
+
+class FrequencyRadioStation : public RadioStation {
+public:
+ FrequencyRadioStation ();
+ FrequencyRadioStation (float frequency);
+ FrequencyRadioStation (const TQString &name, const TQString &shortName, float frequency);
+ FrequencyRadioStation (const FrequencyRadioStation &);
+ FrequencyRadioStation (RegisterStationClass, const TQString &classname = TQString());
+ ~FrequencyRadioStation();
+
+ float frequency() const { return m_frequency; }
+ void setFrequency (float frequency) { m_frequency = frequency; }
+
+ virtual TQString longName() const;
+ virtual TQString description() const;
+ virtual bool isValid () const;
+
+ /* = 0 : "this" is same as "s", i.e. approximately same frequency
+ > 0 : this.frequency > s.frequency
+ < 0 : this.frequency < s.frequency
+ other class than FrequencyRadioStation: compare typeid(.).name()
+ */
+ virtual int compare (const RadioStation &s) const;
+
+ /** returns an exact copy of this station */
+ virtual RadioStation *copy() const;
+ virtual RadioStation *copyNewID() const;
+
+ virtual RadioStationConfig *createEditor() const;
+
+ // for XML-Parsing/Export
+ virtual bool setProperty(const TQString &property_name, const TQString &val);
+ virtual TQString getProperty(const TQString &property_name) const;
+ virtual TQStringList getPropertyNames() const;
+ virtual TQString getClassName() const { return "FrequencyRadioStation"; }
+
+
+ virtual bool operator == (const RadioStation &x) const;
+
+protected:
+
+ float m_frequency;
+};
+
+
+
+#endif
diff --git a/src/include/frequencyseekhelper.h b/src/include/frequencyseekhelper.h
new file mode 100644
index 0000000..68ffe78
--- /dev/null
+++ b/src/include/frequencyseekhelper.h
@@ -0,0 +1,78 @@
+/***************************************************************************
+ frequencyseekhelper.h - description
+ -------------------
+ begin : Fre Mai 9 2003
+ copyright : (C) 2003 by Martin Witte
+ email : 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_FREQUENCY_SEEKHELPER_H
+#define KRADIO_FREQUENCY_SEEKHELPER_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tqobject.h>
+#include "radiodevice_interfaces.h"
+#include "seekhelper.h"
+
+class FrequencySeekHelper : public TQObject,
+ public SeekHelper,
+ public IFrequencyRadioClient
+{
+Q_OBJECT
+
+public:
+
+ FrequencySeekHelper(ISeekRadio &parent);
+ virtual ~FrequencySeekHelper();
+
+// IFrequencyRadioClient
+RECEIVERS:
+ bool noticeFrequencyChanged(float /*f*/, const RadioStation */*s*/) { return false; }
+ bool noticeMinMaxFrequencyChanged(float /*min*/, float /*max*/) { return false; }
+ bool noticeDeviceMinMaxFrequencyChanged(float /*min*/, float /*max*/){ return false; }
+ bool noticeScanStepChanged(float /*s*/) { return false; }
+
+public:
+
+ virtual bool connectI (Interface *i);
+ virtual bool disconnectI(Interface *i);
+
+ virtual void start(const SoundStreamID &, direction_t dir);
+
+public slots:
+
+ virtual void step() { SeekHelper::step(); }
+
+protected:
+ virtual void abort();
+ virtual bool isGood() const;
+ virtual bool isBetter() const;
+ virtual bool isWorse() const;
+ virtual bool bestFound() const;
+ virtual void getData();
+ virtual void rememberBest();
+ virtual bool nextSeekStep();
+ virtual void applyBest();
+
+protected:
+ TQTimer *m_timer;
+
+ float m_currentSignal, m_oldSignal;
+ bool m_goodSignal;
+ float m_currentFrequency, m_oldFrequency;
+ float m_bestFrequency;
+};
+
+#endif
diff --git a/src/include/gui_list_helper.h b/src/include/gui_list_helper.h
new file mode 100644
index 0000000..6a1479c
--- /dev/null
+++ b/src/include/gui_list_helper.h
@@ -0,0 +1,174 @@
+/***************************************************************************
+ gui_list_helper.h
+ -------------------
+ begin : Son Sep 26 2004
+ copyright : (C) 2004 by Martin Witte
+ email : 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_LIBKRADIO_GUI_GUI_LIST_HELPER_H_
+#define _KRADIO_LIBKRADIO_GUI_GUI_LIST_HELPER_H_
+
+#include <tqmap.h>
+#include <tqvaluelist.h>
+
+
+template <class TLIST> class GUISimpleListHelper
+{
+public:
+ GUISimpleListHelper(TLIST *list) : m_List(list) {}
+ ~GUISimpleListHelper() {}
+
+ void setData(const TQValueList<TQString> &data);
+ TQString getCurrentText() const { return m_List->currentText(); }
+ void setCurrentText(const TQString &s) { m_List->setCurrentItem(m_revData.contains(s) ? m_revData[s] : 0); }
+
+ int count() const { return m_revData.count(); }
+ bool contains(const TQString &id) const { return m_revData.contains(id); }
+
+protected:
+ TLIST *m_List;
+ TQMap<TQString, int> m_revData;
+};
+
+
+template <class TLIST>
+void GUISimpleListHelper<TLIST>::setData(const TQValueList<TQString> &data)
+{
+ m_List->clear();
+ m_revData.clear();
+
+ TQValueListConstIterator<TQString> it = data.begin();
+ TQValueListConstIterator<TQString> end = data.end();
+ for (int i = 0; it != end; ++it, ++i) {
+ m_revData[*it] = i;
+ m_List->insertItem(*it);
+ }
+}
+
+
+
+
+
+
+
+
+
+template <class TLIST, class TID> class GUIListHelper
+{
+public:
+ enum SORT_KEY { SORT_BY_ID, SORT_BY_DESCR };
+
+ GUIListHelper(TLIST *list, SORT_KEY skey);
+ GUIListHelper(TLIST *list, const TQMap<TID, TQString> &data, SORT_KEY skey);
+ ~GUIListHelper();
+
+ void setData(const TQMap<TID, TQString> &data);
+
+ void setCurrentItem(const TID &) const;
+ const TID &getCurrentItem() const;
+
+ int count() const { return m_Index2ID.count(); }
+
+ bool contains(const TID &id) const { return m_ID2Index.contains(id); }
+
+protected:
+ SORT_KEY m_skey;
+ TLIST *m_List;
+ TQMap<int, TID> m_Index2ID;
+ TQMap<TID, int> m_ID2Index;
+ TQMap<TID, TQString> m_ID2Description;
+
+ struct THelpData {
+ TID id;
+ TQString descr;
+ SORT_KEY skey;
+
+ THelpData() : id(), descr(), skey(SORT_BY_ID) {}
+ THelpData(TID _id, const TQString &_descr, SORT_KEY _skey)
+ : id(_id),
+ descr(_descr),
+ skey(_skey)
+ {}
+ bool operator > (const THelpData &d) { return (skey == SORT_BY_ID) ? id > d.id : descr > d.descr; }
+ bool operator < (const THelpData &d) { return (skey == SORT_BY_ID) ? id < d.id : descr < d.descr; }
+ };
+};
+
+
+
+template <class TLIST, class TID>
+GUIListHelper<TLIST, TID>::GUIListHelper(TLIST *list, SORT_KEY skey)
+ : m_skey(skey),
+ m_List(list)
+{
+}
+
+
+template <class TLIST, class TID>
+GUIListHelper<TLIST, TID>::GUIListHelper(TLIST *list, const TQMap<TID, TQString> &data, SORT_KEY skey)
+ : m_skey(skey),
+ m_List(list)
+{
+ setData(data);
+}
+
+
+template <class TLIST, class TID>
+GUIListHelper<TLIST, TID>::~GUIListHelper()
+{
+}
+
+
+template <class TLIST, class TID>
+void GUIListHelper<TLIST, TID>::setData (const TQMap<TID, TQString> &data)
+{
+ m_List->clear();
+
+ m_ID2Description = data;
+ TQValueList<THelpData> help_list;
+ TQMapConstIterator<TID, TQString> end = data.end();
+ for (TQMapConstIterator<TID, TQString> it = data.begin(); it != end; ++it) {
+ help_list.push_back(THelpData(it.key(), *it, m_skey));
+ }
+ qHeapSort(help_list);
+
+ m_Index2ID.clear();
+ m_ID2Index.clear();
+
+ int idx = 0;
+ TQValueListIterator<THelpData> end_hlp = help_list.end();
+ for (TQValueListIterator<THelpData> it = help_list.begin(); it != end_hlp; ++it, ++idx) {
+ m_Index2ID.insert(idx, (*it).id);
+ m_ID2Index.insert((*it).id, idx);
+ m_List->insertItem((*it).descr);
+ }
+}
+
+
+template <class TLIST, class TID>
+void GUIListHelper<TLIST, TID>::setCurrentItem(const TID &id) const
+{
+ if (m_ID2Index.contains(id))
+ m_List->setCurrentItem(m_ID2Index[id]);
+ else
+ m_List->setCurrentItem(0);
+}
+
+template <class TLIST, class TID>
+const TID &GUIListHelper<TLIST, TID>::getCurrentItem() const
+{
+ int idx = m_List->currentItem();
+ return m_Index2ID[idx];
+}
+
+#endif
diff --git a/src/include/interfaces.h b/src/include/interfaces.h
new file mode 100644
index 0000000..0ed4a59
--- /dev/null
+++ b/src/include/interfaces.h
@@ -0,0 +1,714 @@
+/***************************************************************************
+ interfaces.h - description
+ -------------------
+ begin : Fre Feb 28 2003
+ copyright : (C) 2003 by Martin Witte
+ email : 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_INTERFACES_H
+#define KRADIO_INTERFACES_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tqptrlist.h>
+#include <tqmap.h>
+#include <kdebug.h>
+#include <typeinfo>
+
+/*
+/////////////////////////////////////////////////////////////////////////////
+
+ Interfaces - Our Concept
+
+ Without connection management an interface can be defined easily as empty
+ abstract C++-Class. But that's not what we want.
+
+ Our interfaces also provide connection management. Thus each interface has
+ exactly one matching counterpart, the complementary interface (cmplIF).
+ Therefore connecting two objects that have matching interfaces can be
+ automated.
+
+ Our interfaces have to be able to support the following "functions":
+
+ - send and receive messages (e.g. notifications, commands, ...) to
+ all connected interfaces. These functions do not need a return value,
+ but in some cases the sender might want to know if anyone has received
+ his message. Thus a boolean return value should indicate if the message
+ was handled or ignored.
+
+ - query for information on connected interfaces / answer queries. These
+ functions usually have a return value. A query is only executed on the
+ "current" or - if not selected - the first or only connection.
+
+/////////////////////////////////////////////////////////////////////////////
+
+ Why are we not using QT signal/slots?
+
+ First the idea of using qt for connecting interfaces is very nice, as the
+ signal/slot model is well known and hopefully properly implemented.
+
+ But there are some problems:
+
+ - Signals/slots do not support return values, except "call by reference".
+ To provide queries or a delivery feedback for messages, wrapper functions
+ would have been necessary.
+
+ - TQt does not support multiple inheritance of TQObjects. Thus even signals
+ have to be declared abstract by the interface though the (later)
+ implementation is already known.
+
+ Those functions have to be declared as signals in the interface
+ implementation (derived from TQObject) though the implementation does not
+ want to worry about these signals.
+
+ - TQt does connect functions (signals/slots) and not interfaces. These
+ functions have to be connected separately. By that it is possible to
+ forget to connect signals/slots of that interfaces.
+
+ - Aggregation of multiple interface implementations (each one is an TQObject)
+ is not possible because qt does not allow multiple inheritance of TQObjects
+
+/////////////////////////////////////////////////////////////////////////////
+
+ What about our own solution?
+
+ Well, it eliminates at least the qt-problems explained above. But first we
+ need a common mechanism to manage interface connections. This functionality
+ can be provided by a common base class "InterfaceBase". It stores all
+ connected interfaces in a list of InterfaceBase pointers, e.g. TQPtrList.
+
+ With this approach we would have some problems:
+
+ - When calling a function of a connected interface a slow dynamic_cast
+ is necessary to upcast the stored InterfaceBase pointer to the
+ apropriate type.
+
+ - Multiple inheritance of InterfaceBase must not be virtual. Otherwise
+ interface connection management is mixed between interfaces.
+ (well, virtual inheritance is usually no real issue, but worth a hint;-)
+
+ To avoid these problems, InterfaceBase is a template with two parameters,
+ thisIF (IF = interface) and cmplIF (complementary IF). With that
+ information the base class for an interface is capable to handle
+ connections with the correct type information. Additionally some pseudo
+ types are declared (thisInterface, cmplInterface, IFList, IFIterator) to
+ make easy-to-use macros for messages and queries possible.
+
+/////////////////////////////////////////////////////////////////////////////
+
+ How do I use it ? - Declarations
+
+ First you have to declare the two matching interface-classes as unkown
+ classes, because both their names are used in the class declarations.
+ Afterwards you can declare both classes as class derived from
+ InterfaceBase.
+
+ class Interface;
+ class ComplementaryInterface;
+
+ class Interface : public InterfaceBase<Interface, ComplementaryInterface>
+ {
+ ...
+ };
+
+ class ComplementaryInterface : public InterfaceBase<ComplementaryInterface, Interface>
+ {
+ ...
+ };
+
+ With macro abbreviation:
+
+ INTERFACE(Interface, ComplementaryInterface)
+ {
+ };
+
+ INTERFACE(ComplementaryInterface, Interface)
+ {
+ };
+
+
+ In order to receive/send Messages or query/answer queries we have to declare
+ special methods:
+
+ - sending Messages
+
+ Declare a virtual constant method with return value "int" and the desired
+ parameters. The return value will indicate how many receivers have handled
+ the message:
+
+ virtual bool SendingMessages(int any_or_non_param) const;
+
+ Abbreviation by macros:
+
+ IF_SENDER( SendingMessages(int any_or_non_param) )
+
+
+ - receiving Messages
+
+ Declare an abstract Method with return value "bool", and the desired
+ paramters. The return value indicates wether the message was handled or not:
+
+ virtual bool ReceivingMessages(int any_or_non_param) = 0;
+
+ Abbreviation by macros:
+
+ IF_RECEIVER( ReceivingMessages(int any_or_non_param) )
+
+
+ The method has to be implemented by a derived class. The current item of the
+ receivers conntions list is set to the sender.
+
+
+ - querying queries
+
+ Declare a virtual constant method with the desired return value and
+ parameters:
+
+ virtual int QueryingQueries(int another_param) const;
+
+ Abbreviation by macros:
+
+ IF_QUERY( int QueryingQueries(int another_param) )
+
+
+ - answering queries
+
+ Declare an abstract Method with return value void, and the desired
+ paramters:
+
+ virtual void AnsweringQueries(int another_param) = 0;
+
+ Abbreviation by macros:
+
+ IF_ANSWER( AnsweringQueries(int another_param) )
+
+ The method has to be implemented by a derived class. The current item of the
+ receivers conntions list is set to the sender.
+
+
+ At last a note on maxConnections. This member is set on initialization by
+ the constructor and thus can be set in a derived class in it's own
+ constructor. Negative values are interpreted as "unlimited".
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+ How do I use it ? - Implementations
+
+ Because we do not have a MOC as TQt does, we have to implement our sending
+ or querying methods by hand. But this minor disadvantage should be
+ considered as less important than the fact, that this implementation is
+ done where it belongs to. Especially because there are easy to use macros
+ to do this:
+
+ int ComplementaryInterface::SendingMessages(int any_or_non_param) const
+ {
+ IF_SEND_MESSAGE( ReceivingMessages(any_or_non_param) )
+ // macro includes "return #receivers"
+ }
+
+ int ComplementaryInterface::QueryingQueries(int another_param) const
+ {
+ IF_SEND_QUERY( AnsweringQuery(another_param), (int)"default return value" )
+ }
+
+
+ Even shorter:
+
+ IF_IMPL_SENDER( ComplementaryInterface::QueryingQueries(int param),
+ AnsweringQueries(param)
+ )
+
+ IF_IMPL_QUERY( int ComplementaryInterface::SendingMessages(int param),
+ ReceivingMessages(param),
+ (int)"default return value"
+ )
+
+/////////////////////////////////////////////////////////////////////////////
+
+ How do I use it ? - Disconnect/Connect notifications
+
+
+ Usually the virtual methods notifyDisconnect(ed) or notifyConnect(ed)
+ will be called within connect/disconnect methods.
+
+ As constructors and destructors are not able to call virtual methods
+ of derived classes, there are two possible problems:
+
+ * Constructors: Calling a connect method in a constructor will not result
+ in a connect notification of any derived class. Thus do not use connect
+ calls in contructors if any derived class hast to receive all
+ connect/disconnect notifications.
+
+ * Destructors: If connections are still present if the interface destructor
+ is called, it will only call its own empty noticedisconnect method. That
+ shouldn't be a big problem as the derived class is already gone and
+ doesn't have any interest in this notification any more. But it might be
+ possible that the connected object wants to call a function of the just
+ destroyed derived class. That is not possible. Dynamic casts to the
+ derived class will return NULL. Do not try to call methods of this class
+ by use of cached pointers.
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+ Extending and Aggregating Interfaces
+
+ Our interfaces must be extended by aggregation. The reason is that
+ otherwise we would have the same problems as with a common base class
+ for connection management. Each interface extensions is an normal
+ interface on its own.
+
+ Example:
+
+ class I_AM_FM_Radio : public IRadioBase,
+ public IRadioFrequencyExtension,
+ public IRadioSeekExtension
+ {
+ ...
+ };
+
+ To guarantee, that connection management continues to work, we have to overwrite
+ the connect and disconnect methods:
+
+ virtual bool I_AM_FM_Radio::connect (Interface *i) {
+ IRadioBase::connect(i);
+ IFrequencyExtension::connect(i);
+ ISeekExtension::connect(i);
+ }
+
+ virtual bool I_AM_FM_Radio::disconnect (Interface *i) {
+ IRadioBase::disconnect(i);
+ IFrequencyExtension::disconnect(i);
+ ISeekExtension::disconnect(i);
+ }
+
+*/
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+// a polymorphic and *virtual* base class so that we can make use of
+// dynamic_casts in connect/disconnect and to be able to merge
+// connect/disconnect methods to one single function in case of multiple
+// inheritance
+
+class Interface
+{
+public:
+ Interface () {}
+ virtual ~Interface() {}
+
+ virtual bool connectI (Interface *) { return false; }
+ virtual bool disconnectI(Interface *) { return false; }
+
+ // "Interface &"-Versions for convienience, not virtual, only "Interface*"
+ // versions have to / may be overwritten in case of multiple inheritance
+ bool connectI (Interface &i) { return connectI (&i); }
+ bool disconnectI(Interface &i) { return disconnectI (&i); }
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+template <class thisIF, class cmplIF>
+class InterfaceBase : virtual public Interface
+{
+private:
+ typedef InterfaceBase<thisIF, cmplIF> thisClass;
+ typedef InterfaceBase<cmplIF, thisIF> cmplClass;
+
+// friend class cmplClass; // necessary for connects (to keep number of different connect functions low)
+
+public:
+
+ typedef thisIF thisInterface;
+ typedef cmplIF cmplInterface;
+
+ typedef TQPtrList<cmplIF> IFList;
+ typedef TQPtrListIterator<cmplIF> IFIterator;
+
+ typedef thisClass BaseClass;
+
+public :
+ InterfaceBase (int maxIConnections = -1);
+ virtual ~InterfaceBase ();
+
+ // duplicate connects will add no more entries to connection list
+ virtual bool connectI(Interface *i);
+ virtual bool disconnectI(Interface *i);
+
+protected:
+ virtual void disconnectAllI();
+
+
+public:
+
+ // It might be compfortable to derived Interfaces to get an argument
+ // of the Interface class, but that part of the object might
+ // already be destroyed. Thus it is necessary to evaluate the additional
+ // pointer_valid argument. A null pointer is not transmitted, as the
+ // pointer value might be needed to clean up some references in derived
+ // classes
+ virtual void noticeConnectI (cmplInterface *, bool /*pointer_valid*/) {}
+ virtual void noticeConnectedI (cmplInterface *, bool /*pointer_valid*/) {}
+ virtual void noticeDisconnectI (cmplInterface *, bool /*pointer_valid*/);
+ virtual void noticeDisconnectedI(cmplInterface *, bool /*pointer_valid*/) {}
+
+ virtual bool isIConnectionFree() const;
+ virtual unsigned connectedI() const { return iConnections.count(); }
+
+ thisIF *initThisInterfacePointer();
+ thisIF *getThisInterfacePointer() const { return me; }
+ bool isThisInterfacePointerValid() const { return me_valid; }
+ bool hasConnectionTo(cmplInterface *other) const { return iConnections.containsRef(other); }
+ void appendConnectionTo(cmplInterface *other) { iConnections.append(other); }
+ void removeConnectionTo(cmplInterface *other) { iConnections.removeRef(other); }
+
+protected :
+
+ IFList iConnections;
+ int maxIConnections;
+
+ // functions for individually selectable callbacks
+protected:
+ bool addListener (const cmplInterface *i, TQPtrList<cmplInterface> &list);
+ void removeListener(const cmplInterface *i, TQPtrList<cmplInterface> &list);
+ void removeListener(const cmplInterface *i);
+
+ TQMap<const cmplInterface *, TQPtrList<TQPtrList<cmplInterface> > > m_FineListeners;
+
+private:
+ thisInterface *me;
+ bool me_valid;
+};
+
+
+// macros for interface declaration
+
+#define INTERFACE(IF, cmplIF) \
+ class IF; \
+ class cmplIF; \
+ class IF : public InterfaceBase<IF, cmplIF> \
+
+#define IF_CON_DESTRUCTOR(IF, n) \
+ IF() : BaseClass((n)) {} \
+ virtual ~IF() { }
+
+// macros to make sending messages or queries easier
+
+
+// debug util
+#ifdef DEBUG
+ #include <iostream>
+ using namespace std;
+ #define IF_QUERY_DEBUG \
+ if (iConnections.count() > 1) { \
+ kdDebug() << "class " << typeid(this).name() << ": using IF_QUERY with #connections > 1\n"; \
+ }
+#else
+ #define IF_QUERY_DEBUG
+#endif
+
+
+
+// messages
+
+#define SENDERS protected
+#define RECEIVERS public
+
+#define IF_SENDER(decl) \
+ virtual int decl const;
+
+#define IF_SEND_MESSAGE(call) \
+ int ____n = 0; \
+ for (IFIterator i(iConnections); i.current(); ++i) { \
+ if (i.current()->call ) ++____n; \
+ } \
+ return ____n;
+
+#define IF_IMPL_SENDER(decl, call) \
+ int decl const \
+ { \
+ IF_SEND_MESSAGE(call) \
+ }
+
+#define IF_RECEIVER(decl) \
+ virtual bool decl = 0;
+
+#define IF_RECEIVER_EMPTY(decl) \
+ virtual bool decl { return false; }
+
+// queries
+
+#define ANSWERS public
+#define QUERIES protected
+
+#define IF_QUERY(decl) \
+ virtual decl const;
+
+#define IF_SEND_QUERY(call, default) \
+ cmplInterface *o = IFIterator(iConnections).current(); \
+ if (o) { \
+ IF_QUERY_DEBUG \
+ return o->call; \
+ } else { \
+ return default; \
+ } \
+
+#define IF_IMPL_QUERY(decl, call, default) \
+ decl const { \
+ IF_SEND_QUERY(call, default) \
+ }
+
+#define IF_ANSWER(decl) \
+ virtual decl = 0;
+
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+// MACROS for individually selectable callbacks
+/////////////////////////////////////////////////////////////////////////////
+
+
+#define IF_SENDER_FINE(name, param) \
+protected: \
+ int name param const; \
+public: \
+ bool register4_##name (cmplInterface *); \
+ void unregister4_##name(cmplInterface *); \
+private: \
+ TQPtrList<cmplInterface> m_Listeners_##name;\
+
+
+#define IF_SEND_MESSAGE_FINE(name, params, call) \
+ int ____n = 0; \
+ for (TQPtrListIterator<cmplInterface> ____it(m_Listeners_##name); ____it.current(); ++____it) { \
+ if (____it.current()->call ) ++____n; \
+ } \
+ return ____n;
+
+#define IF_IMPL_SENDER_FINE(class, name, param, call) \
+ int class::name param const { \
+ IF_SEND_MESSAGE_FINE(name, param, call) \
+ } \
+ \
+ bool class::register4_##name(cmplInterface *i) { \
+ return addListener(i, m_Listeners_##name); \
+ } \
+ void class::unregister4_##name(cmplInterface *i) { \
+ m_Listeners_##name.remove(i); \
+ }
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+
+template <class thisIF, class cmplIF>
+InterfaceBase<thisIF, cmplIF>::InterfaceBase(int _maxIConnections)
+ : maxIConnections(_maxIConnections),
+ me(NULL),
+ me_valid(false)
+{
+}
+
+
+template <class thisIF, class cmplIF>
+InterfaceBase<thisIF, cmplIF>::~InterfaceBase()
+{
+ me_valid = false;
+ // In this state the derived interfaces may already be destroyed
+ // so that dereferencing cached upcasted me-pointers in noticeDisconnect(ed)
+ // will fail.
+ // Thus we must ensure that disconnectAll() is called in the (upper) thisIF
+ // destructor, not here (see macro IF_CON_DESTRUCTOR).
+ // If this has not taken place (i.e. the programmer forgot to do so)
+ // we can only warn, clear our list now and hope that nothing
+ // more bad will happen
+
+ if (iConnections.count() > 0) {
+ thisClass::disconnectAllI();
+ }
+}
+
+
+template <class thisIF, class cmplIF>
+bool InterfaceBase<thisIF, cmplIF>::isIConnectionFree () const
+{
+ int m = maxIConnections;
+ return (m < 0) || (iConnections.count() < (unsigned) m);
+}
+
+template <class thisIF, class cmplIF>
+thisIF *InterfaceBase<thisIF, cmplIF>::initThisInterfacePointer()
+{
+ if (!me) me = dynamic_cast<thisIF*>(this);
+ me_valid = me != NULL;
+ return me;
+}
+
+template <class thisIF, class cmplIF>
+bool InterfaceBase<thisIF, cmplIF>::connectI (Interface *__i)
+{
+ // cache upcasted pointer, especially important for disconnects
+ // where already destructed derived parts cannot be reached with dynamic casts
+ initThisInterfacePointer();
+
+ // same with the other interface
+ cmplClass *_i = dynamic_cast<cmplClass*>(__i);
+ if (!_i) {
+ return false;
+ }
+
+ cmplIF *i = _i->initThisInterfacePointer();
+
+ if (i && me) {
+ bool i_connected = iConnections.containsRef(i);
+ bool me_connected = i->hasConnectionTo(me);
+
+ if (i_connected || me_connected) {
+ return true;
+ } else if (isIConnectionFree() && i->isIConnectionFree()) {
+
+ noticeConnectI(i, i != NULL);
+ _i->noticeConnectI(me, me != NULL);
+
+ if (!i_connected)
+ appendConnectionTo(i);
+ if (!me_connected)
+ _i->appendConnectionTo(me);
+
+ noticeConnectedI(i, i != NULL);
+ _i->noticeConnectedI(me, me != NULL);
+
+ return true;
+ } else {
+ return false;
+ }
+ }
+ return false;
+}
+
+
+
+template <class thisIF, class cmplIF>
+bool InterfaceBase<thisIF, cmplIF>::disconnectI (Interface *__i)
+{
+ cmplClass *_i = dynamic_cast<cmplClass*>(__i);
+
+ // use cache to find pointer in connections list
+ cmplIF *i = _i ? _i->getThisInterfacePointer() : NULL;
+
+ // The cached me pointer might already point to an destroyed
+ // object. We must use it only for identifying the entry in
+ // connections list
+
+ if (i && _i) {
+ if (me_valid)
+ noticeDisconnectI(i, _i->isThisInterfacePointerValid());
+ }
+
+ if (me && _i) {
+ if (_i->isThisInterfacePointerValid())
+ _i->noticeDisconnectI(me, me_valid);
+ }
+
+ if (i && hasConnectionTo(i)) {
+ removeListener(i);
+ removeConnectionTo(i);
+ }
+
+ if (me && i && i->hasConnectionTo(me))
+ i->removeConnectionTo(me);
+
+ if (me_valid && i && _i)
+ noticeDisconnectedI(i, _i->isThisInterfacePointerValid());
+ if (_i && _i->isThisInterfacePointerValid() && me)
+ _i->noticeDisconnectedI(me, me_valid);
+
+ return true;
+}
+
+
+template <class thisIF, class cmplIF>
+void InterfaceBase<thisIF, cmplIF>::noticeDisconnectI(cmplInterface *i, bool /*pointer_valid*/)
+{
+ removeListener(i);
+}
+
+
+template <class thisIF, class cmplIF>
+void InterfaceBase<thisIF, cmplIF>::disconnectAllI()
+{
+ IFList tmp = iConnections;
+ for (IFIterator it(tmp); it.current(); ++it) {
+ /* Do not call virtual methods if I'm in the contstructor!
+ Actually this should be ensured by the compiler generated
+ code and virtual method tables, but unfortunately some compilers
+ seem to ignore this in some situations.
+ */
+ if (me_valid)
+ disconnectI(it.current());
+ else
+ thisClass::disconnectI(it.current());
+ }
+}
+
+
+
+
+template <class thisIF, class cmplIF>
+bool InterfaceBase<thisIF, cmplIF>::addListener(const cmplInterface *i, TQPtrList<cmplInterface> &list)
+{
+ if (iConnections.containsRef(i) && !list.contains(i)) {
+ list.append(i);
+ m_FineListeners[i].append(&list);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+
+template <class thisIF, class cmplIF>
+void InterfaceBase<thisIF, cmplIF>::removeListener(const cmplInterface *i, TQPtrList<cmplInterface> &list)
+{
+ list.remove(i);
+ if (m_FineListeners.contains(i))
+ m_FineListeners[i].remove(&list);
+}
+
+
+template <class thisIF, class cmplIF>
+void InterfaceBase<thisIF, cmplIF>::removeListener(const cmplInterface *i)
+{
+ if (m_FineListeners.contains(i)) {
+ TQPtrList<TQPtrList<cmplInterface> > &list = m_FineListeners[i];
+ TQPtrListIterator<TQPtrList<cmplInterface> > it(list);
+ for (; it.current(); ++it) {
+ (*it)->remove(i);
+ }
+ }
+ m_FineListeners.remove(i);
+}
+
+
+
+
+
+
+
+#endif
diff --git a/src/include/internetradiostation.h b/src/include/internetradiostation.h
new file mode 100644
index 0000000..716dba2
--- /dev/null
+++ b/src/include/internetradiostation.h
@@ -0,0 +1,75 @@
+/***************************************************************************
+ internetradiostation.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_INTERNETRADIOSTATION_H
+#define KRADIO_INTERNETRADIOSTATION_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "radiostation.h"
+
+// KDE includes
+#include <kurl.h>
+
+/**
+ * @author Klas Kalass, Ernst Martin Witte
+ */
+
+class InternetRadioStation : public RadioStation {
+public:
+ InternetRadioStation();
+ InternetRadioStation(KURL const &url);
+ InternetRadioStation(const TQString &name, const TQString &shortName, KURL const &url);
+ InternetRadioStation(const InternetRadioStation &);
+ InternetRadioStation(RegisterStationClass, const TQString &classname = TQString());
+ ~InternetRadioStation();
+
+ const KURL & url() const { return m_url; }
+ void setUrl(KURL const &url) { m_url = url; }
+
+ virtual TQString longName() const;
+ virtual TQString description() const;
+ virtual bool isValid () const;
+
+ /* = 0 : this.url == s.url
+ > 0 : this.url > s.url
+ < 0 : this.url < s.url
+ other class than InternetRadioStation: compare typeid(.).name()
+ */
+ virtual int compare (const RadioStation &s) const;
+
+ /** returns an exact copy of this station */
+ virtual RadioStation *copy() const;
+ virtual RadioStation *copyNewID() const;
+
+ virtual RadioStationConfig *createEditor() const;
+
+ // for XML-Parsing/Export
+ virtual bool setProperty(const TQString &property_name, const TQString &val);
+ virtual TQString getProperty(const TQString &property_name) const;
+ virtual TQStringList getPropertyNames() const;
+ virtual TQString getClassName() const { return "InternetRadioStation"; }
+
+ virtual bool operator == (const RadioStation &x) const;
+
+protected:
+ KURL m_url;
+};
+
+#endif
diff --git a/src/include/multibuffer.h b/src/include/multibuffer.h
new file mode 100644
index 0000000..e0ed05c
--- /dev/null
+++ b/src/include/multibuffer.h
@@ -0,0 +1,65 @@
+/***************************************************************************
+ multibuffer.h
+ -------------------
+ begin : Sat Aug 20 2005
+ copyright : (C) 2005 by Martin Witte
+ email : 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_MULTIBUFFER_H
+#define KRADIO_MULTIBUFFER_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tqsemaphore.h>
+#include <tqstring.h>
+
+class MultiBuffer
+{
+public:
+ MultiBuffer(size_t n_buffers, size_t buffersize);
+ ~MultiBuffer();
+
+ char *lockWriteBuffer (size_t &bufferSize);
+ bool unlockWriteBuffer (size_t bufferSize); // return value: complete buffer full / ready for read
+ void unlockAllWriteBuffers();
+ char *wait4ReadBuffer (size_t &buffer_fill);
+ char *getCurrentReadBuffer(size_t &buffer_fill) const;
+
+ const TQString &getErrorString() const { return m_errorString; }
+ bool hasError() const { return m_error; }
+ void resetError();
+
+ size_t getWriteBufferFill() const { return (m_currentReadBuffer != m_currentWriteBuffer) ? m_buffersFill[m_currentWriteBuffer] : 0; }
+ size_t getAvailableWriteBuffer() const;
+ size_t getAvailableReadBuffers() const;
+ size_t getCurrentReadBufferIdx() const { return m_currentReadBuffer; }
+ size_t getCurrentWriteBufferIdx() const { return m_currentWriteBuffer; }
+
+protected:
+
+ size_t m_nBuffers;
+ size_t m_BufferSize;
+
+ char **m_buffers;
+ size_t *m_buffersFill;
+ size_t m_currentReadBuffer;
+ size_t m_currentWriteBuffer;
+ TQSemaphore m_readLock;
+
+ TQString m_errorString;
+ bool m_error;
+};
+
+#endif
diff --git a/src/include/plugin_configuration_dialog.h b/src/include/plugin_configuration_dialog.h
new file mode 100644
index 0000000..b273207
--- /dev/null
+++ b/src/include/plugin_configuration_dialog.h
@@ -0,0 +1,75 @@
+/***************************************************************************
+ plugin_configuration_dialog.h - description
+ -------------------
+ begin : Sam Jun 21 2003
+ copyright : (C) 2003 by Martin Witte
+ email : 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_PLUGIN_CONFIGURATION_DIALOG
+#define KRADIO_PLUGIN_CONFIGURATION_DIALOG
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <kdialogbase.h>
+#include "widgetplugins.h"
+
+class PluginConfigurationDialog : public KDialogBase,
+ public WidgetPluginBase
+{
+
+Q_OBJECT
+
+
+public:
+ PluginConfigurationDialog(
+ int dialogFace, const TQString &caption,
+ int buttonMask, ButtonCode defaultButton,
+ TQWidget *parent=0, const char *name=0,
+ bool modal=true, bool separator=false);
+
+ // PluginBase
+
+ virtual TQString pluginClassName() const { return "PluginConfigurationDialog"; }
+
+ virtual void saveState (TDEConfig *) const;
+ virtual void restoreState (TDEConfig *);
+
+protected :
+
+ virtual ConfigPageInfo createConfigurationPage();
+ virtual AboutPageInfo createAboutPage();
+
+ // WidgetPluginBase
+
+public slots:
+ void toggleShown() { WidgetPluginBase::pToggleShown(); }
+ virtual void showOnOrgDesktop();
+ virtual void show();
+ virtual void hide();
+ virtual void cancel() { slotCancel(); }
+
+ // TQWidget overrides
+
+protected:
+ virtual void showEvent(TQShowEvent *);
+ virtual void hideEvent(TQHideEvent *);
+
+ virtual TQWidget *getWidget() { return this; }
+ virtual const TQWidget *getWidget() const { return this; }
+
+ TQString m_Caption;
+};
+
+
+#endif
diff --git a/src/include/pluginmanager-configuration.h b/src/include/pluginmanager-configuration.h
new file mode 100644
index 0000000..970aca2
--- /dev/null
+++ b/src/include/pluginmanager-configuration.h
@@ -0,0 +1,61 @@
+/***************************************************************************
+ pluginmanager-configuration.h - description
+ -------------------
+ begin : Thu Sep 30 2004
+ copyright : (C) 2004 by Martin Witte
+ email : 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_PLUGINMANAGER_CONFIGURATION_H
+#define KRADIO_PLUGINMANAGER_CONFIGURATION_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <pluginmanager-configuration-ui.h>
+
+class TQWidget;
+class TDERadioApp;
+class PluginManager;
+
+class PluginManagerConfiguration : public PluginManagerConfigurationUI
+{
+Q_OBJECT
+
+public :
+ PluginManagerConfiguration (TQWidget *parent, TDERadioApp *app, PluginManager *pm);
+ ~PluginManagerConfiguration ();
+
+ void noticePluginLibrariesChanged();
+ void noticePluginsChanged();
+
+protected slots:
+
+ void slotOK();
+ void slotCancel();
+
+ void slotAddLibrary();
+ void slotRemoveLibrary();
+ void slotNewPluginInstance();
+ void slotRemovePluginInstance();
+ void slotSetDirty();
+
+protected:
+
+ TDERadioApp *m_Application;
+ PluginManager *m_PluginManager;
+ bool m_dirty;
+
+};
+
+#endif
diff --git a/src/include/pluginmanager.h b/src/include/pluginmanager.h
new file mode 100644
index 0000000..3bf13f4
--- /dev/null
+++ b/src/include/pluginmanager.h
@@ -0,0 +1,148 @@
+/***************************************************************************
+ pluginmanager.h - description
+ -------------------
+ begin : Mon Apr 28 2003
+ copyright : (C) 2003 by Martin Witte
+ email : 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_PLUGINMANAGER_INTERFACES_H
+#define KRADIO_PLUGINMANAGER_INTERFACES_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tqstring.h>
+#include <tqptrdict.h>
+
+#include "plugins.h"
+
+class PluginBase;
+class WidgetPluginBase;
+class PluginConfigurationDialog;
+class PluginManagerConfiguration;
+class TQWidget;
+class TDEConfig;
+class TQFrame;
+class TDEAboutDialog;
+class KDialogBase;
+
+struct ConfigPageInfo;
+class TQMenuData;
+class TDERadioApp;
+
+
+class PluginManager : public TQObject
+{
+Q_OBJECT
+
+public :
+ PluginManager(const TQString &name,
+ TDERadioApp *app,
+ const TQString &configDialogTitle,
+ const TQString &aboutTitle);
+ virtual ~PluginManager();
+
+ // Library Functions
+
+ void noticeLibrariesChanged();
+ void unloadPlugins(const TQString &class_name);
+
+ // managing plugins
+
+ const PluginList &plugins() const { return m_plugins; }
+ void addWidgetPluginMenuItems(TQMenuData *menu, TQMap<WidgetPluginBase *,int> &map) const;
+ void updateWidgetPluginMenuItem(WidgetPluginBase *p, TQMenuData *menu, TQMap<WidgetPluginBase *,int> &map, bool shown) const;
+
+ PluginBase *getPluginByName(const TQString &name) const;
+
+ // after insert, pluginManager is responsible for deletion
+ void insertPlugin(PluginBase *);
+
+ // remove and delete plugin
+ void deletePlugin(PluginBase *);
+ void deletePluginByName(const TQString &name) { deletePlugin(getPluginByName(name)); }
+
+ // remove plugin, afterwards pluginManager is no longer responsible for deletion
+ void removePlugin(PluginBase *);
+ void removePluginByName(const TQString &name) { removePlugin(getPluginByName(name)); }
+
+ // operations on all plugins
+
+ virtual void saveState (TDEConfig *) const;
+ virtual void restoreState (TDEConfig *);
+ virtual void startPlugins();
+
+ // configuration dialog handling
+
+ virtual PluginConfigurationDialog *getConfigDialog();
+ virtual KDialogBase *getAboutDialog();
+ virtual bool showsProgressBar() const { return m_showProgressBar; }
+ virtual void showProgressBar(bool b) { m_showProgressBar = b; }
+
+ virtual void noticeWidgetPluginShown(WidgetPluginBase *p, bool shown);
+
+protected :
+ virtual void createConfigDialog(const TQString &title = TQString());
+ virtual void createAboutDialog (const TQString &title = TQString());
+
+ virtual void addConfigurationPage (PluginBase *forWhom,
+ const ConfigPageInfo &info);
+ virtual void addAboutPage (PluginBase *forWhom,
+ const AboutPageInfo &info);
+
+protected slots:
+
+ virtual void slotConfigOK();
+
+public slots:
+ virtual void aboutToQuit();
+
+signals:
+
+ virtual void sigConfigOK();
+
+private:
+ virtual TQFrame *addConfigurationPage (const ConfigPageInfo &info);
+ ConfigPageInfo createOwnConfigurationPage();
+
+ // PluginManager's data & types ;)
+protected:
+ typedef TQPtrDict<TQFrame> TQFrameDict;
+ typedef TQPtrDictIterator<TQFrame> TQFrameDictIterator;
+ typedef TQPtrDict<TQWidget> TQWidgetDict;
+ typedef TQPtrDictIterator<TQWidget> TQWidgetDictIterator;
+
+ TQString m_Name;
+ TDERadioApp *m_Application;
+
+ PluginList m_plugins;
+ bool m_showProgressBar;
+
+ TQFrameDict m_configPageFrames;
+ TQWidgetDict m_configPages;
+
+ TQFrameDict m_aboutPageFrames;
+ TQWidgetDict m_aboutPages;
+
+ PluginConfigurationDialog *m_configDialog;
+ PluginManagerConfiguration*m_pluginManagerConfiguration;
+ KDialogBase *m_aboutDialog;
+ TQString m_configDialogTitle;
+ TQString m_aboutDialogTitle;
+};
+
+
+
+
+#endif
diff --git a/src/include/plugins.h b/src/include/plugins.h
new file mode 100644
index 0000000..c39b65e
--- /dev/null
+++ b/src/include/plugins.h
@@ -0,0 +1,192 @@
+/***************************************************************************
+ plugins.h - description
+ -------------------
+ begin : Mon Mär 10 2003
+ copyright : (C) 2003 by Martin Witte
+ email : 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_PLUGINS_INTERFACES_H
+#define KRADIO_PLUGINS_INTERFACES_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tdeglobal.h>
+
+#include "errorlog-interfaces.h"
+#include <tqstring.h>
+#include <tqobject.h>
+#include <tqptrlist.h>
+
+class PluginManager;
+class PluginBase;
+class TQWidget;
+class TDEConfig;
+
+typedef TQPtrList<PluginBase> PluginList;
+typedef TQPtrListIterator<PluginBase> PluginIterator;
+
+/* PluginBase must be inherited from Interface so that a plugin can be used
+ in Interface::connect functions.
+
+ PluginBase must not be inherited from TQObject, because derived classes may
+ be inherited e.g. from TQWidget (multiple inheritance is not possible with
+ OBjects). But we must be able to receive destroy messages e.g. from
+ configuration pages. Thus we need the special callback member
+ m_destroyNotifier.
+
+ PluginBase is derived from Interface to provide connection facilities.
+ In case of multiple inheritance from interface classes, connect and disconnect
+ methods have to be reimplemented in order to call all inherited
+ connect/disconnect methods.
+
+*/
+
+
+class WidgetPluginBase;
+
+struct ConfigPageInfo
+{
+ ConfigPageInfo () : page(NULL) {}
+ ConfigPageInfo (TQWidget *p,
+ const TQString &in,
+ const TQString &ph,
+ const TQString &icon)
+ : page (p),
+ itemName(in),
+ pageHeader(ph),
+ iconName(icon)
+ {}
+
+ TQWidget *page;
+ TQString itemName,
+ pageHeader,
+ iconName;
+};
+
+typedef ConfigPageInfo AboutPageInfo;
+
+
+class PluginBase : public IErrorLogClient
+{
+friend class PluginManager;
+public :
+ PluginBase(const TQString &name, const TQString &description);
+ virtual ~PluginBase();
+
+ virtual TQString pluginClassName() const = 0;
+
+ const TQString &name() const { return m_name; }
+ TQString &name() { return m_name; }
+
+ const TQString &description() const { return m_description; }
+
+ // workaround for compiler bugs
+ bool destructorCalled() const { return m_destructorCalled; }
+
+ // interaction with pluginmanager
+protected:
+ bool setManager (PluginManager *);
+ void unsetManager ();
+ bool isManagerSet () const;
+
+public:
+
+ // these two methods will request a configuration page or
+ // plugin page from plugin manager
+ // they will be deleted automatically when this plugin
+ // is deleted, because we disconnect from pluginmanager
+ // and the plugin manager will delete all associated gui elements
+ virtual ConfigPageInfo createConfigurationPage () = 0;
+ virtual AboutPageInfo createAboutPage () = 0;
+
+ // save/restore status, window position, etc...
+
+ virtual void saveState (TDEConfig *) const = 0;
+ virtual void restoreState (TDEConfig *) = 0;
+ virtual void startPlugin();
+
+ virtual void aboutToQuit();
+
+ //
+
+ virtual void noticeWidgetPluginShown(WidgetPluginBase *, bool /*shown*/) {}
+ virtual void noticePluginsChanged(const PluginList &) {}
+
+protected :
+ TQString m_name;
+ TQString m_description;
+ PluginManager *m_manager;
+ bool m_destructorCalled;
+};
+
+
+#define PLUGIN_LIBRARY_FUNCTIONS(class_name, i18nName, description) \
+extern "C" void TDERadioPlugin_LoadLibrary() \
+{ \
+ TDEGlobal::locale()->insertCatalogue(i18nName); \
+} \
+ \
+extern "C" void TDERadioPlugin_UnloadLibrary() \
+{ \
+ TDEGlobal::locale()->removeCatalogue(i18nName); \
+} \
+ \
+extern "C" void TDERadioPlugin_GetAvailablePlugins(TQMap<TQString, TQString> &info) \
+{ \
+ info.insert(#class_name, (description)); \
+} \
+ \
+extern "C" PluginBase *TDERadioPlugin_CreatePlugin(const TQString &type, const TQString &object_name) \
+{ \
+ if (type == #class_name) { \
+ return new class_name(object_name); \
+ } else { \
+ return NULL; \
+ } \
+}
+
+
+#define PLUGIN_LIBRARY_FUNCTIONS2(class_name1, i18nName, description1, class_name2, description2) \
+extern "C" void TDERadioPlugin_LoadLibrary() \
+{ \
+ TDEGlobal::locale()->insertCatalogue(i18nName); \
+} \
+ \
+extern "C" void TDERadioPlugin_UnloadLibrary() \
+{ \
+ TDEGlobal::locale()->removeCatalogue(i18nName); \
+} \
+ \
+extern "C" void TDERadioPlugin_GetAvailablePlugins(TQMap<TQString, TQString> &info) \
+{ \
+ info.insert(#class_name1, (description1)); \
+ info.insert(#class_name2, (description2)); \
+} \
+ \
+extern "C" PluginBase *TDERadioPlugin_CreatePlugin(const TQString &type, const TQString &object_name) \
+{ \
+ if (type == #class_name1) { \
+ return new class_name1(object_name); \
+ } else if (type == #class_name2) { \
+ return new class_name2(object_name); \
+ } else { \
+ return NULL; \
+ } \
+}
+
+
+#endif
diff --git a/src/include/radio_interfaces.h b/src/include/radio_interfaces.h
new file mode 100644
index 0000000..009df8c
--- /dev/null
+++ b/src/include/radio_interfaces.h
@@ -0,0 +1,117 @@
+/***************************************************************************
+ radio_interfaces.h - description
+ -------------------
+ begin : Mon Mär 10 2003
+ copyright : (C) 2003 by Martin Witte
+ email : 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. *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * Interfaces in this header: *
+ * *
+ * IRadio(Client) *
+ * *
+ ***************************************************************************/
+
+#ifndef KRADIO_RADIO_INTERFACES_H
+#define KRADIO_RADIO_INTERFACES_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "interfaces.h"
+#include "soundstreamid.h"
+
+class RadioStation;
+class StationList;
+
+
+///////////////////////////////////////////////////////////////////////
+
+
+INTERFACE(IRadio, IRadioClient)
+{
+public :
+ IF_CON_DESTRUCTOR(IRadio, -1)
+
+RECEIVERS:
+ IF_RECEIVER( powerOn() )
+ IF_RECEIVER( powerOff() )
+ IF_RECEIVER( activateStation(const RadioStation &rs) )
+ IF_RECEIVER( activateStation(int index) )
+ IF_RECEIVER( setStations(const StationList &sl) )
+ IF_RECEIVER( setPresetFile(const TQString &f) )
+
+SENDERS:
+ IF_SENDER ( notifyPowerChanged(bool on) )
+ IF_SENDER ( notifyStationChanged (const RadioStation &, int idx) )
+ IF_SENDER ( notifyStationsChanged(const StationList &sl) )
+ IF_SENDER ( notifyPresetFileChanged(const TQString &sl) )
+ IF_SENDER ( notifyCurrentSoundStreamIDChanged(SoundStreamID id) )
+
+ANSWERS:
+ IF_ANSWER ( bool isPowerOn() const )
+ IF_ANSWER ( bool isPowerOff() const )
+ IF_ANSWER ( const RadioStation & getCurrentStation() const )
+ IF_ANSWER ( int getStationIdx(const RadioStation &rs) const )
+ IF_ANSWER ( int getCurrentStationIdx() const )
+ IF_ANSWER ( const StationList & getStations() const )
+ IF_ANSWER ( const TQString & getPresetFile() const );
+
+ IF_ANSWER ( SoundStreamID getCurrentSoundStreamID() const );
+
+};
+
+
+INTERFACE(IRadioClient, IRadio)
+{
+friend class IRadio;
+
+public :
+ IF_CON_DESTRUCTOR(IRadioClient, 1)
+
+SENDERS:
+ IF_SENDER ( sendPowerOn() )
+ IF_SENDER ( sendPowerOff() )
+ IF_SENDER ( sendActivateStation(const RadioStation &rs) )
+ IF_SENDER ( sendActivateStation(int index) )
+ IF_SENDER ( sendStations(const StationList &sl) )
+ IF_SENDER ( sendPresetFile(const TQString &f) )
+
+RECEIVERS:
+ IF_RECEIVER( noticePowerChanged(bool on) )
+ IF_RECEIVER( noticeStationChanged (const RadioStation &, int idx) )
+ IF_RECEIVER( noticeStationsChanged(const StationList &sl) )
+ IF_RECEIVER( noticePresetFileChanged(const TQString &f) )
+ IF_RECEIVER( noticeCurrentSoundStreamIDChanged(SoundStreamID id))
+
+QUERIES:
+ IF_QUERY ( bool queryIsPowerOn() )
+ IF_QUERY ( bool queryIsPowerOff() )
+ IF_QUERY ( const RadioStation & queryCurrentStation() )
+ IF_QUERY ( int queryStationIdx(const RadioStation &rs) )
+ IF_QUERY ( int queryCurrentStationIdx() )
+ IF_QUERY ( const StationList & queryStations() )
+ IF_QUERY ( const TQString & queryPresetFile() )
+
+ IF_QUERY ( SoundStreamID queryCurrentSoundStreamID() );
+
+RECEIVERS:
+ virtual void noticeConnectedI (cmplInterface *, bool pointer_valid);
+ virtual void noticeDisconnectedI (cmplInterface *, bool pointer_valid);
+};
+
+
+
+#endif
diff --git a/src/include/radiodevice_interfaces.h b/src/include/radiodevice_interfaces.h
new file mode 100644
index 0000000..f1e3438
--- /dev/null
+++ b/src/include/radiodevice_interfaces.h
@@ -0,0 +1,353 @@
+/***************************************************************************
+ radiodevice_interfaces.h - description
+ -------------------
+ begin : Fre Apr 18 2003
+ copyright : (C) 2003 by Martin Witte
+ email : 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. *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * Interfaces in this header: *
+ * *
+ * IRadioDevice(Client) *
+ * IRadioSound(Client) *
+ * ISeekRadio(Client) *
+ * IFrequencyRadio(Client) *
+ * IInternetRadio(Client) *
+ * *
+ ***************************************************************************/
+
+#ifndef KRADIO_RADIODEVICE_INTERFACES_H
+#define KRADIO_RADIODEVICE_INTERFACES_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "soundstreamid.h"
+#include "interfaces.h"
+
+class RadioStation;
+class KURL;
+
+INTERFACE(IRadioDevice, IRadioDeviceClient)
+{
+public:
+ IF_CON_DESTRUCTOR(IRadioDevice, -1)
+
+RECEIVERS:
+ IF_RECEIVER( setPower(bool on) )
+ IF_RECEIVER( powerOn() )
+ IF_RECEIVER( powerOff() )
+ IF_RECEIVER( activateStation(const RadioStation &rs) )
+
+SENDERS:
+ IF_SENDER ( notifyPowerChanged(bool on) )
+ IF_SENDER ( notifyStationChanged (const RadioStation &) )
+ IF_SENDER ( notifyDescriptionChanged (const TQString &) )
+ IF_SENDER ( notifyCurrentSoundStreamIDChanged(SoundStreamID id))
+
+ANSWERS:
+ IF_ANSWER ( bool isPowerOn() const );
+ IF_ANSWER ( bool isPowerOff() const );
+ IF_ANSWER ( const RadioStation & getCurrentStation() const );
+ IF_ANSWER ( const TQString & getDescription() const );
+
+ IF_ANSWER ( SoundStreamID getCurrentSoundStreamID() const );
+};
+
+
+
+INTERFACE(IRadioDeviceClient, IRadioDevice)
+{
+public :
+ IF_CON_DESTRUCTOR(IRadioDeviceClient, 1);
+ IRadioDeviceClient(int _maxConnections) : IRadioDeviceClient::BaseClass(_maxConnections) {}
+
+SENDERS:
+ IF_SENDER ( sendPower(bool on) )
+ IF_SENDER ( sendPowerOn() )
+ IF_SENDER ( sendPowerOff() )
+ IF_SENDER ( sendActivateStation (const RadioStation &rs) )
+
+RECEIVERS:
+ IF_RECEIVER( noticePowerChanged (bool on, const IRadioDevice *sender = NULL) )
+ IF_RECEIVER( noticeStationChanged (const RadioStation &, const IRadioDevice *sender = NULL) )
+ IF_RECEIVER( noticeDescriptionChanged (const TQString &, const IRadioDevice *sender = NULL) )
+ IF_RECEIVER( noticeCurrentSoundStreamIDChanged(SoundStreamID id, const IRadioDevice *sender = NULL))
+
+QUERIES:
+ IF_QUERY ( bool queryIsPowerOn() )
+ IF_QUERY ( bool queryIsPowerOff() )
+ IF_QUERY ( const RadioStation & queryCurrentStation() )
+ IF_QUERY ( const TQString & queryDescription() )
+
+ IF_QUERY ( SoundStreamID queryCurrentSoundStreamID() )
+
+RECEIVERS:
+ virtual void noticeConnectedI (cmplInterface *, bool pointer_valid);
+ virtual void noticeDisconnectedI (cmplInterface *, bool pointer_valid);
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+// deprecated, use IRadioSoundStreamClient
+/*
+INTERFACE(IRadioSound, IRadioSoundClient)
+{
+public :
+ IF_CON_DESTRUCTOR(IRadioSound, -1)
+
+RECEIVERS:
+ IF_RECEIVER( setVolume (float v) )
+ IF_RECEIVER( setTreble (float v) )
+ IF_RECEIVER( setBass (float v) )
+ IF_RECEIVER( setBalance (float v) )
+ IF_RECEIVER( mute (bool mute) )
+ IF_RECEIVER( unmute (bool unmute) )
+ IF_RECEIVER( setSignalMinQuality(float q) )
+ IF_RECEIVER( setStereo(bool s) )
+
+SENDERS:
+ IF_SENDER ( notifyVolumeChanged(float v) )
+ IF_SENDER ( notifyTrebleChanged(float v) )
+ IF_SENDER ( notifyBassChanged(float v) )
+ IF_SENDER ( notifyBalanceChanged(float v) )
+ IF_SENDER ( notifyMuted(bool m) )
+ IF_SENDER ( notifySignalQualityChanged(float q) )
+ IF_SENDER ( notifySignalQualityBoolChanged(bool good) )
+ IF_SENDER ( notifySignalMinQualityChanged(float q) )
+ IF_SENDER ( notifyStereoChanged(bool s) )
+
+ANSWERS:
+ IF_ANSWER ( float getVolume() const )
+ IF_ANSWER ( float getTreble() const )
+ IF_ANSWER ( float getBass () const )
+ IF_ANSWER ( float getBalance () const )
+ IF_ANSWER ( bool isMuted() const )
+ IF_ANSWER ( float getSignalQuality() const )
+ IF_ANSWER ( float getSignalMinQuality() const )
+ IF_ANSWER ( bool hasGoodQuality() const )
+ IF_ANSWER ( bool isStereo() const )
+};
+
+
+INTERFACE(IRadioSoundClient, IRadioSound)
+{
+public :
+ IF_CON_DESTRUCTOR(IRadioSoundClient, 1)
+
+SENDERS:
+ IF_SENDER ( sendVolume (float v) )
+ IF_SENDER ( sendTreble (float v) )
+ IF_SENDER ( sendBass (float v) )
+ IF_SENDER ( sendBalance (float v) )
+ IF_SENDER ( sendMute (bool mute = true) )
+ IF_SENDER ( sendUnmute (bool unmute = true) )
+ IF_SENDER ( sendSignalMinQuality (float q) )
+ IF_SENDER ( sendStereo(bool s) )
+
+RECEIVERS:
+ IF_RECEIVER( noticeVolumeChanged(float v) )
+ IF_RECEIVER( noticeTrebleChanged(float v) )
+ IF_RECEIVER( noticeBassChanged(float v) )
+ IF_RECEIVER( noticeBalanceChanged(float v) )
+ IF_RECEIVER( noticeSignalQualityChanged(float q) )
+ IF_RECEIVER( noticeSignalQualityChanged(bool good) )
+ IF_RECEIVER( noticeSignalMinQualityChanged(float q) )
+ IF_RECEIVER( noticeStereoChanged(bool s) )
+ IF_RECEIVER( noticeMuted(bool m) )
+
+QUERIES:
+ IF_QUERY ( float queryVolume() )
+ IF_QUERY ( float queryTreble() )
+ IF_QUERY ( float queryBass() )
+ IF_QUERY ( float queryBalance () )
+ IF_QUERY ( float querySignalQuality() )
+ IF_QUERY ( float querySignalMinQuality() )
+ IF_QUERY ( bool queryHasGoodQuality() )
+ IF_QUERY ( bool queryIsStereo() )
+ IF_QUERY ( bool queryIsMuted() )
+
+RECEIVERS:
+ virtual void noticeConnectedI (cmplInterface *, bool pointer_valid);
+ virtual void noticeDisconnectedI (cmplInterface *, bool pointer_valid);
+};
+*/
+
+/////////////////////////////////////////////////////////////////////////////
+INTERFACE(ISeekRadio, ISeekRadioClient)
+{
+ friend class SeekHelper;
+
+public :
+ IF_CON_DESTRUCTOR(ISeekRadio, -1)
+
+RECEIVERS:
+ IF_RECEIVER( toBeginning() )
+ IF_RECEIVER( toEnd() )
+ IF_RECEIVER( startSeek (bool up) )
+ IF_RECEIVER( startSeekUp() )
+ IF_RECEIVER( startSeekDown() )
+ IF_RECEIVER( stopSeek() )
+
+SENDERS:
+ IF_SENDER ( notifySeekStarted (bool up) )
+ IF_SENDER ( notifySeekStopped () )
+ IF_SENDER ( notifySeekFinished (const RadioStation &s, bool goodQuality) )
+ IF_SENDER ( notifyProgress (float f) )
+
+ANSWERS:
+ IF_ANSWER ( bool isSeekRunning() const )
+ IF_ANSWER ( bool isSeekUpRunning() const )
+ IF_ANSWER ( bool isSeekDownRunning() const )
+ IF_ANSWER ( float getProgress () const )
+};
+
+
+INTERFACE(ISeekRadioClient, ISeekRadio)
+{
+public :
+ IF_CON_DESTRUCTOR(ISeekRadioClient, 1)
+
+SENDERS:
+ IF_SENDER ( sendToBeginning() )
+ IF_SENDER ( sendToEnd() )
+ IF_SENDER ( sendStartSeek (bool up) )
+ IF_SENDER ( sendStartSeekUp() )
+ IF_SENDER ( sendStartSeekDown() )
+ IF_SENDER ( sendStopSeek() )
+
+RECEIVERS:
+ IF_RECEIVER( noticeSeekStarted (bool up) )
+ IF_RECEIVER( noticeSeekStopped () )
+ IF_RECEIVER( noticeSeekFinished (const RadioStation &s, bool goodQuality) )
+ IF_RECEIVER( noticeProgress (float f) )
+
+QUERIES:
+ IF_QUERY ( bool queryIsSeekRunning() )
+ IF_QUERY ( bool queryIsSeekUpRunning() )
+ IF_QUERY ( bool queryIsSeekDownRunning() )
+ IF_QUERY ( float queryProgress () )
+
+RECEIVERS:
+ virtual void noticeConnectedI (cmplInterface *, bool pointer_valid);
+ virtual void noticeDisconnectedI (cmplInterface *, bool pointer_valid);
+};
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+INTERFACE(IFrequencyRadio, IFrequencyRadioClient)
+{
+public :
+ IF_CON_DESTRUCTOR(IFrequencyRadio, -1)
+
+RECEIVERS:
+ IF_RECEIVER( setFrequency(float f) )
+ IF_RECEIVER( setMinFrequency(float mf) )
+ IF_RECEIVER( setMaxFrequency(float mf) )
+ IF_RECEIVER( setScanStep(float s) )
+
+SENDERS:
+ IF_SENDER ( notifyFrequencyChanged(float f, const RadioStation *s) )
+ IF_SENDER ( notifyMinMaxFrequencyChanged(float min, float max) )
+ IF_SENDER ( notifyDeviceMinMaxFrequencyChanged(float min, float max) )
+ IF_SENDER ( notifyScanStepChanged(float s) )
+
+ANSWERS:
+ IF_ANSWER ( float getFrequency() const )
+ IF_ANSWER ( float getMinFrequency() const )
+ IF_ANSWER ( float getMinDeviceFrequency() const )
+ IF_ANSWER ( float getMaxFrequency() const )
+ IF_ANSWER ( float getMaxDeviceFrequency() const )
+ IF_ANSWER ( float getScanStep() const )
+};
+
+
+INTERFACE(IFrequencyRadioClient, IFrequencyRadio)
+{
+public :
+ IF_CON_DESTRUCTOR(IFrequencyRadioClient, 1)
+
+SENDERS:
+ IF_SENDER ( sendFrequency(float f) )
+ IF_SENDER ( sendMinFrequency(float mf) )
+ IF_SENDER ( sendMaxFrequency(float mf) )
+ IF_SENDER ( sendScanStep(float s) )
+
+RECEIVERS:
+ IF_RECEIVER( noticeFrequencyChanged(float f, const RadioStation *s) )
+ IF_RECEIVER( noticeMinMaxFrequencyChanged(float min, float max) )
+ IF_RECEIVER( noticeDeviceMinMaxFrequencyChanged(float min, float max) )
+ IF_RECEIVER( noticeScanStepChanged(float s) )
+
+QUERIES:
+ IF_QUERY ( float queryFrequency() )
+ IF_QUERY ( float queryMinFrequency() )
+ IF_QUERY ( float queryMinDeviceFrequency() )
+ IF_QUERY ( float queryMaxFrequency() )
+ IF_QUERY ( float queryMaxDeviceFrequency() )
+ IF_QUERY ( float queryScanStep() )
+
+RECEIVERS:
+ virtual void noticeConnectedI (cmplInterface *, bool pointer_valid);
+ virtual void noticeDisconnectedI (cmplInterface *, bool pointer_valid);
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+INTERFACE(IInternetRadio, IInternetRadioClient)
+{
+public :
+ IF_CON_DESTRUCTOR(IInternetRadio, -1)
+
+RECEIVERS:
+ IF_RECEIVER( setURL(const KURL &url) )
+
+SENDERS:
+ IF_SENDER ( notifyURLChanged(const KURL &u) )
+
+ANSWERS:
+ IF_ANSWER ( const KURL & getURL() const )
+};
+
+
+
+
+INTERFACE(IInternetRadioClient, IInternetRadio)
+{
+public :
+ IF_CON_DESTRUCTOR(IInternetRadioClient, 1)
+
+
+SENDERS:
+ IF_SENDER ( sendURL(const KURL &url) )
+
+RECEIVERS:
+ IF_RECEIVER( noticeURLChanged(const KURL &url) )
+
+QUERIES:
+ IF_QUERY ( const KURL &queryURL() )
+
+RECEIVERS:
+ virtual void noticeConnectedI (cmplInterface *, bool pointer_valid);
+ virtual void noticeDisconnectedI (cmplInterface *, bool pointer_valid);
+};
+
+
+
+#endif
+
diff --git a/src/include/radiodevicepool_interfaces.h b/src/include/radiodevicepool_interfaces.h
new file mode 100644
index 0000000..0e2004c
--- /dev/null
+++ b/src/include/radiodevicepool_interfaces.h
@@ -0,0 +1,75 @@
+/***************************************************************************
+ radiodevicepool_interface.h - description
+ -------------------
+ begin : Sam Apr 19 2003
+ copyright : (C) 2003 by Martin Witte
+ email : 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_RADIODEVICEPOOL_INTERFACES_H
+#define KRADIO_RADIODEVICEPOOL_INTERFACES_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "interfaces.h"
+
+
+class IRadioDevice;
+
+
+INTERFACE(IRadioDevicePool, IRadioDevicePoolClient)
+{
+public:
+ IF_CON_DESTRUCTOR(IRadioDevicePool, -1)
+
+RECEIVERS:
+ IF_RECEIVER( setActiveDevice(IRadioDevice *rd, bool keepPower = true))
+
+SENDERS:
+ IF_SENDER ( notifyActiveDeviceChanged(IRadioDevice *rd) )
+ IF_SENDER ( notifyDevicesChanged(const TQPtrList<IRadioDevice> &) )
+ IF_SENDER ( notifyDeviceDescriptionChanged(const TQString &) )
+
+ANSWERS:
+ IF_ANSWER ( IRadioDevice * getActiveDevice() const )
+ IF_ANSWER ( const TQPtrList<IRadioDevice> & getDevices() const )
+ IF_ANSWER ( const TQString & getDeviceDescription() const )
+};
+
+
+INTERFACE(IRadioDevicePoolClient, IRadioDevicePool)
+{
+public:
+ IF_CON_DESTRUCTOR(IRadioDevicePoolClient, -1)
+
+SENDERS:
+ IF_SENDER ( sendActiveDevice(IRadioDevice *rd, bool keepPower = true))
+
+RECEIVERS:
+ IF_RECEIVER( noticeActiveDeviceChanged(IRadioDevice *rd) )
+ IF_RECEIVER( noticeDevicesChanged(const TQPtrList<IRadioDevice> &) )
+ IF_RECEIVER( noticeDeviceDescriptionChanged(const TQString &) )
+
+QUERIES:
+ IF_QUERY ( IRadioDevice *queryActiveDevice() )
+ IF_QUERY ( const TQPtrList<IRadioDevice> &queryDevices() )
+ IF_QUERY ( const TQString &queryDeviceDescription() )
+
+RECEIVERS:
+ virtual void noticeConnectedI (cmplInterface *, bool /*pointer_valid*/);
+ virtual void noticeDisconnectedI (cmplInterface *, bool /*pointer_valid*/);
+};
+
+
+#endif
diff --git a/src/include/radiostation-config.h b/src/include/radiostation-config.h
new file mode 100644
index 0000000..2efad05
--- /dev/null
+++ b/src/include/radiostation-config.h
@@ -0,0 +1,82 @@
+/***************************************************************************
+ radiostation-config.h - description
+ -------------------
+ begin : Sa Aug 16 2003
+ copyright : (C) 2003 by Martin Witte
+ email : 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_RADIOSTATION_CONFIG_H
+#define KRADIO_RADIOSTATION_CONFIG_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tqwidget.h>
+
+class RadioStation;
+
+class RadioStationConfig : public TQWidget
+{
+Q_OBJECT
+
+public:
+ RadioStationConfig(TQWidget *parent);
+ ~RadioStationConfig();
+
+ virtual void setStationData (const RadioStation &rs) = 0;
+ virtual void storeStationData (RadioStation &rs) = 0;
+
+signals:
+ virtual void changed(RadioStationConfig *);
+};
+
+
+class UndefinedRadioStationConfig : public RadioStationConfig
+{
+Q_OBJECT
+
+public:
+ UndefinedRadioStationConfig (TQWidget *parent);
+ ~UndefinedRadioStationConfig();
+
+ virtual void setStationData (const RadioStation &rs);
+ virtual void storeStationData (RadioStation &rs);
+};
+
+
+
+class TQSpinBox;
+
+class FrequencyRadioStationConfig : public RadioStationConfig
+{
+Q_OBJECT
+
+public:
+ FrequencyRadioStationConfig (TQWidget *parent);
+ ~FrequencyRadioStationConfig();
+
+ virtual void setStationData (const RadioStation &rs);
+ virtual void storeStationData (RadioStation &rs);
+
+protected slots:
+ virtual void slotValueChanged(int);
+
+protected:
+
+ TQSpinBox *m_editFrequency;
+};
+
+
+
+#endif
diff --git a/src/include/radiostation-listview.h b/src/include/radiostation-listview.h
new file mode 100644
index 0000000..2ecb86f
--- /dev/null
+++ b/src/include/radiostation-listview.h
@@ -0,0 +1,84 @@
+/***************************************************************************
+ radiostation-listview.h - description
+ -------------------
+ begin : Mi Mar 03 2004
+ copyright : (C) 2003 by Martin Witte
+ email : 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. *
+ * *
+ ***************************************************************************/
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifndef _KRADIO_RADIOSTATION_LISTVIEW_H_
+#define _KRADIO_RADIOSTATION_LISTVIEW_H_
+
+#include <tdelistview.h>
+
+class RadioStation;
+class StationList;
+
+class RadioStationListView : public TDEListView
+{
+Q_OBJECT
+
+public:
+ RadioStationListView(TQWidget *parent=0, const char *name=0);
+ virtual ~RadioStationListView();
+
+ TQListViewItem *getItemForIndex(int idx) const;
+ int getIndexForItem(TQListViewItem *) const;
+
+ void setStation(int idx, const RadioStation &, int nr = -1);
+ void appendStation(const RadioStation &, int nr = -1);
+ void setStations(const StationList &);
+
+ void removeStation(int idx);
+ void takeItem(TQListViewItem *item, int idx);
+ void insertItem(TQListViewItem *item, const TQString &stationid, int idx);
+
+ void setCurrentStation(int idx);
+ int currentStationIndex() const;
+
+ int count() const { return childCount(); }
+
+ void saveState (TDEConfig *) const;
+ void restoreState (TDEConfig *);
+
+
+protected:
+
+ TQDragObject *dragObject();
+ void dragEnterEvent(TQDragEnterEvent* event);
+ void dropEvent(TQDropEvent* event);
+ void contentsDragEnterEvent(TQDragEnterEvent* event);
+ void contentsDragMoveEvent(TQDragMoveEvent* event);
+ void contentsDropEvent(TQDropEvent* event);
+
+protected slots:
+
+ void slotStationActivation(TQListViewItem *);
+ void slotCurrentStationChanged(TQListViewItem *);
+
+signals:
+ void sigStationActivated(int idx);
+ void sigCurrentStationChanged(int idx);
+ void sigStationsReceived(const TQStringList &stationIDs);
+
+protected:
+
+ TQStringList m_StationIDs;
+
+};
+
+#endif
diff --git a/src/include/radiostation.h b/src/include/radiostation.h
new file mode 100644
index 0000000..68d0325
--- /dev/null
+++ b/src/include/radiostation.h
@@ -0,0 +1,164 @@
+/***************************************************************************
+ radiostation.h - description
+ -------------------
+ begin : Sat Feb 2 2002
+ copyright : (C) 2003 by Martin Witte, Klas Kalass
+ email : witte@kawo1.rwth-aachen.de / klas@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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_RADIOSTATION_H
+#define KRADIO_RADIOSTATION_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+//#include "utils.h"
+#include <tqstring.h>
+#include <tqstringlist.h>
+#include <tqdict.h>
+
+#include <tdelocale.h>
+
+/**
+ *@author Martin Witte, Klas Kalass
+ */
+
+/*
+
+ RadioStation
+
+ RadioStation is an abstract base class for any type of radio station,
+ e.g. AM/FM stations or internet radio stations. Thus no specific knowledge
+ about the frequency or URL is included in this class. A radio station
+ should not contain information on a matching device as well. The device has
+ to decide on its own to use or not to use a station.
+
+ There are some important abstract functions, that have to be overwritten by
+ a derived radio station:
+
+ copy create an exact copy of a station (in case we only have a RadioStation*
+ longName return a verbous station description
+ isValid is this station setup correctly ?
+ compare is this station equivalent to another station, e.g. approximately same frequency
+ getclassname classname string for station registry
+
+ Other methods "should" be overwritten, but still call inherited methods for completeness!
+
+ get/setProperty
+ getPropertyNames
+
+*/
+
+/////////////////////////////////////////////////////////////////////////////
+
+extern struct RegisterStationClass {} registerStationClass;
+
+/////////////////////////////////////////////////////////////////////////////
+
+class RadioStationConfig;
+
+class RadioStation
+{
+protected:
+ RadioStation (RegisterStationClass, const TQString &classname);
+public:
+ RadioStation ();
+ RadioStation (const TQString &name, const TQString &shortName);
+ RadioStation (const RadioStation &);
+ virtual ~RadioStation();
+
+ const TQString &stationID() const { return m_stationID; }
+
+ virtual TQString longName() const = 0;
+ virtual TQString description() const = 0;
+
+ const TQString &name() const { return m_name; }
+ const TQString &shortName() const { return m_shortName; }
+ const TQString &iconName() const { return m_iconName; }
+ float initialVolume() const { return m_initialVolume; }
+
+ void setName (const TQString &name) { m_name = name; }
+ void setShortName (const TQString &shortName) { m_shortName = shortName; }
+ void setIconName (const TQString &iconName) { m_iconName = iconName; }
+ void setInitialVolume(float initialVolume) { m_initialVolume = initialVolume; }
+
+ void copyDescriptionFrom(const RadioStation &rs);
+
+ // for XML-Parsing/Export
+ virtual bool setProperty(const TQString &property_name, const TQString &val);
+ virtual TQString getProperty(const TQString &property_name) const;
+ virtual TQStringList getPropertyNames() const;
+ virtual TQString getClassName() const = 0;
+
+ // get empty derived stations by classname from registry
+ static RadioStation const *getStationClass(const TQString &classname);
+ RadioStation const *getStationClass() const { return getStationClass(getClassName()); }
+
+ // = 0 : "this" is same as "s", e.g. approximately same frequency, same url, ...
+ // > 0 : "this" is numerically (frequencies) or alphanumerically (urls) or ... greater than "s"
+ // < 0 : "this" is numerically (frequencies) or alphanumerically (urls) or ... smaller than "s"
+ virtual int compare(const RadioStation &s) const = 0;
+
+ // is this station setup correctly ?
+ virtual bool isValid() const = 0;
+
+ /** returns an exact copy of this station */
+ virtual RadioStation *copy() const = 0;
+ /** returns an exact copy of this station, BUT with a new station ID */
+ virtual RadioStation *copyNewID() const = 0;
+
+ void generateNewStationID();
+
+ virtual RadioStationConfig *createEditor() const = 0;
+
+ virtual bool operator == (const RadioStation &x) const;
+ virtual bool operator != (const RadioStation &x) const { return !operator==(x); }
+
+protected :
+ TQString m_stationID;
+
+ TQString m_name;
+ TQString m_shortName;
+ float m_initialVolume; // <0: => Don't use
+ TQString m_iconName;
+
+private:
+ static TQDict<RadioStation> *stationClassRegistry;
+};
+
+
+
+
+
+
+
+class UndefinedRadioStation : public RadioStation
+{
+public:
+ UndefinedRadioStation (RegisterStationClass) : RadioStation (registerStationClass, getClassName()) {}
+
+ virtual TQString longName() const { return i18n("unknown"); }
+ virtual TQString description() const { return i18n("unknown"); }
+ virtual bool isValid() const { return false; }
+ virtual RadioStation *copy() const { return new UndefinedRadioStation(*this); }
+ virtual RadioStation *copyNewID() const { RadioStation *x = new UndefinedRadioStation(*this); x->generateNewStationID(); return x; }
+ virtual int compare(const RadioStation &s) const;
+
+ virtual TQString getClassName() const { return "UndefinedRadioStation"; }
+ virtual RadioStationConfig *createEditor() const;
+};
+
+
+extern const UndefinedRadioStation undefinedRadioStation;
+
+#endif
diff --git a/src/include/ringbuffer.h b/src/include/ringbuffer.h
new file mode 100644
index 0000000..1f545ca
--- /dev/null
+++ b/src/include/ringbuffer.h
@@ -0,0 +1,58 @@
+/***************************************************************************
+ ringbuffer.h - description
+ -------------------
+ begin : Sun March 21 2004
+ copyright : (C) 2004 by Martin Witte
+ email : 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_RING_BUFFER_H
+#define _KRADIO_RING_BUFFER_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <sys/types.h>
+
+class RingBuffer
+{
+public:
+ RingBuffer(size_t size);
+ ~RingBuffer();
+
+ bool resize(size_t new_size);
+
+ size_t addData (const char *src, size_t size);
+ size_t takeData(char *dst, size_t size);
+
+ char *getFreeSpace(size_t &size);
+ size_t removeFreeSpace(size_t size);
+
+ char *getData(size_t &size);
+ size_t removeData(size_t size);
+
+ size_t getSize() const { return m_Size; }
+ size_t getFillSize() const { return m_FillSize; }
+ size_t getFreeSize() const { return m_Size - m_FillSize; }
+
+ void clear();
+
+protected:
+
+ char *m_Buffer;
+ size_t m_Start;
+ size_t m_Size,
+ m_FillSize;
+};
+
+#endif
diff --git a/src/include/seekhelper.h b/src/include/seekhelper.h
new file mode 100644
index 0000000..f61ad9d
--- /dev/null
+++ b/src/include/seekhelper.h
@@ -0,0 +1,83 @@
+/***************************************************************************
+ seekhelper.h - description
+ -------------------
+ begin : Sam Mai 10 2003
+ copyright : (C) 2003 by Martin Witte
+ email : 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_SEEKHELPER_H
+#define KRADIO_SEEKHELPER_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "radiodevice_interfaces.h"
+#include "soundstreamclient_interfaces.h"
+
+
+class SeekHelper : public IRadioDeviceClient,
+ public ISoundStreamClient
+{
+public:
+ typedef enum { off, searchWorse, searchBest } state_t;
+ typedef enum { up, down } direction_t;
+
+ SeekHelper(ISeekRadio &parent);
+ virtual ~SeekHelper();
+
+ virtual bool connectI (Interface *i);
+ virtual bool disconnectI(Interface *i);
+
+ virtual void start(const SoundStreamID &id, direction_t dir);
+ virtual void step();
+ virtual void stop();
+
+ bool isRunning() const { return m_state != off; }
+ bool isRunningUp() const { return m_state != off && m_direction == up; }
+ bool isRunningDown() const { return m_state != off && m_direction == down; }
+
+
+// IRadioDeviceClient
+RECEIVERS:
+ bool noticePowerChanged (bool /*on*/, const IRadioDevice */*sender*/) { return false; }
+ bool noticeStationChanged (const RadioStation &, const IRadioDevice */*sender*/) { return false; }
+ bool noticeDescriptionChanged (const TQString &, const IRadioDevice */*sender*/) { return false; }
+
+ bool noticeCurrentSoundStreamIDChanged(SoundStreamID /*id*/, const IRadioDevice */*sender*/) { return false; }
+
+protected:
+
+ virtual void finish();
+
+ virtual void abort() = 0;
+ virtual bool isGood() const = 0;
+ virtual bool isBetter() const = 0;
+ virtual bool isWorse() const = 0;
+ virtual bool bestFound() const = 0;
+ virtual void getData() = 0;
+ virtual void rememberBest() = 0;
+ virtual bool nextSeekStep() = 0;
+ virtual void applyBest() = 0;
+
+protected:
+ state_t m_state;
+ direction_t m_direction;
+ bool m_oldMute;
+
+ ISeekRadio &m_parent;
+ SoundStreamID m_SoundStreamID;
+};
+
+#endif
+
diff --git a/src/include/sound_metadata.h b/src/include/sound_metadata.h
new file mode 100644
index 0000000..723ae3b
--- /dev/null
+++ b/src/include/sound_metadata.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ sound_metadata.h - description
+ -------------------
+ begin : Sun May 15 2005
+ copyright : (C) 2005 by Martin Witte
+ email : 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_SOUND_METADATA_H
+#define KRADIO_SOUND_METADATA_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <time.h>
+#include <endian.h>
+#include <tqstring.h>
+#include <tdeconfig.h>
+#include <kurl.h>
+
+class SoundMetaData
+{
+public:
+ SoundMetaData (TQ_UINT64 pos, time_t rel_ts, time_t abs_ts, const KURL &url = KURL())
+ : m_DataPosition(pos), m_relativeTimestamp(rel_ts), m_absoluteTimestamp(abs_ts), m_URL(url) {}
+
+ TQ_UINT64 position() const { return m_DataPosition; }
+ KURL url() const { return m_URL; }
+ time_t relativeTimestamp() const { return m_relativeTimestamp; }
+ time_t absoluteTimestamp() const { return m_absoluteTimestamp; }
+
+protected:
+ TQ_UINT64 m_DataPosition;
+ time_t m_relativeTimestamp;
+ time_t m_absoluteTimestamp;
+ KURL m_URL;
+};
+
+
+#endif
diff --git a/src/include/soundformat.h b/src/include/soundformat.h
new file mode 100644
index 0000000..0f07d9a
--- /dev/null
+++ b/src/include/soundformat.h
@@ -0,0 +1,75 @@
+/***************************************************************************
+ soundformat.h - description
+ -------------------
+ begin : Sun Aug 1 2004
+ copyright : (C) 2004 by Martin Witte
+ email : 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_SOUNDFORMAT_H
+#define KRADIO_SOUNDFORMAT_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <endian.h>
+#include <tqstring.h>
+#include <tdeconfig.h>
+
+struct SoundFormat {
+ unsigned m_SampleRate;
+ unsigned m_Channels;
+ unsigned m_SampleBits;
+ bool m_IsSigned;
+ unsigned m_Endianess;
+ TQString m_Encoding; // "raw", "mp3", ... (no "wav", because it's only header + raw data)
+
+ SoundFormat(unsigned sample_rate, unsigned channels, unsigned sample_bits, bool is_signed, unsigned endianess, const TQString &enc)
+ : m_SampleRate(sample_rate), m_Channels(channels), m_SampleBits(sample_bits), m_IsSigned(is_signed), m_Endianess(endianess), m_Encoding(enc) {}
+ SoundFormat(unsigned sample_rate, unsigned channels, unsigned sample_bits, bool is_signed, unsigned endianess)
+ : m_SampleRate(sample_rate), m_Channels(channels), m_SampleBits(sample_bits), m_IsSigned(is_signed), m_Endianess(endianess), m_Encoding("raw") {}
+ SoundFormat(unsigned sample_rate, unsigned channels, unsigned sample_bits, bool is_signed)
+ : m_SampleRate(sample_rate), m_Channels(channels), m_SampleBits(sample_bits), m_IsSigned(is_signed), m_Endianess(BYTE_ORDER), m_Encoding("raw") {}
+ SoundFormat(bool stereo)
+ : m_SampleRate(44100), m_Channels(stereo ? 2 : 1), m_SampleBits(16), m_IsSigned(true), m_Endianess(BYTE_ORDER), m_Encoding("raw") {}
+ SoundFormat()
+ : m_SampleRate(44100), m_Channels(2), m_SampleBits(16), m_IsSigned(true), m_Endianess(BYTE_ORDER), m_Encoding("raw") {}
+
+ bool operator == (const SoundFormat &o) const { return m_SampleRate == o.m_SampleRate &&
+ m_Channels == o.m_Channels &&
+ m_SampleBits == o.m_SampleBits &&
+ m_IsSigned == o.m_IsSigned &&
+ m_Endianess == o.m_Endianess &&
+ m_Encoding == o.m_Encoding
+ ;
+ }
+ bool operator != (const SoundFormat &o) const { return !operator == (o); }
+
+ int sampleSize() const; // size of a single sample
+ int frameSize() const; // sampleSize * channels
+ int minValue() const;
+ int maxValue() const;
+
+ void restoreConfig(const TQString &prefix, TDEConfig *c);
+ void saveConfig(const TQString &prefix, TDEConfig *c) const;
+
+ int convertSampleToInt(const char *sample, bool do_scale) const;
+ void convertIntToSample(int src, char *dst, bool is_scaled) const;
+ void convertSamplesToInts(const char *src, int *dst, size_t n, bool do_scale) const;
+ void convertIntsToSamples(const int *src, char *dst, size_t n, bool is_scaled) const;
+ void convertSamplesToFloat (const char *src, float **dst, size_t n) const;
+ void convertFloatsToSamples(const float **src, char *dst, size_t n) const;
+};
+
+
+#endif
diff --git a/src/include/soundstreamclient_interfaces.h b/src/include/soundstreamclient_interfaces.h
new file mode 100644
index 0000000..2d14de2
--- /dev/null
+++ b/src/include/soundstreamclient_interfaces.h
@@ -0,0 +1,372 @@
+/***************************************************************************
+ sounddevice_interfaces.h - description
+ -------------------
+ begin : Sun Mar 21 2004
+ copyright : (C) 2004 by Martin Witte
+ email : 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. *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * Interfaces in this header: *
+ * *
+ * ISoundDevice(Client) *
+ * *
+ ***************************************************************************/
+
+#ifndef KRADIO_SOUNDSTREAMCLIENT_INTERFACES_H
+#define KRADIO_SOUNDSTREAMCLIENT_INTERFACES_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tdeconfig.h>
+#include <tqmap.h>
+
+#include "interfaces.h"
+#include "soundformat.h"
+#include "soundstreamid.h"
+#include "sound_metadata.h"
+
+
+#define CALL_SNDSTR_SERVER(name, param, call) \
+ inline int name param const { \
+ return iConnections.count() ? iConnections.getFirst()->name call : 0; \
+ }
+
+
+#define SIZE_T_DONT_CARE ((size_t)(-1))
+
+class RadioStation;
+
+INTERFACE(ISoundStreamServer, ISoundStreamClient)
+{
+friend class ISoundStreamClient;
+public:
+ IF_CON_DESTRUCTOR(ISoundStreamServer, -1)
+
+ virtual void noticeConnectedI(cmplInterface *i, bool valid);
+ virtual void noticeDisconnectedI(cmplInterface *i, bool valid);
+
+ virtual TQMap<TQString, ISoundStreamClient *> getPlaybackClients() const;
+ virtual TQMap<TQString, TQString> getPlaybackClientDescriptions() const;
+ virtual TQMap<TQString, ISoundStreamClient *> getCaptureClients() const;
+ virtual TQMap<TQString, TQString> getCaptureClientDescriptions() const;
+ virtual ISoundStreamClient *getSoundStreamClientWithID(const TQString &id) const;
+
+ANSWERS:
+ virtual TQPtrList<ISoundStreamClient> getPlaybackMixers() const;
+ virtual TQPtrList<ISoundStreamClient> getCaptureMixers() const;
+
+
+SENDERS:
+ IF_SENDER_FINE ( notifyPlaybackChannelsChanged, (const TQString &/*client_id*/, const TQStringList &) )
+ IF_SENDER_FINE ( notifyCaptureChannelsChanged, (const TQString &/*client_id*/, const TQStringList &) )
+
+ IF_SENDER_FINE ( sendPlaybackVolume, (SoundStreamID /*id*/, float /*volume*/) )
+ IF_SENDER_FINE ( sendCaptureVolume, (SoundStreamID /*id*/, float /*volume*/) )
+ IF_SENDER_FINE ( queryPlaybackVolume, (SoundStreamID /*id*/, float &/*volume*/) )
+ IF_SENDER_FINE ( queryCaptureVolume, (SoundStreamID /*id*/, float &/*volume*/) )
+ IF_SENDER_FINE ( notifyPlaybackVolumeChanged, (SoundStreamID /*id*/, float /*volume*/) )
+ IF_SENDER_FINE ( notifyCaptureVolumeChanged, (SoundStreamID /*id*/, float /*volume*/) )
+
+ IF_SENDER_FINE ( notifyTrebleChanged, (SoundStreamID /*id*/, float /*v*/) )
+ IF_SENDER_FINE ( notifyBassChanged, (SoundStreamID /*id*/, float /*v*/) )
+ IF_SENDER_FINE ( notifyBalanceChanged, (SoundStreamID /*id*/, float /*v*/) )
+ IF_SENDER_FINE ( notifyMuted, (SoundStreamID /*id*/, bool /*m*/) )
+ IF_SENDER_FINE ( notifySignalQualityChanged, (SoundStreamID /*id*/, float /*q*/) )
+ IF_SENDER_FINE ( notifySignalQualityBoolChanged, (SoundStreamID /*id*/, bool /*good*/) )
+ IF_SENDER_FINE ( notifySignalMinQualityChanged, (SoundStreamID /*id*/, float /*q*/) )
+ IF_SENDER_FINE ( notifyStereoChanged, (SoundStreamID /*id*/, bool /*s*/) )
+
+ IF_SENDER_FINE ( sendTreble, (SoundStreamID /*id*/, float /*v*/) )
+ IF_SENDER_FINE ( sendBass, (SoundStreamID /*id*/, float /*v*/) )
+ IF_SENDER_FINE ( sendBalance, (SoundStreamID /*id*/, float /*v*/) )
+ IF_SENDER_FINE ( sendMute, (SoundStreamID /*id*/, bool mute = true) )
+ IF_SENDER_FINE ( sendUnmute, (SoundStreamID /*id*/, bool unmute = true) )
+ IF_SENDER_FINE ( sendSignalMinQuality, (SoundStreamID /*id*/, float /*q*/) )
+ IF_SENDER_FINE ( sendStereo, (SoundStreamID /*id*/, bool /*s*/) )
+
+ IF_SENDER_FINE ( queryTreble, (SoundStreamID /*id*/, float &) )
+ IF_SENDER_FINE ( queryBass, (SoundStreamID /*id*/, float &) )
+ IF_SENDER_FINE ( queryBalance, (SoundStreamID /*id*/, float &) )
+ IF_SENDER_FINE ( querySignalQuality, (SoundStreamID /*id*/, float &) )
+ IF_SENDER_FINE ( querySignalMinQuality, (SoundStreamID /*id*/, float &) )
+ IF_SENDER_FINE ( queryHasGoodQuality, (SoundStreamID /*id*/, bool &) )
+ IF_SENDER_FINE ( queryIsStereo, (SoundStreamID /*id*/, bool &) )
+ IF_SENDER_FINE ( queryIsMuted, (SoundStreamID /*id*/, bool &) )
+
+
+ // sendPreparePlayback/sendPrepareCapture don't make sense for multiple receivers
+ IF_SENDER_FINE ( sendReleasePlayback, (SoundStreamID id) )
+ IF_SENDER_FINE ( sendReleaseCapture, (SoundStreamID id) )
+
+ IF_SENDER_FINE ( sendStartPlayback, (SoundStreamID id) )
+ IF_SENDER_FINE ( sendPausePlayback, (SoundStreamID id) )
+ IF_SENDER_FINE ( sendStopPlayback, (SoundStreamID id) )
+ IF_SENDER_FINE ( queryIsPlaybackRunning, (SoundStreamID id, bool &) )
+
+// IF_SENDER_FINE ( sendStartCapture, (SoundStreamID id) )
+ IF_SENDER_FINE ( sendStartCaptureWithFormat, (SoundStreamID id,
+ const SoundFormat &proposed_format,
+ SoundFormat &real_format,
+ bool force_format = false) )
+ IF_SENDER_FINE ( sendStopCapture, (SoundStreamID id) )
+ IF_SENDER_FINE ( queryIsCaptureRunning, (SoundStreamID id, bool &running, SoundFormat &sf))
+
+ // we need extra recording, in order to distinguish between plain capturing
+ // (making sound data available to tderadio) and writing a stream to disk or sth similar
+ IF_SENDER_FINE ( sendStartRecording, (SoundStreamID id) )
+ IF_SENDER_FINE ( sendStartRecordingWithFormat, (SoundStreamID id,
+ const SoundFormat &proposed_format,
+ SoundFormat &real_format) )
+ IF_SENDER_FINE ( sendStopRecording, (SoundStreamID id) )
+ IF_SENDER_FINE ( queryIsRecordingRunning, (SoundStreamID id, bool &running, SoundFormat &sf))
+
+ IF_SENDER_FINE ( querySoundStreamDescription, (SoundStreamID id, TQString &descr) )
+ IF_SENDER_FINE ( querySoundStreamRadioStation, (SoundStreamID id, const RadioStation *&rs))
+ IF_SENDER_FINE ( queryEnumerateSoundStreams, (TQMap<TQString, SoundStreamID> &) )
+
+ IF_SENDER_FINE ( notifySoundStreamCreated, (SoundStreamID id) )
+ IF_SENDER_FINE ( notifySoundStreamClosed, (SoundStreamID id) )
+ IF_SENDER_FINE ( notifySoundStreamRedirected, (SoundStreamID oldID, SoundStreamID newID) )
+
+ // e.g description or whatever changed
+ IF_SENDER_FINE ( notifySoundStreamChanged, (SoundStreamID id) )
+
+ IF_SENDER_FINE ( notifySoundStreamData, (SoundStreamID /*id*/, const SoundFormat &, const char */*data*/, size_t /*size*/, size_t &/*consumed_size*/, const SoundMetaData &/*md*/) )
+ IF_SENDER_FINE ( notifyReadyForPlaybackData, (SoundStreamID /*id*/, size_t /*size*/) )
+};
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+
+INTERFACE(ISoundStreamClient, ISoundStreamServer)
+{
+public:
+ ISoundStreamClient();
+ virtual ~ISoundStreamClient();
+
+ cmplInterface *getSoundStreamServer() const { return m_Server; }
+
+
+ virtual void noticeConnectedSoundClient(thisInterface *i, bool valid);
+ virtual void noticeDisconnectedSoundClient(thisInterface *i, bool valid);
+
+ virtual void noticeConnectedI(cmplInterface *i, bool valid);
+ virtual void noticeDisconnectedI(cmplInterface *i, bool valid);
+
+// some rarely implemented functions are not pure virtual for convenience
+
+// direct playback / capture device functions
+
+RECEIVERS:
+ IF_RECEIVER_EMPTY( preparePlayback(SoundStreamID /*id*/, const TQString &/*channel*/, bool /*active_mode*/, bool /*start_immediately = false*/) )
+ IF_RECEIVER_EMPTY( prepareCapture(SoundStreamID /*id*/, const TQString &/*channel*/) )
+ IF_RECEIVER_EMPTY( releasePlayback(SoundStreamID /*id*/) )
+ IF_RECEIVER_EMPTY( releaseCapture(SoundStreamID /*id*/) )
+
+ANSWERS:
+ virtual bool supportsPlayback() const { return false; }
+ virtual bool supportsCapture() const { return false; }
+
+ virtual const TQString &getSoundStreamClientID() const;
+ virtual TQString getSoundStreamClientDescription() const { return TQString(); }
+
+ virtual TQMap<TQString, ISoundStreamClient *> getPlaybackClients() const;
+ virtual TQMap<TQString, TQString> getPlaybackClientDescriptions() const;
+ virtual TQMap<TQString, ISoundStreamClient *> getCaptureClients() const;
+ virtual TQMap<TQString, TQString> getCaptureClientDescriptions() const;
+ virtual ISoundStreamClient *getSoundStreamClientWithID(const TQString &id) const;
+
+// device mixer functions
+
+QUERIES:
+ IF_QUERY ( TQPtrList<ISoundStreamClient> queryPlaybackMixers() );
+ IF_QUERY ( TQPtrList<ISoundStreamClient> queryCaptureMixers() );
+
+
+ANSWERS:
+ virtual const TQStringList &getPlaybackChannels() const;
+ virtual const TQStringList &getCaptureChannels() const;
+
+RECEIVERS:
+ IF_RECEIVER_EMPTY( noticePlaybackChannelsChanged(const TQString & /*client_id*/, const TQStringList &/*channels*/) );
+ IF_RECEIVER_EMPTY( noticeCaptureChannelsChanged (const TQString & /*client_id*/, const TQStringList &/*channels*/) );
+
+
+RECEIVERS:
+ IF_RECEIVER_EMPTY( setPlaybackVolume(SoundStreamID /*id*/, float /*volume*/) )
+ IF_RECEIVER_EMPTY( setCaptureVolume(SoundStreamID /*id*/, float /*volume*/) )
+ IF_RECEIVER_EMPTY( getPlaybackVolume(SoundStreamID /*id*/, float &/*volume*/) const )
+ IF_RECEIVER_EMPTY( getCaptureVolume(SoundStreamID /*id*/, float &/*volume*/) const )
+ IF_RECEIVER_EMPTY( noticePlaybackVolumeChanged(SoundStreamID /*id*/, float /*volume*/) )
+ IF_RECEIVER_EMPTY( noticeCaptureVolumeChanged(SoundStreamID /*id*/, float /*volume*/) )
+
+ IF_RECEIVER_EMPTY( setTreble (SoundStreamID /*id*/, float /*v*/) )
+ IF_RECEIVER_EMPTY( setBass (SoundStreamID /*id*/, float /*v*/) )
+ IF_RECEIVER_EMPTY( setBalance (SoundStreamID /*id*/, float /*v*/) )
+ IF_RECEIVER_EMPTY( mute (SoundStreamID /*id*/, bool /*mute*/) )
+ IF_RECEIVER_EMPTY( unmute (SoundStreamID /*id*/, bool /*unmute*/) )
+ IF_RECEIVER_EMPTY( setSignalMinQuality(SoundStreamID /*id*/, float /*q*/) )
+ IF_RECEIVER_EMPTY( setStereo(SoundStreamID /*id*/, bool /*s*/) )
+
+ IF_RECEIVER_EMPTY( noticeTrebleChanged(SoundStreamID /*id*/, float /*v*/) )
+ IF_RECEIVER_EMPTY( noticeBassChanged(SoundStreamID /*id*/, float /*v*/) )
+ IF_RECEIVER_EMPTY( noticeBalanceChanged(SoundStreamID /*id*/, float /*v*/) )
+ IF_RECEIVER_EMPTY( noticeSignalQualityChanged(SoundStreamID /*id*/, float /*q*/) )
+ IF_RECEIVER_EMPTY( noticeSignalQualityChanged(SoundStreamID /*id*/, bool /*good*/) )
+ IF_RECEIVER_EMPTY( noticeSignalMinQualityChanged(SoundStreamID /*id*/, float /*q*/) )
+ IF_RECEIVER_EMPTY( noticeStereoChanged(SoundStreamID /*id*/, bool /*s*/) )
+ IF_RECEIVER_EMPTY( noticeMuted(SoundStreamID /*id*/, bool /*m*/) )
+
+ IF_RECEIVER_EMPTY( getTreble (SoundStreamID /*id*/, float &/*v*/) const )
+ IF_RECEIVER_EMPTY( getBass (SoundStreamID /*id*/, float &/*v*/) const )
+ IF_RECEIVER_EMPTY( getBalance(SoundStreamID /*id*/, float &/*v*/) const )
+ IF_RECEIVER_EMPTY( isMuted(SoundStreamID /*id*/, bool &/*m*/) const )
+ IF_RECEIVER_EMPTY( getSignalQuality(SoundStreamID /*id*/, float &/*q*/) const )
+ IF_RECEIVER_EMPTY( getSignalMinQuality(SoundStreamID /*id*/, float &/*q*/) const )
+ IF_RECEIVER_EMPTY( hasGoodQuality(SoundStreamID /*id*/, bool &/*good*/) const )
+ IF_RECEIVER_EMPTY( isStereo(SoundStreamID /*id*/, bool &/*s*/) const )
+
+// generic stream handling (broadcasts)
+
+RECEIVERS:
+ IF_RECEIVER_EMPTY( startPlayback(SoundStreamID /*id*/) )
+ IF_RECEIVER_EMPTY( pausePlayback(SoundStreamID /*id*/) )
+ IF_RECEIVER_EMPTY( stopPlayback(SoundStreamID /*id*/) )
+ IF_RECEIVER_EMPTY( isPlaybackRunning(SoundStreamID /*id*/, bool &) const )
+
+// IF_RECEIVER_EMPTY( startCapture(SoundStreamID /*id*/) )
+ IF_RECEIVER_EMPTY( startCaptureWithFormat(SoundStreamID /*id*/,
+ const SoundFormat &/*proposed_format*/,
+ SoundFormat &/*real_format*/,
+ bool /*force_format*/ = false) )
+ IF_RECEIVER_EMPTY( stopCapture(SoundStreamID /*id*/) )
+ IF_RECEIVER_EMPTY( isCaptureRunning(SoundStreamID /*id*/, bool &/*running*/, SoundFormat &/*sf*/) const )
+
+ IF_RECEIVER_EMPTY( startRecording(SoundStreamID /*id*/) )
+ IF_RECEIVER_EMPTY( startRecordingWithFormat(SoundStreamID /*id*/,
+ const SoundFormat &/*proposed_format*/,
+ SoundFormat &/*real_format*/) )
+ IF_RECEIVER_EMPTY( stopRecording(SoundStreamID /*id*/) )
+ IF_RECEIVER_EMPTY( isRecordingRunning(SoundStreamID /*id*/, bool &/*running*/, SoundFormat &/*sf*/) const )
+
+ IF_RECEIVER_EMPTY( getSoundStreamDescription(SoundStreamID /*id*/, TQString &/*descr*/) const )
+ IF_RECEIVER_EMPTY( getSoundStreamRadioStation(SoundStreamID /*id*/, const RadioStation *&/*rs*/) const )
+
+ IF_RECEIVER_EMPTY( enumerateSoundStreams(TQMap<TQString, SoundStreamID> &/*list*/) const )
+
+ IF_RECEIVER_EMPTY( noticeSoundStreamCreated(SoundStreamID /*id*/) )
+ IF_RECEIVER_EMPTY( noticeSoundStreamClosed(SoundStreamID /*id*/) )
+ IF_RECEIVER_EMPTY( noticeSoundStreamRedirected(SoundStreamID /*oldID*/, SoundStreamID /*newID*/) )
+
+ // e.g description or whatever changed
+ IF_RECEIVER_EMPTY( noticeSoundStreamChanged(SoundStreamID /*id*/) )
+
+ IF_RECEIVER_EMPTY( noticeSoundStreamData(SoundStreamID /*id*/, const SoundFormat &, const char */*data*/, size_t /*size*/, size_t &/*consumed_size*/, const SoundMetaData &/*md*/))
+ IF_RECEIVER_EMPTY( noticeReadyForPlaybackData(SoundStreamID /*id*/, size_t /*size*/) )
+
+SENDERS:
+ CALL_SNDSTR_SERVER ( notifyPlaybackChannelsChanged, (const TQString &client_id, const TQStringList &map), (client_id, map) )
+ CALL_SNDSTR_SERVER ( notifyCaptureChannelsChanged, (const TQString &client_id, const TQStringList &map), (client_id, map) )
+
+ CALL_SNDSTR_SERVER ( sendPlaybackVolume, (SoundStreamID id, float volume), (id, volume) )
+ CALL_SNDSTR_SERVER ( sendCaptureVolume, (SoundStreamID id, float volume), (id, volume) )
+ CALL_SNDSTR_SERVER ( queryPlaybackVolume, (SoundStreamID id, float &volume), (id, volume) )
+ CALL_SNDSTR_SERVER ( queryCaptureVolume, (SoundStreamID id, float &volume), (id, volume) )
+ CALL_SNDSTR_SERVER ( notifyPlaybackVolumeChanged, (SoundStreamID id, float volume), (id, volume) )
+ CALL_SNDSTR_SERVER ( notifyCaptureVolumeChanged, (SoundStreamID id, float volume), (id, volume) )
+
+ CALL_SNDSTR_SERVER ( notifyTrebleChanged, (SoundStreamID id, float v), (id, v) )
+ CALL_SNDSTR_SERVER ( notifyBassChanged, (SoundStreamID id, float v), (id, v) )
+ CALL_SNDSTR_SERVER ( notifyBalanceChanged, (SoundStreamID id, float v), (id, v) )
+ CALL_SNDSTR_SERVER ( notifyMuted, (SoundStreamID id, bool m), (id, m) )
+ CALL_SNDSTR_SERVER ( notifySignalQualityChanged, (SoundStreamID id, float q), (id, q) )
+ CALL_SNDSTR_SERVER ( notifySignalQualityBoolChanged, (SoundStreamID id, bool good), (id, good) )
+ CALL_SNDSTR_SERVER ( notifySignalMinQualityChanged, (SoundStreamID id, float q), (id, q) )
+ CALL_SNDSTR_SERVER ( notifyStereoChanged, (SoundStreamID id, bool s), (id, s) )
+
+ CALL_SNDSTR_SERVER ( sendTreble , (SoundStreamID id, float v), (id, v) )
+ CALL_SNDSTR_SERVER ( sendBass , (SoundStreamID id, float v), (id, v) )
+ CALL_SNDSTR_SERVER ( sendBalance , (SoundStreamID id, float v), (id, v) )
+ CALL_SNDSTR_SERVER ( sendMute , (SoundStreamID id, bool mute = true), (id, mute) )
+ CALL_SNDSTR_SERVER ( sendUnmute , (SoundStreamID id, bool unmute = true), (id, unmute) )
+ CALL_SNDSTR_SERVER ( sendSignalMinQuality , (SoundStreamID id, float q), (id, q) )
+ CALL_SNDSTR_SERVER ( sendStereo, (SoundStreamID id, bool s), (id, s) )
+
+ CALL_SNDSTR_SERVER ( queryTreble, (SoundStreamID id, float &v), (id, v) )
+ CALL_SNDSTR_SERVER ( queryBass, (SoundStreamID id, float &v), (id, v) )
+ CALL_SNDSTR_SERVER ( queryBalance, (SoundStreamID id, float &v), (id, v) )
+ CALL_SNDSTR_SERVER ( querySignalQuality, (SoundStreamID id, float &v), (id, v) )
+ CALL_SNDSTR_SERVER ( querySignalMinQuality, (SoundStreamID id, float &v), (id, v) )
+ CALL_SNDSTR_SERVER ( queryHasGoodQuality, (SoundStreamID id, bool &v), (id, v) )
+ CALL_SNDSTR_SERVER ( queryIsStereo, (SoundStreamID id, bool &v), (id, v) )
+ CALL_SNDSTR_SERVER ( queryIsMuted, (SoundStreamID id, bool &v), (id, v) )
+
+
+ // sendPreparePlayback/sendPrepareCapture don't make sense for multiple receivers
+ CALL_SNDSTR_SERVER ( sendReleasePlayback, (SoundStreamID id), (id) )
+ CALL_SNDSTR_SERVER ( sendReleaseCapture, (SoundStreamID id), (id) )
+
+ CALL_SNDSTR_SERVER ( sendStartPlayback, (SoundStreamID id), (id) )
+ CALL_SNDSTR_SERVER ( sendPausePlayback, (SoundStreamID id), (id) )
+ CALL_SNDSTR_SERVER ( sendStopPlayback, (SoundStreamID id), (id) )
+ CALL_SNDSTR_SERVER ( queryIsPlaybackRunning, (SoundStreamID id, bool &b), (id, b) )
+
+// CALL_SNDSTR_SERVER ( sendStartCapture, (SoundStreamID id), (id) )
+ CALL_SNDSTR_SERVER ( sendStartCaptureWithFormat, (SoundStreamID id,
+ const SoundFormat &proposed_format,
+ SoundFormat &real_format,
+ bool force_format = false), (id, proposed_format, real_format, force_format) )
+ CALL_SNDSTR_SERVER ( sendStopCapture, (SoundStreamID id), (id) )
+ CALL_SNDSTR_SERVER ( queryIsCaptureRunning, (SoundStreamID id, bool &b, SoundFormat &sf), (id, b, sf) )
+
+ CALL_SNDSTR_SERVER ( sendStartRecording, (SoundStreamID id), (id) )
+ CALL_SNDSTR_SERVER ( sendStartRecordingWithFormat, (SoundStreamID id,
+ const SoundFormat &proposed_format,
+ SoundFormat &real_format), (id, proposed_format, real_format) )
+ CALL_SNDSTR_SERVER ( sendStopRecording, (SoundStreamID id), (id) )
+ CALL_SNDSTR_SERVER ( queryIsRecordingRunning, (SoundStreamID id, bool &b, SoundFormat &sf), (id, b, sf) )
+
+ CALL_SNDSTR_SERVER ( querySoundStreamDescription, (SoundStreamID id, TQString &descr), (id, descr) )
+ CALL_SNDSTR_SERVER ( querySoundStreamRadioStation,(SoundStreamID id, const RadioStation *&rs), (id, rs) )
+
+ CALL_SNDSTR_SERVER ( queryEnumerateSoundStreams, (TQMap<TQString, SoundStreamID> &list), (list) )
+
+ CALL_SNDSTR_SERVER ( notifySoundStreamCreated, (SoundStreamID id), (id) )
+ CALL_SNDSTR_SERVER ( notifySoundStreamClosed, (SoundStreamID id), (id) )
+ CALL_SNDSTR_SERVER ( notifySoundStreamRedirected, (SoundStreamID oldID, SoundStreamID newID), (oldID, newID) )
+
+ // e.g description or whatever changed
+ CALL_SNDSTR_SERVER ( notifySoundStreamChanged, (SoundStreamID id), (id) )
+
+ CALL_SNDSTR_SERVER ( notifySoundStreamData, (SoundStreamID id, const SoundFormat &f, const char *data, size_t size, size_t consumed_size, const SoundMetaData &md), (id, f, data, size, consumed_size, md) )
+ CALL_SNDSTR_SERVER ( notifyReadyForPlaybackData, (SoundStreamID id, size_t size), (id, size) )
+
+protected:
+
+ SoundStreamID createNewSoundStream(bool notify = true) const;
+ SoundStreamID createNewSoundStream(SoundStreamID old_id, bool notify = true) const;
+ void closeSoundStream(SoundStreamID id, bool notify = true);
+
+ static TQString createNewSoundStreamClientID();
+ void setSoundStreamClientID(const TQString &s);
+
+ TQString m_SoundStreamClientID;
+
+ cmplInterface *m_Server;
+};
+
+
+#endif
diff --git a/src/include/soundstreamid.h b/src/include/soundstreamid.h
new file mode 100644
index 0000000..e7aa4d5
--- /dev/null
+++ b/src/include/soundstreamid.h
@@ -0,0 +1,63 @@
+/***************************************************************************
+ soundstreamid.h - description
+ -------------------
+ begin : Sun Aug 1 2004
+ copyright : (C) 2004 by Martin Witte
+ email : 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_SOUNDSTREAMID_H
+#define KRADIO_SOUNDSTREAMID_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+class SoundStreamID {
+
+ SoundStreamID(int _id, int _phys_id);
+public:
+ SoundStreamID();
+ SoundStreamID(const SoundStreamID &org);
+
+ SoundStreamID &operator = (const SoundStreamID &id);
+
+ static SoundStreamID createNewID();
+ static SoundStreamID createNewID(const SoundStreamID &oldID);
+
+ bool operator == (const SoundStreamID id) const { return m_ID == id.m_ID; }
+ bool operator != (const SoundStreamID id) const { return m_ID != id.m_ID; }
+ bool operator > (const SoundStreamID id) const { return m_ID > id.m_ID; }
+ bool operator < (const SoundStreamID id) const { return m_ID < id.m_ID; }
+ bool operator >= (const SoundStreamID id) const { return m_ID >= id.m_ID; }
+ bool operator <= (const SoundStreamID id) const { return m_ID <= id.m_ID; }
+
+ bool HasSamePhysicalID(const SoundStreamID &x) const { return m_PhysicalID == x.m_PhysicalID; }
+
+ bool isValid() const { return m_ID != 0; } // m_PhysicalID is not checked!
+ void invalidate();
+
+ static const SoundStreamID InvalidID;
+
+ int getID() const { return m_ID; }
+ int getPhysicalID() const { return m_PhysicalID; }
+
+protected:
+ unsigned m_ID;
+ unsigned m_PhysicalID;
+ static unsigned nextID;
+ static unsigned nextPhysicalID;
+};
+
+
+#endif
+
diff --git a/src/include/standardscandialog.h b/src/include/standardscandialog.h
new file mode 100644
index 0000000..2be7c74
--- /dev/null
+++ b/src/include/standardscandialog.h
@@ -0,0 +1,101 @@
+/***************************************************************************
+ standardscandialog.h - description
+ -------------------
+ begin : Son Aug 3 2003
+ copyright : (C) 2003 by Martin Witte
+ email : 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_STANDARDSCANDIALOG_H
+#define KRADIO_STANDARDSCANDIALOG_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <standardscandialog-ui.h>
+#include "radiodevice_interfaces.h"
+#include "radio_interfaces.h"
+#include "stationlist.h"
+
+#include <tqtimer.h>
+#include <tqdatetime.h>
+
+class StandardScanDialog : public StandardScanDialogUI,
+ public ISeekRadioClient,
+// public IRadioSoundClient,
+ public IRadioClient
+{
+Q_OBJECT
+
+public:
+ StandardScanDialog(TQWidget *parent);
+ ~StandardScanDialog();
+
+ bool connectI (Interface *i);
+ bool disconnectI (Interface *i);
+
+ void start();
+ void stop();
+
+ const StationList &getStations() const { return m_stations; }
+
+// ISeekRadioClient
+
+RECEIVERS:
+ bool noticeSeekStarted (bool up);
+ bool noticeSeekStopped ();
+ bool noticeSeekFinished (const RadioStation &s, bool goodQuality);
+ bool noticeProgress (float f);
+
+// // ISoundRadioClient
+//
+// RECEIVERS:
+// bool noticeVolumeChanged(float /*v*/) { return false; }
+// bool noticeTrebleChanged(float /*v*/) { return false; }
+// bool noticeBassChanged(float /*v*/) { return false; }
+// bool noticeBalanceChanged(float /*v*/) { return false; }
+// bool noticeSignalQualityChanged(float /*q*/) { return false; }
+// bool noticeSignalQualityChanged(bool /*good*/) { return false; }
+// bool noticeSignalMinQualityChanged(float /*q*/) { return false; }
+// bool noticeStereoChanged(bool /*s*/) { return false; }
+// bool noticeMuted(bool /*m*/) { return false; }
+
+// IRadioClient
+
+RECEIVERS:
+ bool noticePowerChanged(bool on);
+ bool noticeStationChanged (const RadioStation &, int /*idx*/){ return false; }
+ bool noticeStationsChanged(const StationList &/*sl*/) { return false; }
+ bool noticePresetFileChanged(const TQString &/*f*/) { return false; }
+
+ bool noticeCurrentSoundStreamIDChanged(SoundStreamID /*id*/) { return false; }
+
+protected slots:
+
+ void slotCancelDone();
+
+protected:
+
+ int m_count;
+ bool m_running;
+ bool m_oldPowerOn;
+ RadioStation *m_oldStation;
+ TQDateTime m_startTime;
+
+ StationList m_stations;
+
+ bool m_ignorePower;
+};
+
+
+#endif
diff --git a/src/include/station-drag-object.h b/src/include/station-drag-object.h
new file mode 100644
index 0000000..5796dd0
--- /dev/null
+++ b/src/include/station-drag-object.h
@@ -0,0 +1,39 @@
+/***************************************************************************
+ station-drag-object.h - description
+ -------------------
+ begin : Sun Aug 28 2005
+ copyright : (C) 2005 by Martin Witte
+ email : 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_STATION_DRAG_OBJECT_H
+#define KRADIO_STATION_DRAG_OBJECT_H
+
+#include <tqdragobject.h>
+
+class StationDragObject : public TQStoredDrag
+{
+public:
+ StationDragObject(const TQStringList &stationIDs, TQWidget *dragSource = NULL, const char * name = NULL);
+ StationDragObject(TQWidget *dragSource = NULL, const char * name = NULL);
+ virtual ~StationDragObject();
+
+ const char *format(int i = 0) const;
+
+ void setStations(const TQStringList &stationIDs);
+
+ static bool canDecode (const TQMimeSource *e);
+ static bool decode (const TQMimeSource *e, TQStringList &stationIDs);
+};
+
+#endif
+
diff --git a/src/include/stationlist.h b/src/include/stationlist.h
new file mode 100644
index 0000000..dcacdca
--- /dev/null
+++ b/src/include/stationlist.h
@@ -0,0 +1,159 @@
+/***************************************************************************
+ stationlist.h - description
+ -------------------
+ begin : Sat March 29 2003
+ copyright : (C) 2003 by Klas Kalass
+ email : klas@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 STATIONLIST_H
+#define STATIONLIST_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "stationlistmetadata.h"
+#include "errorlog-interfaces.h"
+
+#include <tqptrlist.h>
+
+class RadioStation;
+class KURL;
+
+/*
+
+ Why an own Station List ?
+
+ RadioStations are used everywhere. But who is responsible for them?
+ Especially after a list merge?
+
+ A very simple solution should be a StationList with "deep copies". Though
+ this is not very efficient, we can assume, that copy operations do not
+ take place very often and thus are not critical.
+
+
+ Why don't we use TQValueList then?
+
+ We are using polymorphic radio stations, thus we cannot use a template
+ using instances of a base class and copying them with a copy constructor.
+ But as each derived class has its own copy() function, we are able to create
+ exact copies from a pointer with the type of our base class "RadioStation".
+
+*/
+
+
+class RawStationList : public TQPtrList<RadioStation>
+{
+public:
+
+ typedef TQPtrListIterator<RadioStation> Iterator;
+ typedef TQPtrList<RadioStation> BaseClass;
+
+public:
+ RawStationList ();
+ RawStationList (const RawStationList &sl);
+ ~RawStationList ();
+
+ // overwrite all insert-methods in order to change
+ // multiple insertion of same station_id into an update
+
+ bool insert (uint index, const RadioStation *item);
+ bool insert (const RadioStation *item);
+ void inSort (const RadioStation *item);
+ void prepend (const RadioStation *item);
+ void append (const RadioStation *item);
+ bool replace (uint index, const RadioStation *item);
+
+ // simplify stationIDSearch
+
+ const RadioStation & stationWithID(const TQString &sid) const;
+ RadioStation & stationWithID(const TQString &sid);
+
+ int idxWithID(const TQString &sid) const;
+
+ bool operator == (const RawStationList &l) const;
+ bool operator != (const RawStationList &l) const { return !operator==(l); }
+
+protected:
+
+ TQPtrCollection::Item newItem (TQPtrCollection::Item s);
+ void deleteItem (TQPtrCollection::Item s);
+
+ int compareItems (TQPtrCollection::Item a, TQPtrCollection::Item b);
+};
+
+
+
+
+/**
+ * Contains a list of stations, including meta data
+ * @author Klas Kalass, Ernst Martin Witte
+ */
+
+class StationList {
+public:
+ StationList();
+ StationList(const StationList &sl);
+ ~StationList();
+
+ // some usefull "proxy" functions
+
+ int count() const { return m_all.count(); }
+ const RadioStation & at(int idx) const;
+ RadioStation & at(int idx);
+
+ const RadioStation & stationWithID(const TQString &sid) const;
+ RadioStation & stationWithID(const TQString &sid);
+
+ // all stations, with full access
+ RawStationList & all() { return m_all; }
+ RawStationList const & all() const { return m_all; }
+
+ // the meta data for this station List, with full access
+ StationListMetaData & metaData() { return m_metaData; }
+ StationListMetaData const & metaData() const { return m_metaData; }
+
+ // we do not need a special matchingStation/find/... method because
+ // it is already implemented in RawStationList
+
+ /**
+ * merges the other list into this one. creates copies from the stations.
+ */
+ void merge(const StationList &other);
+
+ // assignment
+
+ StationList &operator = (const StationList &sl);
+
+
+ // xml in/out
+
+ bool readXML (const TQString &dat, const IErrorLogClient &logger, bool enableMessageBox = true);
+ bool readXML (const KURL &url, const IErrorLogClient &logger, bool enableMessageBox = true);
+
+ TQString writeXML (const IErrorLogClient &logger) const;
+ bool writeXML (const KURL &url, const IErrorLogClient &logger, bool enableMessageBox = true) const;
+
+
+ bool operator == (const StationList &x) const { return m_all == x.m_all && m_metaData == x.m_metaData; }
+ bool operator != (const StationList &x) const { return !operator ==(x); }
+
+protected:
+ RawStationList m_all;
+ StationListMetaData m_metaData;
+};
+
+
+extern const StationList emptyStationList;
+
+#endif
diff --git a/src/include/stationlistmetadata.h b/src/include/stationlistmetadata.h
new file mode 100644
index 0000000..00f54f3
--- /dev/null
+++ b/src/include/stationlistmetadata.h
@@ -0,0 +1,55 @@
+/***************************************************************************
+ stationlistmetadata.h - description
+ -------------------
+ begin : Sat March 29 2003
+ copyright : (C) 2003 by Klas Kalass
+ email : klas@kde.org
+ copyright : (C) 2002 by Martin Witte / Frank Schwanz
+ email : witte@kawo1.rwth-aachen.de / schwanz@fh-brandenburg.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 STATIONLISTMETADATA_H
+#define STATIONLISTMETADATA_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tqstring.h>
+#include <tqdatetime.h>
+
+/**
+ * Meta Data about a stationlist
+ * @author Martin Witte
+ */
+
+class StationListMetaData {
+public:
+ TQString maintainer;
+ TQDateTime lastChange;
+ TQString country;
+ TQString city;
+ TQString media;
+ TQString comment;
+
+ bool operator != (const StationListMetaData &x) const { return !operator ==(x); }
+ bool operator == (const StationListMetaData &x) const {
+ return maintainer == x.maintainer &&
+ lastChange == x.lastChange &&
+ country == x.country &&
+ city == x.city &&
+ media == x.media &&
+ comment == x.comment;
+ }
+};
+
+#endif
diff --git a/src/include/stationlistxmlhandler.h b/src/include/stationlistxmlhandler.h
new file mode 100644
index 0000000..65c3cff
--- /dev/null
+++ b/src/include/stationlistxmlhandler.h
@@ -0,0 +1,85 @@
+/***************************************************************************
+ radiocfgxmlhandler.h - description
+ -------------------
+ begin : Son Jan 12 2003
+ copyright : (C) 2003 by Martin Witte
+ email : 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_RADIOCFGXMLHANDLER_H
+#define KRADIO_RADIOCFGXMLHANDLER_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tqxml.h>
+#include <tqobject.h>
+
+#include "radiostation.h"
+#include "stationlist.h"
+
+class StationListXmlHandler : public TQXmlDefaultHandler
+{
+protected:
+ TQStringList m_status;
+ const IErrorLogClient&m_logger;
+
+ RawStationList m_stations;
+ StationListMetaData m_metaData;
+
+ RadioStation *m_newStation;
+
+ bool m_compatMode;
+
+public :
+ StationListXmlHandler (const IErrorLogClient &logger);
+ virtual ~StationListXmlHandler ();
+ bool startDocument ();
+ bool startElement (const TQString &ns, const TQString &localname,
+ const TQString& qname, const TQXmlAttributes &);
+ bool endElement (const TQString &ns, const TQString &localname,
+ const TQString &qname);
+ bool characters (const TQString &ch);
+
+ const RawStationList &getStations() const { return m_stations; }
+ const StationListMetaData &getMetaData() const { return m_metaData; }
+
+
+ bool wasCompatMode() const { return m_compatMode; }
+
+protected:
+
+ void clearNewStation();
+};
+
+
+
+extern const char *TDERadioConfigElement;
+extern const char *StationListElement;
+
+extern const char *StationListInfo;
+extern const char *StationListInfoMaintainer;
+extern const char *StationListInfoCountry;
+extern const char *StationListInfoCity;
+extern const char *StationListInfoMedia;
+extern const char *StationListInfoComments;
+extern const char *StationListInfoChanged;
+extern const char *StationListInfoCreator;
+
+extern const char *StationQuickSelectElement;
+extern const char *StationDockingMenuElement;
+extern const char *StationListFormat;
+
+#define STATION_LIST_FORMAT "tderadio-1.0"
+
+
+#endif
diff --git a/src/include/stationselection_interfaces.h b/src/include/stationselection_interfaces.h
new file mode 100644
index 0000000..463eca0
--- /dev/null
+++ b/src/include/stationselection_interfaces.h
@@ -0,0 +1,67 @@
+/***************************************************************************
+ stationselection_interfaces.h - description
+ -------------------
+ begin : Son Aug 3 2003
+ copyright : (C) 2003 by Martin Witte
+ email : 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_STATIONSELECTION_INTERFACES_H
+#define KRADIO_STATIONSELECTION_INTERFACES_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "interfaces.h"
+
+class TQStringList;
+
+INTERFACE(IStationSelection, IStationSelectionClient)
+{
+public :
+ IF_CON_DESTRUCTOR(IStationSelection, -1)
+
+RECEIVERS:
+ IF_RECEIVER( setStationSelection(const TQStringList &sl) )
+
+SENDERS:
+ IF_SENDER ( notifyStationSelectionChanged(const TQStringList &sl) )
+
+ANSWERS:
+ IF_ANSWER ( const TQStringList & getStationSelection () const )
+
+};
+
+
+INTERFACE(IStationSelectionClient, IStationSelection)
+{
+public :
+ IF_CON_DESTRUCTOR(IStationSelectionClient, 1)
+
+SENDERS:
+ IF_SENDER ( sendStationSelection(const TQStringList &sl) )
+
+RECEIVERS:
+ IF_RECEIVER( noticeStationSelectionChanged(const TQStringList &sl) )
+
+QUERIES:
+ IF_QUERY ( const TQStringList & queryStationSelection () )
+
+
+RECEIVERS:
+ virtual void noticeConnectedI (cmplInterface *, bool /*pointer_valid*/);
+ virtual void noticeDisconnectedI (cmplInterface *, bool /*pointer_valid*/);
+};
+
+
+#endif
diff --git a/src/include/stationselector.h b/src/include/stationselector.h
new file mode 100644
index 0000000..009293e
--- /dev/null
+++ b/src/include/stationselector.h
@@ -0,0 +1,100 @@
+/***************************************************************************
+ StationSelector.h - description
+ -------------------
+ begin : Son Aug 3 2003
+ copyright : (C) 2003 by Martin Witte
+ email : 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_STATIONSELECTOR_H
+#define KRADIO_STATIONSELECTOR_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tqstringlist.h>
+
+#include "radio_interfaces.h"
+#include "stationselection_interfaces.h"
+#include "stationlist.h"
+
+#include <stationselector-ui.h>
+#include "radiostation-listview.h"
+
+
+class RadioStationListView;
+
+class StationSelector : public StationSelectorUI,
+ public IRadioClient,
+ public IStationSelectionClient
+{
+Q_OBJECT
+
+public :
+ StationSelector (TQWidget *parent);
+ ~StationSelector ();
+
+ bool connectI (Interface *i);
+ bool disconnectI (Interface *i);
+
+// IStationSelectionClient
+
+ bool noticeStationSelectionChanged(const TQStringList &sl);
+
+// IRadioClient
+
+ bool noticePowerChanged(bool /*on*/) { return false; }
+ bool noticeStationChanged (const RadioStation &, int /*idx*/) { return false; }
+ bool noticeStationsChanged(const StationList &sl);
+ bool noticePresetFileChanged(const TQString &/*f*/) { return false; }
+
+ bool noticeCurrentSoundStreamIDChanged(SoundStreamID) { return false; }
+
+ void saveState (TDEConfig *) const;
+ void restoreState (TDEConfig *);
+
+ bool isDirty () const { return m_dirty; }
+
+protected slots:
+
+ void slotButtonToLeft();
+ void slotButtonToRight();
+ void slotMoveToRight(const TQStringList &list);
+ void slotMoveToLeft(const TQStringList &list);
+
+ void slotOK();
+ void slotCancel();
+ void slotSetDirty();
+
+signals:
+
+ void sigDirty();
+
+protected:
+
+ void moveItem (RadioStationListView *fromListView, TQStringList &fromIDList,
+ TQListViewItem *item, int fromIdx,
+ RadioStationListView *toListView, TQStringList &toIDList);
+
+ void updateListViews();
+
+ // station ids
+ TQStringList m_stationIDsAvailable,
+ m_stationIDsSelected,
+ m_stationIDsNotDisplayed,
+ m_stationIDsAll;
+
+ bool m_dirty;
+};
+
+#endif
diff --git a/src/include/tderadioapp.h b/src/include/tderadioapp.h
new file mode 100644
index 0000000..8861f04
--- /dev/null
+++ b/src/include/tderadioapp.h
@@ -0,0 +1,121 @@
+/***************************************************************************
+ tderadioapp.h - description
+ -------------------
+ begin : Sa Feb 9 2002
+ copyright : (C) 2002 by Klas Kalass / Martin Witte / Frank Schwanz
+ email : klas.kalass@gmx.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 TDERADIO_TDERADIOAPP_H
+#define TDERADIO_TDERADIOAPP_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tqdict.h>
+
+#include <tdeapplication.h>
+#include <tdeaboutapplication.h>
+#include "pluginmanager.h"
+#include "plugins.h"
+
+class KLibrary;
+
+class TDERadioAbout : public PluginBase
+{
+public:
+ TDERadioAbout(const TQString &name) : PluginBase(name, "TDERadio Application") {}
+
+ virtual TQString pluginClassName() const { return "TDERadioAbout"; }
+
+ virtual ConfigPageInfo createConfigurationPage () { return ConfigPageInfo(); }
+ virtual AboutPageInfo createAboutPage ();
+
+ virtual void saveState (TDEConfig *) const {}
+ virtual void restoreState (TDEConfig *) {}
+};
+
+
+
+
+typedef PluginBase *(*t_tderadio_plugin_init_func)(const TQString & cls, const TQString &obj);
+typedef void (*t_tderadio_plugin_info_func)(TQMap<TQString, TQString> &);
+typedef void (*t_tderadio_plugin_libload_func)();
+typedef void (*t_tderadio_plugin_libunload_func)();
+
+
+struct PluginLibraryInfo {
+ KLibrary *library;
+ TQMap<TQString,TQString> plugins;
+ t_tderadio_plugin_init_func init_func;
+ t_tderadio_plugin_info_func info_func;
+ t_tderadio_plugin_libload_func libload_func;
+ t_tderadio_plugin_libunload_func libunload_func;
+
+ PluginLibraryInfo() : library(NULL), init_func(NULL), info_func(NULL), libload_func(NULL), libunload_func(NULL) {}
+ PluginLibraryInfo(const TQString &libname);
+ bool valid() { return init_func && info_func && library && libload_func && libunload_func; }
+};
+
+
+struct PluginClassInfo {
+ TQString class_name;
+ TQString description;
+ t_tderadio_plugin_init_func create_function;
+
+ PluginClassInfo() : create_function(NULL) {}
+ PluginClassInfo(const TQString &_name, const TQString &descr, t_tderadio_plugin_init_func init_func)
+ : class_name(_name), description(descr), create_function(init_func) {}
+ PluginBase *CreateInstance(const TQString &obj_name) { return create_function ? create_function(class_name, obj_name) : NULL; }
+};
+
+
+class TDERadioApp : public TDEApplication
+{
+Q_OBJECT
+
+public:
+ TDERadioApp();
+ virtual ~TDERadioApp();
+
+ virtual void saveState (TDEConfig *c);
+ virtual void restoreState (TDEConfig *c);
+
+ virtual PluginManager *createNewInstance(const TQString &name);
+
+ virtual KLibrary *LoadLibrary (const TQString &library);
+ virtual void UnloadLibrary (const TQString &library);
+ virtual PluginBase *CreatePlugin (PluginManager *manager, const TQString &name, const TQString &object_name);
+
+ virtual const TQMap<TQString, PluginLibraryInfo> &getPluginLibraries() const { return m_PluginLibraries; }
+ virtual const TQMap<TQString, PluginClassInfo> &getPluginClasses() const { return m_PluginInfos; }
+
+ virtual void startPlugins();
+
+protected slots:
+
+ virtual void saveState();
+ virtual void slotAboutToQuit();
+
+protected:
+
+ TQDict<PluginManager> m_Instances;
+
+ TQMap<TQString, PluginLibraryInfo> m_PluginLibraries;
+ TQMap<TQString, PluginClassInfo> m_PluginInfos;
+
+ bool m_quitting;
+};
+
+
+#endif
diff --git a/src/include/tderadioversion.h b/src/include/tderadioversion.h
new file mode 100644
index 0000000..adfdca1
--- /dev/null
+++ b/src/include/tderadioversion.h
@@ -0,0 +1,23 @@
+/***************************************************************************
+ tderadioversion.h - description
+ -------------------
+ begin : Su May 22 2005
+ copyright : (C) 2005 by Marcus Camen
+ email : mcamen@mcamen.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 TDERADIO_VERSION_H
+#define TDERADIO_VERSION "snapshot-2006-11-12-r497"
+
+#define TDERADIO_VERSION "snapshot-2006-11-12-r497"
+
+#endif
diff --git a/src/include/timecontrol_interfaces.h b/src/include/timecontrol_interfaces.h
new file mode 100644
index 0000000..7fc72ac
--- /dev/null
+++ b/src/include/timecontrol_interfaces.h
@@ -0,0 +1,106 @@
+/***************************************************************************
+ timecontrol_interfaces.h - description
+ -------------------
+ begin : Mon Mär 10 2003
+ copyright : (C) 2003 by Martin Witte
+ email : 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. *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * Interfaces in this header: *
+ * *
+ * ITimeControl(Client) *
+ * *
+ ***************************************************************************/
+
+
+#ifndef KRADIO_TIMECONTROL_INTERFACES_H
+#define KRADIO_TIMECONTROL_INTERFACES_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "interfaces.h"
+#include "alarm.h"
+
+INTERFACE(ITimeControl, ITimeControlClient)
+{
+public :
+ IF_CON_DESTRUCTOR(ITimeControl, -1)
+
+RECEIVERS:
+ IF_RECEIVER( setAlarms(const AlarmVector &sl) )
+ IF_RECEIVER( setCountdownSeconds(int n) )
+ IF_RECEIVER( startCountdown() )
+ IF_RECEIVER( stopCountdown() )
+
+
+SENDERS:
+ IF_SENDER ( notifyAlarmsChanged(const AlarmVector &sl) )
+ IF_SENDER ( notifyAlarm(const Alarm &) )
+ IF_SENDER ( notifyNextAlarmChanged(const Alarm *) )
+ IF_SENDER ( notifyCountdownStarted(const TQDateTime &end) )
+ IF_SENDER ( notifyCountdownStopped() )
+ IF_SENDER ( notifyCountdownZero() )
+ IF_SENDER ( notifyCountdownSecondsChanged(int n) )
+
+
+ANSWERS:
+ IF_ANSWER ( TQDateTime getNextAlarmTime () const )
+ IF_ANSWER ( const Alarm* getNextAlarm () const )
+ IF_ANSWER ( const AlarmVector & getAlarms () const )
+ IF_ANSWER ( int getCountdownSeconds () const )
+ IF_ANSWER ( TQDateTime getCountdownEnd () const )
+
+};
+
+
+INTERFACE(ITimeControlClient, ITimeControl)
+{
+public :
+ IF_CON_DESTRUCTOR(ITimeControlClient, 1)
+
+SENDERS:
+ IF_SENDER ( sendAlarms(const AlarmVector &sl) )
+ IF_SENDER ( sendCountdownSeconds(int n) )
+ IF_SENDER ( sendStartCountdown() )
+ IF_SENDER ( sendStopCountdown() )
+
+
+RECEIVERS:
+ IF_RECEIVER( noticeAlarmsChanged(const AlarmVector &sl) )
+ IF_RECEIVER( noticeAlarm(const Alarm &) )
+ IF_RECEIVER( noticeNextAlarmChanged(const Alarm *) )
+ IF_RECEIVER( noticeCountdownStarted(const TQDateTime &end) )
+ IF_RECEIVER( noticeCountdownStopped() )
+ IF_RECEIVER( noticeCountdownZero() )
+ IF_RECEIVER( noticeCountdownSecondsChanged(int n) )
+
+
+QUERIES:
+ IF_QUERY ( TQDateTime queryNextAlarmTime() )
+ IF_QUERY ( const Alarm* queryNextAlarm () )
+ IF_QUERY ( const AlarmVector & queryAlarms () )
+ IF_QUERY ( int queryCountdownSeconds () )
+ IF_QUERY ( TQDateTime queryCountdownEnd () )
+
+RECEIVERS:
+ virtual void noticeConnectedI (cmplInterface *, bool /*pointer_valid*/);
+ virtual void noticeDisconnectedI (cmplInterface *, bool /*pointer_valid*/);
+};
+
+
+
+
+#endif
diff --git a/src/include/utils.h b/src/include/utils.h
new file mode 100644
index 0000000..c446c82
--- /dev/null
+++ b/src/include/utils.h
@@ -0,0 +1,47 @@
+/***************************************************************************
+ utils.h - description
+ -------------------
+ begin : Sun Feb 3 2002
+ copyright : (C) 2002 by Martin Witte / Frank Schwanz
+ email : witte@kawo1.rwth-aachen.de / schwanz@fh-brandenburg.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_UTILS_H
+#define KRADIO_UTILS_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+using namespace std;
+
+#include <tdeconfig.h>
+#include <tdelocale.h>
+#include <kdebug.h>
+#include <tqstring.h>
+#define __USE_ISOC99 1
+#include <math.h>
+
+//extern const char *mixerChannelLabels[];
+//extern const char *mixerChannelNames[];
+
+extern TQString XMLEscape (const TQString &s);
+TQString xmlOpenTag (const TQString &tag, bool newline = true);
+TQString xmlTag (const TQString &tag, const TQString &s, bool newline = true);
+TQString xmlTag (const TQString &tag, int i, bool newline = true);
+TQString xmlTag (const TQString &tag, float f, bool newline = true);
+TQString xmlCloseTag (const TQString &tag, bool newline = true);
+
+template<class T1, class T2> inline T1 min (T1 a, T2 b) { return a < b ? a : b; }
+template<class T1, class T2> inline T1 max (T1 a, T2 b) { return a < b ? b : a; }
+
+#endif
diff --git a/src/include/widgetplugins.h b/src/include/widgetplugins.h
new file mode 100644
index 0000000..69bb0bf
--- /dev/null
+++ b/src/include/widgetplugins.h
@@ -0,0 +1,75 @@
+/***************************************************************************
+ widgetplugins.h - description
+ -------------------
+ begin : Mi Aug 27 2003
+ copyright : (C) 2003 by Martin Witte
+ email : 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_WIDGETPLUGINS_INTERFACES_H
+#define KRADIO_WIDGETPLUGINS_INTERFACES_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "plugins.h"
+
+class TQWidget;
+
+class WidgetPluginBase : public PluginBase
+{
+public :
+ WidgetPluginBase(const TQString &name, const TQString &description);
+
+ virtual void saveState (TDEConfig *) const;
+ virtual void restoreState (TDEConfig *);
+ virtual void restoreState (TDEConfig *, bool showByDefault);
+ virtual void startPlugin();
+
+ virtual TQWidget *getWidget() = 0;
+ virtual const TQWidget *getWidget() const = 0;
+
+ virtual bool isReallyVisible(const TQWidget *w = NULL) const;
+ virtual bool isAnywhereVisible(const TQWidget *w = NULL) const;
+ virtual void showOnOrgDesktop () = 0;
+
+protected:
+ virtual void pShowOnOrgDesktop ();
+ virtual void pShow ();
+ virtual void pShow (bool show);
+ virtual void pHide ();
+ virtual void pToggleShown ();
+
+ virtual void pShowEvent(TQShowEvent *);
+ virtual void pHideEvent(TQHideEvent *);
+
+ virtual void notifyManager(bool shown);
+
+ virtual void getKWinState(const TQWidget *w = NULL) const;
+
+protected:
+ // temporary data
+ mutable bool m_geoCacheValid;
+ mutable bool m_saveMinimized;
+ mutable bool m_saveMaximized;
+ mutable bool m_saveSticky;
+ mutable int m_saveDesktop;
+ mutable TQRect m_saveGeometry;
+
+ bool m_geoRestoreFlag;
+ bool m_restoreShow;
+};
+
+
+
+#endif