From 4f99f868f09bbffa2e15733b8b7c78eba07a199e Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sun, 6 Dec 2020 21:23:48 +0900 Subject: Renaming of files in preparation for code style tools. Signed-off-by: Michele Calgaro --- arts/kde/CMakeLists.txt | 10 +- arts/kde/Makefile.am | 18 +-- arts/kde/kartsdispatcher.cc | 60 -------- arts/kde/kartsdispatcher.cpp | 60 ++++++++ arts/kde/kaudioconverter.cc | 198 -------------------------- arts/kde/kaudioconverter.cpp | 198 ++++++++++++++++++++++++++ arts/kde/kconverttest.cc | 96 ------------- arts/kde/kconverttest.cpp | 96 +++++++++++++ arts/kde/kiotest.cc | 54 ------- arts/kde/kiotest.cpp | 54 +++++++ arts/kde/kiotestslow.cc | 131 ----------------- arts/kde/kiotestslow.cpp | 131 +++++++++++++++++ arts/kde/kplayobject.cc | 301 ---------------------------------------- arts/kde/kplayobject.cpp | 301 ++++++++++++++++++++++++++++++++++++++++ arts/kde/kplayobjectcreator.cc | 104 -------------- arts/kde/kplayobjectcreator.cpp | 104 ++++++++++++++ arts/kde/kplayobjectfactory.cc | 256 ---------------------------------- arts/kde/kplayobjectfactory.cpp | 256 ++++++++++++++++++++++++++++++++++ arts/message/CMakeLists.txt | 2 +- arts/message/Makefile.am | 2 +- arts/message/artsmessage.cc | 93 ------------- arts/message/artsmessage.cpp | 93 +++++++++++++ 22 files changed, 1309 insertions(+), 1309 deletions(-) delete mode 100644 arts/kde/kartsdispatcher.cc create mode 100644 arts/kde/kartsdispatcher.cpp delete mode 100644 arts/kde/kaudioconverter.cc create mode 100644 arts/kde/kaudioconverter.cpp delete mode 100644 arts/kde/kconverttest.cc create mode 100644 arts/kde/kconverttest.cpp delete mode 100644 arts/kde/kiotest.cc create mode 100644 arts/kde/kiotest.cpp delete mode 100644 arts/kde/kiotestslow.cc create mode 100644 arts/kde/kiotestslow.cpp delete mode 100644 arts/kde/kplayobject.cc create mode 100644 arts/kde/kplayobject.cpp delete mode 100644 arts/kde/kplayobjectcreator.cc create mode 100644 arts/kde/kplayobjectcreator.cpp delete mode 100644 arts/kde/kplayobjectfactory.cc create mode 100644 arts/kde/kplayobjectfactory.cpp delete mode 100644 arts/message/artsmessage.cc create mode 100644 arts/message/artsmessage.cpp (limited to 'arts') diff --git a/arts/kde/CMakeLists.txt b/arts/kde/CMakeLists.txt index 091be3526..211a76924 100644 --- a/arts/kde/CMakeLists.txt +++ b/arts/kde/CMakeLists.txt @@ -43,15 +43,15 @@ install( FILES set( target artskde ) set( ${target}_SRCS - artskde.cc kioinputstream_impl.cpp kplayobject.cc - kplayobjectfactory.cc kartsfloatwatch.cpp kartsdispatcher.cc + artskde.cpp kioinputstream_impl.cpp kplayobject.cpp + kplayobjectfactory.cpp kartsfloatwatch.cpp kartsdispatcher.cpp kaudiorecordstream.cpp kaudioplaystream.cpp kartsserver.cpp - kdatarequest_impl.cpp kaudioconverter.cc kvideowidget.cpp - kplayobjectcreator.cc kaudiomanagerplay.cpp + kdatarequest_impl.cpp kaudioconverter.cpp kvideowidget.cpp + kplayobjectcreator.cpp kaudiomanagerplay.cpp ) add_custom_command( - OUTPUT artskde.cc artskde.h + OUTPUT artskde.cpp artskde.h COMMAND ${ARTS_MCOPIDL_EXECUTABLE} -I${ARTS_INCLUDEDIR} ${CMAKE_CURRENT_SOURCE_DIR}/artskde.idl DEPENDS artskde.idl diff --git a/arts/kde/Makefile.am b/arts/kde/Makefile.am index 37a86f2ad..394b0a32a 100644 --- a/arts/kde/Makefile.am +++ b/arts/kde/Makefile.am @@ -2,11 +2,11 @@ INCLUDES = -I$(top_builddir)/arts/kde \ -I$(top_srcdir) -I$(includedir)/arts $(all_includes) lib_LTLIBRARIES = libartskde.la -libartskde_la_SOURCES = artskde.cc kioinputstream_impl.cpp kplayobject.cc \ - kplayobjectfactory.cc kartsfloatwatch.cpp kartsdispatcher.cc \ +libartskde_la_SOURCES = artskde.cpp kioinputstream_impl.cpp kplayobject.cpp \ + kplayobjectfactory.cpp kartsfloatwatch.cpp kartsdispatcher.cpp \ kaudiorecordstream.cpp kaudioplaystream.cpp \ - kartsserver.cpp kdatarequest_impl.cpp kaudioconverter.cc \ - kvideowidget.cpp kplayobjectcreator.cc \ + kartsserver.cpp kdatarequest_impl.cpp kaudioconverter.cpp \ + kvideowidget.cpp kplayobjectcreator.cpp \ kaudiomanagerplay.cpp libartskde_la_LIBADD = $(LIB_TDEIO) -lqtmcop -lsoundserver_idl -lartsflow_idl -lmcop $(LIB_TQT) $(LIB_TDECORE) -lkmedia2_idl -lartsflow $(LIB_TDEUI) $(LIB_X11) libartskde_la_LDFLAGS = $(all_libraries) -no-undefined -version-info 3:0:2 @@ -23,15 +23,15 @@ noinst_HEADERS = kplayobjectcreator.h kplayobjectfactory_p.h artskde.mcoptype: artskde.h artskde.mcopclass: artskde.h MCOPINC = -I$(srcdir) -artskde.cc artskde.h: $(top_srcdir)/arts/kde/artskde.idl $(MCOPIDL) +artskde.cpp artskde.h: $(top_srcdir)/arts/kde/artskde.idl $(MCOPIDL) $(MCOPIDL) -I$(includedir)/arts -t $(MCOPINC) $(top_srcdir)/arts/kde/artskde.idl -DISTCLEANFILES = artskde.cc artskde.h artskde.mcoptype artskde.mcopclass +DISTCLEANFILES = artskde.cpp artskde.h artskde.mcoptype artskde.mcopclass check_PROGRAMS = kiotest kiotestslow kconverttest -kiotest_SOURCES = kiotest.cc -kiotestslow_SOURCES = kiotestslow.cc -kconverttest_SOURCES = kconverttest.cc +kiotest_SOURCES = kiotest.cpp +kiotestslow_SOURCES = kiotestslow.cpp +kconverttest_SOURCES = kconverttest.cpp kiotest_LDADD = libartskde.la -lqtmcop -lkmedia2 -lsoundserver_idl kiotestslow_LDADD = $(kiotest_LDADD) diff --git a/arts/kde/kartsdispatcher.cc b/arts/kde/kartsdispatcher.cc deleted file mode 100644 index fa41502f8..000000000 --- a/arts/kde/kartsdispatcher.cc +++ /dev/null @@ -1,60 +0,0 @@ - /* - - Copyright (C) 2001 Nikolas Zimmermann - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - */ - -#include -#include - -#include - -#include "kartsdispatcher.moc" - -int KArtsDispatcher::m_refCount = 0; -Arts::Dispatcher *KArtsDispatcher::artsDispatcher = 0; -Arts::QIOManager *KArtsDispatcher::artsQIOManager = 0; - -KArtsDispatcher::KArtsDispatcher(TQObject *parent, const char *name) - : TQObject(parent, name) -{ - m_refCount++; - if(artsDispatcher == 0) - { - if (!Arts::Dispatcher::the()) // only if no Arts::Dispatcher is created yet - { - artsQIOManager = new Arts::QIOManager(); - artsDispatcher = new Arts::Dispatcher(artsQIOManager); - } - else - kdWarning(400) << "An Arts::Dispatcher() instance exists already while trying to instantiate KArtsDispatcher!" << endl; - } -} - -KArtsDispatcher::~KArtsDispatcher() -{ - m_refCount--; - if(m_refCount == 0) - { - delete KArtsDispatcher::artsDispatcher; - artsDispatcher = 0; - - delete KArtsDispatcher::artsQIOManager; - artsQIOManager = 0; - } -} diff --git a/arts/kde/kartsdispatcher.cpp b/arts/kde/kartsdispatcher.cpp new file mode 100644 index 000000000..fa41502f8 --- /dev/null +++ b/arts/kde/kartsdispatcher.cpp @@ -0,0 +1,60 @@ + /* + + Copyright (C) 2001 Nikolas Zimmermann + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + + */ + +#include +#include + +#include + +#include "kartsdispatcher.moc" + +int KArtsDispatcher::m_refCount = 0; +Arts::Dispatcher *KArtsDispatcher::artsDispatcher = 0; +Arts::QIOManager *KArtsDispatcher::artsQIOManager = 0; + +KArtsDispatcher::KArtsDispatcher(TQObject *parent, const char *name) + : TQObject(parent, name) +{ + m_refCount++; + if(artsDispatcher == 0) + { + if (!Arts::Dispatcher::the()) // only if no Arts::Dispatcher is created yet + { + artsQIOManager = new Arts::QIOManager(); + artsDispatcher = new Arts::Dispatcher(artsQIOManager); + } + else + kdWarning(400) << "An Arts::Dispatcher() instance exists already while trying to instantiate KArtsDispatcher!" << endl; + } +} + +KArtsDispatcher::~KArtsDispatcher() +{ + m_refCount--; + if(m_refCount == 0) + { + delete KArtsDispatcher::artsDispatcher; + artsDispatcher = 0; + + delete KArtsDispatcher::artsQIOManager; + artsQIOManager = 0; + } +} diff --git a/arts/kde/kaudioconverter.cc b/arts/kde/kaudioconverter.cc deleted file mode 100644 index 1eb8c20e5..000000000 --- a/arts/kde/kaudioconverter.cc +++ /dev/null @@ -1,198 +0,0 @@ - /* - - Copyright (C) 2002 Nikolas Zimmermann - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - */ - -#include "config.h" -#include "artskde.h" -#include "connect.h" -#include "flowsystem.h" -#include "audiosubsys.h" -#include "dynamicrequest.h" -#include "kdatarequest_impl.h" -#include "kioinputstream_impl.h" -#include "kaudioconverter.moc" - -#include - -#include -#include - -#include -#include -#include -#include - -using namespace std; - -KAudioConverter::KAudioConverter() -{ - m_incoming = 0; - m_started = false; -} - -KAudioConverter::~KAudioConverter() -{ - delete m_incoming; -} - -bool KAudioConverter::setup(int samplingRate) -{ - string backupAudioIO = Arts::AudioSubSystem::the()->audioIO(); - int backupSamplingRate = Arts::AudioSubSystem::the()->samplingRate(); - - Arts::AudioSubSystem::the()->audioIO("null"); - Arts::AudioSubSystem::the()->samplingRate(samplingRate); - - if(!Arts::AudioSubSystem::the()->open()) - { - Arts::AudioSubSystem::the()->audioIO(backupAudioIO); - Arts::AudioSubSystem::the()->samplingRate(backupSamplingRate); - - return false; - } - - return true; -} - -void KAudioConverter::slotMimeType(const TQString &mimeType) -{ - m_mimeType = mimeType; - kapp->exit_loop(); -} - -void KAudioConverter::requestPlayObject(const KURL &url) -{ - string queryInterface = "Arts::PlayObject"; - - Arts::TDEIOInputStream inputStream; - - if(!url.isLocalFile()) - { - Arts::TDEIOInputStream_impl *inputStreamImpl = new Arts::TDEIOInputStream_impl(); - inputStream = Arts::TDEIOInputStream::_from_base(inputStreamImpl); - - TQObject::connect(inputStreamImpl, TQT_SIGNAL(mimeTypeFound(const TQString &)), TQT_SLOT(slotMimeType(const TQString &))); - - inputStream.openURL(url.url().latin1()); - inputStream.streamStart(); - - // ugly hacks.. :/ - kapp->enter_loop(); - - queryInterface = "Arts::StreamPlayObject"; - } - else - { - KMimeType::Ptr mimetype = KMimeType::findByURL(url); - m_mimeType = mimetype->name(); - } - - Arts::TraderQuery query; - query.supports("Interface", queryInterface); - query.supports("MimeType", string(m_mimeType.latin1())); - - string objectType; - - vector *offers = query.query(); - if(!offers->empty()) - objectType = offers->front().interfaceName(); // first offer - - delete offers; - - if(objectType.empty()) - { - m_incoming = 0; - return; - } - - if(!url.isLocalFile()) - { - Arts::StreamPlayObject result = Arts::SubClass(objectType); - result.streamMedia(inputStream); - result._node()->start(); - - m_incoming = new KPlayObject(result, true); - } - else - { - Arts::PlayObject result = Arts::SubClass(objectType); - - if(result.loadMedia(string(TQFile::encodeName(url.path())))) - { - result._node()->start(); - m_incoming = new KPlayObject(result, false); - } - else - m_incoming = 0; - } -} - -void KAudioConverter::start() -{ - if(m_started || !m_incoming) - return; - - m_started = true; - - emit rawStreamStart(); - - m_incoming->play(); - - Arts::KDataRequest_impl *requestImpl = new Arts::KDataRequest_impl(); - m_request = Arts::KDataRequest::_from_base(requestImpl); - - Arts::connect(m_incoming->object(), "left", m_request, "left"); - Arts::connect(m_incoming->object(), "right", m_request, "right"); - - TQObject::connect(requestImpl, TQT_SIGNAL(newBlockSize(long)), TQT_SIGNAL(newBlockSize(long))); - TQObject::connect(requestImpl, TQT_SIGNAL(newBlockPointer(long)), TQT_SIGNAL(newBlockPointer(long))); - TQObject::connect(requestImpl, TQT_SIGNAL(newData()), TQT_SIGNAL(newData())); - - // Special mpeglib case - // TODO: needed at all?? - usleep(100000); - if(m_incoming->object()._base()->_isCompatibleWith("DecoderBaseObject")) - if(!Arts::DynamicRequest(m_incoming->object()).method("_set_blocking").param(true).invoke()) - cerr << "mpeglib, and blocking attribute can't be changed?" << endl; - - m_request.start(); - - // TODO: Maybe do this async, using TQTimer::singleShot - // But jowenn i think jowenn is right -> this would - // lead to problems in slotNewData() when accessing the data - // (could already be overwritten...) - while(m_incoming->state() != Arts::posIdle) - m_request.goOn(); - - stop(); -} - -void KAudioConverter::stop() -{ - if(!m_started || !m_incoming) - return; - - m_incoming->halt(); - m_request.streamEnd(); - - m_started = false; - - emit rawStreamFinished(); -} diff --git a/arts/kde/kaudioconverter.cpp b/arts/kde/kaudioconverter.cpp new file mode 100644 index 000000000..1eb8c20e5 --- /dev/null +++ b/arts/kde/kaudioconverter.cpp @@ -0,0 +1,198 @@ + /* + + Copyright (C) 2002 Nikolas Zimmermann + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + + */ + +#include "config.h" +#include "artskde.h" +#include "connect.h" +#include "flowsystem.h" +#include "audiosubsys.h" +#include "dynamicrequest.h" +#include "kdatarequest_impl.h" +#include "kioinputstream_impl.h" +#include "kaudioconverter.moc" + +#include + +#include +#include + +#include +#include +#include +#include + +using namespace std; + +KAudioConverter::KAudioConverter() +{ + m_incoming = 0; + m_started = false; +} + +KAudioConverter::~KAudioConverter() +{ + delete m_incoming; +} + +bool KAudioConverter::setup(int samplingRate) +{ + string backupAudioIO = Arts::AudioSubSystem::the()->audioIO(); + int backupSamplingRate = Arts::AudioSubSystem::the()->samplingRate(); + + Arts::AudioSubSystem::the()->audioIO("null"); + Arts::AudioSubSystem::the()->samplingRate(samplingRate); + + if(!Arts::AudioSubSystem::the()->open()) + { + Arts::AudioSubSystem::the()->audioIO(backupAudioIO); + Arts::AudioSubSystem::the()->samplingRate(backupSamplingRate); + + return false; + } + + return true; +} + +void KAudioConverter::slotMimeType(const TQString &mimeType) +{ + m_mimeType = mimeType; + kapp->exit_loop(); +} + +void KAudioConverter::requestPlayObject(const KURL &url) +{ + string queryInterface = "Arts::PlayObject"; + + Arts::TDEIOInputStream inputStream; + + if(!url.isLocalFile()) + { + Arts::TDEIOInputStream_impl *inputStreamImpl = new Arts::TDEIOInputStream_impl(); + inputStream = Arts::TDEIOInputStream::_from_base(inputStreamImpl); + + TQObject::connect(inputStreamImpl, TQT_SIGNAL(mimeTypeFound(const TQString &)), TQT_SLOT(slotMimeType(const TQString &))); + + inputStream.openURL(url.url().latin1()); + inputStream.streamStart(); + + // ugly hacks.. :/ + kapp->enter_loop(); + + queryInterface = "Arts::StreamPlayObject"; + } + else + { + KMimeType::Ptr mimetype = KMimeType::findByURL(url); + m_mimeType = mimetype->name(); + } + + Arts::TraderQuery query; + query.supports("Interface", queryInterface); + query.supports("MimeType", string(m_mimeType.latin1())); + + string objectType; + + vector *offers = query.query(); + if(!offers->empty()) + objectType = offers->front().interfaceName(); // first offer + + delete offers; + + if(objectType.empty()) + { + m_incoming = 0; + return; + } + + if(!url.isLocalFile()) + { + Arts::StreamPlayObject result = Arts::SubClass(objectType); + result.streamMedia(inputStream); + result._node()->start(); + + m_incoming = new KPlayObject(result, true); + } + else + { + Arts::PlayObject result = Arts::SubClass(objectType); + + if(result.loadMedia(string(TQFile::encodeName(url.path())))) + { + result._node()->start(); + m_incoming = new KPlayObject(result, false); + } + else + m_incoming = 0; + } +} + +void KAudioConverter::start() +{ + if(m_started || !m_incoming) + return; + + m_started = true; + + emit rawStreamStart(); + + m_incoming->play(); + + Arts::KDataRequest_impl *requestImpl = new Arts::KDataRequest_impl(); + m_request = Arts::KDataRequest::_from_base(requestImpl); + + Arts::connect(m_incoming->object(), "left", m_request, "left"); + Arts::connect(m_incoming->object(), "right", m_request, "right"); + + TQObject::connect(requestImpl, TQT_SIGNAL(newBlockSize(long)), TQT_SIGNAL(newBlockSize(long))); + TQObject::connect(requestImpl, TQT_SIGNAL(newBlockPointer(long)), TQT_SIGNAL(newBlockPointer(long))); + TQObject::connect(requestImpl, TQT_SIGNAL(newData()), TQT_SIGNAL(newData())); + + // Special mpeglib case + // TODO: needed at all?? + usleep(100000); + if(m_incoming->object()._base()->_isCompatibleWith("DecoderBaseObject")) + if(!Arts::DynamicRequest(m_incoming->object()).method("_set_blocking").param(true).invoke()) + cerr << "mpeglib, and blocking attribute can't be changed?" << endl; + + m_request.start(); + + // TODO: Maybe do this async, using TQTimer::singleShot + // But jowenn i think jowenn is right -> this would + // lead to problems in slotNewData() when accessing the data + // (could already be overwritten...) + while(m_incoming->state() != Arts::posIdle) + m_request.goOn(); + + stop(); +} + +void KAudioConverter::stop() +{ + if(!m_started || !m_incoming) + return; + + m_incoming->halt(); + m_request.streamEnd(); + + m_started = false; + + emit rawStreamFinished(); +} diff --git a/arts/kde/kconverttest.cc b/arts/kde/kconverttest.cc deleted file mode 100644 index 647c2f320..000000000 --- a/arts/kde/kconverttest.cc +++ /dev/null @@ -1,96 +0,0 @@ -#include - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include "kconverttest.moc" - -using namespace std; -using namespace Arts; - -static TDECmdLineOptions options[] = -{ - { "+[URL]", I18N_NOOP("URL to open"), 0 }, - TDECmdLineLastOption -}; - -KConvertTest::KConvertTest() -{ -} - -void KConvertTest::slotRawStreamStart() -{ -// cout << "[START]\n\n" << endl; -} - -void KConvertTest::slotNewBlockSize(long blockSize) -{ - m_blockSize = blockSize; -} - -void KConvertTest::slotNewBlockPointer(long blockPointer) -{ - m_blockPointer = blockPointer; -} - -void KConvertTest::slotNewData() -{ - fwrite((void *) m_blockPointer, 1, m_blockSize, stdout); -} - -void KConvertTest::slotRawStreamFinished() -{ -// cout << "\n\n[END]" << endl; -} - -int main(int argc, char **argv) -{ - TDEAboutData aboutData("kconverttest", I18N_NOOP("KConvertTest"), I18N_NOOP("0.1"), "", TDEAboutData::License_GPL, ""); - - TDECmdLineArgs::init(argc, argv, &aboutData); - TDECmdLineArgs::addCmdLineOptions(options); - TDEApplication app; - - TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); - - KURL url; - - if(args->count()) - url = args->arg(0); - else - exit(1); - - args->clear(); - - KConvertTest *get = new KConvertTest(); - - KArtsDispatcher dispatcher; - KAudioConverter converter; - - // FIXME: crashes - // converter.setup(44100); - converter.requestPlayObject(url); - - TQObject::connect(&converter, TQT_SIGNAL(rawStreamStart()), get, TQT_SLOT(slotRawStreamStart())); - - TQObject::connect(&converter, TQT_SIGNAL(newBlockSize(long)), get, TQT_SLOT(slotNewBlockSize(long))); - TQObject::connect(&converter, TQT_SIGNAL(newBlockPointer(long)), get, TQT_SLOT(slotNewBlockPointer(long))); - TQObject::connect(&converter, TQT_SIGNAL(newData()), get, TQT_SLOT(slotNewData())); - - TQObject::connect(&converter, TQT_SIGNAL(rawStreamFinished()), get, TQT_SLOT(slotRawStreamFinished())); - - converter.start(); - - app.exec(); -} - diff --git a/arts/kde/kconverttest.cpp b/arts/kde/kconverttest.cpp new file mode 100644 index 000000000..647c2f320 --- /dev/null +++ b/arts/kde/kconverttest.cpp @@ -0,0 +1,96 @@ +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include "kconverttest.moc" + +using namespace std; +using namespace Arts; + +static TDECmdLineOptions options[] = +{ + { "+[URL]", I18N_NOOP("URL to open"), 0 }, + TDECmdLineLastOption +}; + +KConvertTest::KConvertTest() +{ +} + +void KConvertTest::slotRawStreamStart() +{ +// cout << "[START]\n\n" << endl; +} + +void KConvertTest::slotNewBlockSize(long blockSize) +{ + m_blockSize = blockSize; +} + +void KConvertTest::slotNewBlockPointer(long blockPointer) +{ + m_blockPointer = blockPointer; +} + +void KConvertTest::slotNewData() +{ + fwrite((void *) m_blockPointer, 1, m_blockSize, stdout); +} + +void KConvertTest::slotRawStreamFinished() +{ +// cout << "\n\n[END]" << endl; +} + +int main(int argc, char **argv) +{ + TDEAboutData aboutData("kconverttest", I18N_NOOP("KConvertTest"), I18N_NOOP("0.1"), "", TDEAboutData::License_GPL, ""); + + TDECmdLineArgs::init(argc, argv, &aboutData); + TDECmdLineArgs::addCmdLineOptions(options); + TDEApplication app; + + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + + KURL url; + + if(args->count()) + url = args->arg(0); + else + exit(1); + + args->clear(); + + KConvertTest *get = new KConvertTest(); + + KArtsDispatcher dispatcher; + KAudioConverter converter; + + // FIXME: crashes + // converter.setup(44100); + converter.requestPlayObject(url); + + TQObject::connect(&converter, TQT_SIGNAL(rawStreamStart()), get, TQT_SLOT(slotRawStreamStart())); + + TQObject::connect(&converter, TQT_SIGNAL(newBlockSize(long)), get, TQT_SLOT(slotNewBlockSize(long))); + TQObject::connect(&converter, TQT_SIGNAL(newBlockPointer(long)), get, TQT_SLOT(slotNewBlockPointer(long))); + TQObject::connect(&converter, TQT_SIGNAL(newData()), get, TQT_SLOT(slotNewData())); + + TQObject::connect(&converter, TQT_SIGNAL(rawStreamFinished()), get, TQT_SLOT(slotRawStreamFinished())); + + converter.start(); + + app.exec(); +} + diff --git a/arts/kde/kiotest.cc b/arts/kde/kiotest.cc deleted file mode 100644 index ed9a3fadf..000000000 --- a/arts/kde/kiotest.cc +++ /dev/null @@ -1,54 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include "qiomanager.h" -#include "artskde.h" - -using namespace std; -using namespace Arts; - - -static TDECmdLineOptions options[] = -{ - { "+[URL]", I18N_NOOP("URL to open"), 0 }, - TDECmdLineLastOption -}; - -int main(int argc, char **argv) -{ - TDEAboutData aboutData( "kiotest", I18N_NOOP("KIOTest"), I18N_NOOP("0.1"), "", TDEAboutData::License_GPL, ""); - - TDECmdLineArgs::init(argc,argv,&aboutData); - TDECmdLineArgs::addCmdLineOptions(options); - TDEApplication app; - QIOManager qiomanager; - Dispatcher dispatcher(&qiomanager); - TDEIOInputStream stream; - StdoutWriter writer; - - TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); - - if(args->count()) - { - if(!stream.openURL(args->arg(0))) - { - printf("can't open url"); - exit(1); - } - } - else - exit(1); - - args->clear(); - - connect(stream, writer); - - writer.start(); - stream.start(); - - app.exec(); -} diff --git a/arts/kde/kiotest.cpp b/arts/kde/kiotest.cpp new file mode 100644 index 000000000..ed9a3fadf --- /dev/null +++ b/arts/kde/kiotest.cpp @@ -0,0 +1,54 @@ +#include +#include +#include +#include +#include +#include +#include +#include "qiomanager.h" +#include "artskde.h" + +using namespace std; +using namespace Arts; + + +static TDECmdLineOptions options[] = +{ + { "+[URL]", I18N_NOOP("URL to open"), 0 }, + TDECmdLineLastOption +}; + +int main(int argc, char **argv) +{ + TDEAboutData aboutData( "kiotest", I18N_NOOP("KIOTest"), I18N_NOOP("0.1"), "", TDEAboutData::License_GPL, ""); + + TDECmdLineArgs::init(argc,argv,&aboutData); + TDECmdLineArgs::addCmdLineOptions(options); + TDEApplication app; + QIOManager qiomanager; + Dispatcher dispatcher(&qiomanager); + TDEIOInputStream stream; + StdoutWriter writer; + + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + + if(args->count()) + { + if(!stream.openURL(args->arg(0))) + { + printf("can't open url"); + exit(1); + } + } + else + exit(1); + + args->clear(); + + connect(stream, writer); + + writer.start(); + stream.start(); + + app.exec(); +} diff --git a/arts/kde/kiotestslow.cc b/arts/kde/kiotestslow.cc deleted file mode 100644 index 93bfac388..000000000 --- a/arts/kde/kiotestslow.cc +++ /dev/null @@ -1,131 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include "qiomanager.h" -#include "artskde.h" - -using namespace std; -using namespace Arts; - -namespace Arts { -/* simulate slow receiver */ -class KIOTestSlow_impl : public KIOTestSlow_skel, - public TimeNotify, - public StdSynthModule -{ - int pos; - list< DataPacket* > q; - InputStream _inputStream; - -public: - InputStream inputStream() { return _inputStream; } - void inputStream(InputStream i) { _inputStream = i; } - - KIOTestSlow_impl() - { - Dispatcher::the()->ioManager()->addTimer(10, this); - pos = 0; - } - void notifyTime() - { - if(!_inputStream.isNull() && _inputStream.eof()) - { - printf("\n[*EOF*] remaining = %d packets\n"); - _inputStream = InputStream::null(); - return; - } - - int TODO = 100; - do { - if(q.empty()) - return; - - DataPacket *p = q.front(); - char ch = p->contents[pos++]; - if(p->size == pos) - { - p->processed(); - q.pop_front(); - pos = 0; - } - - if(ch == '\n') - { - long size = 0; - list*>::iterator i; - for(i = q.begin(); i != q.end(); i++) - size += (*i)->size; - printf("\n[queued %8ld] ",size-pos); - } - else - putchar(ch); - - } while(TODO-- > 0); - } - void process_data(DataPacket *p) - { - if(p->size == 0) - p->processed(); - else - q.push_back(p); - } -}; -REGISTER_IMPLEMENTATION(KIOTestSlow_impl); -}; - -static TDECmdLineOptions options[] = -{ - { "+[URL]", I18N_NOOP("URL to open"), 0 }, - TDECmdLineLastOption -}; - -#undef USE_FILEINPUTSTREAM - -int main(int argc, char **argv) -{ - TDEAboutData aboutData( "kiotestslow", I18N_NOOP("KIOTest"), I18N_NOOP("0.1"), "", TDEAboutData::License_GPL, ""); - - TDECmdLineArgs::init(argc,argv,&aboutData); - TDECmdLineArgs::addCmdLineOptions(options); - TDEApplication app; - QIOManager qiomanager; - Dispatcher dispatcher(&qiomanager); -#ifndef USE_FILEINPUTSTREAM - TDEIOInputStream stream; -#else - FileInputStream stream; -#endif - KIOTestSlow writer; - - TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); - - if(args->count()) - { -#ifdef USE_FILEINPUTSTREAM - if(!stream.open(args->arg(0))) -#else - if(!stream.openURL(args->arg(0))) -#endif - { - printf("can't open url"); - exit(1); - } - } - else - exit(1); - - args->clear(); - - writer.inputStream(stream); - connect(stream, writer); - - writer.start(); - stream.start(); - - app.exec(); -} diff --git a/arts/kde/kiotestslow.cpp b/arts/kde/kiotestslow.cpp new file mode 100644 index 000000000..93bfac388 --- /dev/null +++ b/arts/kde/kiotestslow.cpp @@ -0,0 +1,131 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include "qiomanager.h" +#include "artskde.h" + +using namespace std; +using namespace Arts; + +namespace Arts { +/* simulate slow receiver */ +class KIOTestSlow_impl : public KIOTestSlow_skel, + public TimeNotify, + public StdSynthModule +{ + int pos; + list< DataPacket* > q; + InputStream _inputStream; + +public: + InputStream inputStream() { return _inputStream; } + void inputStream(InputStream i) { _inputStream = i; } + + KIOTestSlow_impl() + { + Dispatcher::the()->ioManager()->addTimer(10, this); + pos = 0; + } + void notifyTime() + { + if(!_inputStream.isNull() && _inputStream.eof()) + { + printf("\n[*EOF*] remaining = %d packets\n"); + _inputStream = InputStream::null(); + return; + } + + int TODO = 100; + do { + if(q.empty()) + return; + + DataPacket *p = q.front(); + char ch = p->contents[pos++]; + if(p->size == pos) + { + p->processed(); + q.pop_front(); + pos = 0; + } + + if(ch == '\n') + { + long size = 0; + list*>::iterator i; + for(i = q.begin(); i != q.end(); i++) + size += (*i)->size; + printf("\n[queued %8ld] ",size-pos); + } + else + putchar(ch); + + } while(TODO-- > 0); + } + void process_data(DataPacket *p) + { + if(p->size == 0) + p->processed(); + else + q.push_back(p); + } +}; +REGISTER_IMPLEMENTATION(KIOTestSlow_impl); +}; + +static TDECmdLineOptions options[] = +{ + { "+[URL]", I18N_NOOP("URL to open"), 0 }, + TDECmdLineLastOption +}; + +#undef USE_FILEINPUTSTREAM + +int main(int argc, char **argv) +{ + TDEAboutData aboutData( "kiotestslow", I18N_NOOP("KIOTest"), I18N_NOOP("0.1"), "", TDEAboutData::License_GPL, ""); + + TDECmdLineArgs::init(argc,argv,&aboutData); + TDECmdLineArgs::addCmdLineOptions(options); + TDEApplication app; + QIOManager qiomanager; + Dispatcher dispatcher(&qiomanager); +#ifndef USE_FILEINPUTSTREAM + TDEIOInputStream stream; +#else + FileInputStream stream; +#endif + KIOTestSlow writer; + + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + + if(args->count()) + { +#ifdef USE_FILEINPUTSTREAM + if(!stream.open(args->arg(0))) +#else + if(!stream.openURL(args->arg(0))) +#endif + { + printf("can't open url"); + exit(1); + } + } + else + exit(1); + + args->clear(); + + writer.inputStream(stream); + connect(stream, writer); + + writer.start(); + stream.start(); + + app.exec(); +} diff --git a/arts/kde/kplayobject.cc b/arts/kde/kplayobject.cc deleted file mode 100644 index f11c0eb8f..000000000 --- a/arts/kde/kplayobject.cc +++ /dev/null @@ -1,301 +0,0 @@ - /* - - Copyright (C) 2001 Nikolas Zimmermann - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - */ - -#include "kplayobject.h" -#include "kplayobject.moc" -#include "kplayobjectcreator.h" -#include - -KPlayObject::KPlayObject() : TQObject() -{ - m_playObject = Arts::PlayObject::null(); - m_isStream = false; -} - -KPlayObject::KPlayObject(Arts::PlayObject playobject, bool isStream) : TQObject() -{ - m_playObject = playobject; - m_isStream = isStream; -} - -KPlayObject::~KPlayObject() -{ -} - -void KPlayObject::play() -{ - object().play(); -} - -void KPlayObject::seek(Arts::poTime newTime) -{ - if(!m_isStream) - object().seek(newTime); - else - kdDebug( 400 ) << "Seeking in a Stream? huh?" << endl; -} - -void KPlayObject::pause() -{ - object().pause(); -} - -void KPlayObject::halt() -{ - object().halt(); -} - -TQString KPlayObject::description() -{ - return TQString::fromLatin1(object().description().c_str()); -} - -Arts::poTime KPlayObject::currentTime() -{ - return object().currentTime(); -} - -Arts::poTime KPlayObject::overallTime() -{ - return object().overallTime(); -} - -Arts::poCapabilities KPlayObject::capabilities() -{ - return object().capabilities(); -} - -TQString KPlayObject::mediaName() -{ - return TQString::fromLatin1(object().mediaName().c_str()); -} - -Arts::poState KPlayObject::state() -{ - return object().state(); -} - -Arts::PlayObject KPlayObject::object() -{ - return m_playObject; -} - -bool KPlayObject::isNull() -{ - if( !this ) - return true; - return object().isNull(); -} - -void KPlayObject::setObject(Arts::PlayObject playObject) -{ - m_playObject = playObject; -} - -bool KPlayObject::stream() -{ - return m_isStream; -} - -struct KDE::PlayObject::PrivateData -{ - PrivateData() : creator( 0 ), - isProxy( false ), - internalState( Arts::posIdle ) {} - ~PrivateData() { - delete creator; - } - Arts::SoundServerV2 server; - KDE::PlayObjectCreator* creator; - bool createBUS; - bool isProxy; - Arts::poState internalState; - KURL url; -}; - -KDE::PlayObject::PlayObject() : TQObject() -{ - m_playObject = Arts::PlayObject::null(); - m_isStream = false; - d = new PrivateData; -} - -KDE::PlayObject::PlayObject(Arts::PlayObject playobject, bool isStream) : TQObject() -{ - m_playObject = playobject; - m_isStream = isStream; - d = new PrivateData; - - //very funny! you can't connect to signals before creating - //the object - so nobody will ever receive this signal (mkretz) - // - //emit playObjectCreated(); -} - -KDE::PlayObject::PlayObject( Arts::SoundServerV2 server, const KURL& url, bool isStream, bool createBUS ) : TQObject() -{ - kdDebug( 400 ) << "KDE::PlayObject: created as proxy for URL " << url.url()<< endl; - - m_playObject = Arts::PlayObject::null(); - m_isStream = isStream; - d = new PrivateData; - d->server = server; - d->url = url; - d->createBUS = createBUS; - d->isProxy = true; -} - -KDE::PlayObject::~PlayObject() -{ - kdDebug( 400 ) << "KDE::PlayObject: destroyed" << endl; - - delete d; -} - -void KDE::PlayObject::play() -{ - kdDebug( 400 ) << "KDE::PlayObject::play()" << endl; - - if ( object().isNull() ) { - if ( m_isStream ) { - if ( d->creator ) - delete d->creator; - d->creator = new KDE::PlayObjectCreator( d->server ); - d->creator->create( d->url, d->createBUS, this, TQT_SLOT( attachPlayObject( Arts::PlayObject ) ) ); - kdDebug( 400 ) << "KDE::PlayObject::play(): creator called" << endl; - d->internalState = Arts::posPlaying; - } - return; - } - object().play(); -} - -void KDE::PlayObject::attachPlayObject( Arts::PlayObject playObject ) -{ - kdDebug( 400 ) << "KDE::PlayObject::attachPlayObject()" << endl; - - m_playObject = playObject; - emit playObjectCreated(); - if ( object().isNull() ) - return; - switch ( d->internalState ) { - case Arts::posIdle: - object().halt(); - break; - case Arts::posPaused: - object().pause(); - break; - case Arts::posPlaying: - object().play (); - break; - } -} - -void KDE::PlayObject::seek(Arts::poTime newTime) -{ - if ( object().isNull() ) - return; - if(!m_isStream) - object().seek(newTime); - else - kdDebug( 400 ) << "Seeking in a Stream? huh?" << endl; -} - -void KDE::PlayObject::pause() -{ - if ( !object().isNull() ) - object().pause(); - d->internalState = Arts::posPaused; -} - -void KDE::PlayObject::halt() -{ - kdDebug( 400 ) << "KDE::PlayObject::halt()" << endl; - if ( !object().isNull() ) - object().halt(); - else if ( d->creator ) { - delete d->creator; - d->creator = 0; - kdDebug( 400 ) << "KDE::PlayObject::halt(): creator destroyed" << endl; - } - d->internalState = Arts::posIdle; -} - -TQString KDE::PlayObject::description() -{ - if ( object().isNull() ) - return TQString(); - return TQString::fromLatin1(object().description().c_str()); -} - -Arts::poTime KDE::PlayObject::currentTime() -{ - if ( object().isNull() ) - return Arts::poTime( 0, 0, -1, "" ); - return object().currentTime(); -} - -Arts::poTime KDE::PlayObject::overallTime() -{ - if ( object().isNull() ) - return Arts::poTime( 0, 0, -1, "" ); - return object().overallTime(); -} - -Arts::poCapabilities KDE::PlayObject::capabilities() -{ - if ( object().isNull() ) - return static_cast( 0 ); - return object().capabilities(); -} - -TQString KDE::PlayObject::mediaName() -{ - if ( object().isNull() ) - return TQString(); - return TQString::fromLatin1(object().mediaName().c_str()); -} - -Arts::poState KDE::PlayObject::state() -{ - if ( object().isNull() ) - return d->internalState; - return object().state(); -} - -Arts::PlayObject KDE::PlayObject::object() -{ - return m_playObject; -} - -bool KDE::PlayObject::isNull() -{ - if ( !this ) - return true; - if ( d->isProxy ) - return false; - return object().isNull(); -} - -bool KDE::PlayObject::stream() -{ - return m_isStream; -} diff --git a/arts/kde/kplayobject.cpp b/arts/kde/kplayobject.cpp new file mode 100644 index 000000000..f11c0eb8f --- /dev/null +++ b/arts/kde/kplayobject.cpp @@ -0,0 +1,301 @@ + /* + + Copyright (C) 2001 Nikolas Zimmermann + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + + */ + +#include "kplayobject.h" +#include "kplayobject.moc" +#include "kplayobjectcreator.h" +#include + +KPlayObject::KPlayObject() : TQObject() +{ + m_playObject = Arts::PlayObject::null(); + m_isStream = false; +} + +KPlayObject::KPlayObject(Arts::PlayObject playobject, bool isStream) : TQObject() +{ + m_playObject = playobject; + m_isStream = isStream; +} + +KPlayObject::~KPlayObject() +{ +} + +void KPlayObject::play() +{ + object().play(); +} + +void KPlayObject::seek(Arts::poTime newTime) +{ + if(!m_isStream) + object().seek(newTime); + else + kdDebug( 400 ) << "Seeking in a Stream? huh?" << endl; +} + +void KPlayObject::pause() +{ + object().pause(); +} + +void KPlayObject::halt() +{ + object().halt(); +} + +TQString KPlayObject::description() +{ + return TQString::fromLatin1(object().description().c_str()); +} + +Arts::poTime KPlayObject::currentTime() +{ + return object().currentTime(); +} + +Arts::poTime KPlayObject::overallTime() +{ + return object().overallTime(); +} + +Arts::poCapabilities KPlayObject::capabilities() +{ + return object().capabilities(); +} + +TQString KPlayObject::mediaName() +{ + return TQString::fromLatin1(object().mediaName().c_str()); +} + +Arts::poState KPlayObject::state() +{ + return object().state(); +} + +Arts::PlayObject KPlayObject::object() +{ + return m_playObject; +} + +bool KPlayObject::isNull() +{ + if( !this ) + return true; + return object().isNull(); +} + +void KPlayObject::setObject(Arts::PlayObject playObject) +{ + m_playObject = playObject; +} + +bool KPlayObject::stream() +{ + return m_isStream; +} + +struct KDE::PlayObject::PrivateData +{ + PrivateData() : creator( 0 ), + isProxy( false ), + internalState( Arts::posIdle ) {} + ~PrivateData() { + delete creator; + } + Arts::SoundServerV2 server; + KDE::PlayObjectCreator* creator; + bool createBUS; + bool isProxy; + Arts::poState internalState; + KURL url; +}; + +KDE::PlayObject::PlayObject() : TQObject() +{ + m_playObject = Arts::PlayObject::null(); + m_isStream = false; + d = new PrivateData; +} + +KDE::PlayObject::PlayObject(Arts::PlayObject playobject, bool isStream) : TQObject() +{ + m_playObject = playobject; + m_isStream = isStream; + d = new PrivateData; + + //very funny! you can't connect to signals before creating + //the object - so nobody will ever receive this signal (mkretz) + // + //emit playObjectCreated(); +} + +KDE::PlayObject::PlayObject( Arts::SoundServerV2 server, const KURL& url, bool isStream, bool createBUS ) : TQObject() +{ + kdDebug( 400 ) << "KDE::PlayObject: created as proxy for URL " << url.url()<< endl; + + m_playObject = Arts::PlayObject::null(); + m_isStream = isStream; + d = new PrivateData; + d->server = server; + d->url = url; + d->createBUS = createBUS; + d->isProxy = true; +} + +KDE::PlayObject::~PlayObject() +{ + kdDebug( 400 ) << "KDE::PlayObject: destroyed" << endl; + + delete d; +} + +void KDE::PlayObject::play() +{ + kdDebug( 400 ) << "KDE::PlayObject::play()" << endl; + + if ( object().isNull() ) { + if ( m_isStream ) { + if ( d->creator ) + delete d->creator; + d->creator = new KDE::PlayObjectCreator( d->server ); + d->creator->create( d->url, d->createBUS, this, TQT_SLOT( attachPlayObject( Arts::PlayObject ) ) ); + kdDebug( 400 ) << "KDE::PlayObject::play(): creator called" << endl; + d->internalState = Arts::posPlaying; + } + return; + } + object().play(); +} + +void KDE::PlayObject::attachPlayObject( Arts::PlayObject playObject ) +{ + kdDebug( 400 ) << "KDE::PlayObject::attachPlayObject()" << endl; + + m_playObject = playObject; + emit playObjectCreated(); + if ( object().isNull() ) + return; + switch ( d->internalState ) { + case Arts::posIdle: + object().halt(); + break; + case Arts::posPaused: + object().pause(); + break; + case Arts::posPlaying: + object().play (); + break; + } +} + +void KDE::PlayObject::seek(Arts::poTime newTime) +{ + if ( object().isNull() ) + return; + if(!m_isStream) + object().seek(newTime); + else + kdDebug( 400 ) << "Seeking in a Stream? huh?" << endl; +} + +void KDE::PlayObject::pause() +{ + if ( !object().isNull() ) + object().pause(); + d->internalState = Arts::posPaused; +} + +void KDE::PlayObject::halt() +{ + kdDebug( 400 ) << "KDE::PlayObject::halt()" << endl; + if ( !object().isNull() ) + object().halt(); + else if ( d->creator ) { + delete d->creator; + d->creator = 0; + kdDebug( 400 ) << "KDE::PlayObject::halt(): creator destroyed" << endl; + } + d->internalState = Arts::posIdle; +} + +TQString KDE::PlayObject::description() +{ + if ( object().isNull() ) + return TQString(); + return TQString::fromLatin1(object().description().c_str()); +} + +Arts::poTime KDE::PlayObject::currentTime() +{ + if ( object().isNull() ) + return Arts::poTime( 0, 0, -1, "" ); + return object().currentTime(); +} + +Arts::poTime KDE::PlayObject::overallTime() +{ + if ( object().isNull() ) + return Arts::poTime( 0, 0, -1, "" ); + return object().overallTime(); +} + +Arts::poCapabilities KDE::PlayObject::capabilities() +{ + if ( object().isNull() ) + return static_cast( 0 ); + return object().capabilities(); +} + +TQString KDE::PlayObject::mediaName() +{ + if ( object().isNull() ) + return TQString(); + return TQString::fromLatin1(object().mediaName().c_str()); +} + +Arts::poState KDE::PlayObject::state() +{ + if ( object().isNull() ) + return d->internalState; + return object().state(); +} + +Arts::PlayObject KDE::PlayObject::object() +{ + return m_playObject; +} + +bool KDE::PlayObject::isNull() +{ + if ( !this ) + return true; + if ( d->isProxy ) + return false; + return object().isNull(); +} + +bool KDE::PlayObject::stream() +{ + return m_isStream; +} diff --git a/arts/kde/kplayobjectcreator.cc b/arts/kde/kplayobjectcreator.cc deleted file mode 100644 index 039c8a3bc..000000000 --- a/arts/kde/kplayobjectcreator.cc +++ /dev/null @@ -1,104 +0,0 @@ - /* - - Copyright (C) 2002 Matthias Welwarsky - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - */ - -#include -#include "artskde.h" -#include "kplayobjectcreator.h" -#include "kplayobjectcreator.moc" -#include "kioinputstream_impl.h" - -#include - -#include - -KDE::PlayObjectCreator::PlayObjectCreator(Arts::SoundServerV2 server) -{ - m_server = server; -} - -KDE::PlayObjectCreator::~PlayObjectCreator() -{ -} - -bool KDE::PlayObjectCreator::create(const KURL& url, bool createBUS, const TQObject* receiver, const char* slot) -{ - // no need to go any further, and I hate deep indentation - if (m_server.isNull() || url.isEmpty() ) - return false; - - connect( this, TQT_SIGNAL( playObjectCreated( Arts::PlayObject ) ), - receiver, slot ); - - // check if the URL is a local file - if (!url.isLocalFile()) - { - m_createBUS = createBUS; - - // This is the RightWay(tm) according to stw - Arts::TDEIOInputStream_impl* instream_impl = new Arts::TDEIOInputStream_impl(); - m_instream = Arts::TDEIOInputStream::_from_base(instream_impl); - - // signal will be called once the ioslave knows the mime-type of the stream - connect(instream_impl, TQT_SIGNAL(mimeTypeFound(const TQString &)), - this, TQT_SLOT(slotMimeType(const TQString &))); - - // GO! - m_instream.openURL(url.url().latin1()); - m_instream.streamStart(); - - return true; - } - kdDebug( 400 ) << "stream is local file: " << url.url() << endl; - - // usual stuff if we have a local file - KMimeType::Ptr mimetype = KMimeType::findByURL(url); - emit playObjectCreated ( - m_server.createPlayObjectForURL(std::string(TQFile::encodeName(url.path())), - std::string(mimetype->name().latin1()), - createBUS) - ); - return true; -} - -void KDE::PlayObjectCreator::slotMimeType(const TQString& mimetype) -{ - - kdDebug( 400 ) << "slotMimeType called: " << mimetype << endl; - - TQString mimetype_copy = mimetype; - - if ( mimetype_copy == "application/octet-stream" ) - mimetype_copy = TQString("audio/x-mp3"); - - if (mimetype_copy == "application/x-zerosize") - emit playObjectCreated(Arts::PlayObject::null()); - - playObject = m_server.createPlayObjectForStream( - m_instream, - std::string( mimetype_copy.latin1() ), - m_createBUS ); - if ( playObject.isNull() ) { - m_instream.streamEnd(); - emit playObjectCreated( Arts::PlayObject::null() ); - return; - } - emit playObjectCreated( playObject ); -} diff --git a/arts/kde/kplayobjectcreator.cpp b/arts/kde/kplayobjectcreator.cpp new file mode 100644 index 000000000..039c8a3bc --- /dev/null +++ b/arts/kde/kplayobjectcreator.cpp @@ -0,0 +1,104 @@ + /* + + Copyright (C) 2002 Matthias Welwarsky + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + + */ + +#include +#include "artskde.h" +#include "kplayobjectcreator.h" +#include "kplayobjectcreator.moc" +#include "kioinputstream_impl.h" + +#include + +#include + +KDE::PlayObjectCreator::PlayObjectCreator(Arts::SoundServerV2 server) +{ + m_server = server; +} + +KDE::PlayObjectCreator::~PlayObjectCreator() +{ +} + +bool KDE::PlayObjectCreator::create(const KURL& url, bool createBUS, const TQObject* receiver, const char* slot) +{ + // no need to go any further, and I hate deep indentation + if (m_server.isNull() || url.isEmpty() ) + return false; + + connect( this, TQT_SIGNAL( playObjectCreated( Arts::PlayObject ) ), + receiver, slot ); + + // check if the URL is a local file + if (!url.isLocalFile()) + { + m_createBUS = createBUS; + + // This is the RightWay(tm) according to stw + Arts::TDEIOInputStream_impl* instream_impl = new Arts::TDEIOInputStream_impl(); + m_instream = Arts::TDEIOInputStream::_from_base(instream_impl); + + // signal will be called once the ioslave knows the mime-type of the stream + connect(instream_impl, TQT_SIGNAL(mimeTypeFound(const TQString &)), + this, TQT_SLOT(slotMimeType(const TQString &))); + + // GO! + m_instream.openURL(url.url().latin1()); + m_instream.streamStart(); + + return true; + } + kdDebug( 400 ) << "stream is local file: " << url.url() << endl; + + // usual stuff if we have a local file + KMimeType::Ptr mimetype = KMimeType::findByURL(url); + emit playObjectCreated ( + m_server.createPlayObjectForURL(std::string(TQFile::encodeName(url.path())), + std::string(mimetype->name().latin1()), + createBUS) + ); + return true; +} + +void KDE::PlayObjectCreator::slotMimeType(const TQString& mimetype) +{ + + kdDebug( 400 ) << "slotMimeType called: " << mimetype << endl; + + TQString mimetype_copy = mimetype; + + if ( mimetype_copy == "application/octet-stream" ) + mimetype_copy = TQString("audio/x-mp3"); + + if (mimetype_copy == "application/x-zerosize") + emit playObjectCreated(Arts::PlayObject::null()); + + playObject = m_server.createPlayObjectForStream( + m_instream, + std::string( mimetype_copy.latin1() ), + m_createBUS ); + if ( playObject.isNull() ) { + m_instream.streamEnd(); + emit playObjectCreated( Arts::PlayObject::null() ); + return; + } + emit playObjectCreated( playObject ); +} diff --git a/arts/kde/kplayobjectfactory.cc b/arts/kde/kplayobjectfactory.cc deleted file mode 100644 index 708fe516e..000000000 --- a/arts/kde/kplayobjectfactory.cc +++ /dev/null @@ -1,256 +0,0 @@ - /* - - Copyright (C) 2001 Nikolas Zimmermann - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - */ - -#include -#include "kplayobject.h" -#include "artskde.h" -#include "kplayobjectfactory.h" -#include "kplayobjectfactory_p.h" -#include "kplayobjectcreator.h" -#include "kioinputstream_impl.h" -#include "kartsdispatcher.h" -#include "kartsserver.h" - -#include -#include -#include "kaudiomanagerplay.h" -#include -#include - -using namespace std; - -KPlayObjectFactory::KPlayObjectFactory(Arts::SoundServerV2 server) -{ - m_server = server; - m_allowStreaming = true; - m_stream = false; -} - -KPlayObjectFactory::KPlayObjectFactory(KArtsServer* server) -{ - m_server = server->server(); - m_allowStreaming = true; - m_stream = false; -} - -KPlayObjectFactory::~KPlayObjectFactory() -{ -} - -KPlayObject *KPlayObjectFactory::createPlayObject(const KURL& url, bool createBUS) -{ - KMimeType::Ptr mimetype = KMimeType::findByURL(url); - return createPlayObject(url, mimetype->name(), createBUS); -} - - -KPlayObject *KPlayObjectFactory::createPlayObject(const KURL& _url, const TQString &mimetype, bool createBUS) -{ - // WHY DOES BROKEN TDEIO_MEDIA GIVE WRONG URLS? - // I hate it - // I hate it - // It sucks - // tdeio_media please die - KURL url = TDEIO::NetAccess::mostLocalURL(_url, 0); - - if(!m_server.isNull()) - { - if(mimetype == "application/octet-stream" && m_allowStreaming) - { - Arts::TDEIOInputStream instream; - instream.openURL(url.url().latin1()); - - m_stream = true; - - // TODO: what else than hardcoding audio/x-mp3 ? - return new KPlayObject(m_server.createPlayObjectForStream(instream, string("audio/x-mp3"), createBUS), true); - } - else - return new KPlayObject(m_server.createPlayObjectForURL(string(TQFile::encodeName(url.path())), string(mimetype.latin1()), createBUS), false); - } - else - return new KPlayObject(); -} - - - -// - -KDE::PlayObjectFactory::PlayObjectFactory(Arts::SoundServerV2 server) -{ - d = new PrivateData; - d->server = server; - d->amanPlay = 0; - d->helper = 0; - d->allowStreaming = true; - d->isStream = false; -} - -KDE::PlayObjectFactory::PlayObjectFactory(KArtsServer* server) -{ - d = new PrivateData; - d->server = server->server(); - d->amanPlay = 0; - d->helper = 0; - d->allowStreaming = true; - d->isStream = false; -} - -KDE::PlayObjectFactory::~PlayObjectFactory() -{ - delete d->helper; - delete d; -} - -void KDE::PlayObjectFactory::setAudioManagerPlay( KAudioManagerPlay * amanPlay ) -{ - d->amanPlay = amanPlay; - if( ! d->helper ) - d->helper = new POFHelper; -} - -KDE::PlayObject *KDE::PlayObjectFactory::createPlayObject(const KURL& url, bool createBUS) -{ - KMimeType::Ptr mimetype = KMimeType::findByURL(url); - return createPlayObject(url, mimetype->name(), createBUS); -} - -KDE::PlayObject *KDE::PlayObjectFactory::createPlayObject(const KURL& _url, const TQString &mimetype, bool createBUS) -{ - // WHY DOES BROKEN TDEIO_MEDIA GIVE WRONG URLS? - // I hate it - // I hate it - // It sucks - // tdeio_media please die - KURL url = TDEIO::NetAccess::mostLocalURL(_url, 0); - - // return a NULL playobject if the server is NULL - if ( d->server.isNull() || url.isEmpty() ) - return new KDE::PlayObject(); - - // if the program wants to use it's own Synth_AMAN_PLAY we don't need a - // bus - if( d->amanPlay && createBUS ) - { - kdWarning( 400 ) << "KDE::PlayObjectFactory was instructed to use a Synth_AMAN_PLAY for output but the program also asked for a Synth_BUS_UPLINK" << endl; - createBUS = false; - } - - // decide if it's a local file. mpeglib provides cdda reading and decoding, so we prefer that over tdeio_audiocd - if ( url.isLocalFile() || !d->allowStreaming || (url.protocol() == "audiocd" && mimetype == "application/x-cda" && mimeTypes().contains( "application/x-cda" ) ) ) - { - // we rely on the delivered mimetype if it's a local file - d->playObj = new KDE::PlayObject( d->server.createPlayObjectForURL( string( TQFile::encodeName( url.path() ) ), string( mimetype.latin1() ), createBUS ), false ); - } - else - { - // if non-local, let the KPlayObject figure out the mimetype itself - // this invokes asynchronous creation automatically - d->playObj = new KDE::PlayObject( d->server, url, true, createBUS ); - } - - if( d->playObj->isNull() ) - { - delete d->playObj; - d->playObj = 0; - return new KDE::PlayObject(); // return a NULL playobject - } - - if( d->amanPlay ) - { - d->helper->po = d->playObj; - d->helper->ap = d->amanPlay; - if( d->playObj->object().isNull() && d->amanPlay ) - TQObject::connect( d->playObj, TQT_SIGNAL( playObjectCreated() ), d->helper, TQT_SLOT( connectAmanPlay() ) ); - else - d->helper->connectAmanPlay(); - } - - return d->playObj; -} - -TQStringList KDE::PlayObjectFactory::mimeTypes(void) -{ - KArtsDispatcher dispatcher; // we need such a thing, otherwise we crash - Arts::TraderQuery query; - vector *offers = query.query(); - - TQStringList results; - for(vector::iterator offer = offers->begin(); - offer != offers->end(); ++offer) - { - vector *mimetypes = (*offer).getProperty("MimeType"); - - for(vector::iterator mimetype = mimetypes->begin(); - mimetype != mimetypes->end(); ++mimetype) - { - TQString name = TQString(TQString::fromLocal8Bit((*mimetype).c_str())).stripWhiteSpace(); - if(KMimeType::mimeType(name)) - results.append(name); - } - - delete mimetypes; - } - delete offers; - - // clean out duplicates - results.sort(); - for(TQStringList::iterator result = results.begin(); result != results.end(); ) - { - TQStringList::iterator previous = result; - ++result; - if(result != results.end() && *result == *previous) - { - results.remove(result); - result = previous; - } - } - - return results; -} - -/* ### KDE4 -void KDE::PlayObjectFactory::connectAmanPlay() -{ - kdDebug( 400 ) << k_funcinfo << endl; - if( d->playObj->object().isNull() ) - return; - - d->amanPlay->start(); - d->playObj->object()._node()->start(); - Arts::connect( d->playObj->object(), "left" , d->amanPlay->amanPlay(), "left" ); - Arts::connect( d->playObj->object(), "right", d->amanPlay->amanPlay(), "right" ); -} -*/ - -void KDE::POFHelper::connectAmanPlay() -{ - kdDebug( 400 ) << k_funcinfo << endl; - if( po->object().isNull() ) - return; - - ap->start(); - po->object()._node()->start(); - Arts::connect( po->object(), "left" , ap->amanPlay(), "left" ); - Arts::connect( po->object(), "right", ap->amanPlay(), "right" ); -} - -#include "kplayobjectfactory_p.moc" diff --git a/arts/kde/kplayobjectfactory.cpp b/arts/kde/kplayobjectfactory.cpp new file mode 100644 index 000000000..708fe516e --- /dev/null +++ b/arts/kde/kplayobjectfactory.cpp @@ -0,0 +1,256 @@ + /* + + Copyright (C) 2001 Nikolas Zimmermann + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + + */ + +#include +#include "kplayobject.h" +#include "artskde.h" +#include "kplayobjectfactory.h" +#include "kplayobjectfactory_p.h" +#include "kplayobjectcreator.h" +#include "kioinputstream_impl.h" +#include "kartsdispatcher.h" +#include "kartsserver.h" + +#include +#include +#include "kaudiomanagerplay.h" +#include +#include + +using namespace std; + +KPlayObjectFactory::KPlayObjectFactory(Arts::SoundServerV2 server) +{ + m_server = server; + m_allowStreaming = true; + m_stream = false; +} + +KPlayObjectFactory::KPlayObjectFactory(KArtsServer* server) +{ + m_server = server->server(); + m_allowStreaming = true; + m_stream = false; +} + +KPlayObjectFactory::~KPlayObjectFactory() +{ +} + +KPlayObject *KPlayObjectFactory::createPlayObject(const KURL& url, bool createBUS) +{ + KMimeType::Ptr mimetype = KMimeType::findByURL(url); + return createPlayObject(url, mimetype->name(), createBUS); +} + + +KPlayObject *KPlayObjectFactory::createPlayObject(const KURL& _url, const TQString &mimetype, bool createBUS) +{ + // WHY DOES BROKEN TDEIO_MEDIA GIVE WRONG URLS? + // I hate it + // I hate it + // It sucks + // tdeio_media please die + KURL url = TDEIO::NetAccess::mostLocalURL(_url, 0); + + if(!m_server.isNull()) + { + if(mimetype == "application/octet-stream" && m_allowStreaming) + { + Arts::TDEIOInputStream instream; + instream.openURL(url.url().latin1()); + + m_stream = true; + + // TODO: what else than hardcoding audio/x-mp3 ? + return new KPlayObject(m_server.createPlayObjectForStream(instream, string("audio/x-mp3"), createBUS), true); + } + else + return new KPlayObject(m_server.createPlayObjectForURL(string(TQFile::encodeName(url.path())), string(mimetype.latin1()), createBUS), false); + } + else + return new KPlayObject(); +} + + + +// + +KDE::PlayObjectFactory::PlayObjectFactory(Arts::SoundServerV2 server) +{ + d = new PrivateData; + d->server = server; + d->amanPlay = 0; + d->helper = 0; + d->allowStreaming = true; + d->isStream = false; +} + +KDE::PlayObjectFactory::PlayObjectFactory(KArtsServer* server) +{ + d = new PrivateData; + d->server = server->server(); + d->amanPlay = 0; + d->helper = 0; + d->allowStreaming = true; + d->isStream = false; +} + +KDE::PlayObjectFactory::~PlayObjectFactory() +{ + delete d->helper; + delete d; +} + +void KDE::PlayObjectFactory::setAudioManagerPlay( KAudioManagerPlay * amanPlay ) +{ + d->amanPlay = amanPlay; + if( ! d->helper ) + d->helper = new POFHelper; +} + +KDE::PlayObject *KDE::PlayObjectFactory::createPlayObject(const KURL& url, bool createBUS) +{ + KMimeType::Ptr mimetype = KMimeType::findByURL(url); + return createPlayObject(url, mimetype->name(), createBUS); +} + +KDE::PlayObject *KDE::PlayObjectFactory::createPlayObject(const KURL& _url, const TQString &mimetype, bool createBUS) +{ + // WHY DOES BROKEN TDEIO_MEDIA GIVE WRONG URLS? + // I hate it + // I hate it + // It sucks + // tdeio_media please die + KURL url = TDEIO::NetAccess::mostLocalURL(_url, 0); + + // return a NULL playobject if the server is NULL + if ( d->server.isNull() || url.isEmpty() ) + return new KDE::PlayObject(); + + // if the program wants to use it's own Synth_AMAN_PLAY we don't need a + // bus + if( d->amanPlay && createBUS ) + { + kdWarning( 400 ) << "KDE::PlayObjectFactory was instructed to use a Synth_AMAN_PLAY for output but the program also asked for a Synth_BUS_UPLINK" << endl; + createBUS = false; + } + + // decide if it's a local file. mpeglib provides cdda reading and decoding, so we prefer that over tdeio_audiocd + if ( url.isLocalFile() || !d->allowStreaming || (url.protocol() == "audiocd" && mimetype == "application/x-cda" && mimeTypes().contains( "application/x-cda" ) ) ) + { + // we rely on the delivered mimetype if it's a local file + d->playObj = new KDE::PlayObject( d->server.createPlayObjectForURL( string( TQFile::encodeName( url.path() ) ), string( mimetype.latin1() ), createBUS ), false ); + } + else + { + // if non-local, let the KPlayObject figure out the mimetype itself + // this invokes asynchronous creation automatically + d->playObj = new KDE::PlayObject( d->server, url, true, createBUS ); + } + + if( d->playObj->isNull() ) + { + delete d->playObj; + d->playObj = 0; + return new KDE::PlayObject(); // return a NULL playobject + } + + if( d->amanPlay ) + { + d->helper->po = d->playObj; + d->helper->ap = d->amanPlay; + if( d->playObj->object().isNull() && d->amanPlay ) + TQObject::connect( d->playObj, TQT_SIGNAL( playObjectCreated() ), d->helper, TQT_SLOT( connectAmanPlay() ) ); + else + d->helper->connectAmanPlay(); + } + + return d->playObj; +} + +TQStringList KDE::PlayObjectFactory::mimeTypes(void) +{ + KArtsDispatcher dispatcher; // we need such a thing, otherwise we crash + Arts::TraderQuery query; + vector *offers = query.query(); + + TQStringList results; + for(vector::iterator offer = offers->begin(); + offer != offers->end(); ++offer) + { + vector *mimetypes = (*offer).getProperty("MimeType"); + + for(vector::iterator mimetype = mimetypes->begin(); + mimetype != mimetypes->end(); ++mimetype) + { + TQString name = TQString(TQString::fromLocal8Bit((*mimetype).c_str())).stripWhiteSpace(); + if(KMimeType::mimeType(name)) + results.append(name); + } + + delete mimetypes; + } + delete offers; + + // clean out duplicates + results.sort(); + for(TQStringList::iterator result = results.begin(); result != results.end(); ) + { + TQStringList::iterator previous = result; + ++result; + if(result != results.end() && *result == *previous) + { + results.remove(result); + result = previous; + } + } + + return results; +} + +/* ### KDE4 +void KDE::PlayObjectFactory::connectAmanPlay() +{ + kdDebug( 400 ) << k_funcinfo << endl; + if( d->playObj->object().isNull() ) + return; + + d->amanPlay->start(); + d->playObj->object()._node()->start(); + Arts::connect( d->playObj->object(), "left" , d->amanPlay->amanPlay(), "left" ); + Arts::connect( d->playObj->object(), "right", d->amanPlay->amanPlay(), "right" ); +} +*/ + +void KDE::POFHelper::connectAmanPlay() +{ + kdDebug( 400 ) << k_funcinfo << endl; + if( po->object().isNull() ) + return; + + ap->start(); + po->object()._node()->start(); + Arts::connect( po->object(), "left" , ap->amanPlay(), "left" ); + Arts::connect( po->object(), "right", ap->amanPlay(), "right" ); +} + +#include "kplayobjectfactory_p.moc" diff --git a/arts/message/CMakeLists.txt b/arts/message/CMakeLists.txt index 12e91f65e..0a9be01cb 100644 --- a/arts/message/CMakeLists.txt +++ b/arts/message/CMakeLists.txt @@ -26,7 +26,7 @@ link_directories( set( target artsmessage ) set( ${target}_SRCS - artsmessage.cc + artsmessage.cpp ) tde_add_executable( ${target} diff --git a/arts/message/Makefile.am b/arts/message/Makefile.am index 24b7a6d18..363d561df 100644 --- a/arts/message/Makefile.am +++ b/arts/message/Makefile.am @@ -2,7 +2,7 @@ INCLUDES = $(all_includes) bin_PROGRAMS = artsmessage -artsmessage_SOURCES = artsmessage.cc +artsmessage_SOURCES = artsmessage.cpp artsmessage_LDADD = ../../tdeui/libtdeui.la artsmessage_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(KDE_MT_LDFLAGS) diff --git a/arts/message/artsmessage.cc b/arts/message/artsmessage.cc deleted file mode 100644 index eaa5c8e2c..000000000 --- a/arts/message/artsmessage.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* - Copyright (C) 2001 Jeff Tranter - tranter@kde.org - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - ------------------------------------------------------------------------- - -This application displays an error, warning, or informational message -in a dialog. It is normally used by artsd in conjunction with the -m -option. By abstracting this out of artsd, we keep it independent of -any particular graphics toolkit. - -This version uses KDE. Equivalent versions could be written using Qt, -Gnome, etc. and used instead. - -*/ - -#include - -#include -#include -#include -#include -#include -#include - -// command line options -static TDECmdLineOptions options[] = - { - { "e", 0,0 }, - { "error", I18N_NOOP("Display error message (default)"), 0 }, - { "w", 0, 0}, - { "warning", I18N_NOOP("Display warning message"), 0 }, - { "i", 0, 0 }, - { "info", I18N_NOOP("Display informational message"), 0 }, - { "+message", I18N_NOOP("Message string to be displayed"), 0 }, - TDECmdLineLastOption // End of options. - }; - -TDEAboutData aboutData("artsmessage", I18N_NOOP("artsmessage"), "0.1", - I18N_NOOP("Utility to display aRts error messages"), - TDEAboutData::License_GPL, "(c) 2001, Jeff Tranter", 0, 0, "tranter@kde.org"); - -int main(int argc, char **argv) { - aboutData.addAuthor("Jeff Tranter", 0, "tranter@kde.org"); - TDEGlobal::locale()->setMainCatalogue("tdelibs"); - TDECmdLineArgs::init(argc, argv, &aboutData); - TDECmdLineArgs::addCmdLineOptions(options); - TDEApplication app; - - TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); - TQString msg; - - // must be at least one argument - if (args->count() == 0) { - args->usage(); - } - - // build up message string from remaining arguments - for (int i = 0; i < args->count(); i++) { - if (i == 0) - msg = args->arg(i); - else - msg += TQString(" ") + args->arg(i); - } - - const int notifyOptions = 0; // never activate KNotify - if (args->isSet("w")) { - KMessageBox::sorry(0, msg, i18n("Warning"), notifyOptions); - } else if (args->isSet("i")) { - TQString id = msg; - id.replace(TQRegExp("[\\[\\]\\s=]"), "_"); - KMessageBox::information(0, msg, i18n("Informational"), id, notifyOptions); - } else { - KMessageBox::error(0, msg, i18n("Error"), notifyOptions); - } - - return 0; -} diff --git a/arts/message/artsmessage.cpp b/arts/message/artsmessage.cpp new file mode 100644 index 000000000..eaa5c8e2c --- /dev/null +++ b/arts/message/artsmessage.cpp @@ -0,0 +1,93 @@ +/* + Copyright (C) 2001 Jeff Tranter + tranter@kde.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +------------------------------------------------------------------------ + +This application displays an error, warning, or informational message +in a dialog. It is normally used by artsd in conjunction with the -m +option. By abstracting this out of artsd, we keep it independent of +any particular graphics toolkit. + +This version uses KDE. Equivalent versions could be written using Qt, +Gnome, etc. and used instead. + +*/ + +#include + +#include +#include +#include +#include +#include +#include + +// command line options +static TDECmdLineOptions options[] = + { + { "e", 0,0 }, + { "error", I18N_NOOP("Display error message (default)"), 0 }, + { "w", 0, 0}, + { "warning", I18N_NOOP("Display warning message"), 0 }, + { "i", 0, 0 }, + { "info", I18N_NOOP("Display informational message"), 0 }, + { "+message", I18N_NOOP("Message string to be displayed"), 0 }, + TDECmdLineLastOption // End of options. + }; + +TDEAboutData aboutData("artsmessage", I18N_NOOP("artsmessage"), "0.1", + I18N_NOOP("Utility to display aRts error messages"), + TDEAboutData::License_GPL, "(c) 2001, Jeff Tranter", 0, 0, "tranter@kde.org"); + +int main(int argc, char **argv) { + aboutData.addAuthor("Jeff Tranter", 0, "tranter@kde.org"); + TDEGlobal::locale()->setMainCatalogue("tdelibs"); + TDECmdLineArgs::init(argc, argv, &aboutData); + TDECmdLineArgs::addCmdLineOptions(options); + TDEApplication app; + + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + TQString msg; + + // must be at least one argument + if (args->count() == 0) { + args->usage(); + } + + // build up message string from remaining arguments + for (int i = 0; i < args->count(); i++) { + if (i == 0) + msg = args->arg(i); + else + msg += TQString(" ") + args->arg(i); + } + + const int notifyOptions = 0; // never activate KNotify + if (args->isSet("w")) { + KMessageBox::sorry(0, msg, i18n("Warning"), notifyOptions); + } else if (args->isSet("i")) { + TQString id = msg; + id.replace(TQRegExp("[\\[\\]\\s=]"), "_"); + KMessageBox::information(0, msg, i18n("Informational"), id, notifyOptions); + } else { + KMessageBox::error(0, msg, i18n("Error"), notifyOptions); + } + + return 0; +} -- cgit v1.2.1