File kdemm.diff of Package knights
--- knights/audio.cpp
+++ knights/audio.cpp 2005/08/30 15:20:48
@@ -16,10 +16,7 @@
***************************************************************************/
#include "audio.h"
-#include <arts/soundserver.h>
-#include <arts/dispatcher.h>
-#include <arts/flowsystem.h>
-#include <arts/connect.h>
+#include <kdemm/simpleplayer.h>
#include <ksimpleconfig.h>
#include <kio/netaccess.h>
#include <qptrlist.h>
@@ -29,22 +26,19 @@
class audioPrivate
{
public:
- bool enabled;
- bool firstTime;
- QString theme;
- Arts::Dispatcher dispatcher;
- Arts::SoundServerV2 server;
- Arts::PlayObjectFactory playObjectFactory;
- QMap<int, Arts::PlayObject> audioMap;
- QPtrList<KTempFile> fileRef;
+ bool enabled;
+ bool firstTime;
+ QString theme;
+ KDE::Multimedia::SimplePlayer* player;
+ QPtrList<KTempFile> fileRef;
};
audio::audio()
{
a = new audioPrivate;
- a->server = Arts::Reference("global:Arts_SoundServerV2");
+ a->player = new KDE::Multimedia::SimplePlayer();
a->fileRef.setAutoDelete( TRUE );
- if( a->server.isNull() )
+ if( ! a->player )
{
a->enabled = FALSE;
kdWarning() << "audio::audio: Can not create Arts::SoundServerV2" << endl;
@@ -52,14 +46,13 @@
else
{
a->enabled = TRUE;
- a->playObjectFactory = Arts::Reference("global:Arts_PlayObjectFactory");
}
a->firstTime = TRUE;
}
audio::~audio()
{
- a->audioMap.clear();
a->fileRef.clear();
+ delete a->player;
delete a;
}
void audio::play( const int snd )
@@ -67,39 +60,11 @@
if( a->firstTime || !enabled || !a->enabled )
return;
- QMap<int, Arts::PlayObject>::Iterator IT = a->audioMap.find( snd );
-
- if( IT == a->audioMap.end() )
- {
- return;
- }
-
- Arts::PlayObject* current = &IT.data();
-
- if( volume )
+ if ( a->fileRef.at(snd) && 100-volume )
{
- Arts::Synth_BUS_UPLINK uplink = Arts::DynamicCast( current->_getChild( "uplink" ) );
- uplink.stop();
- current->_node()->stop();
- Arts::disconnect( *current, "left", uplink, "left" );
- Arts::disconnect( *current, "right", uplink, "right" );
- Arts::StereoVolumeControl volumeControl = Arts::DynamicCast( a->server.createObject( "Arts::StereoVolumeControl" ) );
- current->_addChild( volumeControl, "volume" );
- uplink.start();
- volumeControl.start();
- current->_node()->start();
- Arts::connect( *current, "left", volumeControl, "inleft" );
- Arts::connect( *current, "right", volumeControl, "inright" );
- Arts::connect( volumeControl, "outleft", uplink, "left" );
- Arts::connect( volumeControl, "outright", uplink, "right" );
- volumeControl.scaleFactor( ( 100 - volume ) / 100.0 );
+ a->player->setVolume( ((float)(100-volume))/100 );
+ a->player->play( a->fileRef.at(snd)->name() );
}
-
- Arts::poTime time = current->currentTime();
- time.seconds = 0;
- time.ms = 0;
- current->seek( time );
- current->play();
}
void audio::setTheme( const QString &newTheme )
@@ -110,7 +75,6 @@
if( !enabled || !a->enabled )
return;
- a->audioMap.clear();
a->fileRef.clear();
if( !KIO::NetAccess::download( newTheme + "theme.conf" , configFile ) )
@@ -149,7 +113,6 @@
}
void audio::prepFile( const QString &source, const int &ref )
{
- Arts::PlayObject player;
KTempFile *dest;
QString filename;
if( source.isEmpty() )
@@ -165,13 +128,6 @@
delete dest;
return;
}
- player = a->playObjectFactory.createPlayObject( QFile::encodeName( dest->name() ).data() );
- if( player.isNull() )
- {
- delete dest;
- return;
- }
a->fileRef.append( dest );
- a->audioMap[ ref ] = player;
return;
}
--- knights/Makefile.am
+++ knights/Makefile.am 2005/08/30 14:45:27
@@ -4,7 +4,7 @@
## INCLUDES were found outside kdevelop specific part
knights_SOURCES = board_2d.cpp board_base.cpp setpagedisplay.cpp proto_xboard.cpp dlg_selectengine.cpp thinbuttons.cpp pgn.cpp io_engine.cpp dlg_challenge.cpp idmanager.cpp challenge_graph.cpp dlg_login.cpp tabgrip.cpp tabpage.cpp tab_seeklist.cpp dlg_engine.cpp setpageaudio.cpp proto_base.cpp dlg_server.cpp core.cpp match_param.cpp knightspixcache.cpp dlg_settings.cpp console.cpp match.cpp setpagegeneral.cpp splash.cpp audio.cpp main.cpp logic.cpp list_pgn.cpp challenge_graph_view.cpp accel.cpp dlg_selectemail.cpp challenge_rectangle.cpp knightstextview.cpp tabmanager.cpp command.cpp dlg_newmatch.cpp chessclock.cpp dlg_promote.cpp resource.cpp tabbox.cpp io_internet.cpp challenge_game.cpp knights.cpp tab_pgnview.cpp io_base.cpp wiz_setup.cpp setpageservers.cpp proto_uci.cpp setpageengines.cpp
-knights_LDADD = -lqt-mt -lartskde -lkio -lkdeprint -lkdeui -lkdecore $(LIBSOCKET)
+knights_LDADD = -lqt-mt -lkdemm -lkio -lkdeprint -lkdeui -lkdecore $(LIBSOCKET)
EXTRA_DIST = setpageengines.cpp proto_uci.cpp setpageservers.cpp wiz_setup.cpp setpageengines.h io_base.cpp knightsmap.h tab_pgnview.cpp knights.cpp challenge_game.cpp io_internet.cpp challenge_graph_view.h resource.h tabbox.cpp resource.cpp dlg_promote.cpp dlg_server.h pgn.h chessclock.cpp dlg_newmatch.cpp command.h io_internet.h challenge_rectangle.h command.cpp tabmanager.cpp dlg_promote.h definitions.h knightstextview.cpp challenge_rectangle.cpp dlg_selectemail.cpp splash.h list_pgn.h accel.cpp tabmanager.h match.h setpagedisplay.h challenge_graph_view.cpp list_pgn.cpp logic.h logic.cpp knightstextview.h main.cpp audio.cpp splash.cpp setpagegeneral.cpp match.cpp io_base.h console.h idmanager.h dlg_selectemail.h console.cpp tab_pgnview.h knights.h dlg_settings.cpp core.h knightspixcache.cpp thinbuttons.h dlg_settings.h setpageservers.h tab_seeklist.h match_param.cpp core.cpp match_param.h dlg_server.cpp pgn.desktop tabbox.h accel.h io_engine.h proto_base.cpp setpageaudio.cpp dlg_engine.cpp tab_seeklist.cpp tabpage.cpp challenge_graph.h tabgrip.cpp dlg_login.cpp challenge_graph.cpp proto_uci.h setpageaudio.h proto_base.h chessclock.h setpagegeneral.h idmanager.cpp dlg_challenge.cpp io_engine.cpp audio.h dlg_newmatch.h pgn.cpp dlg_engine.h thinbuttons.cpp wiz_setup.h dlg_selectengine.cpp challenge_game.h proto_xboard.cpp knightspixcache.h setpagedisplay.cpp tabgrip.h knights.desktop dlg_login.h proto_xboard.h dlg_challenge.h dlg_selectengine.h tabpage.h board_base.cpp board_base.h board_2d.cpp board_2d.h Makefile.am