summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeL10n.txt6
-rw-r--r--src/Makefile.am104
-rw-r--r--src/aboutwidget.cpp611
-rw-r--r--src/alarm.cpp82
-rw-r--r--src/debug-profiler.cpp138
-rw-r--r--src/errorlog-interfaces.cpp111
-rw-r--r--src/fileringbuffer.cpp252
-rw-r--r--src/frequencyradiostation.cpp200
-rw-r--r--src/frequencyseekhelper.cpp142
-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
-rw-r--r--src/internetradiostation.cpp176
-rw-r--r--src/main.cpp73
-rw-r--r--src/multibuffer.cpp131
-rw-r--r--src/plugin_configuration_dialog.cpp103
-rw-r--r--src/pluginmanager-configuration-ui.ui389
-rw-r--r--src/pluginmanager-configuration.cpp171
-rw-r--r--src/pluginmanager.cpp538
-rw-r--r--src/plugins.cpp84
-rw-r--r--src/po/Makefile.am2
-rw-r--r--src/po/de.po534
-rw-r--r--src/po/es.po1316
-rw-r--r--src/po/pl.po1261
-rw-r--r--src/po/ru.po530
-rw-r--r--src/po/tderadio.pot498
-rw-r--r--src/radio_interfaces.cpp96
-rw-r--r--src/radiodevice_interfaces.cpp330
-rw-r--r--src/radiodevicepool_interfaces.cpp65
-rw-r--r--src/radiostation-config.cpp102
-rw-r--r--src/radiostation-listview.cpp259
-rw-r--r--src/radiostation.cpp216
-rw-r--r--src/ringbuffer.cpp173
-rw-r--r--src/seekhelper.cpp134
-rw-r--r--src/soundformat.cpp270
-rw-r--r--src/soundstreamclient_interfaces.cpp426
-rw-r--r--src/soundstreamid.cpp70
-rw-r--r--src/standardscandialog-ui.ui136
-rw-r--r--src/standardscandialog.cpp183
-rw-r--r--src/station-drag-object.cpp93
-rw-r--r--src/stationlist.cpp494
-rw-r--r--src/stationlistxmlhandler.cpp230
-rw-r--r--src/stationselection_interfaces.cpp47
-rw-r--r--src/stationselector-ui.ui171
-rw-r--r--src/stationselector.cpp321
-rw-r--r--src/tderadio.desktop13
-rw-r--r--src/tderadioapp.cpp370
-rw-r--r--src/timecontrol_interfaces.cpp104
-rw-r--r--src/utils.cpp69
-rw-r--r--src/widgetplugins.cpp235
86 files changed, 16778 insertions, 0 deletions
diff --git a/src/CMakeL10n.txt b/src/CMakeL10n.txt
new file mode 100644
index 0000000..67a60c2
--- /dev/null
+++ b/src/CMakeL10n.txt
@@ -0,0 +1,6 @@
+##### create translation templates ##############
+
+tde_l10n_create_template(
+ CATALOG "tderadio"
+ DESTINATION "po"
+)
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..774b857
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,104 @@
+SUBDIRS = po .
+
+INCLUDES = -I$(top_srcdir)/src/include \
+ -I$(top_builddir)/src/include \
+ $(all_includes)
+
+METASOURCES = AUTO
+
+META_INCLUDES = $(srcdir)/include
+
+KDE_CXXFLAGS="-UQT_NO_ASCII_CAST"
+
+bin_PROGRAMS = tderadio
+
+tderadio_SOURCES = \
+ main.cpp \
+ errorlog-interfaces.cpp \
+ radiodevice_interfaces.cpp \
+ radiodevicepool_interfaces.cpp \
+ radio_interfaces.cpp \
+ soundstreamclient_interfaces.cpp \
+ stationselection_interfaces.cpp \
+ timecontrol_interfaces.cpp \
+ alarm.cpp \
+ debug-profiler.cpp \
+ fileringbuffer.cpp \
+ frequencyseekhelper.cpp \
+ tderadioapp.cpp \
+ multibuffer.cpp \
+ plugin_configuration_dialog.cpp \
+ pluginmanager-configuration.cpp \
+ pluginmanager-configuration-ui.ui \
+ pluginmanager.cpp \
+ plugins.cpp \
+ ringbuffer.cpp \
+ seekhelper.cpp \
+ soundformat.cpp \
+ soundstreamid.cpp \
+ stationlist.cpp \
+ stationlistxmlhandler.cpp \
+ utils.cpp \
+ widgetplugins.cpp \
+ frequencyradiostation.cpp \
+ internetradiostation.cpp \
+ radiostation-config.cpp \
+ radiostation.cpp \
+ aboutwidget.cpp \
+ radiostation-listview.cpp \
+ standardscandialog.cpp \
+ standardscandialog-ui.ui \
+ station-drag-object.cpp \
+ stationselector.cpp \
+ stationselector-ui.ui
+
+noinst_HEADERS = \
+ include/aboutwidget.h \
+ include/alarm.h \
+ include/debug-profiler.h \
+ include/errorlog-interfaces.h \
+ include/fileringbuffer.h \
+ include/frequencyradiostation.h \
+ include/frequencyseekhelper.h \
+ include/gui_list_helper.h \
+ include/interfaces.h \
+ include/internetradiostation.h \
+ include/tderadioapp.h \
+ include/tderadioversion.h \
+ include/multibuffer.h \
+ include/plugin_configuration_dialog.h \
+ include/pluginmanager-configuration.h \
+ include/pluginmanager.h \
+ include/plugins.h \
+ include/radiodevice_interfaces.h \
+ include/radiodevicepool_interfaces.h \
+ include/radio_interfaces.h \
+ include/radiostation-config.h \
+ include/radiostation.h \
+ include/radiostation-listview.h \
+ include/ringbuffer.h \
+ include/seekhelper.h \
+ include/soundformat.h \
+ include/sound_metadata.h \
+ include/soundstreamclient_interfaces.h \
+ include/soundstreamid.h \
+ include/standardscandialog.h \
+ include/station-drag-object.h \
+ include/stationlist.h \
+ include/stationlistmetadata.h \
+ include/stationlistxmlhandler.h \
+ include/stationselection_interfaces.h \
+ include/stationselector.h \
+ include/timecontrol_interfaces.h \
+ include/utils.h \
+ include/widgetplugins.h
+
+tderadio_LDADD = $(LIB_TDEFILE) $(LIB_TDEUI) $(LIB_TDECORE) $(LIB_TDEIO)
+
+tderadio_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor $(LIRC) -Wl,--export-dynamic
+
+xdg_apps_DATA = tderadio.desktop
+
+messages: rc.cpp
+ $(EXTRACTRC) *.ui >> rc.cpp
+ $(XGETTEXT) rc.cpp *.cpp include/*.h -o po/tderadio.pot
diff --git a/src/aboutwidget.cpp b/src/aboutwidget.cpp
new file mode 100644
index 0000000..053f84b
--- /dev/null
+++ b/src/aboutwidget.cpp
@@ -0,0 +1,611 @@
+/***************************************************************************
+ aboutwidget.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+/* Unfortunately KDE doesn't provide the class TDEAboutContainerBase
+ to public programming, so we have to copy most of that code into
+ an own class :(
+*/
+
+#include "include/tderadioversion.h"
+#include "include/aboutwidget.h"
+#include <tqframe.h>
+#include <tdeaboutdialog.h>
+#include <tqtabwidget.h>
+#include <tqlayout.h>
+#include <tqtabbar.h>
+#include <tqimage.h>
+
+#include <tdeglobalsettings.h>
+#include <ktextbrowser.h>
+#include <tqtextedit.h>
+#include <kdebug.h>
+#include <tdeapplication.h>
+#include <tdelocale.h>
+#include <tdeaboutdata.h>
+#include <kurllabel.h>
+
+// copied (and renamed) from tdeaboutdialog.cpp
+// original: TDEAboutTabWidget
+
+class TDERadioAboutTabWidget : public TQTabWidget
+{
+public:
+ TDERadioAboutTabWidget( TQWidget* parent ) : TQTabWidget( parent ) {}
+ TQSize sizeHint() const {
+ return TQTabWidget::sizeHint().expandedTo( tabBar()->sizeHint() + TQSize(4,4) );
+ }
+};
+
+
+// copied (renamed and extended) from tdeaboutdialog.cpp
+// original: TDEAboutContainerBase
+
+TDERadioAboutWidget::TDERadioAboutWidget(const TDEAboutData &aboutData, int layoutType, TQWidget *_parent,
+ char *_name )
+ : TQWidget( _parent, _name ),
+ mImageLabel(0), mTitleLabel(0), mIconLabel(0),mVersionLabel(0),
+ mAuthorLabel(0), mImageFrame(0),mPageTab(0),mPlainSpace(0)
+{
+ mTopLayout = new TQVBoxLayout( this, 0, KDialog::spacingHint() );
+ if( mTopLayout == 0 ) { return; }
+
+ if( layoutType & AbtImageOnly )
+ {
+ layoutType &= ~(AbtImageLeft|AbtImageRight|AbtTabbed|AbtPlain);
+ }
+ if( layoutType & AbtImageLeft )
+ {
+ layoutType &= ~AbtImageRight;
+ }
+
+ if( layoutType & AbtTitle )
+ {
+ mTitleLabel = new TQLabel( this, "title" );
+ mTitleLabel->setAlignment(AlignCenter);
+ mTopLayout->addWidget( mTitleLabel );
+ mTopLayout->addSpacing( KDialog::spacingHint() );
+ }
+
+ if( layoutType & AbtProduct )
+ {
+ TQWidget *productArea = new TQWidget( this, "area" );
+ mTopLayout->addWidget( productArea, 0, AlignLeft );
+
+ TQHBoxLayout *hbox = new TQHBoxLayout(productArea,0,KDialog::spacingHint());
+ if( hbox == 0 ) { return; }
+
+ mIconLabel = new TQLabel( productArea );
+ hbox->addWidget( mIconLabel, 0, AlignLeft|AlignHCenter );
+
+ TQVBoxLayout *vbox = new TQVBoxLayout();
+ if( vbox == 0 ) { return; }
+ hbox->addLayout( vbox );
+
+ mVersionLabel = new TQLabel( productArea, "version" );
+ mAuthorLabel = new TQLabel( productArea, "author" );
+ vbox->addWidget( mVersionLabel );
+ vbox->addWidget( mAuthorLabel );
+ hbox->activate();
+
+ mTopLayout->addSpacing( KDialog::spacingHint() );
+ }
+
+ TQHBoxLayout *hbox = new TQHBoxLayout();
+ if( hbox == 0 ) { return; }
+ mTopLayout->addLayout( hbox, 10 );
+
+ if( layoutType & AbtImageLeft )
+ {
+ TQVBoxLayout *vbox = new TQVBoxLayout();
+ hbox->addLayout(vbox);
+ vbox->addSpacing(1);
+ mImageFrame = new TQFrame( this );
+ setImageFrame( true );
+ vbox->addWidget( mImageFrame );
+ vbox->addSpacing(1);
+
+ vbox = new TQVBoxLayout( mImageFrame, 1 );
+ mImageLabel = new TDERadioImageTrackLabel( mImageFrame );
+ connect( mImageLabel, TQT_SIGNAL(mouseTrack( int, const TQMouseEvent * )),
+ TQT_SLOT( slotMouseTrack( int, const TQMouseEvent * )) );
+ vbox->addStretch(10);
+ vbox->addWidget( mImageLabel );
+ vbox->addStretch(10);
+ vbox->activate();
+ }
+
+ if( layoutType & AbtTabbed )
+ {
+ mPageTab = new TDERadioAboutTabWidget( this );
+ if( mPageTab == 0 ) { return; }
+ hbox->addWidget( mPageTab, 10 );
+ }
+ else if( layoutType & AbtImageOnly )
+ {
+ mImageFrame = new TQFrame( this );
+ setImageFrame( true );
+ hbox->addWidget( mImageFrame, 10 );
+
+ TQGridLayout *gbox = new TQGridLayout(mImageFrame, 3, 3, 1, 0 );
+ gbox->setRowStretch( 0, 10 );
+ gbox->setRowStretch( 2, 10 );
+ gbox->setColStretch( 0, 10 );
+ gbox->setColStretch( 2, 10 );
+
+ mImageLabel = new TDERadioImageTrackLabel( mImageFrame );
+ connect( mImageLabel, TQT_SIGNAL(mouseTrack( int, const TQMouseEvent * )),
+ TQT_SLOT( slotMouseTrack( int, const TQMouseEvent * )) );
+ gbox->addWidget( mImageLabel, 1, 1 );
+ gbox->activate();
+ }
+ else
+ {
+ mPlainSpace = new TQFrame( this );
+ if( mPlainSpace == 0 ) { return; }
+ hbox->addWidget( mPlainSpace, 10 );
+ }
+
+ if( layoutType & AbtImageRight )
+ {
+ TQVBoxLayout *vbox = new TQVBoxLayout();
+ hbox->addLayout(vbox);
+ vbox->addSpacing(1);
+ mImageFrame = new TQFrame( this );
+ setImageFrame( true );
+ vbox->addWidget( mImageFrame );
+ vbox->addSpacing(1);
+
+ vbox = new TQVBoxLayout( mImageFrame, 1 );
+ mImageLabel = new TDERadioImageTrackLabel( mImageFrame );
+ connect( mImageLabel, TQT_SIGNAL(mouseTrack( int, const TQMouseEvent * )),
+ TQT_SLOT( slotMouseTrack( int, const TQMouseEvent * )) );
+ vbox->addStretch(10);
+ vbox->addWidget( mImageLabel );
+ vbox->addStretch(10);
+ vbox->activate();
+ }
+
+ fontChange( font() );
+
+ setAboutData(aboutData);
+}
+
+
+void TDERadioAboutWidget::show( void )
+{
+ TQWidget::show();
+}
+
+TQSize TDERadioAboutWidget::sizeHint( void ) const
+{
+ return minimumSize().expandedTo( TQSize( TQWidget::sizeHint().width(), 0 ) );
+}
+
+void TDERadioAboutWidget::fontChange( const TQFont &/*oldFont*/ )
+{
+ if( mTitleLabel != 0 )
+ {
+ TQFont f( TDEGlobalSettings::generalFont() );
+ f.setBold( true );
+ f.setPointSize( 14 ); // Perhaps changeable ?
+ mTitleLabel->setFont(f);
+ }
+
+ if( mVersionLabel != 0 )
+ {
+ TQFont f( TDEGlobalSettings::generalFont() );
+ f.setBold( true );
+ mVersionLabel->setFont(f);
+ mAuthorLabel->setFont(f);
+ mVersionLabel->parentWidget()->layout()->activate();
+ }
+
+ update();
+}
+
+TQFrame *TDERadioAboutWidget::addTextPage( const TQString &title,
+ const TQString &text,
+ bool richText, int numLines )
+{
+ TQFrame *page = addEmptyPage( title );
+ if( page == 0 ) { return 0; }
+ if( numLines <= 0 ) { numLines = 10; }
+
+ TQVBoxLayout *vbox = new TQVBoxLayout( page, KDialog::spacingHint() );
+
+ if( richText == true )
+ {
+ KTextBrowser *browser = new KTextBrowser( page, "browser" );
+ browser->setHScrollBarMode( TQScrollView::AlwaysOff );
+ browser->setText( text );
+ browser->setMinimumHeight( fontMetrics().lineSpacing()*numLines );
+
+ vbox->addWidget(browser);
+ connect(browser, TQT_SIGNAL(urlClick(const TQString &)),
+ TQT_SLOT(slotUrlClick(const TQString &)));
+ connect(browser, TQT_SIGNAL(mailClick(const TQString &,const TQString &)),
+ TQT_SLOT(slotMailClick(const TQString &,const TQString &)));
+ }
+ else
+ {
+ TQTextEdit *textEdit = new TQTextEdit( page, "text" );
+ textEdit->setReadOnly( true );
+ textEdit->setMinimumHeight( fontMetrics().lineSpacing()*numLines );
+ textEdit->setWordWrap( TQTextEdit::NoWrap );
+ vbox->addWidget( textEdit );
+ }
+
+ return page;
+}
+
+TQFrame *TDERadioAboutWidget::addLicensePage( const TQString &title,
+ const TQString &text, int numLines)
+{
+ TQFrame *page = addEmptyPage( title );
+ if( page == 0 ) { return 0; }
+ if( numLines <= 0 ) { numLines = 10; }
+
+ TQVBoxLayout *vbox = new TQVBoxLayout( page, KDialog::spacingHint() );
+
+ TQTextEdit *textEdit = new TQTextEdit( page, "license" );
+ textEdit->setFont( TDEGlobalSettings::fixedFont() );
+ textEdit->setReadOnly( true );
+ textEdit->setWordWrap( TQTextEdit::NoWrap );
+ textEdit->setText( text );
+ textEdit->setMinimumHeight( fontMetrics().lineSpacing()*numLines );
+ vbox->addWidget( textEdit );
+
+ return page;
+}
+
+
+TDEAboutContainer *TDERadioAboutWidget::addContainerPage( const TQString &title,
+ int childAlignment,
+ int innerAlignment )
+{
+ if( mPageTab == 0 )
+ {
+ kdDebug(291) << "addPage: " << i18n("Invalid layout") << endl;
+ return 0;
+ }
+
+ TDEAboutContainer *container = new TDEAboutContainer( mPageTab, "container",
+ KDialog::spacingHint(), KDialog::spacingHint(), childAlignment,
+ innerAlignment );
+ mPageTab->addTab( container, title );
+
+ if( mContainerList.resize( mContainerList.size() + 1) == true )
+ {
+ mContainerList[ mContainerList.size()-1 ]=container;
+ }
+
+ connect(container, TQT_SIGNAL(urlClick(const TQString &)),
+ TQT_SLOT(slotUrlClick(const TQString &)));
+ connect(container, TQT_SIGNAL(mailClick(const TQString &,const TQString &)),
+ TQT_SLOT(slotMailClick(const TQString &,const TQString &)));
+
+ return container;
+}
+
+
+TDEAboutContainer *TDERadioAboutWidget::addScrolledContainerPage(
+ const TQString &title,
+ int childAlignment,
+ int innerAlignment )
+{
+ if( mPageTab == 0 )
+ {
+ kdDebug(291) << "addPage: " << "Invalid layout" << endl;
+ return 0;
+ }
+
+ TQFrame *page = addEmptyPage( title );
+ TQVBoxLayout *vbox = new TQVBoxLayout( page, KDialog::spacingHint() );
+ TQScrollView *scrollView = new TQScrollView( page );
+ scrollView->viewport()->setBackgroundMode( PaletteBackground );
+ vbox->addWidget( scrollView );
+
+ TDEAboutContainer *container = new TDEAboutContainer( scrollView, "container",
+ KDialog::spacingHint(), KDialog::spacingHint(), childAlignment,
+ innerAlignment );
+ scrollView->addChild( container );
+
+
+ connect(container, TQT_SIGNAL(urlClick(const TQString &)),
+ TQT_SLOT(slotUrlClick(const TQString &)));
+ connect(container, TQT_SIGNAL(mailClick(const TQString &,const TQString &)),
+ TQT_SLOT(slotMailClick(const TQString &,const TQString &)));
+
+ return container;
+}
+
+
+TQFrame *TDERadioAboutWidget::addEmptyPage( const TQString &title )
+{
+ if( mPageTab == 0 )
+ {
+ kdDebug(291) << "addPage: " << "Invalid layout" << endl;
+ return 0;
+ }
+
+ TQFrame *page = new TQFrame( mPageTab, title.latin1() );
+ page->setFrameStyle( TQFrame::NoFrame );
+
+ mPageTab->addTab( page, title );
+ return page;
+}
+
+
+TDEAboutContainer *TDERadioAboutWidget::addContainer( int childAlignment,
+ int innerAlignment )
+{
+ TDEAboutContainer *container = new TDEAboutContainer( this, "container",
+ 0, KDialog::spacingHint(), childAlignment, innerAlignment );
+ mTopLayout->addWidget( container, 0, childAlignment );
+
+ if( mContainerList.resize( mContainerList.size() + 1) == true )
+ {
+ mContainerList[ mContainerList.size()-1 ]=container;
+ }
+
+ connect(container, TQT_SIGNAL(urlClick(const TQString &)),
+ TQT_SLOT(slotUrlClick(const TQString &)));
+ connect(container, TQT_SIGNAL(mailClick(const TQString &,const TQString &)),
+ TQT_SLOT(slotMailClick(const TQString &,const TQString &)));
+
+ return container;
+}
+
+
+
+void TDERadioAboutWidget::setTitle( const TQString &title )
+{
+ if( mTitleLabel == 0 )
+ {
+ kdDebug(291) << "setTitle: " << "Invalid layout" << endl;
+ return;
+ }
+ mTitleLabel->setText(title);
+}
+
+
+void TDERadioAboutWidget::setImage( const TQString &fileName )
+{
+ if( mImageLabel == 0 )
+ {
+ kdDebug(291) << "setImage: " << "Invalid layout" << endl;
+ return;
+ }
+ if( fileName.isNull() )
+ {
+ return;
+ }
+
+ TQImage logo( fileName );
+ if( logo.isNull() == false )
+ {
+ TQPixmap pix;
+ pix = logo;
+ mImageLabel->setPixmap( pix );
+ }
+ mImageFrame->layout()->activate();
+
+}
+
+
+void TDERadioAboutWidget::setImageBackgroundColor( const TQColor &color )
+{
+ if( mImageFrame != 0 )
+ {
+ mImageFrame->setBackgroundColor( color );
+ }
+}
+
+
+void TDERadioAboutWidget::setImageFrame( bool state )
+{
+ if( mImageFrame != 0 )
+ {
+ if( state == true )
+ {
+ mImageFrame->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
+ mImageFrame->setLineWidth(1);
+ }
+ else
+ {
+ mImageFrame->setFrameStyle( TQFrame::NoFrame );
+ mImageFrame->setLineWidth(0);
+ }
+ }
+}
+
+
+void TDERadioAboutWidget::setProduct( const TQString &appName,
+ const TQString &/*version*/,
+ const TQString &author,
+ const TQString &year )
+{
+ if( mIconLabel == 0 )
+ {
+ kdDebug(291) << "setProduct: " << "Invalid layout" << endl;
+ return;
+ }
+
+ if ( kapp )
+ mIconLabel->setPixmap( kapp->icon() );
+
+ TQString msg1 = i18n("%1 %2 (Using TDE %3)").arg(appName).
+ arg(TQString::fromLatin1(TDERADIO_VERSION)).
+ arg(TQString::fromLatin1(TDE_VERSION_STRING));
+ TQString msg2 = !year.isEmpty() ? i18n("%1 %2, %3").arg('').arg(year).
+ arg(author) : TQString::fromLatin1("");
+
+ mVersionLabel->setText( msg1 );
+ mAuthorLabel->setText( msg2 );
+ if( msg2.isEmpty() )
+ {
+ mAuthorLabel->hide();
+ }
+
+ mIconLabel->parentWidget()->layout()->activate();
+}
+
+
+void TDERadioAboutWidget::slotMouseTrack( int mode, const TQMouseEvent *e )
+{
+ emit mouseTrack( mode, e );
+}
+
+
+void TDERadioAboutWidget::slotUrlClick( const TQString &url )
+{
+ if ( kapp )
+ kapp->invokeBrowser( url );
+}
+
+
+void TDERadioAboutWidget::slotMailClick( const TQString &/*_name*/,
+ const TQString &_address )
+{
+ if ( kapp )
+ kapp->invokeMailer( _address, TQString() );
+}
+
+
+// copied (and renamed) from tdeaboutapplication.cpp
+// original: TDEAboutApplication::buildDialog
+
+void TDERadioAboutWidget::setAboutData(const TDEAboutData &_aboutData)
+{
+ const TDEAboutData *aboutData = &_aboutData;
+ if (aboutData->programName().length()) {
+ setProduct( aboutData->programName(), aboutData->version(),
+ TQString(), TQString() );
+ }
+
+ TQString appPageText = aboutData->shortDescription() + "\n";
+
+ if (!aboutData->otherText().isEmpty())
+ appPageText += "\n" + aboutData->otherText()+"\n";
+
+ if (!aboutData->copyrightStatement().isEmpty())
+ appPageText += "\n" + aboutData->copyrightStatement()+"\n";
+
+ TDEAboutContainer *appPage = addContainerPage( i18n("&About"));
+
+ TQLabel *appPageLabel = new TQLabel( appPageText, 0 );
+ appPage->addWidget( appPageLabel );
+
+ if (!aboutData->homepage().isEmpty()) {
+ KURLLabel *url = new KURLLabel();
+ url->setText(aboutData->homepage());
+ url->setURL(aboutData->homepage());
+ appPage->addWidget( url );
+ // FIXME
+ connect( url, TQT_SIGNAL(leftClickedURL(const TQString &)),
+ this, TQT_SLOT(slotUrlClick(const TQString &)));
+ }
+
+ int authorCount = aboutData->authors().count();
+
+ if (authorCount) {
+ TQString authorPageTitle = authorCount == 1 ?
+ i18n("A&uthor") : i18n("A&uthors");
+ TDEAboutContainer *authorPage = addScrolledContainerPage( authorPageTitle );
+ TQValueList<TDEAboutPerson>::ConstIterator it = aboutData->authors().begin();
+ TQValueList<TDEAboutPerson>::ConstIterator end = aboutData->authors().end();
+ for (; it != end; ++it) {
+ authorPage->addPerson( (*it).name(), (*it).emailAddress(),
+ (*it).webAddress(), (*it).task() );
+ }
+ }
+
+ int creditsCount = aboutData->credits().count();
+
+ if (creditsCount) {
+ TDEAboutContainer *creditsPage =
+ addScrolledContainerPage( i18n("&Thanks To") );
+ TQValueList<TDEAboutPerson>::ConstIterator it = aboutData->credits().begin();
+ TQValueList<TDEAboutPerson>::ConstIterator end = aboutData->credits().end();
+ for (; it != end; ++it) {
+ creditsPage->addPerson( (*it).name(), (*it).emailAddress(),
+ (*it).webAddress(), (*it).task() );
+ }
+ }
+
+ const TQValueList<TDEAboutTranslator> translatorList = aboutData->translators();
+
+ if(translatorList.count() > 0) {
+ TDEAboutContainer *translatorPage =
+ addScrolledContainerPage( i18n("T&ranslation") );
+
+ TQValueList<TDEAboutTranslator>::ConstIterator it = translatorList.begin();
+ TQValueList<TDEAboutTranslator>::ConstIterator end = translatorList.end();
+ for(; it != end; ++it) {
+ translatorPage->addPerson((*it).name(), (*it).emailAddress(),
+ 0,0);
+ }
+
+ TQLabel *label = new TQLabel(TDEAboutData::aboutTranslationTeam(),
+ translatorPage);
+ label->adjustSize();
+ label->setMinimumSize(label->sizeHint());
+ translatorPage->addWidget(label);
+ }
+
+ if (!aboutData->license().isEmpty() ) {
+ addLicensePage( i18n("&License Agreement"), aboutData->license() );
+ }
+}
+
+
+//
+// A class that can can monitor mouse movements on the image
+//
+// copied (and renamed) from tdeaboutdialog.cpp
+// original: KImageTrackLabel
+
+TDERadioImageTrackLabel::TDERadioImageTrackLabel( TQWidget *_parent, const char *_name, WFlags f )
+ : TQLabel( _parent, _name, f )
+{
+ setText( i18n("Image missing"));
+}
+
+void TDERadioImageTrackLabel::mousePressEvent( TQMouseEvent *e )
+{
+ emit mouseTrack( MousePress, e );
+}
+
+void TDERadioImageTrackLabel::mouseReleaseEvent( TQMouseEvent *e )
+{
+ emit mouseTrack( MouseRelease, e );
+}
+
+void TDERadioImageTrackLabel::mouseDoubleClickEvent( TQMouseEvent *e )
+{
+ emit mouseTrack( MouseDoubleClick, e );
+}
+
+void TDERadioImageTrackLabel::mouseMoveEvent ( TQMouseEvent *e )
+{
+ emit mouseTrack( MouseDoubleClick, e );
+}
+
+
+
+
+#include "aboutwidget.moc"
diff --git a/src/alarm.cpp b/src/alarm.cpp
new file mode 100644
index 0000000..475d48b
--- /dev/null
+++ b/src/alarm.cpp
@@ -0,0 +1,82 @@
+/***************************************************************************
+ alarm.cpp - 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. *
+ * *
+ ***************************************************************************/
+#include "include/alarm.h"
+
+int Alarm::m_LastID = 0;
+
+Alarm::Alarm(const TQDateTime &time, bool daily, bool enabled)
+ : m_time (time),
+ m_daily (daily),
+ m_weekdayMask (0x7F),
+ m_enabled (enabled),
+ m_stationID (TQString()),
+ m_volumePreset (-1),
+ m_type (StartPlaying),
+ m_ID (++m_LastID)
+{
+}
+
+
+Alarm::Alarm ()
+ : m_time (TQDateTime (TQDate(1800, 1,1), TQTime(0,0,0))),
+ m_daily (false),
+ m_weekdayMask (0x7F),
+ m_enabled (false),
+ m_stationID (TQString()),
+ m_volumePreset(-1),
+ m_type (StartPlaying),
+ m_ID (++m_LastID)
+{
+}
+
+
+Alarm::Alarm (const Alarm &a)
+ : m_time (a.m_time),
+ m_daily (a.m_daily),
+ m_weekdayMask (a.m_weekdayMask),
+ m_enabled (a.m_enabled),
+ m_stationID (a.m_stationID),
+ m_volumePreset(a.m_volumePreset),
+ m_type (a.m_type),
+ m_ID (a.m_ID)
+{
+}
+
+
+Alarm::~Alarm()
+{
+}
+
+
+TQDateTime Alarm::nextAlarm(bool ignoreEnable) const
+{
+ TQDateTime now = TQDateTime::currentDateTime(),
+ alarm = m_time;
+ if (m_daily) {
+ alarm.setDate (now.date());
+ if (alarm <= now)
+ alarm = alarm.addDays(1);
+ while (m_weekdayMask &&
+ !(m_weekdayMask & (1 << (alarm.date().dayOfWeek()-1))))
+ {
+ alarm = alarm.addDays(1);
+ }
+ }
+ return (m_enabled || ignoreEnable) && (!m_daily || m_weekdayMask) ? alarm : TQDateTime();
+}
+
+
diff --git a/src/debug-profiler.cpp b/src/debug-profiler.cpp
new file mode 100644
index 0000000..5194b7e
--- /dev/null
+++ b/src/debug-profiler.cpp
@@ -0,0 +1,138 @@
+/***************************************************************************
+ 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/debug-profiler.h"
+
+#include <tqstringlist.h>
+
+#include <sys/resource.h>
+
+TimeProfiler global_time_profiler;
+MemProfiler global_mem_profiler;
+
+Profiler::Profiler()
+{
+}
+
+
+Profiler::~Profiler()
+{
+ m_tmpStartVal = 0;
+}
+
+void Profiler::stopInternalCounter()
+{
+ long long counter = getCounter();
+ long long diff = counter - m_tmpStartVal;
+ m_internalCounter += diff;
+}
+
+void Profiler::startInternalCounter() {
+ m_tmpStartVal = getCounter();
+}
+
+void Profiler::startProfile(const TQString &descr)
+{
+ stopInternalCounter();
+
+ if (m_ProfileData.contains(descr)) {
+ profile_data &d = m_ProfileData[descr];
+ d.startCounter = m_internalCounter;
+ } else {
+ m_ProfileData.insert(descr, profile_data(m_internalCounter));
+ }
+
+ startInternalCounter();
+}
+
+
+void Profiler::stopProfile (const TQString &descr)
+{
+ stopInternalCounter();
+
+ if (!descr.isNull() && m_ProfileData.contains(descr)) {
+ profile_data &d = m_ProfileData[descr];
+ long long diff = m_internalCounter - d.startCounter;
+ d.accumulatedCounter += diff;
+ if (d.maxCounter < diff)
+ d.maxCounter = diff;
+ if (d.minCounter > diff)
+ d.minCounter = diff;
+ d.callCounter++;
+ }
+
+ startInternalCounter();
+}
+
+
+void Profiler::printData ()
+{
+ stopInternalCounter();
+
+ TQStringList keys=m_ProfileData.keys();
+ keys.sort();
+ TQValueListIterator<TQString> it = keys.begin();
+ TQValueListIterator<TQString> end = keys.end();
+ for (; it != end; ++it) {
+ int l = (*it).length();
+ l = (((l-1) / 25) + 1) * 25;
+ if (l < 50) l = 50;
+ const profile_data &d = m_ProfileData[*it];
+ printf(("%-"+TQString::number(l)+"s: total: %3.8f (%9lli) avg: %3.8f min: %3.8f max: %3.8f\n").ascii(),
+ (*it).ascii(),
+ (double)d.accumulatedCounter / 1.666e9,
+ d.callCounter,
+ (double)d.accumulatedCounter / (double)d.callCounter / 1.666e9,
+ (double)d.minCounter / 1.666e9,
+ (double)d.maxCounter / 1.666e9);
+ }
+
+ startInternalCounter();
+}
+
+
+long long MemProfiler::getCounter() const
+{
+ struct rusage usg;
+ if (getrusage(RUSAGE_SELF, &usg) == 0) {
+ return usg.ru_idrss + usg.ru_isrss;
+ } else {
+ return 0;
+ }
+}
+
+
+BlockProfiler::BlockProfiler(const TQString &descr)
+ : m_Description(descr)
+{
+ global_mem_profiler.startProfile(m_Description);
+ global_time_profiler.startProfile(m_Description);
+}
+
+BlockProfiler::~BlockProfiler()
+{
+ global_time_profiler.stopProfile(m_Description);
+ global_mem_profiler.stopProfile(m_Description);
+}
+
+void BlockProfiler::stop()
+{
+ global_time_profiler.stopProfile(m_Description);
+ global_mem_profiler.stopProfile(m_Description);
+ m_Description = TQString();
+}
+
diff --git a/src/errorlog-interfaces.cpp b/src/errorlog-interfaces.cpp
new file mode 100644
index 0000000..e71304c
--- /dev/null
+++ b/src/errorlog-interfaces.cpp
@@ -0,0 +1,111 @@
+/***************************************************************************
+ errorlog-interfaces.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/errorlog-interfaces.h"
+
+#include <kdebug.h>
+#include <tdelocale.h>
+#include <tqdatetime.h>
+
+IErrorLog *staticLogger = NULL;
+
+IErrorLog::IErrorLog()
+ : BaseClass(-1)
+{
+ if (!staticLogger)
+ staticLogger = this;
+}
+
+
+IErrorLog::~IErrorLog()
+{
+ if (staticLogger == this)
+ staticLogger = NULL;
+}
+
+
+int IErrorLogClient::sendLogError(const TQString &s) const
+{
+ kdDebug() << TQString(i18n("%1 Error: %2\n"))
+ .arg(TQDateTime::currentDateTime().toString(Qt::ISODate))
+ .arg(s);
+ IF_SEND_MESSAGE(logError(s));
+}
+
+
+int IErrorLogClient::sendLogWarning(const TQString &s) const
+{
+ kdDebug() << TQString(i18n("%1 Warning: %2\n"))
+ .arg(TQDateTime::currentDateTime().toString(Qt::ISODate))
+ .arg(s);
+ IF_SEND_MESSAGE(logWarning(s));
+}
+
+
+int IErrorLogClient::sendLogInfo(const TQString &s) const
+{
+ kdDebug() << TQString(i18n("%1 Information: %2\n"))
+ .arg(TQDateTime::currentDateTime().toString(Qt::ISODate))
+ .arg(s);
+ IF_SEND_MESSAGE(logInfo(s));
+}
+
+
+int IErrorLogClient::sendLogDebug(const TQString &s) const
+{
+ kdDebug() << TQString(i18n("%1 Debug: %2\n"))
+ .arg(TQDateTime::currentDateTime().toString(Qt::ISODate))
+ .arg(s);
+ IF_SEND_MESSAGE(logDebug(s));
+}
+
+void IErrorLogClient::staticLogError (const TQString &s)
+{
+ kdDebug() << TQString(i18n("%1 Error: %2\n"))
+ .arg(TQDateTime::currentDateTime().toString(Qt::ISODate))
+ .arg(s);
+ if (staticLogger)
+ staticLogger->logError(s);
+}
+
+void IErrorLogClient::staticLogWarning(const TQString &s)
+{
+ kdDebug() << TQString(i18n("%1 Warning: %2\n"))
+ .arg(TQDateTime::currentDateTime().toString(Qt::ISODate))
+ .arg(s);
+ if (staticLogger)
+ staticLogger->logWarning(s);
+}
+
+void IErrorLogClient::staticLogInfo (const TQString &s)
+{
+ kdDebug() << TQString(i18n("%1 Information: %2\n"))
+ .arg(TQDateTime::currentDateTime().toString(Qt::ISODate))
+ .arg(s);
+ if (staticLogger)
+ staticLogger->logInfo(s);
+}
+
+void IErrorLogClient::staticLogDebug (const TQString &s)
+{
+ kdDebug() << TQString(i18n("%1 Debug: %2\n"))
+ .arg(TQDateTime::currentDateTime().toString(Qt::ISODate))
+ .arg(s);
+ if (staticLogger)
+ staticLogger->logDebug(s);
+}
+
diff --git a/src/fileringbuffer.cpp b/src/fileringbuffer.cpp
new file mode 100644
index 0000000..5cca0c7
--- /dev/null
+++ b/src/fileringbuffer.cpp
@@ -0,0 +1,252 @@
+/***************************************************************************
+ ringbuffer.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/fileringbuffer.h"
+
+#include <tqstring.h>
+#include <unistd.h>
+#include <tdelocale.h>
+
+FileRingBuffer::FileRingBuffer(const TQString &filename, TQ_UINT64 max_size)
+{
+ m_BaseFileName = filename;
+ m_FileIdx = 0;
+ m_FileName = m_BaseFileName + "_" + TQString::number(++m_FileIdx);
+ m_File = fopen(m_FileName.ascii(), "w+");
+ m_MaxSize = max_size;
+ m_RealSize = 0;
+ m_FillSize = 0;
+ m_Start = 0;
+ m_error = m_File == NULL;
+ m_errorString = m_File ? TQString() : i18n("cannot open buffer file %1").arg(filename);
+}
+
+
+FileRingBuffer::~FileRingBuffer()
+{
+ if (m_File) {
+ fclose (m_File);
+ unlink (m_FileName.ascii());
+ }
+ m_File = NULL;
+ m_FileName = TQString();
+ m_MaxSize = 0;
+ m_RealSize = 0;
+ m_FillSize = 0;
+ m_Start = 0;
+ m_error = false;
+ m_errorString = TQString();
+}
+
+
+bool FileRingBuffer::resize(const TQString &filename, TQ_UINT64 new_max_size)
+{
+ if (filename != m_BaseFileName) {
+ clear();
+ if (m_File) {
+ fclose (m_File);
+ unlink (m_FileName.ascii());
+ }
+ m_BaseFileName = filename;
+ m_FileName = m_BaseFileName + "_" + TQString::number(++m_FileIdx);
+ m_File = fopen(m_FileName.ascii(), "w+");
+ m_error = m_File == NULL;
+ m_errorString = m_File ? TQString() : i18n("cannot open buffer file %1").arg(filename);
+ }
+
+ if (new_max_size >= m_RealSize) {
+ m_MaxSize = new_max_size;
+ }
+ else if (m_Start + m_FillSize < m_RealSize && new_max_size > m_Start + m_FillSize) {
+ ftruncate(fileno(m_File), new_max_size);
+ m_MaxSize = new_max_size;
+ }
+ else if (new_max_size >= m_FillSize) {
+ const size_t buffer_size = 65536;
+ char buffer[buffer_size];
+
+ TQString tmp_file_name = m_BaseFileName + "_" + TQString::number(++m_FileIdx);
+ FILE *tmp_file = fopen (tmp_file_name.ascii(), "w+");
+ TQ_UINT64 newFill = 0;
+ if (tmp_file) {
+ while (!m_error && m_FillSize > 0) {
+ int tmp_size = takeData(buffer, buffer_size);
+ if (tmp_size > 0) {
+ if (fwrite (buffer, tmp_size, 1, tmp_file) > 0) {
+ newFill += tmp_size;
+ } else {
+ m_error = true;
+ m_errorString += i18n("FileRingbuffer::resize: Writing to tmpfile %1 failed. ").arg(tmp_file_name);
+ }
+ }
+ }
+ } else {
+ m_error = true;
+ m_errorString += i18n("FileRingbuffer::resize: Opening tmpfile %1 failed. ").arg(tmp_file_name);
+ }
+
+ if (!m_error) {
+ fclose (m_File);
+ m_FileName = tmp_file_name;
+ m_File = tmp_file;
+ m_FillSize = newFill;
+ m_Start = 0;
+ m_MaxSize = new_max_size;
+ m_RealSize = newFill;
+ }
+ return true;
+ }
+ return false;
+}
+
+
+size_t FileRingBuffer::addData (const char *src, size_t size)
+{
+ size_t written = 0;
+ if (m_Start + m_FillSize <= m_RealSize) {
+ TQ_UINT64 rest = m_MaxSize - (m_Start + m_FillSize);
+ if (rest > size)
+ rest = size;
+ fseek(m_File, m_Start + m_FillSize, SEEK_SET);
+ if (rest > 0 && fwrite(src, rest, 1, m_File) <= 0) {
+ m_error = true;
+ m_errorString += i18n("FileRingBuffer::addData: failed writing data to file %1.").arg(m_FileName);
+ } else {
+ m_FillSize += rest;
+ if (m_Start + m_FillSize > m_RealSize)
+ m_RealSize = m_Start + m_FillSize;
+ written += rest;
+ size -= rest;
+ src += rest;
+ }
+ }
+ if (!m_error && size > 0 && m_FillSize < m_RealSize) {
+ size_t rest = size;
+ if (rest > m_RealSize - m_FillSize)
+ rest = m_RealSize - m_FillSize;
+
+ fseek(m_File, m_Start + m_FillSize - m_RealSize, SEEK_SET);
+ if (fwrite(src, rest, 1, m_File) <= 0) {
+ m_error = true;
+ m_errorString += i18n("FileRingBuffer::addData: failed writing data to file %1.").arg(m_FileName);
+ } else {
+ m_FillSize += rest;
+ written += rest;
+ //fflush(m_File); // debug only
+ }
+ }
+ return written;
+}
+
+
+size_t FileRingBuffer::takeData(char *dst, size_t size)
+{
+ size_t read = 0;
+ while (!m_error && m_FillSize > 0 && size > 0) {
+ size_t n = size;
+ if (n > m_FillSize)
+ n = m_FillSize;
+ if (n > m_RealSize - m_Start)
+ n = m_RealSize - m_Start;
+ fseek(m_File, m_Start, SEEK_SET);
+ if (fread(dst+read, n, 1, m_File) <= 0) {
+ m_error = true;
+ m_errorString += i18n("FileRingBuffer::takeData: failed reading data to file %1.").arg(m_FileName);
+ } else {
+ m_FillSize -= n;
+ m_Start += n;
+ read += n;
+ size -= n;
+ if (m_Start >= m_RealSize)
+ m_Start -= m_RealSize;
+ }
+
+ }
+ return read;
+}
+
+
+TQ_UINT64 FileRingBuffer::getFreeSpace(TQ_UINT64 &size)
+{
+ if (m_FillSize == m_RealSize) {
+ size = 0;
+ return 0;
+ }
+
+ if (m_Start + m_FillSize >= m_RealSize) {
+ size = m_RealSize - m_FillSize;
+ return m_Start + m_FillSize - m_RealSize;
+ } else {
+ size = m_MaxSize - m_Start - m_FillSize;
+ return m_Start + m_FillSize;
+ }
+}
+
+
+TQ_UINT64 FileRingBuffer::removeFreeSpace(TQ_UINT64 size)
+{
+ if (m_FillSize == m_RealSize)
+ return 0;
+
+ if (m_Start + m_FillSize >= m_RealSize) {
+ if (size > m_RealSize - m_FillSize)
+ size = m_RealSize - m_FillSize;
+ m_FillSize += size;
+ return size;
+ } else {
+ if (m_Start + m_FillSize + size >= m_MaxSize)
+ size = m_MaxSize - m_Start - m_FillSize;
+ m_FillSize += size;
+ return size;
+ }
+}
+
+
+TQ_UINT64 FileRingBuffer::getData(TQ_UINT64 &size)
+{
+ if (m_Start + m_FillSize >= m_RealSize) {
+ size = m_RealSize - m_Start;
+ } else {
+ size = m_FillSize;
+ }
+ return m_Start;
+}
+
+
+TQ_UINT64 FileRingBuffer::removeData(TQ_UINT64 size)
+{
+ if (size > m_FillSize)
+ size = m_FillSize;
+ if (m_Start + size >= m_RealSize) {
+ m_Start = m_Start + size - m_RealSize;
+ } else {
+ m_Start += size;
+ }
+ m_FillSize -= size;
+ return size;
+}
+
+
+void FileRingBuffer::clear()
+{
+ if (!m_error) {
+ ftruncate(fileno(m_File), 0);
+ m_Start = 0;
+ m_FillSize = 0;
+ m_RealSize = 0;
+ }
+}
diff --git a/src/frequencyradiostation.cpp b/src/frequencyradiostation.cpp
new file mode 100644
index 0000000..38cddd7
--- /dev/null
+++ b/src/frequencyradiostation.cpp
@@ -0,0 +1,200 @@
+/***************************************************************************
+ frequencyradiostation.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/frequencyradiostation.h"
+#include <typeinfo>
+#include "include/radiostation-config.h"
+#include <tdelocale.h>
+#include <tdeglobal.h>
+
+/////////////////////////////////////////////////////////////////////////////
+
+const char *StationFrequencyElement = "frequency";
+
+static FrequencyRadioStation emptyFrequencyRadioStation(registerStationClass);
+
+/////////////////////////////////////////////////////////////////////////////
+
+FrequencyRadioStation::FrequencyRadioStation (RegisterStationClass, const TQString &classname)
+ : RadioStation(registerStationClass, !classname.isNull() ? classname : getClassName()),
+ m_frequency(0)
+{
+}
+
+FrequencyRadioStation::FrequencyRadioStation()
+ : RadioStation(),
+ m_frequency(0)
+{
+}
+
+FrequencyRadioStation::FrequencyRadioStation(float frequency)
+ : RadioStation(),
+ m_frequency(frequency)
+{
+}
+
+FrequencyRadioStation::FrequencyRadioStation(const TQString &name,
+ const TQString &shortName,
+ float frequency)
+ : RadioStation(name, shortName),
+ m_frequency(frequency)
+{
+}
+
+FrequencyRadioStation::FrequencyRadioStation(FrequencyRadioStation const &s)
+ : RadioStation(s),
+ m_frequency(s.m_frequency)
+{
+}
+
+
+/** returns an exact copy of this station */
+RadioStation *FrequencyRadioStation::copy() const
+{
+ return new FrequencyRadioStation(*this);
+}
+
+RadioStation *FrequencyRadioStation::copyNewID() const
+{
+ RadioStation *x = new FrequencyRadioStation(*this);
+ x->generateNewStationID();
+ return x;
+}
+
+
+
+FrequencyRadioStation::~FrequencyRadioStation()
+{
+}
+
+
+/* = 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()
+*/
+int FrequencyRadioStation::compare(const RadioStation &_s) const
+{
+ FrequencyRadioStation const *s = dynamic_cast<FrequencyRadioStation const*>(&_s);
+
+ if (!s) {
+ return (typeid(this).name() > typeid(&_s).name()) ? 1 : -1;
+ }
+
+ // stations with no valid frequency are never identical
+ if (m_frequency == 0)
+ return -1;
+ if (s->m_frequency == 0)
+ return 1;
+
+ float delta = (m_frequency < 10) ? STATION_FREQ_INTERVAL_AM : STATION_FREQ_INTERVAL_FM;
+
+ if ( m_frequency + delta/4 > s->m_frequency
+ && m_frequency - delta/4 < s->m_frequency)
+ {
+ return 0;
+ } else {
+ return (m_frequency > s->m_frequency) ? 1 : -1;
+ }
+}
+
+
+TQString FrequencyRadioStation::longName() const
+{
+ TQString longN = name();
+ if (!longN.isEmpty()) {
+ longN = i18n("%1, %2").arg(longN).arg(description());
+ } else {
+ longN = description();
+ }
+
+ return longN;
+}
+
+
+TQString FrequencyRadioStation::description() const
+{
+ float cf = frequency();
+ TQString f;
+ if (cf >= 10)
+ f = i18n("%1 MHz").arg(TDEGlobal::locale()->formatNumber(cf, 2));
+ else
+ f = i18n("%1 kHz").arg(TDEGlobal::locale()->formatNumber(cf * 1000, 0));
+
+ return f;
+}
+
+
+bool FrequencyRadioStation::isValid() const
+{
+ return m_frequency > 0;
+}
+
+
+
+bool FrequencyRadioStation::setProperty(const TQString &pn, const TQString &val)
+{
+ bool retval = false;
+ if (pn == StationFrequencyElement) {
+ float f = val.toFloat(&retval);
+ if (retval)
+ m_frequency = f;
+ } else {
+ retval = RadioStation::setProperty(pn, val);
+ }
+ return retval;
+}
+
+
+TQString FrequencyRadioStation::getProperty(const TQString &pn) const
+{
+ if (pn == StationFrequencyElement) {
+ return TQString().setNum(m_frequency);
+ } else {
+ return RadioStation::getProperty(pn);
+ }
+}
+
+
+TQStringList FrequencyRadioStation::getPropertyNames() const
+{
+ TQStringList l = RadioStation::getPropertyNames();
+ l.push_back(StationFrequencyElement);
+ return l;
+}
+
+
+RadioStationConfig *FrequencyRadioStation::createEditor() const
+{
+ return new FrequencyRadioStationConfig(NULL);
+}
+
+bool FrequencyRadioStation::operator == (const RadioStation &x) const
+{
+ if (!RadioStation::operator == (x))
+ return false;
+
+ FrequencyRadioStation const *fx = dynamic_cast<FrequencyRadioStation const*>(&x);
+ if (!fx)
+ return false;
+
+ float delta = (m_frequency < 10) ? STATION_FREQ_INTERVAL_AM : STATION_FREQ_INTERVAL_FM;
+
+ return m_frequency + delta/4 > fx->m_frequency
+ && m_frequency - delta/4 < fx->m_frequency;
+
+}
diff --git a/src/frequencyseekhelper.cpp b/src/frequencyseekhelper.cpp
new file mode 100644
index 0000000..1c24329
--- /dev/null
+++ b/src/frequencyseekhelper.cpp
@@ -0,0 +1,142 @@
+/***************************************************************************
+ frequencyseekhelper.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/frequencyseekhelper.h"
+#include <tqtimer.h>
+
+FrequencySeekHelper::FrequencySeekHelper(ISeekRadio &parent)
+ : SeekHelper(parent)
+{
+ m_timer = new TQTimer(this);
+ TQObject::connect (m_timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(step()));
+}
+
+
+FrequencySeekHelper::~FrequencySeekHelper()
+{
+ delete m_timer;
+}
+
+
+bool FrequencySeekHelper::connectI (Interface *i)
+{
+ bool a = SeekHelper::connectI(i);
+ bool b = IFrequencyRadioClient::connectI(i);
+ return a || b;
+}
+
+
+bool FrequencySeekHelper::disconnectI(Interface *i)
+{
+ bool a = SeekHelper::disconnectI(i);
+ bool b = IFrequencyRadioClient::disconnectI(i);
+ return a || b;
+}
+
+
+void FrequencySeekHelper::start(const SoundStreamID &id, direction_t dir)
+{
+ SeekHelper::start(id, dir);
+ m_bestFrequency = 0;
+}
+
+
+void FrequencySeekHelper::abort()
+{
+ m_timer->stop();
+ m_bestFrequency = 0;
+}
+
+
+bool FrequencySeekHelper::nextSeekStep()
+{
+ float f = queryFrequency();
+ f += (m_direction == up ? 1 : -1) * queryScanStep();
+
+ bool bounds = false;
+ if (f > queryMaxFrequency()) {
+ f = queryMaxFrequency();
+ bounds = true;
+ }
+ if (f < queryMinFrequency()) {
+ f = queryMinFrequency();
+ bounds = true;
+ }
+
+ if (sendFrequency(f) > 0) {
+ if (!bounds) {
+ m_timer->start (50, true);
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+}
+
+
+bool FrequencySeekHelper::bestFound() const
+{
+ return m_bestFrequency > 0;
+}
+
+
+void FrequencySeekHelper::rememberBest()
+{
+ m_bestFrequency = m_currentFrequency;
+}
+
+
+void FrequencySeekHelper::getData()
+{
+ m_oldSignal = m_currentSignal;
+ m_oldFrequency = m_currentFrequency;
+
+ querySignalQuality(m_SoundStreamID, m_currentSignal);
+ queryHasGoodQuality(m_SoundStreamID, m_goodSignal);
+ m_currentFrequency = queryFrequency();
+}
+
+
+bool FrequencySeekHelper::isBetter() const
+{
+ return m_currentSignal > m_oldSignal;
+}
+
+
+bool FrequencySeekHelper::isWorse() const
+{
+ return m_currentSignal < m_oldSignal;
+}
+
+
+bool FrequencySeekHelper::isGood() const
+{
+ return m_goodSignal;
+}
+
+
+void FrequencySeekHelper::applyBest()
+{
+ sendFrequency( (m_bestFrequency + m_currentFrequency) / 2);
+}
+
+
+
+
+#include "frequencyseekhelper.moc"
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 Mr 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 Mr 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 Mr 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
diff --git a/src/internetradiostation.cpp b/src/internetradiostation.cpp
new file mode 100644
index 0000000..04cd9f9
--- /dev/null
+++ b/src/internetradiostation.cpp
@@ -0,0 +1,176 @@
+/***************************************************************************
+ internetradiostation.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/internetradiostation.h"
+#include <typeinfo>
+#include "include/radiostation-config.h"
+
+/////////////////////////////////////////////////////////////////////////////
+
+const char *StationUrlElement = "url";
+
+static InternetRadioStation emptyInternetRadioStation(registerStationClass);
+
+/////////////////////////////////////////////////////////////////////////////
+
+InternetRadioStation::InternetRadioStation()
+ : RadioStation(),
+ m_url()
+{
+}
+
+InternetRadioStation::InternetRadioStation(const KURL &url)
+ : RadioStation(),
+ m_url(url)
+{
+}
+
+InternetRadioStation::InternetRadioStation(const TQString &name,
+ const TQString &shortName,
+ const KURL &url)
+ : RadioStation(name, shortName),
+ m_url(url)
+{
+}
+
+InternetRadioStation::InternetRadioStation(const InternetRadioStation &s)
+ : RadioStation(s),
+ m_url(s.m_url)
+{
+}
+
+
+InternetRadioStation::InternetRadioStation(RegisterStationClass, const TQString &classname)
+ : RadioStation(registerStationClass, !classname.isNull() ? classname : getClassName()),
+ m_url()
+{
+}
+
+
+/** returns an exact copy of this station*/
+RadioStation *InternetRadioStation::copy() const
+{
+ return new InternetRadioStation(*this);
+}
+
+RadioStation *InternetRadioStation::copyNewID() const
+{
+ RadioStation *x = new InternetRadioStation(*this);
+ x->generateNewStationID();
+ return x;
+}
+
+InternetRadioStation::~InternetRadioStation()
+{
+}
+
+
+/* = 0 : this.url = s.url
+ > 0 : this.url > s.url
+ < 0 : this.url < s.url
+ other class than FrequencyRadioStation: compare typeid(.).name()
+*/
+int InternetRadioStation::compare(const RadioStation &_s) const
+{
+ InternetRadioStation const *s = dynamic_cast<InternetRadioStation const*>(&_s);
+
+ if (!s)
+ return (typeid(this).name() > typeid(&_s).name()) ? 1 : -1;
+
+ TQString thisurl = m_url.url(-1); // -1: remove trailing '/'
+ TQString thaturl = s->m_url.url(-1);
+
+ // empty urls are never identical
+ if (thisurl.length () == 0)
+ return -1;
+ if (thaturl.length() == 0)
+ return 1;
+
+ return thisurl.compare(thaturl);
+}
+
+
+
+bool InternetRadioStation::isValid() const
+{
+ // TODO: maybe we need to do more to validate this...
+ return !m_url.isEmpty();
+}
+
+TQString InternetRadioStation::longName() const
+{
+ TQString longN = name();
+ if (!longN.isEmpty()) {
+ longN = i18n("%1, %2").arg(longN).arg(description());
+ } else {
+ longN = description();
+ }
+
+ return longN;
+}
+
+
+TQString InternetRadioStation::description() const
+{
+ return m_url.url();
+}
+
+
+bool InternetRadioStation::setProperty(const TQString &pn, const TQString &val)
+{
+ bool retval = false;
+ if (pn == StationUrlElement) {
+ m_url = val;
+ retval = true;
+ } else {
+ retval = RadioStation::setProperty(pn, val);
+ }
+ return retval;
+}
+
+TQString InternetRadioStation::getProperty(const TQString &pn) const
+{
+ if (pn == StationUrlElement) {
+ return m_url.url();
+ } else {
+ return RadioStation::getProperty(pn);
+ }
+}
+
+TQStringList InternetRadioStation::getPropertyNames() const
+{
+ TQStringList l = RadioStation::getPropertyNames();
+ l.push_back(StationUrlElement);
+ return l;
+}
+
+
+RadioStationConfig *InternetRadioStation::createEditor() const
+{
+ return new UndefinedRadioStationConfig(NULL);
+}
+
+bool InternetRadioStation::operator == (const RadioStation &x) const
+{
+ if (!RadioStation::operator == (x))
+ return false;
+
+ InternetRadioStation const *fx = dynamic_cast<InternetRadioStation const*>(&x);
+ if (!fx)
+ return false;
+ return m_url == fx->m_url;
+}
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..ec52b6c
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,73 @@
+/***************************************************************************
+ main.cpp - description
+ -------------------
+ begin : Don Mr 8 21:57:17 CET 2001
+ copyright : (C) 2001-2005 by Ernst 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. *
+ * *
+ ***************************************************************************/
+
+#include <tdecmdlineargs.h>
+#include <tdeaboutdata.h>
+#include <tdelocale.h>
+
+#include "include/tderadioversion.h"
+#include "include/tderadioapp.h"
+
+#include "include/debug-profiler.h"
+
+static TDECmdLineOptions options[] =
+{
+ { 0, 0, 0 }
+};
+
+int main(int argc, char *argv[])
+{
+ BlockProfiler profiler_about("main::aboutdata");
+
+ TDEAboutData aboutData("tderadio", I18N_NOOP("TDERadio"),
+ TDERADIO_VERSION, "TDERadio", TDEAboutData::License_GPL,
+ "(c) 2002-2005 Martin Witte, Klas Kalass, Frank Schwanz",
+ 0,
+ "http://sourceforge.net/projects/tderadio",
+ 0);
+ aboutData.addAuthor("Martin Witte", I18N_NOOP("rewrite for 0.3.0, recording, lirc support, alarms, misc"), "witte@kawo1.rwth-aachen.de");
+ aboutData.addAuthor("Marcus Camen", I18N_NOOP("Buildsystem, Standards Conformance, Cleanups"), "mcamen@mcamen.de");
+ aboutData.addAuthor("Klas Kalass", I18N_NOOP("Miscellaneous"), "klas.kalass@gmx.de");
+ aboutData.addAuthor("Frank Schwanz", I18N_NOOP("idea, first basic application"), "schwanz@fh-brandenburg.de");
+
+ TDECmdLineArgs::init( argc, argv, &aboutData );
+ TDECmdLineArgs::addCmdLineOptions( options ); // Add our own options.
+
+ profiler_about.stop();
+
+ BlockProfiler profiler_tderadioapp("main::TDERadioApp");
+
+ TDERadioApp a;
+
+ profiler_tderadioapp.stop();
+ BlockProfiler profiler_restore("main::restore");
+
+ a.restoreState(TDEGlobal::config());
+ a.startPlugins();
+
+ profiler_restore.stop();
+
+ int ret = a.exec();
+
+ global_time_profiler.printData();
+ global_mem_profiler.printData();
+
+ IErrorLogClient::staticLogDebug("normal shutdown");
+
+ return ret;
+}
+
diff --git a/src/multibuffer.cpp b/src/multibuffer.cpp
new file mode 100644
index 0000000..8f82b2f
--- /dev/null
+++ b/src/multibuffer.cpp
@@ -0,0 +1,131 @@
+/***************************************************************************
+ multibuffer.cpp
+ -------------------
+ 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. *
+ * *
+ ***************************************************************************/
+
+#include <tdelocale.h>
+
+#include "include/multibuffer.h"
+
+MultiBuffer::MultiBuffer(size_t n_buffers, size_t buffersize)
+ : m_nBuffers(n_buffers),
+ m_BufferSize(buffersize),
+ m_currentReadBuffer(m_nBuffers-1), // during wait4read, this will be incremented to 0
+ m_currentWriteBuffer(0),
+ m_readLock(n_buffers),
+ m_errorString(TQString()),
+ m_error(false)
+{
+ m_readLock += m_nBuffers;
+
+ m_buffers = new char* [m_nBuffers];
+ m_buffersFill = new size_t [m_nBuffers];
+ for (size_t i = 0; i < m_nBuffers; ++i) {
+ m_buffers [i] = new char [m_BufferSize];
+ m_buffersFill[i] = 0;
+ }
+}
+
+MultiBuffer::~MultiBuffer()
+{
+ for (size_t i = 0; i < m_nBuffers; ++i) {
+ delete m_buffers[i];
+ }
+ delete m_buffers;
+ delete m_buffersFill;
+ m_buffersFill = NULL;
+ m_buffers = NULL;
+}
+
+size_t MultiBuffer::getAvailableWriteBuffer() const
+{
+ size_t bytesAvailable = m_BufferSize - m_buffersFill[m_currentWriteBuffer];
+ return m_currentWriteBuffer != m_currentReadBuffer ? bytesAvailable : 0;
+}
+
+size_t MultiBuffer::getAvailableReadBuffers() const
+{
+ return m_readLock.available();
+}
+
+char *MultiBuffer::lockWriteBuffer(size_t &bufferSize)
+{
+ size_t bytesAvailable = m_BufferSize - m_buffersFill[m_currentWriteBuffer];
+
+ if (m_currentWriteBuffer != m_currentReadBuffer && bytesAvailable > 0) {
+ bufferSize = bytesAvailable;
+ return m_buffers[m_currentWriteBuffer] + m_buffersFill[m_currentWriteBuffer];
+ }
+/* TQString tmp;
+ IErrorLogClient::staticLogDebug(tmp.sprintf("current input buffer: %li", m_currentInputBuffer));
+ IErrorLogClient::staticLogDebug(tmp.sprintf("inputAvailableLock: %i", m_inputAvailableLock.available()));
+ for (size_t i = 0; i < m_config.m_EncodeBufferCount; ++i) {
+ IErrorLogClient::staticLogDebug(tmp.sprintf("input buffer %li: fill = %li", i, m_buffersInputFill[i]));
+ }
+*/
+/* m_error = true;
+ m_errorString += i18n("Buffer Overflow. ");*/
+ return NULL;
+}
+
+
+bool MultiBuffer::unlockWriteBuffer(size_t bufferSize) // return value: complete buffer ready for read
+{
+ bool retval = false;
+ if (m_buffersFill[m_currentWriteBuffer] + bufferSize > m_BufferSize) {
+ m_error = true;
+ m_errorString += i18n("Buffer Overflow. ");
+ } else if (bufferSize > 0) {
+ m_buffersFill[m_currentWriteBuffer] += bufferSize;
+
+ if (m_buffersFill[m_currentWriteBuffer] == m_BufferSize) {
+ m_currentWriteBuffer = (m_currentWriteBuffer+1 < m_nBuffers) ? m_currentWriteBuffer + 1 : 0;
+ m_readLock--;
+ retval = true;
+ }
+ }
+ return retval;
+}
+
+
+void MultiBuffer::unlockAllWriteBuffers()
+{
+ m_currentWriteBuffer = m_currentReadBuffer;
+ // there are at maximum m_nBuffers - 1 full buffers. The nth buffer is the current read buffer
+ m_readLock -= m_nBuffers - 1 - m_readLock.available();
+}
+
+
+char *MultiBuffer::wait4ReadBuffer(size_t &buffer_fill)
+{
+ m_buffersFill[m_currentReadBuffer] = 0; // mark buffer as empty again
+ m_readLock++;
+ m_currentReadBuffer = (m_currentReadBuffer+1 < m_nBuffers) ? m_currentReadBuffer + 1 : 0;
+ buffer_fill = m_buffersFill[m_currentReadBuffer];
+ return m_buffers[m_currentReadBuffer];
+}
+
+
+char *MultiBuffer::getCurrentReadBuffer(size_t &buffer_fill) const
+{
+ buffer_fill = m_buffersFill[m_currentReadBuffer];
+ return m_buffers[m_currentReadBuffer];
+}
+
+void MultiBuffer::resetError()
+{
+ m_error = false;
+ m_errorString = TQString();
+}
diff --git a/src/plugin_configuration_dialog.cpp b/src/plugin_configuration_dialog.cpp
new file mode 100644
index 0000000..f202d84
--- /dev/null
+++ b/src/plugin_configuration_dialog.cpp
@@ -0,0 +1,103 @@
+/***************************************************************************
+ plugin_configuration_dialog.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/plugin_configuration_dialog.h"
+#include <tdeconfig.h>
+#include <tdelocale.h>
+
+PluginConfigurationDialog::PluginConfigurationDialog(
+ int dialogFace, const TQString &caption,
+ int buttonMask, ButtonCode defaultButton,
+ TQWidget *parent, const char *name,
+ bool modal, bool separator)
+: KDialogBase(dialogFace, caption, buttonMask, defaultButton,
+ parent, name, modal, separator),
+ WidgetPluginBase (name, i18n("Configuration Dialog")),
+ m_Caption(caption)
+{
+}
+
+
+// PluginBase
+
+void PluginConfigurationDialog::saveState (TDEConfig *c) const
+{
+ c->setGroup(TQString("config-dialog-") + WidgetPluginBase::name());
+ WidgetPluginBase::saveState(c);
+}
+
+void PluginConfigurationDialog::restoreState (TDEConfig *c)
+{
+ c->setGroup(TQString("config-dialog-") + WidgetPluginBase::name());
+ WidgetPluginBase::restoreState(c, true);
+}
+
+
+ConfigPageInfo PluginConfigurationDialog::createConfigurationPage()
+{
+ return ConfigPageInfo();
+}
+
+
+AboutPageInfo PluginConfigurationDialog::createAboutPage()
+{
+ return AboutPageInfo();
+}
+
+
+// WidgetPluginBase
+
+void PluginConfigurationDialog::show()
+{
+ WidgetPluginBase::pShow();
+ KDialogBase::show();
+}
+
+
+void PluginConfigurationDialog::showOnOrgDesktop()
+{
+ WidgetPluginBase::pShowOnOrgDesktop();
+ //KDialogBase::show();
+}
+
+
+void PluginConfigurationDialog::hide()
+{
+ WidgetPluginBase::pHide();
+ KDialogBase::hide();
+}
+
+
+// TQWidget overrides
+
+void PluginConfigurationDialog::showEvent(TQShowEvent *e)
+{
+ KDialogBase::showEvent(e);
+ TQWidget::setCaption(m_Caption);
+ WidgetPluginBase::pShowEvent(e);
+}
+
+
+void PluginConfigurationDialog::hideEvent(TQHideEvent *e)
+{
+ KDialogBase::hideEvent(e);
+ WidgetPluginBase::pHideEvent(e);
+}
+
+
+
+#include "plugin_configuration_dialog.moc"
diff --git a/src/pluginmanager-configuration-ui.ui b/src/pluginmanager-configuration-ui.ui
new file mode 100644
index 0000000..921da5c
--- /dev/null
+++ b/src/pluginmanager-configuration-ui.ui
@@ -0,0 +1,389 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>PluginManagerConfigurationUI</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>PluginManagerConfigurationUI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>403</width>
+ <height>324</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>PluginManagerConfigurationUI</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <widget class="TQCheckBox" row="6" column="0">
+ <property name="name">
+ <cstring>cbShowProgressBar</cstring>
+ </property>
+ <property name="text">
+ <string>Show Progress Bar during Startup for Plugin Initiali&amp;zation</string>
+ </property>
+ <property name="accel">
+ <string>Alt+Z</string>
+ </property>
+ </widget>
+ <widget class="Line" row="5" column="0">
+ <property name="name">
+ <cstring>line1_2_2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="TQGroupBox" row="4" column="0">
+ <property name="name">
+ <cstring>groupBox4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TDEListView" row="0" column="0" rowspan="2" colspan="1">
+ <column>
+ <property name="text">
+ <string>Plugin Class</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Instance Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Description</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>listPluginInstances</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>list of running plugins</string>
+ </property>
+ </widget>
+ <spacer row="1" column="1">
+ <property name="name">
+ <cstring>spacer3_2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>87</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton" row="0" column="1">
+ <property name="name">
+ <cstring>btnRemovePluginInstance</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>24</width>
+ <height>24</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="iconSet">
+ <iconset>"edit-delete"</iconset>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>remove/stop a selected plugin instance</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="Line" row="3" column="0">
+ <property name="name">
+ <cstring>line1_2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="TQGroupBox" row="2" column="0">
+ <property name="name">
+ <cstring>groupBox3</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer row="1" column="1">
+ <property name="name">
+ <cstring>spacer3_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>55</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton" row="0" column="1">
+ <property name="name">
+ <cstring>btnNewPluginInstance</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>24</width>
+ <height>24</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="iconSet">
+ <iconset>"filenew2"</iconset>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>create a new instance of selected plugin class</string>
+ </property>
+ </widget>
+ <widget class="TDEListView" row="0" column="0" rowspan="2" colspan="1">
+ <column>
+ <property name="text">
+ <string>Plugin Class</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Description</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>listPluginClasses</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>list of available plugin classes</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="Line" row="1" column="0">
+ <property name="name">
+ <cstring>line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="TQGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="KURLRequester" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>editPluginLibrary</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>select a plugin library</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="2" column="1">
+ <property name="name">
+ <cstring>btnRemoveLibrary</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>24</width>
+ <height>24</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="iconSet">
+ <iconset>"edit-delete"</iconset>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>unload a plugin library</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="1" column="1">
+ <property name="name">
+ <cstring>btnAddLibrary</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>24</width>
+ <height>24</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="iconSet">
+ <iconset>"filenew2"</iconset>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>load a selected plugin library</string>
+ </property>
+ </widget>
+ <widget class="TDEListBox" row="1" column="0" rowspan="3" colspan="1">
+ <property name="name">
+ <cstring>listPluginLibraries</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>list of loaded plugin libraries</string>
+ </property>
+ </widget>
+ <spacer row="3" column="1">
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>61</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<pixmapfunction>SmallIconSet</pixmapfunction>
+<layoutdefaults spacing="6" margin="0"/>
+<includes>
+ <include location="global" impldecl="in implementation">kiconloader.h</include>
+ <include location="global" impldecl="in implementation">klineedit.h</include>
+ <include location="global" impldecl="in implementation">kpushbutton.h</include>
+ <include location="global" impldecl="in implementation">kurlrequester.h</include>
+ <include location="global" impldecl="in implementation">tdelistbox.h</include>
+ <include location="global" impldecl="in implementation">tdelistview.h</include>
+</includes>
+</UI>
diff --git a/src/pluginmanager-configuration.cpp b/src/pluginmanager-configuration.cpp
new file mode 100644
index 0000000..964b004
--- /dev/null
+++ b/src/pluginmanager-configuration.cpp
@@ -0,0 +1,171 @@
+/***************************************************************************
+ pluginmanager-configuration.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+#include "pluginmanager-configuration-ui.h"
+#include "include/pluginmanager-configuration.h"
+#include "include/tderadioapp.h"
+#include "include/pluginmanager.h"
+
+#include <tdelistbox.h>
+#include <tdelistview.h>
+#include <kpushbutton.h>
+#include <kurlrequester.h>
+#include <kinputdialog.h>
+
+#include <tqcheckbox.h>
+
+PluginManagerConfiguration::PluginManagerConfiguration(TQWidget *parent, TDERadioApp *app, PluginManager *pm)
+ : PluginManagerConfigurationUI(parent),
+ m_Application(app),
+ m_PluginManager(pm),
+ m_dirty(true)
+{
+ noticePluginLibrariesChanged();
+ noticePluginsChanged();
+
+ TQObject::connect(btnAddLibrary, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotAddLibrary()));
+ TQObject::connect(btnRemoveLibrary, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotRemoveLibrary()));
+ TQObject::connect(btnNewPluginInstance, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotNewPluginInstance()));
+ TQObject::connect(btnRemovePluginInstance, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotRemovePluginInstance()));
+ TQObject::connect(cbShowProgressBar, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotSetDirty()));
+
+ slotCancel();
+}
+
+
+PluginManagerConfiguration::~PluginManagerConfiguration ()
+{
+}
+
+
+void PluginManagerConfiguration::noticePluginLibrariesChanged()
+{
+ listPluginLibraries->clear();
+ const TQMap<TQString, PluginLibraryInfo> &libs = m_Application->getPluginLibraries();
+ TQMapConstIterator<TQString,PluginLibraryInfo> end = libs.end();
+ for (TQMapConstIterator<TQString,PluginLibraryInfo> it = libs.begin(); it != end; ++it) {
+ listPluginLibraries->insertItem(it.key());
+ }
+
+ listPluginClasses->clear();
+ const TQMap<TQString, PluginClassInfo> &classes = m_Application->getPluginClasses();
+ TQMapConstIterator<TQString, PluginClassInfo> end_cls = classes.end();
+ for (TQMapConstIterator<TQString, PluginClassInfo> it = classes.begin(); it != end_cls; ++it) {
+ listPluginClasses->insertItem(new TDEListViewItem(listPluginClasses, it.key(), (*it).description));
+ }
+
+ noticePluginsChanged();
+}
+
+
+void PluginManagerConfiguration::noticePluginsChanged()
+{
+ listPluginInstances->clear();
+ const PluginList &plugins = m_PluginManager->plugins();
+ const TQMap<TQString, PluginClassInfo> &classes = m_Application->getPluginClasses();
+
+ for (PluginIterator it(plugins); it.current(); ++it) {
+ TQString class_name = it.current()->pluginClassName();
+ if (classes.contains(class_name)) {
+ TQString obj_name = it.current()->name();
+ listPluginInstances->insertItem(new TDEListViewItem(listPluginInstances, class_name, obj_name, classes[class_name].description));
+ }
+ }
+}
+
+
+void PluginManagerConfiguration::slotOK()
+{
+ if (m_dirty) {
+ m_PluginManager->showProgressBar(cbShowProgressBar->isChecked());
+ m_dirty = false;
+ }
+}
+
+
+void PluginManagerConfiguration::slotCancel()
+{
+ if (m_dirty) {
+ cbShowProgressBar->setChecked(m_PluginManager->showsProgressBar());
+ noticePluginLibrariesChanged();
+ noticePluginsChanged();
+ m_dirty = false;
+ }
+}
+
+
+void PluginManagerConfiguration::slotAddLibrary()
+{
+ slotSetDirty();
+ TQString url = editPluginLibrary->url();
+ if (m_Application && url.length())
+ m_Application->LoadLibrary(url);
+}
+
+
+void PluginManagerConfiguration::slotRemoveLibrary()
+{
+ slotSetDirty();
+ if (m_Application) {
+ TQString lib = listPluginLibraries->currentText();
+ if (lib.length()) {
+ m_Application->UnloadLibrary(lib);
+ }
+ }
+}
+
+
+void PluginManagerConfiguration::slotNewPluginInstance()
+{
+ slotSetDirty();
+ if (m_Application && m_PluginManager) {
+ TQListViewItem *item = listPluginClasses->currentItem();
+ TQString class_name = item ? item->text(0) : TQString();
+ bool ok = false;
+ int default_object_id = 1;
+ while (m_PluginManager->getPluginByName(class_name + TQString::number(default_object_id)))
+ ++default_object_id;
+
+ TQString object_name = KInputDialog::getText(i18n("Enter Plugin Instance Name"),
+ i18n("Instance Name"),
+ class_name + TQString::number(default_object_id),
+ &ok);
+ if (ok && class_name.length() && object_name.length())
+ m_Application->CreatePlugin(m_PluginManager, class_name, object_name);
+ }
+}
+
+
+void PluginManagerConfiguration::slotRemovePluginInstance()
+{
+ slotSetDirty();
+ if (m_Application && m_PluginManager) {
+ TQListViewItem *item = listPluginInstances->currentItem();
+ TQString object_name = item ? item->text(1) : TQString();
+ if (object_name.length())
+ m_PluginManager->deletePluginByName(object_name);
+ }
+}
+
+
+void PluginManagerConfiguration::slotSetDirty()
+{
+ m_dirty = true;
+}
+
+
+#include "pluginmanager-configuration.moc"
diff --git a/src/pluginmanager.cpp b/src/pluginmanager.cpp
new file mode 100644
index 0000000..b4eedf3
--- /dev/null
+++ b/src/pluginmanager.cpp
@@ -0,0 +1,538 @@
+/***************************************************************************
+ pluginmanager.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/plugins.h"
+#include "include/pluginmanager.h"
+#include "include/pluginmanager-configuration.h"
+#include "include/plugin_configuration_dialog.h"
+#include "include/tderadioapp.h"
+
+#include <kiconloader.h>
+#include <kdialogbase.h>
+#include <tdelocale.h>
+#include <tdeconfig.h>
+#include <kprogress.h>
+
+#include <tqlayout.h>
+#include <tqframe.h>
+#include <tqmenudata.h>
+
+#include "include/debug-profiler.h"
+
+PluginManager::PluginManager(
+ const TQString &name,
+ TDERadioApp *app,
+ const TQString &configDialogTitle,
+ const TQString &aboutDialogTitle)
+ : m_Name(name),
+ m_Application(app),
+ m_showProgressBar(true),
+ m_configDialog (NULL),
+ m_pluginManagerConfiguration(NULL),
+ m_aboutDialog(NULL),
+ m_configDialogTitle(configDialogTitle),
+ m_aboutDialogTitle (aboutDialogTitle)
+{
+}
+
+
+PluginManager::~PluginManager()
+{
+ delete m_pluginManagerConfiguration;
+ m_pluginManagerConfiguration = NULL;
+
+ // config Dialog must be deleted first, so we can clear m_configPages
+ // without problems (this is the only place where our config dialog is deleted)
+ // Without clearing this list, those pages would be deleted, but
+ // we would try to delete them another time when the associated plugin is
+ // deleted, because m_configPages is out of date.
+ if (m_configDialog) {
+ m_configDialog->cancel();
+ delete m_configDialog;
+ }
+ m_configPages.clear();
+ m_configPageFrames.clear();
+ m_configDialog = NULL;
+
+ if (m_aboutDialog)
+ delete m_aboutDialog;
+ m_aboutPages.clear();
+ m_aboutPageFrames.clear();
+ m_aboutDialog = NULL;
+
+ while (PluginBase *p = m_plugins.getFirst()) {
+ deletePlugin(p);
+ }
+}
+
+
+void PluginManager::noticeLibrariesChanged()
+{
+ if (m_pluginManagerConfiguration)
+ m_pluginManagerConfiguration->noticePluginLibrariesChanged();
+}
+
+
+void PluginManager::unloadPlugins(const TQString &class_name)
+{
+ PluginList plugins = m_plugins;
+ for (PluginIterator it(plugins); it.current(); ++it) {
+ PluginBase *p = it.current();
+ if (p->pluginClassName() == class_name) {
+ deletePlugin(p);
+ }
+ }
+}
+
+
+void PluginManager::addWidgetPluginMenuItems(TQMenuData *menu, TQMap<WidgetPluginBase *,int> &map) const
+{
+ map.clear();
+
+ for (PluginIterator it(m_plugins); it.current(); ++it) {
+ WidgetPluginBase *b = dynamic_cast<WidgetPluginBase*>(it.current());
+ if (!b) continue;
+
+ int id = menu->insertItem("dummy", b->getWidget(), TQT_SLOT(toggleShown()));
+ map.insert(b, id);
+ updateWidgetPluginMenuItem(b, menu, map, b->isReallyVisible());
+ }
+}
+
+
+void PluginManager::updateWidgetPluginMenuItem(WidgetPluginBase *b, TQMenuData *menu, TQMap<WidgetPluginBase *,int> &map, bool shown) const
+{
+ if (!b || !map.contains(b))
+ return;
+
+ const TQString &name = b->description();
+ TQString text = (shown ? i18n("Hide %1") : i18n("Show %1")).arg(name);
+
+ menu->changeItem(map[b],
+ TQIconSet(SmallIconSet(!shown ? "tderadio_show" : "tderadio_hide")),
+ text);
+}
+
+
+void PluginManager::noticeWidgetPluginShown(WidgetPluginBase *p, bool shown)
+{
+ for (PluginIterator it(m_plugins); it.current(); ++it) {
+ it.current()->noticeWidgetPluginShown(p, shown);
+ }
+}
+
+
+PluginBase *PluginManager::getPluginByName(const TQString &name) const
+{
+ for (PluginIterator it(m_plugins); it.current(); ++it) {
+ if (it.current()->name() == name)
+ return it.current();
+ }
+ return NULL;
+}
+
+
+void PluginManager::insertPlugin(PluginBase *p)
+{
+ BlockProfiler profiler("PluginManager::insertPlugin");
+
+ if (p) {
+ BlockProfiler profiler_cfg("PluginManager::insertPlugin - about/config");
+
+ /*kdDebug() << TQDateTime::currentDateTime().toString(Qt::ISODate)
+ << " Debug: Adding Plugin: " << p->name() << "\n";*/
+
+ if (!m_configDialog)
+ createConfigDialog(m_configDialogTitle);
+ if (!m_aboutDialog)
+ createAboutDialog(m_aboutDialogTitle);
+
+ m_plugins.append(p);
+ p->setManager(this);
+
+ addConfigurationPage (p, p->createConfigurationPage());
+ addAboutPage (p, p->createAboutPage());
+
+ profiler_cfg.stop();
+ BlockProfiler profiler_connect("PluginManager::insertPlugin - connect");
+
+ // connect plugins with each other
+ for (PluginIterator it(m_plugins); it.current(); ++it) {
+ if (it.current() != p) {
+ /*kdDebug() << TQDateTime::currentDateTime().toString(Qt::ISODate)
+ << " Debug: connecting with " << it.current()->name() << "\n";*/
+ p->connectI(it.current());
+ }
+ }
+
+ // perhaps some existing config pages will profit from new plugin
+ // example: timecontrol profits from radio plugin
+ for (TQWidgetDictIterator it(m_configPages); it.current(); ++it) {
+ Interface *i = dynamic_cast<Interface *>(it.current());
+ if (i)
+ i->connectI(p);
+ }
+
+ profiler_connect.stop();
+ BlockProfiler profiler_widget("PluginManager::insertPlugin - notifywidgets");
+
+ WidgetPluginBase *w1 = dynamic_cast<WidgetPluginBase*>(p);
+ for (PluginIterator it(m_plugins); it.current(); ++it) {
+ it.current()->noticePluginsChanged(m_plugins);
+ if (w1)
+ it.current()->noticeWidgetPluginShown(w1, w1->isReallyVisible());
+
+ WidgetPluginBase *w2 = dynamic_cast<WidgetPluginBase*>(it.current());
+ if (w2)
+ p->noticeWidgetPluginShown(w2, w2->isReallyVisible());
+ }
+
+ if (m_pluginManagerConfiguration)
+ m_pluginManagerConfiguration->noticePluginsChanged();
+
+ profiler_widget.stop();
+ }
+}
+
+
+void PluginManager::deletePlugin(PluginBase *p)
+{
+ if (p && m_plugins.contains(p)) {
+ removePlugin(p);
+ delete p;
+ }
+}
+
+
+void PluginManager::removePlugin(PluginBase *p)
+{
+ if (p && m_plugins.contains(p)) {
+
+ for (PluginIterator it(m_plugins); it.current(); ++it) {
+ if (it.current() != p) {
+ // workaround for buggy compilers/libstdc++
+ if (p->destructorCalled()) {
+ p->PluginBase::disconnectI(it.current());
+ } else {
+ p->disconnectI(it.current());
+ }
+ }
+ }
+
+ // remove config page from config dialog, only chance is to delete it
+ // plugin will be notified automatically (mechanism implemented by
+ // PluginBase)
+ while (TQFrame *f = m_configPageFrames.find(p)) {
+ m_configPageFrames.remove(p);
+ m_configPages.remove(p);
+ delete f;
+ }
+ while (TQFrame *f = m_aboutPageFrames.find(p)) {
+ m_aboutPageFrames.remove(p);
+ m_aboutPages.remove(p);
+ delete f;
+ }
+
+ // remove bindings between me and plugin
+ m_plugins.remove(p);
+ p->unsetManager();
+
+ p->noticePluginsChanged(PluginList());
+ for (PluginIterator it(m_plugins); it.current(); ++it) {
+ it.current()->noticePluginsChanged(m_plugins);
+ }
+
+ if (m_pluginManagerConfiguration)
+ m_pluginManagerConfiguration->noticePluginsChanged();
+ }
+}
+
+
+void PluginManager::addConfigurationPage (PluginBase *forWhom,
+ const ConfigPageInfo &info)
+{
+ if (!forWhom || !m_plugins.containsRef(forWhom) || !info.page)
+ return;
+ TQFrame *f = addConfigurationPage(info);
+
+ // register this frame and config page
+ m_configPageFrames.insert(forWhom, f);
+ m_configPages.insert(forWhom, info.page);
+
+ // perhaps new config page profits from existing plugins
+ // example: timecontrol profits from radio plugin
+ Interface *i = dynamic_cast<Interface *>(info.page);
+ if (i) {
+ for (PluginIterator it(m_plugins); it.current(); ++it)
+ i->connectI(it.current());
+ }
+}
+
+
+TQFrame *PluginManager::addConfigurationPage (const ConfigPageInfo &info)
+{
+ if (!m_configDialog)
+ createConfigDialog(i18n(m_configDialogTitle.ascii()));
+
+ // create empty config frame
+ TQFrame *f = m_configDialog->addPage(
+ info.itemName,
+ info.pageHeader,
+ TDEGlobal::instance()->iconLoader()->loadIcon( info.iconName, TDEIcon::NoGroup, TDEIcon::SizeMedium )
+ );
+
+ // fill config frame with layout ...
+ TQGridLayout *l = new TQGridLayout(f);
+ l->setSpacing( 0 );
+ l->setMargin( 0 );
+
+ // ... and externally created config page
+ info.page->reparent (f, TQPoint(0,0), true);
+ l->addWidget( info.page, 0, 0 );
+
+ // make sure, that config page receives ok, apply and cancel signals
+ TQObject::connect(this, TQT_SIGNAL(sigConfigOK()), info.page, TQT_SLOT(slotOK()));
+ TQObject::connect(m_configDialog, TQT_SIGNAL(cancelClicked()), info.page, TQT_SLOT(slotCancel()));
+
+ return f;
+}
+
+
+void PluginManager::createConfigDialog(const TQString &title)
+{
+ if (m_configDialog) delete m_configDialog;
+ m_configDialog = NULL;
+
+ PluginConfigurationDialog *cfg = new PluginConfigurationDialog(
+ KDialogBase::IconList,
+ title,
+ KDialogBase::Apply|KDialogBase::Ok|KDialogBase::Cancel,
+ KDialogBase::Ok,
+ /*parent = */ NULL,
+ title.ascii(),
+ /*modal = */ false,
+ true);
+
+ m_configDialog = cfg;
+
+ TQObject::connect(m_configDialog, TQT_SIGNAL(okClicked()), this, TQT_SLOT(slotConfigOK()));
+ TQObject::connect(m_configDialog, TQT_SIGNAL(applyClicked()), this, TQT_SLOT(slotConfigOK()));
+
+ insertPlugin(cfg);
+
+ addConfigurationPage(createOwnConfigurationPage());
+
+ for (PluginIterator i(m_plugins); m_configDialog && i.current(); ++i) {
+ addConfigurationPage(i.current(),
+ i.current()->createConfigurationPage());
+ }
+}
+
+
+ConfigPageInfo PluginManager::createOwnConfigurationPage()
+{
+ m_pluginManagerConfiguration = new PluginManagerConfiguration(NULL, m_Application, this);
+ return ConfigPageInfo (m_pluginManagerConfiguration,
+ i18n("Plugins"),
+ i18n("Plugin Library Configuration"),
+ "tderadio_plugins");
+}
+
+
+
+
+
+void PluginManager::addAboutPage (PluginBase *forWhom,
+ const AboutPageInfo &info)
+{
+ if (!m_aboutDialog)
+ createAboutDialog(i18n(m_aboutDialogTitle.ascii()));
+
+ if ( !forWhom || !m_plugins.containsRef(forWhom)
+ || !m_aboutDialog || !info.page)
+ return;
+
+
+ // create empty about frame
+ TQFrame *f = m_aboutDialog->addPage(
+ info.itemName,
+ info.pageHeader,
+ TDEGlobal::instance()->iconLoader()->loadIcon( info.iconName, TDEIcon::NoGroup, TDEIcon::SizeMedium )
+ );
+
+ // register this frame and config page
+ m_aboutPageFrames.insert(forWhom, f);
+ m_aboutPages.insert(forWhom, info.page);
+
+ // fill config frame with layout ...
+ TQGridLayout *l = new TQGridLayout(f);
+ l->setSpacing( 0 );
+ l->setMargin( 0 );
+
+ // ... and externally created config page
+ info.page->reparent (f, TQPoint(0,0), true);
+ l->addWidget( info.page, 0, 0 );
+}
+
+
+void PluginManager::createAboutDialog(const TQString &title)
+{
+ if (m_aboutDialog) delete m_aboutDialog;
+ m_aboutDialog = NULL;
+
+ m_aboutDialog = new KDialogBase(KDialogBase::IconList,
+ title,
+ KDialogBase::Close,
+ KDialogBase::Close,
+ /*parent = */ NULL,
+ title.ascii(),
+ /*modal = */ false,
+ true);
+
+ for (PluginIterator i(m_plugins); m_aboutDialog && i.current(); ++i) {
+ addAboutPage(i.current(),
+ i.current()->createAboutPage());
+ }
+}
+
+
+void PluginManager::saveState (TDEConfig *c) const
+{
+ c->setGroup("PluginManager-" + m_Name);
+ c->writeEntry("show-progress-bar", m_showProgressBar);
+ int n = 0;
+ for (PluginIterator it(m_plugins); it.current(); ++it) {
+ TQString class_name = it.current()->pluginClassName();
+ TQString object_name = it.current()->name();
+ if (class_name.length() && object_name.length() &&
+ m_Application->getPluginClasses().contains(class_name))
+ {
+ ++n;
+ c->writeEntry("plugin_class_" + TQString::number(n), class_name);
+ c->writeEntry("plugin_name_" + TQString::number(n), object_name);
+ }
+ }
+ c->writeEntry("plugins", n);
+
+ for (PluginIterator i(m_plugins); i.current(); ++i) {
+ i.current()->saveState(c);
+ }
+}
+
+
+void PluginManager::restoreState (TDEConfig *c)
+{
+ BlockProfiler profile_all("PluginManager::restoreState");
+ c->setGroup("PluginManager-" + m_Name);
+ m_showProgressBar = c->readBoolEntry("show-progress-bar", true);
+ int n = c->readNumEntry("plugins", 0);
+
+ KProgressDialog *progress = NULL;
+ if (m_showProgressBar) {
+ progress = new KProgressDialog(NULL, NULL, i18n("Starting Plugins"));
+ progress->setMinimumWidth(400);
+ progress->setAllowCancel(false);
+ progress->show();
+ progress->progressBar()->setTotalSteps(2*n);
+ }
+
+ for (int i = 1; i <= n; ++i) {
+ c->setGroup("PluginManager-" + m_Name);
+ TQString class_name = c->readEntry("plugin_class_" + TQString::number(i));
+ TQString object_name = c->readEntry("plugin_name_" + TQString::number(i));
+
+ if (m_showProgressBar)
+ progress->TQWidget::setCaption(i18n("Creating Plugin %1").arg(class_name));
+ if (class_name.length() && object_name.length())
+ m_Application->CreatePlugin(this, class_name, object_name);
+ if (m_showProgressBar)
+ progress->progressBar()->setProgress(i);
+ }
+
+ if (m_Application && n == 0) {
+ const TQMap<TQString, PluginClassInfo> &classes = m_Application->getPluginClasses();
+ TQMapConstIterator<TQString, PluginClassInfo> end = classes.end();
+ n = classes.count();
+ if (m_showProgressBar)
+ progress->progressBar()->setTotalSteps(2*n);
+ int idx = 1;
+ for (TQMapConstIterator<TQString, PluginClassInfo> it=classes.begin(); it != end; ++it, ++idx) {
+ const PluginClassInfo &cls = *it;
+ if (m_showProgressBar)
+ progress->TQWidget::setCaption(i18n("Creating Plugin %1").arg(cls.class_name));
+ m_Application->CreatePlugin(this, cls.class_name, m_Name + "-" + cls.class_name);
+ if (m_showProgressBar)
+ progress->progressBar()->setProgress(idx);
+ }
+ m_configDialog->show();
+ }
+
+ BlockProfiler profile_plugins("PluginManager::restoreState - plugins");
+
+ int idx = n;
+ for (PluginIterator i(m_plugins); i.current(); ++i, ++idx) {
+ BlockProfiler profile_plugin("PluginManager::restoreState - " + i.current()->pluginClassName());
+ if (m_showProgressBar)
+ progress->TQWidget::setCaption(i18n("Initializing Plugin %1").arg(i.current()->pluginClassName()));
+ i.current()->restoreState(c);
+ if (m_showProgressBar)
+ progress->progressBar()->setProgress(idx+1);
+ }
+ if (m_showProgressBar)
+ delete progress;
+}
+
+PluginConfigurationDialog *PluginManager::getConfigDialog()
+{
+ if (!m_configDialog)
+ createConfigDialog(m_configDialogTitle);
+ return m_configDialog;
+}
+
+KDialogBase *PluginManager::getAboutDialog()
+{
+ if (!m_aboutDialog)
+ createAboutDialog();
+ return m_aboutDialog;
+}
+
+
+
+void PluginManager::slotConfigOK()
+{
+ emit sigConfigOK();
+ if (m_Application)
+ m_Application->saveState(TDEGlobal::config());
+}
+
+
+void PluginManager::startPlugins()
+{
+ for (PluginIterator i(m_plugins); i.current(); ++i) {
+ i.current()->startPlugin();
+ }
+}
+
+void PluginManager::aboutToQuit()
+{
+ for (PluginIterator i(m_plugins); i.current(); ++i) {
+ i.current()->aboutToQuit();
+ }
+}
+
+
+#include "pluginmanager.moc"
diff --git a/src/plugins.cpp b/src/plugins.cpp
new file mode 100644
index 0000000..3c386b3
--- /dev/null
+++ b/src/plugins.cpp
@@ -0,0 +1,84 @@
+/***************************************************************************
+ plugins.cpp - description
+ -------------------
+ begin : Mon Mr 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/plugins.h"
+#include "include/pluginmanager.h"
+
+PluginBase::PluginBase(const TQString &name, const TQString &description)
+ : m_name(name),
+ m_description(description),
+ m_manager(NULL),
+ m_destructorCalled(false)
+{
+}
+
+
+PluginBase::~PluginBase()
+{
+ m_destructorCalled = true;
+ //IErrorLogClient::logDebug("destructing plugin " + m_name);
+ unsetManager();
+}
+
+
+bool PluginBase::setManager (PluginManager *m)
+{
+ if (!m_manager && m) {
+ m_manager = m;
+ return true;
+ } else {
+ return false;
+ }
+}
+
+
+void PluginBase::unsetManager ()
+{
+ if (m_manager) {
+ PluginManager *old = m_manager;
+ m_manager = NULL;
+ old->removePlugin(this);
+ }
+}
+
+
+bool PluginBase::isManagerSet () const
+{
+ return m_manager != NULL;
+}
+
+
+void PluginBase::saveState (TDEConfig *) const
+{
+ // do nothing
+}
+
+
+void PluginBase::restoreState (TDEConfig *)
+{
+ // do nothing
+}
+
+
+void PluginBase::startPlugin()
+{
+ // do nothing
+}
+
+void PluginBase::aboutToQuit()
+{
+}
diff --git a/src/po/Makefile.am b/src/po/Makefile.am
new file mode 100644
index 0000000..e8b16ec
--- /dev/null
+++ b/src/po/Makefile.am
@@ -0,0 +1,2 @@
+POFILES = AUTO
+PACKAGE = tderadio
diff --git a/src/po/de.po b/src/po/de.po
new file mode 100644
index 0000000..e864844
--- /dev/null
+++ b/src/po/de.po
@@ -0,0 +1,534 @@
+# translation of de.po to
+# This file is put in the public domain.
+#
+# Ernst Martin Witte <witte@kawo1.rwth-aachen.de>, 2006.
+# Ernst Martin Witte <emw@nocabal.de>, 2006.
+msgid ""
+msgstr ""
+"Project-Id-Version: de\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2021-07-07 18:28+0000\n"
+"PO-Revision-Date: 2019-12-22 15:33+0000\n"
+"Last-Translator: Chris <xchrisx@uber.space>\n"
+"Language-Team: German <https://mirror.git.trinitydesktop.org/weblate/"
+"projects/applications/tderadio/de/>\n"
+"Language: de\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+"X-Generator: Weblate 3.9.1\n"
+
+#. Instead of a literal translation, add your name to the end of the list (separated by a comma).
+msgid ""
+"_: NAME OF TRANSLATORS\n"
+"Your names"
+msgstr "Ernst Martin Witte, Chris (TDE)"
+
+#. Instead of a literal translation, add your email to the end of the list (separated by a comma).
+msgid ""
+"_: EMAIL OF TRANSLATORS\n"
+"Your emails"
+msgstr "emw@nocabal.de, (Keine Email)"
+
+#: aboutwidget.cpp:282
+msgid "Invalid layout"
+msgstr "Ungültiges Layout"
+
+#: aboutwidget.cpp:451
+msgid "%1 %2 (Using TDE %3)"
+msgstr "%1 %2 (TDE %3)"
+
+#: aboutwidget.cpp:454
+msgid "%1 %2, %3"
+msgstr "%1 %2, %3"
+
+#: aboutwidget.cpp:527
+msgid "A&uthor"
+msgstr "A&utor"
+
+#: aboutwidget.cpp:527
+msgid "A&uthors"
+msgstr "A&utoren"
+
+#: aboutwidget.cpp:541
+msgid "&Thanks To"
+msgstr "&Dank an"
+
+#: aboutwidget.cpp:554
+msgid "T&ranslation"
+msgstr "Ü&bersetzungen"
+
+#: aboutwidget.cpp:571
+msgid "&License Agreement"
+msgstr "&Lizenzen"
+
+#: aboutwidget.cpp:585
+msgid "Image missing"
+msgstr "Bilddatei fehlt"
+
+#: errorlog-interfaces.cpp:43 errorlog-interfaces.cpp:78
+msgid "%1 Error: %2\n"
+msgstr "%1 Fehler: %2\n"
+
+#: errorlog-interfaces.cpp:52 errorlog-interfaces.cpp:87
+msgid "%1 Warning: %2\n"
+msgstr "%1 Warnung: %2\n"
+
+#: errorlog-interfaces.cpp:61 errorlog-interfaces.cpp:96
+msgid "%1 Information: %2\n"
+msgstr "%1 Information: %2\n"
+
+#: errorlog-interfaces.cpp:70 errorlog-interfaces.cpp:105
+msgid "%1 Debug: %2\n"
+msgstr "%1 Debug: %2\n"
+
+#: fileringbuffer.cpp:35 fileringbuffer.cpp:68
+#, c-format
+msgid "cannot open buffer file %1"
+msgstr "kann die Puffer-Datei %1 nicht öffnen"
+
+#: fileringbuffer.cpp:93
+msgid "FileRingbuffer::resize: Writing to tmpfile %1 failed. "
+msgstr ""
+"FileRingbuffer::resize: Schreiben in die temporäre Datei %1 schlug fehl. "
+
+#: fileringbuffer.cpp:99
+msgid "FileRingbuffer::resize: Opening tmpfile %1 failed. "
+msgstr ""
+"FileRingbuffer::resize: Das Öffnen der temporären Datei %1 schlug fehl. "
+
+#: fileringbuffer.cpp:127 fileringbuffer.cpp:145
+#, c-format
+msgid "FileRingBuffer::addData: failed writing data to file %1."
+msgstr "FileRingBuffer::addData: Das Schreiben in die Datei %1 schlug fehl."
+
+#: fileringbuffer.cpp:168
+#, c-format
+msgid "FileRingBuffer::takeData: failed reading data to file %1."
+msgstr "FileRingBuffer::takeData: Das Lesen aus der Datei %1 schlug fehl."
+
+#: frequencyradiostation.cpp:120 internetradiostation.cpp:118
+msgid "%1, %2"
+msgstr "%1, %2"
+
+#: frequencyradiostation.cpp:134
+msgid "%1 MHz"
+msgstr "%1 MHz"
+
+#: frequencyradiostation.cpp:136
+msgid "%1 kHz"
+msgstr "%1 kHz"
+
+#: include/radiostation.h:150 include/radiostation.h:151
+#: standardscandialog.cpp:162 standardscandialog.cpp:165
+msgid "unknown"
+msgstr "unbekannt"
+
+#: main.cpp:36
+msgid "TDERadio"
+msgstr "TDERadio"
+
+#: main.cpp:42
+msgid "rewrite for 0.3.0, recording, lirc support, alarms, misc"
+msgstr ""
+"Überarbeitung für 0.3.0, Aufnahmefunktion, LIRC-Unterstützung, Wecker, "
+"Verschiedenes"
+
+#: main.cpp:43 tderadioapp.cpp:67
+msgid "Buildsystem, Standards Conformance, Cleanups"
+msgstr "Buildsystem, Standardkonformität, Aufräumarbeiten"
+
+#: main.cpp:45 tderadioapp.cpp:69
+msgid "idea, first basic application"
+msgstr "Idee, allererstes Programm"
+
+#: multibuffer.cpp:89
+msgid "Buffer Overflow. "
+msgstr "Puffer Überlauf. "
+
+#: plugin_configuration_dialog.cpp:29
+msgid "Configuration Dialog"
+msgstr "Einrichtungsdialog"
+
+#: pluginmanager-configuration.cpp:143
+msgid "Enter Plugin Instance Name"
+msgstr "Name der Plugin-Instanz eingeben"
+
+#: pluginmanager-configuration-ui.ui:89 pluginmanager-configuration.cpp:144
+#, no-c-format
+msgid "Instance Name"
+msgstr "Name der Instanz"
+
+#: pluginmanager.cpp:123
+#, c-format
+msgid "Hide %1"
+msgstr "Verstecke %1"
+
+#: pluginmanager.cpp:123
+#, c-format
+msgid "Show %1"
+msgstr "%1 anzeigen"
+
+#: pluginmanager.cpp:350
+msgid "Plugins"
+msgstr "Plugins"
+
+#: pluginmanager.cpp:351
+msgid "Plugin Library Configuration"
+msgstr "Einrichtung der Plugin-Bibliotheken"
+
+#: pluginmanager.cpp:446
+msgid "Starting Plugins"
+msgstr "Starten der Plugins"
+
+#: pluginmanager.cpp:459 pluginmanager.cpp:476
+#, c-format
+msgid "Creating Plugin %1"
+msgstr "Erzeuge Plugin %1"
+
+#: pluginmanager.cpp:490
+#, c-format
+msgid "Initializing Plugin %1"
+msgstr "Starten des Plugins %1"
+
+#: radiostation-config.cpp:45
+msgid "I don't know how to edit this station"
+msgstr "Keine Ahnung, wie dieser Sender bearbeitet werden soll"
+
+#: radiostation-config.cpp:68
+msgid "Frequency:"
+msgstr "Frequenz:"
+
+#: radiostation-listview.cpp:33
+msgid "No."
+msgstr "Nr."
+
+#: radiostation-listview.cpp:34
+msgid "Icon"
+msgstr "Symbol "
+
+#: radiostation-listview.cpp:35
+msgid "Station"
+msgstr "Sender"
+
+#: pluginmanager-configuration-ui.ui:100 pluginmanager-configuration-ui.ui:240
+#: radiostation-listview.cpp:36
+#, no-c-format
+msgid "Description"
+msgstr "Beschreibung"
+
+#: radiostation-listview.cpp:234
+msgid "contentsDragEnterEvent accepted"
+msgstr "contentsDragEnterEvent angenommen"
+
+#: radiostation-listview.cpp:236
+msgid "contentsDragEnterEvent rejected"
+msgstr "contentsDragEnterEvent abgelehnt"
+
+#: standardscandialog.cpp:118
+msgid "new station "
+msgstr "Neuer Sender "
+
+#: standardscandialog.cpp:142
+msgid "&Done"
+msgstr "&Fertig"
+
+#: standardscandialog.cpp:160
+msgid "<p align=\"right\">%1</p>"
+msgstr "<p align=\"right\">%1</p>"
+
+#: station-drag-object.cpp:70
+msgid "canDecode = true"
+msgstr "canDecode = true"
+
+#: stationlist.cpp:255
+msgid "Contains merged Data"
+msgstr "Enthält zusammengefügte Einträge"
+
+#: stationlist.cpp:315
+msgid ""
+"Probably an old station preset file was read.\n"
+"You have to rebuild your station selections for the quickbar and the docking "
+"menu."
+msgstr ""
+"Wahrscheinlich wurde eine alte Senderdatei gelesen.\n"
+"Sie müssen ihre Senderauswahlen für das Kurzwahlfenster und das "
+"Kontrollleistenmenü neu erstellen."
+
+#: stationlist.cpp:325
+msgid "parsing failed"
+msgstr "Das Parsen schlug fehl"
+
+#: stationlist.cpp:329
+msgid ""
+"Parsing the station preset file failed.\n"
+"See console output for more details."
+msgstr ""
+"Das Parsen der Senderdatei schlug fehl.\n"
+"Mehr informationen gibts in der Ausgabe auf der Konsole."
+
+#: stationlist.cpp:343 stationlist.cpp:349
+#, c-format
+msgid "error downloading preset file %1"
+msgstr "Fehler beim Download der Senderdatei %1"
+
+#: stationlist.cpp:345
+msgid "Download of the station preset file at %1 failed."
+msgstr "Der Download der Senderdatei %1 schlug fehl."
+
+#: stationlist.cpp:355
+msgid "temporary file: "
+msgstr "temporäre Datei: "
+
+#: stationlist.cpp:361
+#, c-format
+msgid "error opening preset file %1"
+msgstr "Fehler beim Öffnen der Senderdatei %1"
+
+#: stationlist.cpp:364
+msgid "Opening of the station preset file at %1 failed."
+msgstr "Das Öffnen der Senderdatei %1 schluf fehl."
+
+#: stationlist.cpp:383
+msgid "Old Preset File Format detected"
+msgstr "Altes Senderdateiformat erkannt"
+
+#: stationlist.cpp:461
+#, c-format
+msgid "error writing to tempfile %1"
+msgstr "Fehler beim schreiben in die temporäre Datei %1"
+
+#: stationlist.cpp:464
+msgid "Writing station preset file %1 failed."
+msgstr "Das Schreiben der Senderdatei %1 schlug fehl."
+
+#: stationlist.cpp:475
+msgid "uploading preset file %1: "
+msgstr "Speichern der Senderliste in Datei %1: "
+
+#: stationlist.cpp:477
+msgid ""
+"something strange happend, station list has only %1 entries. Writing station "
+"preset file skipped"
+msgstr ""
+"Etwas seltsames ist passiert: Die Senderliste hat nur %1 Einträge. Das "
+"Speichern der Senderliste wurde übersprungen."
+
+#: stationlist.cpp:482
+#, c-format
+msgid "error uploading preset file %1"
+msgstr "Fehler: Das Speichern der Senderlistendatei %1 schlug fehl"
+
+#: stationlist.cpp:486
+msgid "Upload of station preset file to %1 failed."
+msgstr "Der Upload der Senderdatei %1 schlug fehl."
+
+#: stationlistxmlhandler.cpp:116
+#, c-format
+msgid "unknown or unexpected element %1"
+msgstr "unbekanntes oder unerwartetes Element %1"
+
+#: stationlistxmlhandler.cpp:145
+msgid "expected element %1, but found %2"
+msgstr "erwartetes Element: %1, gefundenes: %2"
+
+#: stationlistxmlhandler.cpp:149
+#, c-format
+msgid "unexpected element %1"
+msgstr "unerwartetes Element %1"
+
+#: stationlistxmlhandler.cpp:172
+#, c-format
+msgid "found a station list with unknown format %1"
+msgstr "Die Senderdatei enthält das unbekannte Format %1"
+
+#: stationlistxmlhandler.cpp:212
+msgid "unknown property %1 for class %2"
+msgstr "Die Eigenschaft %1 ist der Klasse %2 unbekannt"
+
+#: stationlistxmlhandler.cpp:219
+#, c-format
+msgid "characters ignored for element %1"
+msgstr "Einige Zeichen des Elements %1 wurden ignoriert"
+
+#: tderadioapp.cpp:44
+msgid ""
+"TDERadio - The Radio Application for TDE<P>With TDERadio you can listen to "
+"radio broadcasts with the help of your V4L/V4L2 compatible radio card.<P>The "
+"TDERadio Project contains a station preset data database. To complete this "
+"database you are encouraged to contribute your station preset file to the "
+"project. Just send it to one of the authors. <P>If you like to contribute "
+"your ideas, your own plugins or translations, don't hesitate to contact one "
+"of the authors.<P>"
+msgstr ""
+"TDERadio - Das Radio-Programm für TDE<P>Mit TDERadio und einer Radiokarte, "
+"die vom Video-Für-Linux Treiber des Linux-Kernels unterstützt wird, können "
+"Sie am PC Radiosendungen hören.<P> Das TDERadio-Projekt baut eine weltweite "
+"Senderdatenbank auf. Seien Sie ermutigt, Ihre eigenen Sendereinstellungen "
+"dem TDERadio-Projekt beizusteuern. Schicken Sie ihre Sendereinstellungen "
+"einfach an einen der Autoren. <P> Wenn Sie mit Ihren Ideen, eigenen Plugins "
+"oder Übersetzungen zum TDERadio-Projekt beitragen wollen, zögern Sie nicht, "
+"sich mit einem der Autoren in Verbindung zu setzen.<P>"
+
+#: tderadioapp.cpp:66
+msgid ""
+"Preset Database, Remote Control Support, Alarms, Rewrite for TDERadio 0.3.0, "
+"Misc"
+msgstr ""
+"Sender-Datenbank, Unterstützung für Fernsteuerungen, Wecker, Überarbeitung "
+"zu TDERadio 0.3.0, Verschiedenes"
+
+#: tderadioapp.cpp:71
+msgid "Many People around the World ... "
+msgstr "Viele Leute rund um die Welt ... "
+
+#: tderadioapp.cpp:72
+msgid ""
+"... which contributed station preset files \n"
+"and tested early and unstable snapshots of TDERadio \n"
+"with much patience"
+msgstr ""
+"... die Senderauswahl-Dateien beigesteuert und frühe und\n"
+"instabile Snapshots von TDERadio mit viel Geduld getestet haben."
+
+#: tderadioapp.cpp:106
+msgid "Library %1: Plugin Entry Point is missing\n"
+msgstr "Bibliothek %1: Eintrittspunkt wurde nicht gefunden\n"
+
+#: tderadioapp.cpp:108 tderadioapp.cpp:119
+msgid "Plugin Library Load Error"
+msgstr "Das Laden der Bibliothek schlug fehl"
+
+#: tderadioapp.cpp:116
+msgid ""
+"Library %1: \n"
+"%2"
+msgstr ""
+"Bibliothek %1: \n"
+"%2"
+
+#: tderadioapp.cpp:143
+msgid "saveState"
+msgstr "saveState"
+
+#: tderadioapp.cpp:221
+msgid "Instance"
+msgstr "Instanz"
+
+#: tderadioapp.cpp:242
+msgid "TDERadio Configuration"
+msgstr "Einrichtung von TDERadio"
+
+#: tderadioapp.cpp:243
+msgid "About TDERadio Components"
+msgstr "Über die TDERadio-Komponenten"
+
+#: tderadioapp.cpp:271
+msgid "Error: Loading Library %1 failed: %2"
+msgstr "Fehler: Das Laden der Bibliothek %1 schlug fehl: %2"
+
+#: tderadioapp.cpp:322
+msgid "Error: Creation of instance \"%1\" of class %2 falied."
+msgstr "Fehler: Das erzeugen der Instanz \"%1\" der Klasse %2 schlug fehl."
+
+#: tderadioapp.cpp:328
+msgid "Error: Cannot create instance \"%1\" of unknown class %2."
+msgstr ""
+"Fehler: Kann die Instanz \"%1\" der unbekannten Klasse %2 nicht erzeugen."
+
+#: pluginmanager-configuration-ui.ui:16
+#, no-c-format
+msgid "PluginManagerConfigurationUI"
+msgstr "PluginManagerConfigurationUI"
+
+#: pluginmanager-configuration-ui.ui:30
+#, no-c-format
+msgid "Show Progress Bar during Startup for Plugin Initiali&zation"
+msgstr "Fortschrittsbalken bei der Initialisierung der Plugins anzeigen"
+
+#: pluginmanager-configuration-ui.ui:33
+#, no-c-format
+msgid "Alt+Z"
+msgstr "Alt+Z"
+
+#: pluginmanager-configuration-ui.ui:78 pluginmanager-configuration-ui.ui:229
+#, no-c-format
+msgid "Plugin Class"
+msgstr "Plugin Klasse"
+
+#: pluginmanager-configuration-ui.ui:116
+#, no-c-format
+msgid "list of running plugins"
+msgstr "Liste der laufenden Plugins"
+
+#: pluginmanager-configuration-ui.ui:153
+#, no-c-format
+msgid "remove/stop a selected plugin instance"
+msgstr "Anhalten/Entfernen der ausgewählten Plugin-Instanz"
+
+#: pluginmanager-configuration-ui.ui:223
+#, no-c-format
+msgid "create a new instance of selected plugin class"
+msgstr "Erzeugen einer neuen Instanz der ausgewählten Pluginklasse"
+
+#: pluginmanager-configuration-ui.ui:256
+#, no-c-format
+msgid "list of available plugin classes"
+msgstr "Liste der Verfügbaren Plugin-Klassen"
+
+#: pluginmanager-configuration-ui.ui:297
+#, no-c-format
+msgid "select a plugin library"
+msgstr "Auswahl einer Plugin-Bibliothek"
+
+#: pluginmanager-configuration-ui.ui:317
+#, no-c-format
+msgid "unload a plugin library"
+msgstr "Entfernen einer Plugin-Bibliothek"
+
+#: pluginmanager-configuration-ui.ui:337
+#, no-c-format
+msgid "load a selected plugin library"
+msgstr "Laden der ausgewählten Plugin-Bibliothek"
+
+#: pluginmanager-configuration-ui.ui:353
+#, no-c-format
+msgid "list of loaded plugin libraries"
+msgstr "Liste der geladenen Plugin-Bibliotheken"
+
+#: standardscandialog-ui.ui:16
+#, no-c-format
+msgid "Stations search in progress ..."
+msgstr "Sendersuchlauf läuft ..."
+
+#: standardscandialog-ui.ui:104
+#, no-c-format
+msgid "remaining time"
+msgstr "verbleibende Zeit"
+
+#: standardscandialog-ui.ui:120
+#, no-c-format
+msgid "<p align=\"right\">nothing here</p>"
+msgstr "<p align=\"right\">hier ist nix</p>"
+
+#: stationselector-ui.ui:16
+#, no-c-format
+msgid "StationSelectorUI"
+msgstr "StationSelectorUI"
+
+#: stationselector-ui.ui:30
+#, no-c-format
+msgid "Selected Stations"
+msgstr "Ausgewählte Sender"
+
+#: stationselector-ui.ui:119
+#, no-c-format
+msgid "Available Stations"
+msgstr "Verfügbare Sender"
+
+#~ msgid "misplaced element %1"
+#~ msgstr "unerwartetes Element %1"
+
+#~ msgid "invalid data for element %1"
+#~ msgstr "ingültige Daten im Element %1"
diff --git a/src/po/es.po b/src/po/es.po
new file mode 100644
index 0000000..bd6c29e
--- /dev/null
+++ b/src/po/es.po
@@ -0,0 +1,1316 @@
+# translation of es.po to es_ES
+# translation of tderadio.po to es_ES
+# This file is distributed under the same license as the PACKAGE package.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER.
+# Rafael Rodrï¿œguez Martï¿œn <apt-drink@telefonica.net>, 2004.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: es\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2021-07-07 18:28+0000\n"
+"PO-Revision-Date: 2004-02-28 22:45+0000\n"
+"Last-Translator: Rafael Rodrï¿œguez Martï¿œn <apt-drink@telefonica.net>\n"
+"Language-Team: es_ES <kde-es@kybs.de>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.3\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#. Instead of a literal translation, add your name to the end of the list (separated by a comma).
+msgid ""
+"_: NAME OF TRANSLATORS\n"
+"Your names"
+msgstr "Rafael Rodrï¿œguez Martï¿œn"
+
+#. Instead of a literal translation, add your email to the end of the list (separated by a comma).
+msgid ""
+"_: EMAIL OF TRANSLATORS\n"
+"Your emails"
+msgstr "apt-drink@telefonica.net"
+
+#: aboutwidget.cpp:282
+#, fuzzy
+msgid "Invalid layout"
+msgstr "emisora no vï¿œlida"
+
+#: aboutwidget.cpp:451
+msgid "%1 %2 (Using TDE %3)"
+msgstr "%1 %2 (Utilizando TDE %3)"
+
+#: aboutwidget.cpp:454
+msgid "%1 %2, %3"
+msgstr "%1 %2, %3"
+
+#: aboutwidget.cpp:527
+msgid "A&uthor"
+msgstr "A&utor"
+
+#: aboutwidget.cpp:527
+msgid "A&uthors"
+msgstr "A&utores"
+
+#: aboutwidget.cpp:541
+msgid "&Thanks To"
+msgstr "&Gracias a"
+
+#: aboutwidget.cpp:554
+msgid "T&ranslation"
+msgstr "T&raducciï¿œn"
+
+#: aboutwidget.cpp:571
+msgid "&License Agreement"
+msgstr "&Acuerdo de licencia"
+
+#: aboutwidget.cpp:585
+msgid "Image missing"
+msgstr "Falta imagen"
+
+#: errorlog-interfaces.cpp:43 errorlog-interfaces.cpp:78
+msgid "%1 Error: %2\n"
+msgstr ""
+
+#: errorlog-interfaces.cpp:52 errorlog-interfaces.cpp:87
+#, fuzzy
+msgid "%1 Warning: %2\n"
+msgstr "Avisos"
+
+#: errorlog-interfaces.cpp:61 errorlog-interfaces.cpp:96
+msgid "%1 Information: %2\n"
+msgstr ""
+
+#: errorlog-interfaces.cpp:70 errorlog-interfaces.cpp:105
+msgid "%1 Debug: %2\n"
+msgstr ""
+
+#: fileringbuffer.cpp:35 fileringbuffer.cpp:68
+#, fuzzy, c-format
+msgid "cannot open buffer file %1"
+msgstr "No se puede abrir el archivo de salida %1. "
+
+#: fileringbuffer.cpp:93
+msgid "FileRingbuffer::resize: Writing to tmpfile %1 failed. "
+msgstr ""
+
+#: fileringbuffer.cpp:99
+msgid "FileRingbuffer::resize: Opening tmpfile %1 failed. "
+msgstr ""
+
+#: fileringbuffer.cpp:127 fileringbuffer.cpp:145
+#, c-format
+msgid "FileRingBuffer::addData: failed writing data to file %1."
+msgstr ""
+
+#: fileringbuffer.cpp:168
+#, c-format
+msgid "FileRingBuffer::takeData: failed reading data to file %1."
+msgstr ""
+
+#: frequencyradiostation.cpp:120 internetradiostation.cpp:118
+#, fuzzy
+msgid "%1, %2"
+msgstr "%1 %2, %3"
+
+#: frequencyradiostation.cpp:134
+#, fuzzy
+msgid "%1 MHz"
+msgstr " kHz"
+
+#: frequencyradiostation.cpp:136
+#, fuzzy
+msgid "%1 kHz"
+msgstr " kHz"
+
+#: include/radiostation.h:150 include/radiostation.h:151
+#: standardscandialog.cpp:162 standardscandialog.cpp:165
+msgid "unknown"
+msgstr "desconocido"
+
+#: main.cpp:36
+msgid "TDERadio"
+msgstr "TDERadio"
+
+#: main.cpp:42
+msgid "rewrite for 0.3.0, recording, lirc support, alarms, misc"
+msgstr ""
+"reescritura para 0.3.0, grabaciï¿œn, soporte lirc, alertas, miscelï¿œnea"
+
+#: main.cpp:43 tderadioapp.cpp:67
+msgid "Buildsystem, Standards Conformance, Cleanups"
+msgstr ""
+
+#: main.cpp:45 tderadioapp.cpp:69
+msgid "idea, first basic application"
+msgstr "idea, primera aplicaciï¿œn bï¿œsica"
+
+#: multibuffer.cpp:89
+msgid "Buffer Overflow. "
+msgstr ""
+
+#: plugin_configuration_dialog.cpp:29
+msgid "Configuration Dialog"
+msgstr "Diï¿œlogo de configuraciï¿œn"
+
+#: pluginmanager-configuration.cpp:143
+msgid "Enter Plugin Instance Name"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:89 pluginmanager-configuration.cpp:144
+#, fuzzy, no-c-format
+msgid "Instance Name"
+msgstr "Instancia"
+
+#: pluginmanager.cpp:123
+#, c-format
+msgid "Hide %1"
+msgstr "Esconder %1"
+
+#: pluginmanager.cpp:123
+#, c-format
+msgid "Show %1"
+msgstr "Mostrar %1"
+
+#: pluginmanager.cpp:350
+#, fuzzy
+msgid "Plugins"
+msgstr "Plugin LIRC"
+
+#: pluginmanager.cpp:351
+#, fuzzy
+msgid "Plugin Library Configuration"
+msgstr "Configuraciï¿œn de barra de acceso rï¿œpido"
+
+#: pluginmanager.cpp:446
+#, fuzzy
+msgid "Starting Plugins"
+msgstr "Iniciar reproducciï¿œn"
+
+#: pluginmanager.cpp:459 pluginmanager.cpp:476
+#, fuzzy, c-format
+msgid "Creating Plugin %1"
+msgstr "Plugin de grabaciï¿œn"
+
+#: pluginmanager.cpp:490
+#, fuzzy, c-format
+msgid "Initializing Plugin %1"
+msgstr "inicializando el plugin lirc de tderadio"
+
+#: radiostation-config.cpp:45
+msgid "I don't know how to edit this station"
+msgstr "No sᅵ como editar esta emisora"
+
+#: radiostation-config.cpp:68
+msgid "Frequency:"
+msgstr "Frecuencia:"
+
+#: radiostation-listview.cpp:33
+msgid "No."
+msgstr ""
+
+#: radiostation-listview.cpp:34
+msgid "Icon"
+msgstr ""
+
+#: radiostation-listview.cpp:35
+#, fuzzy
+msgid "Station"
+msgstr "Emisoras"
+
+#: pluginmanager-configuration-ui.ui:100 pluginmanager-configuration-ui.ui:240
+#: radiostation-listview.cpp:36
+#, no-c-format
+msgid "Description"
+msgstr ""
+
+#: radiostation-listview.cpp:234
+msgid "contentsDragEnterEvent accepted"
+msgstr ""
+
+#: radiostation-listview.cpp:236
+msgid "contentsDragEnterEvent rejected"
+msgstr ""
+
+#: standardscandialog.cpp:118
+msgid "new station "
+msgstr "nueva emisora"
+
+#: standardscandialog.cpp:142
+msgid "&Done"
+msgstr "&Hecho"
+
+#: standardscandialog.cpp:160
+#, fuzzy
+msgid "<p align=\"right\">%1</p>"
+msgstr "<p align=\"right\">nada aquᅵ</p>"
+
+#: station-drag-object.cpp:70
+msgid "canDecode = true"
+msgstr ""
+
+#: stationlist.cpp:255
+msgid "Contains merged Data"
+msgstr "Contiene datos fusionados "
+
+#: stationlist.cpp:315
+msgid ""
+"Probably an old station preset file was read.\n"
+"You have to rebuild your station selections for the quickbar and the docking "
+"menu."
+msgstr ""
+"Probablemente fue leido un archivo de configuracion de emisoras antiguo.\n"
+"Tiene que reconstruir su selecciï¿œn de emisoras para la barra de acceso "
+"rᅵpido y el menᅵ de empotrado."
+
+#: stationlist.cpp:325
+msgid "parsing failed"
+msgstr "fallᅵ el anᅵlisis sintᅵctico"
+
+#: stationlist.cpp:329
+msgid ""
+"Parsing the station preset file failed.\n"
+"See console output for more details."
+msgstr ""
+"Fallᅵ el anᅵlisis sintᅵctico del archivo de configuraciᅵn de "
+"emisoras.\n"
+"Observe la salida en la consola para mï¿œs detalles."
+
+#: stationlist.cpp:343 stationlist.cpp:349
+#, c-format
+msgid "error downloading preset file %1"
+msgstr "error al descargar el archivo de configuraciï¿œn %1"
+
+#: stationlist.cpp:345
+msgid "Download of the station preset file at %1 failed."
+msgstr "Fallᅵ la descarga del archivo de configuraciᅵn de emisoras en %1."
+
+#: stationlist.cpp:355
+msgid "temporary file: "
+msgstr "archivo temporal: "
+
+#: stationlist.cpp:361
+#, c-format
+msgid "error opening preset file %1"
+msgstr "error abriendo el archivo de configuraciï¿œn %1"
+
+#: stationlist.cpp:364
+msgid "Opening of the station preset file at %1 failed."
+msgstr "Fallᅵ la apertura del archivo de configuraciᅵn en %1."
+
+#: stationlist.cpp:383
+msgid "Old Preset File Format detected"
+msgstr "Detectado formato de archivo de configuraciï¿œn antiguo"
+
+#: stationlist.cpp:461
+#, c-format
+msgid "error writing to tempfile %1"
+msgstr "error al escribir al archivo temporal %1"
+
+#: stationlist.cpp:464
+msgid "Writing station preset file %1 failed."
+msgstr "Fallᅵ la escritura del archivo de configuraciᅵn de emisoras %1."
+
+#: stationlist.cpp:475
+#, fuzzy
+msgid "uploading preset file %1: "
+msgstr "Error al subir el archivo de configuraciï¿œn %1"
+
+#: stationlist.cpp:477
+msgid ""
+"something strange happend, station list has only %1 entries. Writing station "
+"preset file skipped"
+msgstr ""
+
+#: stationlist.cpp:482
+#, c-format
+msgid "error uploading preset file %1"
+msgstr "Error al subir el archivo de configuraciï¿œn %1"
+
+#: stationlist.cpp:486
+msgid "Upload of station preset file to %1 failed."
+msgstr "Fallᅵ la subida del archivo de configuraciᅵn de emisoras a %1."
+
+#: stationlistxmlhandler.cpp:116
+#, c-format
+msgid "unknown or unexpected element %1"
+msgstr "elemento %1 desconocido o inesperado"
+
+#: stationlistxmlhandler.cpp:145
+msgid "expected element %1, but found %2"
+msgstr "se esperaba el elemento %1, pero se encontrᅵ %2"
+
+#: stationlistxmlhandler.cpp:149
+#, c-format
+msgid "unexpected element %1"
+msgstr "elemento inesperado %1"
+
+#: stationlistxmlhandler.cpp:172
+#, c-format
+msgid "found a station list with unknown format %1"
+msgstr "encontrada una lista de emisoras con formato desconocido %1"
+
+#: stationlistxmlhandler.cpp:212
+msgid "unknown property %1 for class %2"
+msgstr "propiedad desconocida %1 para clase %2"
+
+#: stationlistxmlhandler.cpp:219
+#, c-format
+msgid "characters ignored for element %1"
+msgstr "caracteres ignorados para elemento %1"
+
+#: tderadioapp.cpp:44
+msgid ""
+"TDERadio - The Radio Application for TDE<P>With TDERadio you can listen to "
+"radio broadcasts with the help of your V4L/V4L2 compatible radio card.<P>The "
+"TDERadio Project contains a station preset data database. To complete this "
+"database you are encouraged to contribute your station preset file to the "
+"project. Just send it to one of the authors. <P>If you like to contribute "
+"your ideas, your own plugins or translations, don't hesitate to contact one "
+"of the authors.<P>"
+msgstr ""
+"TDERadio - La aplicaciï¿œn de radio para TDE<P>Con TDERadio puede escuchar "
+"retransmisiones de radio con la ayuda de su tarjeta de radio compatible con "
+"V4L/V4L2.<P>El proyecto TDERadio contiene una base de datos de "
+"configuraciones de emisoras. Para completar esta base de datos, le animamos "
+"a contribuir al proyecto con su configuraciï¿œn. Sï¿œlo envï¿œela a uno de "
+"los autores. <P>Si desea contribuir con sus ideas, sus propios plugins, o "
+"sus traducciones, no dude en contactar con uno de los autores.<P>"
+
+#: tderadioapp.cpp:66
+msgid ""
+"Preset Database, Remote Control Support, Alarms, Rewrite for TDERadio 0.3.0, "
+"Misc"
+msgstr ""
+"Base de datos de configuraciones, soporte de control remoto, alertas, "
+"reescritura para TDERadio 0.3.0, Miscelï¿œnea"
+
+#: tderadioapp.cpp:71
+msgid "Many People around the World ... "
+msgstr "Mucha gente alrededor del mundo ... "
+
+#: tderadioapp.cpp:72
+msgid ""
+"... which contributed station preset files \n"
+"and tested early and unstable snapshots of TDERadio \n"
+"with much patience"
+msgstr ""
+"... que ha contribuido con archivos de configuraciï¿œn de emisoras \n"
+"y ha testeado las primeras versiones inestables no oficiales de TDERadio \n"
+"con mucha paciencia"
+
+#: tderadioapp.cpp:106
+msgid "Library %1: Plugin Entry Point is missing\n"
+msgstr ""
+
+#: tderadioapp.cpp:108 tderadioapp.cpp:119
+msgid "Plugin Library Load Error"
+msgstr ""
+
+#: tderadioapp.cpp:116
+msgid ""
+"Library %1: \n"
+"%2"
+msgstr ""
+
+#: tderadioapp.cpp:143
+msgid "saveState"
+msgstr ""
+
+#: tderadioapp.cpp:221
+msgid "Instance"
+msgstr "Instancia"
+
+#: tderadioapp.cpp:242
+msgid "TDERadio Configuration"
+msgstr "Configuraciï¿œn de TDERadio"
+
+#: tderadioapp.cpp:243
+msgid "About TDERadio Components"
+msgstr "Acerca de los componentes de TDERadio"
+
+#: tderadioapp.cpp:271
+#, fuzzy
+msgid "Error: Loading Library %1 failed: %2"
+msgstr "error al leer %1: %2"
+
+#: tderadioapp.cpp:322
+msgid "Error: Creation of instance \"%1\" of class %2 falied."
+msgstr ""
+
+#: tderadioapp.cpp:328
+msgid "Error: Cannot create instance \"%1\" of unknown class %2."
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:16
+#, fuzzy, no-c-format
+msgid "PluginManagerConfigurationUI"
+msgstr "DockingConfigurationUI"
+
+#: pluginmanager-configuration-ui.ui:30
+#, no-c-format
+msgid "Show Progress Bar during Startup for Plugin Initiali&zation"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:33
+#, no-c-format
+msgid "Alt+Z"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:78 pluginmanager-configuration-ui.ui:229
+#, no-c-format
+msgid "Plugin Class"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:116
+#, no-c-format
+msgid "list of running plugins"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:153
+#, no-c-format
+msgid "remove/stop a selected plugin instance"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:223
+#, no-c-format
+msgid "create a new instance of selected plugin class"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:256
+#, no-c-format
+msgid "list of available plugin classes"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:297
+#, no-c-format
+msgid "select a plugin library"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:317
+#, no-c-format
+msgid "unload a plugin library"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:337
+#, no-c-format
+msgid "load a selected plugin library"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:353
+#, no-c-format
+msgid "list of loaded plugin libraries"
+msgstr ""
+
+#: standardscandialog-ui.ui:16
+#, no-c-format
+msgid "Stations search in progress ..."
+msgstr "Bï¿œsqueda de emisoras en progreso ..."
+
+#: standardscandialog-ui.ui:104
+#, no-c-format
+msgid "remaining time"
+msgstr "tiempo restante"
+
+#: standardscandialog-ui.ui:120
+#, no-c-format
+msgid "<p align=\"right\">nothing here</p>"
+msgstr "<p align=\"right\">nada aquᅵ</p>"
+
+#: stationselector-ui.ui:16
+#, no-c-format
+msgid "StationSelectorUI"
+msgstr "StationSelectorUI"
+
+#: stationselector-ui.ui:30
+#, no-c-format
+msgid "Selected Stations"
+msgstr "Emisoras seleccionadas"
+
+#: stationselector-ui.ui:119
+#, no-c-format
+msgid "Available Stations"
+msgstr "Emisoras disponibles"
+
+#~ msgid "misplaced element %1"
+#~ msgstr "elemento %1 mal colocado"
+
+#~ msgid "invalid data for element %1"
+#~ msgstr "datos no vï¿œlidos para elemento %1"
+
+#~ msgid "Display Colors"
+#~ msgstr "Colores de la pantalla"
+
+#~ msgid "Active Text"
+#~ msgstr "Texto activo"
+
+#~ msgid "Inactive Text"
+#~ msgstr "Texto inactivo"
+
+#~ msgid "Background Color"
+#~ msgstr "Color de fondo"
+
+#~ msgid "Docking Plugin"
+#~ msgstr "Plugin de icono empotrable"
+
+#~ msgid "Stop Recording"
+#~ msgstr "Detener grabaciï¿œn"
+
+#~ msgid "Start Recording"
+#~ msgstr "Iniciar grabaciï¿œn"
+
+#~ msgid "Docking Menu"
+#~ msgstr "Menᅵ de icono empotrable"
+
+#~ msgid "Docking Menu Configuration"
+#~ msgstr "Configuraciᅵn del menᅵ de icono empotrable"
+
+#~ msgid "Docking Menu for TDERadio"
+#~ msgstr "Menᅵ de icono empotrable de TDERadio"
+
+#~ msgid "Docking Menu Plugin"
+#~ msgstr "Plugin de menᅵ del icono empotrable"
+
+#~ msgid "Search Next Station"
+#~ msgstr "Buscar siguiente emisora"
+
+#~ msgid "Search Previous Station"
+#~ msgstr "Buscar anterior emisora"
+
+#~ msgid "next alarm: %1"
+#~ msgstr "siguiente alerta: %1"
+
+#~ msgid "<no alarm pending>"
+#~ msgstr "<no alarm pending>"
+
+#~ msgid "Stop Sleep Countdown (running until %1)"
+#~ msgstr "Detener cuenta atrï¿œs para dormir (corriendo hasta %1)"
+
+#~ msgid "Start Sleep Countdown"
+#~ msgstr "Iniciar cuenta atrï¿œs para dormir"
+
+#~ msgid "Power Off"
+#~ msgstr "Apagar"
+
+#~ msgid "Power On"
+#~ msgstr "Encender"
+
+#~ msgid "TDERadio Logger"
+#~ msgstr "Registro de TDERadio"
+
+#~ msgid "Save &as"
+#~ msgstr "Guardar &como"
+
+#~ msgid "Error Logger"
+#~ msgstr "Registro de errores"
+
+#~ msgid "logging started"
+#~ msgstr "registro iniciado"
+
+#~ msgid "Errors"
+#~ msgstr "Errores"
+
+#~ msgid "Debugging"
+#~ msgstr "Depuraciï¿œn"
+
+#~ msgid "Log Files"
+#~ msgstr "Archivos de registro"
+
+#~ msgid "Select Log File"
+#~ msgstr "Seleccionar archivo de registro"
+
+#~ msgid "Save TDERadio Logging Data as ..."
+#~ msgstr "Guardar datos de registro como ..."
+
+#~ msgid "Initializing tderadio lirc plugin failed"
+#~ msgstr "Fallᅵ la inicializaciᅵn del plugin lirc de tderadio"
+
+#~ msgid "Initializing tderadio lirc plugin successful"
+#~ msgstr "Inicializaciï¿œn del plugin lirc de tderadio correcta"
+
+#~ msgid "Linux Infrared Remote Control Support for TDERadio"
+#~ msgstr ""
+#~ "Linux Infrared Remote Control Support (soporte de control remoto por "
+#~ "infrarrojos para Linux) de TDERadio"
+
+#~ msgid "LIRC Support"
+#~ msgstr "Soporte LIRC"
+
+#~ msgid "Quickbar Plugin"
+#~ msgstr "Plugin de barra de acceso rï¿œpido"
+
+#~ msgid "Quickbar"
+#~ msgstr "Barra de acceso rï¿œpido"
+
+#~ msgid "Quickback for TDERadio"
+#~ msgstr "Barra de acceso rï¿œpido de TDERadio"
+
+#~ msgid "Images"
+#~ msgstr "Imï¿œgenes"
+
+#~ msgid "Pixmap Selection"
+#~ msgstr "Selecciï¿œn de mapa de pï¿œxels"
+
+#~ msgid "Select Station Pixmap"
+#~ msgstr "Seleccionar mapa de pï¿œxels de la estaciï¿œn"
+
+#~ msgid "TDERadio Preset Files"
+#~ msgstr "Archivos de configuraciï¿œn de emisoras de TDERadio"
+
+#~ msgid "Preset File Selection"
+#~ msgstr "Selecciï¿œn de archivos de configuraciï¿œn"
+
+#~ msgid "Select Preset File"
+#~ msgstr "Seleccionar archivo de configuraciï¿œn"
+
+#~ msgid "Store Preset File"
+#~ msgstr "Guardar archivo de configuraciï¿œn"
+
+#~ msgid "Radio Multiplexer Plugin"
+#~ msgstr "Plugin de multiplexado de radio"
+
+#~ msgid "Radio Stations"
+#~ msgstr "Emisoras de radio"
+
+#~ msgid "Setup Radio Stations"
+#~ msgstr "Configurar emisoras de radio"
+
+#~ msgid "Radio Device Multiplexer and Station Management for TDERadio"
+#~ msgstr ""
+#~ "Multiplexador de dispositivos de radio y administraciï¿œn de emisoras de "
+#~ "TDERadio"
+
+#~ msgid "Device and Station Management"
+#~ msgstr "Administraciï¿œn de dispositivos y emisoras"
+
+#~ msgid "Radio Device Multiplexer and Station Management"
+#~ msgstr ""
+#~ "Administraciï¿œn de emisoras y multiplexado de dispositivos de radio"
+
+#~ msgid "Radio Display"
+#~ msgstr "Pantalla de radio"
+
+#~ msgid "Start Recording and display Recording Monitor"
+#~ msgstr "Iniciar grabaciï¿œn y mostrar monitor de grabaciï¿œn"
+
+#~ msgid "Start Monitoring"
+#~ msgstr "Iniciar monitorizaciï¿œn"
+
+#~ msgid "Configure TDERadio"
+#~ msgstr "Configurar TDERadio"
+
+#~ msgid "Power On/Off"
+#~ msgstr "Encender/Apagar"
+
+#~ msgid "Quit TDERadio Application"
+#~ msgstr "Salir de TDERadio"
+
+#~ msgid "Start/Stop Recording"
+#~ msgstr "Iniciar/detener grabaciï¿œn"
+
+#~ msgid "Start/Stop Sleep Countdown"
+#~ msgstr "Iniciar cuenta atrï¿œs para dormir"
+
+#~ msgid "Select a Radio Station"
+#~ msgstr "Seleccionar una emisora de radio"
+
+#~ msgid "no preset defined"
+#~ msgstr "ninguna configuraciï¿œn definida"
+
+#~ msgid "Display"
+#~ msgstr "Pantalla"
+
+#~ msgid "Display Configuration"
+#~ msgstr "Configuraciï¿œn de la pantalla"
+
+#~ msgid "set Toolbar-Flag for Display"
+#~ msgstr "activar el indicador de barra de herramientas para la pantalla"
+
+#~ msgid "Common"
+#~ msgstr "Comï¿œn"
+
+#~ msgid "Standard Radio Display for TDERadio"
+#~ msgstr "Pantalla estï¿œndar de radio para TDERadio"
+
+#~ msgid "Frequency Display"
+#~ msgstr "Pantalla de la frecuencia"
+
+#~ msgid "AM"
+#~ msgstr "AM"
+
+#~ msgid "FM"
+#~ msgstr "FM"
+
+#~ msgid "Search for previous Radio Station"
+#~ msgstr "Buscar emisora de radio anterior"
+
+#~ msgid "Search for next Radio Station"
+#~ msgstr "Buscar siguiente emisora de radio"
+
+#~ msgid "Decrement Frequency"
+#~ msgstr "Decrementar frecuencia"
+
+#~ msgid "Increment Frequency"
+#~ msgstr "Incrementar frecuencia"
+
+#~ msgid "Change Frequency"
+#~ msgstr "Cambiar frecuencia"
+
+#~ msgid "Change Volume"
+#~ msgstr "Cambiar volumen"
+
+#~ msgid "C&ustom"
+#~ msgstr "&Personalizado"
+
+#~ msgid "RadioConfigurationUI"
+#~ msgstr "RadioConfigurationUI"
+
+#~ msgid "Station &Presets"
+#~ msgstr "&Configuraciones de emisoras"
+
+#~ msgid "&Search Stations"
+#~ msgstr "&Buscar emisoras"
+
+#~ msgid "Load"
+#~ msgstr "Cargar"
+
+#~ msgid "Name"
+#~ msgstr "Nombre"
+
+#~ msgid "Short Name"
+#~ msgstr "Nombre corto"
+
+#~ msgid "Pixmap File"
+#~ msgstr "Archivo de mapa de pï¿œxels"
+
+#~ msgid " %"
+#~ msgstr " %"
+
+#~ msgid "Volume Preset"
+#~ msgstr "Volumen predefinido"
+
+#~ msgid "Personal Preset File"
+#~ msgstr "Archivo de configuraciï¿œn personal"
+
+#~ msgid "City"
+#~ msgstr "Ciudad"
+
+#~ msgid "Country"
+#~ msgstr "Paï¿œs"
+
+#~ msgid "&Now"
+#~ msgstr "&Ahora"
+
+#~ msgid "Comment"
+#~ msgstr "Comentario"
+
+#~ msgid "Media"
+#~ msgstr "Medio"
+
+#~ msgid "Maintainer"
+#~ msgstr "Responsable del mantenimiento"
+
+#~ msgid "Last Change"
+#~ msgstr "ï¿œltimo cambio"
+
+#~ msgid ""
+#~ "<p align=\"center\">Click on the link below to contribute this station "
+#~ "preset file to the tderadio project.</p>"
+#~ msgstr ""
+#~ "<p align=\"center\">Pulse en el enlace de abajo para contribuir con este "
+#~ "archivo de configuraciï¿œn de emisoras al proyecto TDERadio.</p>"
+
+#~ msgid "RadioView_SeekInterface"
+#~ msgstr "RadioView_SeekInterface"
+
+#~ msgid "search previous station"
+#~ msgstr "Buscar anterior emisora"
+
+#~ msgid "decrease freq. by 0.05 MHz"
+#~ msgstr "decrementar frecuencia en 0.05 Mhz"
+
+#~ msgid "Frequency control"
+#~ msgstr "Control de frecuencia"
+
+#~ msgid "increase freq. by 0.05 MHz"
+#~ msgstr "incrementar frecuencia en 0.05 Mhz"
+
+#~ msgid "search next station"
+#~ msgstr "buscar siguiente emisora"
+
+#, fuzzy
+#~ msgid "RecordingConfigurationUI"
+#~ msgstr "RecordingConfigurationUI"
+
+#~ msgid "Buffer Management"
+#~ msgstr "Administraciï¿œn del bï¿œfer"
+
+#~ msgid " kB"
+#~ msgstr " kb"
+
+#~ msgid "Encoding Buffer Size"
+#~ msgstr "Tamaï¿œo del bï¿œfer de codificaciï¿œn"
+
+#~ msgid "Number of Buffers"
+#~ msgstr "Nï¿œmero de bï¿œfers"
+
+#~ msgid "Output"
+#~ msgstr "Salida"
+
+#~ msgid "Recording Directory"
+#~ msgstr "Directorio de grabaciï¿œn"
+
+#~ msgid "MP3 Quality(0 - high, 1 - low)"
+#~ msgstr "Calidad del MP3 (0 - alta, 1 - baja)"
+
+#~ msgid "File Format"
+#~ msgstr "Formato de archivo"
+
+#~ msgid "Microsoft Wave (.wav)"
+#~ msgstr "Microsoft Wave (.wav)"
+
+#~ msgid "Apple/SGI (.aiff)"
+#~ msgstr "Apple/SGI (.aiff)"
+
+#~ msgid "Sun/NeXT (.au)"
+#~ msgstr "Sun/NeXT (.au)"
+
+#~ msgid "raw pcm output (.raw)"
+#~ msgstr "salida pcm en crudo (.raw)"
+
+#~ msgid "MP3 Compressed (.mp3)"
+#~ msgstr "MP3 comprimido (.mp3)"
+
+#~ msgid "Input"
+#~ msgstr "Entrada"
+
+#~ msgid "/dev/dsp"
+#~ msgstr "/dev/dsp"
+
+#~ msgid "Sample Bits"
+#~ msgstr "Bits de sampleado"
+
+#~ msgid "Signed"
+#~ msgstr "Con signo"
+
+#~ msgid "Unsigned"
+#~ msgstr "Sin signo"
+
+#~ msgid "16"
+#~ msgstr "16"
+
+#~ msgid "8"
+#~ msgstr "8"
+
+#~ msgid "Recording Device"
+#~ msgstr "Dispositivo de grabaciï¿œn"
+
+#~ msgid "Endianess"
+#~ msgstr "Posiciï¿œn del byte mï¿œs significativo"
+
+#~ msgid "Channels"
+#~ msgstr "Canales"
+
+#~ msgid "44100"
+#~ msgstr "44100"
+
+#~ msgid "22050"
+#~ msgstr "22050"
+
+#~ msgid "11025"
+#~ msgstr "11025"
+
+#~ msgid "Little Endian"
+#~ msgstr "Little endian ( byte menos significativo primero)"
+
+#~ msgid "Big Endian"
+#~ msgstr "Big endian (byte mï¿œs significativo primero)"
+
+#~ msgid "Sample Rate"
+#~ msgstr "Frecuencia de muestreo"
+
+#~ msgid "Stereo"
+#~ msgstr "Estï¿œreo"
+
+#~ msgid "Mono"
+#~ msgstr "Mono"
+
+#~ msgid "TimeControlConfigurationUI"
+#~ msgstr "TimeControlConfigurationUI"
+
+#~ msgid "sleep countdown"
+#~ msgstr "cuenta atrï¿œs para dormir"
+
+#~ msgid " min"
+#~ msgstr " min"
+
+#~ msgid "Alarms"
+#~ msgstr "Alertas"
+
+#~ msgid "Date"
+#~ msgstr "Fecha"
+
+#~ msgid "Time"
+#~ msgstr "Hora"
+
+#~ msgid "Volume"
+#~ msgstr "Volumen"
+
+#~ msgid "enabled"
+#~ msgstr "activado"
+
+#~ msgid "daily"
+#~ msgstr "diario"
+
+#~ msgid "Radio Station"
+#~ msgstr "Emisora de radio"
+
+#~ msgid "Stop Playing"
+#~ msgstr "Detener reproducciï¿œn"
+
+#~ msgid "SetupDialogGeneral"
+#~ msgstr "SetupDialogGeneral"
+
+#~ msgid "Devices"
+#~ msgstr "Dispositivos"
+
+#~ msgid "unknown v4l device"
+#~ msgstr "dispositivo v4l desconocido"
+
+#~ msgid "Mixer Channel"
+#~ msgstr "Canal mezclador"
+
+#~ msgid "Mixer Device"
+#~ msgstr "Dispositivo mezclador"
+
+#~ msgid "Radio Device"
+#~ msgstr "Dispositivo de radio"
+
+#~ msgid "to"
+#~ msgstr "a"
+
+#~ msgid "minimum signal quality"
+#~ msgstr "calidad mï¿œnima de seï¿œal"
+
+#~ msgid "station scan step"
+#~ msgstr "Paso mï¿œnimo al buscar emisoras"
+
+#~ msgid "allowed frequency range"
+#~ msgstr "Rango de frecuencias permitidas"
+
+#~ msgid "V4L Device Controls"
+#~ msgstr "Controles del dispositivo V4L"
+
+#~ msgid "volume"
+#~ msgstr "volumen"
+
+#~ msgid "treble"
+#~ msgstr "agudos"
+
+#~ msgid "bass"
+#~ msgstr "bajos"
+
+#~ msgid "balance"
+#~ msgstr "balance"
+
+#~ msgid "Recording Monitor"
+#~ msgstr "Monitor de grabaciï¿œn"
+
+#~ msgid "Status"
+#~ msgstr "Estado"
+
+#~ msgid "<undefined>"
+#~ msgstr "<undefined>"
+
+#~ msgid "Recording File"
+#~ msgstr "Archivo de grabaciï¿œn"
+
+#~ msgid "File Size"
+#~ msgstr "Tamaï¿œo del archivo"
+
+#~ msgid "Recording Time"
+#~ msgstr "Tiempo de grabaciï¿œn"
+
+#~ msgid "Hide/Show when recording stops/starts"
+#~ msgstr "Esconder/Iniciar cuando la grabaciï¿œn se detiene/inicia"
+
+#~ msgid "Monitor Input"
+#~ msgstr "Monitorizar entrada"
+
+#~ msgid "Recording Monitor Plugin for TDERadio"
+#~ msgstr "Plugin de monitor de grabaciï¿œn para TDERadio"
+
+#~ msgid "Recording Monitor Plugin"
+#~ msgstr "Plugin de monitor de grabaciï¿œn"
+
+#~ msgid "&Stop"
+#~ msgstr "&Detener"
+
+#~ msgid "not running"
+#~ msgstr "no estᅵ ejecutᅵndose"
+
+#~ msgid "recording"
+#~ msgstr "grabando"
+
+#~ msgid "monitoring"
+#~ msgstr "monitorizando"
+
+#~ msgid "error occurred"
+#~ msgstr "ocurriᅵ un error"
+
+#~ msgid "finished"
+#~ msgstr "finalizado"
+
+#~ msgid "TDERadio Recording Plugin"
+#~ msgstr "Plugin de grabaciï¿œn de TDERadio"
+
+#~ msgid "Recording"
+#~ msgstr "Grabaciï¿œn"
+
+#~ msgid "Recording Monitor for TDERadio"
+#~ msgstr "Monitor de grabaciï¿œn de TDERadio"
+
+#~ msgid "Recording starting"
+#~ msgstr "Iniciando grabaciï¿œn"
+
+#~ msgid "Recording stopped with error"
+#~ msgstr "Grabaciï¿œn detenida con error"
+
+#~ msgid "Monitoring starting"
+#~ msgstr "Iniciando monitorizaciï¿œn"
+
+#~ msgid "Monitoring stopped with error"
+#~ msgstr "Monitorizaciï¿œn detenida con error"
+
+#~ msgid "Recording stopped"
+#~ msgstr "Grabaciï¿œn detenida"
+
+#~ msgid "Monitoring stopped"
+#~ msgstr "Monitorizaciï¿œn detenida"
+
+#~ msgid "Cannot open DSP device %1"
+#~ msgstr "No se puede abrir dispositivo DSP %1"
+
+#~ msgid "Cannot set sample format for recording"
+#~ msgstr "No se puede fijar el formato de muestreo para la grabaciï¿œn"
+
+#~ msgid "Cannot set number of channels for recording"
+#~ msgstr "No se puede fijar el nï¿œmero de canales para grabaciï¿œn"
+
+#~ msgid "Cannot set sampling rate for recording"
+#~ msgstr "No se puede fijar la frecuencia de muestreo para la grabaciï¿œn"
+
+#~ msgid "Asking for recording at %1 Hz but hardware uses %2 Hz"
+#~ msgstr "Intentando grabar a %1 Hz pero el hardware utiliza %2 Hz"
+
+#~ msgid "Cannot set stereo mode for recording"
+#~ msgstr "No se puede fijar el formato estï¿œreo para la grabaciï¿œn"
+
+#~ msgid "Cannot set sample size for recording"
+#~ msgstr "No se puede fijar el tamaï¿œo de muestreo para la grabaciï¿œn"
+
+#~ msgid "Cannot set recording buffers"
+#~ msgstr "No se pueden establecer los bï¿œfers de grabaciï¿œn"
+
+#~ msgid "Cannot read recording buffer size"
+#~ msgstr "No se puede leer el tamaï¿œo del bï¿œfer de grabaciï¿œn"
+
+#~ msgid "Hardware uses buffer blocks of %1 bytes"
+#~ msgstr "El hardware utiliza blï¿œques de bï¿œfer de %1 bytes"
+
+#~ msgid "Recording::outputFile: "
+#~ msgstr "Recording::outputFile: "
+
+#~ msgid "The encoding thread did not finish. It will be killed now."
+#~ msgstr ""
+#~ "El hilo de ejecuciᅵn de la codificaciᅵn no finalizᅵ. Serᅵ matado "
+#~ "ahora."
+
+#~ msgid "Waiting for encoding thread to terminate."
+#~ msgstr ""
+#~ "Esperando a que el hilo de ejecuciï¿œn de la codificaciï¿œn finalice."
+
+#~ msgid "Input buffer overflow. Skipped %1 input bytes"
+#~ msgstr "Desbordamiento del bï¿œfer de entrada. Saltados %1 bytes de entrada"
+
+#~ msgid "No data to record"
+#~ msgstr "No hay datos para grabar"
+
+#~ msgid "Error %1 while recording"
+#~ msgstr "Error %1 durante la grabaciï¿œn"
+
+#~ msgid "Error %1 writing output. "
+#~ msgstr "Error %1 al escribir la salida. "
+
+#~ msgid "Error %1 while encoding mp3. "
+#~ msgstr "Error %1 durante la codificaciï¿œn del mp3"
+
+#~ msgid "Cannot initialize lalibmp3lame. "
+#~ msgstr "No se puede inicializar lalibmp3lame. "
+
+#~ msgid "Cannot initialize libmp3lame parameters. "
+#~ msgstr "No se pueden inicializar los parï¿œmetros de libmp3lame. "
+
+#~ msgid "Recorded by TDERadio"
+#~ msgstr "Grabado por TDERadio"
+
+#~ msgid "Cannot allocate buffers for mp3 encoding. "
+#~ msgstr "No se pueden asignar los bï¿œfers para la codificaciï¿œn del mp3. "
+
+#~ msgid "<don't change>"
+#~ msgstr "<don't change>"
+
+#~ msgid "TimeControl Plugin"
+#~ msgstr "Plugin de control de tiempo"
+
+#~ msgid "Setup Alarms"
+#~ msgstr "Configurar alertas"
+
+#~ msgid ""
+#~ "Time Control Plugin for TDERadio.<P>Provides Alarms and Sleep Countdown<P>"
+#~ msgstr ""
+#~ "Plugin de control de tiempo de TDERadio.<P>Provee alertas y cuenta "
+#~ "atrï¿œs para dormir<P>"
+
+#~ msgid "Time Control Plugin"
+#~ msgstr "Plugin de control de tiempo"
+
+#~ msgid "any ( * )"
+#~ msgstr "cualquiera ( * )"
+
+#~ msgid "Radio Device Selection"
+#~ msgstr "Selecciï¿œn del dispositivo de radio"
+
+#~ msgid "Select Radio Device"
+#~ msgstr "Seleccionar dispositivo de radio"
+
+#~ msgid "Mixer Device Selection"
+#~ msgstr "Selecciï¿œn del dispositivo mezclador"
+
+#~ msgid "Select Mixer Device"
+#~ msgstr "Seleccionar dispositivo mezclador"
+
+#~ msgid "Video For Linux Plugin"
+#~ msgstr "Plugin de Video For Linux"
+
+#~ msgid "error %1 while setting volume to %2"
+#~ msgstr "error %1 al fijar el volumen en %2"
+
+#~ msgid "error %1 while reading volume"
+#~ msgstr "error %1 al leer el volumen"
+
+#~ msgid "invalid frequency %1"
+#~ msgstr "frecuencia no vï¿œlida %1"
+
+#~ msgid "don't known how to handle V4L-version %1"
+#~ msgstr "no se sabe como manejar V4L versiï¿œn %1"
+
+#~ msgid "error setting frequency to %1 (%2)"
+#~ msgstr "error al fijar la frecuencia en %1 (%2)"
+
+#~ msgid ""
+#~ "Selecting V4L radio input as recording source failed with error code %1"
+#~ msgstr ""
+#~ "Fallᅵ la selecciᅵn de la entrada de radio de V4L como fuente de "
+#~ "grabaciï¿œn con cï¿œdigo de error %1"
+
+#~ msgid "Reading igain volume failed with error code %1"
+#~ msgstr "Fallᅵ la lectura del volumen igain con cᅵdigo de error %1"
+
+#~ msgid "Setting igain volume failed with error code %1"
+#~ msgstr "Fallᅵ la escritura del volumen igain con cᅵdigo de error %1"
+
+#~ msgid "V4L Radio Options"
+#~ msgstr "Opciones de radio V4L"
+
+#~ msgid ""
+#~ "V4L/V4L2 Plugin for TDERadio.<P>Provides Support for V4L/V4L2 based Radio "
+#~ "Cards<P>"
+#~ msgstr ""
+#~ "V4L/V4L2 plugin de TDERadio.<P>Provee Soporte para tarjetas de radio "
+#~ "basadas en V4L/V4L2<P>"
+
+#~ msgid "V4L/V4L2"
+#~ msgstr "V4L/V4L2"
+
+#~ msgid "V4L/V4L2 Plugin"
+#~ msgstr "Plugin V4L/V4L2"
+
+#~ msgid "Cannot open mixer device %1"
+#~ msgstr "No se peude abrir el dispositivo mezclador %1"
+
+#~ msgid "Cannot open radio device %1"
+#~ msgstr "No se puede abrir el dispositivo de radio %1"
+
+#~ msgid "cannot open %1"
+#~ msgstr "no se puede abrir %1"
+
+#~ msgid "audio caps = %1"
+#~ msgstr "capacidades de audio = %1"
+
+#~ msgid "error reading V4L1 caps"
+#~ msgstr "error al leer las capacidades de V4L1"
+
+#~ msgid "V4L2: Querying mute control failed"
+#~ msgstr "V4L2: Fallᅵ el acceso al control de silenciado"
+
+#~ msgid "V4L2: Querying volume control failed"
+#~ msgstr "V4L2: Fallᅵ el acceso al control de volumen"
+
+#~ msgid "V4L2: Querying treble control failed"
+#~ msgstr "V4L2: Fallᅵ el acceso al control de agudos"
+
+#~ msgid "V4L2: Querying bass control failed"
+#~ msgstr "V4L2: Fallᅵ el acceso al control de bajos"
+
+#~ msgid "V4L2: Querying balance control failed"
+#~ msgstr "V4L2: Fallᅵ el acceso al control de balanceo"
+
+#~ msgid "V4LRadio::readV4LCaps: Reading V4L2 caps failed"
+#~ msgstr ""
+#~ "V4LRadio::readV4LCaps: Fallᅵ la lectura de las capacidades de V4L2"
+
+#~ msgid "V4L %1 detected"
+#~ msgstr "Detectado V4L %1"
+
+#~ msgid "V4L not detected"
+#~ msgstr "V4L no detectado"
+
+#~ msgid "Radio is mutable"
+#~ msgstr "La radio es silenciable"
+
+#~ msgid "Radio is not mutable"
+#~ msgstr "La radio no es silenciable"
+
+#~ msgid "Radio has Volume Control"
+#~ msgstr "La radio tiene control de volumen"
+
+#~ msgid "Radio has no Volume Control"
+#~ msgstr "La radio no tiene control de volumen"
+
+#~ msgid "Radio has Bass Control"
+#~ msgstr "La radio tiene control de bajos"
+
+#~ msgid "Radio has no Bass Control"
+#~ msgstr "La radio no tiene control de bajos"
+
+#~ msgid "Radio has Treble Control"
+#~ msgstr "La radio tiene control de agudos"
+
+#~ msgid "Radio has no Treble Control"
+#~ msgstr "La radio no tiene control de agudos"
+
+#~ msgid "cannot get tuner info (error %1)"
+#~ msgstr "no se puede obtener informaciï¿œn del sintonizador (error %1)"
+
+#~ msgid "error setting %1: %2"
+#~ msgstr "error al fijar %1: %2"
+
+#~ msgid "error updating radio audio info (%1): %2"
+#~ msgstr "error al actualizar la informaciï¿œn de audio de la radio (%1): %2"
+
+#~ msgid "write"
+#~ msgstr "escribir"
+
+#~ msgid "read"
+#~ msgstr "leer"
diff --git a/src/po/pl.po b/src/po/pl.po
new file mode 100644
index 0000000..31ac424
--- /dev/null
+++ b/src/po/pl.po
@@ -0,0 +1,1261 @@
+# translation of pl.po to
+# translation of pl.po to
+# translation of pl.po to
+# translation of pl.po to
+# translation of pl.po to
+# translation of pl.po to
+# translation of tderadio.po to
+# This file is distributed under the same license as the PACKAGE package.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER, 2003, 2004.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: pl\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2021-07-07 18:28+0000\n"
+"PO-Revision-Date: 2004-01-05 13:29+0000\n"
+"Last-Translator: \n"
+"Language-Team: <pl@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.3\n"
+
+#. Instead of a literal translation, add your name to the end of the list (separated by a comma).
+msgid ""
+"_: NAME OF TRANSLATORS\n"
+"Your names"
+msgstr ""
+
+#. Instead of a literal translation, add your email to the end of the list (separated by a comma).
+msgid ""
+"_: EMAIL OF TRANSLATORS\n"
+"Your emails"
+msgstr ""
+
+#: aboutwidget.cpp:282
+#, fuzzy
+msgid "Invalid layout"
+msgstr "Nieprawidłowa stacja"
+
+#: aboutwidget.cpp:451
+msgid "%1 %2 (Using TDE %3)"
+msgstr "%1 %2 (Wersja TDE %3)"
+
+#: aboutwidget.cpp:454
+msgid "%1 %2, %3"
+msgstr "%1 %2 %3"
+
+#: aboutwidget.cpp:527
+msgid "A&uthor"
+msgstr "A&utor"
+
+#: aboutwidget.cpp:527
+msgid "A&uthors"
+msgstr "A&utorzy"
+
+#: aboutwidget.cpp:541
+msgid "&Thanks To"
+msgstr "P&odziękowania dla"
+
+#: aboutwidget.cpp:554
+msgid "T&ranslation"
+msgstr "&Tłumaczenie"
+
+#: aboutwidget.cpp:571
+msgid "&License Agreement"
+msgstr "Umowa &licencyjne"
+
+#: aboutwidget.cpp:585
+msgid "Image missing"
+msgstr "Brak obrazka"
+
+#: errorlog-interfaces.cpp:43 errorlog-interfaces.cpp:78
+msgid "%1 Error: %2\n"
+msgstr ""
+
+#: errorlog-interfaces.cpp:52 errorlog-interfaces.cpp:87
+#, fuzzy
+msgid "%1 Warning: %2\n"
+msgstr "Ostrzeżenia"
+
+#: errorlog-interfaces.cpp:61 errorlog-interfaces.cpp:96
+#, fuzzy
+msgid "%1 Information: %2\n"
+msgstr "Informacje"
+
+#: errorlog-interfaces.cpp:70 errorlog-interfaces.cpp:105
+msgid "%1 Debug: %2\n"
+msgstr ""
+
+#: fileringbuffer.cpp:35 fileringbuffer.cpp:68
+#, fuzzy, c-format
+msgid "cannot open buffer file %1"
+msgstr "NIe można otworzyć pliku %1"
+
+#: fileringbuffer.cpp:93
+msgid "FileRingbuffer::resize: Writing to tmpfile %1 failed. "
+msgstr ""
+
+#: fileringbuffer.cpp:99
+msgid "FileRingbuffer::resize: Opening tmpfile %1 failed. "
+msgstr ""
+
+#: fileringbuffer.cpp:127 fileringbuffer.cpp:145
+#, c-format
+msgid "FileRingBuffer::addData: failed writing data to file %1."
+msgstr ""
+
+#: fileringbuffer.cpp:168
+#, c-format
+msgid "FileRingBuffer::takeData: failed reading data to file %1."
+msgstr ""
+
+#: frequencyradiostation.cpp:120 internetradiostation.cpp:118
+#, fuzzy
+msgid "%1, %2"
+msgstr "%1 %2 %3"
+
+#: frequencyradiostation.cpp:134
+#, fuzzy
+msgid "%1 MHz"
+msgstr " kHz"
+
+#: frequencyradiostation.cpp:136
+#, fuzzy
+msgid "%1 kHz"
+msgstr " kHz"
+
+#: include/radiostation.h:150 include/radiostation.h:151
+#: standardscandialog.cpp:162 standardscandialog.cpp:165
+msgid "unknown"
+msgstr "nieznany"
+
+#: main.cpp:36
+msgid "TDERadio"
+msgstr "TDERadio"
+
+#: main.cpp:42
+msgid "rewrite for 0.3.0, recording, lirc support, alarms, misc"
+msgstr "przepisanie wersji 0.3.0, nagrywanie, obsługa lirc, alarmy, różne"
+
+#: main.cpp:43 tderadioapp.cpp:67
+msgid "Buildsystem, Standards Conformance, Cleanups"
+msgstr ""
+
+#: main.cpp:45 tderadioapp.cpp:69
+msgid "idea, first basic application"
+msgstr "Pomysł, pierwsza wersja aplikacji"
+
+#: multibuffer.cpp:89
+msgid "Buffer Overflow. "
+msgstr ""
+
+#: plugin_configuration_dialog.cpp:29
+msgid "Configuration Dialog"
+msgstr "Okno Konfiguracji"
+
+#: pluginmanager-configuration.cpp:143
+msgid "Enter Plugin Instance Name"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:89 pluginmanager-configuration.cpp:144
+#, no-c-format
+msgid "Instance Name"
+msgstr ""
+
+#: pluginmanager.cpp:123
+#, c-format
+msgid "Hide %1"
+msgstr "Ukryj: %1"
+
+#: pluginmanager.cpp:123
+#, c-format
+msgid "Show %1"
+msgstr "Pokaż: %1"
+
+#: pluginmanager.cpp:350
+#, fuzzy
+msgid "Plugins"
+msgstr "Wtyczka LIRC"
+
+#: pluginmanager.cpp:351
+#, fuzzy
+msgid "Plugin Library Configuration"
+msgstr "Konfiguracja paska skrótów"
+
+#: pluginmanager.cpp:446
+#, fuzzy
+msgid "Starting Plugins"
+msgstr "Rozpocznij odtwarzanie"
+
+#: pluginmanager.cpp:459 pluginmanager.cpp:476
+#, fuzzy, c-format
+msgid "Creating Plugin %1"
+msgstr "Wtyczka nagrywania"
+
+#: pluginmanager.cpp:490
+#, fuzzy, c-format
+msgid "Initializing Plugin %1"
+msgstr "Inicjalizacja wtyczki LIRC"
+
+#: radiostation-config.cpp:45
+msgid "I don't know how to edit this station"
+msgstr "Nie można edytować tej stacji"
+
+#: radiostation-config.cpp:68
+msgid "Frequency:"
+msgstr "Częstotliwość"
+
+#: radiostation-listview.cpp:33
+msgid "No."
+msgstr ""
+
+#: radiostation-listview.cpp:34
+msgid "Icon"
+msgstr ""
+
+#: radiostation-listview.cpp:35
+#, fuzzy
+msgid "Station"
+msgstr "Stacje"
+
+#: pluginmanager-configuration-ui.ui:100 pluginmanager-configuration-ui.ui:240
+#: radiostation-listview.cpp:36
+#, no-c-format
+msgid "Description"
+msgstr ""
+
+#: radiostation-listview.cpp:234
+msgid "contentsDragEnterEvent accepted"
+msgstr ""
+
+#: radiostation-listview.cpp:236
+msgid "contentsDragEnterEvent rejected"
+msgstr ""
+
+#: standardscandialog.cpp:118
+msgid "new station "
+msgstr "Nowa stacja"
+
+#: standardscandialog.cpp:142
+msgid "&Done"
+msgstr "&Gotowe"
+
+#: standardscandialog.cpp:160
+#, fuzzy
+msgid "<p align=\"right\">%1</p>"
+msgstr "<p align=\"right\">nic</p>"
+
+#: station-drag-object.cpp:70
+msgid "canDecode = true"
+msgstr ""
+
+#: stationlist.cpp:255
+msgid "Contains merged Data"
+msgstr ""
+
+#: stationlist.cpp:315
+msgid ""
+"Probably an old station preset file was read.\n"
+"You have to rebuild your station selections for the quickbar and the docking "
+"menu."
+msgstr "do."
+
+#: stationlist.cpp:325
+msgid "parsing failed"
+msgstr "Błąd odczytu"
+
+#: stationlist.cpp:329
+msgid ""
+"Parsing the station preset file failed.\n"
+"See console output for more details."
+msgstr ""
+"Błąd odczytu pliku zaprogramowanych stacji By dowiedzieć się więcej "
+"obejrzyj komunikaty na konsoli"
+
+#: stationlist.cpp:343 stationlist.cpp:349
+#, c-format
+msgid "error downloading preset file %1"
+msgstr "błąd"
+
+#: stationlist.cpp:345
+msgid "Download of the station preset file at %1 failed."
+msgstr "nieudane."
+
+#: stationlist.cpp:355
+msgid "temporary file: "
+msgstr "plik tymczasowy"
+
+#: stationlist.cpp:361
+#, c-format
+msgid "error opening preset file %1"
+msgstr "błąd"
+
+#: stationlist.cpp:364
+msgid "Opening of the station preset file at %1 failed."
+msgstr "nieudane."
+
+#: stationlist.cpp:383
+msgid "Old Preset File Format detected"
+msgstr "Wykryto stary format pliku zapamiętanych stacji"
+
+#: stationlist.cpp:461
+#, c-format
+msgid "error writing to tempfile %1"
+msgstr "błąd do"
+
+#: stationlist.cpp:464
+msgid "Writing station preset file %1 failed."
+msgstr "nieudane."
+
+#: stationlist.cpp:475
+#, fuzzy
+msgid "uploading preset file %1: "
+msgstr "Błąd podczas wysyłania pliku zapamiętanych stacji: %1"
+
+#: stationlist.cpp:477
+msgid ""
+"something strange happend, station list has only %1 entries. Writing station "
+"preset file skipped"
+msgstr ""
+
+#: stationlist.cpp:482
+#, c-format
+msgid "error uploading preset file %1"
+msgstr "Błąd podczas wysyłania pliku zapamiętanych stacji: %1"
+
+#: stationlist.cpp:486
+msgid "Upload of station preset file to %1 failed."
+msgstr "Wysyłanie pliku zapamiętanych stacji do: %1 nieudane."
+
+#: stationlistxmlhandler.cpp:116
+#, c-format
+msgid "unknown or unexpected element %1"
+msgstr "nieznany"
+
+#: stationlistxmlhandler.cpp:145
+msgid "expected element %1, but found %2"
+msgstr "oczekiwano %1; znaleziono %2"
+
+#: stationlistxmlhandler.cpp:149
+#, c-format
+msgid "unexpected element %1"
+msgstr "nieoczekiwany element: %1"
+
+#: stationlistxmlhandler.cpp:172
+#, c-format
+msgid "found a station list with unknown format %1"
+msgstr "nieznany"
+
+#: stationlistxmlhandler.cpp:212
+msgid "unknown property %1 for class %2"
+msgstr "nieznany"
+
+#: stationlistxmlhandler.cpp:219
+#, c-format
+msgid "characters ignored for element %1"
+msgstr ""
+
+#: tderadioapp.cpp:44
+msgid ""
+"TDERadio - The Radio Application for TDE<P>With TDERadio you can listen to "
+"radio broadcasts with the help of your V4L/V4L2 compatible radio card.<P>The "
+"TDERadio Project contains a station preset data database. To complete this "
+"database you are encouraged to contribute your station preset file to the "
+"project. Just send it to one of the authors. <P>If you like to contribute "
+"your ideas, your own plugins or translations, don't hesitate to contact one "
+"of the authors.<P>"
+msgstr ""
+"TDERadio - Aplikacja do obsługi radia pod TDE<P>TDERadio służy do słuchania "
+"radia z wykorzystaniem karty radiowej kompatybilnej ze standardem V4L/V4L2. "
+"<P> Projekt TDERadio zawiera bazę danych stacji radiowych. Aby uzupełnić tę "
+"bazę potrzebna jest pomoc użytkowników - zachęcamy więc do stworzenia listy "
+"stacji, które można odbierać w twojej okolicy i przesłanie jej do autorów "
+"TDERadio. <P> Jeśli chcielibyście podzielić się swoimi pomysłami, wtyczkami "
+"czy tłumaczeniami skontaktujcie się koniecznie z którymś a autorów. <P>. "
+
+#: tderadioapp.cpp:66
+msgid ""
+"Preset Database, Remote Control Support, Alarms, Rewrite for TDERadio 0.3.0, "
+"Misc"
+msgstr "Baza Danych Stacjie, Obługa zdalnego sterowania, Alarmy, "
+
+#: tderadioapp.cpp:71
+msgid "Many People around the World ... "
+msgstr "Wielu osób w różnych częściach świata..."
+
+#: tderadioapp.cpp:72
+msgid ""
+"... which contributed station preset files \n"
+"and tested early and unstable snapshots of TDERadio \n"
+"with much patience"
+msgstr ""
+"które przesyłały zestawy zapamiętanych stacji \n"
+" i cierpliwe testowały wczesne i niestabilne \n"
+"wersje TDERadio"
+
+#: tderadioapp.cpp:106
+msgid "Library %1: Plugin Entry Point is missing\n"
+msgstr ""
+
+#: tderadioapp.cpp:108 tderadioapp.cpp:119
+msgid "Plugin Library Load Error"
+msgstr ""
+
+#: tderadioapp.cpp:116
+msgid ""
+"Library %1: \n"
+"%2"
+msgstr ""
+
+#: tderadioapp.cpp:143
+msgid "saveState"
+msgstr ""
+
+#: tderadioapp.cpp:221
+msgid "Instance"
+msgstr ""
+
+#: tderadioapp.cpp:242
+msgid "TDERadio Configuration"
+msgstr "Konfiguracja: TDERadio"
+
+#: tderadioapp.cpp:243
+msgid "About TDERadio Components"
+msgstr "O składnikach TDERadio"
+
+#: tderadioapp.cpp:271
+#, fuzzy
+msgid "Error: Loading Library %1 failed: %2"
+msgstr "błąd"
+
+#: tderadioapp.cpp:322
+msgid "Error: Creation of instance \"%1\" of class %2 falied."
+msgstr ""
+
+#: tderadioapp.cpp:328
+msgid "Error: Cannot create instance \"%1\" of unknown class %2."
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:16
+#, fuzzy, no-c-format
+msgid "PluginManagerConfigurationUI"
+msgstr "Konfiguracja dokowalnego menu"
+
+#: pluginmanager-configuration-ui.ui:30
+#, no-c-format
+msgid "Show Progress Bar during Startup for Plugin Initiali&zation"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:33
+#, no-c-format
+msgid "Alt+Z"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:78 pluginmanager-configuration-ui.ui:229
+#, no-c-format
+msgid "Plugin Class"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:116
+#, no-c-format
+msgid "list of running plugins"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:153
+#, no-c-format
+msgid "remove/stop a selected plugin instance"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:223
+#, no-c-format
+msgid "create a new instance of selected plugin class"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:256
+#, no-c-format
+msgid "list of available plugin classes"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:297
+#, no-c-format
+msgid "select a plugin library"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:317
+#, no-c-format
+msgid "unload a plugin library"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:337
+#, no-c-format
+msgid "load a selected plugin library"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:353
+#, no-c-format
+msgid "list of loaded plugin libraries"
+msgstr ""
+
+#: standardscandialog-ui.ui:16
+#, no-c-format
+msgid "Stations search in progress ..."
+msgstr "Trwa poszukiwanie stacji..."
+
+#: standardscandialog-ui.ui:104
+#, no-c-format
+msgid "remaining time"
+msgstr "Pozostały czas"
+
+#: standardscandialog-ui.ui:120
+#, no-c-format
+msgid "<p align=\"right\">nothing here</p>"
+msgstr "<p align=\"right\">nic</p>"
+
+#: stationselector-ui.ui:16
+#, no-c-format
+msgid "StationSelectorUI"
+msgstr ""
+
+#: stationselector-ui.ui:30
+#, no-c-format
+msgid "Selected Stations"
+msgstr "Wybrane stacje"
+
+#: stationselector-ui.ui:119
+#, no-c-format
+msgid "Available Stations"
+msgstr "Dostępne stacje"
+
+#~ msgid "&About"
+#~ msgstr "O progr&amie..."
+
+#~ msgid "Miscellaneous"
+#~ msgstr "Różne"
+
+#~ msgid "&Cancel"
+#~ msgstr "&Anuluj"
+
+#~ msgid "Display Colors"
+#~ msgstr "Kolory wyświetlacza"
+
+#~ msgid "Active Text"
+#~ msgstr "Kolor aktywnego tekstu"
+
+#~ msgid "Inactive Text"
+#~ msgstr "Kolor nieaktywnego tekstu"
+
+#~ msgid "Background Color"
+#~ msgstr "Kolor tła"
+
+#~ msgid "Docking Plugin"
+#~ msgstr "Wtyczka dokowania"
+
+#~ msgid "Stop Recording"
+#~ msgstr "Zakończ nagrywanie"
+
+#~ msgid "Start Recording"
+#~ msgstr "Rozpocznij nagrywanie"
+
+#~ msgid "Docking Menu"
+#~ msgstr "Menu dokowalne"
+
+#~ msgid "Docking Menu Configuration"
+#~ msgstr "Konfiguracja dokowalnego menu"
+
+#~ msgid "Docking Menu for TDERadio"
+#~ msgstr "Menu dokowalne TDERadio"
+
+#~ msgid "Docking Menu Plugin"
+#~ msgstr "Wtyczka menu dokowalnego"
+
+#~ msgid "Search Next Station"
+#~ msgstr "Szukaj następnej stacji"
+
+#~ msgid "Search Previous Station"
+#~ msgstr "Szukaj poprzedniej stacji"
+
+#~ msgid "next alarm: %1"
+#~ msgstr "następny alarm:"
+
+#~ msgid "<no alarm pending>"
+#~ msgstr "<brak ustawionych alarmów>"
+
+#~ msgid "Stop Sleep Countdown (running until %1)"
+#~ msgstr "Zatrzymaj usypianie (ustawione na %1)"
+
+#~ msgid "Start Sleep Countdown"
+#~ msgstr "Rozpocznij usypianie"
+
+#~ msgid "Power Off"
+#~ msgstr "Wyłącz"
+
+#~ msgid "Power On"
+#~ msgstr "Włącz"
+
+#~ msgid "TDERadio Logger"
+#~ msgstr "Dziennik Kradio"
+
+#~ msgid "Save &as"
+#~ msgstr "Zapisz j&ako"
+
+#~ msgid "Error Logger"
+#~ msgstr "Dziennik błędów"
+
+#~ msgid "logging started"
+#~ msgstr "Zapisywanie rozpoczęte"
+
+#~ msgid "Errors"
+#~ msgstr "Błędy"
+
+#~ msgid "Debugging"
+#~ msgstr "Debugowanie"
+
+#~ msgid "Log Files"
+#~ msgstr "Pliki dziennika"
+
+#~ msgid "Select Log File"
+#~ msgstr "Wybierz plik dziennika"
+
+#~ msgid "Save TDERadio Logging Data as ..."
+#~ msgstr "Zapisz dziennik TDERadio jako..."
+
+#~ msgid "Initializing tderadio lirc plugin failed"
+#~ msgstr "Inicjalizacja wtyczki LIRC nieudana"
+
+#~ msgid "Initializing tderadio lirc plugin successful"
+#~ msgstr "Inicjalizacja wtyczki LIRC udana"
+
+#~ msgid "Linux Infrared Remote Control Support for TDERadio"
+#~ msgstr "Obsługa LIRC (Linux Infrared Remote Control) dla TDERadio"
+
+#~ msgid "LIRC Support"
+#~ msgstr "Obsługa LIRC"
+
+#~ msgid "Quickbar Plugin"
+#~ msgstr "Wtyczka paska skrótów"
+
+#~ msgid "Quickbar"
+#~ msgstr "Pasek skrótów"
+
+#~ msgid "Quickback for TDERadio"
+#~ msgstr "Pasek skrótów TDERadio"
+
+#~ msgid "Images"
+#~ msgstr "Obrazy"
+
+#~ msgid "Pixmap Selection"
+#~ msgstr "Wybór logo"
+
+#~ msgid "Select Station Pixmap"
+#~ msgstr "Wybierz logo stacji"
+
+#~ msgid "TDERadio Preset Files"
+#~ msgstr "Pliki zapamiętanych stacji Kradio"
+
+#~ msgid "Preset File Selection"
+#~ msgstr "Wybór pliku zapamiętanych stacji"
+
+#~ msgid "Select Preset File"
+#~ msgstr "Wybierz plik zapamiętanych stacji"
+
+#~ msgid "Store Preset File"
+#~ msgstr "Zapamiętaj plik stacji"
+
+#~ msgid "Radio Multiplexer Plugin"
+#~ msgstr "Wtyczka Mulipleksera Radia"
+
+#~ msgid "Radio Stations"
+#~ msgstr "Stacje"
+
+#~ msgid "Setup Radio Stations"
+#~ msgstr "Stacje"
+
+#~ msgid "Radio Device Multiplexer and Station Management for TDERadio"
+#~ msgstr "Multiplekser urządzenia radia i zarządzanie stacjami dla TDERadio"
+
+#~ msgid "Device and Station Management"
+#~ msgstr "Urządzenia i zarządzanie stacjami"
+
+#~ msgid "Radio Device Multiplexer and Station Management"
+#~ msgstr "Multiplekser urządzenia radia i zarządzanie stacjami"
+
+#~ msgid "Radio Display"
+#~ msgstr "Okno radia"
+
+#~ msgid "Start Recording and display Recording Monitor"
+#~ msgstr "Rozpocznij nagrywanie i pokaż monitor"
+
+#~ msgid "Start Monitoring"
+#~ msgstr "Rozpocznij monitorowanie"
+
+#~ msgid "Configure TDERadio"
+#~ msgstr "Konfiguruj: TDERadio"
+
+#~ msgid "Power On/Off"
+#~ msgstr "Włącz/Wyłącz"
+
+#~ msgid "Quit TDERadio Application"
+#~ msgstr "Zakończ TDERadio"
+
+#~ msgid "Start/Stop Recording"
+#~ msgstr "Rozpocznij/Zakończ nagrywanie"
+
+#, fuzzy
+#~ msgid "Start/Stop Sleep Countdown"
+#~ msgstr "Rozpocznij usypianie"
+
+#~ msgid "Select a Radio Station"
+#~ msgstr "Wybierz stację"
+
+#~ msgid "no preset defined"
+#~ msgstr "nie zdefiniowano ustawień"
+
+#~ msgid "Display"
+#~ msgstr "Wyświetlacz"
+
+#~ msgid "Display Configuration"
+#~ msgstr "Konfiguracja wyświetlacza"
+
+#~ msgid "Standard Radio Display for TDERadio"
+#~ msgstr "Standardowy wyświetlacz dla TDERadio"
+
+#~ msgid "Frequency Display"
+#~ msgstr "Wyświetlacz częstotliwości"
+
+#~ msgid "AM"
+#~ msgstr "AM"
+
+#~ msgid "FM"
+#~ msgstr "FM"
+
+#~ msgid "Search for previous Radio Station"
+#~ msgstr "Szukaj poprzedniej stacji radiowej"
+
+#~ msgid "Search for next Radio Station"
+#~ msgstr "Szukaj następnej stacji radiowej"
+
+#~ msgid "Decrement Frequency"
+#~ msgstr "Zmniejsz częstotliwość"
+
+#~ msgid "Increment Frequency"
+#~ msgstr "Zwiększ częstotliwość"
+
+#~ msgid "Change Frequency"
+#~ msgstr "Zmień częstotliwość"
+
+#~ msgid "Change Volume"
+#~ msgstr "Zmiana głośności"
+
+#~ msgid "Station &Presets"
+#~ msgstr "Za&pamiętane stacje"
+
+#~ msgid "&Search Stations"
+#~ msgstr "&Szukaj stacji"
+
+#~ msgid "Load"
+#~ msgstr "Otwórz"
+
+#~ msgid "Name"
+#~ msgstr "Nazwa"
+
+#~ msgid "Short Name"
+#~ msgstr "Krótka nazwa"
+
+#~ msgid "Pixmap File"
+#~ msgstr "Logo stacji"
+
+#~ msgid " %"
+#~ msgstr " %"
+
+#, fuzzy
+#~ msgid "Volume Preset"
+#~ msgstr "Głośność"
+
+#, fuzzy
+#~ msgid "Personal Preset File"
+#~ msgstr "Wybierz plik zapamiętanych stacji"
+
+#~ msgid "City"
+#~ msgstr "Miasto"
+
+#~ msgid "Country"
+#~ msgstr "Kraj"
+
+#~ msgid "&Now"
+#~ msgstr "&Teraz"
+
+#~ msgid "Comment"
+#~ msgstr "Komentarz"
+
+#~ msgid "Media"
+#~ msgstr "Media"
+
+#~ msgid "Maintainer"
+#~ msgstr "Opiekun"
+
+#~ msgid "Last Change"
+#~ msgstr "Ostatnia zmiana"
+
+#~ msgid ""
+#~ "<p align=\"center\">Click on the link below to contribute this station "
+#~ "preset file to the tderadio project.</p>"
+#~ msgstr ""
+#~ "<p align=\"center\">Kliknij poniżej żeby dołączyć listę stacji do bazy "
+#~ "projektu.TDERadio</p>"
+
+#, fuzzy
+#~ msgid "search previous station"
+#~ msgstr "Szukaj poprzedniej stacji"
+
+#, fuzzy
+#~ msgid "Frequency control"
+#~ msgstr "Częstotliwość"
+
+#, fuzzy
+#~ msgid "search next station"
+#~ msgstr "Szukaj następnej stacji"
+
+#, fuzzy
+#~ msgid "Encoding Buffer Size"
+#~ msgstr "Nie można odczytać wielkości bufora nagrywania"
+
+#~ msgid "Output"
+#~ msgstr "Wyjście"
+
+#~ msgid "Recording Directory"
+#~ msgstr "Katalog zapisywania"
+
+#~ msgid "File Format"
+#~ msgstr "Format pliku"
+
+#~ msgid "Microsoft Wave (.wav)"
+#~ msgstr "Microsoft Wave (.wav)"
+
+#~ msgid "Apple/SGI (.aiff)"
+#~ msgstr "Apple/SGI (.aiff)"
+
+#~ msgid "Sun/NeXT (.au)"
+#~ msgstr "Sun/NeXT (.au)"
+
+#~ msgid "Input"
+#~ msgstr "Wejście"
+
+#~ msgid "/dev/dsp"
+#~ msgstr "/dev/dsp"
+
+#~ msgid "Sample Bits"
+#~ msgstr "Próbkowanie"
+
+#~ msgid "16"
+#~ msgstr "16"
+
+#~ msgid "8"
+#~ msgstr "7"
+
+#~ msgid "Recording Device"
+#~ msgstr "Urządzenie nagrywające"
+
+#~ msgid "Endianess"
+#~ msgstr "Kolejność bajtów"
+
+#~ msgid "Channels"
+#~ msgstr "Kanały"
+
+#~ msgid "44100"
+#~ msgstr "44100"
+
+#~ msgid "22050"
+#~ msgstr "22050"
+
+#~ msgid "11025"
+#~ msgstr "11025"
+
+#~ msgid "Little Endian"
+#~ msgstr "Little Endian"
+
+#~ msgid "Big Endian"
+#~ msgstr "Big Endian"
+
+#~ msgid "Sample Rate"
+#~ msgstr "Częstotliwość próbkowania"
+
+#~ msgid "Stereo"
+#~ msgstr "Stereo"
+
+#~ msgid "Mono"
+#~ msgstr "Mono"
+
+#~ msgid "sleep countdown"
+#~ msgstr "Czas uśpienia"
+
+#~ msgid " min"
+#~ msgstr "min"
+
+#~ msgid "Alarms"
+#~ msgstr "Alarmy"
+
+#~ msgid "Date"
+#~ msgstr "Data"
+
+#~ msgid "Time"
+#~ msgstr "Czas"
+
+#~ msgid "Volume"
+#~ msgstr "Głośność"
+
+#~ msgid "enabled"
+#~ msgstr "Aktywny"
+
+#~ msgid "daily"
+#~ msgstr "Codziennie"
+
+#~ msgid "Radio Station"
+#~ msgstr "Stacja radiowa"
+
+#~ msgid "Stop Playing"
+#~ msgstr "Zakończ odtwarzanie"
+
+#~ msgid "Devices"
+#~ msgstr "Urządzenia"
+
+#~ msgid "unknown v4l device"
+#~ msgstr "Nieznane urządzenie V4L"
+
+#~ msgid "Mixer Channel"
+#~ msgstr "Kanał miksera"
+
+#~ msgid "Mixer Device"
+#~ msgstr "Urządzenie miksera"
+
+#~ msgid "Radio Device"
+#~ msgstr "Urządzenie radia"
+
+#~ msgid "to"
+#~ msgstr "do"
+
+#~ msgid "minimum signal quality"
+#~ msgstr "Minimalna jakość sygnału"
+
+#~ msgid "station scan step"
+#~ msgstr "Skok podczas skanowania"
+
+#~ msgid "allowed frequency range"
+#~ msgstr "Dopuszczalny zakres częstotliwości"
+
+#~ msgid "V4L Device Controls"
+#~ msgstr "Ustawienie urządzenia V4L"
+
+#, fuzzy
+#~ msgid "volume"
+#~ msgstr "Głośność"
+
+#, fuzzy
+#~ msgid "treble"
+#~ msgstr "Aktywny"
+
+#~ msgid "Recording Monitor"
+#~ msgstr "Monitor nagrywania"
+
+#~ msgid "Status"
+#~ msgstr "Status"
+
+#~ msgid "<undefined>"
+#~ msgstr "<niezdefiniowane>"
+
+#~ msgid "Recording File"
+#~ msgstr "Nazwa pliku"
+
+#~ msgid "File Size"
+#~ msgstr "Rozmiar pliku"
+
+#~ msgid "Recording Time"
+#~ msgstr "Czas nagrywania"
+
+#~ msgid "Hide/Show when recording stops/starts"
+#~ msgstr "Pokaż/Ukryj kiedy nagrywanie rozpoczyna/kończy się"
+
+#~ msgid "Monitor Input"
+#~ msgstr "Monitoruj poziom sygnału"
+
+#~ msgid "Recording Monitor Plugin for TDERadio"
+#~ msgstr "Wtyczka monitorowania nagrywania dla TDERadio"
+
+#~ msgid "Recording Monitor Plugin"
+#~ msgstr "Wtyczka monitorowania nagrywania"
+
+#~ msgid "&Stop"
+#~ msgstr "&Stop"
+
+#~ msgid "recording"
+#~ msgstr "nagrywanie"
+
+#~ msgid "monitoring"
+#~ msgstr "monitorowanie"
+
+#~ msgid "error occurred"
+#~ msgstr "wystąpił błąd"
+
+#~ msgid "finished"
+#~ msgstr "zakończone"
+
+#, fuzzy
+#~ msgid "TDERadio Recording Plugin"
+#~ msgstr "Wtyczka nagrywania"
+
+#~ msgid "Recording"
+#~ msgstr "Nagrywanie"
+
+#~ msgid "Recording Monitor for TDERadio"
+#~ msgstr "Monitor nagrywania dla TDERadio"
+
+#~ msgid "Recording starting"
+#~ msgstr "Nagrywanie rozpoczęte"
+
+#~ msgid "Recording stopped with error"
+#~ msgstr "Nagrywanie zakończone z błędem"
+
+#~ msgid "Monitoring starting"
+#~ msgstr "Monitorowanie rozpoczęte"
+
+#~ msgid "Monitoring stopped with error"
+#~ msgstr "Monitorowanie zakończone z błędem"
+
+#~ msgid "Recording stopped"
+#~ msgstr "Nagrywanie zatrzymane"
+
+#~ msgid "Monitoring stopped"
+#~ msgstr "Monitorowanie zatrzymane"
+
+#~ msgid "Cannot open DSP device %1"
+#~ msgstr "Nie można otworzyć urządzenia DSP"
+
+#~ msgid "Cannot set sample format for recording"
+#~ msgstr "Nie można ustawić formatu dla nagrywania"
+
+#~ msgid "Cannot set number of channels for recording"
+#~ msgstr "Nie można ustawić liczby kanałów dla nagywania"
+
+#~ msgid "Cannot set sampling rate for recording"
+#~ msgstr "Nie można ustawić częstotliwości próbkowania dla nagrywania"
+
+#, fuzzy
+#~ msgid "Cannot set stereo mode for recording"
+#~ msgstr "Nie można ustawić formatu dla nagrywania"
+
+#, fuzzy
+#~ msgid "Cannot set sample size for recording"
+#~ msgstr "Nie można ustawić formatu dla nagrywania"
+
+#, fuzzy
+#~ msgid "Cannot set recording buffers"
+#~ msgstr "Nie można odczytać wielkości bufora nagrywania"
+
+#~ msgid "Cannot read recording buffer size"
+#~ msgstr "Nie można odczytać wielkości bufora nagrywania"
+
+#~ msgid "Recording::outputFile: "
+#~ msgstr "Nagrywanie::outputFile: "
+
+#~ msgid "No data to record"
+#~ msgstr "Brak danych do nagrania"
+
+#~ msgid "Error %1 while recording"
+#~ msgstr "Błąd %1 podczas nagrywania"
+
+#, fuzzy
+#~ msgid "Error %1 writing output. "
+#~ msgstr "Błąd %1 podczas zapisu pliku"
+
+#, fuzzy
+#~ msgid "Error %1 while encoding mp3. "
+#~ msgstr "Błąd %1 podczas nagrywania"
+
+#, fuzzy
+#~ msgid "Recorded by TDERadio"
+#~ msgstr "Monitor nagrywania dla TDERadio"
+
+#, fuzzy
+#~ msgid "Cannot allocate buffers for mp3 encoding. "
+#~ msgstr "Nie można ustawić formatu dla nagrywania"
+
+#~ msgid "<don't change>"
+#~ msgstr "<nie zmieniać>"
+
+#~ msgid "TimeControl Plugin"
+#~ msgstr "Wtyczka kontroli czasu"
+
+#~ msgid "Setup Alarms"
+#~ msgstr "Ustawienia alarmów"
+
+#~ msgid ""
+#~ "Time Control Plugin for TDERadio.<P>Provides Alarms and Sleep Countdown<P>"
+#~ msgstr ""
+#~ "Wtyczka kontroli czasu dla TDERadio <P> Umożliwia obsługę alarmów i "
+#~ "usypiania<P>"
+
+#~ msgid "Time Control Plugin"
+#~ msgstr "Wtyczka kontroli czasu"
+
+#~ msgid "any ( * )"
+#~ msgstr "dowolny"
+
+#~ msgid "Radio Device Selection"
+#~ msgstr "Wybór urządzenia radia"
+
+#~ msgid "Select Radio Device"
+#~ msgstr "Wybierz urządzenie radia"
+
+#~ msgid "Mixer Device Selection"
+#~ msgstr "Wybór urządzenia miksera"
+
+#~ msgid "Select Mixer Device"
+#~ msgstr "Wybierz urządzenie miksera"
+
+#~ msgid "Video For Linux Plugin"
+#~ msgstr "Wtyczka Video for Linux"
+
+#~ msgid "error %1 while setting volume to %2"
+#~ msgstr "błąd: %1 podczas ustawiania głośności na: %2"
+
+#~ msgid "error %1 while reading volume"
+#~ msgstr "błąd %1 podczas odczytu głośności"
+
+#~ msgid "invalid frequency %1"
+#~ msgstr "nieprawidłowa częstotliwość %1"
+
+#~ msgid "don't known how to handle V4L-version %1"
+#~ msgstr "do"
+
+#~ msgid "error setting frequency to %1 (%2)"
+#~ msgstr "błąd do"
+
+#~ msgid ""
+#~ "Selecting V4L radio input as recording source failed with error code %1"
+#~ msgstr "nieudane błąd"
+
+#~ msgid "Reading igain volume failed with error code %1"
+#~ msgstr "nieudane błąd"
+
+#~ msgid "Setting igain volume failed with error code %1"
+#~ msgstr "nieudane błąd"
+
+#~ msgid "V4L Radio Options"
+#~ msgstr "Opcje radia V4L"
+
+#~ msgid ""
+#~ "V4L/V4L2 Plugin for TDERadio.<P>Provides Support for V4L/V4L2 based Radio "
+#~ "Cards<P>"
+#~ msgstr ""
+#~ "Wtyczka V4L/V4L2 dla TDERadio. <p>Umożliwia obsługę kart radiowych "
+#~ "zgodnych z V4L/V4L2<p>"
+
+#~ msgid "V4L/V4L2"
+#~ msgstr "V4L/V4LV2"
+
+#~ msgid "V4L/V4L2 Plugin"
+#~ msgstr "Wtyczka V4L/V4L2"
+
+#~ msgid "Cannot open mixer device %1"
+#~ msgstr "Nie można otworzyć urządzenia miksera: %1"
+
+#~ msgid "Cannot open radio device %1"
+#~ msgstr "Nie można otworzyć urządzenia radia: %1"
+
+#~ msgid "cannot open %1"
+#~ msgstr "nie można otworzyć %1"
+
+#~ msgid "error reading V4L1 caps"
+#~ msgstr "błąd"
+
+#~ msgid "V4L2: Querying mute control failed"
+#~ msgstr "nieudane"
+
+#~ msgid "V4L2: Querying volume control failed"
+#~ msgstr "nieudane"
+
+#~ msgid "V4L2: Querying treble control failed"
+#~ msgstr "nieudane"
+
+#~ msgid "V4L2: Querying bass control failed"
+#~ msgstr "nieudane"
+
+#~ msgid "V4L2: Querying balance control failed"
+#~ msgstr "nieudane"
+
+#~ msgid "V4LRadio::readV4LCaps: Reading V4L2 caps failed"
+#~ msgstr "nieudane"
+
+#~ msgid "V4L %1 detected"
+#~ msgstr "Wykryto V4l %1"
+
+#~ msgid "V4L not detected"
+#~ msgstr "Nie wykryto V4L"
+
+#~ msgid "Radio is mutable"
+#~ msgstr "Radio jest wyciszalne"
+
+#~ msgid "Radio is not mutable"
+#~ msgstr "Radio nie jest wyciszalne"
+
+#~ msgid "Radio has Volume Control"
+#~ msgstr "Radio ma regulację głośności"
+
+#~ msgid "Radio has no Volume Control"
+#~ msgstr "Radio nie ma regulacji głośności"
+
+#~ msgid "Radio has Bass Control"
+#~ msgstr "Radio ma regulację basu"
+
+#~ msgid "Radio has no Bass Control"
+#~ msgstr "Radio nie ma regulacji basu"
+
+#~ msgid "Radio has Treble Control"
+#~ msgstr "Radio ma regulację sopranu"
+
+#~ msgid "Radio has no Treble Control"
+#~ msgstr "Radio nie ma regulacji sopranu"
+
+#~ msgid "cannot get tuner info (error %1)"
+#~ msgstr "błąd"
+
+#~ msgid "error setting %1: %2"
+#~ msgstr "błąd"
+
+#~ msgid "error updating radio audio info (%1): %2"
+#~ msgstr "błąd"
+
+#~ msgid "&Quit"
+#~ msgstr "Za&kończ"
+
+#~ msgid "Save As"
+#~ msgstr "Zapisz jako"
+
+#~ msgid "Volume Preset (-1 = disabled)"
+#~ msgstr "Ustawienie głośności (-1=wyłączone)"
+
+#~ msgid "A&bout"
+#~ msgstr "&O..."
+
+#~ msgid "<p align=\"center\">volume</p>"
+#~ msgstr "<p align=\"center\">głośność</p>"
+
+#~ msgid "<p align=\"center\">treble</p>"
+#~ msgstr "<p align=\"center\">tony wysokie</p>"
+
+#~ msgid "<p align=\"center\">bass</p>"
+#~ msgstr "<p align=\"center\">tony niskie</p>"
+
+#~ msgid "<p align=\"center\">balance</p>"
+#~ msgstr "<p align=\"center\">balans</p>"
+
+#~ msgid "Options"
+#~ msgstr "Opcje"
+
+#~ msgid "&Close"
+#~ msgstr "&Zamknij"
+
+#~ msgid "&Start"
+#~ msgstr "&Start"
diff --git a/src/po/ru.po b/src/po/ru.po
new file mode 100644
index 0000000..3428c1b
--- /dev/null
+++ b/src/po/ru.po
@@ -0,0 +1,530 @@
+# translation of tderadio.po to
+# This file is put in the public domain.
+# Алексей Кузнецов <Alexey.Kouznetsov@GMail.com>, 2006.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: tderadio\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2021-07-07 18:28+0000\n"
+"PO-Revision-Date: 2020-01-03 16:07+0000\n"
+"Last-Translator: Serg Bormant <bormant@mail.ru>\n"
+"Language-Team: Russian <https://mirror.git.trinitydesktop.org/weblate/"
+"projects/applications/tderadio/ru/>\n"
+"Language: ru\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
+"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
+"X-Generator: Weblate 3.10\n"
+
+#. Instead of a literal translation, add your name to the end of the list (separated by a comma).
+msgid ""
+"_: NAME OF TRANSLATORS\n"
+"Your names"
+msgstr "Алексей Кузнецов"
+
+#. Instead of a literal translation, add your email to the end of the list (separated by a comma).
+msgid ""
+"_: EMAIL OF TRANSLATORS\n"
+"Your emails"
+msgstr "Alexey.Kouznetsov@GMail.com"
+
+#: aboutwidget.cpp:282
+msgid "Invalid layout"
+msgstr "Неверное расположение"
+
+#: aboutwidget.cpp:451
+msgid "%1 %2 (Using TDE %3)"
+msgstr "%1 %2 (в составе TDE %3)"
+
+#: aboutwidget.cpp:454
+msgid "%1 %2, %3"
+msgstr "%1 %2, %3"
+
+#: aboutwidget.cpp:527
+msgid "A&uthor"
+msgstr "&Автор"
+
+#: aboutwidget.cpp:527
+msgid "A&uthors"
+msgstr "&Авторы"
+
+#: aboutwidget.cpp:541
+msgid "&Thanks To"
+msgstr "&Благодарности"
+
+#: aboutwidget.cpp:554
+msgid "T&ranslation"
+msgstr "&Перевод"
+
+#: aboutwidget.cpp:571
+msgid "&License Agreement"
+msgstr "&Лицензионное соглашение"
+
+#: aboutwidget.cpp:585
+msgid "Image missing"
+msgstr "Изображение недоступно"
+
+#: errorlog-interfaces.cpp:43 errorlog-interfaces.cpp:78
+msgid "%1 Error: %2\n"
+msgstr "Ошибка %1: %2\n"
+
+#: errorlog-interfaces.cpp:52 errorlog-interfaces.cpp:87
+msgid "%1 Warning: %2\n"
+msgstr "Предупреждение %1: %2\n"
+
+#: errorlog-interfaces.cpp:61 errorlog-interfaces.cpp:96
+msgid "%1 Information: %2\n"
+msgstr "Сообщение от %1: %2\n"
+
+#: errorlog-interfaces.cpp:70 errorlog-interfaces.cpp:105
+msgid "%1 Debug: %2\n"
+msgstr "Отладочное сообщение %1: %2\n"
+
+#: fileringbuffer.cpp:35 fileringbuffer.cpp:68
+#, c-format
+msgid "cannot open buffer file %1"
+msgstr "Не могу открыть буферный файл %1"
+
+#: fileringbuffer.cpp:93
+msgid "FileRingbuffer::resize: Writing to tmpfile %1 failed. "
+msgstr "FileRingbuffer::resize: Не могу записать временный файл %1. "
+
+#: fileringbuffer.cpp:99
+msgid "FileRingbuffer::resize: Opening tmpfile %1 failed. "
+msgstr "FileRingbuffer::resize: Не могу открыть ременный файл %1. "
+
+#: fileringbuffer.cpp:127 fileringbuffer.cpp:145
+#, c-format
+msgid "FileRingBuffer::addData: failed writing data to file %1."
+msgstr "FileRingBuffer::addData: Не могу записать данные в файл %1."
+
+#: fileringbuffer.cpp:168
+#, c-format
+msgid "FileRingBuffer::takeData: failed reading data to file %1."
+msgstr ""
+
+#: frequencyradiostation.cpp:120 internetradiostation.cpp:118
+msgid "%1, %2"
+msgstr "%1, %2"
+
+#: frequencyradiostation.cpp:134
+msgid "%1 MHz"
+msgstr "%1 МГц"
+
+#: frequencyradiostation.cpp:136
+msgid "%1 kHz"
+msgstr "%1 кГц"
+
+#: include/radiostation.h:150 include/radiostation.h:151
+#: standardscandialog.cpp:162 standardscandialog.cpp:165
+msgid "unknown"
+msgstr "неизвестно"
+
+#: main.cpp:36
+msgid "TDERadio"
+msgstr "Радиоприёмник TDE"
+
+#: main.cpp:42
+msgid "rewrite for 0.3.0, recording, lirc support, alarms, misc"
+msgstr "Написание версии 0.3.0, запись, поддержка LIRC, расписание, разное"
+
+#: main.cpp:43 tderadioapp.cpp:67
+msgid "Buildsystem, Standards Conformance, Cleanups"
+msgstr "Система сборки, стандартизация, чистка кода"
+
+#: main.cpp:45 tderadioapp.cpp:69
+msgid "idea, first basic application"
+msgstr "Идея, первый вариант программы"
+
+#: multibuffer.cpp:89
+msgid "Buffer Overflow. "
+msgstr "Переполнение буфера. "
+
+#: plugin_configuration_dialog.cpp:29
+msgid "Configuration Dialog"
+msgstr "Окно параметров"
+
+#: pluginmanager-configuration.cpp:143
+msgid "Enter Plugin Instance Name"
+msgstr "Введите название для этого экземпляра"
+
+#: pluginmanager-configuration-ui.ui:89 pluginmanager-configuration.cpp:144
+#, no-c-format
+msgid "Instance Name"
+msgstr "Экземпляр"
+
+#: pluginmanager.cpp:123
+#, c-format
+msgid "Hide %1"
+msgstr "Скрыть \"%1\""
+
+#: pluginmanager.cpp:123
+#, c-format
+msgid "Show %1"
+msgstr "Показать \"%1\""
+
+#: pluginmanager.cpp:350
+msgid "Plugins"
+msgstr ""
+"Модули\n"
+"программы"
+
+#: pluginmanager.cpp:351
+msgid "Plugin Library Configuration"
+msgstr "Настройка библиотечных модулей"
+
+#: pluginmanager.cpp:446
+msgid "Starting Plugins"
+msgstr "Запуск модулей"
+
+#: pluginmanager.cpp:459 pluginmanager.cpp:476
+#, c-format
+msgid "Creating Plugin %1"
+msgstr "Создаю модуль %1"
+
+#: pluginmanager.cpp:490
+#, c-format
+msgid "Initializing Plugin %1"
+msgstr "Включаю модуль %1"
+
+#: radiostation-config.cpp:45
+msgid "I don't know how to edit this station"
+msgstr "Не знаю, как редактировать эту станцию"
+
+#: radiostation-config.cpp:68
+msgid "Frequency:"
+msgstr "Частота, кГц:"
+
+#: radiostation-listview.cpp:33
+msgid "No."
+msgstr "No "
+
+#: radiostation-listview.cpp:34
+msgid "Icon"
+msgstr "Значок"
+
+#: radiostation-listview.cpp:35
+msgid "Station"
+msgstr "Название"
+
+#: pluginmanager-configuration-ui.ui:100 pluginmanager-configuration-ui.ui:240
+#: radiostation-listview.cpp:36
+#, no-c-format
+msgid "Description"
+msgstr "Описание"
+
+#: radiostation-listview.cpp:234
+msgid "contentsDragEnterEvent accepted"
+msgstr "contentsDragEnterEvent "
+
+#: radiostation-listview.cpp:236
+msgid "contentsDragEnterEvent rejected"
+msgstr "contentsDragEnterEvent rejected"
+
+#: standardscandialog.cpp:118
+msgid "new station "
+msgstr "Новая станция"
+
+#: standardscandialog.cpp:142
+msgid "&Done"
+msgstr "&Готово"
+
+#: standardscandialog.cpp:160
+msgid "<p align=\"right\">%1</p>"
+msgstr "<p align=\"right\">%1</p>"
+
+#: station-drag-object.cpp:70
+msgid "canDecode = true"
+msgstr "canDecode = true"
+
+#: stationlist.cpp:255
+msgid "Contains merged Data"
+msgstr "Содержит объединённые данные"
+
+#: stationlist.cpp:315
+msgid ""
+"Probably an old station preset file was read.\n"
+"You have to rebuild your station selections for the quickbar and the docking "
+"menu."
+msgstr ""
+"Был прочитан старый файл настроек TDERadio.\n"
+"Вам потребуется заново выбрать станции для меню в системном лотке и панели "
+"быстрого доступа."
+
+#: stationlist.cpp:325
+msgid "parsing failed"
+msgstr "прочтение не удалось"
+
+#: stationlist.cpp:329
+msgid ""
+"Parsing the station preset file failed.\n"
+"See console output for more details."
+msgstr ""
+"Не могу разобрать файл настроек радиостанций.\n"
+"Для получения более подробной информации см.\n"
+"вывод в консоли."
+
+#: stationlist.cpp:343 stationlist.cpp:349
+#, c-format
+msgid "error downloading preset file %1"
+msgstr "ошибка при скачивании файла настроек"
+
+#: stationlist.cpp:345
+msgid "Download of the station preset file at %1 failed."
+msgstr "Не могу скачать файл радиостанций %1."
+
+#: stationlist.cpp:355
+msgid "temporary file: "
+msgstr "временный файл: "
+
+#: stationlist.cpp:361
+#, c-format
+msgid "error opening preset file %1"
+msgstr "ошибка открытия файла настроек: %1"
+
+#: stationlist.cpp:364
+msgid "Opening of the station preset file at %1 failed."
+msgstr "Не могу открыть файл радиостанций %1."
+
+#: stationlist.cpp:383
+msgid "Old Preset File Format detected"
+msgstr "Старый формат файла радиостанций"
+
+#: stationlist.cpp:461
+#, c-format
+msgid "error writing to tempfile %1"
+msgstr "Ошибка записи во временный файл %1"
+
+#: stationlist.cpp:464
+msgid "Writing station preset file %1 failed."
+msgstr "Не могу записать файл радиостанций %1."
+
+#: stationlist.cpp:475
+#, fuzzy
+msgid "uploading preset file %1: "
+msgstr "Ошибка выгрузки файла настроек %1"
+
+#: stationlist.cpp:477
+msgid ""
+"something strange happend, station list has only %1 entries. Writing station "
+"preset file skipped"
+msgstr ""
+
+#: stationlist.cpp:482
+#, c-format
+msgid "error uploading preset file %1"
+msgstr "Ошибка выгрузки файла настроек %1"
+
+#: stationlist.cpp:486
+msgid "Upload of station preset file to %1 failed."
+msgstr "Выгрузка файла радиостанций %1 завершилась неудачей."
+
+#: stationlistxmlhandler.cpp:116
+#, c-format
+msgid "unknown or unexpected element %1"
+msgstr "Элемент %1 неизвестен либо не ожидался"
+
+#: stationlistxmlhandler.cpp:145
+msgid "expected element %1, but found %2"
+msgstr "Ожидался элемент %1, однако встречен был %2"
+
+#: stationlistxmlhandler.cpp:149
+#, c-format
+msgid "unexpected element %1"
+msgstr "Неожиданно встретился элемент %1"
+
+#: stationlistxmlhandler.cpp:172
+#, c-format
+msgid "found a station list with unknown format %1"
+msgstr "Найден список станций неизвестного формата %1"
+
+#: stationlistxmlhandler.cpp:212
+msgid "unknown property %1 for class %2"
+msgstr "Неизвестное свойство класса %2: %1"
+
+#: stationlistxmlhandler.cpp:219
+#, c-format
+msgid "characters ignored for element %1"
+msgstr "Символы элемента %1 игнорированы"
+
+#: tderadioapp.cpp:44
+msgid ""
+"TDERadio - The Radio Application for TDE<P>With TDERadio you can listen to "
+"radio broadcasts with the help of your V4L/V4L2 compatible radio card.<P>The "
+"TDERadio Project contains a station preset data database. To complete this "
+"database you are encouraged to contribute your station preset file to the "
+"project. Just send it to one of the authors. <P>If you like to contribute "
+"your ideas, your own plugins or translations, don't hesitate to contact one "
+"of the authors.<P>"
+msgstr ""
+"TDERadio — радио для среды TDE<P>С TDERadio вы можете слушать радио с "
+"помощью платы радио, совместимой с v4l/v4l2.<P>Проект TDERadio включает и "
+"базу данных радиостанций; чтобы её дополнить, вы можете включить в проект "
+"свой файл с настройками радиостанций: просто отправьте его одному из авторов."
+"<P>Если вы хотите видеть реализованными в проекте свои идеи, готовые модули "
+"или переводы, не стесняйтесь связаться с кем-нибудь из авторов.<P>"
+
+#: tderadioapp.cpp:66
+msgid ""
+"Preset Database, Remote Control Support, Alarms, Rewrite for TDERadio 0.3.0, "
+"Misc"
+msgstr ""
+"База данных радиостанций, поддержка ДУ, выполнение заданий по расписанию, "
+"код для TDERadio 0.3.0, разное"
+
+#: tderadioapp.cpp:71
+msgid "Many People around the World ... "
+msgstr "Всем-всем-всем..."
+
+#: tderadioapp.cpp:72
+msgid ""
+"... which contributed station preset files \n"
+"and tested early and unstable snapshots of TDERadio \n"
+"with much patience"
+msgstr ""
+"... кто создавал файлы настроек радиостанций \n"
+"и с огромным терпением проверял работу ранних, нестабильных \n"
+" версий TDERadio"
+
+#: tderadioapp.cpp:106
+msgid "Library %1: Plugin Entry Point is missing\n"
+msgstr "Библиотека %1: не найдена точка вхождения модуля\n"
+
+#: tderadioapp.cpp:108 tderadioapp.cpp:119
+msgid "Plugin Library Load Error"
+msgstr "Ошибка загрузки библиотечного модуля"
+
+#: tderadioapp.cpp:116
+msgid ""
+"Library %1: \n"
+"%2"
+msgstr ""
+"Библиотека %1: \n"
+"%2"
+
+#: tderadioapp.cpp:143
+msgid "saveState"
+msgstr "saveState"
+
+#: tderadioapp.cpp:221
+msgid "Instance"
+msgstr "Экземпляр"
+
+#: tderadioapp.cpp:242
+msgid "TDERadio Configuration"
+msgstr "Настройка TDERadio"
+
+#: tderadioapp.cpp:243
+msgid "About TDERadio Components"
+msgstr "О компонентах TDERadio"
+
+#: tderadioapp.cpp:271
+msgid "Error: Loading Library %1 failed: %2"
+msgstr "Ошибка загрузки библиотеки %1: %2"
+
+#: tderadioapp.cpp:322
+msgid "Error: Creation of instance \"%1\" of class %2 falied."
+msgstr "Ошибка при создании экземпляра \"%1\" класса %2."
+
+#: tderadioapp.cpp:328
+msgid "Error: Cannot create instance \"%1\" of unknown class %2."
+msgstr "Ошибка: не могу создать экземпляр \"%1\" неизвестного класса %2."
+
+#: pluginmanager-configuration-ui.ui:16
+#, no-c-format
+msgid "PluginManagerConfigurationUI"
+msgstr "PluginManagerConfigurationUI"
+
+#: pluginmanager-configuration-ui.ui:30
+#, no-c-format
+msgid "Show Progress Bar during Startup for Plugin Initiali&zation"
+msgstr "&Иллюстрировать загрузку модулей во время запуска программы"
+
+#: pluginmanager-configuration-ui.ui:33
+#, no-c-format
+msgid "Alt+Z"
+msgstr "Alt+Z"
+
+#: pluginmanager-configuration-ui.ui:78 pluginmanager-configuration-ui.ui:229
+#, no-c-format
+msgid "Plugin Class"
+msgstr "Модуль"
+
+#: pluginmanager-configuration-ui.ui:116
+#, no-c-format
+msgid "list of running plugins"
+msgstr "Список запущенных модулей"
+
+#: pluginmanager-configuration-ui.ui:153
+#, no-c-format
+msgid "remove/stop a selected plugin instance"
+msgstr "Удалить/остановить выбранный модуль"
+
+#: pluginmanager-configuration-ui.ui:223
+#, no-c-format
+msgid "create a new instance of selected plugin class"
+msgstr "Создать новый экземпляр выбранного модуля"
+
+#: pluginmanager-configuration-ui.ui:256
+#, no-c-format
+msgid "list of available plugin classes"
+msgstr "Список доступных типов модулей"
+
+#: pluginmanager-configuration-ui.ui:297
+#, no-c-format
+msgid "select a plugin library"
+msgstr "Выберите файл"
+
+#: pluginmanager-configuration-ui.ui:317
+#, no-c-format
+msgid "unload a plugin library"
+msgstr "Отключить библиотеку"
+
+#: pluginmanager-configuration-ui.ui:337
+#, no-c-format
+msgid "load a selected plugin library"
+msgstr "Загрузить библиотеку из выбранного файла"
+
+#: pluginmanager-configuration-ui.ui:353
+#, no-c-format
+msgid "list of loaded plugin libraries"
+msgstr "Список загруженных библиотек"
+
+#: standardscandialog-ui.ui:16
+#, no-c-format
+msgid "Stations search in progress ..."
+msgstr "Идёт поиск станций..."
+
+#: standardscandialog-ui.ui:104
+#, no-c-format
+msgid "remaining time"
+msgstr "Оставшееся время"
+
+#: standardscandialog-ui.ui:120
+#, no-c-format
+msgid "<p align=\"right\">nothing here</p>"
+msgstr "<p align=\"right\">ничего</p>"
+
+#: stationselector-ui.ui:16
+#, no-c-format
+msgid "StationSelectorUI"
+msgstr "StationSelectorUI"
+
+#: stationselector-ui.ui:30
+#, no-c-format
+msgid "Selected Stations"
+msgstr "Выбранные"
+
+#: stationselector-ui.ui:119
+#, no-c-format
+msgid "Available Stations"
+msgstr "Доступные"
+
+#~ msgid "misplaced element %1"
+#~ msgstr "Элемент %1 неверно расположен"
+
+#~ msgid "invalid data for element %1"
+#~ msgstr "Неправильные данные для элемента %1"
diff --git a/src/po/tderadio.pot b/src/po/tderadio.pot
new file mode 100644
index 0000000..93c041c
--- /dev/null
+++ b/src/po/tderadio.pot
@@ -0,0 +1,498 @@
+# SOME DESCRIPTIVE TITLE.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2021-07-07 18:28+0000\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Instead of a literal translation, add your name to the end of the list (separated by a comma).
+#, ignore-inconsistent
+msgid ""
+"_: NAME OF TRANSLATORS\n"
+"Your names"
+msgstr ""
+
+#. Instead of a literal translation, add your email to the end of the list (separated by a comma).
+#, ignore-inconsistent
+msgid ""
+"_: EMAIL OF TRANSLATORS\n"
+"Your emails"
+msgstr ""
+
+#: aboutwidget.cpp:282
+msgid "Invalid layout"
+msgstr ""
+
+#: aboutwidget.cpp:451
+msgid "%1 %2 (Using TDE %3)"
+msgstr ""
+
+#: aboutwidget.cpp:454
+msgid "%1 %2, %3"
+msgstr ""
+
+#: aboutwidget.cpp:527
+msgid "A&uthor"
+msgstr ""
+
+#: aboutwidget.cpp:527
+msgid "A&uthors"
+msgstr ""
+
+#: aboutwidget.cpp:541
+msgid "&Thanks To"
+msgstr ""
+
+#: aboutwidget.cpp:554
+msgid "T&ranslation"
+msgstr ""
+
+#: aboutwidget.cpp:571
+msgid "&License Agreement"
+msgstr ""
+
+#: aboutwidget.cpp:585
+msgid "Image missing"
+msgstr ""
+
+#: errorlog-interfaces.cpp:43 errorlog-interfaces.cpp:78
+msgid "%1 Error: %2\n"
+msgstr ""
+
+#: errorlog-interfaces.cpp:52 errorlog-interfaces.cpp:87
+msgid "%1 Warning: %2\n"
+msgstr ""
+
+#: errorlog-interfaces.cpp:61 errorlog-interfaces.cpp:96
+msgid "%1 Information: %2\n"
+msgstr ""
+
+#: errorlog-interfaces.cpp:70 errorlog-interfaces.cpp:105
+msgid "%1 Debug: %2\n"
+msgstr ""
+
+#: fileringbuffer.cpp:35 fileringbuffer.cpp:68
+#, c-format
+msgid "cannot open buffer file %1"
+msgstr ""
+
+#: fileringbuffer.cpp:93
+msgid "FileRingbuffer::resize: Writing to tmpfile %1 failed. "
+msgstr ""
+
+#: fileringbuffer.cpp:99
+msgid "FileRingbuffer::resize: Opening tmpfile %1 failed. "
+msgstr ""
+
+#: fileringbuffer.cpp:127 fileringbuffer.cpp:145
+#, c-format
+msgid "FileRingBuffer::addData: failed writing data to file %1."
+msgstr ""
+
+#: fileringbuffer.cpp:168
+#, c-format
+msgid "FileRingBuffer::takeData: failed reading data to file %1."
+msgstr ""
+
+#: frequencyradiostation.cpp:120 internetradiostation.cpp:118
+msgid "%1, %2"
+msgstr ""
+
+#: frequencyradiostation.cpp:134
+msgid "%1 MHz"
+msgstr ""
+
+#: frequencyradiostation.cpp:136
+msgid "%1 kHz"
+msgstr ""
+
+#: include/radiostation.h:150 include/radiostation.h:151
+#: standardscandialog.cpp:162 standardscandialog.cpp:165
+msgid "unknown"
+msgstr ""
+
+#: main.cpp:36
+msgid "TDERadio"
+msgstr ""
+
+#: main.cpp:42
+msgid "rewrite for 0.3.0, recording, lirc support, alarms, misc"
+msgstr ""
+
+#: main.cpp:43 tderadioapp.cpp:67
+msgid "Buildsystem, Standards Conformance, Cleanups"
+msgstr ""
+
+#: main.cpp:45 tderadioapp.cpp:69
+msgid "idea, first basic application"
+msgstr ""
+
+#: multibuffer.cpp:89
+msgid "Buffer Overflow. "
+msgstr ""
+
+#: plugin_configuration_dialog.cpp:29
+msgid "Configuration Dialog"
+msgstr ""
+
+#: pluginmanager-configuration.cpp:143
+msgid "Enter Plugin Instance Name"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:89 pluginmanager-configuration.cpp:144
+#, no-c-format
+msgid "Instance Name"
+msgstr ""
+
+#: pluginmanager.cpp:123
+#, c-format
+msgid "Hide %1"
+msgstr ""
+
+#: pluginmanager.cpp:123
+#, c-format
+msgid "Show %1"
+msgstr ""
+
+#: pluginmanager.cpp:350
+msgid "Plugins"
+msgstr ""
+
+#: pluginmanager.cpp:351
+msgid "Plugin Library Configuration"
+msgstr ""
+
+#: pluginmanager.cpp:446
+msgid "Starting Plugins"
+msgstr ""
+
+#: pluginmanager.cpp:459 pluginmanager.cpp:476
+#, c-format
+msgid "Creating Plugin %1"
+msgstr ""
+
+#: pluginmanager.cpp:490
+#, c-format
+msgid "Initializing Plugin %1"
+msgstr ""
+
+#: radiostation-config.cpp:45
+msgid "I don't know how to edit this station"
+msgstr ""
+
+#: radiostation-config.cpp:68
+msgid "Frequency:"
+msgstr ""
+
+#: radiostation-listview.cpp:33
+msgid "No."
+msgstr ""
+
+#: radiostation-listview.cpp:34
+msgid "Icon"
+msgstr ""
+
+#: radiostation-listview.cpp:35
+msgid "Station"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:100 pluginmanager-configuration-ui.ui:240
+#: radiostation-listview.cpp:36
+#, no-c-format
+msgid "Description"
+msgstr ""
+
+#: radiostation-listview.cpp:234
+msgid "contentsDragEnterEvent accepted"
+msgstr ""
+
+#: radiostation-listview.cpp:236
+msgid "contentsDragEnterEvent rejected"
+msgstr ""
+
+#: standardscandialog.cpp:118
+msgid "new station "
+msgstr ""
+
+#: standardscandialog.cpp:142
+msgid "&Done"
+msgstr ""
+
+#: standardscandialog.cpp:160
+msgid "<p align=\"right\">%1</p>"
+msgstr ""
+
+#: station-drag-object.cpp:70
+msgid "canDecode = true"
+msgstr ""
+
+#: stationlist.cpp:255
+msgid "Contains merged Data"
+msgstr ""
+
+#: stationlist.cpp:315
+msgid ""
+"Probably an old station preset file was read.\n"
+"You have to rebuild your station selections for the quickbar and the docking "
+"menu."
+msgstr ""
+
+#: stationlist.cpp:325
+msgid "parsing failed"
+msgstr ""
+
+#: stationlist.cpp:329
+msgid ""
+"Parsing the station preset file failed.\n"
+"See console output for more details."
+msgstr ""
+
+#: stationlist.cpp:343 stationlist.cpp:349
+#, c-format
+msgid "error downloading preset file %1"
+msgstr ""
+
+#: stationlist.cpp:345
+msgid "Download of the station preset file at %1 failed."
+msgstr ""
+
+#: stationlist.cpp:355
+msgid "temporary file: "
+msgstr ""
+
+#: stationlist.cpp:361
+#, c-format
+msgid "error opening preset file %1"
+msgstr ""
+
+#: stationlist.cpp:364
+msgid "Opening of the station preset file at %1 failed."
+msgstr ""
+
+#: stationlist.cpp:383
+msgid "Old Preset File Format detected"
+msgstr ""
+
+#: stationlist.cpp:461
+#, c-format
+msgid "error writing to tempfile %1"
+msgstr ""
+
+#: stationlist.cpp:464
+msgid "Writing station preset file %1 failed."
+msgstr ""
+
+#: stationlist.cpp:475
+msgid "uploading preset file %1: "
+msgstr ""
+
+#: stationlist.cpp:477
+msgid ""
+"something strange happend, station list has only %1 entries. Writing station "
+"preset file skipped"
+msgstr ""
+
+#: stationlist.cpp:482
+#, c-format
+msgid "error uploading preset file %1"
+msgstr ""
+
+#: stationlist.cpp:486
+msgid "Upload of station preset file to %1 failed."
+msgstr ""
+
+#: stationlistxmlhandler.cpp:116
+#, c-format
+msgid "unknown or unexpected element %1"
+msgstr ""
+
+#: stationlistxmlhandler.cpp:145
+msgid "expected element %1, but found %2"
+msgstr ""
+
+#: stationlistxmlhandler.cpp:149
+#, c-format
+msgid "unexpected element %1"
+msgstr ""
+
+#: stationlistxmlhandler.cpp:172
+#, c-format
+msgid "found a station list with unknown format %1"
+msgstr ""
+
+#: stationlistxmlhandler.cpp:212
+msgid "unknown property %1 for class %2"
+msgstr ""
+
+#: stationlistxmlhandler.cpp:219
+#, c-format
+msgid "characters ignored for element %1"
+msgstr ""
+
+#: tderadioapp.cpp:44
+msgid ""
+"TDERadio - The Radio Application for TDE<P>With TDERadio you can listen to "
+"radio broadcasts with the help of your V4L/V4L2 compatible radio card.<P>The "
+"TDERadio Project contains a station preset data database. To complete this "
+"database you are encouraged to contribute your station preset file to the "
+"project. Just send it to one of the authors. <P>If you like to contribute "
+"your ideas, your own plugins or translations, don't hesitate to contact one "
+"of the authors.<P>"
+msgstr ""
+
+#: tderadioapp.cpp:66
+msgid ""
+"Preset Database, Remote Control Support, Alarms, Rewrite for TDERadio 0.3.0, "
+"Misc"
+msgstr ""
+
+#: tderadioapp.cpp:71
+msgid "Many People around the World ... "
+msgstr ""
+
+#: tderadioapp.cpp:72
+msgid ""
+"... which contributed station preset files \n"
+"and tested early and unstable snapshots of TDERadio \n"
+"with much patience"
+msgstr ""
+
+#: tderadioapp.cpp:106
+msgid "Library %1: Plugin Entry Point is missing\n"
+msgstr ""
+
+#: tderadioapp.cpp:108 tderadioapp.cpp:119
+msgid "Plugin Library Load Error"
+msgstr ""
+
+#: tderadioapp.cpp:116
+msgid ""
+"Library %1: \n"
+"%2"
+msgstr ""
+
+#: tderadioapp.cpp:143
+msgid "saveState"
+msgstr ""
+
+#: tderadioapp.cpp:221
+msgid "Instance"
+msgstr ""
+
+#: tderadioapp.cpp:242
+msgid "TDERadio Configuration"
+msgstr ""
+
+#: tderadioapp.cpp:243
+msgid "About TDERadio Components"
+msgstr ""
+
+#: tderadioapp.cpp:271
+msgid "Error: Loading Library %1 failed: %2"
+msgstr ""
+
+#: tderadioapp.cpp:322
+msgid "Error: Creation of instance \"%1\" of class %2 falied."
+msgstr ""
+
+#: tderadioapp.cpp:328
+msgid "Error: Cannot create instance \"%1\" of unknown class %2."
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:16
+#, no-c-format
+msgid "PluginManagerConfigurationUI"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:30
+#, no-c-format
+msgid "Show Progress Bar during Startup for Plugin Initiali&zation"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:33
+#, no-c-format
+msgid "Alt+Z"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:78 pluginmanager-configuration-ui.ui:229
+#, no-c-format
+msgid "Plugin Class"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:116
+#, no-c-format
+msgid "list of running plugins"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:153
+#, no-c-format
+msgid "remove/stop a selected plugin instance"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:223
+#, no-c-format
+msgid "create a new instance of selected plugin class"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:256
+#, no-c-format
+msgid "list of available plugin classes"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:297
+#, no-c-format
+msgid "select a plugin library"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:317
+#, no-c-format
+msgid "unload a plugin library"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:337
+#, no-c-format
+msgid "load a selected plugin library"
+msgstr ""
+
+#: pluginmanager-configuration-ui.ui:353
+#, no-c-format
+msgid "list of loaded plugin libraries"
+msgstr ""
+
+#: standardscandialog-ui.ui:16
+#, no-c-format
+msgid "Stations search in progress ..."
+msgstr ""
+
+#: standardscandialog-ui.ui:104
+#, no-c-format
+msgid "remaining time"
+msgstr ""
+
+#: standardscandialog-ui.ui:120
+#, no-c-format
+msgid "<p align=\"right\">nothing here</p>"
+msgstr ""
+
+#: stationselector-ui.ui:16
+#, no-c-format
+msgid "StationSelectorUI"
+msgstr ""
+
+#: stationselector-ui.ui:30
+#, no-c-format
+msgid "Selected Stations"
+msgstr ""
+
+#: stationselector-ui.ui:119
+#, no-c-format
+msgid "Available Stations"
+msgstr ""
diff --git a/src/radio_interfaces.cpp b/src/radio_interfaces.cpp
new file mode 100644
index 0000000..b2bcf74
--- /dev/null
+++ b/src/radio_interfaces.cpp
@@ -0,0 +1,96 @@
+/***************************************************************************
+ radio_interfaces.cpp - description
+ -------------------
+ begin : Don Apr 17 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/radio_interfaces.h"
+#include "include/stationlist.h"
+#include "include/radiostation.h"
+
+// IRadio
+
+IF_IMPL_SENDER ( IRadio::notifyPowerChanged(bool on),
+ noticePowerChanged(on) );
+IF_IMPL_SENDER ( IRadio::notifyStationChanged (const RadioStation &s, int idx),
+ noticeStationChanged (s, idx) );
+IF_IMPL_SENDER ( IRadio::notifyStationsChanged(const StationList &sl),
+ noticeStationsChanged(sl) );
+IF_IMPL_SENDER ( IRadio::notifyPresetFileChanged(const TQString &f),
+ noticePresetFileChanged(f) );
+IF_IMPL_SENDER ( IRadio::notifyCurrentSoundStreamIDChanged(SoundStreamID id),
+ noticeCurrentSoundStreamIDChanged(id) );
+
+// IRadioClient
+
+IF_IMPL_SENDER ( IRadioClient::sendPowerOn(),
+ powerOn() );
+IF_IMPL_SENDER ( IRadioClient::sendPowerOff(),
+ powerOff() );
+IF_IMPL_SENDER ( IRadioClient::sendActivateStation(const RadioStation &rs),
+ activateStation(rs) );
+IF_IMPL_SENDER ( IRadioClient::sendActivateStation(int index),
+ activateStation(index) );
+IF_IMPL_SENDER ( IRadioClient::sendStations(const StationList &sl),
+ setStations(sl) );
+IF_IMPL_SENDER ( IRadioClient::sendPresetFile(const TQString &f),
+ setPresetFile(f) );
+
+IF_IMPL_QUERY ( bool IRadioClient::queryIsPowerOn(),
+ isPowerOn(),
+ false );
+
+IF_IMPL_QUERY ( bool IRadioClient::queryIsPowerOff(),
+ isPowerOff(),
+ true );
+
+IF_IMPL_QUERY ( const RadioStation & IRadioClient::queryCurrentStation(),
+ getCurrentStation(),
+ undefinedRadioStation );
+
+IF_IMPL_QUERY ( int IRadioClient::queryCurrentStationIdx(),
+ getCurrentStationIdx(),
+ -1 );
+
+IF_IMPL_QUERY ( int IRadioClient::queryStationIdx(const RadioStation &rs),
+ getStationIdx(rs),
+ -1 );
+
+IF_IMPL_QUERY ( const StationList & IRadioClient::queryStations(),
+ getStations(),
+ emptyStationList );
+
+static TQString emptyString;
+IF_IMPL_QUERY ( const TQString & IRadioClient::queryPresetFile(),
+ getPresetFile(),
+ emptyString );
+
+IF_IMPL_QUERY ( SoundStreamID IRadioClient::queryCurrentSoundStreamID(),
+ getCurrentSoundStreamID(),
+ SoundStreamID::InvalidID );
+
+void IRadioClient::noticeConnectedI (cmplInterface *, bool /*pointer_valid*/)
+{
+ noticeStationsChanged(queryStations());
+ noticeStationChanged (queryCurrentStation(), queryCurrentStationIdx());
+ noticePowerChanged (queryIsPowerOn());
+}
+
+void IRadioClient::noticeDisconnectedI (cmplInterface *, bool /*pointer_valid*/)
+{
+ noticeStationsChanged(queryStations());
+ noticeStationChanged(queryCurrentStation(), queryCurrentStationIdx());
+ noticePowerChanged(queryIsPowerOn());
+}
+
diff --git a/src/radiodevice_interfaces.cpp b/src/radiodevice_interfaces.cpp
new file mode 100644
index 0000000..a1e7fde
--- /dev/null
+++ b/src/radiodevice_interfaces.cpp
@@ -0,0 +1,330 @@
+/***************************************************************************
+ radiodevice_interfaces.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+
+#include "include/radiodevice_interfaces.h"
+#include "include/radiostation.h"
+
+#include <kurl.h>
+
+// IRadioDevice
+
+IF_IMPL_SENDER ( IRadioDevice::notifyPowerChanged(bool on),
+ noticePowerChanged(on, this) );
+IF_IMPL_SENDER ( IRadioDevice::notifyStationChanged (const RadioStation &s),
+ noticeStationChanged (s, this) );
+IF_IMPL_SENDER ( IRadioDevice::notifyDescriptionChanged (const TQString&s),
+ noticeDescriptionChanged (s, this) );
+IF_IMPL_SENDER ( IRadioDevice::notifyCurrentSoundStreamIDChanged(SoundStreamID id),
+ noticeCurrentSoundStreamIDChanged(id, this) );
+
+// IRadioDeviceClient
+
+IF_IMPL_SENDER ( IRadioDeviceClient::sendPower(bool on),
+ setPower(on) );
+IF_IMPL_SENDER ( IRadioDeviceClient::sendPowerOn(),
+ powerOn() );
+IF_IMPL_SENDER ( IRadioDeviceClient::sendPowerOff(),
+ powerOff() );
+IF_IMPL_SENDER ( IRadioDeviceClient::sendActivateStation(const RadioStation &rs),
+ activateStation(rs) );
+
+IF_IMPL_QUERY ( bool IRadioDeviceClient::queryIsPowerOn(),
+ isPowerOn(),
+ false );
+IF_IMPL_QUERY ( bool IRadioDeviceClient::queryIsPowerOff(),
+ isPowerOff(),
+ true );
+IF_IMPL_QUERY ( const RadioStation & IRadioDeviceClient::queryCurrentStation(),
+ getCurrentStation(),
+ undefinedRadioStation );
+
+static TQString IRadioDeviceClient_unknown("unknown");
+IF_IMPL_QUERY ( const TQString & IRadioDeviceClient::queryDescription(),
+ getDescription(),
+ IRadioDeviceClient_unknown );
+
+IF_IMPL_QUERY ( SoundStreamID IRadioDeviceClient::queryCurrentSoundStreamID(),
+ getCurrentSoundStreamID(),
+ SoundStreamID::InvalidID );
+
+void IRadioDeviceClient::noticeConnectedI (cmplInterface *c, bool pointer_valid)
+{
+ noticePowerChanged(queryIsPowerOn());
+ noticeStationChanged(queryCurrentStation(), pointer_valid ? c : NULL);
+ noticeDescriptionChanged(queryDescription(), pointer_valid ? c : NULL);
+}
+
+void IRadioDeviceClient::noticeDisconnectedI (cmplInterface *c, bool pointer_valid)
+{
+ noticePowerChanged(queryIsPowerOn());
+ noticeStationChanged(queryCurrentStation(), pointer_valid ? c : NULL);
+ noticeDescriptionChanged(queryDescription(), pointer_valid ? c : NULL);
+}
+
+
+
+
+/* Deprecated
+// IRadioSound
+
+IF_IMPL_SENDER ( IRadioSound::notifyVolumeChanged(float v),
+ noticeVolumeChanged(v) )
+IF_IMPL_SENDER ( IRadioSound::notifyTrebleChanged(float v),
+ noticeTrebleChanged(v) )
+IF_IMPL_SENDER ( IRadioSound::notifyBassChanged(float v),
+ noticeBassChanged(v) )
+IF_IMPL_SENDER ( IRadioSound::notifyBalanceChanged(float v),
+ noticeBalanceChanged(v) )
+IF_IMPL_SENDER ( IRadioSound::notifySignalQualityChanged(float q),
+ noticeSignalQualityChanged(q) )
+IF_IMPL_SENDER ( IRadioSound::notifySignalQualityBoolChanged(bool good),
+ noticeSignalQualityChanged(good) )
+IF_IMPL_SENDER ( IRadioSound::notifySignalMinQualityChanged(float q),
+ noticeSignalMinQualityChanged(q) )
+IF_IMPL_SENDER ( IRadioSound::notifyStereoChanged(bool s),
+ noticeStereoChanged(s) )
+IF_IMPL_SENDER ( IRadioSound::notifyMuted(bool m),
+ noticeMuted(m) )
+
+// IRadioSoundClient
+
+IF_IMPL_SENDER ( IRadioSoundClient::sendVolume (float v),
+ setVolume (v) )
+IF_IMPL_SENDER ( IRadioSoundClient::sendTreble (float v),
+ setTreble (v) )
+IF_IMPL_SENDER ( IRadioSoundClient::sendBass (float v),
+ setBass (v) )
+IF_IMPL_SENDER ( IRadioSoundClient::sendBalance (float v),
+ setBalance (v) )
+IF_IMPL_SENDER ( IRadioSoundClient::sendMute (bool mute),
+ mute (mute) )
+IF_IMPL_SENDER ( IRadioSoundClient::sendUnmute (bool unmute),
+ unmute (unmute) )
+IF_IMPL_SENDER ( IRadioSoundClient::sendSignalMinQuality (float q),
+ setSignalMinQuality (q) )
+IF_IMPL_SENDER ( IRadioSoundClient::sendStereo(bool s),
+ setStereo(s) )
+
+IF_IMPL_QUERY ( float IRadioSoundClient::queryVolume(),
+ getVolume(),
+ 0.0 )
+IF_IMPL_QUERY ( float IRadioSoundClient::queryTreble(),
+ getTreble(),
+ 0.0 )
+IF_IMPL_QUERY ( float IRadioSoundClient::queryBass(),
+ getBass(),
+ 0.0 )
+IF_IMPL_QUERY ( float IRadioSoundClient::queryBalance(),
+ getBalance(),
+ 0.0 )
+IF_IMPL_QUERY ( float IRadioSoundClient::querySignalQuality(),
+ getSignalQuality(),
+ 0.0 )
+IF_IMPL_QUERY ( float IRadioSoundClient::querySignalMinQuality(),
+ getSignalMinQuality(),
+ 0.75 )
+IF_IMPL_QUERY ( bool IRadioSoundClient::queryHasGoodQuality(),
+ hasGoodQuality(),
+ false )
+IF_IMPL_QUERY ( bool IRadioSoundClient::queryIsStereo(),
+ isStereo(),
+ false )
+IF_IMPL_QUERY ( bool IRadioSoundClient::queryIsMuted(),
+ isMuted(),
+ true )
+
+
+void IRadioSoundClient::noticeConnectedI (cmplInterface *, bool pointer_valid)
+{
+ noticeVolumeChanged (queryVolume());
+ noticeTrebleChanged (queryTreble());
+ noticeBassChanged (queryBass());
+ noticeBalanceChanged (queryBalance());
+ noticeSignalQualityChanged (querySignalQuality());
+ noticeSignalQualityChanged (queryHasGoodQuality());
+ noticeSignalMinQualityChanged(querySignalMinQuality());
+ noticeStereoChanged (queryIsStereo());
+ noticeMuted (queryIsMuted());
+}
+
+
+void IRadioSoundClient::noticeDisconnectedI (cmplInterface *, bool pointer_valid)
+{
+ noticeVolumeChanged (queryVolume());
+ noticeTrebleChanged (queryTreble());
+ noticeBassChanged (queryBass());
+ noticeBalanceChanged (queryBalance());
+ noticeSignalQualityChanged (querySignalQuality());
+ noticeSignalQualityChanged (queryHasGoodQuality());
+ noticeSignalMinQualityChanged(querySignalMinQuality());
+ noticeStereoChanged (queryIsStereo());
+ noticeMuted (queryIsMuted());
+}
+
+*/
+
+
+
+// ISeekRadio
+
+IF_IMPL_SENDER ( ISeekRadio::notifySeekStarted (bool up),
+ noticeSeekStarted (up) );
+IF_IMPL_SENDER ( ISeekRadio::notifySeekStopped (),
+ noticeSeekStopped () );
+IF_IMPL_SENDER ( ISeekRadio::notifySeekFinished (const RadioStation &s, bool goodQuality),
+ noticeSeekFinished (s, goodQuality) );
+IF_IMPL_SENDER ( ISeekRadio::notifyProgress (float f),
+ noticeProgress (f) );
+
+
+// ISeekRadioClient
+
+IF_IMPL_SENDER ( ISeekRadioClient::sendToBeginning(),
+ toBeginning() );
+IF_IMPL_SENDER ( ISeekRadioClient::sendToEnd(),
+ toEnd() );
+IF_IMPL_SENDER ( ISeekRadioClient::sendStartSeek (bool up),
+ startSeek (up) );
+IF_IMPL_SENDER ( ISeekRadioClient::sendStartSeekUp(),
+ startSeekUp() );
+IF_IMPL_SENDER ( ISeekRadioClient::sendStartSeekDown(),
+ startSeekDown() );
+IF_IMPL_SENDER ( ISeekRadioClient::sendStopSeek(),
+ stopSeek() );
+
+IF_IMPL_QUERY ( bool ISeekRadioClient::queryIsSeekRunning(),
+ isSeekRunning(),
+ false );
+IF_IMPL_QUERY ( bool ISeekRadioClient::queryIsSeekUpRunning(),
+ isSeekUpRunning(),
+ false );
+IF_IMPL_QUERY ( bool ISeekRadioClient::queryIsSeekDownRunning(),
+ isSeekDownRunning(),
+ false );
+IF_IMPL_QUERY ( float ISeekRadioClient::queryProgress(),
+ getProgress(),
+ 1.0 );
+
+
+void ISeekRadioClient::noticeConnectedI (cmplInterface *, bool /*pointer_valid*/)
+{
+ if (queryIsSeekRunning()) {
+ noticeSeekStarted(queryIsSeekUpRunning());
+ } else {
+ noticeSeekStopped();
+ }
+ noticeProgress(queryProgress());
+}
+
+
+void ISeekRadioClient::noticeDisconnectedI (cmplInterface *, bool /*pointer_valid*/)
+{
+ noticeSeekStopped();
+ noticeProgress(queryProgress());
+}
+
+
+// IFrequencyRadio
+
+IF_IMPL_SENDER ( IFrequencyRadio::notifyFrequencyChanged(float f, const RadioStation *s),
+ noticeFrequencyChanged(f, s) )
+IF_IMPL_SENDER ( IFrequencyRadio::notifyMinMaxFrequencyChanged(float min, float max),
+ noticeMinMaxFrequencyChanged(min, max) )
+IF_IMPL_SENDER ( IFrequencyRadio::notifyDeviceMinMaxFrequencyChanged(float min, float max),
+ noticeDeviceMinMaxFrequencyChanged(min, max) )
+IF_IMPL_SENDER ( IFrequencyRadio::notifyScanStepChanged(float s),
+ noticeScanStepChanged(s) )
+
+// IFrequencyRadioClient
+
+IF_IMPL_SENDER ( IFrequencyRadioClient::sendFrequency(float f),
+ setFrequency(f) )
+IF_IMPL_SENDER ( IFrequencyRadioClient::sendMinFrequency(float mf),
+ setMinFrequency(mf) )
+IF_IMPL_SENDER ( IFrequencyRadioClient::sendMaxFrequency(float mf),
+ setMaxFrequency(mf) )
+IF_IMPL_SENDER ( IFrequencyRadioClient::sendScanStep(float s),
+ setScanStep(s) )
+
+IF_IMPL_QUERY ( float IFrequencyRadioClient::queryFrequency(),
+ getFrequency(),
+ 0 )
+IF_IMPL_QUERY ( float IFrequencyRadioClient::queryMinFrequency(),
+ getMinFrequency(),
+ 0 )
+IF_IMPL_QUERY ( float IFrequencyRadioClient::queryMinDeviceFrequency(),
+ getMinDeviceFrequency(),
+ 0 )
+IF_IMPL_QUERY ( float IFrequencyRadioClient::queryMaxFrequency(),
+ getMaxFrequency(),
+ 0 )
+IF_IMPL_QUERY ( float IFrequencyRadioClient::queryMaxDeviceFrequency(),
+ getMaxDeviceFrequency(),
+ 0 )
+IF_IMPL_QUERY ( float IFrequencyRadioClient::queryScanStep(),
+ getScanStep(),
+ 0.05 )
+
+void IFrequencyRadioClient::noticeConnectedI (cmplInterface *, bool /*pointer_valid*/)
+{
+ noticeFrequencyChanged(queryFrequency(), NULL);
+ noticeMinMaxFrequencyChanged(queryMinFrequency(), queryMaxFrequency());
+ noticeDeviceMinMaxFrequencyChanged(queryMinDeviceFrequency(), queryMaxDeviceFrequency());
+ noticeScanStepChanged(queryScanStep());
+}
+
+
+void IFrequencyRadioClient::noticeDisconnectedI (cmplInterface *, bool /*pointer_valid*/)
+{
+ noticeFrequencyChanged(queryFrequency(), NULL);
+ noticeMinMaxFrequencyChanged(queryMinFrequency(), queryMaxFrequency());
+ noticeDeviceMinMaxFrequencyChanged(queryMinDeviceFrequency(), queryMaxDeviceFrequency());
+ noticeScanStepChanged(queryScanStep());
+}
+
+
+
+// IInternetRadio
+
+IF_IMPL_SENDER ( IInternetRadio::notifyURLChanged(const KURL &u),
+ noticeURLChanged(u) )
+
+// IInternetRadioClient
+
+IF_IMPL_SENDER ( IInternetRadioClient::sendURL(const KURL &url),
+ setURL(url) )
+
+
+static KURL emptyURL;
+
+IF_IMPL_QUERY ( const KURL &IInternetRadioClient::queryURL(),
+ getURL(),
+ emptyURL )
+
+void IInternetRadioClient::noticeConnectedI (cmplInterface *, bool /*pointer_valid*/)
+{
+ noticeURLChanged(queryURL());
+}
+
+
+void IInternetRadioClient::noticeDisconnectedI (cmplInterface *, bool /*pointer_valid*/)
+{
+ noticeURLChanged(queryURL());
+}
+
+
diff --git a/src/radiodevicepool_interfaces.cpp b/src/radiodevicepool_interfaces.cpp
new file mode 100644
index 0000000..1f92e9d
--- /dev/null
+++ b/src/radiodevicepool_interfaces.cpp
@@ -0,0 +1,65 @@
+/***************************************************************************
+ radiodevicepool_interface.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+
+#include "include/radiodevicepool_interfaces.h"
+#include "include/radiodevice_interfaces.h"
+
+// IRadioDevicePool
+
+IF_IMPL_SENDER ( IRadioDevicePool::notifyActiveDeviceChanged(IRadioDevice *rd),
+ noticeActiveDeviceChanged(rd) )
+IF_IMPL_SENDER ( IRadioDevicePool::notifyDevicesChanged(const TQPtrList<IRadioDevice> &l),
+ noticeDevicesChanged(l) )
+IF_IMPL_SENDER ( IRadioDevicePool::notifyDeviceDescriptionChanged(const TQString &s),
+ noticeDeviceDescriptionChanged(s) )
+
+// IRadioDevicePoolClient
+
+IF_IMPL_SENDER ( IRadioDevicePoolClient::sendActiveDevice(IRadioDevice *rd, bool keepPower ),
+ setActiveDevice(rd, keepPower) )
+
+IF_IMPL_QUERY ( IRadioDevice *IRadioDevicePoolClient::queryActiveDevice(),
+ getActiveDevice(),
+ NULL )
+
+static const TQPtrList<IRadioDevice> IRadioDevicePoolClient_emptyList;
+IF_IMPL_QUERY ( const TQPtrList<IRadioDevice> &IRadioDevicePoolClient::queryDevices(),
+ getDevices(),
+ IRadioDevicePoolClient_emptyList )
+
+static TQString IRadioDevicePoolClient_unknown("unknown");
+IF_IMPL_QUERY ( const TQString &IRadioDevicePoolClient::queryDeviceDescription(),
+ getDeviceDescription(),
+ IRadioDevicePoolClient_unknown )
+
+
+void IRadioDevicePoolClient::noticeConnectedI (cmplInterface *, bool /*pointer_valid*/)
+{
+ noticeActiveDeviceChanged(queryActiveDevice());
+ noticeDevicesChanged(queryDevices());
+ noticeDeviceDescriptionChanged(queryDeviceDescription());
+}
+
+void IRadioDevicePoolClient::noticeDisconnectedI (cmplInterface *, bool /*pointer_valid*/)
+{
+ noticeActiveDeviceChanged(queryActiveDevice());
+ noticeDevicesChanged(queryDevices());
+ noticeDeviceDescriptionChanged(queryDeviceDescription());
+}
+
+
diff --git a/src/radiostation-config.cpp b/src/radiostation-config.cpp
new file mode 100644
index 0000000..52a692e
--- /dev/null
+++ b/src/radiostation-config.cpp
@@ -0,0 +1,102 @@
+/***************************************************************************
+ radiostation-config.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+#include <tqlabel.h>
+#include <tqspinbox.h>
+#include <tqlayout.h>
+#include <tdelocale.h>
+
+#include <math.h>
+
+#include "include/radiostation-config.h"
+#include "include/frequencyradiostation.h"
+
+
+RadioStationConfig::RadioStationConfig(TQWidget *parent)
+ : TQWidget (parent)
+{
+
+}
+
+RadioStationConfig::~RadioStationConfig()
+{
+}
+
+
+///////////////////////////////////////////////////////////////////////
+
+UndefinedRadioStationConfig::UndefinedRadioStationConfig (TQWidget *parent)
+ : RadioStationConfig(parent)
+{
+ new TQLabel (i18n("I don't know how to edit this station"), this);
+}
+
+UndefinedRadioStationConfig::~UndefinedRadioStationConfig()
+{
+}
+
+void UndefinedRadioStationConfig::setStationData (const RadioStation &/*rs*/)
+{
+}
+
+void UndefinedRadioStationConfig::storeStationData (RadioStation &/*rs*/)
+{
+}
+
+
+///////////////////////////////////////////////////////////////////////
+
+FrequencyRadioStationConfig::FrequencyRadioStationConfig (TQWidget *parent)
+ : RadioStationConfig(parent)
+{
+ TQHBoxLayout *hl = new TQHBoxLayout(this);
+ TQVBoxLayout *vl = new TQVBoxLayout(hl);
+ vl->addWidget (new TQLabel(i18n("Frequency:"), this));
+ m_editFrequency = new TQSpinBox(20, 150000, 10, this);
+ vl->addWidget (m_editFrequency);
+ hl->addItem(new TQSpacerItem (10, 1, TQSizePolicy::Expanding, TQSizePolicy::Fixed));
+
+ connect (m_editFrequency, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(slotValueChanged(int)));
+}
+
+FrequencyRadioStationConfig::~FrequencyRadioStationConfig()
+{
+}
+
+void FrequencyRadioStationConfig::setStationData (const RadioStation &x)
+{
+ const FrequencyRadioStation *rs = dynamic_cast<const FrequencyRadioStation*>(&x);
+ if (rs) {
+ m_editFrequency->setValue((int)rint(rs->frequency() * 1000));
+ }
+}
+
+void FrequencyRadioStationConfig::storeStationData (RadioStation &x)
+{
+ FrequencyRadioStation *rs = dynamic_cast<FrequencyRadioStation*>(&x);
+ if (rs) {
+ rs->setFrequency(0.001 * m_editFrequency->value());
+ }
+}
+
+void FrequencyRadioStationConfig::slotValueChanged(int /*i*/)
+{
+ emit changed(this);
+}
+
+
+#include "radiostation-config.moc"
diff --git a/src/radiostation-listview.cpp b/src/radiostation-listview.cpp
new file mode 100644
index 0000000..4c7fe64
--- /dev/null
+++ b/src/radiostation-listview.cpp
@@ -0,0 +1,259 @@
+/***************************************************************************
+ radiostation-listview.cpp - description
+ -------------------
+ begin : Mi Feb 3 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/radiostation-listview.h"
+#include "include/stationlist.h"
+#include "include/radiostation.h"
+#include "include/station-drag-object.h"
+
+#include <tdelocale.h>
+#include <tqfile.h>
+#include <tqimage.h>
+#include <tqpixmap.h>
+
+#include <tdeconfig.h>
+
+RadioStationListView::RadioStationListView(TQWidget *parent, const char *name)
+ : TDEListView(parent, name)
+{
+ addColumn(i18n("No."));
+ addColumn(i18n("Icon"));
+ addColumn(i18n("Station"));
+ addColumn(i18n("Description"));
+ setAllColumnsShowFocus(true);
+ setSorting(-1);
+
+ TQObject::connect(this, TQT_SIGNAL(spacePressed(TQListViewItem*)),
+ this, TQT_SLOT(slotStationActivation(TQListViewItem* )));
+ TQObject::connect(this, TQT_SIGNAL(returnPressed(TQListViewItem*)),
+ this, TQT_SLOT(slotStationActivation(TQListViewItem* )));
+ TQObject::connect(this, TQT_SIGNAL(doubleClicked(TQListViewItem*)),
+ this, TQT_SLOT(slotStationActivation(TQListViewItem *)));
+ TQObject::connect(this, TQT_SIGNAL(currentChanged(TQListViewItem*)),
+ this, TQT_SLOT(slotCurrentStationChanged(TQListViewItem *)));
+
+ setAcceptDrops(true);
+}
+
+
+RadioStationListView::~RadioStationListView()
+{
+}
+
+
+TQListViewItem *RadioStationListView::getItemForIndex(int idx) const
+{
+ TQListViewItem *item = NULL;
+
+ if (idx >= 0 && idx < childCount()) {
+ item = firstChild();
+ int i = 0;
+ while (item && i < idx) {
+ item = item->nextSibling();
+ ++i;
+ }
+ }
+ return item;
+}
+
+
+int RadioStationListView::getIndexForItem(TQListViewItem *queryItem) const
+{
+ int idx = -1;
+
+ if (queryItem) {
+ TQListViewItem *item = firstChild();
+ ++idx;
+ while (item && item != queryItem) {
+ item = item->nextSibling();
+ ++idx;
+ }
+ if (!item)
+ idx = -1;
+ }
+
+ return idx;
+}
+
+
+void RadioStationListView::setStation(int idx, const RadioStation &s, int nr)
+{
+ TQListViewItem *item = getItemForIndex(idx);
+
+ if (idx < 0) {
+ item = new TQListViewItem(this, firstChild());
+ firstChild()->moveItem(item);
+ m_StationIDs.prepend(s.stationID());
+ idx = 0;
+ } else if (idx >= childCount()) {
+ item = new TQListViewItem(this, lastChild());
+ m_StationIDs.append(s.stationID());
+ idx = childCount() - 1;
+ }
+
+ if (item) {
+ item->setDragEnabled(true);
+ item->setDropEnabled(true);
+
+ item->setText(0, TQString::number(nr > 0 ? nr : idx+1));
+ item->setText(2, s.name());
+ item->setText(3, s.description());
+
+ m_StationIDs[idx] = s.stationID();
+
+ TQImage img(s.iconName());
+ if (!img.isNull()) {
+ int h = img.height();
+ float f = 0.9 * (float)(item->height()) / (h ? (float)h : 1.0);
+ item->setPixmap(1, img.smoothScale((int)(img.width()*f), (int)(h * f)));
+ } else {
+ item->setPixmap(1, TQPixmap());
+ }
+ }
+}
+
+
+void RadioStationListView::appendStation(const RadioStation &st, int nr)
+{
+ setStation(childCount(), st, nr);
+}
+
+
+void RadioStationListView::setStations(const StationList &stations)
+{
+ clear();
+ for (RawStationList::Iterator it(stations.all()); it.current(); ++it) {
+ setStation(childCount(), *it.current());
+ }
+}
+
+
+void RadioStationListView::removeStation(int idx)
+{
+ TQListViewItem *item = getItemForIndex(idx);
+ if (item) {
+ delete item;
+ m_StationIDs.remove(m_StationIDs.at(idx));
+ }
+}
+
+void RadioStationListView::takeItem(TQListViewItem *item, int idx)
+{
+ TQListView::takeItem(item);
+ m_StationIDs.remove(m_StationIDs.at(idx));
+}
+
+void RadioStationListView::insertItem(TQListViewItem *item, const TQString &stationid, int idx_to)
+{
+ TQListView::insertItem(item);
+ m_StationIDs.insert(m_StationIDs.at(idx_to), stationid);
+}
+
+void RadioStationListView::setCurrentStation(int idx)
+{
+ TQListViewItem *item = getItemForIndex(idx);
+ if (item) {
+ clearSelection();
+ setSelected(item, true);
+ setCurrentItem(item);
+ }
+}
+
+
+int RadioStationListView::currentStationIndex() const
+{
+ return getIndexForItem(currentItem());
+}
+
+
+void RadioStationListView::slotStationActivation(TQListViewItem *item)
+{
+ emit sigStationActivated(getIndexForItem(item));
+}
+
+
+void RadioStationListView::slotCurrentStationChanged(TQListViewItem *item)
+{
+ emit sigCurrentStationChanged(getIndexForItem(item));
+}
+
+
+void RadioStationListView::saveState (TDEConfig *cfg) const
+{
+ if (!cfg)
+ return;
+ for (int i = 0; i < 4; ++i)
+ cfg->writeEntry(TQString(name()) + "_radiostation_listview_col_" + TQString::number(i), columnWidth(i));
+}
+
+
+void RadioStationListView::restoreState (TDEConfig *cfg)
+{
+ if (!cfg)
+ return;
+ for (int i = 0; i < 4; ++i)
+ setColumnWidth(i, cfg->readNumEntry(TQString(name()) + "_radiostation_listview_col_" + TQString::number(i), -1));
+}
+
+
+TQDragObject *RadioStationListView::dragObject()
+{
+ TQStringList list;
+ TQListViewItem *item = firstChild();
+ for (int idx = 0; item; ++idx, item = item->nextSibling()) {
+ if (item->isSelected()) {
+ list.append(m_StationIDs[idx]);
+ }
+ }
+ return new StationDragObject(list, this);
+}
+
+void RadioStationListView::dragEnterEvent(TQDragEnterEvent* event)
+{
+ event->accept(StationDragObject::canDecode(event));
+}
+
+void RadioStationListView::contentsDragEnterEvent(TQDragEnterEvent* event)
+{
+ bool a = StationDragObject::canDecode(event);
+ if (a)
+ IErrorLogClient::staticLogDebug(i18n("contentsDragEnterEvent accepted"));
+ else
+ IErrorLogClient::staticLogDebug(i18n("contentsDragEnterEvent rejected"));
+ event->accept(a);
+}
+
+void RadioStationListView::dropEvent(TQDropEvent* event)
+{
+ TQStringList list;
+
+ if ( StationDragObject::decode(event, list) ) {
+ emit sigStationsReceived(list);
+ }
+}
+
+void RadioStationListView::contentsDropEvent(TQDropEvent* event)
+{
+ dropEvent(event);
+}
+
+void RadioStationListView::contentsDragMoveEvent(TQDragMoveEvent* event)
+{
+ event->accept();
+}
+
+#include "radiostation-listview.moc"
diff --git a/src/radiostation.cpp b/src/radiostation.cpp
new file mode 100644
index 0000000..4870f3d
--- /dev/null
+++ b/src/radiostation.cpp
@@ -0,0 +1,216 @@
+/***************************************************************************
+ radiostation.cpp - description
+ -------------------
+ begin : Sat Feb 2 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/radiostation.h"
+#include "include/radiostation-config.h"
+
+#include <unistd.h>
+#include <time.h>
+#include <fcntl.h>
+
+extern const char *StationNameElement;
+extern const char *StationShortNameElement;
+extern const char *StationIconStringElement;
+extern const char *StationVolumePresetElement;
+extern const char *StationIDElement;
+
+const char *StationNameElement = "name";
+const char *StationShortNameElement = "shortname";
+const char *StationIconStringElement = "icon";
+const char *StationVolumePresetElement = "volumepreset";
+const char *StationIDElement = "stationID";
+
+const char *dev_urandom_radiostations = "/dev/urandom";
+
+/////////////////////////////////////////////////////////////////////////////
+
+TQDict<RadioStation> *RadioStation::stationClassRegistry = 0;
+
+/////////////////////////////////////////////////////////////////////////////
+
+RegisterStationClass registerStationClass;
+const UndefinedRadioStation undefinedRadioStation (registerStationClass);
+
+/////////////////////////////////////////////////////////////////////////////
+
+
+RadioStation::RadioStation(RegisterStationClass, const TQString &classname)
+ : m_stationID(TQString()), // mark this station as a prototype station
+ // so that we can create later a real stationID
+ m_name(TQString()),
+ m_shortName(TQString()),
+ m_initialVolume(-1),
+ m_iconName(TQString())
+{
+ if (! stationClassRegistry)
+ stationClassRegistry = new TQDict<RadioStation>;
+ stationClassRegistry->insert(classname, this);
+}
+
+RadioStation::RadioStation()
+ : m_name(TQString()),
+ m_shortName(TQString()),
+ m_initialVolume(-1),
+ m_iconName(TQString())
+{
+ generateNewStationID();
+}
+
+RadioStation::RadioStation(const TQString &name, const TQString &shortName)
+ : m_name(name),
+ m_shortName(shortName),
+ m_initialVolume(-1),
+ m_iconName(TQString())
+{
+ generateNewStationID();
+}
+
+
+RadioStation::RadioStation(const RadioStation &s)
+ : m_stationID(s.m_stationID),
+ m_name(s.m_name),
+ m_shortName(s.m_shortName),
+ m_initialVolume(s.m_initialVolume),
+ m_iconName(s.m_iconName)
+{
+ // create a real stationID if "s" is a prototype
+ if (m_stationID.isNull())
+ generateNewStationID();
+}
+
+
+RadioStation::~RadioStation()
+{
+}
+
+
+void RadioStation::copyDescriptionFrom(const RadioStation &rs)
+{
+ m_name = rs.m_name;
+ m_shortName = rs.m_shortName;
+ m_iconName = rs.m_iconName;
+ m_stationID = rs.m_stationID;
+}
+
+
+void RadioStation::generateNewStationID()
+{
+ const int buffersize = 32;
+ unsigned char buffer[buffersize];
+
+ TQString stime, srandom = TQString();
+ stime.setNum(time(NULL));
+
+ int fd = open (dev_urandom_radiostations, O_RDONLY);
+ read(fd, buffer, buffersize);
+ close(fd);
+ for (int i = 0; i < buffersize; ++i)
+ srandom += TQString().sprintf("%02X", (unsigned int)buffer[i]);
+
+ m_stationID = stime + srandom;
+}
+
+
+RadioStation const *RadioStation::getStationClass(const TQString &classname)
+{
+ if (stationClassRegistry)
+ return stationClassRegistry->find(classname);
+ else
+ return NULL;
+}
+
+
+bool RadioStation::setProperty(const TQString &pn, const TQString &val)
+{
+ bool retval = false;
+ if (pn == StationIDElement) {
+ m_stationID = val;
+ retval = true;
+ } else if (pn == StationNameElement) {
+ m_name = val;
+ retval = true;
+ } else if (pn == StationShortNameElement) {
+ m_shortName = val;
+ retval = true;
+ } else if (pn == StationIconStringElement) {
+ m_iconName = val;
+ retval = true;
+ } else if (pn == StationVolumePresetElement) {
+ float x = val.toFloat(&retval);
+ if (retval)
+ m_initialVolume = x;
+ }
+ return retval;
+}
+
+
+TQString RadioStation::getProperty(const TQString &pn) const
+{
+ if (pn == StationIDElement) {
+ return m_stationID;
+ } else if (pn == StationNameElement) {
+ return m_name;
+ } else if (pn == StationShortNameElement) {
+ return m_shortName;
+ } else if (pn == StationIconStringElement) {
+ return m_iconName;
+ } else if (pn == StationVolumePresetElement) {
+ return TQString().setNum(m_initialVolume);
+ } else {
+ return TQString();
+ }
+}
+
+
+TQStringList RadioStation::getPropertyNames() const
+{
+ TQStringList l;
+ l.push_back(StationIDElement);
+ l.push_back(StationNameElement);
+ l.push_back(StationShortNameElement);
+ l.push_back(StationIconStringElement);
+ l.push_back(StationVolumePresetElement);
+ return l;
+}
+
+bool RadioStation::operator == (const RadioStation &x) const
+{
+ return m_stationID == x.m_stationID &&
+ m_name == x.m_name &&
+ m_shortName == x.m_shortName &&
+ m_initialVolume == x.m_initialVolume &&
+ m_iconName == x.m_iconName;
+}
+
+/////////////////////////////////////////////////////////////////////////
+
+int UndefinedRadioStation::compare(const RadioStation &_s) const
+{
+ UndefinedRadioStation const *s = dynamic_cast<UndefinedRadioStation const*>(&_s);
+
+ if (!s)
+ return -1;
+
+ return 0;
+
+}
+
+
+RadioStationConfig *UndefinedRadioStation::createEditor() const
+{
+ return new UndefinedRadioStationConfig(NULL);
+}
diff --git a/src/ringbuffer.cpp b/src/ringbuffer.cpp
new file mode 100644
index 0000000..7609768
--- /dev/null
+++ b/src/ringbuffer.cpp
@@ -0,0 +1,173 @@
+/***************************************************************************
+ ringbuffer.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/ringbuffer.h"
+#include <string.h>
+
+RingBuffer::RingBuffer(size_t size)
+{
+ m_Buffer = new char [size];
+ m_Size = size;
+ m_FillSize = 0;
+ m_Start = 0;
+}
+
+
+RingBuffer::~RingBuffer()
+{
+ delete[] m_Buffer;
+ m_Buffer = NULL;
+ m_Size = 0;
+}
+
+
+bool RingBuffer::resize(size_t new_size)
+{
+ if (new_size >= m_FillSize && new_size > 0) {
+ char *newBuffer = new char[new_size];
+ size_t newFill = 0;
+ while (m_FillSize > 0)
+ newFill += takeData(newBuffer + newFill, m_FillSize);
+
+ delete[] m_Buffer;
+
+ m_FillSize = newFill;
+ m_Start = 0;
+ m_Buffer = newBuffer;
+ m_Size = new_size;
+ return true;
+ }
+ return false;
+}
+
+
+size_t RingBuffer::addData (const char *src, size_t size)
+{
+ size_t written = 0;
+ if (m_Start + m_FillSize < m_Size) {
+ size_t rest = m_Size - m_Start - m_FillSize;
+ if (rest > size)
+ rest = size;
+ memmove (m_Buffer + m_Start + m_FillSize, src, rest);
+ m_FillSize += rest;
+ written += rest;
+ size -= rest;
+ src += rest;
+ }
+ if (size > 0 && m_FillSize < m_Size) {
+ size_t rest = size;
+ if (rest > m_Size - m_FillSize)
+ rest = m_Size - m_FillSize;
+ memmove(m_Buffer + m_Start + m_FillSize - m_Size, src, rest);
+ m_FillSize += rest;
+ written += rest;
+ }
+ return written;
+}
+
+
+size_t RingBuffer::takeData(char *dst, size_t size)
+{
+ size_t read = 0;
+ while (m_FillSize > 0 && size > 0) {
+ size_t n = size;
+ if (n > m_FillSize)
+ n = m_FillSize;
+ if (n > m_Size - m_Start)
+ n = m_Size - m_Start;
+ memmove (dst, m_Buffer + m_Start, n);
+ m_FillSize -= n;
+ m_Start += n;
+ read += n;
+ size -= n;
+ if (m_Start >= m_Size)
+ m_Start -= m_Size;
+
+ }
+ return read;
+}
+
+
+char *RingBuffer::getFreeSpace(size_t &size)
+{
+ if (m_FillSize == m_Size) {
+ size = 0;
+ return NULL;
+ }
+
+ if (m_Start + m_FillSize >= m_Size) {
+ size = m_Size - m_FillSize;
+ return m_Buffer + m_Start + m_FillSize - m_Size;
+ } else {
+ size = m_Size - m_Start - m_FillSize;
+ return m_Buffer + m_Start + m_FillSize;
+ }
+}
+
+
+size_t RingBuffer::removeFreeSpace(size_t size)
+{
+ if (m_FillSize == m_Size)
+ return 0;
+
+ if (m_Start + m_FillSize >= m_Size) {
+ if (size > m_Size - m_FillSize)
+ size = m_Size - m_FillSize;
+ m_FillSize += size;
+ return size;
+ } else {
+ if (m_Start + m_FillSize + size >= m_Size)
+ size = m_Size - m_Start - m_FillSize;
+ m_FillSize += size;
+ return size;
+ }
+}
+
+
+char *RingBuffer::getData(size_t &size)
+{
+ if (m_Start + m_FillSize >= m_Size) {
+ size = m_Size - m_Start;
+ } else {
+ size = m_FillSize;
+ }
+ return m_Buffer + m_Start;
+}
+
+
+size_t RingBuffer::removeData(size_t size)
+{
+ size_t n = 0;
+ if (size > m_FillSize)
+ size = m_FillSize;
+ if (m_Start + size >= m_Size) {
+ n = m_Size - m_Start;
+ m_Start = 0;
+ } else {
+ m_Start += size;
+ n = size;
+ }
+ m_FillSize -= n;
+ return n;
+}
+
+
+void RingBuffer::clear()
+{
+ m_Start = 0;
+ m_FillSize = 0;
+}
diff --git a/src/seekhelper.cpp b/src/seekhelper.cpp
new file mode 100644
index 0000000..eab7c1a
--- /dev/null
+++ b/src/seekhelper.cpp
@@ -0,0 +1,134 @@
+/***************************************************************************
+ seekhelper.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/seekhelper.h"
+
+#include <kdebug.h>
+
+SeekHelper::SeekHelper(ISeekRadio &parent)
+ : m_state(off),
+ m_parent(parent),
+ m_SoundStreamID(SoundStreamID::InvalidID)
+{
+}
+
+
+SeekHelper::~SeekHelper()
+{
+}
+
+
+bool SeekHelper::connectI (Interface *i)
+{
+ bool a = IRadioDeviceClient::connectI(i);
+ bool b = ISoundStreamClient::connectI(i);
+ return a || b;
+}
+
+
+bool SeekHelper::disconnectI(Interface *i)
+{
+ bool a = IRadioDeviceClient::disconnectI(i);
+ bool b = ISoundStreamClient::disconnectI(i);
+ return a || b;
+}
+
+
+void SeekHelper::start(const SoundStreamID &id, direction_t dir)
+{
+ m_SoundStreamID = id;
+ if (m_state == off) {
+ getData();
+ m_state = isGood() ? searchWorse : searchBest;
+ m_direction = dir;
+
+ queryIsMuted(m_SoundStreamID, m_oldMute);
+ sendMute(m_SoundStreamID, true);
+
+ m_parent.notifySeekStarted(m_direction == up);
+
+ step();
+ }
+}
+
+
+void SeekHelper::stop ()
+{
+ if (m_state != off) {
+ m_state = off;
+ abort();
+ sendMute(m_SoundStreamID, m_oldMute);
+ m_parent.notifySeekStopped();
+ m_SoundStreamID = SoundStreamID::InvalidID;
+ }
+}
+
+
+void SeekHelper::finish ()
+{
+ if (m_state != off) {
+ applyBest();
+ const RadioStation &rs = queryCurrentStation();
+
+ stop();
+ m_parent.notifySeekFinished(rs, isGood());
+ }
+}
+
+
+void SeekHelper::step ()
+{
+ if (m_state == off)
+ return;
+
+ getData();
+
+ switch (m_state) {
+
+ case off : break;
+
+ case searchWorse :
+ if (isWorse())
+ m_state = searchBest;
+
+ if (! nextSeekStep()) {
+ stop();
+ }
+
+ break;
+
+ case searchBest :
+ if (isWorse() && bestFound()) {
+ finish();
+ } else {
+ if (isBetter() && isGood()) {
+ rememberBest();
+ }
+ if (! nextSeekStep()) {
+ if (isGood() && bestFound()) {
+ finish();
+ } else {
+ stop();
+ }
+ }
+ }
+ break;
+ }
+}
+
+
+
diff --git a/src/soundformat.cpp b/src/soundformat.cpp
new file mode 100644
index 0000000..57f9aa1
--- /dev/null
+++ b/src/soundformat.cpp
@@ -0,0 +1,270 @@
+/***************************************************************************
+ soundformat.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/soundformat.h"
+
+int SoundFormat::sampleSize() const
+{
+ if (m_SampleBits <= 8) return 1;
+ if (m_SampleBits <= 16) return 2;
+ if (m_SampleBits <= 32) return 4;
+
+ // unknown
+ return -1;
+}
+
+
+int SoundFormat::frameSize() const
+{
+ return sampleSize() * m_Channels;
+}
+
+
+int SoundFormat::minValue() const
+{
+ if (!m_IsSigned) return 0;
+ return -(1 << (m_SampleBits - 1));
+}
+
+
+int SoundFormat::maxValue() const
+{
+ return (1 << (m_SampleBits - m_IsSigned)) - 1;
+}
+
+
+void SoundFormat::restoreConfig(const TQString &prefix, TDEConfig *c)
+{
+ m_SampleBits = c->readNumEntry (prefix + "bits", 16);
+ m_IsSigned = c->readBoolEntry(prefix + "sign", true);
+ m_Channels = c->readNumEntry (prefix + "channels", 2);
+ m_SampleRate = c->readNumEntry (prefix + "samplerate", 44100);
+ bool littleEndian = c->readBoolEntry(prefix + "littleEndian", true);
+ m_Endianess = littleEndian ? LITTLE_ENDIAN : BIG_ENDIAN;
+ m_Encoding = c->readEntry(prefix + "encoding", "raw");
+}
+
+
+void SoundFormat::saveConfig(const TQString &prefix, TDEConfig *c) const
+{
+ c->writeEntry(prefix + "bits", m_SampleBits);
+ c->writeEntry(prefix + "sign", m_IsSigned);
+ c->writeEntry(prefix + "channels", m_Channels);
+ c->writeEntry(prefix + "samplerate", m_SampleRate);
+ c->writeEntry(prefix + "littleEndian", m_Endianess == LITTLE_ENDIAN);
+ c->writeEntry(prefix + "encoding", m_Encoding);
+}
+
+
+int SoundFormat::convertSampleToInt(const char *sample, bool do_scale) const
+{
+ int size = sampleSize();
+
+ unsigned val = 0;
+ if (m_Endianess == LITTLE_ENDIAN) {
+ sample = sample + size - 1;
+ for (int i = size - 1; i >= 0; --i, --sample) {
+ val = (val << 8) | (unsigned char)*sample;
+ }
+ } else {
+ for (int i = 0; i < size; ++i, ++sample) {
+ val = (val << 8) | (unsigned char)*sample;
+ }
+ }
+
+ int scale = (sizeof(unsigned) << 3) - m_SampleBits;
+ int signmask = do_scale ? (!m_IsSigned << ((sizeof(unsigned) << 3) - 1)) :
+ (-m_IsSigned << ((size << 3) - 1)) ;
+ if (do_scale) {
+ // map to int number space
+ return (val << scale) ^ signmask;
+ } else {
+ // do only sign extension
+ if (val & signmask)
+ val |= signmask;
+ return val;
+ }
+}
+
+
+void SoundFormat::convertIntToSample(int src, char *dst, bool is_scaled) const
+{
+ int size = sampleSize();
+ int scale = (sizeof(unsigned) * 8) - m_SampleBits;
+ int signmask = (!m_IsSigned << (sizeof(unsigned) * 8 - 1));
+
+ unsigned val = is_scaled ? (src ^ signmask) >> scale : src;
+ if (m_Endianess == LITTLE_ENDIAN) {
+ for (int i = 0; i < size; ++i, ++dst) {
+ (unsigned char &)*dst = val & 0xFF;
+ val >>= 8;
+ }
+ } else {
+ dst = dst - 1 + size;
+ for (int i = size - 1; i >= 0; --i, --dst) {
+ (unsigned char &)*dst = val & 0xFF;
+ val >>= 8;
+ }
+ }
+}
+
+
+void SoundFormat::convertSamplesToInts(const char *src, int *dst, size_t n, bool do_scale) const
+{
+ int size = sampleSize();
+ int scale = (sizeof(unsigned) * 8) - m_SampleBits;
+ int signmask = do_scale ? (!m_IsSigned << ((sizeof(unsigned) << 3) - 1)) :
+ (-m_IsSigned << ((size << 3) - 1)) ;
+ if (m_Endianess == LITTLE_ENDIAN) {
+ src = src - 1 + (size * n);
+ int *end = dst;
+ for (dst = dst - 1 + n; dst >= end; --dst) {
+ unsigned val = 0;
+ for (int i = size - 1; i >= 0; --i, --src) {
+ val = (val << 8) | (unsigned char)*src;
+ }
+ if (do_scale) {
+ *dst = (val << scale) ^ signmask;
+ } else if (val & signmask) {
+ *dst = val | signmask;
+ }
+ }
+ } else {
+ for (int *end = dst + n; dst < end; ++dst) {
+ unsigned val = 0;
+ for (int i = 0; i < size; ++i, ++src) {
+ val = (val << 8) | (unsigned char)*src;
+ }
+ if (do_scale) {
+ *dst = (val << scale) ^ signmask;
+ } else if (val & signmask) {
+ *dst = val | signmask;
+ }
+ }
+ }
+}
+
+
+void SoundFormat::convertIntsToSamples(const int *src, char *dst, size_t n, bool is_scaled) const
+{
+ int size = sampleSize();
+ int scale = (sizeof(unsigned) * 8) - m_SampleBits;
+ int signmask = (!m_IsSigned << (sizeof(unsigned) * 8 - 1));
+
+ if (m_Endianess == LITTLE_ENDIAN) {
+ for (const int *end = src+n; src < end; ++src) {
+ unsigned val = is_scaled ? ((unsigned)(*src ^ signmask)) >> scale : *src;
+ for (int i = 0; i < size; ++i, ++dst) {
+ (unsigned char &)*dst = val & 0xFF;
+ val >>= 8;
+ }
+ }
+ } else {
+ dst = dst - 1 + (size * n);
+ const int *end = src;
+ for (src = src - 1 + n; src >= end; --src) {
+ unsigned val = is_scaled ? ((unsigned)(*src ^ signmask)) >> scale : *src;
+ for (int i = size - 1; i >= 0; --i, --dst) {
+ (unsigned char &)*dst = val & 0xFF;
+ val >>= 8;
+ }
+ }
+ }
+}
+
+
+void SoundFormat::convertSamplesToFloat(const char *_src, float **_dst, size_t n) const
+{
+ int sample_size = sampleSize();
+ int frame_size = frameSize();
+ int scale = (sizeof(short) << 3) - m_SampleBits;
+ int signmask = !m_IsSigned << ((sizeof(short) << 3) - 1);
+ int skip = frame_size - sample_size;
+
+ if (m_Endianess == LITTLE_ENDIAN) {
+ const char *src_ch0_end = _src + frame_size * (n - 1) + sample_size - 1;
+ for (unsigned ch = 0; ch < m_Channels; ++ch) {
+ const char *src = src_ch0_end + sample_size * ch;
+ float *dst = _dst[ch];
+ float *end = dst;
+ for (dst = dst - 1 + n; dst >= end; --dst) {
+ unsigned val = 0;
+ for (int i = sample_size - 1; i >= 0; --i, --src) {
+ val = (val << 8) | (unsigned char)*src;
+ }
+ *dst = (float)(signed short)((val << scale) ^ signmask) / 32768.0f;
+ src = src - skip;
+ }
+ }
+ } else {
+ for (unsigned ch = 0; ch < m_Channels; ++ch) {
+ const char *src = _src + sample_size * ch;
+ float *dst = _dst[ch];
+ for (float *end = dst + n; dst < end; ++dst) {
+ unsigned val = 0;
+ for (int i = 0; i < sample_size; ++i, ++src) {
+ val = (val << 8) | (unsigned char)*src;
+ }
+ *dst = (float)(signed short)((val << scale) ^ signmask) / 32768.0f;
+ src = src + skip;
+ }
+ }
+ }
+}
+
+
+
+void SoundFormat::convertFloatsToSamples(const float **_src, char *_dst, size_t n) const
+{
+ int sample_size = sampleSize();
+ int frame_size = frameSize();
+ int scale = (sizeof(short) << 3) - m_SampleBits;
+ int signmask = (!m_IsSigned << (sizeof(short) << 3) - 1);
+ int skip = frame_size - sample_size;
+
+ if (m_Endianess == LITTLE_ENDIAN) {
+ for (unsigned ch = 0; ch < m_Channels; ++ch) {
+ const float *src = _src[ch];
+ char *dst = _dst + ch * sample_size;
+ for (const float *end = src+n; src < end; ++src) {
+ unsigned val = (( ((unsigned)(*src * 32768.0f)) ^ signmask)) >> scale;
+ for (int i = 0; i < sample_size; ++i, ++dst) {
+ (unsigned char &)*dst = val & 0xFF;
+ val >>= 8;
+ }
+ dst = dst + skip;
+ }
+ }
+ } else {
+ char *dst_ch0_end = _dst + frame_size * (n - 1) + sample_size - 1;
+ for (unsigned ch = 0; ch < m_Channels; ++ch) {
+ char *dst = dst_ch0_end + sample_size * ch;
+ const float *src = _src[ch];
+ const float *end = src;
+ for (src = src - 1 + n; src >= end; --src) {
+ unsigned val = (( ((unsigned)(*src * 32768.0f)) ^ signmask)) >> scale;
+ for (int i = sample_size - 1; i >= 0; --i, --dst) {
+ (unsigned char &)*dst = val & 0xFF;
+ val >>= 8;
+ }
+ dst = dst - skip;
+ }
+ }
+ }
+}
+
+
diff --git a/src/soundstreamclient_interfaces.cpp b/src/soundstreamclient_interfaces.cpp
new file mode 100644
index 0000000..fd4822c
--- /dev/null
+++ b/src/soundstreamclient_interfaces.cpp
@@ -0,0 +1,426 @@
+/***************************************************************************
+ sounddevice_interfaces.cpp - description
+ -------------------
+ begin : Mon Mr 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/soundstreamclient_interfaces.h"
+
+#include <unistd.h>
+#include <time.h>
+#include <fcntl.h>
+
+const char *dev_urandom = "/dev/urandom";
+
+////////////////////////////////////////////
+
+void ISoundStreamServer::noticeConnectedI(cmplInterface *i, bool pointer_valid)
+{
+ for (TQPtrListIterator<cmplInterface> it(iConnections); it.current(); ++it) {
+ it.current()->noticeConnectedSoundClient(i, pointer_valid);
+ cmplInterface *x = it.current();
+ if (x != i && pointer_valid)
+ i->noticeConnectedSoundClient(x, x->isThisInterfacePointerValid());
+ }
+}
+
+void ISoundStreamServer::noticeDisconnectedI(cmplInterface *i, bool pointer_valid)
+{
+ for (TQPtrListIterator<cmplInterface> it(iConnections); it.current(); ++it) {
+ it.current()->noticeDisconnectedSoundClient(i, pointer_valid);
+ cmplInterface *x = it.current();
+ if (x != i && pointer_valid)
+ i->noticeDisconnectedSoundClient(x, x->isThisInterfacePointerValid());
+ }
+}
+
+
+
+TQPtrList<ISoundStreamClient> ISoundStreamServer::getPlaybackMixers() const
+{
+ TQPtrList<ISoundStreamClient> tmp;
+ for (TQPtrListIterator<ISoundStreamClient> it(iConnections); it.current(); ++it) {
+ if (it.current()->supportsPlayback())
+ tmp.append(it.current());
+ }
+ return tmp;
+}
+
+TQPtrList<ISoundStreamClient> ISoundStreamServer::getCaptureMixers() const
+{
+ TQPtrList<ISoundStreamClient> tmp;
+ for (TQPtrListIterator<ISoundStreamClient> it(iConnections); it.current(); ++it) {
+ if (it.current()->supportsCapture())
+ tmp.append(it.current());
+ }
+ return tmp;
+}
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, sendPlaybackVolume, (SoundStreamID id, float volume),
+ setPlaybackVolume(id, volume) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, sendCaptureVolume, (SoundStreamID id, float volume),
+ setCaptureVolume(id, volume) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, queryPlaybackVolume, (SoundStreamID id, float &volume),
+ getPlaybackVolume(id, volume) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, queryCaptureVolume, (SoundStreamID id, float &volume),
+ getCaptureVolume(id, volume) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, notifyPlaybackVolumeChanged, (SoundStreamID id, float volume),
+ noticePlaybackVolumeChanged(id, volume) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, notifyCaptureVolumeChanged, (SoundStreamID id, float volume),
+ noticeCaptureVolumeChanged(id, volume) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, sendReleasePlayback, (SoundStreamID id),
+ releasePlayback(id) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, sendReleaseCapture, (SoundStreamID id),
+ releaseCapture(id) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, sendStartPlayback, (SoundStreamID id),
+ startPlayback(id) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, sendPausePlayback, (SoundStreamID id),
+ pausePlayback(id) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, sendStopPlayback, (SoundStreamID id),
+ stopPlayback(id) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, queryIsPlaybackRunning, (SoundStreamID id, bool &b),
+ isPlaybackRunning(id, b) );
+
+//IF_IMPL_SENDER_FINE ( ISoundStreamServer, sendStartCapture, (SoundStreamID id),
+// startCapture(id) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, sendStartCaptureWithFormat, (SoundStreamID id, const SoundFormat &proposed_format, SoundFormat &real_format, bool force_format),
+ startCaptureWithFormat(id, proposed_format, real_format, force_format) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, sendStopCapture, (SoundStreamID id),
+ stopCapture(id) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, queryIsCaptureRunning, (SoundStreamID id, bool &b, SoundFormat &sf),
+ isCaptureRunning(id, b, sf) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, sendStartRecording, (SoundStreamID id),
+ startRecording(id) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, sendStartRecordingWithFormat, (SoundStreamID id, const SoundFormat &proposed_format, SoundFormat &real_format),
+ startRecordingWithFormat(id, proposed_format, real_format) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, sendStopRecording, (SoundStreamID id),
+ stopRecording(id) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, queryIsRecordingRunning, (SoundStreamID id, bool &b, SoundFormat &sf),
+ isRecordingRunning(id, b, sf) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, notifySoundStreamCreated, (SoundStreamID id),
+ noticeSoundStreamCreated(id) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, notifySoundStreamClosed, (SoundStreamID id),
+ noticeSoundStreamClosed(id) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, notifySoundStreamRedirected, (SoundStreamID oldID, SoundStreamID newID),
+ noticeSoundStreamRedirected(oldID, newID) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, notifySoundStreamChanged, (SoundStreamID id),
+ noticeSoundStreamChanged(id) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, notifySoundStreamData, (SoundStreamID id, const SoundFormat &format, const char *data, size_t size, size_t &consumed_size, const SoundMetaData &md),
+ noticeSoundStreamData(id, format, data, size, consumed_size, md) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, notifyReadyForPlaybackData, (SoundStreamID id, size_t size),
+ noticeReadyForPlaybackData(id, size) );
+
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, notifyTrebleChanged, (SoundStreamID id, float v),
+ noticeTrebleChanged(id, v) );
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, notifyBassChanged, (SoundStreamID id, float v),
+ noticeBassChanged(id, v) );
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, notifyBalanceChanged, (SoundStreamID id, float v),
+ noticeBalanceChanged(id, v) );
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, notifyMuted, (SoundStreamID id, bool m),
+ noticeMuted(id, m) );
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, notifySignalQualityChanged, (SoundStreamID id, float q),
+ noticeSignalQualityChanged(id, q) );
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, notifySignalQualityBoolChanged, (SoundStreamID id, bool good),
+ noticeSignalQualityChanged(id, good) );
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, notifySignalMinQualityChanged, (SoundStreamID id, float q),
+ noticeSignalMinQualityChanged(id, q) );
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, notifyStereoChanged, (SoundStreamID id, bool s),
+ noticeStereoChanged(id, s) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, sendTreble , (SoundStreamID id, float v),
+ setTreble(id, v) );
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, sendBass , (SoundStreamID id, float v),
+ setBass(id, v) );
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, sendBalance , (SoundStreamID id, float v),
+ setBalance(id, v) );
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, sendMute , (SoundStreamID id, bool mute),
+ mute(id, mute) );
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, sendUnmute , (SoundStreamID id, bool unmute),
+ unmute(id, unmute) );
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, sendSignalMinQuality , (SoundStreamID id, float q),
+ setSignalMinQuality(id, q) );
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, sendStereo, (SoundStreamID id, bool s),
+ setStereo(id, s) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, queryTreble, (SoundStreamID id, float &v),
+ getTreble(id, v) );
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, queryBass, (SoundStreamID id, float &v),
+ getBass(id, v) );
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, queryBalance, (SoundStreamID id, float &v),
+ getBalance(id, v) );
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, querySignalQuality, (SoundStreamID id, float &q),
+ getSignalQuality(id, q) );
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, querySignalMinQuality, (SoundStreamID id, float &q),
+ getSignalMinQuality(id, q) );
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, queryHasGoodQuality, (SoundStreamID id, bool &good),
+ hasGoodQuality(id, good) );
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, queryIsStereo, (SoundStreamID id, bool &s),
+ isStereo(id, s) );
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, queryIsMuted, (SoundStreamID id, bool &m),
+ isMuted(id, m) );
+
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, notifyPlaybackChannelsChanged, (const TQString &client_id, const TQStringList &map),
+ noticePlaybackChannelsChanged(client_id, map) );
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, notifyCaptureChannelsChanged, (const TQString &client_id, const TQStringList &map),
+ noticeCaptureChannelsChanged (client_id, map) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, querySoundStreamDescription, (SoundStreamID id, TQString &descr),
+ getSoundStreamDescription(id, descr) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, querySoundStreamRadioStation, (SoundStreamID id, const RadioStation *&rs),
+ getSoundStreamRadioStation(id, rs) );
+
+IF_IMPL_SENDER_FINE ( ISoundStreamServer, queryEnumerateSoundStreams, (TQMap<TQString, SoundStreamID> &list),
+ enumerateSoundStreams(list) );
+
+
+
+
+////////////////////////////////////////////
+
+
+ISoundStreamClient::ISoundStreamClient()
+ : BaseClass(1),
+ m_Server(NULL)
+{
+ setSoundStreamClientID(createNewSoundStreamClientID());
+}
+
+
+ISoundStreamClient::~ISoundStreamClient()
+{
+}
+
+TQString ISoundStreamClient::createNewSoundStreamClientID()
+{
+ const int buffersize = 32;
+ unsigned char buffer[buffersize];
+
+ TQString stime, srandom = TQString();
+ stime.setNum(time(NULL));
+
+ int fd = open (dev_urandom, O_RDONLY);
+ read(fd, buffer, buffersize);
+ close(fd);
+ for (int i = 0; i < buffersize; ++i)
+ srandom += TQString().sprintf("%02X", (unsigned int)buffer[i]);
+
+ return stime + srandom;
+}
+
+
+
+void ISoundStreamClient::setSoundStreamClientID(const TQString &s)
+{
+ ISoundStreamServer *server = getSoundStreamServer();
+ if (server)
+ server->noticeDisconnectedI(this, true);
+ m_SoundStreamClientID = s;
+ if (server)
+ server->noticeConnectedI(this, true);
+}
+
+
+const TQString &ISoundStreamClient::getSoundStreamClientID() const
+{
+ return m_SoundStreamClientID;
+}
+
+
+
+void ISoundStreamClient::noticeConnectedI(cmplInterface *i, bool valid)
+{
+ if (valid && i)
+ m_Server = i;
+}
+
+void ISoundStreamClient::noticeDisconnectedI(cmplInterface *i, bool /*valid*/)
+{
+ if (i == m_Server) {
+ m_Server = NULL;
+ }
+}
+
+
+SoundStreamID ISoundStreamClient::createNewSoundStream(bool notify) const
+{
+ SoundStreamID x = SoundStreamID::createNewID();
+ if (iConnections.count() && notify)
+ iConnections.getFirst()->notifySoundStreamCreated(x);
+ return x;
+}
+
+
+SoundStreamID ISoundStreamClient::createNewSoundStream(SoundStreamID old_id, bool notify) const
+{
+ SoundStreamID x = SoundStreamID::createNewID(old_id);
+ if (iConnections.count() && notify)
+ iConnections.getFirst()->notifySoundStreamCreated(x);
+ return x;
+}
+
+
+void ISoundStreamClient::closeSoundStream(SoundStreamID id, bool notify)
+{
+ if (iConnections.count() && notify)
+ iConnections.getFirst()->notifySoundStreamClosed(id);
+}
+
+
+static const TQStringList emptyList;
+
+const TQStringList &ISoundStreamClient::getPlaybackChannels() const
+{
+ return emptyList;
+}
+
+
+const TQStringList &ISoundStreamClient::getCaptureChannels() const
+{
+ return emptyList;
+}
+
+
+static const TQMap<TQString, ISoundStreamClient *> emptyClientMap;
+TQMap<TQString, ISoundStreamClient *> ISoundStreamClient::getPlaybackClients() const
+{
+ return iConnections.count() ? iConnections.getFirst()->getPlaybackClients() : emptyClientMap;
+}
+
+TQMap<TQString, ISoundStreamClient *> ISoundStreamServer::getPlaybackClients() const
+{
+ TQMap<TQString, ISoundStreamClient *> map;
+ for (TQPtrListIterator<ISoundStreamClient> it(ISoundStreamServer::iConnections); it.current(); ++it) {
+ if (it.current()->supportsPlayback())
+ map.insert(it.current()->getSoundStreamClientID(), it.current());
+ }
+ return map;
+}
+
+
+
+static const TQMap<TQString, TQString> emptyClientDescrMap;
+TQMap<TQString, TQString> ISoundStreamClient::getPlaybackClientDescriptions() const
+{
+ return iConnections.count() ? iConnections.getFirst()->getPlaybackClientDescriptions() : emptyClientDescrMap;
+}
+
+TQMap<TQString, TQString> ISoundStreamServer::getPlaybackClientDescriptions() const
+{
+ TQMap<TQString, TQString> map;
+ for (TQPtrListIterator<ISoundStreamClient> it(ISoundStreamServer::iConnections); it.current(); ++it) {
+ if (it.current()->supportsPlayback())
+ map.insert(it.current()->getSoundStreamClientID(), it.current()->getSoundStreamClientDescription());
+ }
+ return map;
+}
+
+
+
+
+TQMap<TQString, ISoundStreamClient *> ISoundStreamClient::getCaptureClients() const
+{
+ return iConnections.count() ? iConnections.getFirst()->getCaptureClients() : emptyClientMap;
+}
+
+
+TQMap<TQString, ISoundStreamClient *> ISoundStreamServer::getCaptureClients() const
+{
+ TQMap<TQString, ISoundStreamClient *> map;
+ for (TQPtrListIterator<ISoundStreamClient> it(ISoundStreamServer::iConnections); it.current(); ++it) {
+ if (it.current()->supportsCapture())
+ map.insert(it.current()->getSoundStreamClientID(), it.current());
+ }
+ return map;
+}
+
+
+
+
+TQMap<TQString, TQString> ISoundStreamClient::getCaptureClientDescriptions() const
+{
+ return iConnections.count() ? iConnections.getFirst()->getCaptureClientDescriptions() : emptyClientDescrMap;
+}
+
+TQMap<TQString, TQString> ISoundStreamServer::getCaptureClientDescriptions() const
+{
+ TQMap<TQString, TQString> map;
+ for (TQPtrListIterator<ISoundStreamClient> it(ISoundStreamServer::iConnections); it.current(); ++it) {
+ if (it.current()->supportsCapture())
+ map.insert(it.current()->getSoundStreamClientID(), it.current()->getSoundStreamClientDescription());
+ }
+ return map;
+}
+
+
+
+
+
+ISoundStreamClient *ISoundStreamClient::getSoundStreamClientWithID(const TQString &search_id) const
+{
+ return iConnections.count() ? iConnections.getFirst()->getSoundStreamClientWithID(search_id) : NULL;
+}
+
+ISoundStreamClient *ISoundStreamServer::getSoundStreamClientWithID(const TQString &search_id) const
+{
+ for (TQPtrListIterator<ISoundStreamClient> it(ISoundStreamServer::iConnections); it.current(); ++it) {
+ const TQString &id = it.current()->getSoundStreamClientID();
+ if (id == search_id)
+ return it.current();
+ }
+ return NULL;
+}
+
+void ISoundStreamClient::noticeConnectedSoundClient(thisInterface */*i*/, bool /*pointer_valid*/)
+{
+}
+
+void ISoundStreamClient::noticeDisconnectedSoundClient(thisInterface */*i*/, bool /*pointer_valid*/)
+{
+}
+
+static const TQPtrList<ISoundStreamClient> emptyClientList;
+IF_IMPL_QUERY ( TQPtrList<ISoundStreamClient> ISoundStreamClient::queryPlaybackMixers(),
+ getPlaybackMixers(),
+ emptyClientList );
+
+IF_IMPL_QUERY ( TQPtrList<ISoundStreamClient> ISoundStreamClient::queryCaptureMixers(),
+ getPlaybackMixers(),
+ emptyClientList );
diff --git a/src/soundstreamid.cpp b/src/soundstreamid.cpp
new file mode 100644
index 0000000..1c9cfed
--- /dev/null
+++ b/src/soundstreamid.cpp
@@ -0,0 +1,70 @@
+/***************************************************************************
+ soundstreamid.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/soundstreamid.h"
+
+unsigned SoundStreamID::nextID = 1;
+unsigned SoundStreamID::nextPhysicalID = 1;
+const SoundStreamID SoundStreamID::InvalidID;
+
+SoundStreamID::SoundStreamID()
+ : m_ID(0),
+ m_PhysicalID(0)
+{
+}
+
+
+SoundStreamID::SoundStreamID(int _id, int _phys_id)
+ : m_ID(_id),
+ m_PhysicalID(_phys_id)
+{
+}
+
+
+SoundStreamID::SoundStreamID(const SoundStreamID &org)
+ : m_ID (org.m_ID),
+ m_PhysicalID(org.m_PhysicalID)
+{
+}
+
+
+SoundStreamID &SoundStreamID::operator = (const SoundStreamID &id)
+{
+ m_ID = id.m_ID;
+ m_PhysicalID = id.m_PhysicalID;
+ return *this;
+}
+
+
+SoundStreamID SoundStreamID::createNewID()
+{
+ return SoundStreamID (nextID++, nextPhysicalID++);
+}
+
+
+SoundStreamID SoundStreamID::createNewID(const SoundStreamID &oldID)
+{
+ return SoundStreamID (nextID++, oldID.m_PhysicalID);
+}
+
+
+void SoundStreamID::invalidate()
+{
+ m_ID = 0;
+ m_PhysicalID = 0;
+}
+
diff --git a/src/standardscandialog-ui.ui b/src/standardscandialog-ui.ui
new file mode 100644
index 0000000..394ccfc
--- /dev/null
+++ b/src/standardscandialog-ui.ui
@@ -0,0 +1,136 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>StandardScanDialogUI</class>
+<widget class="TQDialog">
+ <property name="name">
+ <cstring>StandardScanDialogUI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>359</width>
+ <height>104</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Stations search in progress ...</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQProgressBar" row="0" column="0">
+ <property name="name">
+ <cstring>progressBar</cstring>
+ </property>
+ <property name="progress">
+ <number>50</number>
+ </property>
+ <property name="indicatorFollowsStyle">
+ <bool>true</bool>
+ </property>
+ <property name="percentageVisible">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="TQLayoutWidget" row="2" column="0">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer8_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>100</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>70</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="TQLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>labelTimeDescr</cstring>
+ </property>
+ <property name="text">
+ <string>remaining time</string>
+ </property>
+ </widget>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>labelTime</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;p align="right"&gt;nothing here&lt;/p&gt;</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<connections>
+</connections>
+<includes>
+</includes>
+<variables>
+</variables>
+<Q_SLOTS>
+</Q_SLOTS>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/src/standardscandialog.cpp b/src/standardscandialog.cpp
new file mode 100644
index 0000000..32f1138
--- /dev/null
+++ b/src/standardscandialog.cpp
@@ -0,0 +1,183 @@
+/***************************************************************************
+ standardscandialog.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/standardscandialog.h"
+#include "include/radiostation.h"
+
+#include <tqprogressbar.h>
+#include <tqlabel.h>
+#include <tqpushbutton.h>
+
+#include <tdelocale.h>
+
+#include <math.h>
+
+StandardScanDialog::StandardScanDialog(TQWidget *parent)
+ : StandardScanDialogUI(parent, NULL, true),
+ m_count(0),
+ m_running(false),
+ m_oldPowerOn(false),
+ m_oldStation(NULL),
+ m_ignorePower(false)
+{
+ TQObject::connect(buttonCancel, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotCancelDone()));
+}
+
+
+StandardScanDialog::~StandardScanDialog()
+{
+ stop();
+}
+
+bool StandardScanDialog::connectI (Interface *i)
+{
+ bool a = ISeekRadioClient::connectI(i);
+// bool b = IRadioSoundClient::connectI(i);
+ bool c = IRadioClient::connectI(i);
+
+ return a || /*b ||*/ c;
+}
+
+bool StandardScanDialog::disconnectI (Interface *i)
+{
+ bool a = ISeekRadioClient::disconnectI(i);
+// bool b = IRadioSoundClient::disconnectI(i);
+ bool c = IRadioClient::disconnectI(i);
+
+ return a || /*b ||*/ c;
+}
+
+
+void StandardScanDialog::start()
+{
+ if (!m_running) {
+ m_running = true;
+ m_stations.all().clear();
+ m_startTime = TQDateTime::currentDateTime();
+ m_oldPowerOn = queryIsPowerOn();
+ m_oldStation = queryCurrentStation().copy();
+ sendToBeginning();
+ m_ignorePower = true;
+ sendPowerOn();
+ m_ignorePower = false;
+ sendStartSeekUp();
+ }
+}
+
+
+void StandardScanDialog::stop()
+{
+ if (m_running) {
+ m_running = false;
+
+ sendStopSeek();
+ if (!m_oldPowerOn) sendPowerOff();
+ sendActivateStation(*m_oldStation);
+ delete m_oldStation;
+ m_oldStation = NULL;
+ }
+}
+
+
+bool StandardScanDialog::noticePowerChanged(bool on)
+{
+ if (!on && !m_ignorePower) {
+ stop();
+ }
+ return true;
+}
+
+bool StandardScanDialog::noticeSeekStarted (bool /*up*/)
+{
+ return false;
+}
+
+bool StandardScanDialog::noticeSeekFinished (const RadioStation &, bool goodQuality)
+{
+ if (goodQuality) {
+ ++m_count;
+ TQString s;
+ s.setNum(m_count);
+
+ RadioStation *st = queryCurrentStation().copy();
+ if (st->name().isNull()) {
+ st->setName(i18n("new station ") + s);
+ st->setShortName(s);
+ st->generateNewStationID();
+ }
+
+ int oldcount = m_stations.count();
+ m_stations.all().append(st);
+
+ if (oldcount != m_stations.count()) {
+ } else {
+ --m_count;
+ }
+ delete st;
+ }
+
+ if (rint(queryProgress() * 1000) < 1000) { // round to 4 digits
+ if (m_running) sendStartSeekUp();
+ }
+ return true;
+}
+
+bool StandardScanDialog::noticeSeekStopped ()
+{
+ if (rint(queryProgress() * 1000) >= 1000) { // round to 4 digits
+ buttonCancel->setText(i18n("&Done"));
+ stop();
+ }
+ return true;
+}
+
+
+bool StandardScanDialog::noticeProgress (float f)
+{
+ if (!m_running) return true;
+
+ progressBar->setProgress((int)rint(f * 100));
+
+ if (m_running) {
+ int secs = m_startTime.secsTo(TQDateTime::currentDateTime());
+ int ms = (int)rint((1 - f) * (float) secs / f * 1000.0);
+
+ if (ms > 0 && ms < 86400000) // max one day
+ labelTime->setText(i18n("<p align=\"right\">%1</p>").arg(TQTime(0,0).addMSecs(ms).toString()));
+ else
+ labelTime->setText(i18n("unknown"));
+
+ } else {
+ labelTime->setText(i18n("unknown"));
+ }
+ return true;
+}
+
+
+void StandardScanDialog::slotCancelDone()
+{
+ if (m_running) {
+ stop();
+ reject();
+ } else {
+ accept();
+ }
+}
+
+
+
+#include "standardscandialog.moc"
diff --git a/src/station-drag-object.cpp b/src/station-drag-object.cpp
new file mode 100644
index 0000000..29f082c
--- /dev/null
+++ b/src/station-drag-object.cpp
@@ -0,0 +1,93 @@
+/***************************************************************************
+ station-drag-object.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/station-drag-object.h"
+#include "include/errorlog-interfaces.h"
+#include <tdelocale.h>
+
+#define STATION_LIST_MIME_TYPE "multimedia/tderadio-stationids"
+
+StationDragObject::StationDragObject(const TQStringList &stationIDs, TQWidget *dragSource, const char * name)
+ : TQStoredDrag(STATION_LIST_MIME_TYPE, dragSource, name)
+{
+ setStations(stationIDs);
+}
+
+StationDragObject::StationDragObject(TQWidget *dragSource, const char * name)
+ : TQStoredDrag(STATION_LIST_MIME_TYPE, dragSource, name)
+{
+}
+
+
+StationDragObject::~StationDragObject()
+{
+}
+
+const char *StationDragObject::format(int i) const
+{
+ if (i == 0)
+ return STATION_LIST_MIME_TYPE;
+ else
+ return NULL;
+}
+
+
+void StationDragObject::setStations(const TQStringList &stationIDs)
+{
+ TQByteArray tmp;
+ int pos = 0;
+ for (TQValueListConstIterator<TQString> it=stationIDs.begin(); it != stationIDs.end(); ++it) {
+ const TQString &s = *it;
+ tmp.resize(tmp.size()+s.length() + 1);
+ for (unsigned int k = 0; k < s.length(); ++k) {
+ tmp[pos++] = s[k].latin1();
+ }
+ tmp[pos++] = 0;
+ }
+ setEncodedData(tmp);
+}
+
+
+bool StationDragObject::canDecode (const TQMimeSource *e)
+{
+ IErrorLogClient::staticLogDebug(e->format(0));
+ bool retval = (e && e->format(0) == TQString(STATION_LIST_MIME_TYPE));
+ if (retval)
+ IErrorLogClient::staticLogDebug(i18n("canDecode = true"));
+ return retval;
+}
+
+
+bool StationDragObject::decode (const TQMimeSource *e, TQStringList &stationIDs)
+{
+ stationIDs.clear();
+ if (canDecode(e)) {
+ const TQByteArray &tmp = e->encodedData(e->format(0));
+ TQString str = "";
+ for (unsigned int pos = 0; pos < tmp.size(); ++pos) {
+ if (tmp[pos]) {
+ str.append(tmp[pos]);
+ } else {
+ stationIDs.append(str);
+ str = "";
+ }
+ }
+ }
+ return true;
+}
+
+
diff --git a/src/stationlist.cpp b/src/stationlist.cpp
new file mode 100644
index 0000000..b8bed53
--- /dev/null
+++ b/src/stationlist.cpp
@@ -0,0 +1,494 @@
+/***************************************************************************
+ stationlist.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/radiostation.h"
+#include "include/errorlog-interfaces.h"
+#include "include/utils.h"
+#include "include/stationlist.h"
+#include "include/stationlistxmlhandler.h"
+#include "include/tderadioversion.h"
+
+#include <tqstring.h>
+#include <tqfile.h>
+#include <tqiodevice.h>
+#include <tqmessagebox.h>
+#include <tdeio/netaccess.h>
+#include <tdetempfile.h>
+#include <tdelocale.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+const StationList emptyStationList;
+
+//////////////////////////////////////////////////////////////////////////////
+
+RawStationList::RawStationList ()
+{
+ setAutoDelete(true);
+}
+
+
+RawStationList::RawStationList (const RawStationList &sl)
+ : TQPtrList<RadioStation>(sl)
+{
+ setAutoDelete(true);
+}
+
+
+RawStationList::~RawStationList ()
+{
+ clear();
+}
+
+
+TQPtrCollection::Item RawStationList::newItem (TQPtrCollection::Item s)
+{
+ if (s)
+ return ((RadioStation*)s)->copy();
+ else
+ return NULL;
+}
+
+
+void RawStationList::deleteItem (TQPtrCollection::Item s)
+{
+ if (autoDelete())
+ delete (RadioStation*)s;
+}
+
+
+int RawStationList::compareItems(TQPtrCollection::Item a, TQPtrCollection::Item b)
+{
+ if (!a && !b)
+ return 0;
+
+ if (!a)
+ return -1;
+
+ if (!b)
+ return 1;
+
+ return ((RadioStation*)a)->compare(*(RadioStation*)b);
+}
+
+
+bool RawStationList::insert (uint index, const RadioStation * item )
+{
+ if (!item) return false;
+ RadioStation *rs = &stationWithID(item->stationID());
+ bool r = true;
+ if (rs != item) {
+ r = BaseClass::insert(index, item);
+ removeRef(rs);
+ }
+ return r;
+}
+
+
+bool RawStationList::insert (const RadioStation * item )
+{
+ if (!item) return false;
+ int idx = idxWithID(item->stationID());
+ if (idx >= 0) {
+ return replace(idx, item);
+ } else {
+ append(item);
+ return true;
+ }
+}
+
+
+void RawStationList::inSort ( const RadioStation * item )
+{
+ if (!item) return;
+ RadioStation *rs = &stationWithID(item->stationID());
+ if (rs != item) {
+ removeRef(rs);
+ }
+ BaseClass::inSort(item);
+}
+
+
+void RawStationList::prepend ( const RadioStation * item )
+{
+ if (!item) return;
+ RadioStation *rs = &stationWithID(item->stationID());
+ if (rs != item) {
+ removeRef(rs);
+ }
+ BaseClass::prepend(item);
+}
+
+
+void RawStationList::append ( const RadioStation * item )
+{
+ if (!item) return;
+ RadioStation *rs = &stationWithID(item->stationID());
+ if (rs != item) {
+ removeRef(rs);
+ }
+ BaseClass::append(item);
+}
+
+
+bool RawStationList::replace ( uint index, const RadioStation * item )
+{
+ bool r = true;
+ RadioStation *rs = &stationWithID(item->stationID());
+ r = BaseClass::replace(index, item);
+ if (rs != item) {
+ BaseClass::removeRef(rs);
+ }
+ return r;
+}
+
+
+const RadioStation &RawStationList::stationWithID(const TQString &sid) const
+{
+ Iterator it(*this);
+ for (; const RadioStation *s = it.current(); ++it) {
+ if (s->stationID() == sid)
+ return *s;
+ }
+ return (RadioStation &) undefinedRadioStation;
+}
+
+
+RadioStation &RawStationList::stationWithID(const TQString &sid)
+{
+ Iterator it(*this);
+ for (; RadioStation *s = it.current(); ++it) {
+ if (s->stationID() == sid)
+ return *s;
+ }
+ return (RadioStation &) undefinedRadioStation;
+}
+
+
+
+int RawStationList::idxWithID(const TQString &sid) const
+{
+ int i = 0;
+ Iterator it(*this);
+ for (; const RadioStation *s = it.current(); ++it, ++i) {
+ if (s->stationID() == sid)
+ return i;
+ }
+ return -1;
+}
+
+
+bool RawStationList::operator == (const RawStationList &l) const
+{
+ TQPtrListIterator<RadioStation> it1(*this);
+ TQPtrListIterator<RadioStation> it2(l);
+ if (count() != l.count())
+ return false;
+ for (; it1.current() && it2.current(); ++it1, ++it2) {
+ if (**it1 != **it2)
+ return false;
+ }
+ return true;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+StationList::StationList()
+{
+ m_all.setAutoDelete(true);
+}
+
+StationList::StationList(const StationList &sl)
+ : m_all (sl.m_all),
+ m_metaData (sl.m_metaData)
+{
+ m_all.setAutoDelete(true);
+}
+
+
+StationList::~StationList()
+{
+}
+
+
+void StationList::merge(const StationList & other)
+{
+ // merge meta information: honor merge in comment
+
+ StationListMetaData const & metaData = other.metaData();
+
+ if (! m_metaData.comment.isEmpty())
+ m_metaData.comment += "\n";
+
+ m_metaData.lastChange = TQDateTime::currentDateTime();
+
+ if (!metaData.maintainer.isEmpty())
+ m_metaData.maintainer += (count() ? TQString(" / ") : TQString()) + metaData.maintainer;
+
+ if (!metaData.country.isEmpty())
+ m_metaData.country += (count() ? TQString(" / ") : TQString()) + metaData.country;
+
+ if (!metaData.city.isEmpty())
+ m_metaData.city = (count() ? TQString(" / ") : TQString()) + metaData.city;
+
+ if (!metaData.media.isEmpty())
+ m_metaData.media += (count() ? TQString(" / ") : TQString()) + metaData.media;
+
+ if (!metaData.comment.isEmpty())
+ m_metaData.comment += (count() ? TQString(" / ") : TQString()) + metaData.comment;
+ if (count() && other.count())
+ m_metaData.comment += " " + i18n("Contains merged Data");
+
+
+ // merge stations
+
+ TQPtrListIterator<RadioStation> it(other.all());
+ for (RadioStation *s = it.current(); s; s = ++it) {
+ m_all.insert(s);
+ }
+}
+
+
+
+StationList &StationList::operator = (const StationList &other)
+{
+ m_metaData = other.metaData();
+ m_all = other.all();
+ return *this;
+}
+
+
+const RadioStation &StationList::at(int idx) const
+{
+ RawStationList::Iterator it(m_all);
+ it += idx;
+ return it.current() ? *it.current() : (const RadioStation &) undefinedRadioStation;
+}
+
+
+RadioStation &StationList::at(int idx)
+{
+ RawStationList::Iterator it(m_all);
+ it += idx;
+ return it.current() ? *it.current() : (RadioStation &) undefinedRadioStation;
+}
+
+
+const RadioStation &StationList::stationWithID(const TQString &sid) const
+{
+ return m_all.stationWithID(sid);
+}
+
+
+RadioStation &StationList::stationWithID(const TQString &sid)
+{
+ return m_all.stationWithID(sid);
+}
+
+
+bool StationList::readXML (const TQString &dat, const IErrorLogClient &logger, bool enableMessageBox)
+{
+ // FIXME: TODO: error handling
+ TQXmlInputSource source;
+ source.setData(dat);
+ TQXmlSimpleReader reader;
+ StationListXmlHandler handler(logger);
+ reader.setContentHandler (&handler);
+ if (reader.parse(source)) {
+ if (handler.wasCompatMode() && enableMessageBox) {
+ TQMessageBox::information(NULL, "TDERadio",
+ i18n("Probably an old station preset file was read.\n"
+ "You have to rebuild your station selections for "
+ "the quickbar and the docking menu.")
+ );
+ }
+
+ m_all = handler.getStations();
+ m_metaData = handler.getMetaData();
+ return true;
+ } else {
+ logger.logError("StationList::readXML: " + i18n("parsing failed"));
+
+ if (enableMessageBox) {
+ TQMessageBox::warning(NULL, "TDERadio",
+ i18n("Parsing the station preset file failed.\n"
+ "See console output for more details."));
+ }
+ return false;
+ }
+}
+
+
+bool StationList::readXML (const KURL &url, const IErrorLogClient &logger, bool enableMessageBox)
+{
+ TQString tmpfile;
+ if (!TDEIO::NetAccess::download(url, tmpfile, NULL)) {
+ if (enableMessageBox) {
+ logger.logError("StationList::readXML: " +
+ i18n("error downloading preset file %1").arg(url.url()));
+ TQMessageBox::warning(NULL, "TDERadio",
+ i18n("Download of the station preset file at %1 failed.")
+ .arg(url.url()));
+ } else {
+ logger.logWarning("StationList::readXML: " +
+ i18n("error downloading preset file %1").arg(url.url()));
+ }
+ return false;
+ }
+
+ logger.logDebug("StationList::readXML: " +
+ i18n("temporary file: ") + tmpfile);
+
+ TQFile presetFile (tmpfile);
+
+ if (! presetFile.open(IO_ReadOnly)) {
+ logger.logError("StationList::readXML: " +
+ i18n("error opening preset file %1").arg(tmpfile));
+ if (enableMessageBox) {
+ TQMessageBox::warning(NULL, "TDERadio",
+ i18n("Opening of the station preset file at %1 failed.")
+ .arg(tmpfile));
+ }
+ return false;
+ }
+
+ TQString xmlData;
+
+ // make sure that qtextstream is gone when we close presetFile
+ TQString tmp;
+ {
+ TQTextStream ins(&presetFile);
+ tmp = ins.read();
+ }
+
+ presetFile.reset();
+
+ // preset file written with tderadio <= 0.2.x
+ if (tmp.find("<format>") < 0) {
+ logger.logInfo(i18n("Old Preset File Format detected"));
+ TQTextStream ins(&presetFile);
+ ins.setEncoding(TQTextStream::Locale);
+ xmlData = ins.read();
+ }
+ // preset file written with tderadio >= 0.3.0
+ else {
+ TQXmlInputSource tmp(TQT_TQIODEVICE(&presetFile));
+ xmlData = tmp.data();
+ }
+
+ presetFile.close();
+
+ TDEIO::NetAccess::removeTempFile(tmpfile);
+
+ return readXML(xmlData, logger, enableMessageBox);
+}
+
+
+TQString StationList::writeXML (const IErrorLogClient &/*logger*/) const
+{
+ TQString data = TQString();
+
+ // write station list
+
+ TQString t = "\t";
+ TQString tt = "\t\t";
+ TQString ttt = "\t\t\t";
+
+ data += xmlOpenTag(TDERadioConfigElement) +
+ t + xmlOpenTag(StationListElement) +
+ tt + xmlTag(StationListFormat, STATION_LIST_FORMAT) +
+ tt + xmlOpenTag(StationListInfo) +
+ ttt + xmlTag(StationListInfoCreator, "tderadio-" TDERADIO_VERSION) +
+ ttt + xmlTag(StationListInfoMaintainer, m_metaData.maintainer) +
+ ttt + xmlTag(StationListInfoChanged, m_metaData.lastChange.toString(Qt::ISODate)) +
+ ttt + xmlTag(StationListInfoCountry, m_metaData.country) +
+ ttt + xmlTag(StationListInfoCity, m_metaData.city) +
+ ttt + xmlTag(StationListInfoMedia, m_metaData.media) +
+ ttt + xmlTag(StationListInfoComments, m_metaData.comment) +
+ tt + xmlCloseTag (StationListInfo);
+
+ for (RawStationList::Iterator it(m_all); it.current(); ++it) {
+ RadioStation *s = it.current();
+
+ data += tt + xmlOpenTag (s->getClassName());
+
+ TQStringList properties = s->getPropertyNames();
+ TQStringList::iterator end = properties.end();
+ for (TQStringList::iterator sit = properties.begin(); sit != end; ++sit) {
+ data += ttt + xmlTag (*sit, s->getProperty(*sit));
+ }
+ data += tt + xmlCloseTag(s->getClassName());
+
+ }
+
+ data += t + xmlCloseTag(StationListElement) +
+ xmlCloseTag(TDERadioConfigElement);
+
+ return data;
+}
+
+
+bool StationList::writeXML (const KURL &url, const IErrorLogClient &logger, bool enableMessageBox) const
+{
+ KTempFile tmpFile;
+ tmpFile.setAutoDelete(true);
+ TQFile *outf = tmpFile.file();
+
+ TQTextStream outs(outf);
+ outs.setEncoding(TQTextStream::UnicodeUTF8);
+ outs << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
+
+ TQString output = writeXML(logger);
+
+ outs << output;
+ if (outf->status() != IO_Ok) {
+ logger.logError("StationList::writeXML: " +
+ i18n("error writing to tempfile %1").arg(tmpFile.name()));
+ if (enableMessageBox) {
+ TQMessageBox::warning(NULL, "TDERadio",
+ i18n("Writing station preset file %1 failed.")
+ .arg(tmpFile.name()));
+ }
+ return false;
+ }
+
+ // close hopefully flushes buffers ;)
+ outf->close();
+
+ if (count() <= 1) {
+ logger.logWarning("StationList::writeXML: " +
+ i18n("uploading preset file %1: ").arg(url.url()));
+ logger.logWarning("StationList::writeXML: " +
+ i18n("something strange happend, station list has only %1 entries. Writing station preset file skipped").arg(count()));
+ } else {
+
+ if (!TDEIO::NetAccess::upload(tmpFile.name(), url, NULL)) {
+ logger.logError("StationList::writeXML: " +
+ i18n("error uploading preset file %1").arg(url.url()));
+
+ if (enableMessageBox) {
+ TQMessageBox::warning(NULL, "TDERadio",
+ i18n("Upload of station preset file to %1 failed.")
+ .arg(url.url()));
+ }
+ return false;
+ }
+ }
+
+ return true;
+}
diff --git a/src/stationlistxmlhandler.cpp b/src/stationlistxmlhandler.cpp
new file mode 100644
index 0000000..68bcc69
--- /dev/null
+++ b/src/stationlistxmlhandler.cpp
@@ -0,0 +1,230 @@
+/***************************************************************************
+ StationListXmlHandler.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/stationlistxmlhandler.h"
+#include <tdelocale.h>
+
+const char *TDERadioConfigElement = "tderadiorc";
+
+const char *StationListElement = "stationlist";
+const char *compatStationElement = "station";
+
+const char *StationListInfo = "info";
+const char *StationListInfoMaintainer = "maintainer";
+const char *StationListInfoCountry = "country";
+const char *StationListInfoCity = "city";
+const char *StationListInfoMedia = "media";
+const char *StationListInfoComments = "comments";
+const char *StationListInfoChanged = "changed";
+const char *StationListInfoCreator = "creator";
+
+const char *StationListFormat = "format";
+
+
+StationListXmlHandler::StationListXmlHandler (const IErrorLogClient &logger)
+ : m_logger(logger),
+ m_compatMode (false)
+{
+ m_newStation = NULL;
+}
+
+
+StationListXmlHandler::~StationListXmlHandler ()
+{
+}
+
+
+bool StationListXmlHandler::startDocument ()
+{
+ m_status.clear();
+
+ m_stations.clear();
+ clearNewStation();
+
+ return true;
+}
+
+
+
+#define START_ELEMENT_ERROR m_logger.logError("StationListXmlHandler::startElement: " + \
+ i18n("misplaced element %1") \
+ .arg(qname));\
+ return false;
+
+bool StationListXmlHandler::startElement (const TQString &/*ns*/, const TQString &/*localname*/,
+ const TQString& _qname, const TQXmlAttributes &)
+{
+ TQString qname = _qname;
+ if (qname == TDERadioConfigElement) {
+ if (m_status.size()) { START_ELEMENT_ERROR }
+
+ // station list
+ } else if (qname == StationListElement) {
+ if (!m_status.size() || m_status.back() != TDERadioConfigElement) { START_ELEMENT_ERROR }
+ m_stations.clear();
+ clearNewStation();
+
+ } else if (qname == StationListFormat) {
+ if (!m_status.size() || m_status.back() != StationListElement) { START_ELEMENT_ERROR }
+
+ } else if (qname == StationListInfo) {
+ if (!m_status.size() || m_status.back() != StationListElement) { START_ELEMENT_ERROR }
+
+ } else if (qname == StationListInfoMaintainer ||
+ qname == StationListInfoCountry ||
+ qname == StationListInfoCity ||
+ qname == StationListInfoMedia ||
+ qname == StationListInfoComments ||
+ qname == StationListInfoChanged ||
+ qname == StationListInfoCreator
+ )
+ {
+ if (!m_status.size() || m_status.back() != StationListInfo) { START_ELEMENT_ERROR }
+
+ } else if (!m_newStation && m_status.size() && m_status.back() == StationListElement) {
+
+ if (qname == compatStationElement) {
+ qname = "FrequencyRadioStation";
+ m_compatMode = true;
+ }
+
+ const RadioStation *x = RadioStation::getStationClass(qname);
+ m_newStation = x ? x->copy() : NULL;
+
+ if (!m_newStation) { START_ELEMENT_ERROR }
+
+ } else if (m_newStation && m_status.size() && m_status.back() == m_newStation->getClassName()) {
+
+ // check done later when characters arrive
+
+ } else { // unknown
+ m_logger.logWarning("StationListXmlHandler::startElement: " +
+ i18n("unknown or unexpected element %1").arg(qname));
+ }
+
+ m_status.push_back(qname);
+ return true;
+}
+
+
+bool StationListXmlHandler::endElement (const TQString &/*ns*/, const TQString &/*localname*/,
+ const TQString &_qname)
+{
+ TQString qname = _qname;
+ if (qname == compatStationElement) {
+ qname = "FrequencyRadioStation";
+ m_compatMode = true;
+ }
+
+ if (m_status.size() && m_status.back() == qname) {
+
+ if (m_newStation && qname == m_newStation->getClassName()) {
+ m_stations.append(m_newStation);
+ clearNewStation();
+ }
+
+ m_status.pop_back();
+
+ } else {
+ if (m_status.size()) {
+ m_logger.logError("StationListXmlHandler::endElement: " +
+ i18n("expected element %1, but found %2")
+ .arg(m_status.back()).arg(qname));
+ } else {
+ m_logger.logError("StationListXmlHandler::endElement: " +
+ i18n("unexpected element %1").arg(qname));
+ }
+ }
+ return true;
+}
+
+
+#define CHARACTERS_ERROR m_logger.logError("StationListXmlHandler::characters: " + \
+ i18n("invalid data for element %1") \
+ .arg(stat)); \
+ return false;
+
+bool StationListXmlHandler::characters (const TQString &ch)
+{
+ TQString stat = m_status.back();
+ TQString str = ch.stripWhiteSpace();
+
+ // Station parsing
+
+ // information on list
+ if (stat == StationListFormat) {
+
+ if (str != STATION_LIST_FORMAT) {
+ m_logger.logError(i18n("found a station list with unknown format %1").arg(str));
+ return false;
+ }
+
+ } else if (stat == StationListInfo) {
+
+ } else if (stat == StationListInfoMaintainer) {
+
+ m_metaData.maintainer = str;
+
+ } else if (stat == StationListInfoCountry) {
+
+ m_metaData.country = str;
+
+ } else if (stat == StationListInfoCity) {
+
+ m_metaData.city = str;
+
+ } else if (stat == StationListInfoMedia) {
+
+ m_metaData.media = str;
+
+ } else if (stat == StationListInfoComments) {
+
+ m_metaData.comment = str;
+
+ } else if (stat == StationListInfoChanged) {
+
+ m_metaData.lastChange = TQDateTime::fromString(str, Qt::ISODate);
+
+ } else if (stat == StationListInfoCreator) {
+
+ // do nothing
+
+ // stations
+
+ } else if (m_newStation && m_newStation->getClassName() != stat) {
+
+ if (!m_newStation->setProperty(stat, str)) {
+ m_logger.logWarning("StationListXmlHandler::characters: " +
+ i18n("unknown property %1 for class %2")
+ .arg(stat)
+ .arg(m_newStation->getClassName()));
+ }
+
+ } else if (str.length()) {
+ m_logger.logError("StationListXmlHandler::characters: " +
+ i18n("characters ignored for element %1").arg(stat));
+ }
+ return true;
+}
+
+
+void StationListXmlHandler::clearNewStation()
+{
+ if (m_newStation)
+ delete m_newStation;
+ m_newStation = NULL;
+}
diff --git a/src/stationselection_interfaces.cpp b/src/stationselection_interfaces.cpp
new file mode 100644
index 0000000..89d0c3b
--- /dev/null
+++ b/src/stationselection_interfaces.cpp
@@ -0,0 +1,47 @@
+/***************************************************************************
+ stationselection_interfaces.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/stationselection_interfaces.h"
+#include <tqstringlist.h>
+
+IF_IMPL_SENDER ( IStationSelection::notifyStationSelectionChanged(const TQStringList &sl),
+ noticeStationSelectionChanged(sl)
+ )
+
+IF_IMPL_SENDER ( IStationSelectionClient::sendStationSelection(const TQStringList &sl),
+ setStationSelection(sl)
+ )
+
+static TQStringList IStationSelectionClient_emptyList;
+
+IF_IMPL_QUERY ( const TQStringList & IStationSelectionClient::queryStationSelection(),
+ getStationSelection(),
+ IStationSelectionClient_emptyList
+ )
+
+
+void IStationSelectionClient::noticeConnectedI (cmplInterface *, bool /*pointer_valid*/)
+{
+ noticeStationSelectionChanged(queryStationSelection());
+}
+
+
+void IStationSelectionClient::noticeDisconnectedI (cmplInterface *, bool /*pointer_valid*/)
+{
+ noticeStationSelectionChanged(queryStationSelection());
+}
+
diff --git a/src/stationselector-ui.ui b/src/stationselector-ui.ui
new file mode 100644
index 0000000..3020fe5
--- /dev/null
+++ b/src/stationselector-ui.ui
@@ -0,0 +1,171 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>StationSelectorUI</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>StationSelectorUI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>277</width>
+ <height>109</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>StationSelectorUI</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQLabel" row="0" column="2">
+ <property name="name">
+ <cstring>labelSelected</cstring>
+ </property>
+ <property name="text">
+ <string>Selected Stations</string>
+ </property>
+ </widget>
+ <widget class="RadioStationListView" row="1" column="0">
+ <property name="name">
+ <cstring>listAvailable</cstring>
+ </property>
+ <property name="acceptDrops">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="RadioStationListView" row="1" column="2">
+ <property name="name">
+ <cstring>listSelected</cstring>
+ </property>
+ <property name="acceptDrops">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="TQLayoutWidget" row="1" column="1">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonToRight</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="iconSet">
+ <iconset>"2rightarrow"</iconset>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonToLeft</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="iconSet">
+ <iconset>"2leftarrow"</iconset>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>labelAvailable</cstring>
+ </property>
+ <property name="text">
+ <string>Available Stations</string>
+ </property>
+ </widget>
+ <spacer row="0" column="1">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Minimum</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>10</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>RadioStationListView</class>
+ <header location="local">radiostation-listview.h</header>
+ <sizehint>
+ <width>-1</width>
+ <height>-1</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="XBM.GZ" length="79">789c534e494dcbcc4b554829cdcdad8c2fcf4c29c95030e0524611cd48cd4ccf28010a1797249664262b2467241641a592324b8aa363156c15aab914146aadb90067111b1f</data>
+ </image>
+</images>
+<pixmapfunction>SmallIconSet</pixmapfunction>
+<layoutdefaults spacing="6" margin="11"/>
+<includes>
+ <include location="global" impldecl="in implementation">kiconloader.h</include>
+ <include location="global" impldecl="in implementation">kpushbutton.h</include>
+ <include location="global" impldecl="in implementation">radiostation-listview.h</include>
+</includes>
+</UI>
diff --git a/src/stationselector.cpp b/src/stationselector.cpp
new file mode 100644
index 0000000..d604ea8
--- /dev/null
+++ b/src/stationselector.cpp
@@ -0,0 +1,321 @@
+/***************************************************************************
+ stationselector.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+using namespace std;
+
+#include <kpushbutton.h>
+#include <algorithm>
+
+#include "include/stationlist.h"
+#include "include/radiostation.h"
+
+#include "include/stationselector.h"
+#include "include/radiostation-listview.h"
+
+StationSelector::StationSelector (TQWidget *parent)
+ : StationSelectorUI(parent),
+ m_dirty(true)
+{
+ TQObject::connect(buttonToLeft, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotButtonToLeft()));
+ TQObject::connect(buttonToRight, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotButtonToRight()));
+ TQObject::connect(listAvailable, TQT_SIGNAL(sigStationsReceived(const TQStringList&)), this, TQT_SLOT(slotMoveToLeft(const TQStringList&)));
+ TQObject::connect(listSelected, TQT_SIGNAL(sigStationsReceived(const TQStringList&)), this, TQT_SLOT(slotMoveToRight(const TQStringList&)));
+
+ listSelected->setSelectionMode(TQListView::Extended);
+ listAvailable->setSelectionMode(TQListView::Extended);
+}
+
+
+StationSelector::~StationSelector ()
+{
+}
+
+
+bool StationSelector::connectI(Interface *i)
+{
+ bool a = IStationSelectionClient::connectI(i);
+ bool b = IRadioClient::connectI(i);
+ return a || b;
+}
+
+
+bool StationSelector::disconnectI(Interface *i)
+{
+ bool a = IStationSelectionClient::disconnectI(i);
+ bool b = IRadioClient::disconnectI(i);
+ return a || b;
+}
+
+
+bool StationSelector::noticeStationSelectionChanged(const TQStringList &sl)
+{
+ m_stationIDsNotDisplayed.clear();
+ m_stationIDsSelected.clear();
+ m_stationIDsAvailable.clear();
+
+ for (unsigned int i = 0; i < m_stationIDsAll.count(); ++i) {
+ if (sl.contains(m_stationIDsAll[i])) {
+ m_stationIDsSelected.append(m_stationIDsAll[i]);
+ } else {
+ m_stationIDsAvailable.append(m_stationIDsAll[i]);
+ }
+ }
+ for (unsigned int i = 0; i < sl.count(); ++i) {
+ if (!m_stationIDsAll.contains(sl[i]))
+ m_stationIDsNotDisplayed.append(sl[i]);
+ }
+ updateListViews();
+ m_dirty = false;
+ return true;
+}
+
+
+bool StationSelector::noticeStationsChanged(const StationList &sl)
+{
+ slotSetDirty();
+
+ listAvailable->clear();
+ listSelected->clear();
+
+ m_stationIDsAvailable.clear();
+ m_stationIDsAll.clear();
+
+ for (unsigned int i = 0; i < m_stationIDsSelected.count(); ++i)
+ m_stationIDsNotDisplayed.append(m_stationIDsSelected[i]);
+
+ m_stationIDsSelected.clear();
+
+ for (RawStationList::Iterator i(sl.all()); i.current(); ++i) {
+ const TQString &id = i.current()->stationID();
+
+ m_stationIDsAll.append(id);
+ if (m_stationIDsNotDisplayed.contains(id)) {
+ m_stationIDsNotDisplayed.remove(id);
+ m_stationIDsSelected.append(id);
+ } else {
+ m_stationIDsAvailable.append(id);
+ }
+ }
+
+ updateListViews();
+ return true;
+}
+
+
+void StationSelector::slotButtonToLeft()
+{
+ slotSetDirty();
+ listAvailable->clearSelection();
+ TQListViewItem *item = listSelected->firstChild();
+ int idx_from = 0;
+ while (item) {
+ TQListViewItem *next_item = item->nextSibling();
+
+ if (item->isSelected()) {
+
+ moveItem (listSelected, m_stationIDsSelected,
+ item, idx_from,
+ listAvailable, m_stationIDsAvailable);
+
+ --idx_from;
+ }
+ item = next_item;
+ ++idx_from;
+ }
+}
+
+
+void StationSelector::slotButtonToRight()
+{
+ slotSetDirty();
+ listSelected->clearSelection();
+ TQListViewItem *item = listAvailable->firstChild();
+ int idx_from = 0;
+ while (item) {
+ TQListViewItem *next_item = item->nextSibling();
+
+ if (item->isSelected()) {
+
+ moveItem (listAvailable, m_stationIDsAvailable,
+ item, idx_from,
+ listSelected, m_stationIDsSelected);
+
+ --idx_from;
+ }
+ item = next_item;
+ ++idx_from;
+ }
+}
+
+
+void StationSelector::slotMoveToRight(const TQStringList &list)
+{
+ slotSetDirty();
+ listSelected->clearSelection();
+ TQListViewItem *item = listAvailable->firstChild();
+ int idx_from = 0;
+ while (item) {
+ TQListViewItem *next_item = item->nextSibling();
+
+ if (list.contains(m_stationIDsAvailable[idx_from])) {
+
+ moveItem (listAvailable, m_stationIDsAvailable,
+ item, idx_from,
+ listSelected, m_stationIDsSelected);
+
+ --idx_from;
+ }
+ item = next_item;
+ ++idx_from;
+ }
+}
+
+
+void StationSelector::slotMoveToLeft(const TQStringList &list)
+{
+ slotSetDirty();
+ listAvailable->clearSelection();
+ TQListViewItem *item = listSelected->firstChild();
+ int idx_from = 0;
+ while (item) {
+ TQListViewItem *next_item = item->nextSibling();
+
+ if (list.contains(m_stationIDsSelected[idx_from])) {
+
+ moveItem (listSelected, m_stationIDsSelected,
+ item, idx_from,
+ listAvailable, m_stationIDsAvailable);
+
+ --idx_from;
+ }
+ item = next_item;
+ ++idx_from;
+ }
+}
+
+
+void StationSelector::moveItem(
+ RadioStationListView *fromListView,
+ TQStringList &fromIDList,
+ TQListViewItem *item,
+ int idx_from,
+ RadioStationListView *toListView,
+ TQStringList &toIDList
+)
+{
+ fromListView->takeItem(item, idx_from);
+
+ TQString id = fromIDList[idx_from];
+ fromIDList.remove(fromIDList.at(idx_from));
+
+ unsigned int idx_to = 0,
+ idx_all = 0;
+ bool found = false;
+ TQListViewItem *item_to = toListView->firstChild(),
+ *prev_item_to = NULL;
+
+ while (idx_all < m_stationIDsAll.count() &&
+ idx_to < toIDList.count())
+ {
+ while (m_stationIDsAll[idx_all] != toIDList[idx_to])
+ {
+ if (m_stationIDsAll[idx_all] == id) {
+ found = true;
+ break;
+ }
+ ++idx_all;
+ }
+ if (found)
+ break;
+
+ prev_item_to = item_to;
+ item_to = item_to->nextSibling();
+ ++idx_to;
+ }
+
+ toIDList.insert(toIDList.at(idx_to), id);
+ toListView->insertItem(item, id, idx_to);
+ if (prev_item_to) {
+ item->moveItem(prev_item_to);
+ } else {
+ item->moveItem(item_to);
+ if (item_to) item_to->moveItem(item);
+ }
+}
+
+
+void StationSelector::updateListViews()
+{
+ listAvailable->clear();
+ listSelected->clear();
+ const StationList &stations = queryStations();
+ const RawStationList &sl = stations.all();
+
+ for (unsigned int i = 0; i < m_stationIDsAvailable.count(); ++i) {
+ TQString id = m_stationIDsAvailable[i];
+ listAvailable->appendStation(sl.stationWithID(id), sl.idxWithID(id)+1);
+ }
+ for (unsigned int i = 0; i < m_stationIDsSelected.count(); ++i) {
+ TQString id = m_stationIDsSelected[i];
+ listSelected->appendStation(sl.stationWithID(id), sl.idxWithID(id)+1);
+ }
+}
+
+
+void StationSelector::slotOK()
+{
+ if (m_dirty) {
+ TQStringList l = m_stationIDsSelected;
+ for (unsigned int i = 0; i < m_stationIDsNotDisplayed.count(); ++i)
+ l.append(m_stationIDsNotDisplayed[i]);
+ sendStationSelection(l);
+ }
+ m_dirty = false;
+}
+
+
+void StationSelector::slotCancel()
+{
+ if (m_dirty) {
+ noticeStationSelectionChanged(queryStationSelection());
+ }
+ m_dirty = false;
+}
+
+
+void StationSelector::saveState (TDEConfig *cfg) const
+{
+ listSelected->saveState(cfg);
+ listAvailable->saveState(cfg);
+}
+
+
+void StationSelector::restoreState (TDEConfig *cfg)
+{
+ listSelected->restoreState(cfg);
+ listAvailable->restoreState(cfg);
+}
+
+void StationSelector::slotSetDirty()
+{
+ if (!m_dirty) {
+ m_dirty = true;
+ emit sigDirty();
+ }
+}
+
+#include "stationselector.moc"
diff --git a/src/tderadio.desktop b/src/tderadio.desktop
new file mode 100644
index 0000000..ec79af1
--- /dev/null
+++ b/src/tderadio.desktop
@@ -0,0 +1,13 @@
+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Exec=tderadio -caption "%c" %i %m
+Icon=tderadio
+X-DocPath=tderadio/index.html
+Comment=Audio player for Internet and AM/FM Radio
+Comment[de]=
+Terminal=false
+Name=TDERadio
+Name[de]=TDERadio
+GenericName=Internet and AM/FM Radio
+Categories=Qt;TDE;AudioVideo;
diff --git a/src/tderadioapp.cpp b/src/tderadioapp.cpp
new file mode 100644
index 0000000..dfe28e7
--- /dev/null
+++ b/src/tderadioapp.cpp
@@ -0,0 +1,370 @@
+/**************************************************************************
+ tderadioapp.cpp - description
+ -------------------
+ begin : Sa Feb 9 CET 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. *
+ * *
+ ***************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include <tdeaboutdata.h>
+#include <tdelocale.h>
+#include <klibloader.h>
+#include <tdeconfig.h>
+#include <tdemessagebox.h>
+#include <kstandarddirs.h>
+
+// #include <kprogress.h>
+
+#include "include/tderadioapp.h"
+#include "include/aboutwidget.h"
+#include "include/errorlog-interfaces.h"
+
+#include "include/debug-profiler.h"
+
+/////////////////////////////////////////////////////////////////////////////
+//// TDERadioAbout
+
+AboutPageInfo TDERadioAbout::createAboutPage ()
+{
+ const char *description = I18N_NOOP(
+ "TDERadio - The Radio Application for TDE"
+ "<P>"
+ "With TDERadio you can listen to radio broadcasts with the help of your "
+ "V4L/V4L2 compatible radio card."
+ "<P>"
+ "The TDERadio Project contains a station preset data database. To complete "
+ "this database you are encouraged to contribute your station preset file "
+ "to the project. Just send it to one of the authors. "
+ "<P>"
+ "If you like to contribute your ideas, your own plugins or translations, "
+ "don't hesitate to contact one of the authors."
+ "<P>"
+ );
+
+ TDEAboutData aboutData("tderadio", "TDERadio",
+ VERSION,
+ description,
+ TDEAboutData::License_GPL,
+ "(c) 2002-2006 Martin Witte, Klas Kalass",
+ 0,
+ "http://sourceforge.net/projects/tderadio",
+ 0);
+ aboutData.addAuthor("Martin Witte", I18N_NOOP("Preset Database, Remote Control Support, Alarms, Rewrite for TDERadio 0.3.0, Misc"), "witte@kawo1.rwth-aachen.de");
+ aboutData.addAuthor("Marcus Camen", I18N_NOOP("Buildsystem, Standards Conformance, Cleanups"), "mcamen@mcamen.de");
+ aboutData.addAuthor("Klas Kalass", I18N_NOOP("Miscellaneous"), "klas.kalass@gmx.de");
+ aboutData.addAuthor("Frank Schwanz", I18N_NOOP("idea, first basic application"), "schwanz@fh-brandenburg.de");
+
+ aboutData.addCredit(I18N_NOOP("Many People around the World ... "),
+ I18N_NOOP("... which contributed station preset files \n"
+ "and tested early and unstable snapshots of TDERadio \n"
+ "with much patience"));
+
+ return AboutPageInfo(
+ new TDERadioAboutWidget(aboutData, TDERadioAboutWidget::AbtAppStandard),
+ "TDERadio",
+ "TDERadio",
+ "tderadio"
+ );
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+//// PluginLibraryInfo
+
+PluginLibraryInfo::PluginLibraryInfo (const TQString &lib_name)
+ : library (NULL),
+ init_func(NULL),
+ info_func(NULL),
+ libload_func(NULL),
+ libunload_func(NULL)
+{
+ library = KLibLoader::self()->library(lib_name.ascii());
+ if (library) {
+ info_func = (t_tderadio_plugin_info_func) library->symbol("TDERadioPlugin_GetAvailablePlugins");
+ init_func = (t_tderadio_plugin_init_func) library->symbol("TDERadioPlugin_CreatePlugin");
+ libload_func = (t_tderadio_plugin_libload_func) library->symbol("TDERadioPlugin_LoadLibrary");
+ libunload_func = (t_tderadio_plugin_libunload_func)library->symbol("TDERadioPlugin_UnloadLibrary");
+ if (info_func && init_func && libload_func && libunload_func) {
+ libload_func();
+ info_func(plugins);
+ } else {
+ KMessageBox::error(NULL,
+ i18n("Library %1: Plugin Entry Point is missing\n")
+ .arg(lib_name),
+ i18n("Plugin Library Load Error"));
+ library->unload();
+ info_func = NULL;
+ init_func = NULL;
+ library = NULL;
+ }
+ } else {
+ KMessageBox::error(NULL,
+ i18n("Library %1: \n%2")
+ .arg(lib_name)
+ .arg(KLibLoader::self()->lastErrorMessage()),
+ i18n("Plugin Library Load Error"));
+ }
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+//// TDERadioApp
+
+TDERadioApp::TDERadioApp()
+ : TDEApplication(),
+ m_quitting(false)
+{
+ m_Instances.setAutoDelete(true);
+ connect(this, TQT_SIGNAL(aboutToQuit()), this, TQT_SLOT(slotAboutToQuit()));
+}
+
+
+TDERadioApp::~TDERadioApp()
+{
+ IErrorLogClient::staticLogDebug("TDERadioApp::~TDERadioApp()");
+}
+
+void TDERadioApp::saveState()
+{
+ IErrorLogClient::staticLogDebug(i18n("saveState"));
+ saveState(TDEGlobal::config());
+}
+
+void TDERadioApp::saveState (TDEConfig *c)
+{
+ c->setGroup("Global");
+ c->writeEntry("instances", m_Instances.count());
+
+ int i = 0;
+ TQDictIterator<PluginManager> it(m_Instances);
+ for (; it.current(); ++it, ++i) {
+ c->setGroup("Global");
+ c->writeEntry("instance_name_" + TQString::number(i), it.currentKey());
+ it.current()->saveState(c);
+ }
+
+ c->setGroup("Plugin Libraries");
+ c->writeEntry("count", m_PluginLibraries.count());
+ int idx = 0;
+ TQMapConstIterator<TQString, PluginLibraryInfo> end = m_PluginLibraries.end();
+ for (TQMapConstIterator<TQString, PluginLibraryInfo> it = m_PluginLibraries.begin(); it != end; ++it, ++idx) {
+ c->writeEntry("library_" + TQString::number(idx), it.key());
+ }
+
+ c->sync();
+}
+
+
+void TDERadioApp::restoreState (TDEConfig *c)
+{
+ BlockProfiler profiler("TDERadioApp::restoreState - loadLibraries");
+
+ c->setGroup("Plugin Libraries");
+ int n_libs = c->readNumEntry("count", 0);
+
+// KProgressDialog *progress = new KProgressDialog(NULL, NULL, i18n("Loading Plugin Libraries"));
+// progress->setMinimumWidth(400);
+// progress->setAllowCancel(false);
+// progress->TQWidget::setCaption(i18n("TDERadio - Loading Plugin Libraries"));
+// progress->show();
+
+/* progress->progressBar()->setTotalSteps(n_libs);*/
+ for (int idx = 0; idx < n_libs; ++idx) {
+ TQString lib = c->readEntry("library_" + TQString::number(idx), TQString());
+ if (lib.length()) {
+ LoadLibrary(lib);
+// progress->progressBar()->setProgress(idx+1);
+ }
+ }
+
+ if (n_libs < 6) { // this seems to be a meaningful minimum value for a working tderadio setup
+ TQStringList libs
+ = TDEGlobal::dirs()->findAllResources("lib", "tderadio/plugins/*.so");
+ TQValueListIterator<TQString> end = libs.end();
+ int idx = 0;
+// progress->progressBar()->setTotalSteps(libs.count());
+ for (TQValueListIterator<TQString> it = libs.begin(); it != end; ++it, ++idx) {
+ LoadLibrary(*it);
+// progress->progressBar()->setProgress(idx+1);
+ }
+ }
+
+// delete progress;
+
+ profiler.stop();
+
+ c->setGroup("Global");
+
+ BlockProfiler rest_profiler("TDERadioApp::restoreState - restore");
+
+ int n = c->readNumEntry("instances", 1);
+ if (n < 1 || n > 10)
+ n = 1;
+
+ for (int i = 0; i < n; ++i) {
+ c->setGroup("Global");
+ TQString name = c->readEntry("instance_name_" + TQString::number(i),
+ n > 1 ? (i18n("Instance") + " " + TQString::number(i+1)) : TQString(""));
+ createNewInstance(name)->restoreState(c);
+ }
+}
+
+
+PluginManager *TDERadioApp::createNewInstance(const TQString &_name)
+{
+ BlockProfiler profiler("TDERadioApp::createNewInstance");
+
+ TQString instance_name = _name;
+ TQString title_ext = "";
+ TQString id = TQString::number(m_Instances.count()+1);
+ if (instance_name.length() == 0) {
+ instance_name = "Instance " + id;
+ }
+ if (_name.length() && m_Instances.count() > 0) {
+ title_ext = " " + instance_name;
+ }
+ PluginManager *pm = new PluginManager ( instance_name,
+ this,
+ i18n("TDERadio Configuration") + title_ext,
+ i18n("About TDERadio Components") + title_ext
+ );
+
+ m_Instances.insert(instance_name, pm);
+
+ /* Until we don't have library plugins we must instantiate them hard-wired */
+ TDERadioAbout *about = new TDERadioAbout ( "tderadio-about-" + instance_name);
+ pm->insertPlugin(about);
+
+ return pm;
+}
+
+
+KLibrary *TDERadioApp::LoadLibrary (const TQString &library)
+{
+ BlockProfiler profiler("TDERadioApp::LoadLibrary");
+ BlockProfiler libprofiler("TDERadioApp::LoadLibrary - " + library);
+
+ PluginLibraryInfo libinfo(library);
+ if (libinfo.valid()) {
+ m_PluginLibraries.insert(library, libinfo);
+ TQMapConstIterator<TQString,TQString> end = libinfo.plugins.end();
+ for (TQMapConstIterator<TQString,TQString> it = libinfo.plugins.begin(); it != end; ++it) {
+ m_PluginInfos.insert(it.key(), PluginClassInfo (it.key(), *it, libinfo.init_func));
+ }
+ } else {
+ kdDebug() << TQDateTime::currentDateTime().toString(Qt::ISODate)
+ << " "
+ << i18n("Error: Loading Library %1 failed: %2")
+ .arg(library).arg(KLibLoader::self()->lastErrorMessage())
+ << endl;
+ }
+
+ for (TQDictIterator<PluginManager> it_managers(m_Instances); it_managers.current(); ++it_managers) {
+ it_managers.current()->noticeLibrariesChanged();
+ }
+
+ return libinfo.valid() ? libinfo.library : NULL;
+}
+
+
+void TDERadioApp::UnloadLibrary (const TQString &library)
+{
+ if (!m_PluginLibraries.contains(library))
+ return;
+
+ PluginLibraryInfo info = m_PluginLibraries[library];
+
+ TQMapConstIterator<TQString, TQString> end_classes = info.plugins.end();
+ for (TQMapConstIterator<TQString, TQString> it_classes = info.plugins.begin(); it_classes != end_classes; ++it_classes) {
+ for (TQDictIterator<PluginManager> it_managers(m_Instances); it_managers.current(); ++it_managers) {
+ it_managers.current()->unloadPlugins(it_classes.key());
+ }
+ m_PluginInfos.remove(it_classes.key());
+ }
+ m_PluginLibraries.remove(library);
+
+ info.libunload_func();
+ info.library->unload();
+
+ for (TQDictIterator<PluginManager> it_managers(m_Instances); it_managers.current(); ++it_managers) {
+ it_managers.current()->noticeLibrariesChanged();
+ }
+}
+
+
+PluginBase *TDERadioApp::CreatePlugin (PluginManager *manager, const TQString &class_name, const TQString &object_name)
+{
+ BlockProfiler all_profiler ("TDERadioApp::CreatePlugin");
+ BlockProfiler class_profiler("TDERadioApp::CreatePlugin - " + class_name);
+
+ BlockProfiler create_profiler("TDERadioApp::CreatePlugin - create");
+
+ PluginBase *retval = NULL;
+ if (m_PluginInfos.contains(class_name)) {
+ retval = m_PluginInfos[class_name].CreateInstance(object_name);
+ if (!retval) {
+ kdDebug() << TQDateTime::currentDateTime().toString(Qt::ISODate)
+ << " "
+ << i18n("Error: Creation of instance \"%1\" of class %2 falied.").arg(object_name).arg(class_name)
+ << endl;
+ }
+ } else {
+ kdDebug() << TQDateTime::currentDateTime().toString(Qt::ISODate)
+ << " "
+ << i18n("Error: Cannot create instance \"%1\" of unknown class %2.").arg(object_name).arg(class_name)
+ << endl;
+ }
+
+ create_profiler.stop();
+
+ if (retval) {
+
+ BlockProfiler insert_profiler("TDERadioApp::CreatePlugin - insert");
+ manager->insertPlugin(retval);
+ insert_profiler.stop();
+
+ //BlockProfiler restore_profiler("TDERadioApp::CreatePlugin - restore");
+ //retval->restoreState(TDEGlobal::config());
+ }
+
+ return retval;
+}
+
+void TDERadioApp::startPlugins()
+{
+ TQDictIterator<PluginManager> it(m_Instances);
+ for (; it.current(); ++it) {
+ it.current()->startPlugins();
+ }
+}
+
+void TDERadioApp::slotAboutToQuit()
+{
+ IErrorLogClient::staticLogDebug("slotAboutToQuit");
+ if (!m_quitting) {
+ IErrorLogClient::staticLogDebug("slotAboutToQuit, m_quitting = false");
+ m_quitting = true;
+ saveState();
+ TQDictIterator<PluginManager> it(m_Instances);
+ for (; it.current(); ++it) {
+ it.current()->aboutToQuit();
+ }
+ m_quitting = false;
+ }
+}
+
+#include "tderadioapp.moc"
diff --git a/src/timecontrol_interfaces.cpp b/src/timecontrol_interfaces.cpp
new file mode 100644
index 0000000..1ba4e57
--- /dev/null
+++ b/src/timecontrol_interfaces.cpp
@@ -0,0 +1,104 @@
+/***************************************************************************
+ timecontrol_interfaces.cpp - description
+ -------------------
+ begin : Mon Mr 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/timecontrol_interfaces.h"
+
+static AlarmVector emptyAlarms;
+
+// ITimeControl
+
+IF_IMPL_SENDER ( ITimeControl::notifyAlarmsChanged(const AlarmVector &sl),
+ noticeAlarmsChanged(sl) )
+
+IF_IMPL_SENDER ( ITimeControl::notifyAlarm(const Alarm &a),
+ noticeAlarm(a) )
+
+IF_IMPL_SENDER ( ITimeControl::notifyNextAlarmChanged(const Alarm *a),
+ noticeNextAlarmChanged(a) )
+
+IF_IMPL_SENDER ( ITimeControl::notifyCountdownStarted(const TQDateTime &end),
+ noticeCountdownStarted(end) )
+
+IF_IMPL_SENDER ( ITimeControl::notifyCountdownStopped(),
+ noticeCountdownStopped() )
+
+IF_IMPL_SENDER ( ITimeControl::notifyCountdownZero(),
+ noticeCountdownZero() )
+
+IF_IMPL_SENDER ( ITimeControl::notifyCountdownSecondsChanged(int n),
+ noticeCountdownSecondsChanged(n) )
+
+// ITimeControlClient
+
+IF_IMPL_SENDER ( ITimeControlClient::sendAlarms(const AlarmVector &sl),
+ setAlarms(sl) )
+
+IF_IMPL_SENDER ( ITimeControlClient::sendCountdownSeconds(int n),
+ setCountdownSeconds(n) )
+
+IF_IMPL_SENDER ( ITimeControlClient::sendStartCountdown(),
+ startCountdown() )
+
+IF_IMPL_SENDER ( ITimeControlClient::sendStopCountdown(),
+ stopCountdown() )
+
+
+IF_IMPL_QUERY ( TQDateTime ITimeControlClient::queryNextAlarmTime (),
+ getNextAlarmTime(),
+ TQDateTime() )
+
+IF_IMPL_QUERY ( const Alarm * ITimeControlClient::queryNextAlarm (),
+ getNextAlarm(),
+ NULL )
+
+IF_IMPL_QUERY ( const AlarmVector &ITimeControlClient::queryAlarms (),
+ getAlarms(),
+ emptyAlarms )
+
+IF_IMPL_QUERY ( int ITimeControlClient::queryCountdownSeconds (),
+ getCountdownSeconds(),
+ 30*60 )
+
+IF_IMPL_QUERY ( TQDateTime ITimeControlClient::queryCountdownEnd (),
+ getCountdownEnd(),
+ TQDateTime() )
+
+
+void ITimeControlClient::noticeConnectedI(cmplInterface *, bool /*pointer_valid*/)
+{
+ noticeAlarmsChanged(queryAlarms());
+ noticeNextAlarmChanged(queryNextAlarm());
+ TQDateTime end = queryCountdownEnd();
+ if (end > TQDateTime::currentDateTime())
+ noticeCountdownStarted(end);
+ else
+ noticeCountdownStopped();
+}
+
+
+void ITimeControlClient::noticeDisconnectedI(cmplInterface *, bool /*pointer_valid*/)
+{
+ noticeAlarmsChanged(queryAlarms());
+ noticeNextAlarmChanged(queryNextAlarm());
+ TQDateTime end = queryCountdownEnd();
+ if (end > TQDateTime::currentDateTime())
+ noticeCountdownStarted(end);
+ else
+ noticeCountdownStopped();
+}
+
+
diff --git a/src/utils.cpp b/src/utils.cpp
new file mode 100644
index 0000000..90db463
--- /dev/null
+++ b/src/utils.cpp
@@ -0,0 +1,69 @@
+/***************************************************************************
+ utils.cpp - description
+ -------------------
+ begin : Don Jan 9 2003
+ copyright : (C) 2003 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. *
+ * *
+ ***************************************************************************/
+
+#include <tqregexp.h>
+#include "include/utils.h"
+#include <linux/soundcard.h>
+
+//const char *mixerChannelLabels[] = SOUND_DEVICE_LABELS;
+//const char *mixerChannelNames[] = SOUND_DEVICE_NAMES;
+
+
+TQString XMLEscape (const TQString &s)
+{
+ TQString c = s;
+ c.replace(TQRegExp("&"), "&amp;");
+ c.replace(TQRegExp("<"), "&lt;");
+ c.replace(TQRegExp(">"), "&gt;");
+ c.replace(TQRegExp("\""), "&quot;");
+ c.replace(TQRegExp("'"), "&apos;");
+ return c;
+}
+
+
+TQString xmlOpenTag (const TQString &tag, bool nl)
+{
+ return "<" + tag + ">" + (nl ? TQString("\n") : TQString());
+}
+
+
+TQString xmlCloseTag (const TQString &tag, bool nl)
+{
+ return "</" + tag + ">" + (nl ? TQString("\n") : TQString());
+}
+
+
+TQString xmlTag (const TQString &tag, int v, bool nl)
+{
+ return xmlTag (tag, TQString().setNum(v), nl);
+}
+
+
+TQString xmlTag (const TQString &tag, float f, bool nl)
+{
+ return xmlTag(tag, TQString().setNum(f), nl);
+}
+
+
+TQString xmlTag (const TQString &tag, const TQString &data, bool nl)
+{
+ return xmlOpenTag(tag, false)
+ + XMLEscape(data)
+ + xmlCloseTag(tag, false)
+ + (nl ? TQString("\n") : TQString());
+}
+
diff --git a/src/widgetplugins.cpp b/src/widgetplugins.cpp
new file mode 100644
index 0000000..462030e
--- /dev/null
+++ b/src/widgetplugins.cpp
@@ -0,0 +1,235 @@
+/***************************************************************************
+ widgetplugins.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+#include "include/widgetplugins.h"
+#include "include/pluginmanager.h"
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <twin.h>
+#include <tqwidget.h>
+#include <tdeconfig.h>
+#include <tdelocale.h>
+
+WidgetPluginBase::WidgetPluginBase(const TQString &name, const TQString &description)
+ : PluginBase(name, description),
+ m_geoCacheValid(false),
+ m_geoRestoreFlag(false),
+ m_restoreShow(false)
+{
+}
+
+/*
+TQWidget *WidgetPluginBase::getWidget()
+{
+ return dynamic_cast<TQWidget*>(this);
+}
+
+
+const TQWidget *WidgetPluginBase::getWidget() const
+{
+ return dynamic_cast<const TQWidget*>(this);
+}
+*/
+
+void WidgetPluginBase::notifyManager(bool shown)
+{
+ if (m_manager)
+ m_manager->noticeWidgetPluginShown(this, shown);
+}
+
+
+bool WidgetPluginBase::isReallyVisible(const TQWidget *_w) const
+{
+ const TQWidget *w = _w ? _w : getWidget();
+ if (!w) return false;
+ KWin::WindowInfo i = KWin::WindowInfo(w->winId(), 0, 0);
+ return (i.mappingState() == NET::Visible)
+ && w->isVisible()
+ && (i.onAllDesktops() || i.isOnCurrentDesktop());
+}
+
+
+bool WidgetPluginBase::isAnywhereVisible(const TQWidget *_w) const
+{
+ const TQWidget *w = _w ? _w : getWidget();
+ if (!w) return false;
+ return w->isVisible();
+}
+
+
+void WidgetPluginBase::pShow(bool on)
+{
+ TQWidget *w = getWidget();
+ if (!w) return;
+ if (on && !isReallyVisible(w))
+ w->show();
+ else if (!on && !w->isHidden())
+ w->hide();
+}
+
+
+void WidgetPluginBase::pToggleShown()
+{
+ TQWidget *w = getWidget();
+ if (!w) return;
+ if (!isReallyVisible(w))
+ w->show();
+ else
+ w->hide();
+}
+
+
+void WidgetPluginBase::pShowOnOrgDesktop()
+{
+ KWin::setMainWindow(getWidget(), 0);
+
+ logDebug(TQString("%1::pShowOnOrgDesktop: all: %2, desktop: %3, visible:%4, anywherevisible:%5, cachevalid: %6").arg(name()).arg(m_saveSticky).arg(m_saveDesktop).arg(isReallyVisible()).arg(isAnywhereVisible()).arg(m_geoCacheValid));
+ if (m_geoCacheValid && (!isReallyVisible() || m_geoRestoreFlag) ) {
+ TQWidget *w = getWidget();
+ if (!w) return;
+ WId id = w->winId();
+
+ KWin::setOnAllDesktops(id, m_saveSticky);
+ if (!m_saveSticky) {
+ KWin::setOnDesktop(id, m_saveDesktop);
+ }
+
+ w->resize(m_saveGeometry.size());
+ w->move(m_saveGeometry.topLeft());
+
+ if (m_saveMinimized) {
+ w->showMinimized();
+ KWin::iconifyWindow(id);
+ } else if (m_saveMaximized) {
+ w->showMaximized();
+ } else {
+ w->showNormal();
+ KWin::deIconifyWindow(id);
+ }
+
+ }
+}
+
+void WidgetPluginBase::pShow()
+{
+ KWin::setMainWindow(getWidget(), 0);
+
+ logDebug(TQString("%1::pShow: all: %2, desktop: %3, visible:%4, anywherevisible:%5, cachevalid: %6").arg(name()).arg(m_saveSticky).arg(m_saveDesktop).arg(isReallyVisible()).arg(isAnywhereVisible()).arg(m_geoCacheValid));
+ if (m_geoCacheValid && (!isReallyVisible() || m_geoRestoreFlag) ) {
+ TQWidget *w = getWidget();
+ if (!w) return;
+ WId id = w->winId();
+
+ KWin::setOnAllDesktops(id, m_saveSticky);
+ if (!m_saveSticky)
+ KWin::setOnDesktop(id, KWin::currentDesktop());
+
+ w->resize(m_saveGeometry.size());
+ w->move(m_saveGeometry.topLeft());
+ KWin::deIconifyWindow(id);
+ }
+}
+
+
+void WidgetPluginBase::pHide()
+{
+ logDebug(TQString("%1::pHide1: all: %2, desktop: %3, visible:%4, anywherevisible:%5, cachevalid: %6").arg(name()).arg(m_saveSticky).arg(m_saveDesktop).arg(isReallyVisible()).arg(isAnywhereVisible()).arg(m_geoCacheValid));
+ getKWinState();
+ logDebug(TQString("%1::pHide2: all: %2, desktop: %3, visible:%4, anywherevisible:%5, cachevalid: %6").arg(name()).arg(m_saveSticky).arg(m_saveDesktop).arg(isReallyVisible()).arg(isAnywhereVisible()).arg(m_geoCacheValid));
+}
+
+
+void WidgetPluginBase::pShowEvent(TQShowEvent *)
+{
+ notifyManager (true);
+}
+
+
+void WidgetPluginBase::pHideEvent(TQHideEvent *)
+{
+ notifyManager (false);
+}
+
+
+void WidgetPluginBase::getKWinState(const TQWidget *_w) const
+{
+ if (m_geoRestoreFlag) return;
+
+ const TQWidget *w = _w ? _w : getWidget();
+ if (!w) return;
+ if (w->isVisible()) {
+ KWin::WindowInfo i = KWin::WindowInfo(w->winId(), 0, 0);
+ m_saveMinimized = i.isMinimized();
+ m_saveMaximized = w->isMaximized();
+ m_saveSticky = i.onAllDesktops();
+ m_saveDesktop = i.desktop();
+ m_saveGeometry = TQRect(w->pos(), w->size());
+ m_geoCacheValid = true;
+ }
+}
+
+
+void WidgetPluginBase::saveState (TDEConfig *config) const
+{
+ const TQWidget *w = getWidget();
+ getKWinState(w);
+
+ config->writeEntry("hidden", w ? w->isHidden() : false);
+ config->writeEntry("minimized", m_saveMinimized);
+ config->writeEntry("maximized", m_saveMaximized);
+ config->writeEntry("sticky", m_saveSticky);
+ config->writeEntry("desktop", m_saveDesktop);
+ config->writeEntry("geometry", m_saveGeometry);
+ config->writeEntry("geoCacheValid", m_geoCacheValid);
+}
+
+
+void WidgetPluginBase::restoreState (TDEConfig *config, bool showByDefault)
+{
+ m_geoCacheValid = config->readBoolEntry("geoCacheValid", false);
+ m_saveDesktop = config->readNumEntry ("desktop", 1);
+ m_saveSticky = config->readBoolEntry("sticky", false);
+ m_saveMaximized = config->readBoolEntry("maximized", false);
+ m_saveMinimized = config->readBoolEntry("minimized", false);
+ m_saveGeometry = config->readRectEntry("geometry");
+
+ m_restoreShow = !config->readBoolEntry("hidden", !showByDefault);
+}
+
+
+void WidgetPluginBase::restoreState (TDEConfig *config)
+{
+ restoreState(config, true);
+}
+
+
+void WidgetPluginBase::startPlugin()
+{
+ PluginBase::startPlugin();
+
+ TQWidget *w = getWidget();
+ if (w) {
+ m_geoRestoreFlag = true;
+ if (!m_restoreShow) w->hide();
+ else w->show();
+ m_geoRestoreFlag = false;
+ }
+}
+