Rename "Internet" to "Streaming"

This commit is contained in:
Jonas Kvinge
2024-06-12 22:23:05 +02:00
parent 718af984ab
commit 299415a889
49 changed files with 615 additions and 615 deletions

View File

@@ -256,18 +256,18 @@ set(SOURCES
osd/osdbase.cpp osd/osdbase.cpp
osd/osdpretty.cpp osd/osdpretty.cpp
internet/internetservices.cpp streaming/streamingservices.cpp
internet/internetservice.cpp streaming/streamingservice.cpp
internet/internetplaylistitem.cpp streaming/streamplaylistitem.cpp
internet/internetsearchview.cpp streaming/streamingsearchview.cpp
internet/internetsearchmodel.cpp streaming/streamingsearchmodel.cpp
internet/internetsearchsortmodel.cpp streaming/streamingsearchsortmodel.cpp
internet/internetsearchitemdelegate.cpp streaming/streamingsearchitemdelegate.cpp
internet/internetsongsview.cpp streaming/streamingsongsview.cpp
internet/internettabsview.cpp streaming/streamingtabsview.cpp
internet/internetcollectionview.cpp streaming/streamingcollectionview.cpp
internet/internetcollectionviewcontainer.cpp streaming/streamingcollectionviewcontainer.cpp
internet/internetsearchview.cpp streaming/streamingsearchview.cpp
radios/radioservices.cpp radios/radioservices.cpp
radios/radiobackend.cpp radios/radiobackend.cpp
@@ -503,17 +503,17 @@ set(HEADERS
osd/osdbase.h osd/osdbase.h
osd/osdpretty.h osd/osdpretty.h
internet/internetservices.h streaming/streamingservices.h
internet/internetservice.h streaming/streamingservice.h
internet/internetsongmimedata.h streaming/streamsongmimedata.h
internet/internetsearchmodel.h streaming/streamingsearchmodel.h
internet/internetsearchsortmodel.h streaming/streamingsearchsortmodel.h
internet/internetsearchitemdelegate.h streaming/streamingsearchitemdelegate.h
internet/internetsearchview.h streaming/streamingsearchview.h
internet/internetsongsview.h streaming/streamingsongsview.h
internet/internettabsview.h streaming/streamingtabsview.h
internet/internetcollectionview.h streaming/streamingcollectionview.h
internet/internetcollectionviewcontainer.h streaming/streamingcollectionviewcontainer.h
radios/radioservices.h radios/radioservices.h
radios/radiobackend.h radios/radiobackend.h
@@ -604,9 +604,9 @@ set(UI
osd/osdpretty.ui osd/osdpretty.ui
internet/internettabsview.ui streaming/streamingtabsview.ui
internet/internetcollectionviewcontainer.ui streaming/streamingcollectionviewcontainer.ui
internet/internetsearchview.ui streaming/streamingsearchview.ui
radios/radioviewcontainer.ui radios/radioviewcontainer.ui

View File

@@ -79,7 +79,7 @@
# include "scrobbler/subsonicscrobbler.h" # include "scrobbler/subsonicscrobbler.h"
#endif #endif
#include "internet/internetservices.h" #include "streaming/streamingservices.h"
#ifdef HAVE_SUBSONIC #ifdef HAVE_SUBSONIC
# include "subsonic/subsonicservice.h" # include "subsonic/subsonicservice.h"
@@ -175,18 +175,18 @@ class ApplicationImpl {
lyrics_providers->ReloadSettings(); lyrics_providers->ReloadSettings();
return lyrics_providers; return lyrics_providers;
}), }),
internet_services_([app]() { streaming_services_([app]() {
InternetServices *internet_services = new InternetServices(); StreamingServices *streaming_services = new StreamingServices();
#ifdef HAVE_SUBSONIC #ifdef HAVE_SUBSONIC
internet_services->AddService(make_shared<SubsonicService>(app)); streaming_services->AddService(make_shared<SubsonicService>(app));
#endif #endif
#ifdef HAVE_TIDAL #ifdef HAVE_TIDAL
internet_services->AddService(make_shared<TidalService>(app)); streaming_services->AddService(make_shared<TidalService>(app));
#endif #endif
#ifdef HAVE_QOBUZ #ifdef HAVE_QOBUZ
internet_services->AddService(make_shared<QobuzService>(app)); streaming_services->AddService(make_shared<QobuzService>(app));
#endif #endif
return internet_services; return streaming_services;
}), }),
radio_services_([app]() { return new RadioServices(app); }), radio_services_([app]() { return new RadioServices(app); }),
scrobbler_([app]() { scrobbler_([app]() {
@@ -222,7 +222,7 @@ class ApplicationImpl {
Lazy<AlbumCoverLoader> album_cover_loader_; Lazy<AlbumCoverLoader> album_cover_loader_;
Lazy<CurrentAlbumCoverLoader> current_albumcover_loader_; Lazy<CurrentAlbumCoverLoader> current_albumcover_loader_;
Lazy<LyricsProviders> lyrics_providers_; Lazy<LyricsProviders> lyrics_providers_;
Lazy<InternetServices> internet_services_; Lazy<StreamingServices> streaming_services_;
Lazy<RadioServices> radio_services_; Lazy<RadioServices> radio_services_;
Lazy<AudioScrobbler> scrobbler_; Lazy<AudioScrobbler> scrobbler_;
#ifdef HAVE_MOODBAR #ifdef HAVE_MOODBAR
@@ -287,7 +287,7 @@ void Application::Exit() {
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
<< &*device_manager() << &*device_manager()
#endif #endif
<< &*internet_services() << &*streaming_services()
<< &*radio_services()->radio_backend(); << &*radio_services()->radio_backend();
QObject::connect(&*tag_reader_client(), &TagReaderClient::ExitFinished, this, &Application::ExitReceived); QObject::connect(&*tag_reader_client(), &TagReaderClient::ExitFinished, this, &Application::ExitReceived);
@@ -307,8 +307,8 @@ void Application::Exit() {
device_manager()->Exit(); device_manager()->Exit();
#endif #endif
QObject::connect(&*internet_services(), &InternetServices::ExitFinished, this, &Application::ExitReceived); QObject::connect(&*streaming_services(), &StreamingServices::ExitFinished, this, &Application::ExitReceived);
internet_services()->Exit(); streaming_services()->Exit();
QObject::connect(&*radio_services()->radio_backend(), &RadioBackend::ExitFinished, this, &Application::ExitReceived); QObject::connect(&*radio_services()->radio_backend(), &RadioBackend::ExitFinished, this, &Application::ExitReceived);
radio_services()->radio_backend()->ExitAsync(); radio_services()->radio_backend()->ExitAsync();
@@ -353,7 +353,7 @@ SharedPtr<CurrentAlbumCoverLoader> Application::current_albumcover_loader() cons
SharedPtr<LyricsProviders> Application::lyrics_providers() const { return p_->lyrics_providers_.ptr(); } SharedPtr<LyricsProviders> Application::lyrics_providers() const { return p_->lyrics_providers_.ptr(); }
SharedPtr<PlaylistBackend> Application::playlist_backend() const { return p_->playlist_backend_.ptr(); } SharedPtr<PlaylistBackend> Application::playlist_backend() const { return p_->playlist_backend_.ptr(); }
SharedPtr<PlaylistManager> Application::playlist_manager() const { return p_->playlist_manager_.ptr(); } SharedPtr<PlaylistManager> Application::playlist_manager() const { return p_->playlist_manager_.ptr(); }
SharedPtr<InternetServices> Application::internet_services() const { return p_->internet_services_.ptr(); } SharedPtr<StreamingServices> Application::streaming_services() const { return p_->streaming_services_.ptr(); }
SharedPtr<RadioServices> Application::radio_services() const { return p_->radio_services_.ptr(); } SharedPtr<RadioServices> Application::radio_services() const { return p_->radio_services_.ptr(); }
SharedPtr<AudioScrobbler> Application::scrobbler() const { return p_->scrobbler_.ptr(); } SharedPtr<AudioScrobbler> Application::scrobbler() const { return p_->scrobbler_.ptr(); }
SharedPtr<LastFMImport> Application::lastfm_import() const { return p_->lastfm_import_.ptr(); } SharedPtr<LastFMImport> Application::lastfm_import() const { return p_->lastfm_import_.ptr(); }

View File

@@ -58,7 +58,7 @@ class CoverProviders;
class LyricsProviders; class LyricsProviders;
class AudioScrobbler; class AudioScrobbler;
class LastFMImport; class LastFMImport;
class InternetServices; class StreamingServices;
class RadioServices; class RadioServices;
#ifdef HAVE_MOODBAR #ifdef HAVE_MOODBAR
class MoodbarController; class MoodbarController;
@@ -97,7 +97,7 @@ class Application : public QObject {
SharedPtr<AudioScrobbler> scrobbler() const; SharedPtr<AudioScrobbler> scrobbler() const;
SharedPtr<InternetServices> internet_services() const; SharedPtr<StreamingServices> streaming_services() const;
SharedPtr<RadioServices> radio_services() const; SharedPtr<RadioServices> radio_services() const;
#ifdef HAVE_MOODBAR #ifdef HAVE_MOODBAR

View File

@@ -182,12 +182,12 @@
# include "settings/qobuzsettingspage.h" # include "settings/qobuzsettingspage.h"
#endif #endif
#include "internet/internetservices.h" #include "streaming/streamingservices.h"
#include "internet/internetservice.h" #include "streaming/streamingservice.h"
#include "internet/internetsongsview.h" #include "streaming/streamingsongsview.h"
#include "internet/internettabsview.h" #include "streaming/streamingtabsview.h"
#include "internet/internetcollectionview.h" #include "streaming/streamingcollectionview.h"
#include "internet/internetsearchview.h" #include "streaming/streamingsearchview.h"
#include "radios/radioservices.h" #include "radios/radioservices.h"
#include "radios/radioviewcontainer.h" #include "radios/radioviewcontainer.h"
@@ -303,13 +303,13 @@ MainWindow::MainWindow(Application *app, SharedPtr<SystemTrayIcon> tray_icon, OS
}), }),
smartplaylists_view_(new SmartPlaylistsViewContainer(app, this)), smartplaylists_view_(new SmartPlaylistsViewContainer(app, this)),
#ifdef HAVE_SUBSONIC #ifdef HAVE_SUBSONIC
subsonic_view_(new InternetSongsView(app_, app->internet_services()->ServiceBySource(Song::Source::Subsonic), QLatin1String(SubsonicSettingsPage::kSettingsGroup), SettingsDialog::Page::Subsonic, this)), subsonic_view_(new StreamingSongsView(app_, app->streaming_services()->ServiceBySource(Song::Source::Subsonic), QLatin1String(SubsonicSettingsPage::kSettingsGroup), SettingsDialog::Page::Subsonic, this)),
#endif #endif
#ifdef HAVE_TIDAL #ifdef HAVE_TIDAL
tidal_view_(new InternetTabsView(app_, app->internet_services()->ServiceBySource(Song::Source::Tidal), QLatin1String(TidalSettingsPage::kSettingsGroup), SettingsDialog::Page::Tidal, this)), tidal_view_(new StreamingTabsView(app_, app->streaming_services()->ServiceBySource(Song::Source::Tidal), QLatin1String(TidalSettingsPage::kSettingsGroup), SettingsDialog::Page::Tidal, this)),
#endif #endif
#ifdef HAVE_QOBUZ #ifdef HAVE_QOBUZ
qobuz_view_(new InternetTabsView(app_, app->internet_services()->ServiceBySource(Song::Source::Qobuz), QLatin1String(QobuzSettingsPage::kSettingsGroup), SettingsDialog::Page::Qobuz, this)), qobuz_view_(new StreamingTabsView(app_, app->streaming_services()->ServiceBySource(Song::Source::Qobuz), QLatin1String(QobuzSettingsPage::kSettingsGroup), SettingsDialog::Page::Qobuz, this)),
#endif #endif
radio_view_(new RadioViewContainer(this)), radio_view_(new RadioViewContainer(this)),
lastfm_import_dialog_(new LastFMImportDialog(app_->lastfm_import(), this)), lastfm_import_dialog_(new LastFMImportDialog(app_->lastfm_import(), this)),
@@ -694,24 +694,24 @@ MainWindow::MainWindow(Application *app, SharedPtr<SystemTrayIcon> tray_icon, OS
collection_view_->filter_widget()->AddMenuAction(collection_config_action); collection_view_->filter_widget()->AddMenuAction(collection_config_action);
#ifdef HAVE_SUBSONIC #ifdef HAVE_SUBSONIC
QObject::connect(subsonic_view_->view(), &InternetCollectionView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist); QObject::connect(subsonic_view_->view(), &StreamingCollectionView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist);
#endif #endif
#ifdef HAVE_TIDAL #ifdef HAVE_TIDAL
QObject::connect(tidal_view_->artists_collection_view(), &InternetCollectionView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist); QObject::connect(tidal_view_->artists_collection_view(), &StreamingCollectionView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist);
QObject::connect(tidal_view_->albums_collection_view(), &InternetCollectionView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist); QObject::connect(tidal_view_->albums_collection_view(), &StreamingCollectionView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist);
QObject::connect(tidal_view_->songs_collection_view(), &InternetCollectionView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist); QObject::connect(tidal_view_->songs_collection_view(), &StreamingCollectionView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist);
QObject::connect(tidal_view_->search_view(), &InternetSearchView::AddToPlaylist, this, &MainWindow::AddToPlaylist); QObject::connect(tidal_view_->search_view(), &StreamingSearchView::AddToPlaylist, this, &MainWindow::AddToPlaylist);
if (TidalServicePtr tidalservice = app_->internet_services()->Service<TidalService>()) { if (TidalServicePtr tidalservice = app_->streaming_services()->Service<TidalService>()) {
QObject::connect(this, &MainWindow::AuthorizationUrlReceived, &*tidalservice, &TidalService::AuthorizationUrlReceived); QObject::connect(this, &MainWindow::AuthorizationUrlReceived, &*tidalservice, &TidalService::AuthorizationUrlReceived);
} }
#endif #endif
#ifdef HAVE_QOBUZ #ifdef HAVE_QOBUZ
QObject::connect(qobuz_view_->artists_collection_view(), &InternetCollectionView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist); QObject::connect(qobuz_view_->artists_collection_view(), &StreamingCollectionView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist);
QObject::connect(qobuz_view_->albums_collection_view(), &InternetCollectionView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist); QObject::connect(qobuz_view_->albums_collection_view(), &StreamingCollectionView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist);
QObject::connect(qobuz_view_->songs_collection_view(), &InternetCollectionView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist); QObject::connect(qobuz_view_->songs_collection_view(), &StreamingCollectionView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist);
QObject::connect(qobuz_view_->search_view(), &InternetSearchView::AddToPlaylist, this, &MainWindow::AddToPlaylist); QObject::connect(qobuz_view_->search_view(), &StreamingSearchView::AddToPlaylist, this, &MainWindow::AddToPlaylist);
#endif #endif
QObject::connect(radio_view_, &RadioViewContainer::Refresh, &*app_->radio_services(), &RadioServices::RefreshChannels); QObject::connect(radio_view_, &RadioViewContainer::Refresh, &*app_->radio_services(), &RadioServices::RefreshChannels);
@@ -1213,7 +1213,7 @@ void MainWindow::ReloadAllSettings() {
playlist_list_->ReloadSettings(); playlist_list_->ReloadSettings();
smartplaylists_view_->ReloadSettings(); smartplaylists_view_->ReloadSettings();
radio_view_->ReloadSettings(); radio_view_->ReloadSettings();
app_->internet_services()->ReloadSettings(); app_->streaming_services()->ReloadSettings();
app_->radio_services()->ReloadSettings(); app_->radio_services()->ReloadSettings();
app_->cover_providers()->ReloadSettings(); app_->cover_providers()->ReloadSettings();
app_->lyrics_providers()->ReloadSettings(); app_->lyrics_providers()->ReloadSettings();

View File

@@ -92,8 +92,8 @@ class TrackSelectionDialog;
class TranscodeDialog; class TranscodeDialog;
#endif #endif
class Ui_MainWindow; class Ui_MainWindow;
class InternetSongsView; class StreamingSongsView;
class InternetTabsView; class StreamingTabsView;
class SmartPlaylistsViewContainer; class SmartPlaylistsViewContainer;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
class Windows7ThumbBar; class Windows7ThumbBar;
@@ -341,9 +341,9 @@ class MainWindow : public QMainWindow, public PlatformInterface {
SmartPlaylistsViewContainer *smartplaylists_view_; SmartPlaylistsViewContainer *smartplaylists_view_;
InternetSongsView *subsonic_view_; StreamingSongsView *subsonic_view_;
InternetTabsView *tidal_view_; StreamingTabsView *tidal_view_;
InternetTabsView *qobuz_view_; StreamingTabsView *qobuz_view_;
RadioViewContainer *radio_view_; RadioViewContainer *radio_view_;

View File

@@ -66,7 +66,7 @@
# include "dbus/metatypes.h" # include "dbus/metatypes.h"
#endif #endif
#include "internet/internetsearchview.h" #include "streaming/streamingsearchview.h"
#include "smartplaylists/playlistgenerator_fwd.h" #include "smartplaylists/playlistgenerator_fwd.h"
@@ -147,8 +147,8 @@ void RegisterMetaTypes() {
qDBusRegisterMetaType<ManagedObjectList>(); qDBusRegisterMetaType<ManagedObjectList>();
#endif #endif
qRegisterMetaType<InternetSearchView::Result>("InternetSearchView::Result"); qRegisterMetaType<StreamingSearchView::Result>("StreamingSearchView::Result");
qRegisterMetaType<InternetSearchView::ResultList>("InternetSearchView::ResultList"); qRegisterMetaType<StreamingSearchView::ResultList>("StreamingSearchView::ResultList");
qRegisterMetaType<RadioChannel>("RadioChannel"); qRegisterMetaType<RadioChannel>("RadioChannel");
qRegisterMetaType<RadioChannelList>("RadioChannelList"); qRegisterMetaType<RadioChannelList>("RadioChannelList");

View File

@@ -67,8 +67,8 @@
#include "collection/collectionfilteroptions.h" #include "collection/collectionfilteroptions.h"
#include "collection/collectionbackend.h" #include "collection/collectionbackend.h"
#include "settings/coverssettingspage.h" #include "settings/coverssettingspage.h"
#include "internet/internetservices.h" #include "streaming/streamingservices.h"
#include "internet/internetservice.h" #include "streaming/streamingservice.h"
#include "albumcoverchoicecontroller.h" #include "albumcoverchoicecontroller.h"
#include "albumcoverfetcher.h" #include "albumcoverfetcher.h"
#include "albumcoverloader.h" #include "albumcoverloader.h"
@@ -578,7 +578,7 @@ void AlbumCoverChoiceController::SaveArtManualToSong(Song *song, const QUrl &art
case Song::Source::Tidal: case Song::Source::Tidal:
case Song::Source::Qobuz: case Song::Source::Qobuz:
case Song::Source::Subsonic: case Song::Source::Subsonic:
InternetServicePtr service = app_->internet_services()->ServiceBySource(song->source()); StreamingServicePtr service = app_->streaming_services()->ServiceBySource(song->source());
if (!service) break; if (!service) break;
if (service->artists_collection_backend()) { if (service->artists_collection_backend()) {
service->artists_collection_backend()->UpdateManualAlbumArtAsync(song->effective_albumartist(), song->album(), art_manual); service->artists_collection_backend()->UpdateManualAlbumArtAsync(song->effective_albumartist(), song->album(), art_manual);

View File

@@ -40,7 +40,7 @@
#include "core/networkaccessmanager.h" #include "core/networkaccessmanager.h"
#include "core/logging.h" #include "core/logging.h"
#include "core/song.h" #include "core/song.h"
#include "internet/internetservices.h" #include "streaming/streamingservices.h"
#include "qobuz/qobuzservice.h" #include "qobuz/qobuzservice.h"
#include "albumcoverfetcher.h" #include "albumcoverfetcher.h"
#include "jsoncoverprovider.h" #include "jsoncoverprovider.h"
@@ -52,7 +52,7 @@ constexpr int kLimit = 10;
QobuzCoverProvider::QobuzCoverProvider(Application *app, SharedPtr<NetworkAccessManager> network, QObject *parent) QobuzCoverProvider::QobuzCoverProvider(Application *app, SharedPtr<NetworkAccessManager> network, QObject *parent)
: JsonCoverProvider(QStringLiteral("Qobuz"), true, true, 2.0, true, true, app, network, parent), : JsonCoverProvider(QStringLiteral("Qobuz"), true, true, 2.0, true, true, app, network, parent),
service_(app->internet_services()->Service<QobuzService>()) {} service_(app->streaming_services()->Service<QobuzService>()) {}
QobuzCoverProvider::~QobuzCoverProvider() { QobuzCoverProvider::~QobuzCoverProvider() {

View File

@@ -39,7 +39,7 @@
#include "core/networkaccessmanager.h" #include "core/networkaccessmanager.h"
#include "core/logging.h" #include "core/logging.h"
#include "core/song.h" #include "core/song.h"
#include "internet/internetservices.h" #include "streaming/streamingservices.h"
#include "tidal/tidalservice.h" #include "tidal/tidalservice.h"
#include "albumcoverfetcher.h" #include "albumcoverfetcher.h"
#include "jsoncoverprovider.h" #include "jsoncoverprovider.h"
@@ -51,7 +51,7 @@ constexpr int kLimit = 10;
TidalCoverProvider::TidalCoverProvider(Application *app, SharedPtr<NetworkAccessManager> network, QObject *parent) TidalCoverProvider::TidalCoverProvider(Application *app, SharedPtr<NetworkAccessManager> network, QObject *parent)
: JsonCoverProvider(QStringLiteral("Tidal"), true, true, 2.5, true, true, app, network, parent), : JsonCoverProvider(QStringLiteral("Tidal"), true, true, 2.5, true, true, app, network, parent),
service_(app->internet_services()->Service<TidalService>()) {} service_(app->streaming_services()->Service<TidalService>()) {}
TidalCoverProvider::~TidalCoverProvider() { TidalCoverProvider::~TidalCoverProvider() {

View File

@@ -231,7 +231,7 @@ int main(int argc, char *argv[]) {
if (QApplication::style()) qLog(Debug) << "Style:" << QApplication::style()->objectName(); if (QApplication::style()) qLog(Debug) << "Style:" << QApplication::style()->objectName();
} }
// Set the permissions on the config file on Unix - it can contain passwords for internet services, so it's important that other users can't read it. // Set the permissions on the config file on Unix - it can contain passwords for streaming services, so it's important that other users can't read it.
// On Windows these are stored in the registry instead. // On Windows these are stored in the registry instead.
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
{ {

View File

@@ -87,9 +87,9 @@
#include "smartplaylists/playlistgeneratorinserter.h" #include "smartplaylists/playlistgeneratorinserter.h"
#include "smartplaylists/playlistgeneratormimedata.h" #include "smartplaylists/playlistgeneratormimedata.h"
#include "internet/internetplaylistitem.h" #include "streaming/streamplaylistitem.h"
#include "internet/internetsongmimedata.h" #include "streaming/streamsongmimedata.h"
#include "internet/internetservice.h" #include "streaming/streamingservice.h"
#include "radios/radiomimedata.h" #include "radios/radiomimedata.h"
#include "radios/radioplaylistitem.h" #include "radios/radioplaylistitem.h"
@@ -815,8 +815,8 @@ bool Playlist::dropMimeData(const QMimeData *data, Qt::DropAction action, int ro
else if (const PlaylistGeneratorMimeData *generator_data = qobject_cast<const PlaylistGeneratorMimeData*>(data)) { else if (const PlaylistGeneratorMimeData *generator_data = qobject_cast<const PlaylistGeneratorMimeData*>(data)) {
InsertSmartPlaylist(generator_data->generator_, row, play_now, enqueue_now, enqueue_next_now); InsertSmartPlaylist(generator_data->generator_, row, play_now, enqueue_now, enqueue_next_now);
} }
else if (const InternetSongMimeData *internet_song_data = qobject_cast<const InternetSongMimeData*>(data)) { else if (const StreamSongMimeData *stream_song_data = qobject_cast<const StreamSongMimeData*>(data)) {
InsertInternetItems(internet_song_data->service, internet_song_data->songs, row, play_now, enqueue_now, enqueue_next_now); InsertStreamingItems(stream_song_data->service, stream_song_data->songs, row, play_now, enqueue_now, enqueue_next_now);
} }
else if (const RadioMimeData *radio_data = qobject_cast<const RadioMimeData*>(data)) { else if (const RadioMimeData *radio_data = qobject_cast<const RadioMimeData*>(data)) {
InsertRadioItems(radio_data->songs, row, play_now, enqueue_now, enqueue_next_now); InsertRadioItems(radio_data->songs, row, play_now, enqueue_now, enqueue_next_now);
@@ -1168,7 +1168,7 @@ void Playlist::InsertSongsOrCollectionItems(const SongList &songs, const int pos
items << make_shared<RadioPlaylistItem>(song); items << make_shared<RadioPlaylistItem>(song);
} }
else { else {
items << make_shared<InternetPlaylistItem>(song); items << make_shared<StreamPlaylistItem>(song);
} }
} }
} }
@@ -1176,12 +1176,12 @@ void Playlist::InsertSongsOrCollectionItems(const SongList &songs, const int pos
} }
void Playlist::InsertInternetItems(InternetServicePtr service, const SongList &songs, const int pos, const bool play_now, const bool enqueue, const bool enqueue_next) { void Playlist::InsertStreamingItems(StreamingServicePtr service, const SongList &songs, const int pos, const bool play_now, const bool enqueue, const bool enqueue_next) {
PlaylistItemPtrList playlist_items; PlaylistItemPtrList playlist_items;
playlist_items.reserve(songs.count()); playlist_items.reserve(songs.count());
for (const Song &song : songs) { for (const Song &song : songs) {
playlist_items << make_shared<InternetPlaylistItem>(service, song); playlist_items << make_shared<StreamPlaylistItem>(service, song);
} }
InsertItems(playlist_items, pos, play_now, enqueue, enqueue_next); InsertItems(playlist_items, pos, play_now, enqueue, enqueue_next);
@@ -1233,7 +1233,7 @@ void Playlist::UpdateItems(SongList songs) {
new_item = make_shared<RadioPlaylistItem>(song); new_item = make_shared<RadioPlaylistItem>(song);
} }
else { else {
new_item = make_shared<InternetPlaylistItem>(song); new_item = make_shared<StreamPlaylistItem>(song);
} }
} }
items_[i] = new_item; items_[i] = new_item;

View File

@@ -48,7 +48,7 @@
#include "playlistitem.h" #include "playlistitem.h"
#include "playlistsequence.h" #include "playlistsequence.h"
#include "smartplaylists/playlistgenerator_fwd.h" #include "smartplaylists/playlistgenerator_fwd.h"
#include <internet/internetservice.h> #include <streaming/streamingservice.h>
class QMimeData; class QMimeData;
class QUndoStack; class QUndoStack;
@@ -229,7 +229,7 @@ class Playlist : public QAbstractListModel {
void InsertSongs(const SongList &songs, const int pos = -1, const bool play_now = false, const bool enqueue = false, const bool enqueue_next = false); void InsertSongs(const SongList &songs, const int pos = -1, const bool play_now = false, const bool enqueue = false, const bool enqueue_next = false);
void InsertSongsOrCollectionItems(const SongList &songs, const int pos = -1, const bool play_now = false, const bool enqueue = false, const bool enqueue_next = false); void InsertSongsOrCollectionItems(const SongList &songs, const int pos = -1, const bool play_now = false, const bool enqueue = false, const bool enqueue_next = false);
void InsertSmartPlaylist(PlaylistGeneratorPtr gen, const int pos = -1, const bool play_now = false, const bool enqueue = false, const bool enqueue_next = false); void InsertSmartPlaylist(PlaylistGeneratorPtr gen, const int pos = -1, const bool play_now = false, const bool enqueue = false, const bool enqueue_next = false);
void InsertInternetItems(InternetServicePtr service, const SongList &songs, const int pos = -1, const bool play_now = false, const bool enqueue = false, const bool enqueue_next = false); void InsertStreamingItems(StreamingServicePtr service, const SongList &songs, const int pos = -1, const bool play_now = false, const bool enqueue = false, const bool enqueue_next = false);
void InsertRadioItems(const SongList &songs, const int pos = -1, const bool play_now = false, const bool enqueue = false, const bool enqueue_next = false); void InsertRadioItems(const SongList &songs, const int pos = -1, const bool play_now = false, const bool enqueue = false, const bool enqueue_next = false);
void ReshuffleIndices(); void ReshuffleIndices();

View File

@@ -34,7 +34,7 @@
#include "playlistitem.h" #include "playlistitem.h"
#include "songplaylistitem.h" #include "songplaylistitem.h"
#include "internet/internetplaylistitem.h" #include "streaming/streamplaylistitem.h"
#include "radios/radioplaylistitem.h" #include "radios/radioplaylistitem.h"
using std::make_shared; using std::make_shared;
@@ -47,7 +47,7 @@ PlaylistItemPtr PlaylistItem::NewFromSource(const Song::Source source) {
case Song::Source::Subsonic: case Song::Source::Subsonic:
case Song::Source::Tidal: case Song::Source::Tidal:
case Song::Source::Qobuz: case Song::Source::Qobuz:
return make_shared<InternetPlaylistItem>(source); return make_shared<StreamPlaylistItem>(source);
case Song::Source::Stream: case Song::Source::Stream:
case Song::Source::RadioParadise: case Song::Source::RadioParadise:
case Song::Source::SomaFM: case Song::Source::SomaFM:
@@ -71,7 +71,7 @@ PlaylistItemPtr PlaylistItem::NewFromSong(const Song &song) {
case Song::Source::Subsonic: case Song::Source::Subsonic:
case Song::Source::Tidal: case Song::Source::Tidal:
case Song::Source::Qobuz: case Song::Source::Qobuz:
return make_shared<InternetPlaylistItem>(song); return make_shared<StreamPlaylistItem>(song);
case Song::Source::Stream: case Song::Source::Stream:
case Song::Source::RadioParadise: case Song::Source::RadioParadise:
case Song::Source::SomaFM: case Song::Source::SomaFM:

View File

@@ -46,7 +46,7 @@
#include "core/song.h" #include "core/song.h"
#include "core/settings.h" #include "core/settings.h"
#include "utilities/macaddrutils.h" #include "utilities/macaddrutils.h"
#include "internet/internetsearchview.h" #include "streaming/streamingsearchview.h"
#include "collection/collectionbackend.h" #include "collection/collectionbackend.h"
#include "collection/collectionmodel.h" #include "collection/collectionmodel.h"
#include "collection/collectionfilter.h" #include "collection/collectionfilter.h"
@@ -78,7 +78,7 @@ constexpr char kSongsTable[] = "qobuz_songs";
} // namespace } // namespace
QobuzService::QobuzService(Application *app, QObject *parent) QobuzService::QobuzService(Application *app, QObject *parent)
: InternetService(Song::Source::Qobuz, QStringLiteral("Qobuz"), QStringLiteral("qobuz"), QLatin1String(QobuzSettingsPage::kSettingsGroup), SettingsDialog::Page::Qobuz, app, parent), : StreamingService(Song::Source::Qobuz, QStringLiteral("Qobuz"), QStringLiteral("qobuz"), QLatin1String(QobuzSettingsPage::kSettingsGroup), SettingsDialog::Page::Qobuz, app, parent),
app_(app), app_(app),
network_(app->network()), network_(app->network()),
url_handler_(new QobuzUrlHandler(app, this)), url_handler_(new QobuzUrlHandler(app, this)),
@@ -101,7 +101,7 @@ QobuzService::QobuzService(Application *app, QObject *parent)
credential_id_(-1), credential_id_(-1),
pending_search_id_(0), pending_search_id_(0),
next_pending_search_id_(1), next_pending_search_id_(1),
pending_search_type_(InternetSearchView::SearchType::Artists), pending_search_type_(StreamingSearchView::SearchType::Artists),
search_id_(0), search_id_(0),
login_sent_(false), login_sent_(false),
login_attempts_(0), login_attempts_(0),
@@ -646,7 +646,7 @@ void QobuzService::SongsUpdateProgressReceived(const int id, const int progress)
emit SongsUpdateProgress(progress); emit SongsUpdateProgress(progress);
} }
int QobuzService::Search(const QString &text, InternetSearchView::SearchType type) { int QobuzService::Search(const QString &text, StreamingSearchView::SearchType type) {
pending_search_id_ = next_pending_search_id_; pending_search_id_ = next_pending_search_id_;
pending_search_text_ = text; pending_search_text_ = text;
@@ -687,13 +687,13 @@ void QobuzService::SendSearch() {
QobuzBaseRequest::QueryType query_type = QobuzBaseRequest::QueryType::None; QobuzBaseRequest::QueryType query_type = QobuzBaseRequest::QueryType::None;
switch (pending_search_type_) { switch (pending_search_type_) {
case InternetSearchView::SearchType::Artists: case StreamingSearchView::SearchType::Artists:
query_type = QobuzBaseRequest::QueryType::SearchArtists; query_type = QobuzBaseRequest::QueryType::SearchArtists;
break; break;
case InternetSearchView::SearchType::Albums: case StreamingSearchView::SearchType::Albums:
query_type = QobuzBaseRequest::QueryType::SearchAlbums; query_type = QobuzBaseRequest::QueryType::SearchAlbums;
break; break;
case InternetSearchView::SearchType::Songs: case StreamingSearchView::SearchType::Songs:
query_type = QobuzBaseRequest::QueryType::SearchSongs; query_type = QobuzBaseRequest::QueryType::SearchSongs;
break; break;
} }

View File

@@ -39,8 +39,8 @@
#include "core/shared_ptr.h" #include "core/shared_ptr.h"
#include "core/song.h" #include "core/song.h"
#include "internet/internetservice.h" #include "streaming/streamingservice.h"
#include "internet/internetsearchview.h" #include "streaming/streamingsearchview.h"
class QTimer; class QTimer;
class QNetworkReply; class QNetworkReply;
@@ -54,7 +54,7 @@ class CollectionBackend;
class CollectionModel; class CollectionModel;
class CollectionFilter; class CollectionFilter;
class QobuzService : public InternetService { class QobuzService : public StreamingService {
Q_OBJECT Q_OBJECT
public: public:
@@ -69,7 +69,7 @@ class QobuzService : public InternetService {
void ReloadSettings() override; void ReloadSettings() override;
void Logout(); void Logout();
int Search(const QString &text, InternetSearchView::SearchType type) override; int Search(const QString &text, StreamingSearchView::SearchType type) override;
void CancelSearch() override; void CancelSearch() override;
int max_login_attempts() { return kLoginAttempts; } int max_login_attempts() { return kLoginAttempts; }
@@ -188,7 +188,7 @@ class QobuzService : public InternetService {
int pending_search_id_; int pending_search_id_;
int next_pending_search_id_; int next_pending_search_id_;
QString pending_search_text_; QString pending_search_text_;
InternetSearchView::SearchType pending_search_type_; StreamingSearchView::SearchType pending_search_type_;
int search_id_; int search_id_;
QString search_text_; QString search_text_;

View File

@@ -33,7 +33,7 @@
#include "core/logging.h" #include "core/logging.h"
#include "utilities/timeconstants.h" #include "utilities/timeconstants.h"
#include "settings/subsonicsettingspage.h" #include "settings/subsonicsettingspage.h"
#include "internet/internetservices.h" #include "streaming/streamingservices.h"
#include "subsonic/subsonicservice.h" #include "subsonic/subsonicservice.h"
#include "scrobblersettings.h" #include "scrobblersettings.h"
@@ -70,7 +70,7 @@ void SubsonicScrobbler::ReloadSettings() {
SubsonicServicePtr SubsonicScrobbler::service() { SubsonicServicePtr SubsonicScrobbler::service() {
if (!service_) { if (!service_) {
service_ = app_->internet_services()->Service<SubsonicService>(); service_ = app_->streaming_services()->Service<SubsonicService>();
} }
return service_; return service_;

View File

@@ -38,7 +38,7 @@
#include "core/iconloader.h" #include "core/iconloader.h"
#include "core/settings.h" #include "core/settings.h"
#include "widgets/loginstatewidget.h" #include "widgets/loginstatewidget.h"
#include "internet/internetservices.h" #include "streaming/streamingservices.h"
#include "qobuz/qobuzservice.h" #include "qobuz/qobuzservice.h"
const char *QobuzSettingsPage::kSettingsGroup = "Qobuz"; const char *QobuzSettingsPage::kSettingsGroup = "Qobuz";
@@ -46,7 +46,7 @@ const char *QobuzSettingsPage::kSettingsGroup = "Qobuz";
QobuzSettingsPage::QobuzSettingsPage(SettingsDialog *dialog, QWidget *parent) QobuzSettingsPage::QobuzSettingsPage(SettingsDialog *dialog, QWidget *parent)
: SettingsPage(dialog, parent), : SettingsPage(dialog, parent),
ui_(new Ui::QobuzSettingsPage), ui_(new Ui::QobuzSettingsPage),
service_(dialog->app()->internet_services()->Service<QobuzService>()) { service_(dialog->app()->streaming_services()->Service<QobuzService>()) {
ui_->setupUi(this); ui_->setupUi(this);
setWindowIcon(IconLoader::Load(QStringLiteral("qobuz"), true, 0, 32)); setWindowIcon(IconLoader::Load(QStringLiteral("qobuz"), true, 0, 32));
@@ -54,10 +54,10 @@ QobuzSettingsPage::QobuzSettingsPage(SettingsDialog *dialog, QWidget *parent)
QObject::connect(ui_->button_login, &QPushButton::clicked, this, &QobuzSettingsPage::LoginClicked); QObject::connect(ui_->button_login, &QPushButton::clicked, this, &QobuzSettingsPage::LoginClicked);
QObject::connect(ui_->login_state, &LoginStateWidget::LogoutClicked, this, &QobuzSettingsPage::LogoutClicked); QObject::connect(ui_->login_state, &LoginStateWidget::LogoutClicked, this, &QobuzSettingsPage::LogoutClicked);
QObject::connect(this, &QobuzSettingsPage::Login, &*service_, &InternetService::LoginWithCredentials); QObject::connect(this, &QobuzSettingsPage::Login, &*service_, &StreamingService::LoginWithCredentials);
QObject::connect(&*service_, &InternetService::LoginFailure, this, &QobuzSettingsPage::LoginFailure); QObject::connect(&*service_, &StreamingService::LoginFailure, this, &QobuzSettingsPage::LoginFailure);
QObject::connect(&*service_, &InternetService::LoginSuccess, this, &QobuzSettingsPage::LoginSuccess); QObject::connect(&*service_, &StreamingService::LoginSuccess, this, &QobuzSettingsPage::LoginSuccess);
dialog->installEventFilter(this); dialog->installEventFilter(this);

View File

@@ -37,7 +37,7 @@
#include "core/application.h" #include "core/application.h"
#include "core/iconloader.h" #include "core/iconloader.h"
#include "core/settings.h" #include "core/settings.h"
#include "internet/internetservices.h" #include "streaming/streamingservices.h"
#include "subsonic/subsonicservice.h" #include "subsonic/subsonicservice.h"
const char *SubsonicSettingsPage::kSettingsGroup = "Subsonic"; const char *SubsonicSettingsPage::kSettingsGroup = "Subsonic";
@@ -45,7 +45,7 @@ const char *SubsonicSettingsPage::kSettingsGroup = "Subsonic";
SubsonicSettingsPage::SubsonicSettingsPage(SettingsDialog *dialog, QWidget *parent) SubsonicSettingsPage::SubsonicSettingsPage(SettingsDialog *dialog, QWidget *parent)
: SettingsPage(dialog, parent), : SettingsPage(dialog, parent),
ui_(new Ui::SubsonicSettingsPage), ui_(new Ui::SubsonicSettingsPage),
service_(dialog->app()->internet_services()->Service<SubsonicService>()) { service_(dialog->app()->streaming_services()->Service<SubsonicService>()) {
ui_->setupUi(this); ui_->setupUi(this);
setWindowIcon(IconLoader::Load(QStringLiteral("subsonic"), true, 0, 32)); setWindowIcon(IconLoader::Load(QStringLiteral("subsonic"), true, 0, 32));

View File

@@ -37,7 +37,7 @@
#include "core/application.h" #include "core/application.h"
#include "core/iconloader.h" #include "core/iconloader.h"
#include "core/settings.h" #include "core/settings.h"
#include "internet/internetservices.h" #include "streaming/streamingservices.h"
#include "tidal/tidalservice.h" #include "tidal/tidalservice.h"
#include "widgets/loginstatewidget.h" #include "widgets/loginstatewidget.h"
@@ -46,7 +46,7 @@ const char *TidalSettingsPage::kSettingsGroup = "Tidal";
TidalSettingsPage::TidalSettingsPage(SettingsDialog *dialog, QWidget *parent) TidalSettingsPage::TidalSettingsPage(SettingsDialog *dialog, QWidget *parent)
: SettingsPage(dialog, parent), : SettingsPage(dialog, parent),
ui_(new Ui::TidalSettingsPage), ui_(new Ui::TidalSettingsPage),
service_(dialog->app()->internet_services()->Service<TidalService>()) { service_(dialog->app()->streaming_services()->Service<TidalService>()) {
ui_->setupUi(this); ui_->setupUi(this);
setWindowIcon(IconLoader::Load(QStringLiteral("tidal"), true, 0, 32)); setWindowIcon(IconLoader::Load(QStringLiteral("tidal"), true, 0, 32));
@@ -58,8 +58,8 @@ TidalSettingsPage::TidalSettingsPage(SettingsDialog *dialog, QWidget *parent)
QObject::connect(this, &TidalSettingsPage::Authorize, &*service_, &TidalService::StartAuthorization); QObject::connect(this, &TidalSettingsPage::Authorize, &*service_, &TidalService::StartAuthorization);
QObject::connect(this, &TidalSettingsPage::Login, &*service_, &TidalService::SendLoginWithCredentials); QObject::connect(this, &TidalSettingsPage::Login, &*service_, &TidalService::SendLoginWithCredentials);
QObject::connect(&*service_, &InternetService::LoginFailure, this, &TidalSettingsPage::LoginFailure); QObject::connect(&*service_, &StreamingService::LoginFailure, this, &TidalSettingsPage::LoginFailure);
QObject::connect(&*service_, &InternetService::LoginSuccess, this, &TidalSettingsPage::LoginSuccess); QObject::connect(&*service_, &StreamingService::LoginSuccess, this, &TidalSettingsPage::LoginSuccess);
dialog->installEventFilter(this); dialog->installEventFilter(this);

View File

@@ -47,9 +47,9 @@
#include "collection/collectionfilterwidget.h" #include "collection/collectionfilterwidget.h"
#include "collection/collectionitem.h" #include "collection/collectionitem.h"
#include "collection/collectionitemdelegate.h" #include "collection/collectionitemdelegate.h"
#include "internetcollectionview.h" #include "streamingcollectionview.h"
InternetCollectionView::InternetCollectionView(QWidget *parent) StreamingCollectionView::StreamingCollectionView(QWidget *parent)
: AutoExpandingTreeView(parent), : AutoExpandingTreeView(parent),
app_(nullptr), app_(nullptr),
collection_backend_(nullptr), collection_backend_(nullptr),
@@ -82,7 +82,7 @@ InternetCollectionView::InternetCollectionView(QWidget *parent)
} }
void InternetCollectionView::Init(Application *app, SharedPtr<CollectionBackend> collection_backend, CollectionModel *collection_model, const bool favorite) { void StreamingCollectionView::Init(Application *app, SharedPtr<CollectionBackend> collection_backend, CollectionModel *collection_model, const bool favorite) {
app_ = app; app_ = app;
collection_backend_ = collection_backend; collection_backend_ = collection_backend;
@@ -93,20 +93,20 @@ void InternetCollectionView::Init(Application *app, SharedPtr<CollectionBackend>
} }
void InternetCollectionView::SetFilter(CollectionFilterWidget *filter) { void StreamingCollectionView::SetFilter(CollectionFilterWidget *filter) {
filter_ = filter; filter_ = filter;
} }
void InternetCollectionView::ReloadSettings() { void StreamingCollectionView::ReloadSettings() {
if (collection_model_) collection_model_->ReloadSettings(); if (collection_model_) collection_model_->ReloadSettings();
if (filter_) filter_->ReloadSettings(); if (filter_) filter_->ReloadSettings();
} }
void InternetCollectionView::SaveFocus() { void StreamingCollectionView::SaveFocus() {
const QModelIndex current = currentIndex(); const QModelIndex current = currentIndex();
const QVariant role_type = model()->data(current, CollectionModel::Role_Type); const QVariant role_type = model()->data(current, CollectionModel::Role_Type);
@@ -147,7 +147,7 @@ void InternetCollectionView::SaveFocus() {
} }
void InternetCollectionView::SaveContainerPath(const QModelIndex &child) { void StreamingCollectionView::SaveContainerPath(const QModelIndex &child) {
const QModelIndex current = model()->parent(child); const QModelIndex current = model()->parent(child);
const QVariant role_type = model()->data(current, CollectionModel::Role_Type); const QVariant role_type = model()->data(current, CollectionModel::Role_Type);
@@ -165,7 +165,7 @@ void InternetCollectionView::SaveContainerPath(const QModelIndex &child) {
} }
void InternetCollectionView::RestoreFocus() { void StreamingCollectionView::RestoreFocus() {
if (last_selected_container_.isEmpty() && last_selected_song_.url().isEmpty()) { if (last_selected_container_.isEmpty() && last_selected_song_.url().isEmpty()) {
return; return;
@@ -174,7 +174,7 @@ void InternetCollectionView::RestoreFocus() {
} }
bool InternetCollectionView::RestoreLevelFocus(const QModelIndex &parent) { bool StreamingCollectionView::RestoreLevelFocus(const QModelIndex &parent) {
if (model()->canFetchMore(parent)) { if (model()->canFetchMore(parent)) {
model()->fetchMore(parent); model()->fetchMore(parent);
@@ -229,7 +229,7 @@ bool InternetCollectionView::RestoreLevelFocus(const QModelIndex &parent) {
} }
void InternetCollectionView::TotalSongCountUpdated(int count) { void StreamingCollectionView::TotalSongCountUpdated(int count) {
int old = total_song_count_; int old = total_song_count_;
total_song_count_ = count; total_song_count_ = count;
@@ -246,7 +246,7 @@ void InternetCollectionView::TotalSongCountUpdated(int count) {
} }
void InternetCollectionView::TotalArtistCountUpdated(int count) { void StreamingCollectionView::TotalArtistCountUpdated(int count) {
int old = total_artist_count_; int old = total_artist_count_;
total_artist_count_ = count; total_artist_count_ = count;
@@ -263,7 +263,7 @@ void InternetCollectionView::TotalArtistCountUpdated(int count) {
} }
void InternetCollectionView::TotalAlbumCountUpdated(int count) { void StreamingCollectionView::TotalAlbumCountUpdated(int count) {
int old = total_album_count_; int old = total_album_count_;
total_album_count_ = count; total_album_count_ = count;
@@ -280,7 +280,7 @@ void InternetCollectionView::TotalAlbumCountUpdated(int count) {
} }
void InternetCollectionView::paintEvent(QPaintEvent *event) { void StreamingCollectionView::paintEvent(QPaintEvent *event) {
if (total_song_count_ == 0) { if (total_song_count_ == 0) {
QPainter p(viewport()); QPainter p(viewport());
@@ -298,7 +298,7 @@ void InternetCollectionView::paintEvent(QPaintEvent *event) {
QFontMetrics metrics(bold_font); QFontMetrics metrics(bold_font);
QRect title_rect(0, image_rect.bottom() + 20, rect.width(), metrics.height()); QRect title_rect(0, image_rect.bottom() + 20, rect.width(), metrics.height());
p.drawText(title_rect, Qt::AlignHCenter, tr("The internet collection is empty!")); p.drawText(title_rect, Qt::AlignHCenter, tr("The streaming collection is empty!"));
// Draw the other text // Draw the other text
p.setFont(QFont()); p.setFont(QFont());
@@ -312,7 +312,7 @@ void InternetCollectionView::paintEvent(QPaintEvent *event) {
} }
void InternetCollectionView::mouseReleaseEvent(QMouseEvent *e) { void StreamingCollectionView::mouseReleaseEvent(QMouseEvent *e) {
QTreeView::mouseReleaseEvent(e); QTreeView::mouseReleaseEvent(e);
@@ -322,22 +322,22 @@ void InternetCollectionView::mouseReleaseEvent(QMouseEvent *e) {
} }
void InternetCollectionView::contextMenuEvent(QContextMenuEvent *e) { void StreamingCollectionView::contextMenuEvent(QContextMenuEvent *e) {
if (!context_menu_) { if (!context_menu_) {
context_menu_ = new QMenu(this); context_menu_ = new QMenu(this);
add_to_playlist_ = context_menu_->addAction(IconLoader::Load(QStringLiteral("media-playback-start")), tr("Append to current playlist"), this, &InternetCollectionView::AddToPlaylist); add_to_playlist_ = context_menu_->addAction(IconLoader::Load(QStringLiteral("media-playback-start")), tr("Append to current playlist"), this, &StreamingCollectionView::AddToPlaylist);
load_ = context_menu_->addAction(IconLoader::Load(QStringLiteral("media-playback-start")), tr("Replace current playlist"), this, &InternetCollectionView::Load); load_ = context_menu_->addAction(IconLoader::Load(QStringLiteral("media-playback-start")), tr("Replace current playlist"), this, &StreamingCollectionView::Load);
open_in_new_playlist_ = context_menu_->addAction(IconLoader::Load(QStringLiteral("document-new")), tr("Open in new playlist"), this, &InternetCollectionView::OpenInNewPlaylist); open_in_new_playlist_ = context_menu_->addAction(IconLoader::Load(QStringLiteral("document-new")), tr("Open in new playlist"), this, &StreamingCollectionView::OpenInNewPlaylist);
context_menu_->addSeparator(); context_menu_->addSeparator();
add_to_playlist_enqueue_ = context_menu_->addAction(IconLoader::Load(QStringLiteral("go-next")), tr("Queue track"), this, &InternetCollectionView::AddToPlaylistEnqueue); add_to_playlist_enqueue_ = context_menu_->addAction(IconLoader::Load(QStringLiteral("go-next")), tr("Queue track"), this, &StreamingCollectionView::AddToPlaylistEnqueue);
add_to_playlist_enqueue_next_ = context_menu_->addAction(IconLoader::Load(QStringLiteral("go-next")), tr("Queue to play next"), this, &InternetCollectionView::AddToPlaylistEnqueueNext); add_to_playlist_enqueue_next_ = context_menu_->addAction(IconLoader::Load(QStringLiteral("go-next")), tr("Queue to play next"), this, &StreamingCollectionView::AddToPlaylistEnqueueNext);
context_menu_->addSeparator(); context_menu_->addSeparator();
if (favorite_) { if (favorite_) {
remove_songs_ = context_menu_->addAction(IconLoader::Load(QStringLiteral("edit-delete")), tr("Remove from favorites"), this, &InternetCollectionView::RemoveSelectedSongs); remove_songs_ = context_menu_->addAction(IconLoader::Load(QStringLiteral("edit-delete")), tr("Remove from favorites"), this, &StreamingCollectionView::RemoveSelectedSongs);
context_menu_->addSeparator(); context_menu_->addSeparator();
} }
@@ -363,7 +363,7 @@ void InternetCollectionView::contextMenuEvent(QContextMenuEvent *e) {
} }
void InternetCollectionView::Load() { void StreamingCollectionView::Load() {
QMimeData *q_mimedata = model()->mimeData(selectedIndexes()); QMimeData *q_mimedata = model()->mimeData(selectedIndexes());
if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) { if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) {
@@ -373,13 +373,13 @@ void InternetCollectionView::Load() {
} }
void InternetCollectionView::AddToPlaylist() { void StreamingCollectionView::AddToPlaylist() {
emit AddToPlaylistSignal(model()->mimeData(selectedIndexes())); emit AddToPlaylistSignal(model()->mimeData(selectedIndexes()));
} }
void InternetCollectionView::AddToPlaylistEnqueue() { void StreamingCollectionView::AddToPlaylistEnqueue() {
QMimeData *q_mimedata = model()->mimeData(selectedIndexes()); QMimeData *q_mimedata = model()->mimeData(selectedIndexes());
if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) { if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) {
@@ -389,7 +389,7 @@ void InternetCollectionView::AddToPlaylistEnqueue() {
} }
void InternetCollectionView::AddToPlaylistEnqueueNext() { void StreamingCollectionView::AddToPlaylistEnqueueNext() {
QMimeData *q_mimedata = model()->mimeData(selectedIndexes()); QMimeData *q_mimedata = model()->mimeData(selectedIndexes());
if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) { if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) {
@@ -399,7 +399,7 @@ void InternetCollectionView::AddToPlaylistEnqueueNext() {
} }
void InternetCollectionView::OpenInNewPlaylist() { void StreamingCollectionView::OpenInNewPlaylist() {
QMimeData *q_mimedata = model()->mimeData(selectedIndexes()); QMimeData *q_mimedata = model()->mimeData(selectedIndexes());
if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) { if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) {
@@ -409,13 +409,13 @@ void InternetCollectionView::OpenInNewPlaylist() {
} }
void InternetCollectionView::RemoveSelectedSongs() { void StreamingCollectionView::RemoveSelectedSongs() {
emit RemoveSongs(GetSelectedSongs()); emit RemoveSongs(GetSelectedSongs());
} }
void InternetCollectionView::keyboardSearch(const QString &search) { void StreamingCollectionView::keyboardSearch(const QString &search) {
is_in_keyboard_search_ = true; is_in_keyboard_search_ = true;
QTreeView::keyboardSearch(search); QTreeView::keyboardSearch(search);
@@ -423,7 +423,7 @@ void InternetCollectionView::keyboardSearch(const QString &search) {
} }
void InternetCollectionView::scrollTo(const QModelIndex &idx, ScrollHint hint) { void StreamingCollectionView::scrollTo(const QModelIndex &idx, ScrollHint hint) {
if (is_in_keyboard_search_) { if (is_in_keyboard_search_) {
QTreeView::scrollTo(idx, QAbstractItemView::PositionAtTop); QTreeView::scrollTo(idx, QAbstractItemView::PositionAtTop);
@@ -434,14 +434,14 @@ void InternetCollectionView::scrollTo(const QModelIndex &idx, ScrollHint hint) {
} }
SongList InternetCollectionView::GetSelectedSongs() const { SongList StreamingCollectionView::GetSelectedSongs() const {
QModelIndexList selected_indexes = qobject_cast<QSortFilterProxyModel*>(model())->mapSelectionToSource(selectionModel()->selection()).indexes(); QModelIndexList selected_indexes = qobject_cast<QSortFilterProxyModel*>(model())->mapSelectionToSource(selectionModel()->selection()).indexes();
return collection_model_->GetChildSongs(selected_indexes); return collection_model_->GetChildSongs(selected_indexes);
} }
void InternetCollectionView::FilterReturnPressed() { void StreamingCollectionView::FilterReturnPressed() {
if (!currentIndex().isValid()) { if (!currentIndex().isValid()) {
// Pick the first thing that isn't a divider // Pick the first thing that isn't a divider
@@ -463,12 +463,12 @@ void InternetCollectionView::FilterReturnPressed() {
} }
int InternetCollectionView::TotalSongs() const { int StreamingCollectionView::TotalSongs() const {
return total_song_count_; return total_song_count_;
} }
int InternetCollectionView::TotalArtists() const { int StreamingCollectionView::TotalArtists() const {
return total_artist_count_; return total_artist_count_;
} }
int InternetCollectionView::TotalAlbums() const { int StreamingCollectionView::TotalAlbums() const {
return total_album_count_; return total_album_count_;
} }

View File

@@ -19,8 +19,8 @@
* *
*/ */
#ifndef INTERNETCOLLECTIONVIEW_H #ifndef STREAMINGCOLLECTIONVIEW_H
#define INTERNETCOLLECTIONVIEW_H #define STREAMINGCOLLECTIONVIEW_H
#include "config.h" #include "config.h"
@@ -49,11 +49,11 @@ class CollectionBackend;
class CollectionModel; class CollectionModel;
class CollectionFilterWidget; class CollectionFilterWidget;
class InternetCollectionView : public AutoExpandingTreeView { class StreamingCollectionView : public AutoExpandingTreeView {
Q_OBJECT Q_OBJECT
public: public:
explicit InternetCollectionView(QWidget *parent = nullptr); explicit StreamingCollectionView(QWidget *parent = nullptr);
void Init(Application *app, SharedPtr<CollectionBackend> collection_backend, CollectionModel *collection_model, const bool favorite = false); void Init(Application *app, SharedPtr<CollectionBackend> collection_backend, CollectionModel *collection_model, const bool favorite = false);
@@ -140,4 +140,4 @@ class InternetCollectionView : public AutoExpandingTreeView {
QSet<QString> last_selected_path_; QSet<QString> last_selected_path_;
}; };
#endif // INTERNETCOLLECTIONVIEW_H #endif // STREAMINGCOLLECTIONVIEW_H

View File

@@ -26,21 +26,21 @@
#include <QContextMenuEvent> #include <QContextMenuEvent>
#include "collection/collectionfilterwidget.h" #include "collection/collectionfilterwidget.h"
#include "internetcollectionview.h" #include "streamingcollectionview.h"
#include "internetcollectionviewcontainer.h" #include "streamingcollectionviewcontainer.h"
#include "ui_internetcollectionviewcontainer.h" #include "ui_streamingcollectionviewcontainer.h"
InternetCollectionViewContainer::InternetCollectionViewContainer(QWidget *parent) StreamingCollectionViewContainer::StreamingCollectionViewContainer(QWidget *parent)
: QWidget(parent), : QWidget(parent),
ui_(new Ui_InternetCollectionViewContainer) { ui_(new Ui_StreamingCollectionViewContainer) {
ui_->setupUi(this); ui_->setupUi(this);
ui_->view->SetFilter(ui_->filter_widget); ui_->view->SetFilter(ui_->filter_widget);
QObject::connect(ui_->filter_widget, &CollectionFilterWidget::UpPressed, ui_->view, &InternetCollectionView::UpAndFocus); QObject::connect(ui_->filter_widget, &CollectionFilterWidget::UpPressed, ui_->view, &StreamingCollectionView::UpAndFocus);
QObject::connect(ui_->filter_widget, &CollectionFilterWidget::DownPressed, ui_->view, &InternetCollectionView::DownAndFocus); QObject::connect(ui_->filter_widget, &CollectionFilterWidget::DownPressed, ui_->view, &StreamingCollectionView::DownAndFocus);
QObject::connect(ui_->filter_widget, &CollectionFilterWidget::ReturnPressed, ui_->view, &InternetCollectionView::FilterReturnPressed); QObject::connect(ui_->filter_widget, &CollectionFilterWidget::ReturnPressed, ui_->view, &StreamingCollectionView::FilterReturnPressed);
QObject::connect(ui_->view, &InternetCollectionView::FocusOnFilterSignal, ui_->filter_widget, &CollectionFilterWidget::FocusOnFilter); QObject::connect(ui_->view, &StreamingCollectionView::FocusOnFilterSignal, ui_->filter_widget, &CollectionFilterWidget::FocusOnFilter);
ui_->progressbar->hide(); ui_->progressbar->hide();
@@ -48,21 +48,21 @@ InternetCollectionViewContainer::InternetCollectionViewContainer(QWidget *parent
} }
InternetCollectionViewContainer::~InternetCollectionViewContainer() { delete ui_; } StreamingCollectionViewContainer::~StreamingCollectionViewContainer() { delete ui_; }
void InternetCollectionViewContainer::ReloadSettings() const { void StreamingCollectionViewContainer::ReloadSettings() const {
ui_->filter_widget->ReloadSettings(); ui_->filter_widget->ReloadSettings();
ui_->view->ReloadSettings(); ui_->view->ReloadSettings();
} }
bool InternetCollectionViewContainer::SearchFieldHasFocus() const { bool StreamingCollectionViewContainer::SearchFieldHasFocus() const {
return ui_->filter_widget->SearchFieldHasFocus(); return ui_->filter_widget->SearchFieldHasFocus();
} }
void InternetCollectionViewContainer::FocusSearchField() { void StreamingCollectionViewContainer::FocusSearchField() {
ui_->filter_widget->FocusSearchField(); ui_->filter_widget->FocusSearchField();
} }
void InternetCollectionViewContainer::contextMenuEvent(QContextMenuEvent *e) { Q_UNUSED(e); } void StreamingCollectionViewContainer::contextMenuEvent(QContextMenuEvent *e) { Q_UNUSED(e); }

View File

@@ -17,8 +17,8 @@
* *
*/ */
#ifndef INTERNETCOLLECTIONVIEWCONTAINER_H #ifndef STREAMINGCOLLECTIONVIEWCONTAINER_H
#define INTERNETCOLLECTIONVIEWCONTAINER_H #define STREAMINGCOLLECTIONVIEWCONTAINER_H
#include "config.h" #include "config.h"
@@ -26,8 +26,8 @@
#include <QWidget> #include <QWidget>
#include <QString> #include <QString>
#include "internetcollectionview.h" #include "streamingcollectionview.h"
#include "ui_internetcollectionviewcontainer.h" #include "ui_streamingcollectionviewcontainer.h"
class QStackedWidget; class QStackedWidget;
class QPushButton; class QPushButton;
@@ -36,12 +36,12 @@ class QProgressBar;
class QContextMenuEvent; class QContextMenuEvent;
class CollectionFilterWidget; class CollectionFilterWidget;
class InternetCollectionViewContainer : public QWidget { class StreamingCollectionViewContainer : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit InternetCollectionViewContainer(QWidget *parent = nullptr); explicit StreamingCollectionViewContainer(QWidget *parent = nullptr);
~InternetCollectionViewContainer() override; ~StreamingCollectionViewContainer() override;
void ReloadSettings() const; void ReloadSettings() const;
bool SearchFieldHasFocus() const; bool SearchFieldHasFocus() const;
@@ -49,8 +49,8 @@ class InternetCollectionViewContainer : public QWidget {
QStackedWidget *stacked() const { return ui_->stacked; } QStackedWidget *stacked() const { return ui_->stacked; }
QWidget *help_page() const { return ui_->help_page; } QWidget *help_page() const { return ui_->help_page; }
QWidget *internetcollection_page() const { return ui_->internetcollection_page; } QWidget *streamingcollection_page() const { return ui_->streamingcollection_page; }
InternetCollectionView *view() const { return ui_->view; } StreamingCollectionView *view() const { return ui_->view; }
CollectionFilterWidget *filter_widget() const { return ui_->filter_widget; } CollectionFilterWidget *filter_widget() const { return ui_->filter_widget; }
QPushButton *button_refresh() const { return ui_->refresh; } QPushButton *button_refresh() const { return ui_->refresh; }
QPushButton *button_close() const { return ui_->close; } QPushButton *button_close() const { return ui_->close; }
@@ -62,8 +62,8 @@ class InternetCollectionViewContainer : public QWidget {
void contextMenuEvent(QContextMenuEvent *e) override; void contextMenuEvent(QContextMenuEvent *e) override;
private: private:
Ui_InternetCollectionViewContainer *ui_; Ui_StreamingCollectionViewContainer *ui_;
}; };
#endif // INTERNETCOLLECTIONVIEWCONTAINER_H #endif // STREAMINGCOLLECTIONVIEWCONTAINER_H

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>InternetCollectionViewContainer</class> <class>StreamingCollectionViewContainer</class>
<widget class="QWidget" name="InternetCollectionViewContainer"> <widget class="QWidget" name="StreamingCollectionViewContainer">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@@ -111,7 +111,7 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="internetcollection_page"> <widget class="QWidget" name="streamingcollection_page">
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
@@ -139,7 +139,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="InternetCollectionView" name="view"/> <widget class="StreamingCollectionView" name="view"/>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -155,9 +155,9 @@
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>InternetCollectionView</class> <class>StreamingCollectionView</class>
<extends>QTreeView</extends> <extends>QTreeView</extends>
<header location="global">internet/internetcollectionview.h</header> <header location="global">streaming/streamingcollectionview.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>

View File

@@ -21,17 +21,17 @@
#include <QStyleOptionViewItem> #include <QStyleOptionViewItem>
#include <QPainter> #include <QPainter>
#include "internetsearchitemdelegate.h" #include "streamingsearchitemdelegate.h"
#include "internetsearchview.h" #include "streamingsearchview.h"
InternetSearchItemDelegate::InternetSearchItemDelegate(InternetSearchView *view) StreamingSearchItemDelegate::StreamingSearchItemDelegate(StreamingSearchView *view)
: CollectionItemDelegate(view), : CollectionItemDelegate(view),
view_(view) {} view_(view) {}
void InternetSearchItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &idx) const { void StreamingSearchItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &idx) const {
// Tell the view we painted this item, so it can lazy load some art. // Tell the view we painted this item, so it can lazy load some art.
const_cast<InternetSearchView*>(view_)->LazyLoadAlbumCover(idx); const_cast<StreamingSearchView*>(view_)->LazyLoadAlbumCover(idx);
CollectionItemDelegate::paint(painter, option, idx); CollectionItemDelegate::paint(painter, option, idx);

View File

@@ -18,8 +18,8 @@
* *
*/ */
#ifndef INTERNETSEARCHITEMDELEGATE_H #ifndef STREAMINGSEARCHITEMDELEGATE_H
#define INTERNETSEARCHITEMDELEGATE_H #define STREAMINGSEARCHITEMDELEGATE_H
#include <QStyleOptionViewItem> #include <QStyleOptionViewItem>
#include <QStyleOption> #include <QStyleOption>
@@ -28,18 +28,18 @@
class QPainter; class QPainter;
class QModelIndex; class QModelIndex;
class InternetSearchView; class StreamingSearchView;
class InternetSearchItemDelegate : public CollectionItemDelegate { class StreamingSearchItemDelegate : public CollectionItemDelegate {
Q_OBJECT Q_OBJECT
public: public:
explicit InternetSearchItemDelegate(InternetSearchView *view); explicit StreamingSearchItemDelegate(StreamingSearchView *view);
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &idx) const override; void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &idx) const override;
private: private:
InternetSearchView *view_; StreamingSearchView *view_;
}; };
#endif // INTERNETSEARCHITEMDELEGATE_H #endif // STREAMINGSEARCHITEMDELEGATE_H

View File

@@ -32,12 +32,12 @@
#include "core/mimedata.h" #include "core/mimedata.h"
#include "core/iconloader.h" #include "core/iconloader.h"
#include "internetsongmimedata.h" #include "streamsongmimedata.h"
#include "internetservice.h" #include "streamingservice.h"
#include "internetsearchmodel.h" #include "streamingsearchmodel.h"
#include "internetsearchview.h" #include "streamingsearchview.h"
InternetSearchModel::InternetSearchModel(InternetServicePtr service, QObject *parent) StreamingSearchModel::StreamingSearchModel(StreamingServicePtr service, QObject *parent)
: QStandardItemModel(parent), : QStandardItemModel(parent),
service_(service), service_(service),
proxy_(nullptr), proxy_(nullptr),
@@ -54,9 +54,9 @@ InternetSearchModel::InternetSearchModel(InternetServicePtr service, QObject *pa
} }
void InternetSearchModel::AddResults(const InternetSearchView::ResultList &results) { void StreamingSearchModel::AddResults(const StreamingSearchView::ResultList &results) {
for (const InternetSearchView::Result &result : results) { for (const StreamingSearchView::Result &result : results) {
QStandardItem *parent = invisibleRootItem(); QStandardItem *parent = invisibleRootItem();
// Find (or create) the container nodes for this result if we can. // Find (or create) the container nodes for this result if we can.
@@ -74,7 +74,7 @@ void InternetSearchModel::AddResults(const InternetSearchView::ResultList &resul
} }
QStandardItem *InternetSearchModel::BuildContainers(const Song &s, QStandardItem *parent, ContainerKey *key, const int level) { QStandardItem *StreamingSearchModel::BuildContainers(const Song &s, QStandardItem *parent, ContainerKey *key, const int level) {
if (level >= 3) { if (level >= 3) {
return parent; return parent;
@@ -286,14 +286,14 @@ QStandardItem *InternetSearchModel::BuildContainers(const Song &s, QStandardItem
} }
void InternetSearchModel::Clear() { void StreamingSearchModel::Clear() {
containers_.clear(); containers_.clear();
clear(); clear();
} }
InternetSearchView::ResultList InternetSearchModel::GetChildResults(const QModelIndexList &indexes) const { StreamingSearchView::ResultList StreamingSearchModel::GetChildResults(const QModelIndexList &indexes) const {
QList<QStandardItem*> items; QList<QStandardItem*> items;
items.reserve(indexes.count()); items.reserve(indexes.count());
@@ -304,9 +304,9 @@ InternetSearchView::ResultList InternetSearchModel::GetChildResults(const QModel
} }
InternetSearchView::ResultList InternetSearchModel::GetChildResults(const QList<QStandardItem*> &items) const { StreamingSearchView::ResultList StreamingSearchModel::GetChildResults(const QList<QStandardItem*> &items) const {
InternetSearchView::ResultList results; StreamingSearchView::ResultList results;
QSet<const QStandardItem*> visited; QSet<const QStandardItem*> visited;
for (QStandardItem *item : items) { for (QStandardItem *item : items) {
@@ -317,7 +317,7 @@ InternetSearchView::ResultList InternetSearchModel::GetChildResults(const QList<
} }
void InternetSearchModel::GetChildResults(const QStandardItem *item, InternetSearchView::ResultList *results, QSet<const QStandardItem*> *visited) const { void StreamingSearchModel::GetChildResults(const QStandardItem *item, StreamingSearchView::ResultList *results, QSet<const QStandardItem*> *visited) const {
if (visited->contains(item)) { if (visited->contains(item)) {
return; return;
@@ -339,13 +339,13 @@ void InternetSearchModel::GetChildResults(const QStandardItem *item, InternetSea
// No - maybe it's a song, add its result if valid // No - maybe it's a song, add its result if valid
QVariant result = item->data(Role_Result); QVariant result = item->data(Role_Result);
if (result.isValid()) { if (result.isValid()) {
results->append(result.value<InternetSearchView::Result>()); results->append(result.value<StreamingSearchView::Result>());
} }
} }
} }
QMimeData *InternetSearchModel::mimeData(const QModelIndexList &indexes) const { QMimeData *StreamingSearchModel::mimeData(const QModelIndexList &indexes) const {
return LoadTracks(GetChildResults(indexes)); return LoadTracks(GetChildResults(indexes));
@@ -353,11 +353,11 @@ QMimeData *InternetSearchModel::mimeData(const QModelIndexList &indexes) const {
namespace { namespace {
void GatherResults(const QStandardItem *parent, InternetSearchView::ResultList *results) { void GatherResults(const QStandardItem *parent, StreamingSearchView::ResultList *results) {
QVariant result_variant = parent->data(InternetSearchModel::Role_Result); QVariant result_variant = parent->data(StreamingSearchModel::Role_Result);
if (result_variant.isValid()) { if (result_variant.isValid()) {
InternetSearchView::Result result = result_variant.value<InternetSearchView::Result>(); StreamingSearchView::Result result = result_variant.value<StreamingSearchView::Result>();
(*results).append(result); (*results).append(result);
} }
@@ -369,14 +369,14 @@ void GatherResults(const QStandardItem *parent, InternetSearchView::ResultList *
} // namespace } // namespace
void InternetSearchModel::SetGroupBy(const CollectionModel::Grouping grouping, const bool regroup_now) { void StreamingSearchModel::SetGroupBy(const CollectionModel::Grouping grouping, const bool regroup_now) {
const CollectionModel::Grouping old_group_by = group_by_; const CollectionModel::Grouping old_group_by = group_by_;
group_by_ = grouping; group_by_ = grouping;
if (regroup_now && group_by_ != old_group_by) { if (regroup_now && group_by_ != old_group_by) {
// Walk the tree gathering the results we have already // Walk the tree gathering the results we have already
InternetSearchView::ResultList results; StreamingSearchView::ResultList results;
GatherResults(invisibleRootItem(), &results); GatherResults(invisibleRootItem(), &results);
// Reset the model and re-add all the results using the new grouping. // Reset the model and re-add all the results using the new grouping.
@@ -386,7 +386,7 @@ void InternetSearchModel::SetGroupBy(const CollectionModel::Grouping grouping, c
} }
MimeData *InternetSearchModel::LoadTracks(const InternetSearchView::ResultList &results) const { MimeData *StreamingSearchModel::LoadTracks(const StreamingSearchView::ResultList &results) const {
if (results.isEmpty()) { if (results.isEmpty()) {
return nullptr; return nullptr;
@@ -396,14 +396,14 @@ MimeData *InternetSearchModel::LoadTracks(const InternetSearchView::ResultList &
QList<QUrl> urls; QList<QUrl> urls;
songs.reserve(results.count()); songs.reserve(results.count());
urls.reserve(results.count()); urls.reserve(results.count());
for (const InternetSearchView::Result &result : results) { for (const StreamingSearchView::Result &result : results) {
songs.append(result.metadata_); songs.append(result.metadata_);
urls << result.metadata_.url(); urls << result.metadata_.url();
} }
InternetSongMimeData *internet_song_mime_data = new InternetSongMimeData(service_); StreamSongMimeData *streaming_song_mime_data = new StreamSongMimeData(service_);
internet_song_mime_data->songs = songs; streaming_song_mime_data->songs = songs;
MimeData *mime_data = internet_song_mime_data; MimeData *mime_data = streaming_song_mime_data;
mime_data->setUrls(urls); mime_data->setUrls(urls);

View File

@@ -19,8 +19,8 @@
* *
*/ */
#ifndef INTERNETSEARCHMODEL_H #ifndef STREAMINGSEARCHMODEL_H
#define INTERNETSEARCHMODEL_H #define STREAMINGSEARCHMODEL_H
#include "config.h" #include "config.h"
@@ -39,19 +39,19 @@
#include "core/shared_ptr.h" #include "core/shared_ptr.h"
#include "core/song.h" #include "core/song.h"
#include "collection/collectionmodel.h" #include "collection/collectionmodel.h"
#include "internetsearchview.h" #include "streamingsearchview.h"
class QMimeData; class QMimeData;
class QSortFilterProxyModel; class QSortFilterProxyModel;
class MimeData; class MimeData;
class InternetService; class StreamingService;
class InternetSearchModel : public QStandardItemModel { class StreamingSearchModel : public QStandardItemModel {
Q_OBJECT Q_OBJECT
public: public:
explicit InternetSearchModel(SharedPtr<InternetService> service, QObject *parent = nullptr); explicit StreamingSearchModel(SharedPtr<StreamingService> service, QObject *parent = nullptr);
enum Role { enum Role {
Role_Result = CollectionModel::LastRole, Role_Result = CollectionModel::LastRole,
@@ -69,24 +69,24 @@ class InternetSearchModel : public QStandardItemModel {
void Clear(); void Clear();
InternetSearchView::ResultList GetChildResults(const QModelIndexList &indexes) const; StreamingSearchView::ResultList GetChildResults(const QModelIndexList &indexes) const;
InternetSearchView::ResultList GetChildResults(const QList<QStandardItem*> &items) const; StreamingSearchView::ResultList GetChildResults(const QList<QStandardItem*> &items) const;
QMimeData *mimeData(const QModelIndexList &indexes) const override; QMimeData *mimeData(const QModelIndexList &indexes) const override;
// Loads tracks for results that were previously emitted by ResultsAvailable. // Loads tracks for results that were previously emitted by ResultsAvailable.
// The implementation creates a SongMimeData with one Song for each Result. // The implementation creates a SongMimeData with one Song for each Result.
MimeData *LoadTracks(const InternetSearchView::ResultList &results) const; MimeData *LoadTracks(const StreamingSearchView::ResultList &results) const;
public slots: public slots:
void AddResults(const InternetSearchView::ResultList &results); void AddResults(const StreamingSearchView::ResultList &results);
private: private:
QStandardItem *BuildContainers(const Song &s, QStandardItem *parent, ContainerKey *key, const int level = 0); QStandardItem *BuildContainers(const Song &s, QStandardItem *parent, ContainerKey *key, const int level = 0);
void GetChildResults(const QStandardItem *item, InternetSearchView::ResultList *results, QSet<const QStandardItem*> *visited) const; void GetChildResults(const QStandardItem *item, StreamingSearchView::ResultList *results, QSet<const QStandardItem*> *visited) const;
private: private:
SharedPtr<InternetService> service_; SharedPtr<StreamingService> service_;
QSortFilterProxyModel *proxy_; QSortFilterProxyModel *proxy_;
bool use_pretty_covers_; bool use_pretty_covers_;
QIcon artist_icon_; QIcon artist_icon_;
@@ -97,14 +97,14 @@ class InternetSearchModel : public QStandardItemModel {
}; };
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
inline size_t qHash(const InternetSearchModel::ContainerKey &key) { inline size_t qHash(const StreamingSearchModel::ContainerKey &key) {
#else #else
inline uint qHash(const InternetSearchModel::ContainerKey &key) { inline uint qHash(const StreamingSearchModel::ContainerKey &key) {
#endif #endif
return qHash(key.group_[0]) ^ qHash(key.group_[1]) ^ qHash(key.group_[2]); return qHash(key.group_[0]) ^ qHash(key.group_[1]) ^ qHash(key.group_[2]);
} }
inline bool operator<(const InternetSearchModel::ContainerKey &left, const InternetSearchModel::ContainerKey &right) { inline bool operator<(const StreamingSearchModel::ContainerKey &left, const StreamingSearchModel::ContainerKey &right) {
#define CMP(field) \ #define CMP(field) \
if (left.field < right.field) return true; \ if (left.field < right.field) return true; \
if (left.field > right.field) return false if (left.field > right.field) return false
@@ -117,4 +117,4 @@ inline bool operator<(const InternetSearchModel::ContainerKey &left, const Inter
#undef CMP #undef CMP
} }
#endif // INTERNETSEARCHMODEL_H #endif // STREAMINGSEARCHMODEL_H

View File

@@ -26,13 +26,13 @@
#include <QString> #include <QString>
#include "collection/collectionmodel.h" #include "collection/collectionmodel.h"
#include "internetsearchmodel.h" #include "streamingsearchmodel.h"
#include "internetsearchsortmodel.h" #include "streamingsearchsortmodel.h"
#include "internetsearchview.h" #include "streamingsearchview.h"
InternetSearchSortModel::InternetSearchSortModel(QObject *parent) : QSortFilterProxyModel(parent) {} StreamingSearchSortModel::StreamingSearchSortModel(QObject *parent) : QSortFilterProxyModel(parent) {}
bool InternetSearchSortModel::lessThan(const QModelIndex &left, const QModelIndex &right) const { bool StreamingSearchSortModel::lessThan(const QModelIndex &left, const QModelIndex &right) const {
// Dividers always go first // Dividers always go first
if (left.data(CollectionModel::Role_IsDivider).toBool()) return true; if (left.data(CollectionModel::Role_IsDivider).toBool()) return true;
@@ -50,8 +50,8 @@ bool InternetSearchSortModel::lessThan(const QModelIndex &left, const QModelInde
} }
// Otherwise we're comparing songs. Sort by disc, track, then title. // Otherwise we're comparing songs. Sort by disc, track, then title.
const InternetSearchView::Result r1 = left.data(InternetSearchModel::Role_Result).value<InternetSearchView::Result>(); const StreamingSearchView::Result r1 = left.data(StreamingSearchModel::Role_Result).value<StreamingSearchView::Result>();
const InternetSearchView::Result r2 = right.data(InternetSearchModel::Role_Result).value<InternetSearchView::Result>(); const StreamingSearchView::Result r2 = right.data(StreamingSearchModel::Role_Result).value<StreamingSearchView::Result>();
if (r1.metadata_.disc() < r2.metadata_.disc()) return true; if (r1.metadata_.disc() < r2.metadata_.disc()) return true;
if (r1.metadata_.disc() > r2.metadata_.disc()) return false; if (r1.metadata_.disc() > r2.metadata_.disc()) return false;

View File

@@ -18,22 +18,22 @@
* *
*/ */
#ifndef INTERNETSEARCHSORTMODEL_H #ifndef STREAMINGSEARCHSORTMODEL_H
#define INTERNETSEARCHSORTMODEL_H #define STREAMINGSEARCHSORTMODEL_H
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
class QObject; class QObject;
class QModelIndex; class QModelIndex;
class InternetSearchSortModel : public QSortFilterProxyModel { class StreamingSearchSortModel : public QSortFilterProxyModel {
Q_OBJECT Q_OBJECT
public: public:
explicit InternetSearchSortModel(QObject *parent = nullptr); explicit StreamingSearchSortModel(QObject *parent = nullptr);
protected: protected:
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
}; };
#endif // INTERNETSEARCHSORTMODEL_H #endif // STREAMINGSEARCHSORTMODEL_H

View File

@@ -75,37 +75,37 @@
#include "collection/savedgroupingmanager.h" #include "collection/savedgroupingmanager.h"
#include "covermanager/albumcoverloader.h" #include "covermanager/albumcoverloader.h"
#include "covermanager/albumcoverloaderresult.h" #include "covermanager/albumcoverloaderresult.h"
#include "internetsongmimedata.h" #include "streamsongmimedata.h"
#include "internetservice.h" #include "streamingservice.h"
#include "internetsearchitemdelegate.h" #include "streamingsearchitemdelegate.h"
#include "internetsearchmodel.h" #include "streamingsearchmodel.h"
#include "internetsearchsortmodel.h" #include "streamingsearchsortmodel.h"
#include "internetsearchview.h" #include "streamingsearchview.h"
#include "ui_internetsearchview.h" #include "ui_streamingsearchview.h"
#include "settings/appearancesettingspage.h" #include "settings/appearancesettingspage.h"
using std::make_unique; using std::make_unique;
const int InternetSearchView::kSwapModelsTimeoutMsec = 250; const int StreamingSearchView::kSwapModelsTimeoutMsec = 250;
const int InternetSearchView::kDelayedSearchTimeoutMs = 200; const int StreamingSearchView::kDelayedSearchTimeoutMs = 200;
const int InternetSearchView::kArtHeight = 32; const int StreamingSearchView::kArtHeight = 32;
InternetSearchView::InternetSearchView(QWidget *parent) StreamingSearchView::StreamingSearchView(QWidget *parent)
: QWidget(parent), : QWidget(parent),
app_(nullptr), app_(nullptr),
service_(nullptr), service_(nullptr),
ui_(new Ui_InternetSearchView), ui_(new Ui_StreamingSearchView),
context_menu_(nullptr), context_menu_(nullptr),
group_by_actions_(nullptr), group_by_actions_(nullptr),
front_model_(nullptr), front_model_(nullptr),
back_model_(nullptr), back_model_(nullptr),
current_model_(nullptr), current_model_(nullptr),
front_proxy_(new InternetSearchSortModel(this)), front_proxy_(new StreamingSearchSortModel(this)),
back_proxy_(new InternetSearchSortModel(this)), back_proxy_(new StreamingSearchSortModel(this)),
current_proxy_(front_proxy_), current_proxy_(front_proxy_),
swap_models_timer_(new QTimer(this)), swap_models_timer_(new QTimer(this)),
use_pretty_covers_(true), use_pretty_covers_(true),
search_type_(InternetSearchView::SearchType::Artists), search_type_(StreamingSearchView::SearchType::Artists),
search_error_(false), search_error_(false),
last_search_id_(0), last_search_id_(0),
searches_next_id_(1) { searches_next_id_(1) {
@@ -118,7 +118,7 @@ InternetSearchView::InternetSearchView(QWidget *parent)
ui_->settings->setIcon(IconLoader::Load(QStringLiteral("configure"))); ui_->settings->setIcon(IconLoader::Load(QStringLiteral("configure")));
// Set the appearance of the results list // Set the appearance of the results list
ui_->results->setItemDelegate(new InternetSearchItemDelegate(this)); ui_->results->setItemDelegate(new StreamingSearchItemDelegate(this));
ui_->results->setAttribute(Qt::WA_MacShowFocusRect, false); ui_->results->setAttribute(Qt::WA_MacShowFocusRect, false);
ui_->results->setStyleSheet(QStringLiteral("QTreeView::item{padding-top:1px;}")); ui_->results->setStyleSheet(QStringLiteral("QTreeView::item{padding-top:1px;}"));
@@ -144,18 +144,18 @@ InternetSearchView::InternetSearchView(QWidget *parent)
} }
InternetSearchView::~InternetSearchView() { delete ui_; } StreamingSearchView::~StreamingSearchView() { delete ui_; }
void InternetSearchView::Init(Application *app, InternetServicePtr service) { void StreamingSearchView::Init(Application *app, StreamingServicePtr service) {
app_ = app; app_ = app;
service_ = service; service_ = service;
front_model_ = new InternetSearchModel(service, this); front_model_ = new StreamingSearchModel(service, this);
back_model_ = new InternetSearchModel(service, this); back_model_ = new StreamingSearchModel(service, this);
front_proxy_ = new InternetSearchSortModel(this); front_proxy_ = new StreamingSearchSortModel(this);
back_proxy_ = new InternetSearchSortModel(this); back_proxy_ = new StreamingSearchSortModel(this);
front_model_->set_proxy(front_proxy_); front_model_->set_proxy(front_proxy_);
back_model_->set_proxy(back_proxy_); back_model_->set_proxy(back_proxy_);
@@ -177,30 +177,30 @@ void InternetSearchView::Init(Application *app, InternetServicePtr service) {
QMenu *settings_menu = new QMenu(this); QMenu *settings_menu = new QMenu(this);
settings_menu->addActions(group_by_actions_->actions()); settings_menu->addActions(group_by_actions_->actions());
settings_menu->addSeparator(); settings_menu->addSeparator();
settings_menu->addAction(IconLoader::Load(QStringLiteral("configure")), tr("Configure %1...").arg(Song::DescriptionForSource(service_->source())), this, &InternetSearchView::OpenSettingsDialog); settings_menu->addAction(IconLoader::Load(QStringLiteral("configure")), tr("Configure %1...").arg(Song::DescriptionForSource(service_->source())), this, &StreamingSearchView::OpenSettingsDialog);
ui_->settings->setMenu(settings_menu); ui_->settings->setMenu(settings_menu);
swap_models_timer_->setSingleShot(true); swap_models_timer_->setSingleShot(true);
swap_models_timer_->setInterval(kSwapModelsTimeoutMsec); swap_models_timer_->setInterval(kSwapModelsTimeoutMsec);
QObject::connect(swap_models_timer_, &QTimer::timeout, this, &InternetSearchView::SwapModels); QObject::connect(swap_models_timer_, &QTimer::timeout, this, &StreamingSearchView::SwapModels);
QObject::connect(ui_->radiobutton_search_artists, &QRadioButton::clicked, this, &InternetSearchView::SearchArtistsClicked); QObject::connect(ui_->radiobutton_search_artists, &QRadioButton::clicked, this, &StreamingSearchView::SearchArtistsClicked);
QObject::connect(ui_->radiobutton_search_albums, &QRadioButton::clicked, this, &InternetSearchView::SearchAlbumsClicked); QObject::connect(ui_->radiobutton_search_albums, &QRadioButton::clicked, this, &StreamingSearchView::SearchAlbumsClicked);
QObject::connect(ui_->radiobutton_search_songs, &QRadioButton::clicked, this, &InternetSearchView::SearchSongsClicked); QObject::connect(ui_->radiobutton_search_songs, &QRadioButton::clicked, this, &StreamingSearchView::SearchSongsClicked);
QObject::connect(group_by_actions_, &QActionGroup::triggered, this, &InternetSearchView::GroupByClicked); QObject::connect(group_by_actions_, &QActionGroup::triggered, this, &StreamingSearchView::GroupByClicked);
QObject::connect(group_by_actions_, &QActionGroup::triggered, this, &InternetSearchView::GroupByClicked); QObject::connect(group_by_actions_, &QActionGroup::triggered, this, &StreamingSearchView::GroupByClicked);
QObject::connect(ui_->search, &QSearchField::textChanged, this, &InternetSearchView::TextEdited); QObject::connect(ui_->search, &QSearchField::textChanged, this, &StreamingSearchView::TextEdited);
QObject::connect(ui_->results, &AutoExpandingTreeView::AddToPlaylistSignal, this, &InternetSearchView::AddToPlaylist); QObject::connect(ui_->results, &AutoExpandingTreeView::AddToPlaylistSignal, this, &StreamingSearchView::AddToPlaylist);
QObject::connect(ui_->results, &AutoExpandingTreeView::FocusOnFilterSignal, this, &InternetSearchView::FocusOnFilter); QObject::connect(ui_->results, &AutoExpandingTreeView::FocusOnFilterSignal, this, &StreamingSearchView::FocusOnFilter);
QObject::connect(&*service_, &InternetService::SearchUpdateStatus, this, &InternetSearchView::UpdateStatus); QObject::connect(&*service_, &StreamingService::SearchUpdateStatus, this, &StreamingSearchView::UpdateStatus);
QObject::connect(&*service_, &InternetService::SearchProgressSetMaximum, this, &InternetSearchView::ProgressSetMaximum); QObject::connect(&*service_, &StreamingService::SearchProgressSetMaximum, this, &StreamingSearchView::ProgressSetMaximum);
QObject::connect(&*service_, &InternetService::SearchUpdateProgress, this, &InternetSearchView::UpdateProgress); QObject::connect(&*service_, &StreamingService::SearchUpdateProgress, this, &StreamingSearchView::UpdateProgress);
QObject::connect(&*service_, &InternetService::SearchResults, this, &InternetSearchView::SearchDone); QObject::connect(&*service_, &StreamingService::SearchResults, this, &StreamingSearchView::SearchDone);
QObject::connect(app_, &Application::SettingsChanged, this, &InternetSearchView::ReloadSettings); QObject::connect(app_, &Application::SettingsChanged, this, &StreamingSearchView::ReloadSettings);
QObject::connect(&*app_->album_cover_loader(), &AlbumCoverLoader::AlbumCoverLoaded, this, &InternetSearchView::AlbumCoverLoaded); QObject::connect(&*app_->album_cover_loader(), &AlbumCoverLoader::AlbumCoverLoaded, this, &StreamingSearchView::AlbumCoverLoaded);
QObject::connect(ui_->settings, &QToolButton::clicked, ui_->settings, &QToolButton::showMenu); QObject::connect(ui_->settings, &QToolButton::clicked, ui_->settings, &QToolButton::showMenu);
@@ -208,7 +208,7 @@ void InternetSearchView::Init(Application *app, InternetServicePtr service) {
} }
void InternetSearchView::ReloadSettings() { void StreamingSearchView::ReloadSettings() {
Settings s; Settings s;
@@ -219,17 +219,17 @@ void InternetSearchView::ReloadSettings() {
front_model_->set_use_pretty_covers(use_pretty_covers_); front_model_->set_use_pretty_covers(use_pretty_covers_);
back_model_->set_use_pretty_covers(use_pretty_covers_); back_model_->set_use_pretty_covers(use_pretty_covers_);
// Internet search settings // Streaming search settings
search_type_ = static_cast<InternetSearchView::SearchType>(s.value("type", static_cast<int>(InternetSearchView::SearchType::Artists)).toInt()); search_type_ = static_cast<StreamingSearchView::SearchType>(s.value("type", static_cast<int>(StreamingSearchView::SearchType::Artists)).toInt());
switch (search_type_) { switch (search_type_) {
case InternetSearchView::SearchType::Artists: case StreamingSearchView::SearchType::Artists:
ui_->radiobutton_search_artists->setChecked(true); ui_->radiobutton_search_artists->setChecked(true);
break; break;
case InternetSearchView::SearchType::Albums: case StreamingSearchView::SearchType::Albums:
ui_->radiobutton_search_albums->setChecked(true); ui_->radiobutton_search_albums->setChecked(true);
break; break;
case InternetSearchView::SearchType::Songs: case StreamingSearchView::SearchType::Songs:
ui_->radiobutton_search_songs->setChecked(true); ui_->radiobutton_search_songs->setChecked(true);
break; break;
} }
@@ -255,7 +255,7 @@ void InternetSearchView::ReloadSettings() {
} }
void InternetSearchView::showEvent(QShowEvent *e) { void StreamingSearchView::showEvent(QShowEvent *e) {
QWidget::showEvent(e); QWidget::showEvent(e);
@@ -265,7 +265,7 @@ void InternetSearchView::showEvent(QShowEvent *e) {
} }
bool InternetSearchView::eventFilter(QObject *object, QEvent *e) { bool StreamingSearchView::eventFilter(QObject *object, QEvent *e) {
if (object == ui_->search && e->type() == QEvent::KeyRelease) { if (object == ui_->search && e->type() == QEvent::KeyRelease) {
if (SearchKeyEvent(static_cast<QKeyEvent*>(e))) { if (SearchKeyEvent(static_cast<QKeyEvent*>(e))) {
@@ -282,7 +282,7 @@ bool InternetSearchView::eventFilter(QObject *object, QEvent *e) {
} }
bool InternetSearchView::SearchKeyEvent(QKeyEvent *e) { bool StreamingSearchView::SearchKeyEvent(QKeyEvent *e) {
switch (e->key()) { switch (e->key()) {
case Qt::Key_Up: case Qt::Key_Up:
@@ -310,40 +310,40 @@ bool InternetSearchView::SearchKeyEvent(QKeyEvent *e) {
} }
bool InternetSearchView::ResultsContextMenuEvent(QContextMenuEvent *e) { bool StreamingSearchView::ResultsContextMenuEvent(QContextMenuEvent *e) {
if (!context_menu_) { if (!context_menu_) {
context_menu_ = new QMenu(this); context_menu_ = new QMenu(this);
context_actions_ << context_menu_->addAction(IconLoader::Load(QStringLiteral("media-playback-start")), tr("Append to current playlist"), this, &InternetSearchView::AddSelectedToPlaylist); context_actions_ << context_menu_->addAction(IconLoader::Load(QStringLiteral("media-playback-start")), tr("Append to current playlist"), this, &StreamingSearchView::AddSelectedToPlaylist);
context_actions_ << context_menu_->addAction(IconLoader::Load(QStringLiteral("media-playback-start")), tr("Replace current playlist"), this, &InternetSearchView::LoadSelected); context_actions_ << context_menu_->addAction(IconLoader::Load(QStringLiteral("media-playback-start")), tr("Replace current playlist"), this, &StreamingSearchView::LoadSelected);
context_actions_ << context_menu_->addAction(IconLoader::Load(QStringLiteral("document-new")), tr("Open in new playlist"), this, &InternetSearchView::OpenSelectedInNewPlaylist); context_actions_ << context_menu_->addAction(IconLoader::Load(QStringLiteral("document-new")), tr("Open in new playlist"), this, &StreamingSearchView::OpenSelectedInNewPlaylist);
context_menu_->addSeparator(); context_menu_->addSeparator();
context_actions_ << context_menu_->addAction(IconLoader::Load(QStringLiteral("go-next")), tr("Queue track"), this, &InternetSearchView::AddSelectedToPlaylistEnqueue); context_actions_ << context_menu_->addAction(IconLoader::Load(QStringLiteral("go-next")), tr("Queue track"), this, &StreamingSearchView::AddSelectedToPlaylistEnqueue);
context_menu_->addSeparator(); context_menu_->addSeparator();
if (service_->artists_collection_model() || service_->albums_collection_model() || service_->songs_collection_model()) { if (service_->artists_collection_model() || service_->albums_collection_model() || service_->songs_collection_model()) {
if (service_->artists_collection_model()) { if (service_->artists_collection_model()) {
context_actions_ << context_menu_->addAction(IconLoader::Load(QStringLiteral("folder-new")), tr("Add to artists"), this, &InternetSearchView::AddArtists); context_actions_ << context_menu_->addAction(IconLoader::Load(QStringLiteral("folder-new")), tr("Add to artists"), this, &StreamingSearchView::AddArtists);
} }
if (service_->albums_collection_model()) { if (service_->albums_collection_model()) {
context_actions_ << context_menu_->addAction(IconLoader::Load(QStringLiteral("folder-new")), tr("Add to albums"), this, &InternetSearchView::AddAlbums); context_actions_ << context_menu_->addAction(IconLoader::Load(QStringLiteral("folder-new")), tr("Add to albums"), this, &StreamingSearchView::AddAlbums);
} }
if (service_->songs_collection_model()) { if (service_->songs_collection_model()) {
context_actions_ << context_menu_->addAction(IconLoader::Load(QStringLiteral("folder-new")), tr("Add to songs"), this, &InternetSearchView::AddSongs); context_actions_ << context_menu_->addAction(IconLoader::Load(QStringLiteral("folder-new")), tr("Add to songs"), this, &StreamingSearchView::AddSongs);
} }
context_menu_->addSeparator(); context_menu_->addSeparator();
} }
if (ui_->results->selectionModel() && ui_->results->selectionModel()->selectedRows().length() == 1) { if (ui_->results->selectionModel() && ui_->results->selectionModel()->selectedRows().length() == 1) {
context_actions_ << context_menu_->addAction(IconLoader::Load(QStringLiteral("search")), tr("Search for this"), this, &InternetSearchView::SearchForThis); context_actions_ << context_menu_->addAction(IconLoader::Load(QStringLiteral("search")), tr("Search for this"), this, &StreamingSearchView::SearchForThis);
} }
context_menu_->addSeparator(); context_menu_->addSeparator();
context_menu_->addMenu(tr("Group by"))->addActions(group_by_actions_->actions()); context_menu_->addMenu(tr("Group by"))->addActions(group_by_actions_->actions());
context_menu_->addAction(IconLoader::Load(QStringLiteral("configure")), tr("Configure %1...").arg(Song::TextForSource(service_->source())), this, &InternetSearchView::OpenSettingsDialog); context_menu_->addAction(IconLoader::Load(QStringLiteral("configure")), tr("Configure %1...").arg(Song::TextForSource(service_->source())), this, &StreamingSearchView::OpenSettingsDialog);
} }
@@ -359,7 +359,7 @@ bool InternetSearchView::ResultsContextMenuEvent(QContextMenuEvent *e) {
} }
void InternetSearchView::timerEvent(QTimerEvent *e) { void StreamingSearchView::timerEvent(QTimerEvent *e) {
QMap<int, DelayedSearch>::iterator it = delayed_searches_.find(e->timerId()); QMap<int, DelayedSearch>::iterator it = delayed_searches_.find(e->timerId());
if (it != delayed_searches_.end()) { if (it != delayed_searches_.end()) {
@@ -372,7 +372,7 @@ void InternetSearchView::timerEvent(QTimerEvent *e) {
} }
void InternetSearchView::StartSearch(const QString &query) { void StreamingSearchView::StartSearch(const QString &query) {
ui_->search->setText(query); ui_->search->setText(query);
TextEdited(query); TextEdited(query);
@@ -383,7 +383,7 @@ void InternetSearchView::StartSearch(const QString &query) {
} }
void InternetSearchView::TextEdited(const QString &text) { void StreamingSearchView::TextEdited(const QString &text) {
const QString trimmed(text.trimmed()); const QString trimmed(text.trimmed());
@@ -414,7 +414,7 @@ void InternetSearchView::TextEdited(const QString &text) {
} }
void InternetSearchView::SwapModels() { void StreamingSearchView::SwapModels() {
cover_loader_tasks_.clear(); cover_loader_tasks_.clear();
@@ -432,7 +432,7 @@ void InternetSearchView::SwapModels() {
} }
QStringList InternetSearchView::TokenizeQuery(const QString &query) { QStringList StreamingSearchView::TokenizeQuery(const QString &query) {
QStringList tokens(query.split(QRegularExpression(QStringLiteral("\\s+")))); QStringList tokens(query.split(QRegularExpression(QStringLiteral("\\s+"))));
@@ -451,7 +451,7 @@ QStringList InternetSearchView::TokenizeQuery(const QString &query) {
} }
bool InternetSearchView::Matches(const QStringList &tokens, const QString &string) { bool StreamingSearchView::Matches(const QStringList &tokens, const QString &string) {
for (const QString &token : tokens) { for (const QString &token : tokens) {
if (!string.contains(token, Qt::CaseInsensitive)) { if (!string.contains(token, Qt::CaseInsensitive)) {
@@ -463,7 +463,7 @@ bool InternetSearchView::Matches(const QStringList &tokens, const QString &strin
} }
int InternetSearchView::SearchAsync(const QString &query, const SearchType type) { int StreamingSearchView::SearchAsync(const QString &query, const SearchType type) {
const int id = searches_next_id_++; const int id = searches_next_id_++;
@@ -476,14 +476,14 @@ int InternetSearchView::SearchAsync(const QString &query, const SearchType type)
} }
void InternetSearchView::SearchAsync(const int id, const QString &query, const SearchType type) { void StreamingSearchView::SearchAsync(const int id, const QString &query, const SearchType type) {
const int service_id = service_->Search(query, type); const int service_id = service_->Search(query, type);
pending_searches_[service_id] = PendingState(id, TokenizeQuery(query)); pending_searches_[service_id] = PendingState(id, TokenizeQuery(query));
} }
void InternetSearchView::SearchDone(const int service_id, const SongMap &songs, const QString &error) { void StreamingSearchView::SearchDone(const int service_id, const SongMap &songs, const QString &error) {
if (!pending_searches_.contains(service_id)) return; if (!pending_searches_.contains(service_id)) return;
@@ -505,7 +505,7 @@ void InternetSearchView::SearchDone(const int service_id, const SongMap &songs,
} }
// Load cached pixmaps into the results // Load cached pixmaps into the results
for (InternetSearchView::ResultList::iterator it = results.begin(); it != results.end(); ++it) { for (StreamingSearchView::ResultList::iterator it = results.begin(); it != results.end(); ++it) {
it->pixmap_cache_key_ = PixmapCacheKey(*it); it->pixmap_cache_key_ = PixmapCacheKey(*it);
} }
@@ -513,7 +513,7 @@ void InternetSearchView::SearchDone(const int service_id, const SongMap &songs,
} }
void InternetSearchView::CancelSearch(const int id) { void StreamingSearchView::CancelSearch(const int id) {
QMap<int, DelayedSearch>::iterator it; QMap<int, DelayedSearch>::iterator it;
for (it = delayed_searches_.begin(); it != delayed_searches_.end(); ++it) { for (it = delayed_searches_.begin(); it != delayed_searches_.end(); ++it) {
@@ -527,7 +527,7 @@ void InternetSearchView::CancelSearch(const int id) {
} }
void InternetSearchView::AddResults(const int id, const InternetSearchView::ResultList &results) { void StreamingSearchView::AddResults(const int id, const StreamingSearchView::ResultList &results) {
if (id != last_search_id_ || results.isEmpty()) return; if (id != last_search_id_ || results.isEmpty()) return;
@@ -538,7 +538,7 @@ void InternetSearchView::AddResults(const int id, const InternetSearchView::Resu
} }
void InternetSearchView::SearchError(const int id, const QString &error) { void StreamingSearchView::SearchError(const int id, const QString &error) {
if (id != last_search_id_) return; if (id != last_search_id_) return;
@@ -551,7 +551,7 @@ void InternetSearchView::SearchError(const int id, const QString &error) {
} }
void InternetSearchView::UpdateStatus(const int service_id, const QString &text) { void StreamingSearchView::UpdateStatus(const int service_id, const QString &text) {
if (!pending_searches_.contains(service_id)) return; if (!pending_searches_.contains(service_id)) return;
const PendingState state = pending_searches_[service_id]; const PendingState state = pending_searches_[service_id];
@@ -562,7 +562,7 @@ void InternetSearchView::UpdateStatus(const int service_id, const QString &text)
} }
void InternetSearchView::ProgressSetMaximum(const int service_id, const int max) { void StreamingSearchView::ProgressSetMaximum(const int service_id, const int max) {
if (!pending_searches_.contains(service_id)) return; if (!pending_searches_.contains(service_id)) return;
const PendingState state = pending_searches_[service_id]; const PendingState state = pending_searches_[service_id];
@@ -572,7 +572,7 @@ void InternetSearchView::ProgressSetMaximum(const int service_id, const int max)
} }
void InternetSearchView::UpdateProgress(const int service_id, const int progress) { void StreamingSearchView::UpdateProgress(const int service_id, const int progress) {
if (!pending_searches_.contains(service_id)) return; if (!pending_searches_.contains(service_id)) return;
const PendingState state = pending_searches_[service_id]; const PendingState state = pending_searches_[service_id];
@@ -582,7 +582,7 @@ void InternetSearchView::UpdateProgress(const int service_id, const int progress
} }
MimeData *InternetSearchView::SelectedMimeData() { MimeData *StreamingSearchView::SelectedMimeData() {
if (!ui_->results->selectionModel()) return nullptr; if (!ui_->results->selectionModel()) return nullptr;
@@ -616,11 +616,11 @@ MimeData *InternetSearchView::SelectedMimeData() {
} }
void InternetSearchView::AddSelectedToPlaylist() { void StreamingSearchView::AddSelectedToPlaylist() {
emit AddToPlaylist(SelectedMimeData()); emit AddToPlaylist(SelectedMimeData());
} }
void InternetSearchView::LoadSelected() { void StreamingSearchView::LoadSelected() {
MimeData *mimedata = SelectedMimeData(); MimeData *mimedata = SelectedMimeData();
if (!mimedata) return; if (!mimedata) return;
@@ -630,7 +630,7 @@ void InternetSearchView::LoadSelected() {
} }
void InternetSearchView::AddSelectedToPlaylistEnqueue() { void StreamingSearchView::AddSelectedToPlaylistEnqueue() {
MimeData *mimedata = SelectedMimeData(); MimeData *mimedata = SelectedMimeData();
if (!mimedata) return; if (!mimedata) return;
@@ -640,7 +640,7 @@ void InternetSearchView::AddSelectedToPlaylistEnqueue() {
} }
void InternetSearchView::OpenSelectedInNewPlaylist() { void StreamingSearchView::OpenSelectedInNewPlaylist() {
MimeData *mimedata = SelectedMimeData(); MimeData *mimedata = SelectedMimeData();
if (!mimedata) return; if (!mimedata) return;
@@ -650,40 +650,40 @@ void InternetSearchView::OpenSelectedInNewPlaylist() {
} }
void InternetSearchView::SearchForThis() { void StreamingSearchView::SearchForThis() {
StartSearch(ui_->results->selectionModel()->selectedRows().first().data().toString()); StartSearch(ui_->results->selectionModel()->selectedRows().first().data().toString());
} }
bool InternetSearchView::SearchFieldHasFocus() const { bool StreamingSearchView::SearchFieldHasFocus() const {
return ui_->search->hasFocus(); return ui_->search->hasFocus();
} }
void InternetSearchView::FocusSearchField() { void StreamingSearchView::FocusSearchField() {
ui_->search->setFocus(); ui_->search->setFocus();
ui_->search->selectAll(); ui_->search->selectAll();
} }
void InternetSearchView::FocusOnFilter(QKeyEvent *e) { void StreamingSearchView::FocusOnFilter(QKeyEvent *e) {
ui_->search->setFocus(); ui_->search->setFocus();
QApplication::sendEvent(ui_->search, e); QApplication::sendEvent(ui_->search, e);
} }
void InternetSearchView::OpenSettingsDialog() { void StreamingSearchView::OpenSettingsDialog() {
app_->OpenSettingsDialogAtPage(service_->settings_page()); app_->OpenSettingsDialogAtPage(service_->settings_page());
} }
void InternetSearchView::GroupByClicked(QAction *action) { void StreamingSearchView::GroupByClicked(QAction *action) {
if (action->property("group_by").isNull()) { if (action->property("group_by").isNull()) {
if (!group_by_dialog_) { if (!group_by_dialog_) {
group_by_dialog_ = make_unique<GroupByDialog>(); group_by_dialog_ = make_unique<GroupByDialog>();
QObject::connect(&*group_by_dialog_, &GroupByDialog::Accepted, this, &InternetSearchView::SetGroupBy); QObject::connect(&*group_by_dialog_, &GroupByDialog::Accepted, this, &StreamingSearchView::SetGroupBy);
} }
group_by_dialog_->show(); group_by_dialog_->show();
@@ -694,11 +694,11 @@ void InternetSearchView::GroupByClicked(QAction *action) {
} }
void InternetSearchView::SetGroupBy(const CollectionModel::Grouping g) { void StreamingSearchView::SetGroupBy(const CollectionModel::Grouping g) {
// Clear requests: changing "group by" on the models will cause all the items to be removed/added again, // Clear requests: changing "group by" on the models will cause all the items to be removed/added again,
// so all the QModelIndex here will become invalid. New requests will be created for those // so all the QModelIndex here will become invalid. New requests will be created for those
// songs when they will be displayed again anyway (when InternetSearchItemDelegate::paint will call LazyLoadAlbumCover) // songs when they will be displayed again anyway (when StreamingSearchItemDelegate::paint will call LazyLoadAlbumCover)
cover_loader_tasks_.clear(); cover_loader_tasks_.clear();
// Update the models // Update the models
@@ -730,19 +730,19 @@ void InternetSearchView::SetGroupBy(const CollectionModel::Grouping g) {
} }
void InternetSearchView::SearchArtistsClicked(const bool) { void StreamingSearchView::SearchArtistsClicked(const bool) {
SetSearchType(InternetSearchView::SearchType::Artists); SetSearchType(StreamingSearchView::SearchType::Artists);
} }
void InternetSearchView::SearchAlbumsClicked(const bool) { void StreamingSearchView::SearchAlbumsClicked(const bool) {
SetSearchType(InternetSearchView::SearchType::Albums); SetSearchType(StreamingSearchView::SearchType::Albums);
} }
void InternetSearchView::SearchSongsClicked(const bool) { void StreamingSearchView::SearchSongsClicked(const bool) {
SetSearchType(InternetSearchView::SearchType::Songs); SetSearchType(StreamingSearchView::SearchType::Songs);
} }
void InternetSearchView::SetSearchType(const InternetSearchView::SearchType type) { void StreamingSearchView::SetSearchType(const StreamingSearchView::SearchType type) {
search_type_ = type; search_type_ = type;
@@ -755,37 +755,37 @@ void InternetSearchView::SetSearchType(const InternetSearchView::SearchType type
} }
void InternetSearchView::AddArtists() { void StreamingSearchView::AddArtists() {
MimeData *mimedata = SelectedMimeData(); MimeData *mimedata = SelectedMimeData();
if (!mimedata) return; if (!mimedata) return;
if (const InternetSongMimeData *internet_song_data = qobject_cast<const InternetSongMimeData*>(mimedata)) { if (const StreamSongMimeData *streaming_song_data = qobject_cast<const StreamSongMimeData*>(mimedata)) {
emit AddArtistsSignal(internet_song_data->songs); emit AddArtistsSignal(streaming_song_data->songs);
} }
} }
void InternetSearchView::AddAlbums() { void StreamingSearchView::AddAlbums() {
MimeData *mimedata = SelectedMimeData(); MimeData *mimedata = SelectedMimeData();
if (!mimedata) return; if (!mimedata) return;
if (const InternetSongMimeData *internet_song_data = qobject_cast<const InternetSongMimeData*>(mimedata)) { if (const StreamSongMimeData *streaming_song_data = qobject_cast<const StreamSongMimeData*>(mimedata)) {
emit AddAlbumsSignal(internet_song_data->songs); emit AddAlbumsSignal(streaming_song_data->songs);
} }
} }
void InternetSearchView::AddSongs() { void StreamingSearchView::AddSongs() {
MimeData *mimedata = SelectedMimeData(); MimeData *mimedata = SelectedMimeData();
if (!mimedata) return; if (!mimedata) return;
if (const InternetSongMimeData *internet_song_data = qobject_cast<const InternetSongMimeData*>(mimedata)) { if (const StreamSongMimeData *streaming_song_data = qobject_cast<const StreamSongMimeData*>(mimedata)) {
emit AddSongsSignal(internet_song_data->songs); emit AddSongsSignal(streaming_song_data->songs);
} }
} }
QString InternetSearchView::PixmapCacheKey(const InternetSearchView::Result &result) const { QString StreamingSearchView::PixmapCacheKey(const StreamingSearchView::Result &result) const {
if (result.metadata_.art_automatic_is_valid()) { if (result.metadata_.art_automatic_is_valid()) {
return Song::TextForSource(service_->source()) + QLatin1Char('/') + result.metadata_.art_automatic().toString(); return Song::TextForSource(service_->source()) + QLatin1Char('/') + result.metadata_.art_automatic().toString();
@@ -798,11 +798,11 @@ QString InternetSearchView::PixmapCacheKey(const InternetSearchView::Result &res
} }
bool InternetSearchView::FindCachedPixmap(const InternetSearchView::Result &result, QPixmap *pixmap) const { bool StreamingSearchView::FindCachedPixmap(const StreamingSearchView::Result &result, QPixmap *pixmap) const {
return QPixmapCache::find(result.pixmap_cache_key_, pixmap); return QPixmapCache::find(result.pixmap_cache_key_, pixmap);
} }
void InternetSearchView::LazyLoadAlbumCover(const QModelIndex &proxy_index) { void StreamingSearchView::LazyLoadAlbumCover(const QModelIndex &proxy_index) {
if (!proxy_index.isValid() || proxy_index.model() != front_proxy_) { if (!proxy_index.isValid() || proxy_index.model() != front_proxy_) {
return; return;
@@ -814,7 +814,7 @@ void InternetSearchView::LazyLoadAlbumCover(const QModelIndex &proxy_index) {
} }
// Already loading art for this item? // Already loading art for this item?
if (source_index.data(InternetSearchModel::Role_LazyLoadingArt).isValid()) { if (source_index.data(StreamingSearchModel::Role_LazyLoadingArt).isValid()) {
return; return;
} }
@@ -833,7 +833,7 @@ void InternetSearchView::LazyLoadAlbumCover(const QModelIndex &proxy_index) {
if (!item_album) { if (!item_album) {
return; return;
} }
item_album->setData(true, InternetSearchModel::Role_LazyLoadingArt); item_album->setData(true, StreamingSearchModel::Role_LazyLoadingArt);
// Walk down the item's children until we find a track // Walk down the item's children until we find a track
QStandardItem *item_song = item_album; QStandardItem *item_song = item_album;
@@ -842,7 +842,7 @@ void InternetSearchView::LazyLoadAlbumCover(const QModelIndex &proxy_index) {
} }
// Get the track's Result // Get the track's Result
const InternetSearchView::Result result = item_song->data(InternetSearchModel::Role_Result).value<InternetSearchView::Result>(); const StreamingSearchView::Result result = item_song->data(StreamingSearchModel::Role_Result).value<StreamingSearchView::Result>();
QPixmap cached_pixmap; QPixmap cached_pixmap;
if (QPixmapCache::find(result.pixmap_cache_key_, &cached_pixmap)) { if (QPixmapCache::find(result.pixmap_cache_key_, &cached_pixmap)) {
@@ -857,7 +857,7 @@ void InternetSearchView::LazyLoadAlbumCover(const QModelIndex &proxy_index) {
} }
void InternetSearchView::AlbumCoverLoaded(const quint64 id, const AlbumCoverLoaderResult &albumcover_result) { void StreamingSearchView::AlbumCoverLoaded(const quint64 id, const AlbumCoverLoaderResult &albumcover_result) {
if (!cover_loader_tasks_.contains(id)) return; if (!cover_loader_tasks_.contains(id)) return;

View File

@@ -19,8 +19,8 @@
* *
*/ */
#ifndef INTERNETSEARCHVIEW_H #ifndef STREAMINGSEARCHVIEW_H
#define INTERNETSEARCHVIEW_H #define STREAMINGSEARCHVIEW_H
#include "config.h" #include "config.h"
@@ -59,16 +59,16 @@ class QTimerEvent;
class Application; class Application;
class MimeData; class MimeData;
class GroupByDialog; class GroupByDialog;
class InternetService; class StreamingService;
class InternetSearchModel; class StreamingSearchModel;
class Ui_InternetSearchView; class Ui_StreamingSearchView;
class InternetSearchView : public QWidget { class StreamingSearchView : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit InternetSearchView(QWidget *parent = nullptr); explicit StreamingSearchView(QWidget *parent = nullptr);
~InternetSearchView() override; ~StreamingSearchView() override;
enum class SearchType { enum class SearchType {
Artists = 1, Artists = 1,
@@ -81,7 +81,7 @@ class InternetSearchView : public QWidget {
}; };
using ResultList = QList<Result>; using ResultList = QList<Result>;
void Init(Application *app, SharedPtr<InternetService> service); void Init(Application *app, SharedPtr<StreamingService> service);
bool SearchFieldHasFocus() const; bool SearchFieldHasFocus() const;
void FocusSearchField(); void FocusSearchField();
@@ -151,7 +151,7 @@ class InternetSearchView : public QWidget {
void UpdateStatus(const int service_id, const QString &text); void UpdateStatus(const int service_id, const QString &text);
void ProgressSetMaximum(const int service_id, const int max); void ProgressSetMaximum(const int service_id, const int max);
void UpdateProgress(const int service_id, const int progress); void UpdateProgress(const int service_id, const int progress);
void AddResults(const int service_id, const InternetSearchView::ResultList &results); void AddResults(const int service_id, const StreamingSearchView::ResultList &results);
void FocusOnFilter(QKeyEvent *e); void FocusOnFilter(QKeyEvent *e);
@@ -183,8 +183,8 @@ class InternetSearchView : public QWidget {
private: private:
Application *app_; Application *app_;
SharedPtr<InternetService> service_; SharedPtr<StreamingService> service_;
Ui_InternetSearchView *ui_; Ui_StreamingSearchView *ui_;
ScopedPtr<GroupByDialog> group_by_dialog_; ScopedPtr<GroupByDialog> group_by_dialog_;
QMenu *context_menu_; QMenu *context_menu_;
@@ -194,9 +194,9 @@ class InternetSearchView : public QWidget {
// Like graphics APIs have a front buffer and a back buffer, there's a front model and a back model // Like graphics APIs have a front buffer and a back buffer, there's a front model and a back model
// The front model is the one that's shown in the UI and the back model is the one that lies in wait. // The front model is the one that's shown in the UI and the back model is the one that lies in wait.
// current_model_ will point to either the front or the back model. // current_model_ will point to either the front or the back model.
InternetSearchModel *front_model_; StreamingSearchModel *front_model_;
InternetSearchModel *back_model_; StreamingSearchModel *back_model_;
InternetSearchModel *current_model_; StreamingSearchModel *current_model_;
QSortFilterProxyModel *front_proxy_; QSortFilterProxyModel *front_proxy_;
QSortFilterProxyModel *back_proxy_; QSortFilterProxyModel *back_proxy_;
@@ -215,7 +215,7 @@ class InternetSearchView : public QWidget {
QMap<quint64, QPair<QModelIndex, QString>> cover_loader_tasks_; QMap<quint64, QPair<QModelIndex, QString>> cover_loader_tasks_;
}; };
Q_DECLARE_METATYPE(InternetSearchView::Result) Q_DECLARE_METATYPE(StreamingSearchView::Result)
Q_DECLARE_METATYPE(InternetSearchView::ResultList) Q_DECLARE_METATYPE(StreamingSearchView::ResultList)
#endif // INTERNETSEARCHVIEW_H #endif // STREAMINGSEARCHVIEW_H

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>InternetSearchView</class> <class>StreamingSearchView</class>
<widget class="QWidget" name="InternetSearchView"> <widget class="QWidget" name="StreamingSearchView">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Internet Search View</string> <string>Streaming Search View</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing"> <property name="spacing">

View File

@@ -20,13 +20,13 @@
#include <QObject> #include <QObject>
#include <QString> #include <QString>
#include "internetservice.h" #include "streamingservice.h"
#include "core/song.h" #include "core/song.h"
#include "settings/settingsdialog.h" #include "settings/settingsdialog.h"
class Application; class Application;
InternetService::InternetService(const Song::Source source, const QString &name, const QString &url_scheme, const QString &settings_group, const SettingsDialog::Page settings_page, Application *app, QObject *parent) StreamingService::StreamingService(const Song::Source source, const QString &name, const QString &url_scheme, const QString &settings_group, const SettingsDialog::Page settings_page, Application *app, QObject *parent)
: QObject(parent), : QObject(parent),
app_(app), app_(app),
source_(source), source_(source),

View File

@@ -17,8 +17,8 @@
* *
*/ */
#ifndef INTERNETSERVICE_H #ifndef STREAMINGSERVICE_H
#define INTERNETSERVICE_H #define STREAMINGSERVICE_H
#include <QtGlobal> #include <QtGlobal>
#include <QObject> #include <QObject>
@@ -31,20 +31,20 @@
#include "core/shared_ptr.h" #include "core/shared_ptr.h"
#include "core/song.h" #include "core/song.h"
#include "settings/settingsdialog.h" #include "settings/settingsdialog.h"
#include "internetsearchview.h" #include "streamingsearchview.h"
class Application; class Application;
class CollectionBackend; class CollectionBackend;
class CollectionModel; class CollectionModel;
class CollectionFilter; class CollectionFilter;
class InternetService : public QObject { class StreamingService : public QObject {
Q_OBJECT Q_OBJECT
public: public:
explicit InternetService(const Song::Source source, const QString &name, const QString &url_scheme, const QString &settings_group, const SettingsDialog::Page settings_page, Application *app, QObject *parent = nullptr); explicit StreamingService(const Song::Source source, const QString &name, const QString &url_scheme, const QString &settings_group, const SettingsDialog::Page settings_page, Application *app, QObject *parent = nullptr);
~InternetService() override {} ~StreamingService() override {}
virtual void Exit() {} virtual void Exit() {}
virtual Song::Source source() const { return source_; } virtual Song::Source source() const { return source_; }
@@ -58,7 +58,7 @@ class InternetService : public QObject {
virtual QIcon Icon() const { return Song::IconForSource(source_); } virtual QIcon Icon() const { return Song::IconForSource(source_); }
virtual bool oauth() const { return false; } virtual bool oauth() const { return false; }
virtual bool authenticated() const { return false; } virtual bool authenticated() const { return false; }
virtual int Search(const QString &query, InternetSearchView::SearchType type) { Q_UNUSED(query); Q_UNUSED(type); return 0; } virtual int Search(const QString &query, StreamingSearchView::SearchType type) { Q_UNUSED(query); Q_UNUSED(type); return 0; }
virtual void CancelSearch() {} virtual void CancelSearch() {}
virtual SharedPtr<CollectionBackend> artists_collection_backend() { return nullptr; } virtual SharedPtr<CollectionBackend> artists_collection_backend() { return nullptr; }
@@ -144,9 +144,9 @@ class InternetService : public QObject {
SettingsDialog::Page settings_page_; SettingsDialog::Page settings_page_;
}; };
using InternetServicePtr = SharedPtr<InternetService>; using StreamingServicePtr = SharedPtr<StreamingService>;
Q_DECLARE_METATYPE(InternetService*) Q_DECLARE_METATYPE(StreamingService*)
Q_DECLARE_METATYPE(InternetServicePtr) Q_DECLARE_METATYPE(StreamingServicePtr)
#endif // INTERNETSERVICE_H #endif // STREAMINGSERVICE_H

View File

@@ -26,71 +26,71 @@
#include <QString> #include <QString>
#include "core/logging.h" #include "core/logging.h"
#include "internetservices.h" #include "streamingservices.h"
#include "internetservice.h" #include "streamingservice.h"
InternetServices::InternetServices(QObject *parent) : QObject(parent) {} StreamingServices::StreamingServices(QObject *parent) : QObject(parent) {}
InternetServices::~InternetServices() { StreamingServices::~StreamingServices() {
while (!services_.isEmpty()) { while (!services_.isEmpty()) {
InternetServicePtr service = services_.first(); StreamingServicePtr service = services_.first();
RemoveService(service); RemoveService(service);
} }
} }
void InternetServices::AddService(InternetServicePtr service) { void StreamingServices::AddService(StreamingServicePtr service) {
services_.insert(service->source(), service); services_.insert(service->source(), service);
if (service->has_initial_load_settings()) service->InitialLoadSettings(); if (service->has_initial_load_settings()) service->InitialLoadSettings();
else service->ReloadSettings(); else service->ReloadSettings();
qLog(Debug) << "Added internet service" << service->name(); qLog(Debug) << "Added streaming service" << service->name();
} }
void InternetServices::RemoveService(InternetServicePtr service) { void StreamingServices::RemoveService(StreamingServicePtr service) {
if (!services_.contains(service->source())) return; if (!services_.contains(service->source())) return;
services_.remove(service->source()); services_.remove(service->source());
QObject::disconnect(&*service, nullptr, this, nullptr); QObject::disconnect(&*service, nullptr, this, nullptr);
qLog(Debug) << "Removed internet service" << service->name(); qLog(Debug) << "Removed streaming service" << service->name();
} }
InternetServicePtr InternetServices::ServiceBySource(const Song::Source source) const { StreamingServicePtr StreamingServices::ServiceBySource(const Song::Source source) const {
if (services_.contains(source)) return services_.value(source); if (services_.contains(source)) return services_.value(source);
return nullptr; return nullptr;
} }
void InternetServices::ReloadSettings() { void StreamingServices::ReloadSettings() {
const QList<InternetServicePtr> services = services_.values(); const QList<StreamingServicePtr> services = services_.values();
for (InternetServicePtr service : services) { for (StreamingServicePtr service : services) {
service->ReloadSettings(); service->ReloadSettings();
} }
} }
void InternetServices::Exit() { void StreamingServices::Exit() {
const QList<InternetServicePtr> services = services_.values(); const QList<StreamingServicePtr> services = services_.values();
for (InternetServicePtr service : services) { for (StreamingServicePtr service : services) {
wait_for_exit_ << &*service; wait_for_exit_ << &*service;
QObject::connect(&*service, &InternetService::ExitFinished, this, &InternetServices::ExitReceived); QObject::connect(&*service, &StreamingService::ExitFinished, this, &StreamingServices::ExitReceived);
service->Exit(); service->Exit();
} }
if (wait_for_exit_.isEmpty()) emit ExitFinished(); if (wait_for_exit_.isEmpty()) emit ExitFinished();
} }
void InternetServices::ExitReceived() { void StreamingServices::ExitReceived() {
InternetService *service = qobject_cast<InternetService*>(sender()); StreamingService *service = qobject_cast<StreamingService*>(sender());
wait_for_exit_.removeAll(service); wait_for_exit_.removeAll(service);
if (wait_for_exit_.isEmpty()) emit ExitFinished(); if (wait_for_exit_.isEmpty()) emit ExitFinished();

View File

@@ -19,8 +19,8 @@
* *
*/ */
#ifndef INTERNETSERVICES_H #ifndef STREAMINGSERVICES_H
#define INTERNETSERVICES_H #define STREAMINGSERVICES_H
#include "config.h" #include "config.h"
@@ -34,24 +34,24 @@
#include <core/shared_ptr.h> #include <core/shared_ptr.h>
#include "core/song.h" #include "core/song.h"
class InternetService; class StreamingService;
class InternetServices : public QObject { class StreamingServices : public QObject {
Q_OBJECT Q_OBJECT
public: public:
explicit InternetServices(QObject *parent = nullptr); explicit StreamingServices(QObject *parent = nullptr);
~InternetServices() override; ~StreamingServices() override;
SharedPtr<InternetService> ServiceBySource(const Song::Source source) const; SharedPtr<StreamingService> ServiceBySource(const Song::Source source) const;
template <typename T> template <typename T>
SharedPtr<T> Service() { SharedPtr<T> Service() {
return std::static_pointer_cast<T>(ServiceBySource(T::kSource)); return std::static_pointer_cast<T>(ServiceBySource(T::kSource));
} }
void AddService(SharedPtr<InternetService> service); void AddService(SharedPtr<StreamingService> service);
void RemoveService(SharedPtr<InternetService> service); void RemoveService(SharedPtr<StreamingService> service);
void ReloadSettings(); void ReloadSettings();
void Exit(); void Exit();
@@ -62,8 +62,8 @@ class InternetServices : public QObject {
void ExitReceived(); void ExitReceived();
private: private:
QMap<Song::Source, SharedPtr<InternetService>> services_; QMap<Song::Source, SharedPtr<StreamingService>> services_;
QList<InternetService*> wait_for_exit_; QList<StreamingService*> wait_for_exit_;
}; };
#endif // INTERNETSERVICES_H #endif // STREAMINGSERVICES_H

View File

@@ -35,22 +35,22 @@
#include "collection/collectionbackend.h" #include "collection/collectionbackend.h"
#include "collection/collectionmodel.h" #include "collection/collectionmodel.h"
#include "collection/collectionfilter.h" #include "collection/collectionfilter.h"
#include "internetservice.h" #include "streamingservice.h"
#include "internetsongsview.h" #include "streamingsongsview.h"
#include "internetcollectionview.h" #include "streamingcollectionview.h"
#include "ui_internetcollectionviewcontainer.h" #include "ui_streamingcollectionviewcontainer.h"
InternetSongsView::InternetSongsView(Application *app, InternetServicePtr service, const QString &settings_group, const SettingsDialog::Page settings_page, QWidget *parent) StreamingSongsView::StreamingSongsView(Application *app, StreamingServicePtr service, const QString &settings_group, const SettingsDialog::Page settings_page, QWidget *parent)
: QWidget(parent), : QWidget(parent),
app_(app), app_(app),
service_(service), service_(service),
settings_group_(settings_group), settings_group_(settings_group),
settings_page_(settings_page), settings_page_(settings_page),
ui_(new Ui_InternetCollectionViewContainer) { ui_(new Ui_StreamingCollectionViewContainer) {
ui_->setupUi(this); ui_->setupUi(this);
ui_->stacked->setCurrentWidget(ui_->internetcollection_page); ui_->stacked->setCurrentWidget(ui_->streamingcollection_page);
ui_->view->Init(app_, service_->songs_collection_backend(), service_->songs_collection_model(), false); ui_->view->Init(app_, service_->songs_collection_backend(), service_->songs_collection_model(), false);
ui_->view->setModel(service_->songs_collection_filter_model()); ui_->view->setModel(service_->songs_collection_filter_model());
ui_->view->SetFilter(ui_->filter_widget); ui_->view->SetFilter(ui_->filter_widget);
@@ -58,45 +58,45 @@ InternetSongsView::InternetSongsView(Application *app, InternetServicePtr servic
ui_->filter_widget->Init(service_->songs_collection_model(), service_->songs_collection_filter_model()); ui_->filter_widget->Init(service_->songs_collection_model(), service_->songs_collection_filter_model());
QAction *action_configure = new QAction(IconLoader::Load(QStringLiteral("configure")), tr("Configure %1...").arg(Song::DescriptionForSource(service_->source())), this); QAction *action_configure = new QAction(IconLoader::Load(QStringLiteral("configure")), tr("Configure %1...").arg(Song::DescriptionForSource(service_->source())), this);
QObject::connect(action_configure, &QAction::triggered, this, &InternetSongsView::OpenSettingsDialog); QObject::connect(action_configure, &QAction::triggered, this, &StreamingSongsView::OpenSettingsDialog);
ui_->filter_widget->AddMenuAction(action_configure); ui_->filter_widget->AddMenuAction(action_configure);
QObject::connect(ui_->view, &InternetCollectionView::GetSongs, this, &InternetSongsView::GetSongs); QObject::connect(ui_->view, &StreamingCollectionView::GetSongs, this, &StreamingSongsView::GetSongs);
QObject::connect(ui_->view, &InternetCollectionView::RemoveSongs, &*service_, &InternetService::RemoveSongsByList); QObject::connect(ui_->view, &StreamingCollectionView::RemoveSongs, &*service_, &StreamingService::RemoveSongsByList);
QObject::connect(ui_->refresh, &QPushButton::clicked, this, &InternetSongsView::GetSongs); QObject::connect(ui_->refresh, &QPushButton::clicked, this, &StreamingSongsView::GetSongs);
QObject::connect(ui_->close, &QPushButton::clicked, this, &InternetSongsView::AbortGetSongs); QObject::connect(ui_->close, &QPushButton::clicked, this, &StreamingSongsView::AbortGetSongs);
QObject::connect(ui_->abort, &QPushButton::clicked, this, &InternetSongsView::AbortGetSongs); QObject::connect(ui_->abort, &QPushButton::clicked, this, &StreamingSongsView::AbortGetSongs);
QObject::connect(&*service_, &InternetService::SongsResults, this, &InternetSongsView::SongsFinished); QObject::connect(&*service_, &StreamingService::SongsResults, this, &StreamingSongsView::SongsFinished);
QObject::connect(&*service_, &InternetService::SongsUpdateStatus, ui_->status, &QLabel::setText); QObject::connect(&*service_, &StreamingService::SongsUpdateStatus, ui_->status, &QLabel::setText);
QObject::connect(&*service_, &InternetService::SongsProgressSetMaximum, ui_->progressbar, &QProgressBar::setMaximum); QObject::connect(&*service_, &StreamingService::SongsProgressSetMaximum, ui_->progressbar, &QProgressBar::setMaximum);
QObject::connect(&*service_, &InternetService::SongsUpdateProgress, ui_->progressbar, &QProgressBar::setValue); QObject::connect(&*service_, &StreamingService::SongsUpdateProgress, ui_->progressbar, &QProgressBar::setValue);
QObject::connect(service_->songs_collection_model(), &CollectionModel::TotalArtistCountUpdated, ui_->view, &InternetCollectionView::TotalArtistCountUpdated); QObject::connect(service_->songs_collection_model(), &CollectionModel::TotalArtistCountUpdated, ui_->view, &StreamingCollectionView::TotalArtistCountUpdated);
QObject::connect(service_->songs_collection_model(), &CollectionModel::TotalAlbumCountUpdated, ui_->view, &InternetCollectionView::TotalAlbumCountUpdated); QObject::connect(service_->songs_collection_model(), &CollectionModel::TotalAlbumCountUpdated, ui_->view, &StreamingCollectionView::TotalAlbumCountUpdated);
QObject::connect(service_->songs_collection_model(), &CollectionModel::TotalSongCountUpdated, ui_->view, &InternetCollectionView::TotalSongCountUpdated); QObject::connect(service_->songs_collection_model(), &CollectionModel::TotalSongCountUpdated, ui_->view, &StreamingCollectionView::TotalSongCountUpdated);
QObject::connect(service_->songs_collection_model(), &CollectionModel::modelAboutToBeReset, ui_->view, &InternetCollectionView::SaveFocus); QObject::connect(service_->songs_collection_model(), &CollectionModel::modelAboutToBeReset, ui_->view, &StreamingCollectionView::SaveFocus);
QObject::connect(service_->songs_collection_model(), &CollectionModel::modelReset, ui_->view, &InternetCollectionView::RestoreFocus); QObject::connect(service_->songs_collection_model(), &CollectionModel::modelReset, ui_->view, &StreamingCollectionView::RestoreFocus);
ReloadSettings(); ReloadSettings();
} }
InternetSongsView::~InternetSongsView() { delete ui_; } StreamingSongsView::~StreamingSongsView() { delete ui_; }
void InternetSongsView::ReloadSettings() { void StreamingSongsView::ReloadSettings() {
ui_->filter_widget->ReloadSettings(); ui_->filter_widget->ReloadSettings();
ui_->view->ReloadSettings(); ui_->view->ReloadSettings();
} }
void InternetSongsView::OpenSettingsDialog() { void StreamingSongsView::OpenSettingsDialog() {
app_->OpenSettingsDialogAtPage(service_->settings_page()); app_->OpenSettingsDialogAtPage(service_->settings_page());
} }
void InternetSongsView::GetSongs() { void StreamingSongsView::GetSongs() {
if (!service_->authenticated() && service_->oauth()) { if (!service_->authenticated() && service_->oauth()) {
service_->ShowConfig(); service_->ShowConfig();
@@ -112,16 +112,16 @@ void InternetSongsView::GetSongs() {
} }
void InternetSongsView::AbortGetSongs() { void StreamingSongsView::AbortGetSongs() {
service_->ResetSongsRequest(); service_->ResetSongsRequest();
ui_->progressbar->setValue(0); ui_->progressbar->setValue(0);
ui_->status->clear(); ui_->status->clear();
ui_->stacked->setCurrentWidget(ui_->internetcollection_page); ui_->stacked->setCurrentWidget(ui_->streamingcollection_page);
} }
void InternetSongsView::SongsFinished(const SongMap &songs, const QString &error) { void StreamingSongsView::SongsFinished(const SongMap &songs, const QString &error) {
if (songs.isEmpty() && !error.isEmpty()) { if (songs.isEmpty() && !error.isEmpty()) {
ui_->status->setText(error); ui_->status->setText(error);
@@ -131,7 +131,7 @@ void InternetSongsView::SongsFinished(const SongMap &songs, const QString &error
ui_->close->show(); ui_->close->show();
} }
else { else {
ui_->stacked->setCurrentWidget(ui_->internetcollection_page); ui_->stacked->setCurrentWidget(ui_->streamingcollection_page);
ui_->status->clear(); ui_->status->clear();
service_->songs_collection_backend()->UpdateSongsBySongIDAsync(songs); service_->songs_collection_backend()->UpdateSongsBySongIDAsync(songs);
} }

View File

@@ -17,8 +17,8 @@
* *
*/ */
#ifndef INTERNETSONGSVIEW_H #ifndef STREAMINGSONGSVIEW_H
#define INTERNETSONGSVIEW_H #define STREAMINGSONGSVIEW_H
#include "config.h" #include "config.h"
@@ -30,24 +30,24 @@
#include "core/shared_ptr.h" #include "core/shared_ptr.h"
#include "core/song.h" #include "core/song.h"
#include "settings/settingsdialog.h" #include "settings/settingsdialog.h"
#include "ui_internetcollectionviewcontainer.h" #include "ui_streamingcollectionviewcontainer.h"
class QContextMenuEvent; class QContextMenuEvent;
class Application; class Application;
class InternetService; class StreamingService;
class InternetCollectionView; class StreamingCollectionView;
class InternetSongsView : public QWidget { class StreamingSongsView : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit InternetSongsView(Application *app, SharedPtr<InternetService> service, const QString &settings_group, const SettingsDialog::Page settings_page, QWidget *parent = nullptr); explicit StreamingSongsView(Application *app, SharedPtr<StreamingService> service, const QString &settings_group, const SettingsDialog::Page settings_page, QWidget *parent = nullptr);
~InternetSongsView() override; ~StreamingSongsView() override;
void ReloadSettings(); void ReloadSettings();
InternetCollectionView *view() const { return ui_->view; } StreamingCollectionView *view() const { return ui_->view; }
bool SearchFieldHasFocus() const { return ui_->filter_widget->SearchFieldHasFocus(); } bool SearchFieldHasFocus() const { return ui_->filter_widget->SearchFieldHasFocus(); }
void FocusSearchField() { ui_->filter_widget->FocusSearchField(); } void FocusSearchField() { ui_->filter_widget->FocusSearchField(); }
@@ -60,10 +60,10 @@ class InternetSongsView : public QWidget {
private: private:
Application *app_; Application *app_;
SharedPtr<InternetService> service_; SharedPtr<StreamingService> service_;
QString settings_group_; QString settings_group_;
SettingsDialog::Page settings_page_; SettingsDialog::Page settings_page_;
Ui_InternetCollectionViewContainer *ui_; Ui_StreamingCollectionViewContainer *ui_;
}; };
#endif // INTERNETSONGSVIEW_H #endif // STREAMINGSONGSVIEW_H

View File

@@ -40,32 +40,32 @@
#include "collection/collectionmodel.h" #include "collection/collectionmodel.h"
#include "collection/collectionfilter.h" #include "collection/collectionfilter.h"
#include "collection/collectionfilterwidget.h" #include "collection/collectionfilterwidget.h"
#include "internetservice.h" #include "streamingservice.h"
#include "internettabsview.h" #include "streamingtabsview.h"
#include "internetcollectionview.h" #include "streamingcollectionview.h"
#include "internetcollectionviewcontainer.h" #include "streamingcollectionviewcontainer.h"
#include "ui_internettabsview.h" #include "ui_streamingtabsview.h"
InternetTabsView::InternetTabsView(Application *app, InternetServicePtr service, const QString &settings_group, const SettingsDialog::Page settings_page, QWidget *parent) StreamingTabsView::StreamingTabsView(Application *app, StreamingServicePtr service, const QString &settings_group, const SettingsDialog::Page settings_page, QWidget *parent)
: QWidget(parent), : QWidget(parent),
app_(app), app_(app),
service_(service), service_(service),
settings_group_(settings_group), settings_group_(settings_group),
settings_page_(settings_page), settings_page_(settings_page),
ui_(new Ui_InternetTabsView) { ui_(new Ui_StreamingTabsView) {
ui_->setupUi(this); ui_->setupUi(this);
ui_->search_view->Init(app, service); ui_->search_view->Init(app, service);
QObject::connect(ui_->search_view, &InternetSearchView::AddArtistsSignal, &*service_, &InternetService::AddArtists); QObject::connect(ui_->search_view, &StreamingSearchView::AddArtistsSignal, &*service_, &StreamingService::AddArtists);
QObject::connect(ui_->search_view, &InternetSearchView::AddAlbumsSignal, &*service_, &InternetService::AddAlbums); QObject::connect(ui_->search_view, &StreamingSearchView::AddAlbumsSignal, &*service_, &StreamingService::AddAlbums);
QObject::connect(ui_->search_view, &InternetSearchView::AddSongsSignal, &*service_, &InternetService::AddSongs); QObject::connect(ui_->search_view, &StreamingSearchView::AddSongsSignal, &*service_, &StreamingService::AddSongs);
QAction *action_configure = new QAction(IconLoader::Load(QStringLiteral("configure")), tr("Configure %1...").arg(Song::TextForSource(service_->source())), this); QAction *action_configure = new QAction(IconLoader::Load(QStringLiteral("configure")), tr("Configure %1...").arg(Song::TextForSource(service_->source())), this);
QObject::connect(action_configure, &QAction::triggered, this, &InternetTabsView::OpenSettingsDialog); QObject::connect(action_configure, &QAction::triggered, this, &StreamingTabsView::OpenSettingsDialog);
if (service_->artists_collection_model()) { if (service_->artists_collection_model()) {
ui_->artists_collection->stacked()->setCurrentWidget(ui_->artists_collection->internetcollection_page()); ui_->artists_collection->stacked()->setCurrentWidget(ui_->artists_collection->streamingcollection_page());
ui_->artists_collection->view()->Init(app_, service_->artists_collection_backend(), service_->artists_collection_model(), true); ui_->artists_collection->view()->Init(app_, service_->artists_collection_backend(), service_->artists_collection_model(), true);
ui_->artists_collection->view()->setModel(service_->artists_collection_filter_model()); ui_->artists_collection->view()->setModel(service_->artists_collection_filter_model());
ui_->artists_collection->view()->SetFilter(ui_->artists_collection->filter_widget()); ui_->artists_collection->view()->SetFilter(ui_->artists_collection->filter_widget());
@@ -74,22 +74,22 @@ InternetTabsView::InternetTabsView(Application *app, InternetServicePtr service,
ui_->artists_collection->filter_widget()->Init(service_->artists_collection_model(), service_->artists_collection_filter_model()); ui_->artists_collection->filter_widget()->Init(service_->artists_collection_model(), service_->artists_collection_filter_model());
ui_->artists_collection->filter_widget()->AddMenuAction(action_configure); ui_->artists_collection->filter_widget()->AddMenuAction(action_configure);
QObject::connect(ui_->artists_collection->view(), &InternetCollectionView::GetSongs, this, &InternetTabsView::GetArtists); QObject::connect(ui_->artists_collection->view(), &StreamingCollectionView::GetSongs, this, &StreamingTabsView::GetArtists);
QObject::connect(ui_->artists_collection->view(), &InternetCollectionView::RemoveSongs, &*service_, &InternetService::RemoveArtists); QObject::connect(ui_->artists_collection->view(), &StreamingCollectionView::RemoveSongs, &*service_, &StreamingService::RemoveArtists);
QObject::connect(ui_->artists_collection->button_refresh(), &QPushButton::clicked, this, &InternetTabsView::GetArtists); QObject::connect(ui_->artists_collection->button_refresh(), &QPushButton::clicked, this, &StreamingTabsView::GetArtists);
QObject::connect(ui_->artists_collection->button_close(), &QPushButton::clicked, this, &InternetTabsView::AbortGetArtists); QObject::connect(ui_->artists_collection->button_close(), &QPushButton::clicked, this, &StreamingTabsView::AbortGetArtists);
QObject::connect(ui_->artists_collection->button_abort(), &QPushButton::clicked, this, &InternetTabsView::AbortGetArtists); QObject::connect(ui_->artists_collection->button_abort(), &QPushButton::clicked, this, &StreamingTabsView::AbortGetArtists);
QObject::connect(&*service_, &InternetService::ArtistsResults, this, &InternetTabsView::ArtistsFinished); QObject::connect(&*service_, &StreamingService::ArtistsResults, this, &StreamingTabsView::ArtistsFinished);
QObject::connect(&*service_, &InternetService::ArtistsUpdateStatus, ui_->artists_collection->status(), &QLabel::setText); QObject::connect(&*service_, &StreamingService::ArtistsUpdateStatus, ui_->artists_collection->status(), &QLabel::setText);
QObject::connect(&*service_, &InternetService::ArtistsProgressSetMaximum, ui_->artists_collection->progressbar(), &QProgressBar::setMaximum); QObject::connect(&*service_, &StreamingService::ArtistsProgressSetMaximum, ui_->artists_collection->progressbar(), &QProgressBar::setMaximum);
QObject::connect(&*service_, &InternetService::ArtistsUpdateProgress, ui_->artists_collection->progressbar(), &QProgressBar::setValue); QObject::connect(&*service_, &StreamingService::ArtistsUpdateProgress, ui_->artists_collection->progressbar(), &QProgressBar::setValue);
QObject::connect(service_->artists_collection_model(), &CollectionModel::TotalArtistCountUpdated, ui_->artists_collection->view(), &InternetCollectionView::TotalArtistCountUpdated); QObject::connect(service_->artists_collection_model(), &CollectionModel::TotalArtistCountUpdated, ui_->artists_collection->view(), &StreamingCollectionView::TotalArtistCountUpdated);
QObject::connect(service_->artists_collection_model(), &CollectionModel::TotalAlbumCountUpdated, ui_->artists_collection->view(), &InternetCollectionView::TotalAlbumCountUpdated); QObject::connect(service_->artists_collection_model(), &CollectionModel::TotalAlbumCountUpdated, ui_->artists_collection->view(), &StreamingCollectionView::TotalAlbumCountUpdated);
QObject::connect(service_->artists_collection_model(), &CollectionModel::TotalSongCountUpdated, ui_->artists_collection->view(), &InternetCollectionView::TotalSongCountUpdated); QObject::connect(service_->artists_collection_model(), &CollectionModel::TotalSongCountUpdated, ui_->artists_collection->view(), &StreamingCollectionView::TotalSongCountUpdated);
QObject::connect(service_->artists_collection_model(), &CollectionModel::modelAboutToBeReset, ui_->artists_collection->view(), &InternetCollectionView::SaveFocus); QObject::connect(service_->artists_collection_model(), &CollectionModel::modelAboutToBeReset, ui_->artists_collection->view(), &StreamingCollectionView::SaveFocus);
QObject::connect(service_->artists_collection_model(), &CollectionModel::modelReset, ui_->artists_collection->view(), &InternetCollectionView::RestoreFocus); QObject::connect(service_->artists_collection_model(), &CollectionModel::modelReset, ui_->artists_collection->view(), &StreamingCollectionView::RestoreFocus);
} }
else { else {
@@ -97,7 +97,7 @@ InternetTabsView::InternetTabsView(Application *app, InternetServicePtr service,
} }
if (service_->albums_collection_model()) { if (service_->albums_collection_model()) {
ui_->albums_collection->stacked()->setCurrentWidget(ui_->albums_collection->internetcollection_page()); ui_->albums_collection->stacked()->setCurrentWidget(ui_->albums_collection->streamingcollection_page());
ui_->albums_collection->view()->Init(app_, service_->albums_collection_backend(), service_->albums_collection_model(), true); ui_->albums_collection->view()->Init(app_, service_->albums_collection_backend(), service_->albums_collection_model(), true);
ui_->albums_collection->view()->setModel(service_->albums_collection_filter_model()); ui_->albums_collection->view()->setModel(service_->albums_collection_filter_model());
ui_->albums_collection->view()->SetFilter(ui_->albums_collection->filter_widget()); ui_->albums_collection->view()->SetFilter(ui_->albums_collection->filter_widget());
@@ -106,22 +106,22 @@ InternetTabsView::InternetTabsView(Application *app, InternetServicePtr service,
ui_->albums_collection->filter_widget()->Init(service_->albums_collection_model(), service_->albums_collection_filter_model()); ui_->albums_collection->filter_widget()->Init(service_->albums_collection_model(), service_->albums_collection_filter_model());
ui_->albums_collection->filter_widget()->AddMenuAction(action_configure); ui_->albums_collection->filter_widget()->AddMenuAction(action_configure);
QObject::connect(ui_->albums_collection->view(), &InternetCollectionView::GetSongs, this, &InternetTabsView::GetAlbums); QObject::connect(ui_->albums_collection->view(), &StreamingCollectionView::GetSongs, this, &StreamingTabsView::GetAlbums);
QObject::connect(ui_->albums_collection->view(), &InternetCollectionView::RemoveSongs, &*service_, &InternetService::RemoveAlbums); QObject::connect(ui_->albums_collection->view(), &StreamingCollectionView::RemoveSongs, &*service_, &StreamingService::RemoveAlbums);
QObject::connect(ui_->albums_collection->button_refresh(), &QPushButton::clicked, this, &InternetTabsView::GetAlbums); QObject::connect(ui_->albums_collection->button_refresh(), &QPushButton::clicked, this, &StreamingTabsView::GetAlbums);
QObject::connect(ui_->albums_collection->button_close(), &QPushButton::clicked, this, &InternetTabsView::AbortGetAlbums); QObject::connect(ui_->albums_collection->button_close(), &QPushButton::clicked, this, &StreamingTabsView::AbortGetAlbums);
QObject::connect(ui_->albums_collection->button_abort(), &QPushButton::clicked, this, &InternetTabsView::AbortGetAlbums); QObject::connect(ui_->albums_collection->button_abort(), &QPushButton::clicked, this, &StreamingTabsView::AbortGetAlbums);
QObject::connect(&*service_, &InternetService::AlbumsResults, this, &InternetTabsView::AlbumsFinished); QObject::connect(&*service_, &StreamingService::AlbumsResults, this, &StreamingTabsView::AlbumsFinished);
QObject::connect(&*service_, &InternetService::AlbumsUpdateStatus, ui_->albums_collection->status(), &QLabel::setText); QObject::connect(&*service_, &StreamingService::AlbumsUpdateStatus, ui_->albums_collection->status(), &QLabel::setText);
QObject::connect(&*service_, &InternetService::AlbumsProgressSetMaximum, ui_->albums_collection->progressbar(), &QProgressBar::setMaximum); QObject::connect(&*service_, &StreamingService::AlbumsProgressSetMaximum, ui_->albums_collection->progressbar(), &QProgressBar::setMaximum);
QObject::connect(&*service_, &InternetService::AlbumsUpdateProgress, ui_->albums_collection->progressbar(), &QProgressBar::setValue); QObject::connect(&*service_, &StreamingService::AlbumsUpdateProgress, ui_->albums_collection->progressbar(), &QProgressBar::setValue);
QObject::connect(service_->albums_collection_model(), &CollectionModel::TotalArtistCountUpdated, ui_->albums_collection->view(), &InternetCollectionView::TotalArtistCountUpdated); QObject::connect(service_->albums_collection_model(), &CollectionModel::TotalArtistCountUpdated, ui_->albums_collection->view(), &StreamingCollectionView::TotalArtistCountUpdated);
QObject::connect(service_->albums_collection_model(), &CollectionModel::TotalAlbumCountUpdated, ui_->albums_collection->view(), &InternetCollectionView::TotalAlbumCountUpdated); QObject::connect(service_->albums_collection_model(), &CollectionModel::TotalAlbumCountUpdated, ui_->albums_collection->view(), &StreamingCollectionView::TotalAlbumCountUpdated);
QObject::connect(service_->albums_collection_model(), &CollectionModel::TotalSongCountUpdated, ui_->albums_collection->view(), &InternetCollectionView::TotalSongCountUpdated); QObject::connect(service_->albums_collection_model(), &CollectionModel::TotalSongCountUpdated, ui_->albums_collection->view(), &StreamingCollectionView::TotalSongCountUpdated);
QObject::connect(service_->albums_collection_model(), &CollectionModel::modelAboutToBeReset, ui_->albums_collection->view(), &InternetCollectionView::SaveFocus); QObject::connect(service_->albums_collection_model(), &CollectionModel::modelAboutToBeReset, ui_->albums_collection->view(), &StreamingCollectionView::SaveFocus);
QObject::connect(service_->albums_collection_model(), &CollectionModel::modelReset, ui_->albums_collection->view(), &InternetCollectionView::RestoreFocus); QObject::connect(service_->albums_collection_model(), &CollectionModel::modelReset, ui_->albums_collection->view(), &StreamingCollectionView::RestoreFocus);
} }
else { else {
@@ -129,7 +129,7 @@ InternetTabsView::InternetTabsView(Application *app, InternetServicePtr service,
} }
if (service_->songs_collection_model()) { if (service_->songs_collection_model()) {
ui_->songs_collection->stacked()->setCurrentWidget(ui_->songs_collection->internetcollection_page()); ui_->songs_collection->stacked()->setCurrentWidget(ui_->songs_collection->streamingcollection_page());
ui_->songs_collection->view()->Init(app_, service_->songs_collection_backend(), service_->songs_collection_model(), true); ui_->songs_collection->view()->Init(app_, service_->songs_collection_backend(), service_->songs_collection_model(), true);
ui_->songs_collection->view()->setModel(service_->songs_collection_filter_model()); ui_->songs_collection->view()->setModel(service_->songs_collection_filter_model());
ui_->songs_collection->view()->SetFilter(ui_->songs_collection->filter_widget()); ui_->songs_collection->view()->SetFilter(ui_->songs_collection->filter_widget());
@@ -138,22 +138,22 @@ InternetTabsView::InternetTabsView(Application *app, InternetServicePtr service,
ui_->songs_collection->filter_widget()->Init(service_->songs_collection_model(), service_->songs_collection_filter_model()); ui_->songs_collection->filter_widget()->Init(service_->songs_collection_model(), service_->songs_collection_filter_model());
ui_->songs_collection->filter_widget()->AddMenuAction(action_configure); ui_->songs_collection->filter_widget()->AddMenuAction(action_configure);
QObject::connect(ui_->songs_collection->view(), &InternetCollectionView::GetSongs, this, &InternetTabsView::GetSongs); QObject::connect(ui_->songs_collection->view(), &StreamingCollectionView::GetSongs, this, &StreamingTabsView::GetSongs);
QObject::connect(ui_->songs_collection->view(), &InternetCollectionView::RemoveSongs, &*service_, &InternetService::RemoveSongsByList); QObject::connect(ui_->songs_collection->view(), &StreamingCollectionView::RemoveSongs, &*service_, &StreamingService::RemoveSongsByList);
QObject::connect(ui_->songs_collection->button_refresh(), &QPushButton::clicked, this, &InternetTabsView::GetSongs); QObject::connect(ui_->songs_collection->button_refresh(), &QPushButton::clicked, this, &StreamingTabsView::GetSongs);
QObject::connect(ui_->songs_collection->button_close(), &QPushButton::clicked, this, &InternetTabsView::AbortGetSongs); QObject::connect(ui_->songs_collection->button_close(), &QPushButton::clicked, this, &StreamingTabsView::AbortGetSongs);
QObject::connect(ui_->songs_collection->button_abort(), &QPushButton::clicked, this, &InternetTabsView::AbortGetSongs); QObject::connect(ui_->songs_collection->button_abort(), &QPushButton::clicked, this, &StreamingTabsView::AbortGetSongs);
QObject::connect(&*service_, &InternetService::SongsResults, this, &InternetTabsView::SongsFinished); QObject::connect(&*service_, &StreamingService::SongsResults, this, &StreamingTabsView::SongsFinished);
QObject::connect(&*service_, &InternetService::SongsUpdateStatus, ui_->songs_collection->status(), &QLabel::setText); QObject::connect(&*service_, &StreamingService::SongsUpdateStatus, ui_->songs_collection->status(), &QLabel::setText);
QObject::connect(&*service_, &InternetService::SongsProgressSetMaximum, ui_->songs_collection->progressbar(), &QProgressBar::setMaximum); QObject::connect(&*service_, &StreamingService::SongsProgressSetMaximum, ui_->songs_collection->progressbar(), &QProgressBar::setMaximum);
QObject::connect(&*service_, &InternetService::SongsUpdateProgress, ui_->songs_collection->progressbar(), &QProgressBar::setValue); QObject::connect(&*service_, &StreamingService::SongsUpdateProgress, ui_->songs_collection->progressbar(), &QProgressBar::setValue);
QObject::connect(service_->songs_collection_model(), &CollectionModel::TotalArtistCountUpdated, ui_->songs_collection->view(), &InternetCollectionView::TotalArtistCountUpdated); QObject::connect(service_->songs_collection_model(), &CollectionModel::TotalArtistCountUpdated, ui_->songs_collection->view(), &StreamingCollectionView::TotalArtistCountUpdated);
QObject::connect(service_->songs_collection_model(), &CollectionModel::TotalAlbumCountUpdated, ui_->songs_collection->view(), &InternetCollectionView::TotalAlbumCountUpdated); QObject::connect(service_->songs_collection_model(), &CollectionModel::TotalAlbumCountUpdated, ui_->songs_collection->view(), &StreamingCollectionView::TotalAlbumCountUpdated);
QObject::connect(service_->songs_collection_model(), &CollectionModel::TotalSongCountUpdated, ui_->songs_collection->view(), &InternetCollectionView::TotalSongCountUpdated); QObject::connect(service_->songs_collection_model(), &CollectionModel::TotalSongCountUpdated, ui_->songs_collection->view(), &StreamingCollectionView::TotalSongCountUpdated);
QObject::connect(service_->songs_collection_model(), &CollectionModel::modelAboutToBeReset, ui_->songs_collection->view(), &InternetCollectionView::SaveFocus); QObject::connect(service_->songs_collection_model(), &CollectionModel::modelAboutToBeReset, ui_->songs_collection->view(), &StreamingCollectionView::SaveFocus);
QObject::connect(service_->songs_collection_model(), &CollectionModel::modelReset, ui_->songs_collection->view(), &InternetCollectionView::RestoreFocus); QObject::connect(service_->songs_collection_model(), &CollectionModel::modelReset, ui_->songs_collection->view(), &StreamingCollectionView::RestoreFocus);
} }
else { else {
@@ -182,7 +182,7 @@ InternetTabsView::InternetTabsView(Application *app, InternetServicePtr service,
} }
InternetTabsView::~InternetTabsView() { StreamingTabsView::~StreamingTabsView() {
Settings s; Settings s;
s.beginGroup(settings_group_); s.beginGroup(settings_group_);
@@ -192,7 +192,7 @@ InternetTabsView::~InternetTabsView() {
delete ui_; delete ui_;
} }
void InternetTabsView::ReloadSettings() { void StreamingTabsView::ReloadSettings() {
if (service_->artists_collection_model()) { if (service_->artists_collection_model()) {
ui_->artists_collection->view()->ReloadSettings(); ui_->artists_collection->view()->ReloadSettings();
@@ -207,7 +207,7 @@ void InternetTabsView::ReloadSettings() {
} }
bool InternetTabsView::SearchFieldHasFocus() const { bool StreamingTabsView::SearchFieldHasFocus() const {
return ((ui_->tabs->currentWidget() == ui_->artists && ui_->artists_collection->SearchFieldHasFocus()) || return ((ui_->tabs->currentWidget() == ui_->artists && ui_->artists_collection->SearchFieldHasFocus()) ||
(ui_->tabs->currentWidget() == ui_->albums && ui_->albums_collection->SearchFieldHasFocus()) || (ui_->tabs->currentWidget() == ui_->albums && ui_->albums_collection->SearchFieldHasFocus()) ||
@@ -216,7 +216,7 @@ bool InternetTabsView::SearchFieldHasFocus() const {
} }
void InternetTabsView::FocusSearchField() { void StreamingTabsView::FocusSearchField() {
if (ui_->tabs->currentWidget() == ui_->artists) { if (ui_->tabs->currentWidget() == ui_->artists) {
ui_->artists_collection->FocusSearchField(); ui_->artists_collection->FocusSearchField();
@@ -233,7 +233,7 @@ void InternetTabsView::FocusSearchField() {
} }
void InternetTabsView::GetArtists() { void StreamingTabsView::GetArtists() {
if (!service_->authenticated() && service_->oauth()) { if (!service_->authenticated() && service_->oauth()) {
service_->ShowConfig(); service_->ShowConfig();
@@ -249,16 +249,16 @@ void InternetTabsView::GetArtists() {
} }
void InternetTabsView::AbortGetArtists() { void StreamingTabsView::AbortGetArtists() {
service_->ResetArtistsRequest(); service_->ResetArtistsRequest();
ui_->artists_collection->progressbar()->setValue(0); ui_->artists_collection->progressbar()->setValue(0);
ui_->artists_collection->status()->clear(); ui_->artists_collection->status()->clear();
ui_->artists_collection->stacked()->setCurrentWidget(ui_->artists_collection->internetcollection_page()); ui_->artists_collection->stacked()->setCurrentWidget(ui_->artists_collection->streamingcollection_page());
} }
void InternetTabsView::ArtistsFinished(const SongMap &songs, const QString &error) { void StreamingTabsView::ArtistsFinished(const SongMap &songs, const QString &error) {
if (songs.isEmpty() && !error.isEmpty()) { if (songs.isEmpty() && !error.isEmpty()) {
ui_->artists_collection->status()->setText(error); ui_->artists_collection->status()->setText(error);
@@ -268,14 +268,14 @@ void InternetTabsView::ArtistsFinished(const SongMap &songs, const QString &erro
ui_->artists_collection->button_close()->show(); ui_->artists_collection->button_close()->show();
} }
else { else {
ui_->artists_collection->stacked()->setCurrentWidget(ui_->artists_collection->internetcollection_page()); ui_->artists_collection->stacked()->setCurrentWidget(ui_->artists_collection->streamingcollection_page());
ui_->artists_collection->status()->clear(); ui_->artists_collection->status()->clear();
service_->artists_collection_backend()->UpdateSongsBySongIDAsync(songs); service_->artists_collection_backend()->UpdateSongsBySongIDAsync(songs);
} }
} }
void InternetTabsView::GetAlbums() { void StreamingTabsView::GetAlbums() {
if (!service_->authenticated() && service_->oauth()) { if (!service_->authenticated() && service_->oauth()) {
service_->ShowConfig(); service_->ShowConfig();
@@ -291,16 +291,16 @@ void InternetTabsView::GetAlbums() {
} }
void InternetTabsView::AbortGetAlbums() { void StreamingTabsView::AbortGetAlbums() {
service_->ResetAlbumsRequest(); service_->ResetAlbumsRequest();
ui_->albums_collection->progressbar()->setValue(0); ui_->albums_collection->progressbar()->setValue(0);
ui_->albums_collection->status()->clear(); ui_->albums_collection->status()->clear();
ui_->albums_collection->stacked()->setCurrentWidget(ui_->albums_collection->internetcollection_page()); ui_->albums_collection->stacked()->setCurrentWidget(ui_->albums_collection->streamingcollection_page());
} }
void InternetTabsView::AlbumsFinished(const SongMap &songs, const QString &error) { void StreamingTabsView::AlbumsFinished(const SongMap &songs, const QString &error) {
if (songs.isEmpty() && !error.isEmpty()) { if (songs.isEmpty() && !error.isEmpty()) {
ui_->albums_collection->status()->setText(error); ui_->albums_collection->status()->setText(error);
@@ -310,14 +310,14 @@ void InternetTabsView::AlbumsFinished(const SongMap &songs, const QString &error
ui_->albums_collection->button_close()->show(); ui_->albums_collection->button_close()->show();
} }
else { else {
ui_->albums_collection->stacked()->setCurrentWidget(ui_->albums_collection->internetcollection_page()); ui_->albums_collection->stacked()->setCurrentWidget(ui_->albums_collection->streamingcollection_page());
ui_->albums_collection->status()->clear(); ui_->albums_collection->status()->clear();
service_->albums_collection_backend()->UpdateSongsBySongIDAsync(songs); service_->albums_collection_backend()->UpdateSongsBySongIDAsync(songs);
} }
} }
void InternetTabsView::GetSongs() { void StreamingTabsView::GetSongs() {
if (!service_->authenticated() && service_->oauth()) { if (!service_->authenticated() && service_->oauth()) {
service_->ShowConfig(); service_->ShowConfig();
@@ -333,16 +333,16 @@ void InternetTabsView::GetSongs() {
} }
void InternetTabsView::AbortGetSongs() { void StreamingTabsView::AbortGetSongs() {
service_->ResetSongsRequest(); service_->ResetSongsRequest();
ui_->songs_collection->progressbar()->setValue(0); ui_->songs_collection->progressbar()->setValue(0);
ui_->songs_collection->status()->clear(); ui_->songs_collection->status()->clear();
ui_->songs_collection->stacked()->setCurrentWidget(ui_->songs_collection->internetcollection_page()); ui_->songs_collection->stacked()->setCurrentWidget(ui_->songs_collection->streamingcollection_page());
} }
void InternetTabsView::SongsFinished(const SongMap &songs, const QString &error) { void StreamingTabsView::SongsFinished(const SongMap &songs, const QString &error) {
if (songs.isEmpty() && !error.isEmpty()) { if (songs.isEmpty() && !error.isEmpty()) {
ui_->songs_collection->status()->setText(error); ui_->songs_collection->status()->setText(error);
@@ -352,13 +352,13 @@ void InternetTabsView::SongsFinished(const SongMap &songs, const QString &error)
ui_->songs_collection->button_close()->show(); ui_->songs_collection->button_close()->show();
} }
else { else {
ui_->songs_collection->stacked()->setCurrentWidget(ui_->songs_collection->internetcollection_page()); ui_->songs_collection->stacked()->setCurrentWidget(ui_->songs_collection->streamingcollection_page());
ui_->songs_collection->status()->clear(); ui_->songs_collection->status()->clear();
service_->songs_collection_backend()->UpdateSongsBySongIDAsync(songs); service_->songs_collection_backend()->UpdateSongsBySongIDAsync(songs);
} }
} }
void InternetTabsView::OpenSettingsDialog() { void StreamingTabsView::OpenSettingsDialog() {
app_->OpenSettingsDialogAtPage(service_->settings_page()); app_->OpenSettingsDialogAtPage(service_->settings_page());
} }

View File

@@ -17,8 +17,8 @@
* *
*/ */
#ifndef INTERNETTABSVIEW_H #ifndef STREAMINGTABSVIEW_H
#define INTERNETTABSVIEW_H #define STREAMINGTABSVIEW_H
#include "config.h" #include "config.h"
@@ -29,30 +29,30 @@
#include "core/shared_ptr.h" #include "core/shared_ptr.h"
#include "settings/settingsdialog.h" #include "settings/settingsdialog.h"
#include "internetcollectionviewcontainer.h" #include "streamingcollectionviewcontainer.h"
#include "ui_internettabsview.h" #include "ui_streamingtabsview.h"
#include "core/song.h" #include "core/song.h"
class QContextMenuEvent; class QContextMenuEvent;
class Application; class Application;
class InternetService; class StreamingService;
class InternetCollectionView; class StreamingCollectionView;
class InternetSearchView; class StreamingSearchView;
class InternetTabsView : public QWidget { class StreamingTabsView : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit InternetTabsView(Application *app, SharedPtr<InternetService> service, const QString &settings_group, const SettingsDialog::Page settings_page, QWidget *parent = nullptr); explicit StreamingTabsView(Application *app, SharedPtr<StreamingService> service, const QString &settings_group, const SettingsDialog::Page settings_page, QWidget *parent = nullptr);
~InternetTabsView() override; ~StreamingTabsView() override;
void ReloadSettings(); void ReloadSettings();
InternetCollectionView *artists_collection_view() const { return ui_->artists_collection->view(); } StreamingCollectionView *artists_collection_view() const { return ui_->artists_collection->view(); }
InternetCollectionView *albums_collection_view() const { return ui_->albums_collection->view(); } StreamingCollectionView *albums_collection_view() const { return ui_->albums_collection->view(); }
InternetCollectionView *songs_collection_view() const { return ui_->songs_collection->view(); } StreamingCollectionView *songs_collection_view() const { return ui_->songs_collection->view(); }
InternetSearchView *search_view() const { return ui_->search_view; } StreamingSearchView *search_view() const { return ui_->search_view; }
bool SearchFieldHasFocus() const; bool SearchFieldHasFocus() const;
void FocusSearchField(); void FocusSearchField();
@@ -71,10 +71,10 @@ class InternetTabsView : public QWidget {
private: private:
Application *app_; Application *app_;
SharedPtr <InternetService> service_; SharedPtr <StreamingService> service_;
QString settings_group_; QString settings_group_;
SettingsDialog::Page settings_page_; SettingsDialog::Page settings_page_;
Ui_InternetTabsView *ui_; Ui_StreamingTabsView *ui_;
}; };
#endif // INTERNETTABSVIEW_H #endif // STREAMINGTABSVIEW_H

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>InternetTabsView</class> <class>StreamingTabsView</class>
<widget class="QWidget" name="InternetTabsView"> <widget class="QWidget" name="StreamingTabsView">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@@ -11,9 +11,9 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Internet Tabs View</string> <string>Streaming Tabs View</string>
</property> </property>
<layout class="QVBoxLayout" name="layout_internettabsview"> <layout class="QVBoxLayout" name="layout_streamingtabsview">
<item> <item>
<widget class="QTabWidget" name="tabs"> <widget class="QTabWidget" name="tabs">
<property name="sizePolicy"> <property name="sizePolicy">
@@ -43,7 +43,7 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="InternetCollectionViewContainer" name="artists_collection" native="true"/> <widget class="StreamingCollectionViewContainer" name="artists_collection" native="true"/>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -65,7 +65,7 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="InternetCollectionViewContainer" name="albums_collection" native="true"/> <widget class="StreamingCollectionViewContainer" name="albums_collection" native="true"/>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -87,7 +87,7 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="InternetCollectionViewContainer" name="songs_collection" native="true"/> <widget class="StreamingCollectionViewContainer" name="songs_collection" native="true"/>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -109,7 +109,7 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="InternetSearchView" name="search_view" native="true"/> <widget class="StreamingSearchView" name="search_view" native="true"/>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -119,15 +119,15 @@
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>InternetSearchView</class> <class>StreamingSearchView</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>internet/internetsearchview.h</header> <header>streaming/streamingsearchview.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>InternetCollectionViewContainer</class> <class>StreamingCollectionViewContainer</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>internet/internetcollectionviewcontainer.h</header> <header>streaming/streamingcollectionviewcontainer.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>

View File

@@ -24,29 +24,29 @@
#include <QApplication> #include <QApplication>
#include <QVariant> #include <QVariant>
#include "internetplaylistitem.h" #include "streamplaylistitem.h"
#include "internetservice.h" #include "streamingservice.h"
#include "core/sqlrow.h" #include "core/sqlrow.h"
InternetPlaylistItem::InternetPlaylistItem(const Song::Source source) StreamPlaylistItem::StreamPlaylistItem(const Song::Source source)
: PlaylistItem(source), : PlaylistItem(source),
source_(source) {} source_(source) {}
InternetPlaylistItem::InternetPlaylistItem(const Song &metadata) StreamPlaylistItem::StreamPlaylistItem(const Song &metadata)
: PlaylistItem(metadata.source()), : PlaylistItem(metadata.source()),
source_(metadata.source()), source_(metadata.source()),
metadata_(metadata) { metadata_(metadata) {
InitMetadata(); InitMetadata();
} }
InternetPlaylistItem::InternetPlaylistItem(InternetServicePtr service, const Song &metadata) StreamPlaylistItem::StreamPlaylistItem(StreamingServicePtr service, const Song &metadata)
: PlaylistItem(metadata.source()), : PlaylistItem(metadata.source()),
source_(service->source()), source_(service->source()),
metadata_(metadata) { metadata_(metadata) {
InitMetadata(); InitMetadata();
} }
bool InternetPlaylistItem::InitFromQuery(const SqlRow &query) { bool StreamPlaylistItem::InitFromQuery(const SqlRow &query) {
metadata_.InitFromQuery(query, false, static_cast<int>(Song::kRowIdColumns.count())); metadata_.InitFromQuery(query, false, static_cast<int>(Song::kRowIdColumns.count()));
InitMetadata(); InitMetadata();
@@ -54,11 +54,11 @@ bool InternetPlaylistItem::InitFromQuery(const SqlRow &query) {
} }
QVariant InternetPlaylistItem::DatabaseValue(DatabaseColumn column) const { QVariant StreamPlaylistItem::DatabaseValue(DatabaseColumn column) const {
return PlaylistItem::DatabaseValue(column); return PlaylistItem::DatabaseValue(column);
} }
void InternetPlaylistItem::InitMetadata() { void StreamPlaylistItem::InitMetadata() {
if (metadata_.title().isEmpty()) metadata_.set_title(metadata_.url().toString()); if (metadata_.title().isEmpty()) metadata_.set_title(metadata_.url().toString());
if (metadata_.source() == Song::Source::Unknown) metadata_.set_source(Song::Source::Stream); if (metadata_.source() == Song::Source::Unknown) metadata_.set_source(Song::Source::Stream);
@@ -67,16 +67,16 @@ void InternetPlaylistItem::InitMetadata() {
} }
Song InternetPlaylistItem::Metadata() const { Song StreamPlaylistItem::Metadata() const {
if (HasTemporaryMetadata()) return temp_metadata_; if (HasTemporaryMetadata()) return temp_metadata_;
return metadata_; return metadata_;
} }
QUrl InternetPlaylistItem::Url() const { return metadata_.url(); } QUrl StreamPlaylistItem::Url() const { return metadata_.url(); }
void InternetPlaylistItem::SetArtManual(const QUrl &cover_url) { void StreamPlaylistItem::SetArtManual(const QUrl &cover_url) {
metadata_.set_art_manual(cover_url); metadata_.set_art_manual(cover_url);
temp_metadata_.set_art_manual(cover_url); temp_metadata_.set_art_manual(cover_url);

View File

@@ -19,8 +19,8 @@
* *
*/ */
#ifndef INTERNETPLAYLISTITEM_H #ifndef STREAMPLAYLISTITEM_H
#define INTERNETPLAYLISTITEM_H #define STREAMPLAYLISTITEM_H
#include "config.h" #include "config.h"
@@ -32,14 +32,14 @@
#include "core/sqlrow.h" #include "core/sqlrow.h"
#include "playlist/playlistitem.h" #include "playlist/playlistitem.h"
class InternetService; class StreamingService;
class InternetPlaylistItem : public PlaylistItem { class StreamPlaylistItem : public PlaylistItem {
public: public:
explicit InternetPlaylistItem(const Song::Source source); explicit StreamPlaylistItem(const Song::Source source);
explicit InternetPlaylistItem(const Song &metadata); explicit StreamPlaylistItem(const Song &metadata);
explicit InternetPlaylistItem(SharedPtr<InternetService> service, const Song &metadata); explicit StreamPlaylistItem(SharedPtr<StreamingService> service, const Song &metadata);
bool InitFromQuery(const SqlRow &query) override; bool InitFromQuery(const SqlRow &query) override;
Song Metadata() const override; Song Metadata() const override;
@@ -60,7 +60,7 @@ class InternetPlaylistItem : public PlaylistItem {
Song::Source source_; Song::Source source_;
Song metadata_; Song metadata_;
Q_DISABLE_COPY(InternetPlaylistItem) Q_DISABLE_COPY(StreamPlaylistItem)
}; };
#endif // INTERNETPLAYLISTITEM_H #endif // STREAMPLAYLISTITEM_H

View File

@@ -18,23 +18,23 @@
* *
*/ */
#ifndef INTERNETSONGMIMEDATA_H #ifndef STREAMSONGMIMEDATA_H
#define INTERNETSONGMIMEDATA_H #define STREAMSONGMIMEDATA_H
#include "core/shared_ptr.h" #include "core/shared_ptr.h"
#include "core/mimedata.h" #include "core/mimedata.h"
#include "core/song.h" #include "core/song.h"
class InternetService; class StreamingService;
class InternetSongMimeData : public MimeData { class StreamSongMimeData : public MimeData {
Q_OBJECT Q_OBJECT
public: public:
explicit InternetSongMimeData(SharedPtr<InternetService> _service, QObject* = nullptr) : service(_service) {} explicit StreamSongMimeData(SharedPtr<StreamingService> _service, QObject* = nullptr) : service(_service) {}
SharedPtr<InternetService> service; SharedPtr<StreamingService> service;
SongList songs; SongList songs;
}; };
#endif // INTERNETSONGMIMEDATA_H #endif // STREAMSONGMIMEDATA_H

View File

@@ -72,7 +72,7 @@ constexpr int kMaxRedirects = 3;
} // namespace } // namespace
SubsonicService::SubsonicService(Application *app, QObject *parent) SubsonicService::SubsonicService(Application *app, QObject *parent)
: InternetService(Song::Source::Subsonic, QStringLiteral("Subsonic"), QStringLiteral("subsonic"), QLatin1String(SubsonicSettingsPage::kSettingsGroup), SettingsDialog::Page::Subsonic, app, parent), : StreamingService(Song::Source::Subsonic, QStringLiteral("Subsonic"), QStringLiteral("subsonic"), QLatin1String(SubsonicSettingsPage::kSettingsGroup), SettingsDialog::Page::Subsonic, app, parent),
app_(app), app_(app),
url_handler_(new SubsonicUrlHandler(app, this)), url_handler_(new SubsonicUrlHandler(app, this)),
collection_backend_(nullptr), collection_backend_(nullptr),

View File

@@ -39,7 +39,7 @@
#include "core/scoped_ptr.h" #include "core/scoped_ptr.h"
#include "core/shared_ptr.h" #include "core/shared_ptr.h"
#include "core/song.h" #include "core/song.h"
#include "internet/internetservice.h" #include "streaming/streamingservice.h"
#include "settings/subsonicsettingspage.h" #include "settings/subsonicsettingspage.h"
class QNetworkReply; class QNetworkReply;
@@ -52,7 +52,7 @@ class CollectionBackend;
class CollectionModel; class CollectionModel;
class CollectionFilter; class CollectionFilter;
class SubsonicService : public InternetService { class SubsonicService : public StreamingService {
Q_OBJECT Q_OBJECT
public: public:

View File

@@ -51,7 +51,7 @@
#include "core/settings.h" #include "core/settings.h"
#include "utilities/randutils.h" #include "utilities/randutils.h"
#include "utilities/timeconstants.h" #include "utilities/timeconstants.h"
#include "internet/internetsearchview.h" #include "streaming/streamingsearchview.h"
#include "collection/collectionbackend.h" #include "collection/collectionbackend.h"
#include "collection/collectionmodel.h" #include "collection/collectionmodel.h"
#include "collection/collectionfilter.h" #include "collection/collectionfilter.h"
@@ -89,7 +89,7 @@ constexpr char kSongsTable[] = "tidal_songs";
} // namespace } // namespace
TidalService::TidalService(Application *app, QObject *parent) TidalService::TidalService(Application *app, QObject *parent)
: InternetService(Song::Source::Tidal, QStringLiteral("Tidal"), QStringLiteral("tidal"), QLatin1String(TidalSettingsPage::kSettingsGroup), SettingsDialog::Page::Tidal, app, parent), : StreamingService(Song::Source::Tidal, QStringLiteral("Tidal"), QStringLiteral("tidal"), QLatin1String(TidalSettingsPage::kSettingsGroup), SettingsDialog::Page::Tidal, app, parent),
app_(app), app_(app),
network_(app->network()), network_(app->network()),
url_handler_(new TidalUrlHandler(app, this)), url_handler_(new TidalUrlHandler(app, this)),
@@ -117,7 +117,7 @@ TidalService::TidalService(Application *app, QObject *parent)
login_time_(0), login_time_(0),
pending_search_id_(0), pending_search_id_(0),
next_pending_search_id_(1), next_pending_search_id_(1),
pending_search_type_(InternetSearchView::SearchType::Artists), pending_search_type_(StreamingSearchView::SearchType::Artists),
search_id_(0), search_id_(0),
login_sent_(false), login_sent_(false),
login_attempts_(0), login_attempts_(0),
@@ -871,7 +871,7 @@ void TidalService::SongsUpdateProgressReceived(const int id, const int progress)
emit SongsUpdateProgress(progress); emit SongsUpdateProgress(progress);
} }
int TidalService::Search(const QString &text, InternetSearchView::SearchType type) { int TidalService::Search(const QString &text, StreamingSearchView::SearchType type) {
pending_search_id_ = next_pending_search_id_; pending_search_id_ = next_pending_search_id_;
pending_search_text_ = text; pending_search_text_ = text;
@@ -919,13 +919,13 @@ void TidalService::SendSearch() {
TidalBaseRequest::QueryType query_type = TidalBaseRequest::QueryType::None; TidalBaseRequest::QueryType query_type = TidalBaseRequest::QueryType::None;
switch (pending_search_type_) { switch (pending_search_type_) {
case InternetSearchView::SearchType::Artists: case StreamingSearchView::SearchType::Artists:
query_type = TidalBaseRequest::QueryType::SearchArtists; query_type = TidalBaseRequest::QueryType::SearchArtists;
break; break;
case InternetSearchView::SearchType::Albums: case StreamingSearchView::SearchType::Albums:
query_type = TidalBaseRequest::QueryType::SearchAlbums; query_type = TidalBaseRequest::QueryType::SearchAlbums;
break; break;
case InternetSearchView::SearchType::Songs: case StreamingSearchView::SearchType::Songs:
query_type = TidalBaseRequest::QueryType::SearchSongs; query_type = TidalBaseRequest::QueryType::SearchSongs;
break; break;
default: default:

View File

@@ -38,8 +38,8 @@
#include "core/shared_ptr.h" #include "core/shared_ptr.h"
#include "core/song.h" #include "core/song.h"
#include "internet/internetservice.h" #include "streaming/streamingservice.h"
#include "internet/internetsearchview.h" #include "streaming/streamingsearchview.h"
#include "settings/tidalsettingspage.h" #include "settings/tidalsettingspage.h"
class QNetworkReply; class QNetworkReply;
@@ -55,7 +55,7 @@ class CollectionBackend;
class CollectionModel; class CollectionModel;
class CollectionFilter; class CollectionFilter;
class TidalService : public InternetService { class TidalService : public StreamingService {
Q_OBJECT Q_OBJECT
public: public:
@@ -71,7 +71,7 @@ class TidalService : public InternetService {
void ReloadSettings() override; void ReloadSettings() override;
void Logout(); void Logout();
int Search(const QString &text, InternetSearchView::SearchType type) override; int Search(const QString &text, StreamingSearchView::SearchType type) override;
void CancelSearch() override; void CancelSearch() override;
int max_login_attempts() const { return kLoginAttempts; } int max_login_attempts() const { return kLoginAttempts; }
@@ -209,7 +209,7 @@ class TidalService : public InternetService {
int pending_search_id_; int pending_search_id_;
int next_pending_search_id_; int next_pending_search_id_;
QString pending_search_text_; QString pending_search_text_;
InternetSearchView::SearchType pending_search_type_; StreamingSearchView::SearchType pending_search_type_;
int search_id_; int search_id_;
QString search_text_; QString search_text_;