diff -urN ./mixxx-1.10.0final/src/widget/wtracktableview.cpp ./mixxx-1.10.0/src/widget/wtracktableview.cpp --- ./mixxx-1.10.0final/src/widget/wtracktableview.cpp 2011-12-24 08:23:20.000000000 +0530 +++ ./mixxx-1.10.0/src/widget/wtracktableview.cpp 2012-02-17 23:54:12.601950874 +0530 @@ -261,6 +261,10 @@ m_pReloadMetadataAct = new QAction(tr("Reload Track Metadata"), this); connect(m_pReloadMetadataAct, SIGNAL(triggered()), this, SLOT(slotReloadTrackMetadata())); + + m_pResetPlayed = new QAction(tr("Reset Played Count"), this); + connect(m_pResetPlayed, SIGNAL(triggered()), this, SLOT(slotResetPlayed())); + } void WTrackTableView::slotMouseDoubleClicked(const QModelIndex &index) { @@ -310,6 +314,25 @@ } } +void WTrackTableView::slotResetPlayed(){ + //qDebug()<<"slotResetPlayed called"; + QModelIndexList indices = selectionModel()->selectedRows(); + + TrackModel* trackModel = getTrackModel(); + + if (trackModel == NULL) { + return; + } + + foreach (QModelIndex index, indices) { + TrackPointer pTrack = trackModel->getTrack(index); + if (pTrack) { + pTrack->setTimesPlayed(0); + } + } + +} + void WTrackTableView::slotShowTrackInfo() { QModelIndexList indices = selectionModel()->selectedRows(); @@ -453,6 +476,12 @@ m_pPropertiesAct->setEnabled(oneSongSelected); m_pMenu->addAction(m_pPropertiesAct); + if(modelHasCapabilities(TrackModel::TRACKMODELCAPS_RESETPLAYED)){ + m_pMenu->addAction(m_pResetPlayed); + } + else{ + qDebug()<<"Couldnt get flag i guess"; + } //Create the right-click menu m_pMenu->popup(event->globalPos()); } diff -urN ./mixxx-1.10.0final/src/widget/wtracktableview.h ./mixxx-1.10.0/src/widget/wtracktableview.h --- ./mixxx-1.10.0final/src/widget/wtracktableview.h 2011-12-24 08:23:20.000000000 +0530 +++ ./mixxx-1.10.0/src/widget/wtracktableview.h 2012-02-16 17:21:01.537726060 +0530 @@ -46,6 +46,7 @@ void slotNextTrackInfo(); void slotPrevTrackInfo(); void slotSendToAutoDJ(); + void slotResetPlayed(); void slotReloadTrackMetadata(); void addSelectionToPlaylist(int iPlaylistId); void addSelectionToCrate(int iCrateId); @@ -95,6 +96,9 @@ // Show track-editor action QAction *m_pPropertiesAct; + + //Reset played count action + QAction *m_pResetPlayed; }; #endif