diff options
author | Michele Calgaro <[email protected]> | 2022-05-30 19:40:31 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2022-05-31 01:17:58 +0900 |
commit | d95a4fea540b371fa86493d069fdbd54f33c5b40 (patch) | |
tree | 079b038ab559439eb7ded40a07bd79fd92926b3b /tderadio3/src | |
parent | e54890e0480e5adee69f5220a7c6dd072bbd75ea (diff) | |
download | tderadio-d95a4fea540b371fa86493d069fdbd54f33c5b40.tar.gz tderadio-d95a4fea540b371fa86493d069fdbd54f33c5b40.zip |
Standardize folder structure.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'tderadio3/src')
81 files changed, 0 insertions, 12639 deletions
diff --git a/tderadio3/src/CMakeL10n.txt b/tderadio3/src/CMakeL10n.txt deleted file mode 100644 index 67a60c2..0000000 --- a/tderadio3/src/CMakeL10n.txt +++ /dev/null @@ -1,6 +0,0 @@ -##### create translation templates ############## - -tde_l10n_create_template( - CATALOG "tderadio" - DESTINATION "po" -) diff --git a/tderadio3/src/Makefile.am b/tderadio3/src/Makefile.am deleted file mode 100644 index eb573c4..0000000 --- a/tderadio3/src/Makefile.am +++ /dev/null @@ -1,104 +0,0 @@ -SUBDIRS = po . - -INCLUDES = -I$(top_srcdir)/tderadio3/src/include \ - -I$(top_builddir)/tderadio3/src/include \ - $(all_includes) - -METASOURCES = AUTO - -META_INCLUDES = $(srcdir)/include - -KDE_CXXFLAGS="-UTQT_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_TQT) -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/tderadio3/src/aboutwidget.cpp b/tderadio3/src/aboutwidget.cpp deleted file mode 100644 index 053f84b..0000000 --- a/tderadio3/src/aboutwidget.cpp +++ /dev/null @@ -1,611 +0,0 @@ -/*************************************************************************** - aboutwidget.cpp - description - ------------------- - begin : Sa Sep 13 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/alarm.cpp b/tderadio3/src/alarm.cpp deleted file mode 100644 index 475d48b..0000000 --- a/tderadio3/src/alarm.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/*************************************************************************** - alarm.cpp - description - ------------------- - begin : Mon Feb 4 2002 - copyright : (C) 2002 by Martin Witte / Frank Schwanz - email : [email protected] / [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/debug-profiler.cpp b/tderadio3/src/debug-profiler.cpp deleted file mode 100644 index 5194b7e..0000000 --- a/tderadio3/src/debug-profiler.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/*************************************************************************** - debug-profiler.h - description - ------------------- - begin : Sat May 28 2005 - copyright : (C) 2005 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/errorlog-interfaces.cpp b/tderadio3/src/errorlog-interfaces.cpp deleted file mode 100644 index e71304c..0000000 --- a/tderadio3/src/errorlog-interfaces.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/*************************************************************************** - errorlog-interfaces.cpp - description - ------------------- - begin : Sa Sep 13 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/fileringbuffer.cpp b/tderadio3/src/fileringbuffer.cpp deleted file mode 100644 index 5cca0c7..0000000 --- a/tderadio3/src/fileringbuffer.cpp +++ /dev/null @@ -1,252 +0,0 @@ -/*************************************************************************** - ringbuffer.cpp - description - ------------------- - begin : Sun March 21 2004 - copyright : (C) 2004 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/frequencyradiostation.cpp b/tderadio3/src/frequencyradiostation.cpp deleted file mode 100644 index 38cddd7..0000000 --- a/tderadio3/src/frequencyradiostation.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/*************************************************************************** - frequencyradiostation.cpp - description - ------------------- - begin : Sat March 29 2003 - copyright : (C) 2003 by Klas Kalass, Ernst Martin Witte - email : [email protected], [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/frequencyseekhelper.cpp b/tderadio3/src/frequencyseekhelper.cpp deleted file mode 100644 index 1c24329..0000000 --- a/tderadio3/src/frequencyseekhelper.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/*************************************************************************** - frequencyseekhelper.cpp - description - ------------------- - begin : Fre Mai 9 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/aboutwidget.h b/tderadio3/src/include/aboutwidget.h deleted file mode 100644 index a0b3fe7..0000000 --- a/tderadio3/src/include/aboutwidget.h +++ /dev/null @@ -1,149 +0,0 @@ -/*************************************************************************** - aboutwidget.h - description - ------------------- - begin : Sa Sep 13 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/alarm.h b/tderadio3/src/include/alarm.h deleted file mode 100644 index 14b4abc..0000000 --- a/tderadio3/src/include/alarm.h +++ /dev/null @@ -1,104 +0,0 @@ -/*************************************************************************** - alarm.h - description - ------------------- - begin : Mon Feb 4 2002 - copyright : (C) 2002 by Martin Witte / Frank Schwanz - email : [email protected] / [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/debug-profiler.h b/tderadio3/src/include/debug-profiler.h deleted file mode 100644 index 7ceb50d..0000000 --- a/tderadio3/src/include/debug-profiler.h +++ /dev/null @@ -1,112 +0,0 @@ -/*************************************************************************** - debug-profiler.h - description - ------------------- - begin : Sat May 28 2005 - copyright : (C) 2005 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/errorlog-interfaces.h b/tderadio3/src/include/errorlog-interfaces.h deleted file mode 100644 index 85d5926..0000000 --- a/tderadio3/src/include/errorlog-interfaces.h +++ /dev/null @@ -1,64 +0,0 @@ -/*************************************************************************** - errorlog-interfaces.h - description - ------------------- - begin : Sa Sep 13 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/fileringbuffer.h b/tderadio3/src/include/fileringbuffer.h deleted file mode 100644 index 2978bec..0000000 --- a/tderadio3/src/include/fileringbuffer.h +++ /dev/null @@ -1,71 +0,0 @@ -/*************************************************************************** - ringbuffer.h - description - ------------------- - begin : Sun March 21 2004 - copyright : (C) 2004 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/frequencyradiostation.h b/tderadio3/src/include/frequencyradiostation.h deleted file mode 100644 index 75c6ecd..0000000 --- a/tderadio3/src/include/frequencyradiostation.h +++ /dev/null @@ -1,83 +0,0 @@ -/*************************************************************************** - frequencyradiostation.h - description - ------------------- - begin : Sat March 29 2003 - copyright : (C) 2003 by Klas Kalass, Ernst Martin Witte - email : [email protected], [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/frequencyseekhelper.h b/tderadio3/src/include/frequencyseekhelper.h deleted file mode 100644 index 68ffe78..0000000 --- a/tderadio3/src/include/frequencyseekhelper.h +++ /dev/null @@ -1,78 +0,0 @@ -/*************************************************************************** - frequencyseekhelper.h - description - ------------------- - begin : Fre Mai 9 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/gui_list_helper.h b/tderadio3/src/include/gui_list_helper.h deleted file mode 100644 index 6a1479c..0000000 --- a/tderadio3/src/include/gui_list_helper.h +++ /dev/null @@ -1,174 +0,0 @@ -/*************************************************************************** - gui_list_helper.h - ------------------- - begin : Son Sep 26 2004 - copyright : (C) 2004 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/interfaces.h b/tderadio3/src/include/interfaces.h deleted file mode 100644 index 0ed4a59..0000000 --- a/tderadio3/src/include/interfaces.h +++ /dev/null @@ -1,714 +0,0 @@ -/*************************************************************************** - interfaces.h - description - ------------------- - begin : Fre Feb 28 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/internetradiostation.h b/tderadio3/src/include/internetradiostation.h deleted file mode 100644 index 716dba2..0000000 --- a/tderadio3/src/include/internetradiostation.h +++ /dev/null @@ -1,75 +0,0 @@ -/*************************************************************************** - internetradiostation.h - description - ------------------- - begin : Sat March 29 2003 - copyright : (C) 2003 by Klas Kalass, Ernst Martin Witte - email : [email protected], [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/multibuffer.h b/tderadio3/src/include/multibuffer.h deleted file mode 100644 index e0ed05c..0000000 --- a/tderadio3/src/include/multibuffer.h +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - multibuffer.h - ------------------- - begin : Sat Aug 20 2005 - copyright : (C) 2005 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/plugin_configuration_dialog.h b/tderadio3/src/include/plugin_configuration_dialog.h deleted file mode 100644 index b273207..0000000 --- a/tderadio3/src/include/plugin_configuration_dialog.h +++ /dev/null @@ -1,75 +0,0 @@ -/*************************************************************************** - plugin_configuration_dialog.h - description - ------------------- - begin : Sam Jun 21 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/pluginmanager-configuration.h b/tderadio3/src/include/pluginmanager-configuration.h deleted file mode 100644 index 970aca2..0000000 --- a/tderadio3/src/include/pluginmanager-configuration.h +++ /dev/null @@ -1,61 +0,0 @@ -/*************************************************************************** - pluginmanager-configuration.h - description - ------------------- - begin : Thu Sep 30 2004 - copyright : (C) 2004 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/pluginmanager.h b/tderadio3/src/include/pluginmanager.h deleted file mode 100644 index 3bf13f4..0000000 --- a/tderadio3/src/include/pluginmanager.h +++ /dev/null @@ -1,148 +0,0 @@ -/*************************************************************************** - pluginmanager.h - description - ------------------- - begin : Mon Apr 28 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/plugins.h b/tderadio3/src/include/plugins.h deleted file mode 100644 index c39b65e..0000000 --- a/tderadio3/src/include/plugins.h +++ /dev/null @@ -1,192 +0,0 @@ -/*************************************************************************** - plugins.h - description - ------------------- - begin : Mon M�r 10 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/radio_interfaces.h b/tderadio3/src/include/radio_interfaces.h deleted file mode 100644 index 009df8c..0000000 --- a/tderadio3/src/include/radio_interfaces.h +++ /dev/null @@ -1,117 +0,0 @@ -/*************************************************************************** - radio_interfaces.h - description - ------------------- - begin : Mon M�r 10 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/radiodevice_interfaces.h b/tderadio3/src/include/radiodevice_interfaces.h deleted file mode 100644 index f1e3438..0000000 --- a/tderadio3/src/include/radiodevice_interfaces.h +++ /dev/null @@ -1,353 +0,0 @@ -/*************************************************************************** - radiodevice_interfaces.h - description - ------------------- - begin : Fre Apr 18 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/radiodevicepool_interfaces.h b/tderadio3/src/include/radiodevicepool_interfaces.h deleted file mode 100644 index 0e2004c..0000000 --- a/tderadio3/src/include/radiodevicepool_interfaces.h +++ /dev/null @@ -1,75 +0,0 @@ -/*************************************************************************** - radiodevicepool_interface.h - description - ------------------- - begin : Sam Apr 19 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/radiostation-config.h b/tderadio3/src/include/radiostation-config.h deleted file mode 100644 index 2efad05..0000000 --- a/tderadio3/src/include/radiostation-config.h +++ /dev/null @@ -1,82 +0,0 @@ -/*************************************************************************** - radiostation-config.h - description - ------------------- - begin : Sa Aug 16 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/radiostation-listview.h b/tderadio3/src/include/radiostation-listview.h deleted file mode 100644 index 2ecb86f..0000000 --- a/tderadio3/src/include/radiostation-listview.h +++ /dev/null @@ -1,84 +0,0 @@ -/*************************************************************************** - radiostation-listview.h - description - ------------------- - begin : Mi Mar 03 2004 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/radiostation.h b/tderadio3/src/include/radiostation.h deleted file mode 100644 index 68d0325..0000000 --- a/tderadio3/src/include/radiostation.h +++ /dev/null @@ -1,164 +0,0 @@ -/*************************************************************************** - radiostation.h - description - ------------------- - begin : Sat Feb 2 2002 - copyright : (C) 2003 by Martin Witte, Klas Kalass - email : [email protected] / [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/ringbuffer.h b/tderadio3/src/include/ringbuffer.h deleted file mode 100644 index 1f545ca..0000000 --- a/tderadio3/src/include/ringbuffer.h +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************** - ringbuffer.h - description - ------------------- - begin : Sun March 21 2004 - copyright : (C) 2004 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/seekhelper.h b/tderadio3/src/include/seekhelper.h deleted file mode 100644 index f61ad9d..0000000 --- a/tderadio3/src/include/seekhelper.h +++ /dev/null @@ -1,83 +0,0 @@ -/*************************************************************************** - seekhelper.h - description - ------------------- - begin : Sam Mai 10 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/sound_metadata.h b/tderadio3/src/include/sound_metadata.h deleted file mode 100644 index 723ae3b..0000000 --- a/tderadio3/src/include/sound_metadata.h +++ /dev/null @@ -1,50 +0,0 @@ -/*************************************************************************** - sound_metadata.h - description - ------------------- - begin : Sun May 15 2005 - copyright : (C) 2005 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/soundformat.h b/tderadio3/src/include/soundformat.h deleted file mode 100644 index 0f07d9a..0000000 --- a/tderadio3/src/include/soundformat.h +++ /dev/null @@ -1,75 +0,0 @@ -/*************************************************************************** - soundformat.h - description - ------------------- - begin : Sun Aug 1 2004 - copyright : (C) 2004 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/soundstreamclient_interfaces.h b/tderadio3/src/include/soundstreamclient_interfaces.h deleted file mode 100644 index 2d14de2..0000000 --- a/tderadio3/src/include/soundstreamclient_interfaces.h +++ /dev/null @@ -1,372 +0,0 @@ -/*************************************************************************** - sounddevice_interfaces.h - description - ------------------- - begin : Sun Mar 21 2004 - copyright : (C) 2004 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/soundstreamid.h b/tderadio3/src/include/soundstreamid.h deleted file mode 100644 index e7aa4d5..0000000 --- a/tderadio3/src/include/soundstreamid.h +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - soundstreamid.h - description - ------------------- - begin : Sun Aug 1 2004 - copyright : (C) 2004 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/standardscandialog.h b/tderadio3/src/include/standardscandialog.h deleted file mode 100644 index 2be7c74..0000000 --- a/tderadio3/src/include/standardscandialog.h +++ /dev/null @@ -1,101 +0,0 @@ -/*************************************************************************** - standardscandialog.h - description - ------------------- - begin : Son Aug 3 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/station-drag-object.h b/tderadio3/src/include/station-drag-object.h deleted file mode 100644 index 5796dd0..0000000 --- a/tderadio3/src/include/station-drag-object.h +++ /dev/null @@ -1,39 +0,0 @@ -/*************************************************************************** - station-drag-object.h - description - ------------------- - begin : Sun Aug 28 2005 - copyright : (C) 2005 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/stationlist.h b/tderadio3/src/include/stationlist.h deleted file mode 100644 index dcacdca..0000000 --- a/tderadio3/src/include/stationlist.h +++ /dev/null @@ -1,159 +0,0 @@ -/*************************************************************************** - stationlist.h - description - ------------------- - begin : Sat March 29 2003 - copyright : (C) 2003 by Klas Kalass - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/stationlistmetadata.h b/tderadio3/src/include/stationlistmetadata.h deleted file mode 100644 index 00f54f3..0000000 --- a/tderadio3/src/include/stationlistmetadata.h +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - stationlistmetadata.h - description - ------------------- - begin : Sat March 29 2003 - copyright : (C) 2003 by Klas Kalass - email : [email protected] - copyright : (C) 2002 by Martin Witte / Frank Schwanz - email : [email protected] / [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/stationlistxmlhandler.h b/tderadio3/src/include/stationlistxmlhandler.h deleted file mode 100644 index 65c3cff..0000000 --- a/tderadio3/src/include/stationlistxmlhandler.h +++ /dev/null @@ -1,85 +0,0 @@ -/*************************************************************************** - radiocfgxmlhandler.h - description - ------------------- - begin : Son Jan 12 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/stationselection_interfaces.h b/tderadio3/src/include/stationselection_interfaces.h deleted file mode 100644 index 463eca0..0000000 --- a/tderadio3/src/include/stationselection_interfaces.h +++ /dev/null @@ -1,67 +0,0 @@ -/*************************************************************************** - stationselection_interfaces.h - description - ------------------- - begin : Son Aug 3 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/stationselector.h b/tderadio3/src/include/stationselector.h deleted file mode 100644 index 009293e..0000000 --- a/tderadio3/src/include/stationselector.h +++ /dev/null @@ -1,100 +0,0 @@ -/*************************************************************************** - StationSelector.h - description - ------------------- - begin : Son Aug 3 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/tderadioapp.h b/tderadio3/src/include/tderadioapp.h deleted file mode 100644 index 8861f04..0000000 --- a/tderadio3/src/include/tderadioapp.h +++ /dev/null @@ -1,121 +0,0 @@ -/*************************************************************************** - tderadioapp.h - description - ------------------- - begin : Sa Feb 9 2002 - copyright : (C) 2002 by Klas Kalass / Martin Witte / Frank Schwanz - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/tderadioversion.h b/tderadio3/src/include/tderadioversion.h deleted file mode 100644 index adfdca1..0000000 --- a/tderadio3/src/include/tderadioversion.h +++ /dev/null @@ -1,23 +0,0 @@ -/*************************************************************************** - tderadioversion.h - description - ------------------- - begin : Su May 22 2005 - copyright : (C) 2005 by Marcus Camen - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/timecontrol_interfaces.h b/tderadio3/src/include/timecontrol_interfaces.h deleted file mode 100644 index 7fc72ac..0000000 --- a/tderadio3/src/include/timecontrol_interfaces.h +++ /dev/null @@ -1,106 +0,0 @@ -/*************************************************************************** - timecontrol_interfaces.h - description - ------------------- - begin : Mon M�r 10 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/utils.h b/tderadio3/src/include/utils.h deleted file mode 100644 index c446c82..0000000 --- a/tderadio3/src/include/utils.h +++ /dev/null @@ -1,47 +0,0 @@ -/*************************************************************************** - utils.h - description - ------------------- - begin : Sun Feb 3 2002 - copyright : (C) 2002 by Martin Witte / Frank Schwanz - email : [email protected] / [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/include/widgetplugins.h b/tderadio3/src/include/widgetplugins.h deleted file mode 100644 index 69bb0bf..0000000 --- a/tderadio3/src/include/widgetplugins.h +++ /dev/null @@ -1,75 +0,0 @@ -/*************************************************************************** - widgetplugins.h - description - ------------------- - begin : Mi Aug 27 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/internetradiostation.cpp b/tderadio3/src/internetradiostation.cpp deleted file mode 100644 index 04cd9f9..0000000 --- a/tderadio3/src/internetradiostation.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/*************************************************************************** - internetradiostation.cpp - description - ------------------- - begin : Sat March 29 2003 - copyright : (C) 2003 by Klas Kalass - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/main.cpp b/tderadio3/src/main.cpp deleted file mode 100644 index ec52b6c..0000000 --- a/tderadio3/src/main.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/*************************************************************************** - main.cpp - description - ------------------- - begin : Don M�r 8 21:57:17 CET 2001 - copyright : (C) 2001-2005 by Ernst Martin Witte, Frank Schwanz - email : [email protected], [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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"), "[email protected]"); - aboutData.addAuthor("Marcus Camen", I18N_NOOP("Buildsystem, Standards Conformance, Cleanups"), "[email protected]"); - aboutData.addAuthor("Klas Kalass", I18N_NOOP("Miscellaneous"), "[email protected]"); - aboutData.addAuthor("Frank Schwanz", I18N_NOOP("idea, first basic application"), "[email protected]"); - - 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/tderadio3/src/multibuffer.cpp b/tderadio3/src/multibuffer.cpp deleted file mode 100644 index 8f82b2f..0000000 --- a/tderadio3/src/multibuffer.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/*************************************************************************** - multibuffer.cpp - ------------------- - begin : Sat Aug 20 2005 - copyright : (C) 2005 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/plugin_configuration_dialog.cpp b/tderadio3/src/plugin_configuration_dialog.cpp deleted file mode 100644 index f202d84..0000000 --- a/tderadio3/src/plugin_configuration_dialog.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/*************************************************************************** - plugin_configuration_dialog.cpp - description - ------------------- - begin : Sam Jun 21 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/pluginmanager-configuration-ui.ui b/tderadio3/src/pluginmanager-configuration-ui.ui deleted file mode 100644 index 921da5c..0000000 --- a/tderadio3/src/pluginmanager-configuration-ui.ui +++ /dev/null @@ -1,389 +0,0 @@ -<!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&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/tderadio3/src/pluginmanager-configuration.cpp b/tderadio3/src/pluginmanager-configuration.cpp deleted file mode 100644 index 964b004..0000000 --- a/tderadio3/src/pluginmanager-configuration.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/*************************************************************************** - pluginmanager-configuration.cpp - description - ------------------- - begin : Thu Sep 30 2004 - copyright : (C) 2004 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/pluginmanager.cpp b/tderadio3/src/pluginmanager.cpp deleted file mode 100644 index b4eedf3..0000000 --- a/tderadio3/src/pluginmanager.cpp +++ /dev/null @@ -1,538 +0,0 @@ -/*************************************************************************** - pluginmanager.cpp - description - ------------------- - begin : Mon Apr 28 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/plugins.cpp b/tderadio3/src/plugins.cpp deleted file mode 100644 index 3c386b3..0000000 --- a/tderadio3/src/plugins.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/*************************************************************************** - plugins.cpp - description - ------------------- - begin : Mon M�r 10 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/po/Makefile.am b/tderadio3/src/po/Makefile.am deleted file mode 100644 index e8b16ec..0000000 --- a/tderadio3/src/po/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -POFILES = AUTO -PACKAGE = tderadio diff --git a/tderadio3/src/radio_interfaces.cpp b/tderadio3/src/radio_interfaces.cpp deleted file mode 100644 index b2bcf74..0000000 --- a/tderadio3/src/radio_interfaces.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/*************************************************************************** - radio_interfaces.cpp - description - ------------------- - begin : Don Apr 17 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/radiodevice_interfaces.cpp b/tderadio3/src/radiodevice_interfaces.cpp deleted file mode 100644 index a1e7fde..0000000 --- a/tderadio3/src/radiodevice_interfaces.cpp +++ /dev/null @@ -1,330 +0,0 @@ -/*************************************************************************** - radiodevice_interfaces.cpp - description - ------------------- - begin : Sam Apr 19 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/radiodevicepool_interfaces.cpp b/tderadio3/src/radiodevicepool_interfaces.cpp deleted file mode 100644 index 1f92e9d..0000000 --- a/tderadio3/src/radiodevicepool_interfaces.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - radiodevicepool_interface.cpp - description - ------------------- - begin : Sam Apr 19 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/radiostation-config.cpp b/tderadio3/src/radiostation-config.cpp deleted file mode 100644 index 52a692e..0000000 --- a/tderadio3/src/radiostation-config.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/*************************************************************************** - radiostation-config.cpp - description - ------------------- - begin : Sa Aug 16 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/radiostation-listview.cpp b/tderadio3/src/radiostation-listview.cpp deleted file mode 100644 index 4c7fe64..0000000 --- a/tderadio3/src/radiostation-listview.cpp +++ /dev/null @@ -1,259 +0,0 @@ -/*************************************************************************** - radiostation-listview.cpp - description - ------------------- - begin : Mi Feb 3 2004 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/radiostation.cpp b/tderadio3/src/radiostation.cpp deleted file mode 100644 index 4870f3d..0000000 --- a/tderadio3/src/radiostation.cpp +++ /dev/null @@ -1,216 +0,0 @@ -/*************************************************************************** - radiostation.cpp - description - ------------------- - begin : Sat Feb 2 2002 - copyright : (C) 2002 by Martin Witte / Frank Schwanz - email : [email protected] / [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/ringbuffer.cpp b/tderadio3/src/ringbuffer.cpp deleted file mode 100644 index 7609768..0000000 --- a/tderadio3/src/ringbuffer.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/*************************************************************************** - ringbuffer.cpp - description - ------------------- - begin : Sun March 21 2004 - copyright : (C) 2004 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/seekhelper.cpp b/tderadio3/src/seekhelper.cpp deleted file mode 100644 index eab7c1a..0000000 --- a/tderadio3/src/seekhelper.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/*************************************************************************** - seekhelper.cpp - description - ------------------- - begin : Sam Mai 10 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/soundformat.cpp b/tderadio3/src/soundformat.cpp deleted file mode 100644 index 57f9aa1..0000000 --- a/tderadio3/src/soundformat.cpp +++ /dev/null @@ -1,270 +0,0 @@ -/*************************************************************************** - soundformat.cpp - description - ------------------- - begin : Sun Aug 1 2004 - copyright : (C) 2004 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/soundstreamclient_interfaces.cpp b/tderadio3/src/soundstreamclient_interfaces.cpp deleted file mode 100644 index fd4822c..0000000 --- a/tderadio3/src/soundstreamclient_interfaces.cpp +++ /dev/null @@ -1,426 +0,0 @@ -/*************************************************************************** - sounddevice_interfaces.cpp - description - ------------------- - begin : Mon M�r 21 2004 - copyright : (C) 2004 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/soundstreamid.cpp b/tderadio3/src/soundstreamid.cpp deleted file mode 100644 index 1c9cfed..0000000 --- a/tderadio3/src/soundstreamid.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/*************************************************************************** - soundstreamid.cpp - description - ------------------- - begin : Sun Aug 1 2004 - copyright : (C) 2004 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/standardscandialog-ui.ui b/tderadio3/src/standardscandialog-ui.ui deleted file mode 100644 index 394ccfc..0000000 --- a/tderadio3/src/standardscandialog-ui.ui +++ /dev/null @@ -1,136 +0,0 @@ -<!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>&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><p align="right">nothing here</p></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/tderadio3/src/standardscandialog.cpp b/tderadio3/src/standardscandialog.cpp deleted file mode 100644 index 32f1138..0000000 --- a/tderadio3/src/standardscandialog.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/*************************************************************************** - standardscandialog.cpp - description - ------------------- - begin : Son Aug 3 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/station-drag-object.cpp b/tderadio3/src/station-drag-object.cpp deleted file mode 100644 index 29f082c..0000000 --- a/tderadio3/src/station-drag-object.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/*************************************************************************** - station-drag-object.cpp - description - ------------------- - begin : Sun Aug 28 2005 - copyright : (C) 2005 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/stationlist.cpp b/tderadio3/src/stationlist.cpp deleted file mode 100644 index b8bed53..0000000 --- a/tderadio3/src/stationlist.cpp +++ /dev/null @@ -1,494 +0,0 @@ -/*************************************************************************** - stationlist.cpp - description - ------------------- - begin : Sat March 29 2003 - copyright : (C) 2003 by Klas Kalass, Ernst Martin Witte - email : [email protected], [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/stationlistxmlhandler.cpp b/tderadio3/src/stationlistxmlhandler.cpp deleted file mode 100644 index 68bcc69..0000000 --- a/tderadio3/src/stationlistxmlhandler.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/*************************************************************************** - StationListXmlHandler.cpp - description - ------------------- - begin : Son Jan 12 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/stationselection_interfaces.cpp b/tderadio3/src/stationselection_interfaces.cpp deleted file mode 100644 index 89d0c3b..0000000 --- a/tderadio3/src/stationselection_interfaces.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/*************************************************************************** - stationselection_interfaces.cpp - description - ------------------- - begin : Son Aug 3 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/stationselector-ui.ui b/tderadio3/src/stationselector-ui.ui deleted file mode 100644 index 3020fe5..0000000 --- a/tderadio3/src/stationselector-ui.ui +++ /dev/null @@ -1,171 +0,0 @@ -<!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/tderadio3/src/stationselector.cpp b/tderadio3/src/stationselector.cpp deleted file mode 100644 index d604ea8..0000000 --- a/tderadio3/src/stationselector.cpp +++ /dev/null @@ -1,321 +0,0 @@ -/*************************************************************************** - stationselector.cpp - description - ------------------- - begin : Son Aug 3 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/tderadio.desktop b/tderadio3/src/tderadio.desktop deleted file mode 100644 index ec79af1..0000000 --- a/tderadio3/src/tderadio.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[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/tderadio3/src/tderadioapp.cpp b/tderadio3/src/tderadioapp.cpp deleted file mode 100644 index dfe28e7..0000000 --- a/tderadio3/src/tderadioapp.cpp +++ /dev/null @@ -1,370 +0,0 @@ -/************************************************************************** - tderadioapp.cpp - description - ------------------- - begin : Sa Feb 9 CET 2002 - copyright : (C) 2002 by Klas Kalass / Martin Witte / Frank Schwanz - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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"), "[email protected]"); - aboutData.addAuthor("Marcus Camen", I18N_NOOP("Buildsystem, Standards Conformance, Cleanups"), "[email protected]"); - aboutData.addAuthor("Klas Kalass", I18N_NOOP("Miscellaneous"), "[email protected]"); - aboutData.addAuthor("Frank Schwanz", I18N_NOOP("idea, first basic application"), "[email protected]"); - - 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/tderadio3/src/timecontrol_interfaces.cpp b/tderadio3/src/timecontrol_interfaces.cpp deleted file mode 100644 index 1ba4e57..0000000 --- a/tderadio3/src/timecontrol_interfaces.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/*************************************************************************** - timecontrol_interfaces.cpp - description - ------------------- - begin : Mon M�r 10 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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/tderadio3/src/utils.cpp b/tderadio3/src/utils.cpp deleted file mode 100644 index 90db463..0000000 --- a/tderadio3/src/utils.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/*************************************************************************** - utils.cpp - description - ------------------- - begin : Don Jan 9 2003 - copyright : (C) 2003 by Martin Witte / Frank Schwanz - email : [email protected] / [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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("&"), "&"); - c.replace(TQRegExp("<"), "<"); - c.replace(TQRegExp(">"), ">"); - c.replace(TQRegExp("\""), """); - c.replace(TQRegExp("'"), "'"); - 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/tderadio3/src/widgetplugins.cpp b/tderadio3/src/widgetplugins.cpp deleted file mode 100644 index 462030e..0000000 --- a/tderadio3/src/widgetplugins.cpp +++ /dev/null @@ -1,235 +0,0 @@ -/*************************************************************************** - widgetplugins.cpp - description - ------------------- - begin : Mi Aug 27 2003 - copyright : (C) 2003 by Martin Witte - email : [email protected] - ***************************************************************************/ - -/*************************************************************************** - * * - * 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; - } -} - |