mirror of
https://github.com/clangen/musikcube.git
synced 2025-03-14 04:18:36 +00:00
Added library labs for multiple libraries.
Upgraded to SQLite 3.6.1
This commit is contained in:
parent
b4b0aaaa7d
commit
25dfdd942d
1316
src/3rdparty/include/sqlite/sqlite3.h
vendored
1316
src/3rdparty/include/sqlite/sqlite3.h
vendored
File diff suppressed because it is too large
Load Diff
5104
src/3rdparty/src/sqlite/sqlite3.c
vendored
5104
src/3rdparty/src/sqlite/sqlite3.c
vendored
File diff suppressed because it is too large
Load Diff
@ -37,6 +37,7 @@
|
||||
#include "pch.hpp"
|
||||
|
||||
#include <core/Library/Base.h>
|
||||
#include <core/tracklist/Standard.h>
|
||||
|
||||
#include <core/config_filesystem.h>
|
||||
#include <core/Query/Base.h>
|
||||
@ -46,7 +47,17 @@
|
||||
|
||||
using namespace musik::core;
|
||||
|
||||
Library::Base::Base(void) : identifier(UTF("local")), queueCallbackStarted(false), bCurrentQueryCanceled(false), exit(false){
|
||||
Library::Base::Base(utfstring identifier)
|
||||
:identifier(identifier)
|
||||
,queueCallbackStarted(false)
|
||||
,bCurrentQueryCanceled(false)
|
||||
,exit(false)
|
||||
,nowPlaying(new musik::core::tracklist::Standard())
|
||||
{
|
||||
}
|
||||
|
||||
musik::core::tracklist::Ptr Library::Base::NowPlaying(){
|
||||
return this->nowPlaying;
|
||||
}
|
||||
|
||||
Library::Base::~Base(void){
|
||||
@ -54,6 +65,10 @@ Library::Base::~Base(void){
|
||||
this->threads.join_all();
|
||||
}
|
||||
|
||||
const utfstring& Library::Base::Identifier(){
|
||||
return this->identifier;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Get the directory-location of the library where you may store extra files.
|
||||
|
@ -36,18 +36,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define INCLUDE_BOOSTFS
|
||||
#include <core/config.h>
|
||||
#include <core/db/Connection.h>
|
||||
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <boost/thread/condition.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
#include <sigslot/sigslot.h>
|
||||
#include <string>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace musik{ namespace core{
|
||||
@ -57,9 +46,26 @@ namespace musik{ namespace core{
|
||||
class Base;
|
||||
typedef boost::shared_ptr<musik::core::Query::Base> Ptr;
|
||||
}
|
||||
namespace Library{
|
||||
class Base;
|
||||
}
|
||||
typedef boost::shared_ptr<Library::Base> LibraryPtr;
|
||||
} }
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <core/config.h>
|
||||
#include <core/db/Connection.h>
|
||||
#include <core/tracklist/IRandomAccess.h>
|
||||
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <boost/thread/condition.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
#include <sigslot/sigslot.h>
|
||||
#include <string>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace musik{ namespace core{ namespace Library{
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -81,7 +87,7 @@ namespace musik{ namespace core{ namespace Library{
|
||||
//////////////////////////////////////////
|
||||
class Base : boost::noncopyable{
|
||||
public:
|
||||
Base(void);
|
||||
Base(utfstring identifier);
|
||||
virtual ~Base(void);
|
||||
|
||||
//////////////////////////////////////////
|
||||
@ -123,11 +129,15 @@ class Base : boost::noncopyable{
|
||||
|
||||
bool Exited();
|
||||
|
||||
const utfstring& Identifier();
|
||||
|
||||
musik::core::tracklist::Ptr NowPlaying();
|
||||
|
||||
|
||||
static bool IsStaticMetaKey(std::string &metakey);
|
||||
static bool IsSpecialMTOMetaKey(std::string &metakey);
|
||||
static bool IsSpecialMTMMetaKey(std::string &metakey);
|
||||
|
||||
|
||||
static void CreateDatabase(db::Connection &db);
|
||||
|
||||
protected:
|
||||
@ -248,6 +258,9 @@ class Base : boost::noncopyable{
|
||||
|
||||
bool exit;
|
||||
boost::condition waitCondition;
|
||||
|
||||
musik::core::tracklist::Ptr nowPlaying;
|
||||
|
||||
public:
|
||||
boost::mutex libraryMutex;
|
||||
|
||||
|
@ -53,7 +53,9 @@ using namespace musik::core;
|
||||
///\see
|
||||
///Startup
|
||||
//////////////////////////////////////////
|
||||
Library::LocalDB::LocalDB(void){
|
||||
Library::LocalDB::LocalDB(utfstring identifier)
|
||||
:Base(identifier)
|
||||
{
|
||||
}
|
||||
|
||||
Library::LocalDB::~LocalDB(void){
|
||||
|
@ -71,7 +71,7 @@ namespace musik{ namespace core{ namespace Library{
|
||||
class LocalDB : public Library::Base{
|
||||
public:
|
||||
// Methods:
|
||||
LocalDB(void);
|
||||
LocalDB(utfstring identifier);
|
||||
~LocalDB(void);
|
||||
|
||||
bool Startup();
|
||||
|
@ -57,8 +57,9 @@ using namespace musik::core;
|
||||
///\see
|
||||
///Startup
|
||||
//////////////////////////////////////////
|
||||
Library::Remote::Remote(void)
|
||||
:socket(ioService)
|
||||
Library::Remote::Remote(utfstring identifier)
|
||||
:Base(identifier)
|
||||
,socket(ioService)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ namespace musik{ namespace core{ namespace Library{
|
||||
class Remote : public Library::Base{
|
||||
public:
|
||||
// Methods:
|
||||
Remote(void);
|
||||
Remote(utfstring identifier);
|
||||
~Remote(void);
|
||||
|
||||
bool Startup();
|
||||
|
@ -36,35 +36,87 @@
|
||||
#include "pch.hpp"
|
||||
#include <core/LibraryFactory.h>
|
||||
#include <core/Library/LocalDB.h>
|
||||
#include <core/Library/Remote.h>
|
||||
#include <core/db/Connection.h>
|
||||
#include <core/Common.h>
|
||||
|
||||
using namespace musik::core;
|
||||
|
||||
LibraryFactory LibraryFactory::sInstance;
|
||||
|
||||
LibraryFactory::LibraryFactory(void) : currentPosition(0){
|
||||
// The first library should always be a localDB
|
||||
LibraryPtr localLibrary(new musik::core::Library::LocalDB());
|
||||
localLibrary->Startup();
|
||||
this->libraries.push_back(localLibrary);
|
||||
LibraryFactory::LibraryFactory(void){
|
||||
// Connect to the settings.db
|
||||
utfstring dataDir = GetDataDirectory();
|
||||
utfstring dbFile = GetDataDirectory() + UTF("settings.db");
|
||||
musik::core::db::Connection db;
|
||||
db.Open(dbFile.c_str(),0,128);
|
||||
|
||||
// Start by initializing the db
|
||||
db.Execute("CREATE TABLE IF NOT EXISTS libraries ("
|
||||
"id INTEGER PRIMARY KEY AUTOINCREMENT,"
|
||||
"name TEXT,"
|
||||
"type INTEGER DEFAULT 0)");
|
||||
db.Execute("CREATE UNIQUE INDEX IF NOT EXISTS library_index ON libraries (name)");
|
||||
|
||||
// Get the libraries
|
||||
db::Statement stmtGetLibs("SELECT name,type FROM libraries ORDER BY id",db);
|
||||
|
||||
while(stmtGetLibs.Step()==db::Row){
|
||||
this->AddLibrary( stmtGetLibs.ColumnTextUTF(0),stmtGetLibs.ColumnInt(1) );
|
||||
}
|
||||
|
||||
// If there are no libraries, add a LocalDB
|
||||
if(this->libraries.empty()){
|
||||
this->CreateLibrary(UTF("Local Library"),Types::LocalDB);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LibraryFactory::~LibraryFactory(void){
|
||||
}
|
||||
|
||||
void LibraryFactory::AddLibrary(utfstring name,int type){
|
||||
LibraryPtr lib;
|
||||
switch(type){
|
||||
case Types::Remote:
|
||||
lib.reset(new Library::Remote(name));
|
||||
break;
|
||||
default:
|
||||
lib.reset(new Library::LocalDB(name));
|
||||
}
|
||||
|
||||
LibraryPtr LibraryFactory::GetCurrentLibrary(){
|
||||
return Instance().GetLibrary(sInstance.currentPosition);
|
||||
if(lib){
|
||||
this->libraries.push_back(lib);
|
||||
|
||||
// Start the library
|
||||
lib->Startup();
|
||||
}
|
||||
}
|
||||
|
||||
LibraryFactory::LibraryChangeEvent& LibraryFactory::OnLibraryChange(){
|
||||
return Instance().OnLibraryChangeSignal;
|
||||
void LibraryFactory::RemoveLibrary(utfstring name){
|
||||
}
|
||||
|
||||
LibraryPtr LibraryFactory::GetLibrary(int position){
|
||||
if(position>=0 && position<this->libraries.size()){
|
||||
return this->libraries[position];
|
||||
}
|
||||
return LibraryPtr();
|
||||
bool LibraryFactory::CreateLibrary(utfstring name,int type){
|
||||
// Connect to the settings.db
|
||||
utfstring dataDir = GetDataDirectory();
|
||||
utfstring dbFile = GetDataDirectory() + UTF("settings.db");
|
||||
musik::core::db::Connection db;
|
||||
db.Open(dbFile.c_str(),0,128);
|
||||
|
||||
db::Statement stmtInsert("INSERT OR FAIL INTO libraries (name,type) VALUES (?,?)",db);
|
||||
stmtInsert.BindTextUTF(0,name);
|
||||
stmtInsert.BindInt(1,type);
|
||||
if(stmtInsert.Step()==db::Done){
|
||||
this->AddLibrary(name,type);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void LibraryFactory::DeleteLibrary(utfstring name){
|
||||
}
|
||||
|
||||
LibraryFactory::LibraryVector& LibraryFactory::Libraries(){
|
||||
return LibraryFactory::sInstance.libraries;
|
||||
}
|
||||
|
||||
|
@ -50,24 +50,28 @@ class LibraryFactory{
|
||||
static LibraryFactory sInstance;
|
||||
public:
|
||||
|
||||
typedef sigslot::signal1<LibraryPtr> LibraryChangeEvent;
|
||||
enum Types:int{
|
||||
LocalDB=1,
|
||||
Remote=2
|
||||
};
|
||||
|
||||
typedef std::vector<LibraryPtr> LibraryVector;
|
||||
|
||||
static LibraryFactory& Instance(){ return sInstance; };
|
||||
static LibraryPtr GetCurrentLibrary();
|
||||
static LibraryChangeEvent& OnLibraryChange();
|
||||
static LibraryVector& Libraries();
|
||||
|
||||
bool CreateLibrary(utfstring name,int type);
|
||||
void DeleteLibrary(utfstring name);
|
||||
|
||||
private:
|
||||
|
||||
sigslot::signal1<LibraryPtr> OnLibraryChangeSignal;
|
||||
LibraryPtr GetLibrary(int position);
|
||||
|
||||
std::vector<LibraryPtr> libraries;
|
||||
int currentPosition;
|
||||
LibraryVector libraries;
|
||||
|
||||
LibraryFactory(void);
|
||||
~LibraryFactory(void);
|
||||
|
||||
|
||||
void AddLibrary(utfstring name,int type);
|
||||
void RemoveLibrary(utfstring name);
|
||||
|
||||
};
|
||||
|
||||
|
@ -50,11 +50,10 @@ PlaybackQueue PlaybackQueue::sInstance;
|
||||
///
|
||||
///Will connect the appropiate signals in the transport
|
||||
//////////////////////////////////////////
|
||||
PlaybackQueue::PlaybackQueue(void) :
|
||||
nowPlaying( new musik::core::tracklist::Standard() ),
|
||||
signalDisabled(false),
|
||||
playing(false),
|
||||
paused(false)
|
||||
PlaybackQueue::PlaybackQueue(void)
|
||||
:signalDisabled(false)
|
||||
,playing(false)
|
||||
,paused(false)
|
||||
{
|
||||
this->transport.EventMixpointReached.connect(this,&PlaybackQueue::OnPlaybackEndOrFail);
|
||||
}
|
||||
@ -85,7 +84,7 @@ void PlaybackQueue::OnPlaybackEndOrFail(){
|
||||
///\brief
|
||||
///Return a shared_ptr to the now playing tracklist
|
||||
//////////////////////////////////////////
|
||||
tracklist::Standard::Ptr PlaybackQueue::NowPlayingTracklist(){
|
||||
tracklist::Ptr PlaybackQueue::NowPlayingTracklist(){
|
||||
return this->nowPlaying;
|
||||
}
|
||||
|
||||
@ -138,10 +137,12 @@ void PlaybackQueue::Resume()
|
||||
///Start playing the next track.
|
||||
//////////////////////////////////////////
|
||||
void PlaybackQueue::Next(){
|
||||
musik::core::TrackPtr track( this->nowPlaying->NextTrack() );
|
||||
if(this->nowPlaying){
|
||||
musik::core::TrackPtr track( this->nowPlaying->NextTrack() );
|
||||
|
||||
this->SetCurrentTrack(track);
|
||||
this->Play();
|
||||
this->SetCurrentTrack(track);
|
||||
this->Play();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
@ -149,11 +150,12 @@ void PlaybackQueue::Next(){
|
||||
///Start playing the previous track.
|
||||
//////////////////////////////////////////
|
||||
void PlaybackQueue::Previous(){
|
||||
musik::core::TrackPtr track( this->nowPlaying->PreviousTrack() );
|
||||
|
||||
this->SetCurrentTrack(track);
|
||||
this->Play();
|
||||
if(this->nowPlaying){
|
||||
musik::core::TrackPtr track( this->nowPlaying->PreviousTrack() );
|
||||
|
||||
this->SetCurrentTrack(track);
|
||||
this->Play();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
@ -174,16 +176,19 @@ void PlaybackQueue::Stop(){
|
||||
///Return the current running track
|
||||
//////////////////////////////////////////
|
||||
TrackPtr PlaybackQueue::CurrentTrack(){
|
||||
if (this->nowPlaying->Size() <= 0)
|
||||
{
|
||||
return TrackPtr();
|
||||
}
|
||||
if(this->nowPlaying){
|
||||
if (this->nowPlaying->Size() <= 0)
|
||||
{
|
||||
return TrackPtr();
|
||||
}
|
||||
|
||||
if(!this->currentTrack){
|
||||
// If the current track is empty, get a track from the nowPlaying tracklist
|
||||
this->SetCurrentTrack( this->nowPlaying->CurrentTrack() );
|
||||
}
|
||||
return this->currentTrack;
|
||||
if(!this->currentTrack){
|
||||
// If the current track is empty, get a track from the nowPlaying tracklist
|
||||
this->SetCurrentTrack( this->nowPlaying->CurrentTrack() );
|
||||
}
|
||||
return this->currentTrack;
|
||||
}
|
||||
return TrackPtr();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
@ -221,8 +226,12 @@ void PlaybackQueue::SetCurrentTrack(TrackPtr track){
|
||||
///\param tracklist
|
||||
///Tracklist that should be copied to now playing
|
||||
//////////////////////////////////////////
|
||||
void PlaybackQueue::Play(tracklist::IRandomAccess &tracklist){
|
||||
this->currentTrack.reset();
|
||||
void PlaybackQueue::Play(tracklist::Ptr tracklist){
|
||||
|
||||
// Set the "now playing" to libraries own playlist
|
||||
this->nowPlaying = tracklist->Library()->NowPlaying();
|
||||
|
||||
this->currentTrack.reset();
|
||||
this->nowPlaying->CopyTracks(tracklist);
|
||||
this->Play();
|
||||
}
|
@ -36,7 +36,7 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <core/audio/Transport.h>
|
||||
#include <core/tracklist/Standard.h>
|
||||
#include <core/tracklist/IRandomAccess.h>
|
||||
#include <core/Query/TrackMetadata.h>
|
||||
#include <sigslot/sigslot.h>
|
||||
|
||||
@ -73,7 +73,7 @@ class PlaybackQueue : public sigslot::has_slots<>{
|
||||
///\brief
|
||||
///The "now playing" tracklist
|
||||
//////////////////////////////////////////
|
||||
tracklist::Standard::Ptr nowPlaying;
|
||||
tracklist::Ptr nowPlaying;
|
||||
|
||||
bool playing;
|
||||
bool paused;
|
||||
@ -94,9 +94,9 @@ class PlaybackQueue : public sigslot::has_slots<>{
|
||||
musik::core::audio::Transport& Transport() { return this->transport; };
|
||||
|
||||
// Now Playing control
|
||||
tracklist::Standard::Ptr NowPlayingTracklist();
|
||||
void Play(tracklist::IRandomAccess &tracklist);
|
||||
void Append(tracklist::IRandomAccess &tracklist);
|
||||
tracklist::Ptr NowPlayingTracklist();
|
||||
void Play(tracklist::Ptr tracklist);
|
||||
void Append(tracklist::Ptr tracklist);
|
||||
|
||||
// Playback Control
|
||||
void Play();
|
||||
|
@ -50,8 +50,8 @@ using namespace musik::core::server;
|
||||
|
||||
Connection::Connection(boost::asio::io_service &ioService)
|
||||
:socket(ioService)
|
||||
,Base(UTF("Server"))
|
||||
{
|
||||
this->identifier = UTF("server");
|
||||
}
|
||||
|
||||
Connection::~Connection(void){
|
||||
|
@ -36,6 +36,19 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace musik{ namespace core{
|
||||
namespace Query{
|
||||
class ListBase;
|
||||
}
|
||||
namespace tracklist{
|
||||
class IRandomAccess;
|
||||
typedef boost::shared_ptr<IRandomAccess> Ptr;
|
||||
}
|
||||
} }
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <core/tracklist/IBase.h>
|
||||
#include <core/Library/Base.h>
|
||||
|
||||
@ -59,14 +72,18 @@ namespace musik{ namespace core{
|
||||
virtual void SetLibrary(musik::core::LibraryPtr setLibrary) = 0;
|
||||
virtual musik::core::LibraryPtr Library() = 0;
|
||||
|
||||
virtual bool CopyTracks(musik::core::tracklist::IRandomAccess &tracklist) = 0;
|
||||
virtual bool AppendTracks(musik::core::tracklist::IRandomAccess &tracklist) = 0;
|
||||
virtual bool CopyTracks(musik::core::tracklist::Ptr tracklist) = 0;
|
||||
virtual bool AppendTracks(musik::core::tracklist::Ptr tracklist) = 0;
|
||||
|
||||
virtual void AddRequestedMetakey(const char* metakey) = 0;
|
||||
virtual void RemoveRequestedMetakey(const char* metakey) = 0;
|
||||
|
||||
virtual UINT64 Duration() = 0;
|
||||
virtual UINT64 Filesize() = 0;
|
||||
|
||||
virtual void HintNumberOfRows(int rows) = 0;
|
||||
virtual void ConnectToQuery(musik::core::Query::ListBase &listQuery)=0;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
typedef sigslot::signal3<UINT64,UINT64,UINT64> TracklistInfoEvent;
|
||||
TracklistInfoEvent TracklistInfoUpdated;
|
||||
@ -78,7 +95,7 @@ namespace musik{ namespace core{
|
||||
TrackMetaEvent TrackMetaUpdated;
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<IRandomAccess> IRandomAccessPtr;
|
||||
typedef boost::shared_ptr<IRandomAccess> Ptr;
|
||||
|
||||
}
|
||||
} }
|
||||
|
@ -208,38 +208,41 @@ void Standard::RemoveRequestedMetakey(const char* metakey){
|
||||
this->trackQuery.RequestMetakeys(this->requestedMetaKeys);
|
||||
}
|
||||
|
||||
bool Standard::CopyTracks(musik::core::tracklist::IRandomAccess &tracklist){
|
||||
if(this!=&tracklist){ // Do not copy to itself
|
||||
bool Standard::CopyTracks(musik::core::tracklist::Ptr tracklist){
|
||||
if(tracklist.get()!=this){ // Do not copy to itself
|
||||
this->trackCache.clear();
|
||||
this->SetLibrary(tracklist.Library());
|
||||
this->SetLibrary(tracklist->Library());
|
||||
this->tracks.clear();
|
||||
this->tracks.reserve(tracklist.Size());
|
||||
for(int i(0);i<tracklist.Size();++i){
|
||||
this->tracks.push_back(tracklist[i]->Copy());
|
||||
this->tracks.reserve(tracklist->Size());
|
||||
for(int i(0);i<tracklist->Size();++i){
|
||||
this->tracks.push_back( (*tracklist)[i]->Copy());
|
||||
}
|
||||
this->SetCurrentPosition(tracklist.CurrentPosition());
|
||||
this->SetCurrentPosition(tracklist->CurrentPosition());
|
||||
|
||||
this->TracksUpdated(true);
|
||||
this->infoDuration = tracklist.Duration();
|
||||
this->infoFilesize = tracklist.Filesize();
|
||||
this->infoDuration = tracklist->Duration();
|
||||
this->infoFilesize = tracklist->Filesize();
|
||||
this->TracklistInfoUpdated(this->tracks.size(),this->infoDuration,this->infoFilesize);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Standard::AppendTracks(musik::core::tracklist::IRandomAccess &tracklist){
|
||||
if(!this->library){
|
||||
this->SetLibrary(tracklist.Library());
|
||||
}
|
||||
bool Standard::AppendTracks(musik::core::tracklist::Ptr tracklist){
|
||||
if(this->library==tracklist->Library()){ // Only append to same library
|
||||
if(!this->library){ // If library is not set, set it.
|
||||
this->SetLibrary(tracklist->Library());
|
||||
}
|
||||
|
||||
this->tracks.reserve(this->tracks.size()+tracklist.Size());
|
||||
this->tracks.reserve(this->tracks.size()+tracklist->Size());
|
||||
|
||||
for(int i(0);i<tracklist.Size();++i){
|
||||
this->tracks.push_back(tracklist[i]->Copy());
|
||||
}
|
||||
for(int i(0);i<tracklist->Size();++i){
|
||||
this->tracks.push_back( (*tracklist)[i]->Copy());
|
||||
}
|
||||
|
||||
this->TracksUpdated(false);
|
||||
return true;
|
||||
this->TracksUpdated(false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Standard::OnTracksInfoFromQuery(UINT64 tracks,UINT64 duration,UINT64 filesize){
|
||||
|
@ -59,7 +59,7 @@ namespace musik{ namespace core{
|
||||
|
||||
public:
|
||||
|
||||
typedef boost::shared_ptr<Standard> Ptr;
|
||||
// typedef boost::shared_ptr<Standard> Ptr;
|
||||
|
||||
Standard(void);
|
||||
~Standard(void);
|
||||
@ -80,18 +80,20 @@ namespace musik{ namespace core{
|
||||
virtual void SetLibrary(musik::core::LibraryPtr setLibrary);
|
||||
virtual musik::core::LibraryPtr Library();
|
||||
|
||||
virtual bool CopyTracks(musik::core::tracklist::IRandomAccess &tracklist);
|
||||
virtual bool AppendTracks(musik::core::tracklist::IRandomAccess &tracklist);
|
||||
virtual bool CopyTracks(musik::core::tracklist::Ptr tracklist);
|
||||
virtual bool AppendTracks(musik::core::tracklist::Ptr tracklist);
|
||||
|
||||
virtual void AddRequestedMetakey(const char* metakey);
|
||||
virtual void RemoveRequestedMetakey(const char* metakey);
|
||||
|
||||
virtual UINT64 Duration();
|
||||
virtual UINT64 Filesize();
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
void ConnectToQuery(musik::core::Query::ListBase &listQuery);
|
||||
|
||||
void HintNumberOfRows(int rows);
|
||||
virtual void HintNumberOfRows(int rows);
|
||||
|
||||
virtual void ConnectToQuery(musik::core::Query::ListBase &listQuery);
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include <cube/BrowseView.hpp>
|
||||
#include <cube/TracklistController.hpp>
|
||||
#include <core/LibraryFactory.h>
|
||||
#include <core/tracklist/Standard.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -48,9 +49,10 @@ using namespace musik::cube;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*ctor*/ BrowseController::BrowseController(BrowseView& view)
|
||||
/*ctor*/ BrowseController::BrowseController(BrowseView& view,musik::core::LibraryPtr library)
|
||||
: view(view)
|
||||
, tracklistController(NULL)
|
||||
, library(library)
|
||||
{
|
||||
view.Handle()
|
||||
? this->OnViewCreated(&view)
|
||||
@ -64,7 +66,12 @@ using namespace musik::cube;
|
||||
|
||||
void BrowseController::OnViewCreated(Window* window)
|
||||
{
|
||||
this->tracklistController = new TracklistController(*this->view.tracklistView,&this->selectionQuery);
|
||||
|
||||
// Create a tracklist, connected to current library
|
||||
musik::core::tracklist::Ptr browseTrackList(new musik::core::tracklist::Standard());
|
||||
browseTrackList->SetLibrary(this->library);
|
||||
|
||||
this->tracklistController = new TracklistController(*this->view.tracklistView,&this->selectionQuery,browseTrackList);
|
||||
|
||||
// create all the metadata filter controllers
|
||||
typedef BrowseView::FilterViewList FilterViewList;
|
||||
@ -89,6 +96,6 @@ void BrowseController::OnViewCreated(Window* window)
|
||||
}
|
||||
|
||||
void BrowseController::SendQuery(){
|
||||
musik::core::LibraryFactory::GetCurrentLibrary()->AddQuery(this->selectionQuery,musik::core::Query::CancelSimilar);
|
||||
this->library->AddQuery(this->selectionQuery,musik::core::Query::CancelSimilar);
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,7 @@ namespace musik { namespace cube {
|
||||
|
||||
#include <cube/MetadataFilterController.hpp>
|
||||
#include <core/Query/ListSelection.h>
|
||||
#include <core/Library/Base.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -61,7 +62,7 @@ namespace musik { namespace cube {
|
||||
|
||||
class BrowseController : public EventHandler
|
||||
{
|
||||
public: /*ctor*/ BrowseController(BrowseView& view);
|
||||
public: /*ctor*/ BrowseController(BrowseView& view,musik::core::LibraryPtr library);
|
||||
public: /*dtor*/ ~BrowseController();
|
||||
|
||||
private: typedef MetadataFilterController FilterController;
|
||||
@ -76,6 +77,7 @@ protected: FilterControllerList filterControllers;
|
||||
protected: TracklistController* tracklistController;
|
||||
public: musik::core::Query::ListSelection selectionQuery;
|
||||
public: void SendQuery();
|
||||
public: musik::core::LibraryPtr library;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
116
src/cube/LibraryWindowController.cpp
Normal file
116
src/cube/LibraryWindowController.cpp
Normal file
@ -0,0 +1,116 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2007, Casey Langen
|
||||
//
|
||||
// Sources and Binaries of: mC2, win32cpp
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// * Neither the name of the author nor the names of other contributors may
|
||||
// be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pch.hpp"
|
||||
#include <cube/LibraryWindowController.hpp>
|
||||
#include <cube/LibraryWindowView.hpp>
|
||||
#include <cube/SourcesView.hpp>
|
||||
|
||||
#include <core/LibraryFactory.h>
|
||||
#include <core/Pluginfactory.h>
|
||||
|
||||
#include <win32cpp/Types.hpp> // uichar, uistring
|
||||
#include <win32cpp/TopLevelWindow.hpp>
|
||||
#include <win32cpp/Splitter.hpp>
|
||||
#include <win32cpp/TabView.hpp>
|
||||
#include <win32cpp/RedrawLock.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using namespace musik::cube;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*ctor*/ LibraryWindowController::LibraryWindowController(LibraryWindowView& view)
|
||||
: view(view)
|
||||
{
|
||||
musik::core::PluginFactory::Instance();
|
||||
|
||||
this->view.Handle()
|
||||
? this->OnViewCreated(&view)
|
||||
: this->view.Created.connect(this, &LibraryWindowController::OnViewCreated);
|
||||
|
||||
}
|
||||
|
||||
LibraryWindowController::~LibraryWindowController()
|
||||
{
|
||||
}
|
||||
|
||||
void LibraryWindowController::OnViewCreated(Window* window)
|
||||
{
|
||||
|
||||
using namespace musik::core;
|
||||
// Get libraries from LibraryFactory
|
||||
LibraryFactory::LibraryVector& libraries = LibraryFactory::Libraries();
|
||||
|
||||
// Loop through the libraries
|
||||
for(LibraryFactory::LibraryVector::iterator library=libraries.begin();library!=libraries.end();++library){
|
||||
|
||||
SourcesView* sourcesView = new SourcesView();
|
||||
this->libraries.push_back(SourcesControllerPtr(new SourcesController(*sourcesView,*library)));
|
||||
this->view.AddTab( (*library)->Identifier() ,sourcesView);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// create sources view/controller
|
||||
/*
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
void LibraryWindowController::OnResize(Window* window, Size size)
|
||||
{
|
||||
RedrawLock redrawLock(&this->view);
|
||||
// this->clientView->Resize(this->mainWindow.ClientSize());
|
||||
}
|
||||
/*
|
||||
void LibraryWindowController::QueryQueueStart(){
|
||||
this->LibraryCallbackTimer.ConnectToWindow(&this->mainWindow);
|
||||
this->LibraryCallbackTimer.Start();
|
||||
}
|
||||
|
||||
void LibraryWindowController::QueryQueueEnd(){
|
||||
this->LibraryCallbackTimer.Stop();
|
||||
}
|
||||
|
||||
void LibraryWindowController::QueryQueueLoop(){
|
||||
musik::core::LibraryFactory::GetCurrentLibrary()->RunCallbacks();
|
||||
}
|
||||
*/
|
91
src/cube/LibraryWindowController.hpp
Normal file
91
src/cube/LibraryWindowController.hpp
Normal file
@ -0,0 +1,91 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2007, Casey Langen
|
||||
//
|
||||
// Sources and Binaries of: mC2, win32cpp
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// * Neither the name of the author nor the names of other contributors may
|
||||
// be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace win32cpp{
|
||||
class Splitter;
|
||||
class TabView;
|
||||
class Window;
|
||||
class TopLevelWindow;
|
||||
}
|
||||
namespace musik { namespace cube {
|
||||
class LibraryWindowView;
|
||||
} }
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <cube/SourcesController.hpp>
|
||||
#include <win32cpp/Timer.hpp>
|
||||
#include <win32cpp/Types.hpp>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <vector>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using namespace win32cpp;
|
||||
|
||||
namespace musik { namespace cube {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class LibraryWindowController : public EventHandler
|
||||
{
|
||||
public: /*ctor*/ LibraryWindowController(LibraryWindowView& view);
|
||||
public: /*dtor*/ ~LibraryWindowController();
|
||||
|
||||
protected:
|
||||
void OnViewCreated(Window* window);
|
||||
void OnResize(Window* window, Size size);
|
||||
|
||||
LibraryWindowView& view;
|
||||
// SourcesController* sourcesController;
|
||||
|
||||
typedef boost::shared_ptr<SourcesController> SourcesControllerPtr;
|
||||
typedef std::vector<SourcesControllerPtr> LibraryWindowVector;
|
||||
|
||||
LibraryWindowVector libraries;
|
||||
|
||||
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} } // musik::cube
|
132
src/cube/LibraryWindowView.cpp
Normal file
132
src/cube/LibraryWindowView.cpp
Normal file
@ -0,0 +1,132 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2007, Casey Langen
|
||||
//
|
||||
// Sources and Binaries of: mC2, win32cpp
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// * Neither the name of the author nor the names of other contributors may
|
||||
// be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pch.hpp"
|
||||
#include <cube/LibraryWindowView.hpp>
|
||||
#include <cube/LibraryWindowController.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using namespace musik::cube;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*ctor*/ LibraryWindowView::LibraryWindowView()
|
||||
{
|
||||
}
|
||||
|
||||
/*dtor*/ LibraryWindowView::~LibraryWindowView()
|
||||
{
|
||||
// make sure not to delete any SourcesItem views, and also
|
||||
// automatically delete the defaultView.
|
||||
// this->SetView(this->defaultView);
|
||||
}
|
||||
/*
|
||||
void SourcesView::OnCreated()
|
||||
{
|
||||
// add main splitter as the top level window's main window
|
||||
this->splitter = this->AddChild(
|
||||
new Splitter(SplitColumn, this->listView, this->defaultView));
|
||||
|
||||
this->splitter->SetAnchorSize(125);
|
||||
}
|
||||
|
||||
void SourcesView::OnListViewCreated(Window* window)
|
||||
{
|
||||
typedef ListView::Column Column;
|
||||
|
||||
Size clientSize = this->listView->ClientSize();
|
||||
|
||||
this->mainColumn = Column::Create(_T("Sources"), clientSize.width, TextAlignCenter);
|
||||
this->listView->AddColumn(this->mainColumn);
|
||||
|
||||
this->listView->Resized.connect(this, &SourcesView::OnListViewResized);
|
||||
this->listView->ThemeChanged.connect(this, &SourcesView::OnListViewThemeChanged);
|
||||
this->listView->HotRowChanged.connect(this, &SourcesView::OnListViewHotRowChanged);
|
||||
|
||||
this->listView->SetRowHeight(this->listView->RowHeight() + 2);
|
||||
this->listView->SetScrollBarVisibility(HorizontalScrollBar, false);
|
||||
this->listView->EnableColumnResizing(false);
|
||||
this->listView->EnableMultipleSelection(false);
|
||||
this->UpdateListViewBkgndColor();
|
||||
|
||||
int itemHeight = this->listView->RowHeight();
|
||||
this->listView->SetRowHeight(max(itemHeight, 19));
|
||||
}
|
||||
|
||||
void SourcesView::SetView(Window* view)
|
||||
{
|
||||
Window* oldView =
|
||||
const_cast<Window*>(this->splitter->Child2());
|
||||
|
||||
if (view && (view != oldView))
|
||||
{
|
||||
RedrawLock lockRedraw(this);
|
||||
|
||||
oldView->SetVisible(false);
|
||||
this->splitter->SetChild2(view);
|
||||
view->SetVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
void SourcesView::OnListViewResized(Window* window, Size size)
|
||||
{
|
||||
this->listView->SetColumnWidth(this->mainColumn, this->listView->ClientSize().width);
|
||||
}
|
||||
|
||||
void SourcesView::OnListViewThemeChanged(Window* window)
|
||||
{
|
||||
this->UpdateListViewBkgndColor();
|
||||
}
|
||||
|
||||
void SourcesView::UpdateListViewBkgndColor()
|
||||
{
|
||||
this->listView->SetBackgroundColor(Color::SystemColor(COLOR_BTNFACE));
|
||||
}
|
||||
|
||||
void SourcesView::OnListViewHotRowChanged(ListView* listView, int rowIndex)
|
||||
{
|
||||
// Redraw the newly hot, and previously hot row to get the fancy
|
||||
// mouse hover effect. we need to redraw (and remember) the
|
||||
// previously hot row to make sure to "remove" the effect from
|
||||
// the old row.
|
||||
if (rowIndex >= 0) this->listView->RedrawRow(rowIndex);
|
||||
if (this->lastHotRowIndex != -1) this->listView->RedrawRow(this->lastHotRowIndex);
|
||||
this->lastHotRowIndex = rowIndex;
|
||||
}
|
||||
*/
|
87
src/cube/LibraryWindowView.hpp
Normal file
87
src/cube/LibraryWindowView.hpp
Normal file
@ -0,0 +1,87 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2007, Casey Langen
|
||||
//
|
||||
// Sources and Binaries of: mC2, win32cpp
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// * Neither the name of the author nor the names of other contributors may
|
||||
// be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace win32cpp{
|
||||
class Splitter;
|
||||
}
|
||||
namespace musik{ namespace cube{
|
||||
class LibraryWindowController;
|
||||
}}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/TabView.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using namespace win32cpp;
|
||||
|
||||
namespace musik { namespace cube {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class LibraryWindowView: public TabView
|
||||
{
|
||||
public: friend class LibraryWindowController;
|
||||
|
||||
public: /*ctor*/ LibraryWindowView();
|
||||
public: /*dtor*/ ~LibraryWindowView();
|
||||
|
||||
/*
|
||||
protected: void SetView(Window* newView); // used by SourcesController
|
||||
|
||||
protected: void OnListViewCreated(Window* window);
|
||||
protected: void OnListViewResized(Window* window, Size size);
|
||||
protected: void OnListViewThemeChanged(Window* window);
|
||||
protected: void OnListViewHotRowChanged(ListView* listView, int rowIndex);
|
||||
protected: void UpdateListViewBkgndColor();
|
||||
protected: virtual void OnCreated();
|
||||
|
||||
protected: ListView* listView;
|
||||
protected: ListView::ColumnRef mainColumn;
|
||||
protected: int lastHotRowIndex;
|
||||
protected: Window* defaultView;
|
||||
protected: Splitter* splitter;*/
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} } // musik::cube
|
@ -39,8 +39,8 @@
|
||||
#include "pch.hpp"
|
||||
#include <cube/MainWindowController.hpp>
|
||||
#include <cube/TransportView.hpp>
|
||||
#include <cube/SourcesView.hpp>
|
||||
#include <cube/SourcesController.hpp>
|
||||
#include <cube/LibraryWindowController.hpp>
|
||||
#include <cube/LibraryWindowView.hpp>
|
||||
#include <cube/TransportController.hpp>
|
||||
|
||||
#include <core/LibraryFactory.h>
|
||||
@ -62,10 +62,9 @@ using namespace musik::cube;
|
||||
|
||||
/*ctor*/ MainWindowController::MainWindowController(TopLevelWindow& mainWindow)
|
||||
: mainWindow(mainWindow)
|
||||
, sourcesController(NULL)
|
||||
, transportController(NULL)
|
||||
, menuController(mainWindow)
|
||||
, LibraryCallbackTimer(20)
|
||||
, libraryController(NULL)
|
||||
{
|
||||
musik::core::PluginFactory::Instance();
|
||||
|
||||
@ -73,16 +72,17 @@ using namespace musik::cube;
|
||||
this, &MainWindowController::OnMainWindowCreated);
|
||||
|
||||
// Connect the local library to the
|
||||
this->LibraryCallbackTimer.ConnectToWindow(&mainWindow);
|
||||
/*
|
||||
this->LibraryCallbackTimer.ConnectToWindow(&mainWindow);
|
||||
this->LibraryCallbackTimer.OnTimeout.connect(this,&MainWindowController::QueryQueueLoop);
|
||||
musik::core::LibraryFactory::GetCurrentLibrary()->OnQueryQueueStart.connect(this,&MainWindowController::QueryQueueStart);
|
||||
musik::core::LibraryFactory::GetCurrentLibrary()->OnQueryQueueEnd.connect(this,&MainWindowController::QueryQueueEnd);
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
MainWindowController::~MainWindowController()
|
||||
{
|
||||
delete this->sourcesController;
|
||||
delete this->libraryController;
|
||||
delete this->transportController;
|
||||
}
|
||||
|
||||
@ -112,13 +112,14 @@ void MainWindowController::OnMainWindowCreated(Window* window)
|
||||
transportView->SetPadding(FramePadding(2, 4, 0, 0));
|
||||
this->transportController = new TransportController(*transportView);
|
||||
|
||||
// create sources view/controller
|
||||
SourcesView* sourcesView = new SourcesView();
|
||||
this->sourcesController = new SourcesController(*sourcesView);
|
||||
// create library view/controller
|
||||
LibraryWindowView* libraryView = new LibraryWindowView();
|
||||
this->libraryController = new LibraryWindowController(*libraryView);
|
||||
|
||||
|
||||
// the main splitter
|
||||
Splitter* transportSplitter = this->mainWindow.AddChild(
|
||||
new Splitter(SplitRow, sourcesView, transportView));
|
||||
new Splitter(SplitRow, libraryView, transportView));
|
||||
|
||||
// set initial sizes
|
||||
transportSplitter->Resize(clientSize);
|
||||
@ -136,15 +137,3 @@ void MainWindowController::OnResize(Window* window, Size size)
|
||||
this->clientView->Resize(this->mainWindow.ClientSize());
|
||||
}
|
||||
|
||||
void MainWindowController::QueryQueueStart(){
|
||||
this->LibraryCallbackTimer.ConnectToWindow(&this->mainWindow);
|
||||
this->LibraryCallbackTimer.Start();
|
||||
}
|
||||
|
||||
void MainWindowController::QueryQueueEnd(){
|
||||
this->LibraryCallbackTimer.Stop();
|
||||
}
|
||||
|
||||
void MainWindowController::QueryQueueLoop(){
|
||||
musik::core::LibraryFactory::GetCurrentLibrary()->RunCallbacks();
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ namespace win32cpp{
|
||||
namespace musik { namespace cube {
|
||||
class SourcesController;
|
||||
class TransportController;
|
||||
class LibraryWindowController;
|
||||
} }
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -78,17 +79,16 @@ protected: void OnResize(Window* window, Size size);
|
||||
|
||||
protected: TopLevelWindow& mainWindow;
|
||||
protected: Splitter* clientView;
|
||||
protected: SourcesController* sourcesController;
|
||||
protected: LibraryWindowController* libraryController;
|
||||
protected: TransportController* transportController;
|
||||
protected: TabView* tabView;
|
||||
|
||||
protected: MainMenuController menuController;
|
||||
protected: Timer LibraryCallbackTimer;
|
||||
/*protected: Timer LibraryCallbackTimer;
|
||||
|
||||
protected: void QueryQueueStart();
|
||||
protected: void QueryQueueEnd();
|
||||
protected: void QueryQueueLoop();
|
||||
|
||||
*/
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -52,9 +52,10 @@ using namespace musik::cube;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*ctor*/ SettingsController::SettingsController(SettingsView& settingsView)
|
||||
/*ctor*/ SettingsController::SettingsController(SettingsView& settingsView,musik::core::LibraryPtr library)
|
||||
: settingsView(settingsView)
|
||||
, libraryStatusTimer(300)
|
||||
, library(library)
|
||||
{
|
||||
this->settingsView.Created.connect(
|
||||
this, &SettingsController::OnViewCreated);
|
||||
@ -84,7 +85,7 @@ void SettingsController::OnAddPath(Button* button){
|
||||
win32cpp::FolderBrowseDialog addPath;
|
||||
|
||||
if(addPath.Show(win32cpp::Application::Instance().MainWindow())==win32cpp::FolderBrowseDialog::ResultOK){
|
||||
musik::core::Indexer *indexer = musik::core::LibraryFactory::GetCurrentLibrary()->Indexer();
|
||||
musik::core::Indexer *indexer = this->library->Indexer();
|
||||
if(indexer){
|
||||
indexer->AddPath(addPath.Directory());
|
||||
}
|
||||
@ -96,7 +97,7 @@ void SettingsController::OnRemovePath(Button* button){
|
||||
}
|
||||
|
||||
void SettingsController::OnLibraryStatus(){
|
||||
this->settingsView.libraryStatus->SetCaption( musik::core::LibraryFactory::GetCurrentLibrary()->GetInfo() );
|
||||
this->settingsView.libraryStatus->SetCaption( this->library->GetInfo() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,6 +52,7 @@ namespace win32cpp{
|
||||
#include <cube/settings/SyncPathController.hpp>
|
||||
#include <win32cpp/Timer.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <core/Library/Base.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -63,7 +64,7 @@ namespace musik { namespace cube {
|
||||
|
||||
class SettingsController : public EventHandler
|
||||
{
|
||||
public: /*ctor*/ SettingsController(SettingsView& settingsView);
|
||||
public: /*ctor*/ SettingsController(SettingsView& settingsView,musik::core::LibraryPtr library);
|
||||
|
||||
private:
|
||||
void OnViewCreated(Window* window);
|
||||
@ -80,8 +81,8 @@ private:
|
||||
typedef boost::shared_ptr<settings::SyncPathController> SyncPathControllerRef;
|
||||
|
||||
SyncPathControllerRef syncPathController;
|
||||
|
||||
|
||||
public:
|
||||
musik::core::LibraryPtr library;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -48,10 +48,12 @@ using namespace musik::cube;
|
||||
// SourcesController
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*ctor*/ SourcesController::SourcesController(SourcesView& view)
|
||||
/*ctor*/ SourcesController::SourcesController(SourcesView& view,musik::core::LibraryPtr library)
|
||||
: view(view)
|
||||
, model(SourcesModel())
|
||||
, model(SourcesModel(library))
|
||||
, listController(new ListController(*view.listView))
|
||||
, library(library)
|
||||
, LibraryCallbackTimer(20)
|
||||
{
|
||||
this->view.Handle()
|
||||
? this->OnViewCreated(&view)
|
||||
@ -59,6 +61,13 @@ using namespace musik::cube;
|
||||
|
||||
this->listController->Model()->ActiveItemChanged.connect(
|
||||
this, &SourcesController::OnActiveItemChanged);
|
||||
|
||||
// Connect timer to librarys callbacks
|
||||
this->LibraryCallbackTimer.ConnectToWindow(&view);
|
||||
this->LibraryCallbackTimer.OnTimeout.connect(this,&SourcesController::QueryQueueLoop);
|
||||
library->OnQueryQueueStart.connect(this,&SourcesController::QueryQueueStart);
|
||||
library->OnQueryQueueEnd.connect(this,&SourcesController::QueryQueueEnd);
|
||||
|
||||
}
|
||||
|
||||
void SourcesController::OnViewCreated(Window* window)
|
||||
@ -96,6 +105,19 @@ void SourcesController::OnActiveItemChanged(ItemRef item)
|
||||
}
|
||||
}
|
||||
|
||||
void SourcesController::QueryQueueStart(){
|
||||
this->LibraryCallbackTimer.ConnectToWindow(&this->view);
|
||||
this->LibraryCallbackTimer.Start();
|
||||
}
|
||||
|
||||
void SourcesController::QueryQueueEnd(){
|
||||
this->LibraryCallbackTimer.Stop();
|
||||
}
|
||||
|
||||
void SourcesController::QueryQueueLoop(){
|
||||
this->library->RunCallbacks();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// SourcesController::ListController
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -46,6 +46,8 @@ namespace musik { namespace cube {
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <cube/SourcesModel.hpp>
|
||||
#include <core/Library/Base.h>
|
||||
#include <win32cpp/Timer.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -59,21 +61,32 @@ using namespace win32cpp;
|
||||
|
||||
class SourcesController: public EventHandler
|
||||
{
|
||||
private: typedef ListView::ColumnRef ColumnRef;
|
||||
private: typedef SourcesModel::CategoryRef CategoryRef;
|
||||
private: typedef SourcesModel::ItemRef ItemRef;
|
||||
private: class ListController;
|
||||
private:
|
||||
typedef ListView::ColumnRef ColumnRef;
|
||||
typedef SourcesModel::CategoryRef CategoryRef;
|
||||
typedef SourcesModel::ItemRef ItemRef;
|
||||
|
||||
public: /*ctor*/ SourcesController(SourcesView& sourcesView);
|
||||
class ListController;
|
||||
|
||||
private: void OnViewCreated(Window* window);
|
||||
private: void OnActiveItemChanged(ItemRef newItem);
|
||||
private: void OnModelCategoryAdded(CategoryRef category);
|
||||
private: void OnModelCategoryRemoved(CategoryRef category);
|
||||
public:
|
||||
/*ctor*/ SourcesController(SourcesView& sourcesView,musik::core::LibraryPtr library);
|
||||
musik::core::LibraryPtr library;
|
||||
|
||||
protected: SourcesView& view;
|
||||
protected: SourcesModel model;
|
||||
protected: boost::scoped_ptr<ListController> listController;
|
||||
private:
|
||||
void OnViewCreated(Window* window);
|
||||
void OnActiveItemChanged(ItemRef newItem);
|
||||
void OnModelCategoryAdded(CategoryRef category);
|
||||
void OnModelCategoryRemoved(CategoryRef category);
|
||||
|
||||
protected:
|
||||
SourcesView& view;
|
||||
SourcesModel model;
|
||||
boost::scoped_ptr<ListController> listController;
|
||||
|
||||
Timer LibraryCallbackTimer;
|
||||
void QueryQueueStart();
|
||||
void QueryQueueEnd();
|
||||
void QueryQueueLoop();
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -85,8 +85,8 @@ private: Label view;
|
||||
|
||||
class BrowseItem: public SourcesItem
|
||||
{
|
||||
private: /*ctor*/ BrowseItem()
|
||||
: controller(view)
|
||||
private: /*ctor*/ BrowseItem(musik::core::LibraryPtr library)
|
||||
: controller(view,library)
|
||||
{
|
||||
|
||||
}
|
||||
@ -95,9 +95,9 @@ public: /*dtor*/ ~BrowseItem()
|
||||
{
|
||||
}
|
||||
|
||||
public: static SourcesItemRef Create()
|
||||
public: static SourcesItemRef Create(musik::core::LibraryPtr library)
|
||||
{
|
||||
return SourcesItemRef(new BrowseItem());
|
||||
return SourcesItemRef(new BrowseItem(library));
|
||||
}
|
||||
|
||||
public: virtual uistring Caption() { return _T("Browse"); }
|
||||
@ -114,8 +114,10 @@ private: BrowseController controller;
|
||||
|
||||
class NowPlayingItem: public SourcesItem
|
||||
{
|
||||
private: /*ctor*/ NowPlayingItem()
|
||||
: controller(view,NULL,musik::core::PlaybackQueue::Instance().NowPlayingTracklist())
|
||||
private:
|
||||
|
||||
/*ctor*/ NowPlayingItem(musik::core::LibraryPtr library)
|
||||
: controller(view,NULL,library->NowPlaying())
|
||||
{
|
||||
}
|
||||
|
||||
@ -123,9 +125,9 @@ public: /*dtor*/ ~NowPlayingItem()
|
||||
{
|
||||
}
|
||||
|
||||
public: static SourcesItemRef Create()
|
||||
public: static SourcesItemRef Create(musik::core::LibraryPtr library)
|
||||
{
|
||||
return SourcesItemRef(new NowPlayingItem());
|
||||
return SourcesItemRef(new NowPlayingItem(library));
|
||||
}
|
||||
|
||||
public: virtual uistring Caption() { return _T("Now Playing"); }
|
||||
@ -145,8 +147,8 @@ private: TracklistController controller;
|
||||
|
||||
class SettingsItem: public SourcesItem
|
||||
{
|
||||
private: /*ctor*/ SettingsItem()
|
||||
: controller(view)
|
||||
private: /*ctor*/ SettingsItem(musik::core::LibraryPtr library)
|
||||
: controller(view,library)
|
||||
{
|
||||
}
|
||||
|
||||
@ -154,9 +156,9 @@ public: /*dtor*/ ~SettingsItem()
|
||||
{
|
||||
}
|
||||
|
||||
public: static SourcesItemRef Create()
|
||||
public: static SourcesItemRef Create(musik::core::LibraryPtr library)
|
||||
{
|
||||
return SourcesItemRef(new SettingsItem());
|
||||
return SourcesItemRef(new SettingsItem(library));
|
||||
}
|
||||
|
||||
public: virtual uistring Caption() { return _T("Settings"); }
|
||||
@ -174,16 +176,17 @@ private: SettingsController controller;
|
||||
typedef SourcesListModel::Category Category;
|
||||
typedef SourcesListModel::CategoryRef CategoryRef;
|
||||
|
||||
/*ctor*/ SourcesModel::SourcesModel()
|
||||
/*ctor*/ SourcesModel::SourcesModel(musik::core::LibraryPtr library)
|
||||
: library(library)
|
||||
{
|
||||
}
|
||||
|
||||
void SourcesModel::Load()
|
||||
{
|
||||
CategoryRef viewCategory(new Category(_T("View")));
|
||||
viewCategory->Add(BrowseItem::Create());
|
||||
viewCategory->Add(NowPlayingItem::Create());
|
||||
viewCategory->Add(SettingsItem::Create());
|
||||
viewCategory->Add(BrowseItem::Create(this->library));
|
||||
viewCategory->Add(NowPlayingItem::Create(this->library));
|
||||
viewCategory->Add(SettingsItem::Create(this->library));
|
||||
this->AddCategory(viewCategory);
|
||||
|
||||
CategoryRef playlistCategory(new Category(_T("Playlists")));
|
||||
|
@ -39,6 +39,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cube/SourcesListModel.hpp>
|
||||
#include <core/Library/Base.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -60,7 +61,8 @@ private: class InvalidCategoryException: public Exception { };
|
||||
public: sigslot::signal1<CategoryRef> CategoryAdded;
|
||||
public: sigslot::signal1<CategoryRef> CategoryRemoved;
|
||||
|
||||
public: /*ctor*/ SourcesModel();
|
||||
public: /*ctor*/ SourcesModel(musik::core::LibraryPtr library);
|
||||
musik::core::LibraryPtr library;
|
||||
|
||||
public: void Load();
|
||||
|
||||
|
@ -55,7 +55,7 @@ using namespace musik::cube;
|
||||
/*ctor*/ TracklistController::TracklistController(
|
||||
TracklistView& view,
|
||||
musik::core::Query::ListBase *connectedQuery,
|
||||
musik::core::tracklist::Standard::Ptr tracklist)
|
||||
musik::core::tracklist::Ptr tracklist)
|
||||
: view(view)
|
||||
, model(new TracklistModel(connectedQuery, tracklist))
|
||||
{
|
||||
@ -157,7 +157,10 @@ void TracklistController::OnColumnSort(ListView *listView,ColumnRef column){
|
||||
// Add the tracks to sort
|
||||
this->sortQuery.AddTracks(*(model->tracklist));
|
||||
|
||||
musik::core::LibraryFactory::GetCurrentLibrary()->AddQuery(this->sortQuery,musik::core::Query::CancelSimilar);
|
||||
musik::core::LibraryPtr library( model->tracklist->Library());
|
||||
if(library){
|
||||
library->AddQuery(this->sortQuery,musik::core::Query::CancelSimilar);
|
||||
}
|
||||
|
||||
this->sortQuery.ClearTracks();
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ namespace musik { namespace cube {
|
||||
#include <win32cpp/ListView.hpp>
|
||||
#include <core/config.h>
|
||||
#include <core/Query/ListBase.h>
|
||||
#include <core/tracklist/Standard.h>
|
||||
#include <core/tracklist/IRandomAccess.h>
|
||||
#include <core/Query/SortTracks.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -72,8 +72,8 @@ private:
|
||||
public:
|
||||
/*ctor*/ TracklistController(
|
||||
TracklistView& listView,
|
||||
musik::core::Query::ListBase *connectedQuery = NULL,
|
||||
musik::core::tracklist::Standard::Ptr tracklist = musik::core::tracklist::Standard::Ptr());
|
||||
musik::core::Query::ListBase *connectedQuery,
|
||||
musik::core::tracklist::Ptr tracklist);
|
||||
|
||||
private:
|
||||
void OnViewCreated(Window* window);
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include <core/LibraryFactory.h>
|
||||
#include <core/PlaybackQueue.h>
|
||||
#include <core/MetaKey.h>
|
||||
#include <core/tracklist/Standard.h>
|
||||
|
||||
|
||||
|
||||
@ -56,19 +57,16 @@ using namespace musik::cube;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*ctor*/ TracklistModel::TracklistModel(musik::core::Query::ListBase *connectedQuery,musik::core::tracklist::Standard::Ptr setTracklist)
|
||||
/*ctor*/ TracklistModel::TracklistModel(musik::core::Query::ListBase *connectedQuery,musik::core::tracklist::Ptr setTracklist)
|
||||
{
|
||||
if(setTracklist){
|
||||
this->tracklist = setTracklist;
|
||||
}else{
|
||||
this->tracklist.reset( new musik::core::tracklist::Standard() );
|
||||
}
|
||||
|
||||
this->tracklist = setTracklist;
|
||||
|
||||
this->SetRowCount(0);
|
||||
|
||||
this->tracklist->TracksUpdated.connect(this,&TracklistModel::OnTracks);
|
||||
this->tracklist->TrackMetaUpdated.connect(this,&TracklistModel::OnTrackMeta);
|
||||
this->tracklist->SetLibrary(musik::core::LibraryFactory::GetCurrentLibrary());
|
||||
// this->tracklist->SetLibrary(musik::core::LibraryFactory::GetCurrentLibrary());
|
||||
|
||||
this->ConnectToQuery(connectedQuery);
|
||||
}
|
||||
@ -125,7 +123,7 @@ void TracklistModel::OnTracks(bool cleared){
|
||||
|
||||
void TracklistModel::OnRowActivated(int row){
|
||||
this->tracklist->SetCurrentPosition(row);
|
||||
musik::core::PlaybackQueue::Instance().Play(*this->tracklist);
|
||||
musik::core::PlaybackQueue::Instance().Play(this->tracklist);
|
||||
}
|
||||
|
||||
void TracklistModel::ConnectToQuery(musik::core::Query::ListBase *connectedQuery){
|
||||
|
@ -46,7 +46,7 @@ namespace musik{ namespace core{ namespace Query{
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/ListView.hpp>
|
||||
#include <core/tracklist/Standard.h>
|
||||
#include <core/tracklist/IRandomAccess.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -67,7 +67,7 @@ public: typedef ListView::ColumnRef ColumnRef;
|
||||
// public API
|
||||
public: /*ctor*/ TracklistModel(
|
||||
musik::core::Query::ListBase *connectedQuery,
|
||||
musik::core::tracklist::Standard::Ptr setTracklist);
|
||||
musik::core::tracklist::Ptr setTracklist);
|
||||
|
||||
public: void ConnectToQuery(musik::core::Query::ListBase *connectedQuery);
|
||||
|
||||
@ -79,7 +79,7 @@ public: virtual uistring CellValueToString(int rowIndex, ColumnRef column);
|
||||
// instance data
|
||||
protected: void OnTrackMeta(std::vector<int> &trackPositions);
|
||||
protected: void OnTracks(bool cleared);
|
||||
public: musik::core::tracklist::Standard::Ptr tracklist; // FIXME: no public fields!
|
||||
public: musik::core::tracklist::Ptr tracklist; // FIXME: no public fields!
|
||||
|
||||
};
|
||||
|
||||
|
@ -69,6 +69,9 @@
|
||||
IgnoreDefaultLibraryNames=""
|
||||
ModuleDefinitionFile=""
|
||||
GenerateDebugInformation="true"
|
||||
GenerateMapFile="true"
|
||||
MapFileName="$(TargetDir)$(TargetName).map"
|
||||
MapExports="true"
|
||||
SubSystem="2"
|
||||
EntryPointSymbol="wWinMainCRTStartup"
|
||||
ImportLibrary=""
|
||||
@ -192,6 +195,22 @@
|
||||
<Filter
|
||||
Name="MainWindow"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\LibraryWindowController.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\LibraryWindowController.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\LibraryWindowView.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\LibraryWindowView.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\MainMenuController.cpp"
|
||||
>
|
||||
|
@ -89,7 +89,7 @@ void SyncPathController::OnResized(Window* window, Size size)
|
||||
void SyncPathController::RemoveSelectedPaths(){
|
||||
|
||||
SyncPathModel* model = (SyncPathModel*)this->model.get();
|
||||
musik::core::Indexer *indexer = musik::core::LibraryFactory::GetCurrentLibrary()->Indexer();
|
||||
musik::core::Indexer *indexer = this->settingsController->library->Indexer();
|
||||
if(indexer && model){
|
||||
|
||||
win32cpp::ListView::RowIndexList selectedRows(this->listView.SelectedRows());
|
||||
|
@ -46,6 +46,9 @@
|
||||
// Forward
|
||||
namespace musik { namespace cube {
|
||||
class SettingsController;
|
||||
namespace settings{
|
||||
class SyncPathModel;
|
||||
}
|
||||
} }
|
||||
|
||||
|
||||
@ -64,9 +67,12 @@ class SyncPathController : public EventHandler{
|
||||
void OnResized(Window* window, Size size);
|
||||
|
||||
ListView& listView;
|
||||
musik::cube::SettingsController* settingsController;
|
||||
ListView::ModelRef model;
|
||||
ListView::ColumnRef mainColumn;
|
||||
|
||||
friend class settings::SyncPathModel;
|
||||
|
||||
musik::cube::SettingsController* settingsController;
|
||||
};
|
||||
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "pch.hpp"
|
||||
#include <win32cpp/ApplicationThread.hpp>
|
||||
#include <cube/settings/SyncPathModel.hpp>
|
||||
#include <cube/SettingsController.hpp>
|
||||
#include <core/Indexer.h>
|
||||
#include <core/LibraryFactory.h>
|
||||
|
||||
@ -51,7 +52,7 @@ using namespace musik::cube::settings;
|
||||
SyncPathModel::SyncPathModel(SyncPathController *controller)
|
||||
: controller(controller)
|
||||
{
|
||||
musik::core::Indexer *indexer = musik::core::LibraryFactory::GetCurrentLibrary()->Indexer();
|
||||
musik::core::Indexer *indexer = this->controller->settingsController->library->Indexer();
|
||||
if(indexer){
|
||||
indexer->PathsUpdated.connect(this,&SyncPathModel::OnPathsUpdated);
|
||||
}
|
||||
@ -69,7 +70,7 @@ uistring SyncPathModel::CellValueToString(int rowIndex, ListView::ColumnRef colu
|
||||
}
|
||||
|
||||
void SyncPathModel::UpdateSyncPaths(){
|
||||
musik::core::Indexer *indexer = musik::core::LibraryFactory::GetCurrentLibrary()->Indexer();
|
||||
musik::core::Indexer *indexer = this->controller->settingsController->library->Indexer();
|
||||
if(indexer){
|
||||
this->paths = indexer->GetPaths();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user