-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
106 changed files
with
12,796 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
cvs | ||
*.obj | ||
*.~* | ||
*.sxw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#ifndef _GLOBAL__HEADERS_ | ||
#define _GLOBAL__HEADERS_ | ||
|
||
// STL C++ | ||
|
||
#include <vector> | ||
#include <algorith> | ||
#include <memory> | ||
#include <fstream> | ||
#include <string> | ||
#include <map> | ||
#include <utility> | ||
|
||
// Windows SDK | ||
|
||
#include <wtypes.h> | ||
#include <winbase.h> | ||
|
||
// Borland VCL | ||
|
||
#include <vcl/sysdefs.h> | ||
#include <vcl/system.hpp> | ||
#include <vcl/windows.hpp> | ||
#include <vcl/messages.hpp> | ||
#include <vcl/sysutils.hpp> | ||
#include <vcl/classes.hpp> | ||
#include <vcl/graphics.hpp> | ||
#include <vcl/controls.hpp> | ||
#include <vcl/forms.hpp> | ||
#include <vcl/stdctrls.hpp> | ||
#include <vcl/extctrls.hpp> | ||
#include <vcl/registry.hpp> | ||
#include <vcl/masks.hpp> | ||
#include <shlobj.h> | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
//--------------------------------------------------------------------------- | ||
#include <vcl.h> | ||
#include <iostream.h> | ||
#pragma hdrstop | ||
#include "ConcreteImportExportFacade.h" | ||
#include "TagImpEx.h" | ||
#include "../Song/SongTag.h" | ||
#include "../lib/extlib.h" | ||
//--------------------------------------------------------------------------- | ||
void PrintIfNotNull(const string &a_description, const string &a_data) | ||
{ | ||
if(a_data == "") | ||
return; | ||
|
||
cout << a_description << ": " << a_data << "\n"; | ||
} | ||
#pragma argsused | ||
int main(int argc, char* argv[]) | ||
{ | ||
ImportExportFacade *cief = 0; | ||
SongTag *st = new SongTag(); | ||
|
||
try { | ||
cief = new ConcreteImportExportFacade(); | ||
const TagImpEx *tie = cief->createTagImpEx("ID3"); | ||
|
||
AnsiString filename = "E:\\MP3\\Men in Black.mp3"; | ||
|
||
try { | ||
tie->importTag(filename, st); | ||
} | ||
catch(EAbort &) { cout << "Eabort\n"; } | ||
|
||
PrintIfNotNull("artist", st->getLeadArtist()); | ||
PrintIfNotNull("ursprunglig artist", st->getOriginalArtists()); | ||
PrintIfNotNull("band", st->getBand()); | ||
PrintIfNotNull("titel", st->getTitle()); | ||
PrintIfNotNull("undertitel", st->getSubtitle()); | ||
PrintIfNotNull("album", st->getAlbum()); | ||
PrintIfNotNull("ursprungligt album", st->getOriginalAlbum()); | ||
PrintIfNotNull("spårnr", st->getTrackNo()); | ||
PrintIfNotNull("inspelad", st->getRecordingTime()); | ||
PrintIfNotNull("ursprungligen utgiven", st->getOriginalReleaseTime()); | ||
PrintIfNotNull("kompositör", st->getComposer()); | ||
PrintIfNotNull("textförfattare", st->getLyricist()); | ||
PrintIfNotNull("ursprunglig textförfattare", st->getOriginalLyricist()); | ||
PrintIfNotNull("tolkare", st->getInterpreter()); | ||
PrintIfNotNull("label", st->getPublisher()); | ||
PrintIfNotNull("genre", st->getContentType()); | ||
PrintIfNotNull("situation", st->getSituation()); | ||
PrintIfNotNull("tempo", st->getTempo()); | ||
PrintIfNotNull("humör", st->getMood()); | ||
PrintIfNotNull("kodad av", st->getEncoder()); | ||
PrintIfNotNull("kommentar", st->getComment()); | ||
PrintIfNotNull("språk", st->getLanguages()); | ||
PrintIfNotNull("tonart", st->getKey()); | ||
PrintIfNotNull("sångtext", st->getLyrics()); | ||
PrintIfNotNull("betyg", string(IntToStr(st->getRating()).c_str())); | ||
|
||
tie->exportTag(filename, *st); | ||
} | ||
catch(...) { | ||
cout << "oväntat undantag!\n"; | ||
} | ||
|
||
if(cief) | ||
delete cief; | ||
if(st) | ||
delete st; | ||
|
||
cout << "\nklart.\n"; | ||
Pause(); | ||
return 0; | ||
} | ||
//--------------------------------------------------------------------------- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
#include "../Headers.h" | ||
#pragma hdrstop | ||
|
||
#include "Mediator.h" | ||
#include "../Player/PlayerFacade.h" | ||
#include "../ImportExport/ImportExportFacade.h" | ||
#include "../ImportExport/TagImpEx.h" | ||
#include "../Playlist/PlaylistFacade.h" | ||
#include "../Song/SongFacade.h" | ||
#include "../Song/SongProperty.h" | ||
#include "../Database/DatabaseEngine.h" | ||
#include "../Exceptions.h" | ||
#include "../Constants.h" | ||
|
||
using namespace std; | ||
|
||
Mediator::Mediator() | ||
{ | ||
m_pImportexportfacade = 0; | ||
m_pPlayerfacade = 0; | ||
m_pPlaylistfacade = 0; | ||
m_pSongfacade = 0; | ||
m_pDatabaseengine = 0; | ||
} | ||
|
||
void Mediator::playSongs(vector<string> a_songfilenames) const | ||
{ | ||
if(m_pPlayerfacade == 0) | ||
throw Exception("Mediator::playSongs"); | ||
|
||
m_pPlayerfacade->playMultiple(a_songfilenames); | ||
} | ||
|
||
void Mediator::getSongProperties(int a_song, SongProperty *a_property) const | ||
{ | ||
if(m_pSongfacade == 0) | ||
throw Exception("Mediator::getSongProperties"); | ||
|
||
m_pSongfacade->getSongProperties(a_song, a_property); | ||
} | ||
|
||
intvector Mediator::getSongsMatchingProperties(const SongProperty &a_properties) const | ||
{ | ||
if(m_pSongfacade == 0) | ||
throw Exception("Mediator::getSongProperties"); | ||
|
||
return m_pSongfacade->getSongsMatchingProperties(a_properties); | ||
} | ||
|
||
void Mediator::removeSongFromPlaylists(int a_song) const | ||
{ | ||
// if(m_pPlaylistfacade == 0) | ||
// throw Exception("Mediator::removeSongFromPlaylists"); | ||
// | ||
// m_pPlaylistfacade->removeSongFromAllPlaylists(a_song); | ||
} | ||
|
||
AnsiString Mediator::getPlayedFilename() const | ||
{ | ||
if(m_pPlayerfacade == 0) | ||
throw Exception("Mediator::getPlayedFilename"); | ||
|
||
return m_pPlayerfacade->getPlayedFile(); | ||
} | ||
|
||
void Mediator::saveAndStop() const | ||
{ | ||
if(m_pPlayerfacade == 0) | ||
throw Exception("Mediator::saveAndStop"); | ||
|
||
m_pPlayerfacade->saveAndStop(); | ||
} | ||
|
||
void Mediator::resumePlay() const | ||
{ | ||
if(m_pPlayerfacade == 0) | ||
throw Exception("Mediator::resumePlay"); | ||
|
||
m_pPlayerfacade->resumePlay(); | ||
} | ||
|
||
const TagImpEx *Mediator::createTagImpEx(AnsiString a_tagtype) const | ||
{ | ||
if(m_pImportexportfacade == 0) | ||
throw Exception("Mediator::createTagImpEx"); | ||
|
||
return m_pImportexportfacade->createTagImpEx(a_tagtype); | ||
} | ||
|
||
vector<SongProperty> Mediator::getSongsFromDatabase() const | ||
{ | ||
if(m_pDatabaseengine == 0) | ||
throw Exception("Mediator::getSongsFromDatabase"); | ||
|
||
return m_pDatabaseengine->getSongs(); | ||
} | ||
|
||
void Mediator::updateSongDatabase(int a_song, const SongProperty &a_properties) const | ||
{ | ||
if(m_pDatabaseengine == 0) | ||
throw Exception("Mediator::updateSongDatabase"); | ||
|
||
m_pDatabaseengine->updateSong(a_song, a_properties); | ||
} | ||
|
||
void Mediator::updateSongDatabase(vector<SongProperty> a_songs) const | ||
{ | ||
if(m_pDatabaseengine == 0) | ||
throw Exception("Mediator::updateSongDatabase"); | ||
|
||
m_pDatabaseengine->updateSongs(a_songs); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#ifndef MEDIATOR_HEADER_BLAHBLAH | ||
#define MEDIATOR_HEADER_BLAHBLAH | ||
|
||
#include "MediatorInterface.h" | ||
#include "../Constants.h" | ||
|
||
class ImportExportFacade; | ||
class PlayerFacade; | ||
class PlaylistFacade; | ||
class SongFacade; | ||
class DatabaseEngine; | ||
|
||
// Som en 'eter' mellan fasaderna för kontrollerad kommunikation | ||
|
||
class Mediator : public MediatorInterface | ||
{ | ||
public: | ||
// virtual ~Mediator(); | ||
Mediator(); | ||
|
||
virtual void playSongs(stringvector) const; // Playlist/Song -> Player | ||
virtual void getSongProperties(int, SongProperty *) const; // Playlist -> Song | ||
virtual intvector getSongsMatchingProperties(const SongProperty &) const; // Playlist -> Song | ||
|
||
virtual void removeSongFromPlaylists(int) const; // Song -> Playlist | ||
virtual AnsiString getPlayedFilename() const; // Song -> Player | ||
virtual void saveAndStop() const; // Song -> Player | ||
virtual void resumePlay() const; // Song -> Player | ||
virtual const TagImpEx *createTagImpEx(AnsiString) const; // Song -> ImportExport | ||
virtual vector<SongProperty> getSongsFromDatabase() const; // Song -> Database | ||
virtual void updateSongDatabase(int, const SongProperty &) const; | ||
virtual void updateSongDatabase(vector<SongProperty>) const; | ||
|
||
void setImportExportFacade(ImportExportFacade *const a) { m_pImportexportfacade = a; } | ||
void setPlayerFacade(PlayerFacade *const a) { m_pPlayerfacade = a; } | ||
void setPlaylistFacade(PlaylistFacade *const a) { m_pPlaylistfacade = a; } | ||
void setSongFacade(SongFacade *const a) { m_pSongfacade = a; } | ||
void setDatabaseEngine(DatabaseEngine *const a) { m_pDatabaseengine = a; } | ||
|
||
private: | ||
ImportExportFacade *m_pImportexportfacade; | ||
PlayerFacade *m_pPlayerfacade; | ||
PlaylistFacade *m_pPlaylistfacade; | ||
SongFacade *m_pSongfacade; | ||
DatabaseEngine *m_pDatabaseengine; | ||
}; | ||
|
||
#endif |
Oops, something went wrong.