PlayQueue: play/add the whole track list if no selection performed
This commit is contained in:
@@ -140,6 +140,10 @@ _mediaPlayer(nullptr)
|
||||
std::vector<Database::Track::id_type> trackIds;
|
||||
trackView->getSelectedTracks(trackIds);
|
||||
|
||||
// If nothing is selected, get the whole track list
|
||||
if (trackIds.empty())
|
||||
trackView->getTracks(trackIds);
|
||||
|
||||
playQueue->clear();
|
||||
playQueue->addTracks(trackIds);
|
||||
|
||||
@@ -153,6 +157,10 @@ _mediaPlayer(nullptr)
|
||||
std::vector<Database::Track::id_type> trackIds;
|
||||
trackView->getSelectedTracks(trackIds);
|
||||
|
||||
// If nothing is selected, get the whole track list
|
||||
if (trackIds.empty())
|
||||
trackView->getTracks(trackIds);
|
||||
|
||||
playQueue->addTracks(trackIds);
|
||||
}));
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ PlayQueue::addTracks(const std::vector<Database::Track::id_type>& trackIds)
|
||||
|
||||
_model->setData(dataRow, 0, track.id());
|
||||
_model->setData(dataRow, 1, dataRow + 1);
|
||||
_model->setData(dataRow, 2, track->getName());
|
||||
_model->setData(dataRow, 2, track->getArtist()->getName() + " - " + track->getName());
|
||||
_model->setData(dataRow, 3, track->getDuration());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,5 +171,23 @@ TrackView::getSelectedTracks(std::vector<Database::Track::id_type>& track_ids)
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Getting all selected tracks DONE...";
|
||||
}
|
||||
|
||||
void
|
||||
TrackView::getTracks(std::vector<Database::Track::id_type>& trackIds)
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Getting all tracks...";
|
||||
|
||||
for (int i = 0; i < _queryModel.rowCount(); ++i)
|
||||
{
|
||||
const ResultType& result = _queryModel.resultRow( i );
|
||||
|
||||
// Get the track part
|
||||
Wt::Dbo::ptr<Database::Track> track ( result.get<0>() );
|
||||
|
||||
trackIds.push_back(track.id());
|
||||
}
|
||||
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Getting all tracks done!";
|
||||
}
|
||||
|
||||
} // namespace UserInterface
|
||||
|
||||
|
||||
@@ -44,9 +44,12 @@ class TrackView : public Wt::WTableView, public Filter
|
||||
void getConstraint(Constraint& constraint) {}
|
||||
|
||||
|
||||
// Get all the tracks that are currently displayed
|
||||
// Get all the tracks that are currently selected
|
||||
void getSelectedTracks(std::vector<Database::Track::id_type>& track_ids);
|
||||
|
||||
// Get all the tracks
|
||||
void getTracks(std::vector<Database::Track::id_type>& track_ids);
|
||||
|
||||
typedef Wt::Signal<void> SigTrackDoubleClicked;
|
||||
|
||||
SigTrackDoubleClicked& trackDoubleClicked() { return _sigTrackDoubleClicked; }
|
||||
|
||||
Reference in New Issue
Block a user