本文整理汇总了C++中TrackPointer::setPlayedAndUpdatePlaycount方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackPointer::setPlayedAndUpdatePlaycount方法的具体用法?C++ TrackPointer::setPlayedAndUpdatePlaycount怎么用?C++ TrackPointer::setPlayedAndUpdatePlaycount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrackPointer
的用法示例。
在下文中一共展示了TrackPointer::setPlayedAndUpdatePlaycount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotPlayingDeckChanged
void SetlogFeature::slotPlayingDeckChanged(int deck) {
if (deck > -1) {
QString chan = PlayerManager::groupForDeck(deck);
TrackPointer currentPlayingTrack =
PlayerInfo::instance().getTrackInfo(chan);
if (!currentPlayingTrack) {
return;
}
int currentPlayingTrackId = currentPlayingTrack->getId();
bool track_played_recently = false;
if (currentPlayingTrackId >= 0) {
// Remove the track from the recent tracks list if it's present and put
// at the front of the list.
track_played_recently = m_recentTracks.removeOne(currentPlayingTrackId);
m_recentTracks.push_front(currentPlayingTrackId);
// Keep a window of 6 tracks (inspired by 2 decks, 4 samplers)
const int kRecentTrackWindow = 6;
while (m_recentTracks.size() > kRecentTrackWindow) {
m_recentTracks.pop_back();
}
}
// If the track was recently played, don't increment the playcount or
// add it to the history.
if (track_played_recently) {
return;
}
// If the track is not present in the recent tracks list, mark it
// played and update its playcount.
currentPlayingTrack->setPlayedAndUpdatePlaycount(true);
// We can only add tracks that are Mixxx library tracks, not external
// sources.
if (currentPlayingTrackId < 0) {
return;
}
if (m_pPlaylistTableModel->getPlaylist() == m_playlistId) {
// View needs a refresh
m_pPlaylistTableModel->appendTrack(currentPlayingTrackId);
} else {
// TODO(XXX): Care whether the append succeeded.
m_playlistDao.appendTrackToPlaylist(currentPlayingTrackId,
m_playlistId);
}
}
}