summaryrefslogtreecommitdiffstats
path: root/kaboodle
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commite2de64d6f1beb9e492daf5b886e19933c1fa41dd (patch)
tree9047cf9e6b5c43878d5bf82660adae77ceee097a /kaboodle
downloadtdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.tar.gz
tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kaboodle')
-rw-r--r--kaboodle/AUTHORS6
-rw-r--r--kaboodle/Makefile.am45
-rw-r--r--kaboodle/actions/Makefile.am2
-rw-r--r--kaboodle/actions/cr16-action-kaboodleloop.pngbin0 -> 641 bytes
-rw-r--r--kaboodle/actions/cr22-action-kaboodleloop.pngbin0 -> 266 bytes
-rw-r--r--kaboodle/conf.cpp59
-rw-r--r--kaboodle/conf.h52
-rw-r--r--kaboodle/configure.in.in4
-rw-r--r--kaboodle/controls.cpp138
-rw-r--r--kaboodle/controls.h97
-rw-r--r--kaboodle/engine.cpp207
-rw-r--r--kaboodle/engine.h100
-rw-r--r--kaboodle/kaboodle.desktop83
-rw-r--r--kaboodle/kaboodle_component.desktop72
-rw-r--r--kaboodle/kaboodle_factory.cpp83
-rw-r--r--kaboodle/kaboodle_factory.h55
-rw-r--r--kaboodle/kaboodleapp.cpp53
-rw-r--r--kaboodle/kaboodleapp.h45
-rw-r--r--kaboodle/kaboodleengine.desktop67
-rw-r--r--kaboodle/kaboodlepartui.rc26
-rw-r--r--kaboodle/kaboodleui.rc17
-rw-r--r--kaboodle/main.cpp59
-rw-r--r--kaboodle/pics/Makefile.am1
-rw-r--r--kaboodle/pics/hi128-app-kaboodle.pngbin0 -> 15814 bytes
-rw-r--r--kaboodle/pics/hi16-app-kaboodle.pngbin0 -> 897 bytes
-rw-r--r--kaboodle/pics/hi22-app-kaboodle.pngbin0 -> 1319 bytes
-rw-r--r--kaboodle/pics/hi32-app-kaboodle.pngbin0 -> 2070 bytes
-rw-r--r--kaboodle/pics/hi48-app-kaboodle.pngbin0 -> 4411 bytes
-rw-r--r--kaboodle/pics/hi64-app-kaboodle.pngbin0 -> 6498 bytes
-rw-r--r--kaboodle/player.cpp268
-rw-r--r--kaboodle/player.h116
-rw-r--r--kaboodle/userinterface.cpp182
-rw-r--r--kaboodle/userinterface.h72
-rw-r--r--kaboodle/view.cpp323
-rw-r--r--kaboodle/view.h104
35 files changed, 2336 insertions, 0 deletions
diff --git a/kaboodle/AUTHORS b/kaboodle/AUTHORS
new file mode 100644
index 00000000..d9dbb241
--- /dev/null
+++ b/kaboodle/AUTHORS
@@ -0,0 +1,6 @@
+Neil Stevens <multivac@fcmail.com>
+Charles Samuels <charles@kde.org>
+Stefan Schimanski <1Stein@gmx.de>
+Malte Starostik <malte@kde.org>
+Stefan Westerfeld <stefan@space.twc.de>
+Nikolas Zimmermann <wildfox@kde.org>
diff --git a/kaboodle/Makefile.am b/kaboodle/Makefile.am
new file mode 100644
index 00000000..2c7183c1
--- /dev/null
+++ b/kaboodle/Makefile.am
@@ -0,0 +1,45 @@
+INCLUDES = -I$(kde_includes)/kio -I$(kde_includes)/arts $(all_includes)
+
+SUBDIRS = pics actions
+
+kde_module_LTLIBRARIES = libkaboodlepart.la
+
+noinst_LTLIBRARIES = libkaboodle_noinst.la
+libkaboodle_noinst_la_SOURCES = conf.cpp \
+ controls.cpp \
+ engine.cpp \
+ player.cpp \
+ view.cpp \
+ kaboodle_factory.cpp
+
+libs = $(LIB_KPARTS) -lqtmcop -lkmedia2_idl -lsoundserver_idl -lartskde -lkmediaplayer
+
+libkaboodlepart_la_SOURCES = dummy.cpp
+libkaboodlepart_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+libkaboodlepart_la_LIBADD = libkaboodle_noinst.la $(libs)
+
+kaboodle_SOURCES = main.cpp \
+ kaboodleapp.cpp \
+ userinterface.cpp
+
+dummy.cpp:
+ echo > dummy.cpp
+
+CLEANFILES = dummy.cpp
+
+kaboodle_LDADD = libkaboodle_noinst.la $(libs)
+kaboodle_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+
+bin_PROGRAMS = kaboodle
+
+METASOURCES = AUTO
+
+xdg_apps_DATA = kaboodle.desktop
+
+kde_services_DATA = kaboodle_component.desktop kaboodleengine.desktop
+
+appdata_DATA = kaboodleui.rc kaboodlepartui.rc
+appdatadir = $(kde_datadir)/kaboodle
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp *.h -o $(podir)/kaboodle.pot
diff --git a/kaboodle/actions/Makefile.am b/kaboodle/actions/Makefile.am
new file mode 100644
index 00000000..e96a10cd
--- /dev/null
+++ b/kaboodle/actions/Makefile.am
@@ -0,0 +1,2 @@
+kaboodleiconsdir = $(kde_datadir)/kaboodle/icons
+kaboodleicons_ICON = AUTO
diff --git a/kaboodle/actions/cr16-action-kaboodleloop.png b/kaboodle/actions/cr16-action-kaboodleloop.png
new file mode 100644
index 00000000..86c65667
--- /dev/null
+++ b/kaboodle/actions/cr16-action-kaboodleloop.png
Binary files differ
diff --git a/kaboodle/actions/cr22-action-kaboodleloop.png b/kaboodle/actions/cr22-action-kaboodleloop.png
new file mode 100644
index 00000000..d18f40a5
--- /dev/null
+++ b/kaboodle/actions/cr22-action-kaboodleloop.png
Binary files differ
diff --git a/kaboodle/conf.cpp b/kaboodle/conf.cpp
new file mode 100644
index 00000000..eb5b0d7d
--- /dev/null
+++ b/kaboodle/conf.cpp
@@ -0,0 +1,59 @@
+// conf.cpp
+//
+// Copyright (C) 2001 Neil Stevens <multivac@fcmail.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 <kconfig.h>
+#include <klocale.h>
+#include <qcheckbox.h>
+#include <qvbox.h>
+
+#include "conf.h"
+#include "view.h"
+
+Kaboodle::Conf::Conf(QWidget *_parent, const char *_name)
+ : KDialogBase(_parent, _name, true, QString::null, Ok | Cancel)
+{
+ QVBox *box = makeVBoxMainWidget();
+
+ autoPlay = new QCheckBox(i18n("Start playing automatically"), box);
+ quitAfterPlaying = new QCheckBox(i18n("Quit when finished playing"), box);
+
+ KConfig &config = *KGlobal::config();
+ config.setGroup("core");
+ autoPlay->setChecked(config.readBoolEntry("autoPlay", true));
+ quitAfterPlaying->setChecked(config.readBoolEntry("quitAfterPlaying", true));
+}
+
+void Kaboodle::Conf::accept(void)
+{
+ KConfig &config = *KGlobal::config();
+ config.setGroup("core");
+ config.writeEntry("autoPlay", autoPlay->isChecked());
+ config.writeEntry("quitAfterPlaying", quitAfterPlaying->isChecked());
+ config.sync();
+
+ KDialogBase::accept();
+}
+
+#include "conf.moc"
diff --git a/kaboodle/conf.h b/kaboodle/conf.h
new file mode 100644
index 00000000..ecd1d0da
--- /dev/null
+++ b/kaboodle/conf.h
@@ -0,0 +1,52 @@
+// conf.h
+//
+// Copyright (C) 2001 Neil Stevens <multivac@fcmail.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 CONF_H
+#define CONF_H
+
+#include <kdialogbase.h>
+
+class QCheckBox;
+
+namespace Kaboodle
+{
+
+class Conf : public KDialogBase
+{
+Q_OBJECT
+
+public:
+ Conf(QWidget *_parent = 0, const char *_name = 0);
+
+protected:
+ virtual void accept(void);
+
+private:
+ QCheckBox *autoPlay, *quitAfterPlaying;
+};
+
+}
+
+#endif
diff --git a/kaboodle/configure.in.in b/kaboodle/configure.in.in
new file mode 100644
index 00000000..1d032bd4
--- /dev/null
+++ b/kaboodle/configure.in.in
@@ -0,0 +1,4 @@
+if test "x$build_arts" = "xno"; then
+ DO_NOT_COMPILE="$DO_NOT_COMPILE kaboodle"
+fi
+
diff --git a/kaboodle/controls.cpp b/kaboodle/controls.cpp
new file mode 100644
index 00000000..4d86e1c7
--- /dev/null
+++ b/kaboodle/controls.cpp
@@ -0,0 +1,138 @@
+/*****************************************************************
+
+Copyright (c) 2000-2001 the noatun authors. See file AUTHORS.
+
+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
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIAB\ILITY, 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.
+
+******************************************************************/
+
+#include "controls.h"
+
+Kaboodle::L33tSlider::L33tSlider(QWidget * parent, const char * name) :
+ QSlider(parent,name), pressed(false)
+{}
+Kaboodle::L33tSlider::L33tSlider(Orientation o, QWidget * parent, const char * name) :
+ QSlider(o,parent,name), pressed(false)
+{}
+Kaboodle::L33tSlider::L33tSlider(int minValue, int maxValue, int pageStep, int value,
+ Orientation o, QWidget * parent, const char * name) :
+ QSlider(minValue, maxValue, pageStep, value, o, parent,name), pressed(false)
+{}
+
+bool Kaboodle::L33tSlider::currentlyPressed() const
+{
+ return pressed;
+}
+
+void Kaboodle::L33tSlider::setValue(int i)
+{
+ if (!pressed)
+ QSlider::setValue(i);
+}
+
+void Kaboodle::L33tSlider::mousePressEvent(QMouseEvent*e)
+{
+ if (e->button()!=RightButton)
+ {
+ pressed=true;
+ QSlider::mousePressEvent(e);
+ }
+}
+
+void Kaboodle::L33tSlider::mouseReleaseEvent(QMouseEvent*e)
+{
+ pressed=false;
+ QSlider::mouseReleaseEvent(e);
+ emit userChanged(value());
+}
+
+void Kaboodle::L33tSlider::wheelEvent(QWheelEvent *e)
+{
+ QSlider::wheelEvent(e);
+ int newValue = value();
+
+ if(newValue < minValue())
+ newValue = minValue();
+ else if(newValue > maxValue())
+ newValue = maxValue();
+
+ setValue(newValue);
+ emit userChanged(newValue);
+}
+
+Kaboodle::SliderAction::SliderAction(const QString& text, int accel, const QObject *receiver,
+ const char *member, QObject* parent, const char* name )
+ : KAction( text, accel, parent, name )
+{
+ m_receiver = receiver;
+ m_member = member;
+}
+
+int Kaboodle::SliderAction::plug( QWidget *w, int index )
+{
+ if (!w->inherits("KToolBar")) return -1;
+
+ KToolBar *toolBar = (KToolBar *)w;
+ int id = KAction::getToolButtonID();
+
+ //Create it.
+ m_slider=new L33tSlider(0, 1000, 100, 0, Horizontal, toolBar);
+ m_slider->setMinimumWidth(10);
+ toolBar->insertWidget(id, 10, m_slider, index );
+
+
+ addContainer( toolBar, id );
+ connect( toolBar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
+ toolBar->setItemAutoSized( id, true );
+
+ if (w->inherits( "KToolBar" ))
+ connect(toolBar, SIGNAL(moved(KToolBar::BarPosition)), this, SLOT(toolbarMoved(KToolBar::BarPosition)));
+
+ emit plugged();
+
+ return containerCount() - 1;
+}
+
+void Kaboodle::SliderAction::toolbarMoved(KToolBar::BarPosition)
+{
+// I wish this worked :)
+return;
+/*
+ if (pos == KToolBar::Left || pos == KToolBar::Right)
+ {
+ m_slider->setOrientation(Vertical);
+ m_slider->setFixedWidth(m_slider->height());
+ }
+ else
+ {
+ m_slider->setOrientation(Horizontal);
+ m_slider->resize(m_slider->height(), m_slider->height());
+ }
+*/
+}
+
+void Kaboodle::SliderAction::unplug( QWidget *w )
+{
+ KToolBar *toolBar = (KToolBar *)w;
+ int idx = findContainer( w );
+
+ toolBar->removeItem( itemId( idx ) );
+ removeContainer( idx );
+}
+
+#include "controls.moc"
diff --git a/kaboodle/controls.h b/kaboodle/controls.h
new file mode 100644
index 00000000..d288d1fc
--- /dev/null
+++ b/kaboodle/controls.h
@@ -0,0 +1,97 @@
+/*****************************************************************
+
+Copyright (c) 2000-2001 the noatun authors. See file AUTHORS.
+
+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
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIAB\ILITY, 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.
+
+******************************************************************/
+
+#ifndef __CONTROLS_H
+#define __CONTROLS_H
+
+#include <qguardedptr.h>
+
+#include <kaction.h>
+#include <ktoolbar.h>
+#include <qslider.h>
+#include <qstringlist.h>
+
+class QComboBox;
+class QLabel;
+
+namespace Kaboodle
+{
+/**
+ * A slider that can be moved around while being
+ * changed internally
+ **/
+class L33tSlider : public QSlider
+{
+Q_OBJECT
+public:
+ L33tSlider(QWidget * parent, const char * name=0);
+ L33tSlider(Orientation, QWidget * parent, const char * name=0);
+ L33tSlider(int minValue, int maxValue, int pageStep, int value,
+ Orientation, QWidget * parent, const char * name=0);
+
+ bool currentlyPressed() const;
+signals:
+ /**
+ * emmited only when the user changes the value by hand
+ **/
+ void userChanged(int value);
+
+public slots:
+ virtual void setValue(int);
+protected:
+ virtual void mousePressEvent(QMouseEvent*);
+ virtual void mouseReleaseEvent(QMouseEvent*);
+ virtual void wheelEvent(QWheelEvent *e);
+
+private:
+ bool pressed;
+};
+
+/**
+ * A slider for your toolbar
+ **/
+class SliderAction : public KAction
+{
+Q_OBJECT
+public:
+ SliderAction(const QString& text, int accel, const QObject *receiver,
+ const char *member, QObject* parent, const char* name );
+ virtual int plug( QWidget *w, int index = -1 );
+ virtual void unplug( QWidget *w );
+ QSlider* slider() const { return m_slider; }
+
+signals:
+ void plugged();
+
+public slots:
+ void toolbarMoved(KToolBar::BarPosition pos);
+private:
+ QGuardedPtr<QSlider> m_slider;
+ QStringList m_items;
+ const QObject *m_receiver;
+ const char *m_member;
+};
+
+}
+
+#endif
diff --git a/kaboodle/engine.cpp b/kaboodle/engine.cpp
new file mode 100644
index 00000000..20d9d2e4
--- /dev/null
+++ b/kaboodle/engine.cpp
@@ -0,0 +1,207 @@
+/*****************************************************************
+
+Copyright (c) 2000-2001 the noatun authors. See file AUTHORS.
+
+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
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIAB\ILITY, 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.
+
+******************************************************************/
+
+extern "C"
+{
+#include <sys/wait.h>
+}
+
+#include <kconfig.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kmimetype.h>
+#include <kstandarddirs.h>
+#include <kurl.h>
+#include <qtimer.h>
+#include <qfile.h>
+#include <qdir.h>
+
+#include <connect.h>
+#include <dynamicrequest.h>
+#include <flowsystem.h>
+#include <kartsdispatcher.h>
+#include <kartsserver.h>
+#include <kplayobjectfactory.h>
+#include <soundserver.h>
+
+#include "engine.h"
+#include <string.h>
+
+using namespace std;
+
+class Kaboodle::Engine::EnginePrivate
+{
+public:
+ EnginePrivate()
+ : playobj(0)
+ , dispatcher()
+ , server()
+ {
+ }
+
+ ~EnginePrivate()
+ {
+ delete playobj;
+ }
+
+ KDE::PlayObject *playobj;
+ KArtsDispatcher dispatcher;
+ KArtsServer server;
+ KURL file;
+};
+
+Kaboodle::Engine::Engine(QObject *parent)
+ : QObject(parent)
+ , d(new EnginePrivate)
+{
+}
+
+Kaboodle::Engine::~Engine()
+{
+ stop();
+ delete d;
+}
+
+bool Kaboodle::Engine::load(const KURL &file)
+{
+ if(file.path().length())
+ {
+ d->file = file;
+ return reload();
+ }
+ else return false;
+}
+
+bool Kaboodle::Engine::reload(void)
+{
+ // Only You can prevent memory leaks
+ delete d->playobj;
+ d->playobj = 0;
+
+ KDE::PlayObjectFactory factory(d->server.server());
+ d->playobj = factory.createPlayObject(d->file, true);
+
+ needReload = false;
+
+ return !d->playobj->isNull();
+}
+
+void Kaboodle::Engine::play()
+{
+ if(d->playobj)
+ {
+ switch(d->playobj->state())
+ {
+ case Arts::posIdle:
+ if(needReload)
+ reload();
+ d->playobj->play();
+ break;
+ case Arts::posPaused:
+ d->playobj->play();
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+void Kaboodle::Engine::pause()
+{
+ if(d->playobj && !d->playobj->isNull())
+ d->playobj->pause();
+}
+
+void Kaboodle::Engine::stop()
+{
+ if(d->playobj && !d->playobj->isNull())
+ {
+ d->playobj->halt();
+ needReload = true;
+ }
+}
+
+// pass time in msecs
+void Kaboodle::Engine::seek(unsigned long msec)
+{
+ Arts::poTime t;
+
+ t.ms = (long) msec % 1000;
+ t.seconds = (long) ((long)msec - t.ms) / 1000;
+
+ if(d->playobj && !d->playobj->isNull())
+ d->playobj->seek(t);
+}
+
+// return position in milliseconds
+long Kaboodle::Engine::position()
+{
+ if(!d->playobj || d->playobj->isNull()) return 0;
+
+ Arts::poTime time(d->playobj->currentTime());
+ return (time.ms + (time.seconds*1000));
+}
+
+// return track-length in milliseconds
+unsigned long Kaboodle::Engine::length()
+{
+ if(!d->playobj || d->playobj->isNull()) return 0;
+
+ Arts::poTime time(d->playobj->overallTime());
+ return (time.ms + (time.seconds*1000));
+}
+
+KMediaPlayer::Player::State Kaboodle::Engine::state()
+{
+ if(!d->playobj || d->playobj->isNull()) return KMediaPlayer::Player::Empty;
+
+ switch(d->playobj->state())
+ {
+ case Arts::posIdle:
+ return KMediaPlayer::Player::Stop;
+ break;
+ case Arts::posPlaying:
+ return KMediaPlayer::Player::Play;
+ break;
+ case Arts::posPaused:
+ return KMediaPlayer::Player::Pause;
+ break;
+ default:
+ return KMediaPlayer::Player::Stop;
+ break;
+ }
+}
+
+bool Kaboodle::Engine::seekable(void)
+{
+ if(!d->playobj || d->playobj->isNull()) return false;
+ return d->playobj->capabilities() & Arts::capSeek;
+}
+
+Arts::PlayObject Kaboodle::Engine::playObject() const
+{
+ return d->playobj ? d->playobj->object() : Arts::PlayObject::null();
+}
+
+#include "engine.moc"
diff --git a/kaboodle/engine.h b/kaboodle/engine.h
new file mode 100644
index 00000000..7174af3a
--- /dev/null
+++ b/kaboodle/engine.h
@@ -0,0 +1,100 @@
+/*****************************************************************
+
+Copyright (c) 2000-2001 the noatun authors. See file AUTHORS.
+
+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
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIAB\ILITY, 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.
+
+******************************************************************/
+
+#ifndef _ENGINE_H
+#define _ENGINE_H
+
+#include <qobject.h>
+#include <kmedia2.h>
+#include <kmediaplayer/player.h>
+#include <kurl.h>
+
+namespace Arts
+{
+class PlayObject;
+class SoundServerV2;
+}
+
+namespace Kaboodle
+{
+/**
+ * Handles all playing, connecting to aRts.
+ * Does almost everything related to multimedia.
+ * Most interfacing should be done with Player
+ **/
+class Engine : public QObject
+{
+Q_OBJECT
+
+public:
+ Engine(QObject *parent=0);
+ ~Engine();
+
+ Arts::PlayObject playObject() const;
+
+public slots:
+ /**
+ * Load a file
+ **/
+ bool load(const KURL &file);
+
+ /**
+ * Pause while playing
+ **/
+ void pause();
+
+ /**
+ * Start
+ **/
+ void play();
+
+ /**
+ * stops, and unloads
+ **/
+ void stop();
+
+ /**
+ * skips to a time
+ **/
+ void seek(unsigned long msec);
+
+public:
+ KMediaPlayer::Player::State state();
+ long position(); // NOT unsigned
+ unsigned long length();
+
+ /**
+ * returns if the current track is seekable
+ */
+ bool seekable(void);
+
+private:
+ bool reload(void);
+ bool needReload;
+
+ class EnginePrivate;
+ EnginePrivate *d;
+};
+
+}
+#endif
diff --git a/kaboodle/kaboodle.desktop b/kaboodle/kaboodle.desktop
new file mode 100644
index 00000000..2bddd990
--- /dev/null
+++ b/kaboodle/kaboodle.desktop
@@ -0,0 +1,83 @@
+[Desktop Entry]
+Name=Kaboodle
+Name[bn]=ক্যাবুডল্
+Name[eo]=Kabudlo
+Name[hi]=के-बूडल
+Name[ne]=काबोल्डल
+Name[pa]=ਕੇਬੋਡਲੀ
+Name[ta]=கபூடல்
+Name[zh_TW]=Kaboodle 媒體播放器
+Exec=kaboodle %i %m -caption "%c" %U
+Icon=kaboodle
+X-KDE-StartupNotify=true
+Type=Application
+# Keep in sync with the audio types in kaboodle_component.desktop
+MimeType=audio/x-mp3;application/ogg;audio/x-mp2;video/mpeg;audio/x-wav;audio/x-mod;video/x-msvideo;video/quicktime;video/x-flic;audio/basic;video/x-ms-asf;
+GenericName=Media Player
+GenericName[af]=Media Speler
+GenericName[ar]=مشغل وسائط
+GenericName[bg]=Мултимедиен плеър
+GenericName[bn]=মিডিয়া প্লেয়ার
+GenericName[br]=Soner liesvedia
+GenericName[ca]=Reproductor multimèdia
+GenericName[cs]=Přehrávač médií
+GenericName[cy]=Chwaraeydd Cyfryngau
+GenericName[da]=Medieafspiller
+GenericName[de]=Multimedia-Wiedergabe
+GenericName[el]=Αναπαραγωγέας μέσων
+GenericName[eo]=Ludilo por sonor-dosieroj
+GenericName[es]=Reproductor multimedia
+GenericName[et]=Multimeedia mängija
+GenericName[eu]=Euskarri erreproduzigailua
+GenericName[fa]=پخش‌کنندۀ رسانه
+GenericName[fi]=Mediasoitin
+GenericName[fr]=Lecteur multimédia
+GenericName[ga]=Seinnteoir Meán
+GenericName[gl]=Reproductor Multimedia
+GenericName[he]=נגן מדיה
+GenericName[hi]=मीडिया प्लेयर
+GenericName[hu]=Médialejátszó
+GenericName[is]=Margmiðlunarforrit
+GenericName[it]=Lettore multimediale
+GenericName[ja]=メディアプレーヤ
+GenericName[kk]=Media ойнатқышы
+GenericName[km]=កម្មវិធី​ចាក់​មេ​ឌៀ
+GenericName[ko]=미디어 재생기
+GenericName[lt]=Media grotuvas
+GenericName[lv]=Mēdiju Atskaņotājs
+GenericName[mk]=Медијaплеер
+GenericName[nb]=Mediaspiller
+GenericName[nds]=Medienafspeler
+GenericName[ne]=मिडिया प्लेयर
+GenericName[nl]=Mediaspeler
+GenericName[nn]=Mediespelar
+GenericName[pa]=ਸੰਗੀਤ ਵਾਜਾ
+GenericName[pl]=Odtwarzacz multimedialny
+GenericName[pt]=Leitor Multimédia
+GenericName[pt_BR]=Reprodutor de Mídia
+GenericName[ro]=Program de redare multimedia
+GenericName[ru]=Медиаплеер
+GenericName[se]=Mediačuojaheaddji
+GenericName[sk]=Prehrávač médií
+GenericName[sl]=Večpredstavnostni predvajalnik
+GenericName[sr]=Медија плејер
+GenericName[sr@Latn]=Medija plejer
+GenericName[sv]=Mediaspelare
+GenericName[ta]=ஊடக இயக்கி
+GenericName[tg]=Бозингари Расона
+GenericName[th]=โปรแกรมเล่นแฟ้มสื่อ
+GenericName[tr]=Medya Yürütücüsü
+GenericName[uk]=Програвач медіа-матеріалів
+GenericName[uz]=Media pleyer
+GenericName[uz@cyrillic]=Медиа плейер
+GenericName[ven]=Tshitambi tsha Media
+GenericName[wa]=Djouweu multimedia
+GenericName[xh]=Umdlali we Midia
+GenericName[zh_CN]=媒体播放器
+GenericName[zh_HK]=媒體播放器
+GenericName[zh_TW]=媒體播放器
+GenericName[zu]=Umdlali Womculo
+Terminal=false
+InitialPreference=6
+X-DCOP-ServiceType=Multi
+Categories=Qt;KDE;AudioVideo;X-KDE-More;
diff --git a/kaboodle/kaboodle_component.desktop b/kaboodle/kaboodle_component.desktop
new file mode 100644
index 00000000..0f363cf6
--- /dev/null
+++ b/kaboodle/kaboodle_component.desktop
@@ -0,0 +1,72 @@
+[Desktop Entry]
+Name=Embedded Media Player
+Name[af]=Ingebedde Media Speler
+Name[ar]=مشغل وسائط متعددة معلّب
+Name[az]=Daxili Medya Çalğıcısı
+Name[bn]=সন্নিবিষ্ট মিডিয়া প্লেয়ার
+Name[br]=Soner liesvedia enframmet
+Name[bs]=Uključeni Media Player
+Name[ca]=Reproductor multimèdia incrustat
+Name[cs]=Vestavěný přehrávač médií
+Name[cy]=Chwaraeydd Cyfryngau Mewnol
+Name[da]=Indlejret medieafspiller
+Name[de]=Eingebettete Multimedia-Wiedergabe
+Name[el]=Ενσωματωμένος αναπαραγωγέας μέσων
+Name[eo]=Implantita Sondosierludilo
+Name[es]=Reproductor de multimedia empotrado
+Name[et]=Põimitav meediafailide mängija
+Name[eu]=Euskarri erreproduzigailu kapsulatua
+Name[fa]=پخش‌کنندۀ رسانۀ نهفته
+Name[fi]=Upotettava mediasoitin
+Name[fr]=Lecteur multimédia incorporé
+Name[ga]=Seinnteoir Meán Leabaithe
+Name[gl]=Reproductor Incrustado Multimedia
+Name[he]=נגן המדיה המוטבע
+Name[hi]=एम्बेडेड मीडिया प्लेयर
+Name[hr]=Ugradivi media player
+Name[hu]=Beágyazott médialejátszó
+Name[is]=Ívafinn Hljóðspilari KDE
+Name[it]=Lettore multimediale integrabile
+Name[ja]=埋め込みメディアプレーヤ
+Name[kk]=Ендірілетін медиа ойнатқышы
+Name[km]=កម្មវិធី​ចាក់​មេឌៀ​បង្កប់
+Name[ko]=포함된 미디어 재생기
+Name[lt]=Įdėtas media grotuvas
+Name[lv]=Iegults Mēdiju Atskaņotājs
+Name[mk]=Вгнезден медијаплеер
+Name[mt]=Plejer tal-Media integrat
+Name[nb]=Innebygget mediaspiller
+Name[nds]=Inbett Medienafspeler
+Name[ne]=सम्मिलित मिडिया प्लेयर
+Name[nl]=Ingebedde mediaspeler
+Name[nn]=Innebygd mediespelar
+Name[pa]=ਸ਼ਾਮਿਲ ਮੀਡਿਆ ਵਾਜਾ
+Name[pl]=Osadzony odtwarzacz mediów
+Name[pt]=Leitor Multimédia Embebido
+Name[pt_BR]=Reprodutor de Mídia Integrado KDE
+Name[ro]=Program de redare multimedia înglobat
+Name[ru]=Встроенный медиаплеер
+Name[se]=Vuojuhuvvon mediečuojaheaddji
+Name[sk]=Vložitelný prehrávač médií
+Name[sl]=Vključeni večpredstavnostni predvajalnik
+Name[sr]=Уграђени медија плејер
+Name[sr@Latn]=Ugrađeni medija plejer
+Name[sv]=Inbäddad mediaspelare
+Name[ta]=உட்பொதிந்த ஊடக இயக்கி
+Name[tg]=Бозингари Расонаи Дарунсохта
+Name[th]=โปรแกรมเล่นแฟ้มสื่อแบบฝังตัว
+Name[tr]=Gömülü Medya Yürütücüsü
+Name[uk]=Вмонтований програвач медіа
+Name[ven]=Tshitambi tsha media tsha Embedded
+Name[xh]=Umdlali ophakathi olungisiweyo
+Name[zh_CN]=嵌入式媒体播放器
+Name[zh_HK]=嵌入式媒體播放器
+Name[zh_TW]=嵌入式媒體播放器
+Name[zu]=Oxubiwe Umdlai Wezezindaba
+X-KDE-Library=libkaboodlepart
+Icon=kaboodle
+# Keep in sync with the audio types in kaboodle.desktop
+MimeType=audio/x-mp3;application/ogg;audio/x-mp2;video/mpeg;audio/x-wav;audio/x-mod;video/x-msvideo;video/quicktime;video/x-flic;audio/basic;video/x-ms-asf
+ServiceTypes=KParts/ReadOnlyPart,Browser/View,KMediaPlayer/Player
+Type=Service
+InitialPreference=8
diff --git a/kaboodle/kaboodle_factory.cpp b/kaboodle/kaboodle_factory.cpp
new file mode 100644
index 00000000..1706f3c3
--- /dev/null
+++ b/kaboodle/kaboodle_factory.cpp
@@ -0,0 +1,83 @@
+/*****************************************************************
+
+Copyright (c) 2000-2001 the noatun authors. See file AUTHORS.
+
+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
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIAB\ILITY, 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.
+
+******************************************************************/
+
+#include <klocale.h>
+#include "kaboodle_factory.h"
+#include "player.h"
+
+K_EXPORT_COMPONENT_FACTORY( libkaboodlepart, Kaboodle::KaboodleFactory)
+
+KInstance *Kaboodle::KaboodleFactory::s_instance = 0;
+KAboutData *Kaboodle::KaboodleFactory::s_aboutData = 0;
+
+Kaboodle::KaboodleFactory::KaboodleFactory() : KParts::Factory()
+{
+}
+
+Kaboodle::KaboodleFactory::~KaboodleFactory()
+{
+ delete s_aboutData;
+ s_aboutData = 0;
+ delete s_instance;
+ s_instance = 0;
+}
+
+KParts::Part *Kaboodle::KaboodleFactory::createPartObject(QWidget *widgetParent, const char *widgetName, QObject *parent, const char *name, const char *className, const QStringList &)
+{
+ if(className == QString("KMediaPlayer/Engine"))
+ {
+ return new Player(parent, name);
+ }
+ else
+ {
+ return new Player(widgetParent, widgetName, parent, name);
+ }
+}
+
+KInstance *Kaboodle::KaboodleFactory::instance()
+{
+ if(!s_instance)
+ s_instance = new KInstance(aboutData());
+
+ return s_instance;
+}
+
+const KAboutData *Kaboodle::KaboodleFactory::aboutData()
+{
+ if(!s_aboutData)
+ {
+ s_aboutData = new KAboutData("kaboodle", I18N_NOOP("Kaboodle"), "1.7",
+ I18N_NOOP("The Lean KDE Media Player"),
+ KAboutData::License_BSD,
+ "(c) 2001-2003 Kaboodle developers", 0,
+ "http://www.freekde.org/neil/kaboodle/");
+ s_aboutData->addCredit("Carsten Pfeiffer", I18N_NOOP("Maintainer"), "pfeiffer@kde.org");
+ s_aboutData->addAuthor("Neil Stevens", I18N_NOOP("Previous Maintainer"), "neil@qualityassistant.com");
+ s_aboutData->addCredit("Elhay Achiam", I18N_NOOP("Application icon"));
+ s_aboutData->addCredit("Charles Samuels", I18N_NOOP("Original Noatun Developer"), "charles@kde.org");
+ s_aboutData->addCredit("Nikolas Zimmermann", I18N_NOOP("Konqueror Embedding"), "wildfox@kde.org");
+ }
+ return s_aboutData;
+}
+
+#include "kaboodle_factory.moc"
diff --git a/kaboodle/kaboodle_factory.h b/kaboodle/kaboodle_factory.h
new file mode 100644
index 00000000..0c43c7c2
--- /dev/null
+++ b/kaboodle/kaboodle_factory.h
@@ -0,0 +1,55 @@
+/*****************************************************************
+
+Copyright (c) 2000-2001 the noatun authors. See file AUTHORS.
+
+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
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIAB\ILITY, 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.
+
+******************************************************************/
+
+#ifndef KABOODLE_FACTORY_H
+#define KABOODLE_FACTORY_H
+
+#include <kaboutdata.h>
+#include <kinstance.h>
+#include <kparts/factory.h>
+
+namespace Kaboodle
+{
+class Player;
+
+class KaboodleFactory : public KParts::Factory
+{
+Q_OBJECT
+
+public:
+ KaboodleFactory();
+ virtual ~KaboodleFactory();
+
+ virtual KParts::Part *createPartObject(QWidget *widgetParent, const char *widgetName, QObject *parent = 0, const char *name = 0, const char *classname = "QObject", const QStringList &args = QStringList());
+
+ static const KAboutData *aboutData();
+ static KInstance *instance();
+
+private:
+ static KInstance *s_instance;
+ static KAboutData *s_aboutData;
+};
+
+}
+
+#endif
diff --git a/kaboodle/kaboodleapp.cpp b/kaboodle/kaboodleapp.cpp
new file mode 100644
index 00000000..22de968a
--- /dev/null
+++ b/kaboodle/kaboodleapp.cpp
@@ -0,0 +1,53 @@
+/*****************************************************************
+
+Copyright (c) 2000-2001 the noatun authors. See file AUTHORS.
+
+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
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIAB\ILITY, 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.
+
+******************************************************************/
+
+#include <kcmdlineargs.h>
+#include <kconfig.h>
+
+#include "kaboodleapp.h"
+#include "userinterface.h"
+
+Kaboodle::KaboodleApp::KaboodleApp()
+ : KApplication()
+{
+ disableSessionManagement();
+
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+ KURL openURL;
+ if(args->count() > 0)
+ {
+ KURL url = args->url(args->count() - 1);
+ if(url.isValid()) openURL = url;
+ }
+
+ ui = new UserInterface(0L, openURL);
+ setMainWidget( ui );
+}
+
+Kaboodle::KaboodleApp::~KaboodleApp()
+{
+ // do not delete ui here, it might be the one closing us via closeEvent
+ // ui is deleted automatically anyway.
+}
+
+#include "kaboodleapp.moc"
diff --git a/kaboodle/kaboodleapp.h b/kaboodle/kaboodleapp.h
new file mode 100644
index 00000000..92073c96
--- /dev/null
+++ b/kaboodle/kaboodleapp.h
@@ -0,0 +1,45 @@
+/*****************************************************************
+
+Copyright (c) 2000-2001 the noatun authors. See file AUTHORS.
+
+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
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIAB\ILITY, 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.
+
+******************************************************************/
+
+#ifndef KABOODLEAPP_H
+#define KABOODLEAPP_H
+
+#include <kapplication.h>
+
+namespace Kaboodle
+{
+class UserInterface;
+
+class KaboodleApp : public KApplication
+{
+Q_OBJECT
+
+public:
+ KaboodleApp();
+ virtual ~KaboodleApp();
+
+private:
+ UserInterface *ui;
+};
+}
+#endif
diff --git a/kaboodle/kaboodleengine.desktop b/kaboodle/kaboodleengine.desktop
new file mode 100644
index 00000000..853951bf
--- /dev/null
+++ b/kaboodle/kaboodleengine.desktop
@@ -0,0 +1,67 @@
+[Desktop Entry]
+Name=Embedded Media Player Engine
+Name[af]=Ingebedde Media Speler Masjien
+Name[bn]=সন্নিবিষ্ট মিডিয়া প্লেয়ার ইঞ্জিন
+Name[br]=Keflusker enframmet soner liesvedia
+Name[bs]=Uključeni Media Player
+Name[ca]=Motor del reproductor multimèdia incrustat
+Name[cs]=Vestavěný přehrávač médií
+Name[cy]=Peiriant Chwaraeydd Cyfryngau Mewnol
+Name[da]=Indlejret medieafspiller-motor
+Name[de]=Eingebettete Multimedia-Wiedergabe
+Name[el]=Ενσωματωμένη μηχανή αναπαραγωγής μέσων
+Name[eo]=Implantita Sondosierludilo
+Name[es]=Motor reproductor multimedia empotrado
+Name[et]=Põimitav meediafailide mängija
+Name[eu]=Euskarri erreproduzigailuaren motore kapsulatua
+Name[fa]=موتور پخش‌کنندۀ رسانۀ نهفته
+Name[fi]=Upotettava mediasoitinkoneisto
+Name[ga]=Inneall Seinnteora Leabaithe Meán
+Name[gl]=Mecanismo do Reproductor Incrustado Multimedia
+Name[he]=מנוע נגן המדיה המוטבע
+Name[hi]=एम्बेडेड मीडिया प्लेयर इंजिन
+Name[hr]=Ugradiva osnova za Media Player
+Name[hu]=Beágyazott médialejátszó motor
+Name[is]=Ívafinn Hljóðspilari KDE
+Name[it]=Motore del lettore multimediale integrato
+Name[ja]=埋め込みメディアプレーヤエンジン
+Name[kk]=Ендірілетін медиа ойнатқыш тетігі
+Name[km]=ម៉ាស៊ីន​កម្មវិធី​ចាក់​មេឌៀ​បង្កប់
+Name[ko]=포함된 미디어 재생기 엔진
+Name[lt]=Įdėto media grotuvo variklis
+Name[mk]=Вградена машина за медијаплеер
+Name[nb]=Innebygget motor for mediaavspiller
+Name[nds]=Inbett Medienafspeelmaschien
+Name[ne]=सम्मिलित मिडिया प्लेयर इन्जिन
+Name[nl]=Ingebedde mediaspeler
+Name[nn]=Innebygd mediespelemotor
+Name[pa]=ਸ਼ਾਮਿਲ ਮੀਡਿਆ ਵਾਜਾ ਇੰਜਣ
+Name[pl]=Osadzony odtwarzacz mediów
+Name[pt]=Motor do Leitor Multimédia Embebido
+Name[pt_BR]=Mecanismo integrado ao Reprodutor de Mídia
+Name[ro]=Program de redare multimedia înglobat
+Name[ru]=Движок встроенного медиаплеера
+Name[se]=Vuojuhuvvon mediačuojahanmutuvra
+Name[sk]=Vložiteľný prehrávač médií
+Name[sl]=Pogon vključenega večpredstavnostnega predvajalnika
+Name[sr]=Уграђени мотор медија плејера
+Name[sr@Latn]=Ugrađeni motor medija plejera
+Name[sv]=Inbäddad mediaspelarkomponent
+Name[ta]=உட்பொதிந்த மீடியா பிளேயர் பொறி
+Name[tg]=Бозингари Расонаи Дарунсохтаи Муҳаррик
+Name[th]=โปรแกรมประมวลผลสำหรับเล่นแฟ้มสื่อ
+Name[tr]=Gömülü Çoklu Ortam Yürütücüsü Motoru
+Name[uk]=Механізм вмонтованого програвача медіа
+Name[ven]=Tshitambi tsha media tsho dzheniswaho
+Name[xh]=Injini Yomdlali we Media Ebekiweyo
+Name[zh_CN]=嵌入式媒体播放器引擎
+Name[zh_HK]=嵌入式媒體播放器引擎
+Name[zh_TW]=嵌入式媒體播放器引擎
+Name[zu]=Injini Yomdlali Womculom Ohlanganisiwe
+X-KDE-Library=libkaboodlepart
+Icon=kaboodle
+# Keep in sync with the audio types in kaboodle.desktop
+MimeType=audio/x-mp3;application/ogg;audio/x-mp2;video/mpeg;audio/x-wav;audio/x-mod;video/x-msvideo;video/quicktime;video/x-flic;audio/basic;video/x-ms-asf
+ServiceTypes=KMediaPlayer/Engine
+Type=Service
+InitialPreference=8
diff --git a/kaboodle/kaboodlepartui.rc b/kaboodle/kaboodlepartui.rc
new file mode 100644
index 00000000..a5861c23
--- /dev/null
+++ b/kaboodle/kaboodlepartui.rc
@@ -0,0 +1,26 @@
+<!DOCTYPE kpartgui>
+<kpartgui name="kaboodle" version="6">
+<ActionProperties>
+ <Action name="play" icon="1rightarrow"/>
+ <Action name="pause" icon="player_pause"/>
+ <Action name="stop" icon="player_stop"/>
+ <Action name="loop" icon="kaboodleloop"/>
+</ActionProperties>
+<Toolbar name="KaboodleToolbar"><text>Kaboodle Toolbar</text>
+ <Action name="play"/>
+ <Action name="pause"/>
+ <Action name="stop"/>
+ <Separator/>
+ <Action name="loop"/>
+</Toolbar>
+<MenuBar>
+<Menu name="edit">
+ <Separator/>
+ <Action name="play"/>
+ <Action name="pause"/>
+ <Action name="stop"/>
+ <Separator/>
+ <Action name="loop"/>
+</Menu>
+</MenuBar>
+</kpartgui>
diff --git a/kaboodle/kaboodleui.rc b/kaboodle/kaboodleui.rc
new file mode 100644
index 00000000..4f46a170
--- /dev/null
+++ b/kaboodle/kaboodleui.rc
@@ -0,0 +1,17 @@
+<!DOCTYPE kpartgui>
+<kpartgui name="kaboodle" version="9">
+<MenuBar>
+ <Menu name="edit">
+ <text>&amp;Edit</text>
+ <Action name="properties"/>
+ </Menu>
+</MenuBar>
+<Toolbar name="KaboodleToolbar"><text>Kaboodle Toolbar</text>
+ <Action name="file_open"/>
+ <Action name="options_show_menubar"/>
+ <Separator line="true"/>
+ <Merge/>
+ <Separator line="true"/>
+ <Action name="file_quit"/>
+</Toolbar>
+</kpartgui>
diff --git a/kaboodle/main.cpp b/kaboodle/main.cpp
new file mode 100644
index 00000000..35e858df
--- /dev/null
+++ b/kaboodle/main.cpp
@@ -0,0 +1,59 @@
+/*****************************************************************
+
+Copyright (c) 2000-2001 the noatun authors. See file AUTHORS.
+
+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
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIAB\ILITY, 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.
+
+******************************************************************/
+
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+#include <klocale.h>
+#include <qapplication.h>
+
+#include "kaboodle_factory.h"
+#include "kaboodleapp.h"
+
+void noMessageOutput(QtMsgType, const char *)
+{
+}
+
+static KCmdLineOptions options[] =
+{
+ { "+[URL]", I18N_NOOP("URL to open"), 0 },
+#ifndef NDEBUG
+ { "qdebug", I18N_NOOP("Turn on Qt Debug output"), 0 },
+#endif
+ KCmdLineLastOption
+};
+
+int main(int argc, char **argv)
+{
+ KCmdLineArgs::init(argc, argv, Kaboodle::KaboodleFactory::aboutData());
+ KCmdLineArgs::addCmdLineOptions(options);
+
+#ifndef NDEBUG
+ if(!KCmdLineArgs::parsedArgs()->isSet("qdebug"))
+ qInstallMsgHandler(noMessageOutput);
+#endif
+
+ Kaboodle::KaboodleApp::addCmdLineOptions();
+ Kaboodle::KaboodleApp app;
+
+ return app.exec();
+}
diff --git a/kaboodle/pics/Makefile.am b/kaboodle/pics/Makefile.am
new file mode 100644
index 00000000..e5515a85
--- /dev/null
+++ b/kaboodle/pics/Makefile.am
@@ -0,0 +1 @@
+KDE_ICON = AUTO
diff --git a/kaboodle/pics/hi128-app-kaboodle.png b/kaboodle/pics/hi128-app-kaboodle.png
new file mode 100644
index 00000000..3c041bbd
--- /dev/null
+++ b/kaboodle/pics/hi128-app-kaboodle.png
Binary files differ
diff --git a/kaboodle/pics/hi16-app-kaboodle.png b/kaboodle/pics/hi16-app-kaboodle.png
new file mode 100644
index 00000000..71e4dd53
--- /dev/null
+++ b/kaboodle/pics/hi16-app-kaboodle.png
Binary files differ
diff --git a/kaboodle/pics/hi22-app-kaboodle.png b/kaboodle/pics/hi22-app-kaboodle.png
new file mode 100644
index 00000000..838cf9d8
--- /dev/null
+++ b/kaboodle/pics/hi22-app-kaboodle.png
Binary files differ
diff --git a/kaboodle/pics/hi32-app-kaboodle.png b/kaboodle/pics/hi32-app-kaboodle.png
new file mode 100644
index 00000000..87ac58b8
--- /dev/null
+++ b/kaboodle/pics/hi32-app-kaboodle.png
Binary files differ
diff --git a/kaboodle/pics/hi48-app-kaboodle.png b/kaboodle/pics/hi48-app-kaboodle.png
new file mode 100644
index 00000000..509c0221
--- /dev/null
+++ b/kaboodle/pics/hi48-app-kaboodle.png
Binary files differ
diff --git a/kaboodle/pics/hi64-app-kaboodle.png b/kaboodle/pics/hi64-app-kaboodle.png
new file mode 100644
index 00000000..7086d4fd
--- /dev/null
+++ b/kaboodle/pics/hi64-app-kaboodle.png
Binary files differ
diff --git a/kaboodle/player.cpp b/kaboodle/player.cpp
new file mode 100644
index 00000000..2530c0c5
--- /dev/null
+++ b/kaboodle/player.cpp
@@ -0,0 +1,268 @@
+/*****************************************************************
+
+Copyright (c) 2000-2001 the noatun authors. See file AUTHORS.
+
+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
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIAB\ILITY, 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.
+
+******************************************************************/
+
+#include <kaction.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kurl.h>
+
+#include "engine.h"
+#include "kaboodleapp.h"
+#include "kaboodle_factory.h"
+#include "player.h"
+#include "view.h"
+
+Kaboodle::Player::Player(QObject *parent, const char *name)
+ : KMediaPlayer::Player(parent, name)
+ , engine(new Engine(this))
+ , widget(0)
+ , uncompleted(true)
+ , embedded(false)
+{
+ setInstance(KaboodleFactory::instance());
+
+ connect(&ticker, SIGNAL(timeout()), SLOT(tickerTimeout()));
+ ticker.start(500);
+ setState(Empty);
+}
+
+Kaboodle::Player::Player(QWidget *widgetParent, const char *widgetName,
+ QObject *parent, const char *name)
+ : KMediaPlayer::Player(widgetParent, widgetName, parent, name)
+ , engine(new Engine(this))
+ , widget(new View(widgetParent, widgetName, this))
+ , uncompleted(true)
+ , embedded(false)
+{
+ setInstance(KaboodleFactory::instance());
+
+ connect(&ticker, SIGNAL(timeout()), SLOT(tickerTimeout()));
+ ticker.start(500);
+ setState(Empty);
+
+ playAction = new KAction(i18n("&Play"), 0, this, SLOT(play()), actionCollection(), "play");
+ pauseAction = new KAction(i18n("&Pause"), 0, this, SLOT(pause()), actionCollection(), "pause");
+ stopAction = new KAction(i18n("&Stop"), 0, this, SLOT(stop()), actionCollection(), "stop");
+ loopAction = new KToggleAction(i18n("&Looping"), 0, this, SLOT(loop()), actionCollection(), "loop");
+ stopAction->setEnabled(false);
+ playAction->setEnabled(false);
+ pauseAction->setEnabled(false);
+ connect(this, SIGNAL(loopingChanged(bool)), loopAction, SLOT(setChecked(bool)));
+
+ KParts::Part::setWidget(widget);
+ setXMLFile("kaboodlepartui.rc");
+
+ extension = new BrowserExtension(this);
+ extension->setURLDropHandlingEnabled(true);
+}
+
+Kaboodle::Player::~Player()
+{
+}
+
+KMediaPlayer::View *Kaboodle::Player::view(void)
+{
+ return widget;
+}
+
+// notice how this is just an expanded stop() ? weird.
+bool Kaboodle::Player::openURL(const KURL &f)
+{
+ if(!current.isEmpty())
+ {
+ uncompleted = false;
+ engine->stop();
+ }
+
+ emit started(0);
+ current = f;
+ if(!engine->load(current))
+ {
+ current = KURL();
+ setState(Empty);
+ emit canceled(i18n("aRts could not load this file."));
+ return false;
+ }
+
+ stopAction->setEnabled(false);
+ playAction->setEnabled(true);
+ pauseAction->setEnabled(false);
+ setState(Empty); // so stateChanged() is emitted and autoPlay works
+ setState(Stop);
+
+ tickerTimeout();
+ return true;
+}
+
+KURL Kaboodle::Player::currentURL(void)
+{
+ return current;
+}
+
+bool Kaboodle::Player::openFile(void)
+{
+ return true;
+}
+
+QString Kaboodle::Player::timeString(unsigned long time)
+{
+ int posSecs = (int)(time / 1000);
+ int posSeconds = posSecs % 60;
+ int posMinutes = (posSecs - posSeconds) / 60;
+
+ QString result;
+ result.sprintf("%.2d:%.2d", posMinutes, posSeconds);
+ return result;
+}
+
+QString Kaboodle::Player::positionString(void)
+{
+ return timeString(engine->position());
+}
+
+QString Kaboodle::Player::lengthString(void)
+{
+ return timeString(engine->length());
+}
+
+void Kaboodle::Player::pause()
+{
+ if(engine->state() == Play)
+ {
+ stopAction->setEnabled(true);
+ playAction->setEnabled(true);
+ pauseAction->setEnabled(false);
+ engine->pause();
+ setState(Pause);
+ }
+}
+
+void Kaboodle::Player::play()
+{
+ stopAction->setEnabled(true);
+ playAction->setEnabled(false);
+ pauseAction->setEnabled(true);
+ engine->play();
+ setState(Play);
+ uncompleted = true;
+}
+
+void Kaboodle::Player::stop(void)
+{
+ engine->stop();
+ uncompleted = false;
+ stopAction->setEnabled(false);
+ playAction->setEnabled(true);
+ pauseAction->setEnabled(false);
+ setState(Stop);
+}
+
+void Kaboodle::Player::loop(void)
+{
+ setLooping(!isLooping());
+}
+
+void Kaboodle::Player::seek(unsigned long msec)
+{
+ if(!current.isEmpty())
+ engine->seek(msec);
+}
+
+bool Kaboodle::Player::isSeekable(void) const
+{
+ return engine->seekable();
+}
+
+unsigned long Kaboodle::Player::position(void) const
+{
+ return engine->position();
+}
+
+bool Kaboodle::Player::hasLength(void) const
+{
+ // TODO: replace this weird assumption with something nice in aRts
+ return engine->seekable();
+}
+
+unsigned long Kaboodle::Player::length(void) const
+{
+ return engine->length();
+}
+
+void Kaboodle::Player::tickerTimeout(void)
+{
+ if(engine->state() == Stop)
+ {
+ if ( uncompleted )
+ {
+ stop();
+ if( isLooping() )
+ {
+ play();
+ }
+ else
+ {
+ uncompleted = false;
+ emit completed();
+ }
+ }
+ if(embedded)
+ {
+ widget->embed(Arts::PlayObject::null());
+ embedded = false;
+ }
+ }
+ else if(engine->state() != Stop && engine->state() != Empty)
+ {
+ if(!embedded)
+ {
+ widget->embed(engine->playObject());
+ embedded = true;
+ }
+
+ emit timeout();
+
+ if(extension)
+ emit setStatusBarText(i18n("Playing %1 - %2")
+ .arg(current.prettyURL())
+ .arg(positionString() + "/" + lengthString()));
+
+ }
+ updateTitle();
+}
+
+void Kaboodle::Player::updateTitle()
+{
+ if(!current.isEmpty() && (lastEmitted != current))
+ {
+ lastEmitted = current;
+ emit setWindowCaption(current.prettyURL());
+ }
+}
+
+Kaboodle::BrowserExtension::BrowserExtension(Player *parent)
+ : KParts::BrowserExtension(parent, "Kaboodle Browser Extension")
+{
+}
+
+#include "player.moc"
diff --git a/kaboodle/player.h b/kaboodle/player.h
new file mode 100644
index 00000000..90ddad49
--- /dev/null
+++ b/kaboodle/player.h
@@ -0,0 +1,116 @@
+/*****************************************************************
+
+Copyright (c) 2000-2001 the noatun authors. See file AUTHORS.
+
+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
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIAB\ILITY, 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.
+
+******************************************************************/
+
+#ifndef PLAYER_H
+#define PLAYER_H
+
+#include <kmedia2.h>
+#include <kmediaplayer/player.h>
+#include <kparts/browserextension.h>
+#include <kurl.h>
+#include <qobject.h>
+#include <qtimer.h>
+
+class KAction;
+class KToggleAction;
+
+namespace Kaboodle
+{
+class Engine;
+class Player;
+class View;
+
+class BrowserExtension : public KParts::BrowserExtension
+{
+Q_OBJECT
+
+public:
+ BrowserExtension(Player *parent);
+};
+
+class Player : public KMediaPlayer::Player
+{
+Q_OBJECT
+
+public:
+ Player(QWidget *widgetParent, const char *widgetName,
+ QObject *parent, const char *name);
+ Player(QObject *parent, const char *name);
+ virtual ~Player();
+
+ virtual bool openURL(const KURL &);
+ KURL currentURL(void);
+
+ /**
+ * returns a string with the time that can
+ * be used in the UI:
+ * CC:CC/LL:LL (mm:ss)
+ **/
+ static QString timeString(unsigned long);
+ QString lengthString(void);
+ QString positionString(void);
+
+ virtual KMediaPlayer::View *view(void);
+
+public slots:
+ virtual void pause(void);
+ virtual void play(void);
+ virtual void stop(void);
+ void loop(void);
+
+ virtual void seek(unsigned long msec);
+
+public:
+ virtual bool isSeekable(void) const;
+ virtual unsigned long position(void) const;
+ virtual bool hasLength(void) const;
+ virtual unsigned long length(void) const;
+
+signals:
+ void timeout(void);
+
+protected:
+ virtual bool openFile(void);
+
+private slots:
+ void tickerTimeout(void);
+ void updateTitle(void);
+
+private:
+ Engine *engine;
+ View *widget;
+
+ BrowserExtension *extension;
+
+ KAction *playAction, *pauseAction, *stopAction;
+ KToggleAction *loopAction;
+
+ QTimer ticker;
+ KURL current;
+ bool uncompleted;
+
+ KURL lastEmitted;
+ bool embedded;
+};
+}
+#endif
diff --git a/kaboodle/userinterface.cpp b/kaboodle/userinterface.cpp
new file mode 100644
index 00000000..eca95c75
--- /dev/null
+++ b/kaboodle/userinterface.cpp
@@ -0,0 +1,182 @@
+// Copyright (C) 2002 Neil Stevens <neil@qualityassistant.com>
+// Copyright (C) 1999 Charles Samuels <charles@kde.org>
+//
+// 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 <arts/kplayobjectfactory.h>
+#include <kconfig.h>
+#include <kdialog.h>
+#include <kfiledialog.h>
+#include <kglobal.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kmenubar.h>
+#include <kpropertiesdialog.h>
+#include <kstatusbar.h>
+#include <kstdaction.h>
+#include <kurldrag.h>
+#include <qdragobject.h>
+#include <qlayout.h>
+#include <qlcdnumber.h>
+#include <qvbox.h>
+#include <kkeydialog.h>
+#include <kvideowidget.h>
+
+#include "conf.h"
+#include "kaboodleapp.h"
+#include "kaboodle_factory.h"
+#include "player.h"
+#include "view.h"
+#include "userinterface.h"
+
+Kaboodle::UserInterface::UserInterface(QWidget *parent, const KURL &initialFile)
+ : KParts::MainWindow(parent)
+{
+ setAcceptDrops(true);
+ setStandardToolBarMenuEnabled(true);
+
+ KStdAction::open(this, SLOT(fileOpen()), actionCollection());
+ KStdAction::quit(kapp, SLOT(quit()), actionCollection());
+ KStdAction::preferences(this, SLOT(playerPreferences()), actionCollection());
+ KStdAction::keyBindings( this, SLOT( slotConfigureKeys() ), actionCollection() );
+
+ menubarAction = KStdAction::showMenubar(this, SLOT(showMenubar()), actionCollection());
+ propertiesAction = new KAction(i18n("Properties"), 0, this, SLOT(properties()), actionCollection(), "properties");
+ propertiesAction->setEnabled(false);
+
+ part = new Player(this, "KaboodlePlayer", this, "KaboodleView");
+ part->view()->setButtons(KMediaPlayer::View::Seeker);
+
+ setCentralWidget(part->view());
+ createGUI(part);
+ delete toolBar("mainToolBar");
+
+ statusBar()->show();
+
+ connect(part, SIGNAL(setWindowCaption(const QString &)), this, SLOT(updateTitle(const QString &)));
+ connect(part->view(), SIGNAL(adaptSize(int, int)), this, SLOT(adaptSize(int, int)));
+
+ setIcon(SmallIcon("kaboodle"));
+
+ resize(320, minimumHeight());
+ applyMainWindowSettings(KGlobal::config());
+ menubarAction->setChecked(!menuBar()->isHidden());
+
+ applySettings();
+
+ if(!initialFile.isEmpty())
+ {
+ part->openURL(initialFile);
+ propertiesAction->setEnabled(true);
+ }
+
+ show();
+}
+
+void Kaboodle::UserInterface::slotConfigureKeys()
+{
+ KKeyDialog dialog(this, 0);
+ dialog.insert(actionCollection(), KaboodleFactory::instance()->aboutData()->programName() );
+ dialog.insert(part->actionCollection(), i18n("Player") );
+ View *view = static_cast<View*>( part->view() );
+ dialog.insert(view->videoWidget()->actionCollection(), i18n("Video"));
+ (void) dialog.configure();
+}
+
+Kaboodle::UserInterface::~UserInterface(void)
+{
+ saveMainWindowSettings(KGlobal::config());
+}
+
+void Kaboodle::UserInterface::fileOpen(void)
+{
+ KURL file(KFileDialog::getOpenURL(QString::null, KDE::PlayObjectFactory::mimeTypes().join(" "), this, i18n("Select File to Play")));
+ if(file.isValid())
+ {
+ part->openURL(file);
+ propertiesAction->setEnabled(true);
+ }
+}
+
+void Kaboodle::UserInterface::dragEnterEvent(QDragEnterEvent *event)
+{
+ // accept uri drops only
+ event->accept(KURLDrag::canDecode(event));
+}
+
+void Kaboodle::UserInterface::dropEvent(QDropEvent *event)
+{
+ KURL::List list;
+ if (KURLDrag::decode(event, list))
+ {
+ if (!list.isEmpty())
+ part->openURL(list.first());
+ }
+}
+
+void Kaboodle::UserInterface::playerPreferences(void)
+{
+ Conf dlg(this);
+ dlg.exec();
+ applySettings();
+}
+
+void Kaboodle::UserInterface::applySettings(void)
+{
+ View *view = static_cast<View *>(part->view());
+ KConfig &config = *KGlobal::config();
+ config.setGroup("core");
+ view->setAutoPlay(config.readBoolEntry("autoPlay", true));
+ view->setQuitAfterPlaying(config.readBoolEntry("quitAfterPlaying", true));
+}
+
+void Kaboodle::UserInterface::showMenubar(void)
+{
+ if(menubarAction->isChecked())
+ menuBar()->show();
+ else
+ menuBar()->hide();
+}
+
+void Kaboodle::UserInterface::updateTitle(const QString &text)
+{
+ setCaption(text);
+ statusBar()->message(text);
+}
+
+void Kaboodle::UserInterface::properties(void)
+{
+ if(!part->currentURL().isEmpty())
+ (void)new KPropertiesDialog(part->currentURL());
+}
+
+void Kaboodle::UserInterface::adaptSize(int newViewWidth, int newViewHeight)
+{
+ if(!newViewWidth) return;
+ View *view = static_cast<View *>(part->view());
+ int extraWidth = width() - view->width();
+ int extraHeight = height() - view->height();
+ resize(newViewWidth + extraWidth, newViewHeight + extraHeight);
+}
+
+#include "userinterface.moc"
+
diff --git a/kaboodle/userinterface.h b/kaboodle/userinterface.h
new file mode 100644
index 00000000..db91ebad
--- /dev/null
+++ b/kaboodle/userinterface.h
@@ -0,0 +1,72 @@
+// Copyright (C) 2000 Neil Stevens <multivac@fcmail.com>
+// Copyright (C) 1999 Charles Samuels <charles@kde.org>
+//
+// 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 USERINTERFACE_H
+#define USERINTERFACE_H
+
+#include "kaboodleapp.h"
+#include <kaction.h>
+#include <kparts/mainwindow.h>
+#include <kurl.h>
+
+#include "player.h"
+
+namespace Kaboodle
+{
+/**
+ * @short Main window class
+ * @author Neil Stevens <multivac@fcmail.com>
+ * @author Charles Samuels <charles@kde.org>
+ */
+class UserInterface : public KParts::MainWindow
+{
+Q_OBJECT
+public:
+ UserInterface(QWidget *parent, const KURL &initialFile = KURL());
+ virtual ~UserInterface(void);
+
+ void load(const QString& url);
+
+protected:
+ virtual void dragEnterEvent(QDragEnterEvent *);
+ virtual void dropEvent(QDropEvent *);
+
+public slots:
+ void playerPreferences(void);
+
+private slots:
+ void fileOpen(void);
+ void showMenubar(void);
+ void updateTitle(const QString &text);
+ void applySettings(void);
+ void properties(void);
+ void adaptSize(int width, int height);
+ void slotConfigureKeys();
+private:
+ Player *part;
+ KToggleAction *menubarAction;
+ KAction *propertiesAction;
+};
+}
+#endif
diff --git a/kaboodle/view.cpp b/kaboodle/view.cpp
new file mode 100644
index 00000000..3ddf3621
--- /dev/null
+++ b/kaboodle/view.cpp
@@ -0,0 +1,323 @@
+/*****************************************************************
+
+Copyright (c) 2000-2001 the noatun authors. See file AUTHORS.
+
+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
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIAB\ILITY, 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.
+
+******************************************************************/
+
+#include <kapplication.h>
+#include <kcmdlineargs.h>
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kdialog.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kvideowidget.h>
+#include <qdragobject.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qtoolbutton.h>
+#include <qtooltip.h>
+#include <qwidget.h>
+#include <qvbox.h>
+
+#include "view.h"
+#include "player.h"
+
+namespace
+{
+QButton *createButton(const QIconSet &_iconset, const QString &_tip, QObject *_receiver, const char *_slot, QWidget *_parent)
+{
+ QToolButton *button = new QToolButton(_parent);
+ button->setMaximumSize(50, 50);
+ button->setIconSet(_iconset);
+ QToolTip::add(button, _tip);
+ QObject::connect(button, SIGNAL(clicked()), _receiver, _slot);
+ button->show();
+ return button;
+}
+}
+
+Kaboodle::View::View(QWidget *parent, const char *name, Player *p)
+ : KMediaPlayer::View(parent, name)
+ , state((KMediaPlayer::Player::State)p->state())
+ , autoPlay(false)
+ , quitAfterPlaying(false)
+ , player(p)
+ , firstVideo(false)
+ , lastWidth(0)
+{
+ (new QHBoxLayout(this))->setAutoAdd(true);
+ QVBox *box = new QVBox(this);
+ box->setSpacing(KDialog::spacingHint());
+ box->setMargin(0);
+
+ video = new KVideoWidget(player, box);
+ video->actionCollection()->readShortcutSettings();
+ setVideoWidget(video);
+ connect(video, SIGNAL(adaptSize(int, int)), this, SLOT(calculateSize(int, int)));
+ connect(video, SIGNAL(mouseButtonPressed(int, const QPoint&, int)), this, SLOT(slotButtonPressed(int, const QPoint &, int) ) ) ;
+ connect(video, SIGNAL(mouseButtonDoubleClick(const QPoint&, int)), this, SLOT(slotDblClick(const QPoint &, int) ) ) ;
+
+ QWidget *sliderBox = new QWidget(box);
+ sliderBox->setFocusPolicy(QWidget::ClickFocus);
+ sliderBox->setAcceptDrops(true);
+
+ QHBoxLayout *layout = new QHBoxLayout(sliderBox);
+ layout->setSpacing(KDialog::spacingHint());
+ layout->setMargin(0);
+ layout->setAutoAdd(true);
+
+ playButton = createButton(BarIconSet("1rightarrow"), i18n("Play"), player, SLOT(play()), sliderBox);
+ pauseButton = createButton(BarIconSet("player_pause"), i18n("Pause"), player, SLOT(pause()), sliderBox);
+ stopButton = createButton(BarIconSet("player_stop"), i18n("Stop"), player, SLOT(stop()), sliderBox);
+
+ slider = new L33tSlider(0, 1000, 10, 0, L33tSlider::Horizontal, sliderBox);
+ slider->setTickmarks(QSlider::NoMarks);
+ slider->show();
+
+ elapsedLabel = new QLabel(sliderBox);
+ QFont labelFont = elapsedLabel->font();
+ labelFont.setPointSize(24);
+ labelFont.setBold(true);
+ QFontMetrics labelFontMetrics(labelFont);
+ elapsedLabel->setFont(labelFont);
+ elapsedLabel->setAlignment(AlignCenter | AlignVCenter | ExpandTabs);
+ elapsedLabel->setFixedHeight(labelFontMetrics.height());
+ elapsedLabel->setMinimumWidth(labelFontMetrics.width("00:00"));
+
+ connect(player, SIGNAL(stateChanged(int)), this, SLOT(stateChanged(int)));
+ connect(player, SIGNAL(completed()), this, SLOT(playerFinished()));
+ connect(player, SIGNAL(timeout()), this, SLOT(playerTimeout()));
+
+ connect(slider, SIGNAL(userChanged(int)), this, SLOT(skipToWrapper(int)));
+ connect(slider, SIGNAL(sliderMoved(int)), this, SLOT(sliderMoved(int)));
+ slider->setEnabled(false);
+
+ connect(this, SIGNAL(buttonsChanged(int)), this, SLOT(updateButtons(int)));
+ updateButtons(buttons());
+
+ updateLabel("--:--/--:--");
+
+ video->setMinimumHeight(0);
+}
+
+Kaboodle::View::~View(void)
+{
+ embed(Arts::PlayObject::null());
+}
+
+void Kaboodle::View::stateChanged(int s)
+{
+ KMediaPlayer::Player::State oldState = state;
+ state = (KMediaPlayer::Player::State)s;
+
+ switch(state)
+ {
+ case KMediaPlayer::Player::Play:
+ stopButton->setEnabled(true);
+ playButton->setEnabled(false);
+ pauseButton->setEnabled(true);
+ break;
+
+ case KMediaPlayer::Player::Empty:
+ slider->setEnabled(false);
+ slider->setValue(0);
+ updateLabel("--:--");
+ stopButton->setEnabled(false);
+ playButton->setEnabled(false);
+ pauseButton->setEnabled(false);
+ break;
+
+ case KMediaPlayer::Player::Stop:
+ slider->setEnabled(false);
+ slider->setValue(0);
+ updateLabel("00:00");
+ stopButton->setEnabled(false);
+ playButton->setEnabled(true);
+ pauseButton->setEnabled(false);
+
+ // loaded
+ if(oldState == KMediaPlayer::Player::Empty)
+ {
+ firstVideo = true;
+ if(autoPlay) player->play();
+ }
+
+ break;
+
+ case KMediaPlayer::Player::Pause:
+ slider->setEnabled(player->isSeekable());
+ stopButton->setEnabled(true);
+ playButton->setEnabled(true);
+ pauseButton->setEnabled(false);
+ break;
+ }
+}
+
+void Kaboodle::View::playerFinished()
+{
+ if(quitAfterPlaying) kapp->quit();
+}
+
+void Kaboodle::View::playerTimeout()
+{
+ if(player->currentURL().isEmpty())
+ return;
+
+ if(slider->currentlyPressed())
+ return;
+
+ updateTicks();
+
+ if(firstVideo)
+ {
+ if(!lastWidth)
+ {
+ video->setNormalSize();
+ }
+ else
+ {
+ firstVideo = false;
+ lastWidth = 0;
+ }
+ }
+
+ if(player->isSeekable())
+ {
+ slider->setEnabled(true);
+ slider->setValue((int)(player->position() / 1000));
+ }
+
+ updateLabel( player->positionString() );
+}
+
+void Kaboodle::View::updateTicks(void)
+{
+ if(player->hasLength())
+ {
+ int range = (int)(player->length() / 1000);
+ slider->setRange(0, range);
+ }
+ else
+ {
+ slider->setRange(0, 1);
+ }
+}
+
+void Kaboodle::View::sliderMoved(int seconds)
+{
+ if(!player->currentURL().isEmpty())
+ updateLabel(Player::timeString(seconds*1000));
+}
+
+void Kaboodle::View::skipToWrapper(int second)
+{
+ player->seek((unsigned long)(second*1000));
+}
+
+void Kaboodle::View::updateLabel(const QString &text)
+{
+ if(elapsedLabel)
+ elapsedLabel->setText(text.left(5));
+}
+
+void Kaboodle::View::calculateSize(int newWidth, int newHeight)
+{
+ lastWidth = newWidth;
+ int extraWidth = width() - video->width();
+ int extraHeight = height() - video->height();
+ newWidth += extraWidth;
+ newHeight += extraHeight;
+ emit adaptSize(newWidth, newHeight);
+}
+
+bool Kaboodle::View::isAutoPlay()
+{
+ return autoPlay;
+}
+
+void Kaboodle::View::setAutoPlay(bool b)
+{
+ autoPlay = b;
+}
+
+bool Kaboodle::View::isQuitAfterPlaying()
+{
+ return quitAfterPlaying;
+}
+
+void Kaboodle::View::setQuitAfterPlaying(bool b)
+{
+ quitAfterPlaying = b;
+}
+
+void Kaboodle::View::embed(Arts::PlayObject object)
+{
+ video->embed(Arts::DynamicCast(object));
+}
+
+void Kaboodle::View::updateButtons(int b)
+{
+ if(b & Play)
+ playButton->show();
+ else
+ playButton->hide();
+
+ if(b & Pause)
+ pauseButton->show();
+ else
+ pauseButton->hide();
+
+ if(b & Stop)
+ stopButton->show();
+ else
+ stopButton->hide();
+
+ if(b & Seeker)
+ {
+ slider->show();
+ elapsedLabel->show();
+ }
+ else
+ {
+ slider->hide();
+ elapsedLabel->hide();
+ }
+
+}
+
+void Kaboodle::View::slotButtonPressed(int /*type*/, const QPoint &, int /* state */)
+{
+ if((KMediaPlayer::Player::State)player->state() == KMediaPlayer::Player::Pause )
+ player->play();
+ else player->pause();
+}
+
+void Kaboodle::View::slotDblClick( const QPoint &, int /* state */)
+{
+ if ( video->isFullscreen() )
+ video->setWindowed();
+ else video->setFullscreen();
+
+ player->play(); // play() is called because the video is stopped when double-clicking ( slotButtonPressed is called )
+}
+
+#include "view.moc"
diff --git a/kaboodle/view.h b/kaboodle/view.h
new file mode 100644
index 00000000..f21de905
--- /dev/null
+++ b/kaboodle/view.h
@@ -0,0 +1,104 @@
+/*****************************************************************
+
+Copyright (c) 2000-2001 the noatun authors. See file AUTHORS.
+
+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
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIAB\ILITY, 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.
+
+******************************************************************/
+
+#ifndef KABOODLEVIEW_H
+#define KABOODLEVIEW_H
+
+#include <kmediaplayer/player.h>
+#include <kmediaplayer/view.h>
+#include <kurl.h>
+#include <qevent.h>
+#include <qhbox.h>
+#include <qlayout.h>
+#include <qlcdnumber.h>
+#include <qwidget.h>
+
+#include "controls.h"
+#include "player.h"
+
+class QButton;
+class QLabel;
+class KVideoWidget;
+
+namespace Kaboodle
+{
+class View : public KMediaPlayer::View
+{
+Q_OBJECT
+
+public:
+ View(QWidget *parent, const char *name, Player *player);
+ virtual ~View(void);
+
+ /**
+ * automatically play a file after opening it
+ */
+ bool isAutoPlay(void);
+ void setAutoPlay(bool);
+
+ /**
+ * if we opened a file on the command line, quit after playing it
+ */
+ bool isQuitAfterPlaying(void);
+ void setQuitAfterPlaying(bool);
+
+ void embed(Arts::PlayObject);
+ KVideoWidget *videoWidget() { return video; }
+
+public slots:
+ void stateChanged(int);
+ void updateButtons(int);
+ void playerFinished(void);
+ void playerTimeout(void);
+
+ void sliderMoved(int);
+ void skipToWrapper(int);
+
+signals:
+ void adaptSize(int width, int height);
+
+private slots:
+ void updateLabel(const QString &text);
+ void slotButtonPressed( int, const QPoint &, int state );
+ void slotDblClick( const QPoint &, int state );
+
+ void calculateSize(int width, int height);
+
+private:
+ KMediaPlayer::Player::State state;
+ bool autoPlay, quitAfterPlaying;
+ Player *player;
+
+ void updateTicks(void);
+
+ L33tSlider *slider;
+ QLabel *elapsedLabel;
+ KVideoWidget *video;
+ bool firstVideo;
+
+ int lastWidth;
+
+ QButton *playButton, *pauseButton, *stopButton;
+};
+}
+#endif