Fix show album cover from Tidal
This commit is contained in:
parent
f9379961e9
commit
e479e7e113
|
@ -856,6 +856,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
|
|||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
||||
|
||||
|
||||
qt5_wrap_cpp(MOC ${HEADERS})
|
||||
qt5_wrap_ui(UIC ${UI})
|
||||
qt5_add_resources(QRC ${RESOURCES})
|
||||
|
|
|
@ -2346,7 +2346,7 @@ void MainWindow::UnsetCover() {
|
|||
}
|
||||
|
||||
void MainWindow::ShowCover() {
|
||||
album_cover_choice_controller_->ShowCover(song_);
|
||||
album_cover_choice_controller_->ShowCover(song_, image_original_);
|
||||
}
|
||||
|
||||
void MainWindow::SearchCoverAutomatically() {
|
||||
|
|
|
@ -206,6 +206,26 @@ QString AlbumCoverChoiceController::UnsetCover(Song *song) {
|
|||
|
||||
void AlbumCoverChoiceController::ShowCover(const Song &song) {
|
||||
|
||||
QPixmap pixmap = AlbumCoverLoader::TryLoadPixmap(song.art_automatic(), song.art_manual(), song.url().toLocalFile());
|
||||
ShowCover(song, pixmap);
|
||||
|
||||
}
|
||||
|
||||
void AlbumCoverChoiceController::ShowCover(const Song &song, const QImage image) {
|
||||
|
||||
QUrl url_manual(song.art_manual());
|
||||
QUrl url_automatic(song.art_automatic());
|
||||
|
||||
if (url_manual.isLocalFile() || url_automatic.isLocalFile()) {
|
||||
QPixmap pixmap = AlbumCoverLoader::TryLoadPixmap(song.art_automatic(), song.art_manual(), song.url().toLocalFile());
|
||||
ShowCover(song, pixmap);
|
||||
}
|
||||
else if (!image.isNull()) ShowCover(song, QPixmap::fromImage(image));
|
||||
|
||||
}
|
||||
|
||||
void AlbumCoverChoiceController::ShowCover(const Song &song, const QPixmap &pixmap) {
|
||||
|
||||
QDialog *dialog = new QDialog(this);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
|
@ -214,7 +234,7 @@ void AlbumCoverChoiceController::ShowCover(const Song &song) {
|
|||
if (!song.effective_album().isEmpty()) title_text += " - " + song.effective_album();
|
||||
|
||||
QLabel *label = new QLabel(dialog);
|
||||
label->setPixmap(AlbumCoverLoader::TryLoadPixmap(song.art_automatic(), song.art_manual(), song.url().toLocalFile()));
|
||||
label->setPixmap(pixmap);
|
||||
|
||||
// Add (WxHpx) to the title before possibly resizing
|
||||
title_text += " (" + QString::number(label->pixmap()->width()) + "x" + QString::number(label->pixmap()->height()) + "px)";
|
||||
|
@ -329,6 +349,7 @@ bool AlbumCoverChoiceController::CanAcceptDrag(const QDragEnterEvent *e) {
|
|||
QString AlbumCoverChoiceController::SaveCover(Song *song, const QDropEvent *e) {
|
||||
|
||||
for (const QUrl &url : e->mimeData()->urls()) {
|
||||
|
||||
const QString filename = url.toLocalFile();
|
||||
const QString suffix = QFileInfo(filename).suffix().toLower();
|
||||
|
||||
|
|
|
@ -101,6 +101,8 @@ class AlbumCoverChoiceController : public QWidget {
|
|||
|
||||
// Shows the cover of given song in it's original size.
|
||||
void ShowCover(const Song &song);
|
||||
void ShowCover(const Song &song, const QImage image);
|
||||
void ShowCover(const Song &song, const QPixmap &pixmap);
|
||||
|
||||
// Search for covers automatically
|
||||
void SearchCoverAutomatically(const Song &song);
|
||||
|
|
|
@ -55,7 +55,7 @@ bool MusicbrainzCoverProvider::StartSearch(const QString &artist, const QString
|
|||
QString query = QString("release:\"%1\" AND artist:\"%2\"").arg(album.trimmed().replace('"', "\\\"")).arg(artist.trimmed().replace('"', "\\\""));
|
||||
QUrlQuery url_query;
|
||||
url_query.addQueryItem("query", query);
|
||||
url_query.addQueryItem("limit", "15");
|
||||
url_query.addQueryItem("limit", "6");
|
||||
QUrl url(kReleaseSearchUrl);
|
||||
url.setQuery(url_query);
|
||||
QNetworkRequest request(url);
|
||||
|
|
|
@ -261,7 +261,7 @@ void TidalSearch::HandleLoadedArt(int id, const QImage &image) {
|
|||
}
|
||||
|
||||
QImage TidalSearch::ScaleAndPad(const QImage &image) {
|
||||
|
||||
|
||||
if (image.isNull()) return QImage();
|
||||
|
||||
const QSize target_size = QSize(kArtHeight, kArtHeight);
|
||||
|
|
|
@ -274,7 +274,7 @@ void TidalSearchView::SwapModels() {
|
|||
}
|
||||
|
||||
void TidalSearchView::LazyLoadArt(const QModelIndex &proxy_index) {
|
||||
|
||||
|
||||
if (!proxy_index.isValid() || proxy_index.model() != front_proxy_) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -109,8 +109,7 @@ private:
|
|||
float m_fader;
|
||||
};
|
||||
|
||||
class FancyTabBar : public QWidget
|
||||
{
|
||||
class FancyTabBar : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
@ -139,7 +138,7 @@ class FancyTabBar : public QWidget
|
|||
|
||||
QIcon tabIcon(int index) const {return m_tabs.at(index)->icon; }
|
||||
QString tabText(int index) const { return m_tabs.at(index)->text; }
|
||||
int count() const {return m_tabs.count(); }
|
||||
int count() const { return m_tabs.count(); }
|
||||
QRect tabRect(int index) const;
|
||||
|
||||
signals:
|
||||
|
|
Loading…
Reference in New Issue