mirror of
https://github.com/clementine-player/Clementine
synced 2025-02-02 20:36:44 +01:00
Use InternetSongMimeData in global search when possible (i.e. for search providers which have an Internet service)
This commit is contained in:
parent
45104adca9
commit
a8ce1ba17b
@ -23,7 +23,6 @@
|
||||
#include "core/logging.h"
|
||||
#include "covers/albumcoverloader.h"
|
||||
#include "internet/groovesharkservice.h"
|
||||
#include "internet/internetsongmimedata.h"
|
||||
|
||||
GroovesharkSearchProvider::GroovesharkSearchProvider(Application* app, QObject* parent)
|
||||
: SearchProvider(app, parent),
|
||||
|
@ -20,9 +20,9 @@
|
||||
|
||||
#include "searchprovider.h"
|
||||
#include "covers/albumcoverloaderoptions.h"
|
||||
#include "internet/groovesharkservice.h"
|
||||
|
||||
class AlbumCoverLoader;
|
||||
class GroovesharkService;
|
||||
|
||||
class GroovesharkSearchProvider : public SearchProvider {
|
||||
Q_OBJECT
|
||||
@ -36,6 +36,7 @@ class GroovesharkSearchProvider : public SearchProvider {
|
||||
void LoadArtAsync(int id, const Result& result);
|
||||
bool IsLoggedIn();
|
||||
void ShowConfig();
|
||||
InternetService* internet_service() { return service_; }
|
||||
|
||||
private slots:
|
||||
void SearchDone(int id, const SongList& songs);
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "searchprovider.h"
|
||||
#include "core/boundfuturewatcher.h"
|
||||
#include "internet/internetsongmimedata.h"
|
||||
#include "playlist/songmimedata.h"
|
||||
|
||||
#include <QPainter>
|
||||
@ -130,11 +131,19 @@ MimeData* SearchProvider::LoadTracks(const ResultList& results) {
|
||||
if (mime_data_contains_urls_only()) {
|
||||
mime_data = new MimeData;
|
||||
} else {
|
||||
SongMimeData* song_mime_data = new SongMimeData;
|
||||
mime_data = song_mime_data;
|
||||
|
||||
SongList songs;
|
||||
foreach (const Result& result, results) {
|
||||
song_mime_data->songs << result.metadata_;
|
||||
songs << result.metadata_;
|
||||
}
|
||||
|
||||
if (internet_service()) {
|
||||
InternetSongMimeData* internet_song_mime_data = new InternetSongMimeData(internet_service());
|
||||
internet_song_mime_data->songs = songs;
|
||||
mime_data = internet_song_mime_data;
|
||||
} else {
|
||||
SongMimeData* song_mime_data = new SongMimeData;
|
||||
song_mime_data->songs = songs;
|
||||
mime_data = song_mime_data;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
class Application;
|
||||
class MimeData;
|
||||
class InternetService;
|
||||
|
||||
|
||||
class SearchProvider : public QObject {
|
||||
@ -138,6 +139,9 @@ public:
|
||||
// be reimplemented
|
||||
virtual bool IsLoggedIn() { return true; }
|
||||
virtual void ShowConfig() { } // Remember to set the CanShowConfig hint
|
||||
// Returns the Internet service in charge of this provider, or NULL if there
|
||||
// is none
|
||||
virtual InternetService* internet_service() { return NULL; }
|
||||
|
||||
static QImage ScaleAndPad(const QImage& image);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user