mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-01 17:58:29 +00:00
Started testing highlight of current position in tracklists.
This commit is contained in:
parent
a440be19aa
commit
41769da567
@ -94,6 +94,9 @@ namespace musik{ namespace core{
|
||||
|
||||
typedef sigslot::signal1<std::vector<int>&> TrackMetaEvent;
|
||||
TrackMetaEvent TrackMetaUpdated;
|
||||
|
||||
typedef sigslot::signal2<int,int> PositionChangedEvent;
|
||||
PositionChangedEvent PositionChanged;
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<IRandomAccess> Ptr;
|
||||
|
@ -93,6 +93,7 @@ int Standard::Size(){
|
||||
|
||||
|
||||
void Standard::SetCurrentPosition(int position){
|
||||
int lastPosition(this->currentPosition);
|
||||
if(position<-1){
|
||||
this->currentPosition = -1;
|
||||
}else{
|
||||
@ -102,6 +103,9 @@ void Standard::SetCurrentPosition(int position){
|
||||
this->currentPosition = position;
|
||||
}
|
||||
}
|
||||
if(this->currentPosition!=lastPosition){
|
||||
this->PositionChanged(this->currentPosition,lastPosition);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,12 +45,12 @@
|
||||
#include <cube/TracklistColumn.hpp>
|
||||
|
||||
#include <win32cpp/Utility.hpp>
|
||||
#include <win32cpp/ApplicationThread.hpp>
|
||||
|
||||
#include <core/LibraryFactory.h>
|
||||
#include <core/PlaybackQueue.h>
|
||||
#include <core/MetaKey.h>
|
||||
#include <core/tracklist/Standard.h>
|
||||
|
||||
#include <core/tracklist/IRandomAccess.h>
|
||||
|
||||
|
||||
using namespace musik::cube;
|
||||
@ -58,6 +58,7 @@ using namespace musik::cube;
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*ctor*/ TracklistModel::TracklistModel(musik::core::Query::ListBase *connectedQuery,musik::core::tracklist::Ptr setTracklist)
|
||||
: currentPosition(-1)
|
||||
{
|
||||
|
||||
this->tracklist = setTracklist;
|
||||
@ -66,7 +67,7 @@ using namespace musik::cube;
|
||||
|
||||
this->tracklist->TracksUpdated.connect(this,&TracklistModel::OnTracks);
|
||||
this->tracklist->TrackMetaUpdated.connect(this,&TracklistModel::OnTrackMeta);
|
||||
// this->tracklist->SetLibrary(musik::core::LibraryFactory::GetCurrentLibrary());
|
||||
this->tracklist->PositionChanged.connect(this,&TracklistModel::OnPositionChanged);
|
||||
|
||||
this->ConnectToQuery(connectedQuery);
|
||||
}
|
||||
@ -100,6 +101,9 @@ uistring TracklistModel::CellValueToString(int rowIndex, ColumnRef co
|
||||
result += boost::lexical_cast<utfstring>(duration);
|
||||
return win32cpp::Escape(result);
|
||||
break;
|
||||
}
|
||||
if(rowIndex==this->currentPosition){
|
||||
return win32cpp::Escape(value)+_T("***");
|
||||
}
|
||||
return win32cpp::Escape(value);
|
||||
}
|
||||
@ -131,3 +135,18 @@ void TracklistModel::ConnectToQuery(musik::core::Query::ListBase *connectedQuery
|
||||
this->tracklist->ConnectToQuery(*connectedQuery);
|
||||
}
|
||||
}
|
||||
|
||||
void TracklistModel::OnPositionChanged(int activeRow,int oldActiveRow){
|
||||
if(!win32cpp::ApplicationThread::InMainThread()){
|
||||
win32cpp::ApplicationThread::Call2(this,&TracklistModel::OnPositionChanged,activeRow,oldActiveRow);
|
||||
return;
|
||||
}
|
||||
|
||||
if(activeRow!=-1){
|
||||
this->InvalidateData(activeRow);
|
||||
}
|
||||
if(oldActiveRow!=-1){
|
||||
this->InvalidateData(oldActiveRow);
|
||||
}
|
||||
this->currentPosition = activeRow;
|
||||
}
|
||||
|
@ -79,6 +79,9 @@ public: virtual uistring CellValueToString(int rowIndex, ColumnRef column);
|
||||
// instance data
|
||||
protected: void OnTrackMeta(std::vector<int> &trackPositions);
|
||||
protected: void OnTracks(bool cleared);
|
||||
protected: void OnPositionChanged(int activeRow,int oldActiveRow);
|
||||
protected: int currentPosition;
|
||||
|
||||
public: musik::core::tracklist::Ptr tracklist; // FIXME: no public fields!
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user