engine/src/PodcastModel.cpp
changeset 66 41d00e97e2f7
parent 63 a8538f50e2ba
child 76 223f270fa7ff
--- a/engine/src/PodcastModel.cpp	Thu Apr 01 11:39:23 2010 +0200
+++ b/engine/src/PodcastModel.cpp	Thu Apr 01 11:41:33 2010 +0200
@@ -19,7 +19,6 @@
 #include <commdb.h>
 #include "PodcastModel.h"
 #include "FeedEngine.h"
-#include "SoundEngine.h"
 #include "SettingsEngine.h"
 #include "ShowEngine.h"
 #include "connectionengine.h"
@@ -45,7 +44,6 @@
 {
 	
 	delete iFeedEngine;
-	delete iSoundEngine;
 	delete iSettingsEngine;
 	delete iShowEngine;
 
@@ -89,7 +87,6 @@
 	iFeedEngine = CFeedEngine::NewL(*this);
 	iShowEngine = CShowEngine::NewL(*this);
 
-	iSoundEngine = CSoundEngine::NewL(*this);	
 	DP("CPodcastModel::ConstructL END");
 }
 
@@ -199,11 +196,6 @@
 	return *iShowEngine;
 }
 
-EXPORT_C CSoundEngine& CPodcastModel::SoundEngine()
-{
-	return *iSoundEngine;
-}
-
 EXPORT_C CSettingsEngine& CPodcastModel::SettingsEngine()
 {
 	return *iSettingsEngine;
@@ -216,40 +208,8 @@
 
 EXPORT_C void CPodcastModel::PlayPausePodcastL(CShowInfo* aPodcast, TBool aPlayOnInit) 
 	{
-	
-	// special treatment if this podcast is already active
-	if (iPlayingPodcast->Uid() == aPodcast->Uid() && SoundEngine().State() > ESoundEngineOpening ) {
-		if (aPodcast->PlayState() == EPlaying) {
-			SoundEngine().Pause();
-			aPodcast->SetPosition(iSoundEngine->Position());
-			aPodcast->SetPlayState(EPlayed);
-			aPodcast->SetPlayState(EPlayed);
-		} else {
-			iSoundEngine->Play();
-		}
-	} else {
-		// switching file, so save position
-		iSoundEngine->Pause();
-		if (iPlayingPodcast != NULL) {
-			iPlayingPodcast->SetPosition(iSoundEngine->Position());
-		}
-		
-		iSoundEngine->Stop(EFalse);
-
-		// we play video podcasts through the external player
-		if(aPodcast != NULL && aPodcast->ShowType() != EVideoPodcast) {
-			DP1("Starting: %S", &(aPodcast->FileName()));
-			TRAPD( error, iSoundEngine->OpenFileL(aPodcast->FileName(), aPlayOnInit) );
-			if (error != KErrNone) {
-				DP1("Error: %d", error);
-			} else {
-				iSoundEngine->SetPosition(aPodcast->Position().Int64() / 1000000);
-			}
-		}
-
-		iPlayingPodcast = aPodcast;		
+	// TODO: interact with MPX
 	}
-}
 
 EXPORT_C CFeedInfo* CPodcastModel::ActiveFeedInfo()
 {
@@ -279,6 +239,7 @@
 
 sqlite3* CPodcastModel::DB()
 {
+	DP("CPodcastModel::DB BEGIN");
 	if (iDB == NULL) {		
 		TFileName dbFileName;
 		dbFileName.Copy(iSettingsEngine->PrivatePath());
@@ -298,7 +259,8 @@
 		
 		TBuf8<KMaxFileName> filename8;
 		filename8.Copy(dbFileName);
-		int rc = rc = sqlite3_open((const char*) filename8.PtrZ(), &iDB);
+		DP("Before sqlite3_open");
+		int rc = sqlite3_open((const char*) filename8.PtrZ(), &iDB);
 		if( rc != SQLITE_OK){
 			DP("Error loading DB");
 			User::Panic(_L("Podcatcher"), 10);
@@ -306,6 +268,7 @@
 
 
 	}
+	DP("CPodcastModel::DB END");
 	return iDB;
 }
 
@@ -410,12 +373,12 @@
 	iShowEngine->GetShowsByFeedL(iActiveShowList, aFeedUid);
 	}
 
-EXPORT_C void CPodcastModel::MarkSelectionPlayed()
+EXPORT_C void CPodcastModel::MarkSelectionPlayedL()
 	{
 	for (int i=0;i<iActiveShowList.Count();i++) {
 		if(iActiveShowList[i]->PlayState() != EPlayed) {
 			iActiveShowList[i]->SetPlayState(EPlayed);
-			iShowEngine->UpdateShow(*iActiveShowList[i]);
+			iShowEngine->UpdateShowL(*iActiveShowList[i]);
 		}
 	}
 	}