1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-04 21:27:58 +02:00

* RecentlyPlayedModel can now deal with date ranges.

This commit is contained in:
Christian Muehlhaeuser
2013-06-08 10:20:24 +02:00
parent 99e331d8cd
commit 00de575744
2 changed files with 22 additions and 0 deletions

View File

@@ -56,6 +56,8 @@ RecentlyPlayedModel::loadHistory()
startLoading(); startLoading();
DatabaseCommand_PlaybackHistory* cmd = new DatabaseCommand_PlaybackHistory( m_source ); DatabaseCommand_PlaybackHistory* cmd = new DatabaseCommand_PlaybackHistory( m_source );
cmd->setDateFrom( m_dateFrom );
cmd->setDateTo( m_dateTo );
cmd->setLimit( m_limit ); cmd->setLimit( m_limit );
connect( cmd, SIGNAL( tracks( QList<Tomahawk::track_ptr>, QList<Tomahawk::PlaybackLog> ) ), connect( cmd, SIGNAL( tracks( QList<Tomahawk::track_ptr>, QList<Tomahawk::PlaybackLog> ) ),
@@ -150,3 +152,18 @@ RecentlyPlayedModel::isTemporary() const
{ {
return true; return true;
} }
void
RecentlyPlayedModel::setDateFrom( const QDate& date )
{
m_dateFrom = date;
}
void
RecentlyPlayedModel::setDateTo( const QDate& date )
{
m_dateTo = date;
loadHistory();
}

View File

@@ -20,6 +20,7 @@
#define RECENTLYPLAYEDMODEL_H #define RECENTLYPLAYEDMODEL_H
#include <QList> #include <QList>
#include <QDate>
#include <QHash> #include <QHash>
#include "Typedefs.h" #include "Typedefs.h"
@@ -42,6 +43,8 @@ public:
public slots: public slots:
void setSource( const Tomahawk::source_ptr& source ); void setSource( const Tomahawk::source_ptr& source );
void setDateFrom( const QDate& date );
void setDateTo( const QDate& date );
private slots: private slots:
void onSourcesReady(); void onSourcesReady();
@@ -53,6 +56,8 @@ private slots:
private: private:
Tomahawk::source_ptr m_source; Tomahawk::source_ptr m_source;
unsigned int m_limit; unsigned int m_limit;
QDate m_dateFrom;
QDate m_dateTo;
}; };
#endif // RECENTLYPLAYEDMODEL_H #endif // RECENTLYPLAYEDMODEL_H