mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 21:57:41 +02:00
Modernize DatabaseCommand_AllTracks
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
#include "SourceList.h"
|
||||
#include "Track.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
namespace Tomahawk
|
||||
{
|
||||
|
||||
@@ -100,7 +102,7 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
|
||||
|
||||
// Small cache to keep already created source objects.
|
||||
// This saves some mutex locking.
|
||||
std::map<uint, Tomahawk::source_ptr> sourceCache;
|
||||
std::unordered_map<uint, Tomahawk::source_ptr> sourceCache;
|
||||
|
||||
while( query.next() )
|
||||
{
|
||||
@@ -119,7 +121,7 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
|
||||
uint albumpos = query.value( 13 ).toUInt();
|
||||
uint trackId = query.value( 14 ).toUInt();
|
||||
|
||||
std::map<uint, Tomahawk::source_ptr>::const_iterator _s = sourceCache.find( sourceId );
|
||||
std::unordered_map<uint, Tomahawk::source_ptr>::const_iterator _s = sourceCache.find( sourceId );
|
||||
Tomahawk::source_ptr s;
|
||||
if ( _s == sourceCache.end() )
|
||||
{
|
||||
|
@@ -47,22 +47,22 @@ public:
|
||||
AlbumPosition = 3
|
||||
};
|
||||
|
||||
explicit DatabaseCommand_AllTracks( const Tomahawk::collection_ptr& collection = Tomahawk::collection_ptr(), QObject* parent = 0 )
|
||||
explicit DatabaseCommand_AllTracks( const Tomahawk::collection_ptr& collection = Tomahawk::collection_ptr(), QObject* parent = nullptr )
|
||||
: DatabaseCommand( parent )
|
||||
, m_collection( collection )
|
||||
, m_artist( 0 )
|
||||
, m_album( 0 )
|
||||
, m_artist( nullptr )
|
||||
, m_album( nullptr )
|
||||
, m_amount( 0 )
|
||||
, m_sortOrder( DatabaseCommand_AllTracks::None )
|
||||
, m_sortDescending( false )
|
||||
{}
|
||||
|
||||
virtual void exec( DatabaseImpl* );
|
||||
void exec( DatabaseImpl* ) override;
|
||||
|
||||
virtual bool doesMutates() const { return false; }
|
||||
virtual QString commandname() const { return "alltracks"; }
|
||||
bool doesMutates() const override { return false; }
|
||||
QString commandname() const override { return "alltracks"; }
|
||||
|
||||
virtual void enqueue() { Database::instance()->enqueue( Tomahawk::dbcmd_ptr( this ) ); }
|
||||
void enqueue() override { Database::instance()->enqueue( Tomahawk::dbcmd_ptr( this ) ); }
|
||||
|
||||
void setArtist( const Tomahawk::artist_ptr& artist ) { m_artist = artist; }
|
||||
void setAlbum( const Tomahawk::album_ptr& album ) { m_album = album; }
|
||||
|
Reference in New Issue
Block a user