mirror of
https://github.com/clangen/musikcube.git
synced 2024-12-29 18:14:16 +00:00
"Now Playing" playlist (visual) working.
This commit is contained in:
parent
6d479c3d13
commit
cd328eca08
@ -65,7 +65,7 @@ void PlaybackQueue::OnPlaybackEndOrFail(){
|
||||
}
|
||||
}
|
||||
|
||||
tracklist::IRandomAccessPtr PlaybackQueue::NowPlayingTracklist(){
|
||||
tracklist::Standard::Ptr PlaybackQueue::NowPlayingTracklist(){
|
||||
return this->nowPlaying;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ class PlaybackQueue : public sigslot::has_slots<>{
|
||||
static PlaybackQueue sInstance;
|
||||
|
||||
audio::Transport transport;
|
||||
tracklist::IRandomAccessPtr nowPlaying;
|
||||
tracklist::Standard::Ptr nowPlaying;
|
||||
|
||||
bool playing;
|
||||
|
||||
@ -61,7 +61,7 @@ class PlaybackQueue : public sigslot::has_slots<>{
|
||||
static PlaybackQueue& Instance(){ return sInstance; };
|
||||
|
||||
// Now Playing control
|
||||
tracklist::IRandomAccessPtr NowPlayingTracklist();
|
||||
tracklist::Standard::Ptr NowPlayingTracklist();
|
||||
void Play(tracklist::IRandomAccess &tracklist);
|
||||
void Append(tracklist::IRandomAccess &tracklist);
|
||||
|
||||
|
@ -57,6 +57,7 @@ namespace musik{ namespace core{
|
||||
virtual void AppendTracks(musik::core::tracklist::IRandomAccess &tracklist) = 0;
|
||||
|
||||
virtual musik::core::TrackPtr Track(int position)=0;
|
||||
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<IRandomAccess> IRandomAccessPtr;
|
||||
|
@ -223,13 +223,17 @@ void Standard::RemoveRequestedMetakey(const char* metakey){
|
||||
}
|
||||
|
||||
void Standard::CopyTracks(musik::core::tracklist::IRandomAccess &tracklist){
|
||||
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.Track(i)->Copy());
|
||||
if(this!=&tracklist){ // Do not copy to itself
|
||||
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.Track(i)->Copy());
|
||||
}
|
||||
this->SetCurrentPosition(tracklist.CurrentPosition());
|
||||
|
||||
this->OnTracks(true);
|
||||
}
|
||||
this->SetCurrentPosition(tracklist.CurrentPosition());
|
||||
}
|
||||
|
||||
void Standard::AppendTracks(musik::core::tracklist::IRandomAccess &tracklist){
|
||||
@ -242,6 +246,8 @@ void Standard::AppendTracks(musik::core::tracklist::IRandomAccess &tracklist){
|
||||
for(int i(0);i<tracklist.Size();++i){
|
||||
this->tracks.push_back(tracklist.Track(i)->Copy());
|
||||
}
|
||||
|
||||
this->OnTracks(false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -79,14 +79,6 @@ namespace musik{ namespace core{
|
||||
void SetLibrary(musik::core::LibraryPtr setLibrary);
|
||||
musik::core::LibraryPtr Library();
|
||||
|
||||
|
||||
typedef sigslot::signal1<bool> TracksEvent;
|
||||
TracksEvent OnTracks;
|
||||
|
||||
typedef sigslot::signal1<std::vector<int>&> TrackMetaEvent;
|
||||
TrackMetaEvent OnTrackMeta;
|
||||
|
||||
|
||||
void HintNumberOfRows(int rows);
|
||||
|
||||
void AddRequestedMetakey(const char* metakey);
|
||||
@ -94,6 +86,12 @@ namespace musik{ namespace core{
|
||||
|
||||
void CopyTracks(musik::core::tracklist::IRandomAccess &tracklist);
|
||||
void AppendTracks(musik::core::tracklist::IRandomAccess &tracklist);
|
||||
|
||||
typedef sigslot::signal1<bool> TracksEvent;
|
||||
TracksEvent OnTracks;
|
||||
typedef sigslot::signal1<std::vector<int>&> TrackMetaEvent;
|
||||
TrackMetaEvent OnTrackMeta;
|
||||
|
||||
protected:
|
||||
|
||||
musik::core::TrackPtr Track(int position);
|
||||
|
@ -43,6 +43,8 @@
|
||||
#include <pch.hpp>
|
||||
#include <cube/SourcesModel.hpp>
|
||||
|
||||
#include <core/PlaybackQueue.h>
|
||||
|
||||
using namespace musik::cube;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -110,7 +112,7 @@ private: BrowseController controller;
|
||||
class NowPlayingItem: public SourcesItem
|
||||
{
|
||||
private: /*ctor*/ NowPlayingItem()
|
||||
: controller(view)
|
||||
: controller(view,NULL,musik::core::PlaybackQueue::Instance().NowPlayingTracklist())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -47,9 +47,9 @@ using namespace musik::cube;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*ctor*/ TracklistController::TracklistController(TracklistView& view,musik::core::Query::ListBase *connectedQuery)
|
||||
/*ctor*/ TracklistController::TracklistController(TracklistView& view,musik::core::Query::ListBase *connectedQuery,musik::core::tracklist::Standard::Ptr tracklist)
|
||||
: view(view)
|
||||
, model(new TracklistModel(connectedQuery))
|
||||
, model(new TracklistModel(connectedQuery,tracklist))
|
||||
{
|
||||
this->view.Handle()
|
||||
? this->OnViewCreated()
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include <core/config.h>
|
||||
#include <cube/TracklistView.hpp>
|
||||
#include <core/Query/ListBase.h>
|
||||
#include <core/tracklist/Standard.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -62,7 +63,7 @@ private: typedef ListView::ColumnRef ColumnRef;
|
||||
private: typedef std::vector<ColumnRef> ColumnList;
|
||||
private: typedef ListView::ModelRef ModelRef;
|
||||
|
||||
public: /*ctor*/ TracklistController(TracklistView& listView,musik::core::Query::ListBase *connectedQuery=NULL);
|
||||
public: /*ctor*/ TracklistController(TracklistView& listView,musik::core::Query::ListBase *connectedQuery=NULL,musik::core::tracklist::Standard::Ptr tracklist=musik::core::tracklist::Standard::Ptr() );
|
||||
|
||||
protected: void OnViewCreated();
|
||||
protected: void OnResized(Size size);
|
||||
|
@ -52,9 +52,14 @@ using namespace musik::cube;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*ctor*/ TracklistModel::TracklistModel(musik::core::Query::ListBase *connectedQuery) :
|
||||
tracklist(new musik::core::tracklist::Standard())
|
||||
/*ctor*/ TracklistModel::TracklistModel(musik::core::Query::ListBase *connectedQuery,musik::core::tracklist::Standard::Ptr setTracklist)
|
||||
{
|
||||
if(setTracklist){
|
||||
this->tracklist = setTracklist;
|
||||
}else{
|
||||
this->tracklist.reset( new musik::core::tracklist::Standard() );
|
||||
}
|
||||
|
||||
this->SetRowCount(0);
|
||||
|
||||
this->tracklist->OnTracks.connect(this,&TracklistModel::OnTracks);
|
||||
|
@ -59,7 +59,7 @@ public: typedef ListView::CellRendererRef CellRendererRef;
|
||||
public: typedef ListView::ColumnRef ColumnRef;
|
||||
|
||||
// public API
|
||||
public: /*ctor*/ TracklistModel(musik::core::Query::ListBase *connectedQuery);
|
||||
public: /*ctor*/ TracklistModel(musik::core::Query::ListBase *connectedQuery,musik::core::tracklist::Standard::Ptr setTracklist);
|
||||
|
||||
// ListView::Model implementation
|
||||
public: virtual uistring CellValueToString(int rowIndex, ColumnRef column);
|
||||
|
Loading…
Reference in New Issue
Block a user