当前位置: 首页>>代码示例>>C++>>正文


C++ TrackPointer::setPlayedAndUpdatePlaycount方法代码示例

本文整理汇总了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);
        }
    }
}
开发者ID:happysoftcore,项目名称:mixxx,代码行数:50,代码来源:setlogfeature.cpp


注:本文中的TrackPointer::setPlayedAndUpdatePlaycount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。