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