now that we have more cover providers, we're bringing the cover manager and the cover searcher goodness to our last.fm-less users
This commit is contained in:
parent
b15156a7a3
commit
fdda938c53
@ -228,6 +228,9 @@ set(SOURCES
|
||||
ui/about.cpp
|
||||
ui/addstreamdialog.cpp
|
||||
ui/albumcoverchoicecontroller.cpp
|
||||
ui/albumcovermanager.cpp
|
||||
ui/albumcovermanagerlist.cpp
|
||||
ui/albumcoversearcher.cpp
|
||||
ui/coverfromurldialog.cpp
|
||||
ui/edittagdialog.cpp
|
||||
ui/equalizer.cpp
|
||||
@ -422,6 +425,9 @@ set(HEADERS
|
||||
ui/about.h
|
||||
ui/addstreamdialog.h
|
||||
ui/albumcoverchoicecontroller.h
|
||||
ui/albumcovermanager.h
|
||||
ui/albumcovermanagerlist.h
|
||||
ui/albumcoversearcher.h
|
||||
ui/coverfromurldialog.h
|
||||
ui/edittagdialog.h
|
||||
ui/equalizer.h
|
||||
@ -510,6 +516,8 @@ set(UI
|
||||
|
||||
ui/about.ui
|
||||
ui/addstreamdialog.ui
|
||||
ui/albumcovermanager.ui
|
||||
ui/albumcoversearcher.ui
|
||||
ui/coverfromurldialog.ui
|
||||
ui/edittagdialog.ui
|
||||
ui/equalizer.ui
|
||||
@ -588,9 +596,6 @@ if(HAVE_LIBLASTFM)
|
||||
songinfo/echonesttags.cpp
|
||||
songinfo/lastfmtrackinfoprovider.cpp
|
||||
songinfo/tagwidget.cpp
|
||||
ui/albumcovermanager.cpp
|
||||
ui/albumcovermanagerlist.cpp
|
||||
ui/albumcoversearcher.cpp
|
||||
)
|
||||
list(APPEND HEADERS
|
||||
covers/lastfmcoverprovider.h
|
||||
@ -601,15 +606,10 @@ if(HAVE_LIBLASTFM)
|
||||
songinfo/echonesttags.h
|
||||
songinfo/lastfmtrackinfoprovider.h
|
||||
songinfo/tagwidget.h
|
||||
ui/albumcovermanager.h
|
||||
ui/albumcovermanagerlist.h
|
||||
ui/albumcoversearcher.h
|
||||
)
|
||||
list(APPEND UI
|
||||
radio/lastfmconfig.ui
|
||||
radio/lastfmstationdialog.ui
|
||||
ui/albumcovermanager.ui
|
||||
ui/albumcoversearcher.ui
|
||||
)
|
||||
endif(HAVE_LIBLASTFM)
|
||||
|
||||
|
@ -39,8 +39,11 @@ public:
|
||||
|
||||
// Let's a cover provider to register itself in the repository.
|
||||
void AddCoverProvider(CoverProvider* provider);
|
||||
|
||||
// Returns a list of the currently registered cover providers.
|
||||
const QList<CoverProvider*> List();
|
||||
// Returns true if this repository has at least one registered provider.
|
||||
bool HasAnyProviders() { return !List().isEmpty(); }
|
||||
|
||||
~CoverProviders() {}
|
||||
|
||||
|
@ -21,13 +21,10 @@
|
||||
#include "library/librarybackend.h"
|
||||
#include "ui/albumcoverchoicecontroller.h"
|
||||
#include "ui/albumcovermanager.h"
|
||||
#include "ui/albumcoversearcher.h"
|
||||
#include "ui/coverfromurldialog.h"
|
||||
#include "ui/iconloader.h"
|
||||
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
# include "ui/albumcoversearcher.h"
|
||||
#endif
|
||||
|
||||
#include <QAction>
|
||||
#include <QCryptographicHash>
|
||||
#include <QDialog>
|
||||
@ -50,17 +47,13 @@ QSet<QString>* AlbumCoverChoiceController::sImageExtensions = NULL;
|
||||
|
||||
AlbumCoverChoiceController::AlbumCoverChoiceController(QWidget* parent)
|
||||
: QWidget(parent),
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
cover_searcher_(new AlbumCoverSearcher(QIcon(":/nocover.png"), this)),
|
||||
#endif
|
||||
cover_fetcher_(new AlbumCoverFetcher(this)),
|
||||
save_file_dialog_(NULL),
|
||||
cover_from_url_dialog_(NULL),
|
||||
library_(NULL)
|
||||
{
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
cover_searcher_->Init(cover_fetcher_);
|
||||
#endif
|
||||
|
||||
cover_from_file_ = new QAction(IconLoader::Load("document-open"), tr("Load cover from disk..."), this);
|
||||
cover_to_file_ = new QAction(IconLoader::Load("document-save"), tr("Save cover to disk..."), this);
|
||||
@ -164,7 +157,6 @@ QString AlbumCoverChoiceController::LoadCoverFromURL(Song* song) {
|
||||
}
|
||||
|
||||
QString AlbumCoverChoiceController::SearchForCover(Song* song) {
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
// Get something sensible to stick in the search box
|
||||
QString query = song->artist();
|
||||
if (!query.isEmpty())
|
||||
@ -181,9 +173,6 @@ QString AlbumCoverChoiceController::SearchForCover(Song* song) {
|
||||
} else {
|
||||
return QString();
|
||||
}
|
||||
#else
|
||||
return QString();
|
||||
#endif
|
||||
}
|
||||
|
||||
QString AlbumCoverChoiceController::UnsetCover(Song* song) {
|
||||
|
@ -23,11 +23,8 @@
|
||||
#include <QMenu>
|
||||
#include <QWidget>
|
||||
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
class AlbumCoverSearcher;
|
||||
#endif
|
||||
|
||||
class AlbumCoverFetcher;
|
||||
class AlbumCoverSearcher;
|
||||
class CoverFromURLDialog;
|
||||
class LibraryBackend;
|
||||
class QFileDialog;
|
||||
@ -115,9 +112,7 @@ private:
|
||||
static bool IsKnownImageExtension(const QString& suffix);
|
||||
static QSet<QString>* sImageExtensions;
|
||||
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
AlbumCoverSearcher* cover_searcher_;
|
||||
#endif
|
||||
AlbumCoverFetcher* cover_fetcher_;
|
||||
|
||||
QFileDialog* save_file_dialog_;
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "iconloader.h"
|
||||
#include "ui_albumcovermanager.h"
|
||||
#include "covers/albumcoverfetcher.h"
|
||||
#include "covers/coverproviders.h"
|
||||
#include "library/librarybackend.h"
|
||||
#include "library/libraryquery.h"
|
||||
#include "library/sqlrow.h"
|
||||
@ -444,6 +445,7 @@ bool AlbumCoverManager::eventFilter(QObject *obj, QEvent *event) {
|
||||
album_cover_choice_controller_->cover_from_url_action()->setEnabled(context_menu_items_.size() == 1);
|
||||
album_cover_choice_controller_->show_cover_action()->setEnabled(some_with_covers && context_menu_items_.size() == 1);
|
||||
album_cover_choice_controller_->unset_cover_action()->setEnabled(some_with_covers);
|
||||
album_cover_choice_controller_->search_for_cover_action()->setEnabled(CoverProviders::instance().HasAnyProviders());
|
||||
|
||||
QContextMenuEvent* e = static_cast<QContextMenuEvent*>(event);
|
||||
context_menu_->popup(e->globalPos());
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "core/logging.h"
|
||||
#include "core/utilities.h"
|
||||
#include "covers/albumcoverloader.h"
|
||||
#include "covers/coverproviders.h"
|
||||
#include "library/library.h"
|
||||
#include "library/librarybackend.h"
|
||||
#include "musicbrainz/fingerprinter.h"
|
||||
@ -409,11 +410,6 @@ void EditTagDialog::UpdateSummaryTab(const Song& song) {
|
||||
|
||||
ui_->summary->setText(summary);
|
||||
|
||||
#ifndef HAVE_LIBLASTFM
|
||||
album_cover_choice_controller_->cover_from_file_action()->setEnabled(false);
|
||||
album_cover_choice_controller_->search_for_cover_action()->setEnabled(false);
|
||||
#endif
|
||||
|
||||
album_cover_choice_controller_->unset_cover_action()->setEnabled(art_is_set);
|
||||
album_cover_choice_controller_->show_cover_action()->setEnabled(art_is_set);
|
||||
ui_->summary_art_button->setEnabled(song.id() != -1);
|
||||
@ -429,6 +425,8 @@ void EditTagDialog::UpdateSummaryTab(const Song& song) {
|
||||
ui_->filesize->setText(Utilities::PrettySize(song.filesize()));
|
||||
ui_->filetype->setText(song.TextForFiletype());
|
||||
ui_->filename->setText(QDir::toNativeSeparators(song.filename()));
|
||||
|
||||
album_cover_choice_controller_->search_for_cover_action()->setEnabled(CoverProviders::instance().HasAnyProviders());
|
||||
}
|
||||
|
||||
void EditTagDialog::UpdateStatisticsTab(const Song& song) {
|
||||
|
@ -73,6 +73,7 @@
|
||||
#include "transcoder/transcodedialog.h"
|
||||
#include "ui/about.h"
|
||||
#include "ui/addstreamdialog.h"
|
||||
#include "ui/albumcovermanager.h"
|
||||
#include "ui/edittagdialog.h"
|
||||
#include "ui/equalizer.h"
|
||||
#include "ui/iconloader.h"
|
||||
@ -97,7 +98,6 @@
|
||||
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
# include "radio/lastfmservice.h"
|
||||
# include "ui/albumcovermanager.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WIIMOTEDEV
|
||||
@ -181,9 +181,7 @@ MainWindow::MainWindow(
|
||||
song_info_view_(new SongInfoView(this)),
|
||||
artist_info_view_(new ArtistInfoView(this)),
|
||||
settings_dialog_(NULL),
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
cover_manager_(NULL),
|
||||
#endif
|
||||
equalizer_(new Equalizer),
|
||||
error_dialog_(NULL),
|
||||
organise_dialog_(new OrganiseDialog(task_manager_)),
|
||||
@ -341,11 +339,7 @@ MainWindow::MainWindow(
|
||||
connect(ui_->action_add_file, SIGNAL(triggered()), SLOT(AddFile()));
|
||||
connect(ui_->action_add_folder, SIGNAL(triggered()), SLOT(AddFolder()));
|
||||
connect(ui_->action_add_stream, SIGNAL(triggered()), SLOT(AddStream()));
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
connect(ui_->action_cover_manager, SIGNAL(triggered()), SLOT(ShowCoverManager()));
|
||||
#else
|
||||
ui_->action_cover_manager->setEnabled(false);
|
||||
#endif
|
||||
connect(ui_->action_equalizer, SIGNAL(triggered()), equalizer_.get(), SLOT(show()));
|
||||
connect(ui_->action_transcode, SIGNAL(triggered()), SLOT(ShowTranscodeDialog()));
|
||||
connect(ui_->action_jump, SIGNAL(triggered()), ui_->playlist->view(), SLOT(JumpToCurrentlyPlayingTrack()));
|
||||
@ -1871,7 +1865,6 @@ void MainWindow::ChangeLibraryQueryMode(QAction* action) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
void MainWindow::ShowCoverManager() {
|
||||
if (!cover_manager_) {
|
||||
cover_manager_.reset(new AlbumCoverManager(library_->backend()));
|
||||
@ -1883,7 +1876,6 @@ void MainWindow::ShowCoverManager() {
|
||||
|
||||
cover_manager_->show();
|
||||
}
|
||||
#endif
|
||||
|
||||
void MainWindow::EnsureSettingsDialogCreated() {
|
||||
if (settings_dialog_)
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
class About;
|
||||
class AddStreamDialog;
|
||||
class AlbumCoverManager;
|
||||
class ArtistInfoView;
|
||||
class ArtLoader;
|
||||
class BackgroundStreams;
|
||||
@ -77,10 +78,6 @@ class Ui_MainWindow;
|
||||
|
||||
class QSortFilterProxyModel;
|
||||
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
class AlbumCoverManager;
|
||||
#endif
|
||||
|
||||
class MainWindow : public QMainWindow, public PlatformInterface {
|
||||
Q_OBJECT
|
||||
|
||||
@ -221,8 +218,8 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
||||
|
||||
void SongSaveComplete();
|
||||
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
void ShowCoverManager();
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
void ScrobblerStatus(int value);
|
||||
#endif
|
||||
void ShowAboutDialog();
|
||||
@ -288,9 +285,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
||||
|
||||
boost::scoped_ptr<SettingsDialog> settings_dialog_;
|
||||
boost::scoped_ptr<AddStreamDialog> add_stream_dialog_;
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
boost::scoped_ptr<AlbumCoverManager> cover_manager_;
|
||||
#endif
|
||||
boost::scoped_ptr<Equalizer> equalizer_;
|
||||
boost::scoped_ptr<TranscodeDialog> transcode_dialog_;
|
||||
boost::scoped_ptr<ErrorDialog> error_dialog_;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "fullscreenhypnotoad.h"
|
||||
#include "nowplayingwidget.h"
|
||||
#include "covers/albumcoverloader.h"
|
||||
#include "covers/coverproviders.h"
|
||||
#include "covers/kittenloader.h"
|
||||
#include "library/librarybackend.h"
|
||||
#include "ui/albumcoverchoicecontroller.h"
|
||||
@ -379,17 +380,12 @@ void NowPlayingWidget::contextMenuEvent(QContextMenuEvent* e) {
|
||||
album_cover_choice_controller_->cover_from_file_action()->setEnabled(!aww_);
|
||||
album_cover_choice_controller_->cover_to_file_action()->setEnabled(aww_);
|
||||
album_cover_choice_controller_->cover_from_url_action()->setEnabled(!aww_);
|
||||
album_cover_choice_controller_->search_for_cover_action()->setEnabled(!aww_);
|
||||
album_cover_choice_controller_->search_for_cover_action()->setEnabled(!aww_ && CoverProviders::instance().HasAnyProviders());
|
||||
album_cover_choice_controller_->unset_cover_action()->setEnabled(!aww_);
|
||||
album_cover_choice_controller_->show_cover_action()->setEnabled(!aww_);
|
||||
|
||||
// some special cases
|
||||
if (!aww_) {
|
||||
#ifndef HAVE_LIBLASTFM
|
||||
album_cover_choice_controller_->cover_from_file_action()->setEnabled(false);
|
||||
album_cover_choice_controller_->search_for_cover_action()->setEnabled(false);
|
||||
#endif
|
||||
|
||||
const bool art_is_not_set = metadata_.has_manually_unset_cover()
|
||||
|| (metadata_.art_automatic().isEmpty() && metadata_.art_manual().isEmpty());
|
||||
|
||||
|
@ -109,6 +109,7 @@ endmacro (add_test_file)
|
||||
|
||||
#add_test_file(albumcoverfetcher_test.cpp false)
|
||||
|
||||
add_test_file(albumcovermanager_test.cpp true)
|
||||
add_test_file(asxparser_test.cpp false)
|
||||
add_test_file(asxiniparser_test.cpp false)
|
||||
add_test_file(cueparser_test.cpp false)
|
||||
@ -129,10 +130,6 @@ add_test_file(song_test.cpp false)
|
||||
add_test_file(translations_test.cpp false)
|
||||
add_test_file(xspfparser_test.cpp false)
|
||||
|
||||
if(HAVE_LIBLASTFM)
|
||||
add_test_file(albumcovermanager_test.cpp true)
|
||||
endif(HAVE_LIBLASTFM)
|
||||
|
||||
if(LINUX AND HAVE_DBUS)
|
||||
add_test_file(mpris1_test.cpp true)
|
||||
endif(LINUX AND HAVE_DBUS)
|
||||
|
Loading…
x
Reference in New Issue
Block a user