summaryrefslogtreecommitdiffstats
path: root/interfaces/tdemediaplayer
diff options
context:
space:
mode:
Diffstat (limited to 'interfaces/tdemediaplayer')
-rw-r--r--interfaces/tdemediaplayer/CMakeLists.txt60
-rw-r--r--interfaces/tdemediaplayer/Makefile.am18
-rw-r--r--interfaces/tdemediaplayer/player.cpp79
-rw-r--r--interfaces/tdemediaplayer/player.h143
-rw-r--r--interfaces/tdemediaplayer/playerdcopobject.h62
-rw-r--r--interfaces/tdemediaplayer/tdefileaudiopreview/CMakeLists.txt46
-rw-r--r--interfaces/tdemediaplayer/tdefileaudiopreview/Makefile.am13
-rw-r--r--interfaces/tdemediaplayer/tdefileaudiopreview/tdefileaudiopreview.cpp146
-rw-r--r--interfaces/tdemediaplayer/tdefileaudiopreview/tdefileaudiopreview.h64
-rw-r--r--interfaces/tdemediaplayer/tdemediaplayer.desktop4
-rw-r--r--interfaces/tdemediaplayer/tdemediaplayerengine.desktop3
-rw-r--r--interfaces/tdemediaplayer/view.cpp89
-rw-r--r--interfaces/tdemediaplayer/view.h98
13 files changed, 825 insertions, 0 deletions
diff --git a/interfaces/tdemediaplayer/CMakeLists.txt b/interfaces/tdemediaplayer/CMakeLists.txt
new file mode 100644
index 000000000..0c9355560
--- /dev/null
+++ b/interfaces/tdemediaplayer/CMakeLists.txt
@@ -0,0 +1,60 @@
+#################################################
+#
+# (C) 2010 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+if( ARTS_FOUND )
+ add_subdirectory( tdefileaudiopreview )
+endif( ARTS_FOUND )
+
+include_directories(
+ ${TQT_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}/tdecore
+ ${CMAKE_SOURCE_DIR}
+ ${CMAKE_SOURCE_DIR}/interfaces
+ ${CMAKE_SOURCE_DIR}/dcop
+ ${CMAKE_SOURCE_DIR}/tdecore
+ ${CMAKE_SOURCE_DIR}/tdeui
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### headers ###################################
+
+install( FILES
+ player.h playerdcopobject.h view.h
+ DESTINATION ${INCLUDE_INSTALL_DIR}/tdemediaplayer )
+
+
+##### other data ################################
+
+install( FILES
+ tdemediaplayerengine.desktop tdemediaplayer.desktop
+ DESTINATION ${SERVICETYPES_INSTALL_DIR} )
+
+
+##### tdemediaplayer ##############################
+
+set( target tdemediaplayer )
+
+set( ${target}_SRCS
+ player.cpp view.cpp playerdcopobject.skel
+)
+
+tde_add_library( ${target} SHARED AUTOMOC
+ SOURCES ${${target}_SRCS}
+ VERSION 0.0.0
+ LINK tdeparts-shared
+ DESTINATION ${LIB_INSTALL_DIR}
+ DEPENDENCIES dcopidl
+)
diff --git a/interfaces/tdemediaplayer/Makefile.am b/interfaces/tdemediaplayer/Makefile.am
new file mode 100644
index 000000000..91ed342bd
--- /dev/null
+++ b/interfaces/tdemediaplayer/Makefile.am
@@ -0,0 +1,18 @@
+if include_ARTS
+tdefileaudiopreview_subdir = tdefileaudiopreview
+endif
+
+SUBDIRS = . $(tdefileaudiopreview_subdir)
+INCLUDES = -I$(srcdir)/.. $(all_includes)
+
+lib_LTLIBRARIES = libtdemediaplayer.la
+
+libtdemediaplayer_la_SOURCES = player.cpp playerdcopobject.skel view.cpp
+libtdemediaplayer_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -no-undefined
+libtdemediaplayer_la_LIBADD = $(LIB_KPARTS) $(LIB_QT) $(top_builddir)/dcop/libDCOP.la $(LIB_TDEUI) $(LIB_TDECORE)
+libtdemediaplayer_la_METASOURCES = AUTO
+
+tdemediaplayerinclude_HEADERS = player.h playerdcopobject.h view.h
+tdemediaplayerincludedir = $(includedir)/tdemediaplayer
+
+kde_servicetypes_DATA = tdemediaplayerengine.desktop tdemediaplayer.desktop
diff --git a/interfaces/tdemediaplayer/player.cpp b/interfaces/tdemediaplayer/player.cpp
new file mode 100644
index 000000000..2d97aa1f7
--- /dev/null
+++ b/interfaces/tdemediaplayer/player.cpp
@@ -0,0 +1,79 @@
+// Copyright (C) 2002 Neil Stevens <neil@qualityassistant.com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Except as contained in this notice, the name(s) of the author(s) shall not be
+// used in advertising or otherwise to promote the sale, use or other dealings
+// in this Software without prior written authorization from the author(s).
+
+#include <tdemediaplayer/player.h>
+
+KMediaPlayer::PlayerDCOPObject::PlayerDCOPObject(void)
+ : DCOPObject("KMediaPlayer")
+{
+}
+
+KMediaPlayer::Player::Player(TQWidget *, const char *, TQObject *parent, const char *name)
+ : KParts::ReadOnlyPart(parent, name)
+ , currentLooping(false)
+ , currentState(Empty)
+ , d(0)
+{
+}
+
+KMediaPlayer::Player::Player(TQObject *parent, const char *name)
+ : KParts::ReadOnlyPart(parent, name)
+ , currentLooping(false)
+ , currentState(Empty)
+ , d(0)
+{
+}
+
+KMediaPlayer::Player::~Player(void)
+{
+}
+
+void KMediaPlayer::Player::setLooping(bool b)
+{
+ if(b != currentLooping)
+ {
+ currentLooping = b;
+ emit loopingChanged(b);
+ }
+}
+
+bool KMediaPlayer::Player::isLooping(void) const
+{
+ return currentLooping;
+}
+
+void KMediaPlayer::Player::setState(int s)
+{
+ if(s != currentState)
+ {
+ currentState = (State)s;
+ emit stateChanged(s);
+ }
+}
+
+int KMediaPlayer::Player::state(void) const
+{
+ return (int)currentState;
+}
+
+#include "player.moc"
diff --git a/interfaces/tdemediaplayer/player.h b/interfaces/tdemediaplayer/player.h
new file mode 100644
index 000000000..05582ca07
--- /dev/null
+++ b/interfaces/tdemediaplayer/player.h
@@ -0,0 +1,143 @@
+// Copyright (C) 2002 Neil Stevens <neil@qualityassistant.com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Except as contained in this notice, the name(s) of the author(s) shall not be
+// used in advertising or otherwise to promote the sale, use or other dealings
+// in this Software without prior written authorization from the author(s).
+
+#ifndef KMEDIAPLAYERPLAYER_H
+#define KMEDIAPLAYERPLAYER_H
+
+#include <tdeparts/part.h>
+#include <tdemediaplayer/playerdcopobject.h>
+#include <tdemediaplayer/view.h>
+
+/** KMediaPlayer contains an interface to reusable media player components.
+*/
+namespace KMediaPlayer
+{
+
+/** Player is the center of the KMediaPlayer interface. It provides all of
+ * the necessary media player operations, and optionally provides the GUI to
+ * control them.
+ *
+ * There are two servicetypes for Player: KMediaPlayer/Player and
+ * KMediaPlayer/Engine. KMediaPlayer/Player provides a widget (accessable
+ * through view as well as XML GUI TDEActions. KMediaPlayer/Engine omits
+ * the user interface facets, for those who wish to provide their own
+ * interface.
+ */
+class KDE_EXPORT Player : public KParts::ReadOnlyPart, public PlayerDCOPObject
+{
+Q_OBJECT
+
+public:
+ /** This constructor is what to use when no GUI is required, as in the
+ * case of a KMediaPlayer/Engine.
+ */
+ Player(TQObject *parent, const char *name);
+
+ /** This constructor is what to use when a GUI is required, as in the
+ * case of a KMediaPlayer/Player.
+ */
+ Player(TQWidget *parentWidget, const char *widgetName, TQObject *parent, const char *name);
+
+ virtual ~Player(void);
+
+ /** A convenience function returning a pointer to the View for this
+ * Player, or 0 if this Player has no GUI.
+ */
+ virtual View *view(void) = 0;
+
+public slots:
+ /** Pause playback of the media track.*/
+ virtual void pause(void) = 0;
+
+ /** Begin playing the media track.*/
+ virtual void play(void) = 0;
+
+ /** Stop playback of the media track and return to the beginning.*/
+ virtual void stop(void) = 0;
+
+ /** Move the current playback position to the specified time in
+ * milliseconds, if the track is seekable. Some streams may not be
+ * seeked.
+ */
+ virtual void seek(unsigned long msec) = 0;
+public:
+ /** Returns whether the current track honors seek requests.*/
+ virtual bool isSeekable(void) const = 0;
+
+ /** Returns the current playback position in the track.*/
+ virtual unsigned long position(void) const = 0;
+
+ /** Returns whether the current track has a length. Some streams are
+ * endless, and do not have one. */
+ virtual bool hasLength(void) const = 0;
+
+ /** Returns the length of the current track.*/
+ virtual unsigned long length(void) const = 0;
+
+public slots:
+ /** Set whether the Player should continue playing at the beginning of
+ * the track when the end of the track is reached.
+ */
+ void setLooping(bool);
+public:
+ /** Return the current looping state. */
+ bool isLooping(void) const;
+signals:
+ /** Emitted when the looping state is changed. */
+ void loopingChanged(bool);
+
+public:
+ /** The possible states of the Player */
+ enum State
+ {
+ /** No track is loaded. */
+ Empty,
+ /** Not playing. */
+ Stop,
+ /** Playing is temporarily suspended. */
+ Pause,
+ /** The media is currently being output. */
+ Play
+ };
+ /** Return the current state of the player. */
+ int state(void) const;
+signals:
+ /** Emitted when the state changes. */
+ void stateChanged(int);
+
+protected slots:
+ /** Implementers use this to control what users see as the current
+ * state.*/
+ void setState(int);
+
+private:
+ bool currentLooping;
+ State currentState;
+
+ struct Data;
+ Data *d;
+};
+
+}
+
+#endif
diff --git a/interfaces/tdemediaplayer/playerdcopobject.h b/interfaces/tdemediaplayer/playerdcopobject.h
new file mode 100644
index 000000000..73a1cfa1d
--- /dev/null
+++ b/interfaces/tdemediaplayer/playerdcopobject.h
@@ -0,0 +1,62 @@
+// Copyright (C) 2002 Neil Stevens <neil@qualityassistant.com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Except as contained in this notice, the name(s) of the author(s) shall not be
+// used in advertising or otherwise to promote the sale, use or other dealings
+// in this Software without prior written authorization from the author(s).
+
+#ifndef KMEDIAPLAYERPLAYERDCOPOBJECT_H
+#define KMEDIAPLAYERPLAYERDCOPOBJECT_H
+
+#include <dcopobject.h>
+#include <kurl.h>
+
+namespace KMediaPlayer
+{
+
+class KDE_EXPORT PlayerDCOPObject : public DCOPObject
+{
+K_DCOP
+
+public:
+ PlayerDCOPObject(void);
+
+k_dcop:
+ virtual bool openURL(const KURL &file) = 0;
+ virtual void pause() = 0;
+ virtual void play() = 0;
+ virtual void stop() = 0;
+
+ virtual void seek(unsigned long msec) = 0;
+ virtual bool isSeekable() const = 0;
+ virtual unsigned long position() const = 0;
+
+ virtual bool hasLength() const = 0;
+ virtual unsigned long length() const = 0;
+
+ virtual void setLooping(bool) = 0;
+ virtual bool isLooping() const = 0;
+
+ virtual int state() const = 0;
+ virtual void setState(int) = 0;
+};
+
+}
+
+#endif
diff --git a/interfaces/tdemediaplayer/tdefileaudiopreview/CMakeLists.txt b/interfaces/tdemediaplayer/tdefileaudiopreview/CMakeLists.txt
new file mode 100644
index 000000000..8e561e1f3
--- /dev/null
+++ b/interfaces/tdemediaplayer/tdefileaudiopreview/CMakeLists.txt
@@ -0,0 +1,46 @@
+#################################################
+#
+# (C) 2010 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+include_directories(
+ ${TQT_INCLUDE_DIRS}
+ ${ARTS_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}/tdecore
+ ${CMAKE_SOURCE_DIR}
+ ${CMAKE_SOURCE_DIR}/dcop
+ ${CMAKE_SOURCE_DIR}/interfaces
+ ${CMAKE_SOURCE_DIR}/tdecore
+ ${CMAKE_SOURCE_DIR}/tdeui
+ ${CMAKE_SOURCE_DIR}/tdeio
+ ${CMAKE_SOURCE_DIR}/tdeio/tdeio
+ ${CMAKE_SOURCE_DIR}/tdeio/tdefile
+ ${CMAKE_SOURCE_DIR}/arts/kde
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+ ${ARTS_LIBRARY_DIRS}
+)
+
+
+##### tdefileaudiopreview #########################
+
+set( target tdefileaudiopreview )
+
+set( ${target}_SRCS
+ tdefileaudiopreview.cpp
+)
+
+tde_add_kpart( ${target} AUTOMOC
+ SOURCES ${${target}_SRCS}
+ LINK tdemediaplayer-shared artskde-shared
+ DESTINATION ${PLUGIN_INSTALL_DIR}
+)
diff --git a/interfaces/tdemediaplayer/tdefileaudiopreview/Makefile.am b/interfaces/tdemediaplayer/tdefileaudiopreview/Makefile.am
new file mode 100644
index 000000000..d73cf545f
--- /dev/null
+++ b/interfaces/tdemediaplayer/tdefileaudiopreview/Makefile.am
@@ -0,0 +1,13 @@
+INCLUDES = -I$(top_srcdir)/interfaces/ -I$(top_srcdir)/arts/kde -I$(includedir)/arts $(all_includes)
+METASOURCES = AUTO
+
+kde_module_LTLIBRARIES = tdefileaudiopreview.la
+
+tdefileaudiopreview_la_SOURCES = tdefileaudiopreview.cpp
+tdefileaudiopreview_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -module -avoid-version -no-undefined
+tdefileaudiopreview_la_LIBADD = $(top_builddir)/interfaces/tdemediaplayer/libtdemediaplayer.la $(top_builddir)/arts/kde/libartskde.la $(LIB_KIO) $(LIB_QT) $(LIB_TDECORE)
+
+noinst_HEADERS = tdefileaudiopreview.h
+
+messages:
+ $(XGETTEXT) $(tdefileaudiopreview_la_SOURCES) -o $(podir)/tdefileaudiopreview.pot
diff --git a/interfaces/tdemediaplayer/tdefileaudiopreview/tdefileaudiopreview.cpp b/interfaces/tdemediaplayer/tdefileaudiopreview/tdefileaudiopreview.cpp
new file mode 100644
index 000000000..370805a74
--- /dev/null
+++ b/interfaces/tdemediaplayer/tdefileaudiopreview/tdefileaudiopreview.cpp
@@ -0,0 +1,146 @@
+#include "tdefileaudiopreview.h"
+
+#include <tqcheckbox.h>
+#include <tqhbox.h>
+#include <tqlayout.h>
+#include <tqvgroupbox.h>
+
+#include <tdeglobal.h>
+#include <tdeconfig.h>
+#include <klibloader.h>
+#include <tdelocale.h>
+#include <tdemediaplayer/player.h>
+#include <kmimetype.h>
+#include <tdeparts/componentfactory.h>
+
+#include <kplayobjectfactory.h>
+
+#include <config-tdefile.h>
+
+class KFileAudioPreviewFactory : public KLibFactory
+{
+protected:
+ virtual TQObject *createObject( TQObject *parent, const char *name,
+ const char *className, const TQStringList & args)
+ {
+ Q_UNUSED(className);
+ Q_UNUSED(args);
+ return TQT_TQOBJECT(new KFileAudioPreview( dynamic_cast<TQWidget*>( parent ), name ));
+ }
+};
+
+K_EXPORT_COMPONENT_FACTORY( tdefileaudiopreview, KFileAudioPreviewFactory )
+
+
+///////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+
+
+class KFileAudioPreview::KFileAudioPreviewPrivate
+{
+public:
+ KFileAudioPreviewPrivate( TQWidget *parent )
+ {
+ player = KParts::ComponentFactory::createInstanceFromQuery<KMediaPlayer::Player>( "KMediaPlayer/Player", TQString(), TQT_TQOBJECT(parent) );
+ }
+
+ ~KFileAudioPreviewPrivate()
+ {
+ delete player;
+ }
+
+ KMediaPlayer::Player *player;
+};
+
+
+KFileAudioPreview::KFileAudioPreview( TQWidget *parent, const char *name )
+ : KPreviewWidgetBase( parent, name )
+{
+ TDEGlobal::locale()->insertCatalogue("tdefileaudiopreview");
+
+ TQStringList formats = KDE::PlayObjectFactory::mimeTypes();
+ // ###
+ TQStringList::ConstIterator it = formats.begin();
+ for ( ; it != formats.end(); ++it )
+ m_supportedFormats.insert( *it, (void*) 1 );
+
+ TQVGroupBox *box = new TQVGroupBox( i18n("Media Player"), this );
+ TQVBoxLayout *layout = new TQVBoxLayout( this );
+ layout->addWidget( box );
+
+ (void) new TQWidget( box ); // spacer
+
+ d = new KFileAudioPreviewPrivate( 0L ); // not box -- being reparented anyway
+ if ( d->player ) // only if there actually is a component...
+ {
+ setSupportedMimeTypes( formats );
+ KMediaPlayer::View *view = d->player->view();
+ view->setEnabled( false );
+
+ // if we have access to the video widget, show it above the player
+ // So, reparent first the video widget, then the view.
+ if ( view->videoWidget() )
+ {
+ TQHBox *frame = new TQHBox( box );
+ frame->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
+ frame->setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Expanding ) );
+ view->videoWidget()->reparent( frame, TQPoint(0,0) );
+ }
+
+ view->reparent( box, TQPoint(0,0) );
+ }
+
+ m_autoPlay = new TQCheckBox( i18n("Play &automatically"), box );
+ TDEConfigGroup config( TDEGlobal::config(), ConfigGroup );
+ m_autoPlay->setChecked( config.readBoolEntry( "Autoplay sounds", true ) );
+ connect( m_autoPlay, TQT_SIGNAL(toggled(bool)), TQT_SLOT(toggleAuto(bool)) );
+}
+
+KFileAudioPreview::~KFileAudioPreview()
+{
+ TDEConfigGroup config( TDEGlobal::config(), ConfigGroup );
+ config.writeEntry( "Autoplay sounds", m_autoPlay->isChecked() );
+
+ delete d;
+}
+
+void KFileAudioPreview::showPreview( const KURL &url )
+{
+ if ( !d->player || !url.isValid() )
+ return;
+
+ KMimeType::Ptr mt = KMimeType::findByURL( url );
+ bool supported = m_supportedFormats.find( mt->name() );
+ d->player->view()->setEnabled( supported );
+ if ( !supported )
+ return;
+
+ static_cast<KParts::ReadOnlyPart*>(d->player)->openURL( url );
+ if ( m_autoPlay->isChecked() )
+ d->player->play();
+}
+
+void KFileAudioPreview::clearPreview()
+{
+ if ( d->player )
+ {
+ d->player->stop();
+ d->player->closeURL();
+ }
+}
+
+void KFileAudioPreview::toggleAuto( bool on )
+{
+ if ( !d->player )
+ return;
+
+ if ( on && m_currentURL.isValid() && d->player->view()->isEnabled() )
+ d->player->play();
+ else
+ d->player->stop();
+}
+
+void KFileAudioPreview::virtual_hook( int, void* )
+{}
+
+#include "tdefileaudiopreview.moc"
diff --git a/interfaces/tdemediaplayer/tdefileaudiopreview/tdefileaudiopreview.h b/interfaces/tdemediaplayer/tdefileaudiopreview/tdefileaudiopreview.h
new file mode 100644
index 000000000..6eae52cf7
--- /dev/null
+++ b/interfaces/tdemediaplayer/tdefileaudiopreview/tdefileaudiopreview.h
@@ -0,0 +1,64 @@
+/* This file is part of the KDE libraries
+ Copyright (C) 2003 Carsten Pfeiffer <pfeiffer@kde.org>
+
+ 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, version 2.
+
+ 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.
+*/
+
+#ifndef TDEFILEAUDIOPREVIEW_H
+#define TDEFILEAUDIOPREVIEW_H
+
+#include <tqdict.h>
+
+#include <kurl.h>
+#include <kpreviewwidgetbase.h>
+
+class TQCheckBox;
+class TQPushButton;
+class TQLabel;
+
+class KFileDialog;
+class KFileItem;
+
+/**
+ * Audio "preview" widget for the file dialog.
+ */
+class KFileAudioPreview : public KPreviewWidgetBase
+{
+ Q_OBJECT
+
+public:
+ KFileAudioPreview(TQWidget *parent = 0, const char *name = 0 );
+ ~KFileAudioPreview();
+
+public slots:
+ virtual void showPreview(const KURL &url);
+ virtual void clearPreview();
+
+private slots:
+ void toggleAuto(bool);
+
+private:
+ TQDict<void> m_supportedFormats;
+ KURL m_currentURL;
+ TQCheckBox *m_autoPlay;
+
+protected:
+ virtual void virtual_hook( int id, void* data );
+private:
+ class KFileAudioPreviewPrivate;
+ KFileAudioPreviewPrivate *d;
+};
+
+#endif // TDEFILEAUDIOPREVIEW_H
diff --git a/interfaces/tdemediaplayer/tdemediaplayer.desktop b/interfaces/tdemediaplayer/tdemediaplayer.desktop
new file mode 100644
index 000000000..85c1df65b
--- /dev/null
+++ b/interfaces/tdemediaplayer/tdemediaplayer.desktop
@@ -0,0 +1,4 @@
+[Desktop Entry]
+Type=ServiceType
+X-TDE-ServiceType=KMediaPlayer/Player
+X-TDE-Derived=KParts/ReadOnlyPart
diff --git a/interfaces/tdemediaplayer/tdemediaplayerengine.desktop b/interfaces/tdemediaplayer/tdemediaplayerengine.desktop
new file mode 100644
index 000000000..ba7bf0403
--- /dev/null
+++ b/interfaces/tdemediaplayer/tdemediaplayerengine.desktop
@@ -0,0 +1,3 @@
+[Desktop Entry]
+Type=ServiceType
+X-TDE-ServiceType=KMediaPlayer/Engine
diff --git a/interfaces/tdemediaplayer/view.cpp b/interfaces/tdemediaplayer/view.cpp
new file mode 100644
index 000000000..87d1d78a5
--- /dev/null
+++ b/interfaces/tdemediaplayer/view.cpp
@@ -0,0 +1,89 @@
+// Copyright (C) 2002 Neil Stevens <neil@qualityassistant.com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Except as contained in this notice, the name(s) of the author(s) shall not be
+// used in advertising or otherwise to promote the sale, use or other dealings
+// in this Software without prior written authorization from the author(s).
+
+#include <tdemediaplayer/view.h>
+
+struct KMediaPlayer::View::Data
+{
+ Data() : videoWidget(0L) {}
+
+ TQWidget *videoWidget;
+};
+
+KMediaPlayer::View::View(TQWidget *parent, const char *name)
+ : TQWidget(parent, name)
+ , currentButtons((int)All)
+ , d(new Data())
+{
+}
+
+KMediaPlayer::View::~View(void)
+{
+ delete d;
+}
+
+int KMediaPlayer::View::buttons(void)
+{
+ return currentButtons;
+}
+
+void KMediaPlayer::View::setButtons(int buttons)
+{
+ if(buttons != currentButtons)
+ {
+ currentButtons = buttons;
+ emit buttonsChanged(buttons);
+ }
+}
+
+bool KMediaPlayer::View::button(int b)
+{
+ return currentButtons & b;
+}
+
+void KMediaPlayer::View::showButton(int b)
+{
+ setButtons(currentButtons | b);
+}
+
+void KMediaPlayer::View::hideButton(int b)
+{
+ setButtons(currentButtons & ~b);
+}
+
+void KMediaPlayer::View::toggleButton(int b)
+{
+ setButtons(currentButtons ^ b);
+}
+
+void KMediaPlayer::View::setVideoWidget(TQWidget *videoWidget)
+{
+ d->videoWidget = videoWidget;
+}
+
+TQWidget* KMediaPlayer::View::videoWidget()
+{
+ return d->videoWidget;
+}
+
+#include "view.moc"
diff --git a/interfaces/tdemediaplayer/view.h b/interfaces/tdemediaplayer/view.h
new file mode 100644
index 000000000..c1d9dbe41
--- /dev/null
+++ b/interfaces/tdemediaplayer/view.h
@@ -0,0 +1,98 @@
+// Copyright (C) 2002 Neil Stevens <neil@qualityassistant.com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Except as contained in this notice, the name(s) of the author(s) shall not be
+// used in advertising or otherwise to promote the sale, use or other dealings
+// in this Software without prior written authorization from the author(s).
+
+#ifndef KMEDIAPLAYERVIEW_H
+#define KMEDIAPLAYERVIEW_H
+
+#include <tqwidget.h>
+#include <tdelibs_export.h>
+
+namespace KMediaPlayer
+{
+
+/** View is part of the user interface of a Player. */
+class KDE_EXPORT View : public TQWidget
+{
+Q_OBJECT
+
+public:
+ /** Your typical TQWidget constructor. */
+ View(TQWidget *parent, const char *name);
+ virtual ~View(void);
+
+ /** The Possible buttons that can appear in the UI. */
+ enum Button
+ {
+ /** Button that connects to Player::play */
+ Play = 1,
+ /** Button that connects to Player::stop */
+ Stop = 2,
+ /** Button that connects to Player::pause */
+ Pause = 4,
+ /** A seeker that interfaces with Player::seek */
+ Seeker = 8,
+ /** Show all buttons. */
+ All = 255
+ };
+
+ /** Return which buttons are being displayed. */
+ int buttons(void);
+
+ /** Return the TQWidget in which video is displayed.
+ May Return 0L if there is none. */
+ TQWidget *videoWidget();
+
+public slots:
+ /** Set which buttons to display. See Button. */
+ void setButtons(int);
+
+ /** Returns if a particular button is being displayed. */
+ bool button(int);
+ /** Display a particular button. */
+ void showButton(int);
+ /** Stop displaying a particular button. */
+ void hideButton(int);
+ /** Toggle the display of a particular button. */
+ void toggleButton(int);
+
+signals:
+ /** Emitted when the set of displayed buttons changes. */
+ void buttonsChanged(int);
+
+protected:
+ /** The implementing view should set the widget in which
+ the video will be displayed. KMediaPlayer users may
+ reparent() it to somewhere else, for example.
+ */
+ void setVideoWidget(TQWidget *videoWidget);
+
+private:
+ int currentButtons;
+
+ struct Data;
+ Data *d;
+};
+
+}
+
+#endif