mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-31 11:35:24 +01:00
Work around QTBUG-11620 (fixed in 4.7) that causes a crash when skipping through tracks with the Artist Info tab open. Fixes issue #935
This commit is contained in:
parent
b578c61b36
commit
92b6c3a3ec
@ -55,7 +55,7 @@ void ArtistInfoView::ResultReady(int id, const SongInfoFetcher::Result& result)
|
||||
|
||||
if (!result.images_.isEmpty()) {
|
||||
// Image view goes at the top
|
||||
PrettyImageView* image_view = new PrettyImageView(this);
|
||||
PrettyImageView* image_view = new PrettyImageView(network_, this);
|
||||
AddWidget(image_view);
|
||||
|
||||
foreach (const QUrl& url, result.images_) {
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "songinfobase.h"
|
||||
#include "core/network.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QScrollArea>
|
||||
@ -28,6 +29,7 @@ const char* SongInfoBase::kSettingsGroup = "SongInfo";
|
||||
|
||||
SongInfoBase::SongInfoBase(QWidget* parent)
|
||||
: QWidget(parent),
|
||||
network_(new NetworkAccessManager(this)),
|
||||
fetcher_(new SongInfoFetcher(this)),
|
||||
current_request_id_(-1),
|
||||
scroll_area_(new QScrollArea),
|
||||
|
@ -30,6 +30,7 @@
|
||||
class CollapsibleInfoPane;
|
||||
class WidgetFadeHelper;
|
||||
|
||||
class QNetworkAccessManager;
|
||||
class QScrollArea;
|
||||
class QVBoxLayout;
|
||||
|
||||
@ -66,6 +67,7 @@ protected slots:
|
||||
virtual void ResultReady(int id, const SongInfoFetcher::Result& result);
|
||||
|
||||
protected:
|
||||
QNetworkAccessManager* network_;
|
||||
SongInfoFetcher* fetcher_;
|
||||
int current_request_id_;
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
#include "prettyimage.h"
|
||||
#include "core/network.h"
|
||||
#include "ui/iconloader.h"
|
||||
|
||||
#include <QApplication>
|
||||
@ -28,6 +27,7 @@
|
||||
#include <QFutureWatcher>
|
||||
#include <QLabel>
|
||||
#include <QMenu>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QPainter>
|
||||
#include <QScrollArea>
|
||||
@ -43,9 +43,10 @@ const int PrettyImage::kMaxImageWidth = 300;
|
||||
|
||||
const char* PrettyImage::kSettingsGroup = "PrettyImageView";
|
||||
|
||||
PrettyImage::PrettyImage(const QUrl& url, QWidget* parent)
|
||||
PrettyImage::PrettyImage(const QUrl& url, QNetworkAccessManager* network,
|
||||
QWidget* parent)
|
||||
: QWidget(parent),
|
||||
network_(new NetworkAccessManager(this)),
|
||||
network_(network),
|
||||
state_(State_WaitingForLazyLoad),
|
||||
url_(url),
|
||||
menu_(NULL)
|
||||
|
@ -21,16 +21,16 @@
|
||||
#include <QUrl>
|
||||
#include <QWidget>
|
||||
|
||||
class NetworkAccessManager;
|
||||
|
||||
class QMenu;
|
||||
class QNetworkAccessManager;
|
||||
class QNetworkReply;
|
||||
|
||||
class PrettyImage : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PrettyImage(const QUrl& url, QWidget* parent = 0);
|
||||
PrettyImage(const QUrl& url, QNetworkAccessManager* network,
|
||||
QWidget* parent = 0);
|
||||
|
||||
static const int kTotalHeight;
|
||||
static const int kReflectionHeight;
|
||||
@ -70,7 +70,7 @@ private:
|
||||
void DrawThumbnail(QPainter* p, const QRect& rect);
|
||||
|
||||
private:
|
||||
NetworkAccessManager* network_;
|
||||
QNetworkAccessManager* network_;
|
||||
State state_;
|
||||
QUrl url_;
|
||||
|
||||
|
@ -25,8 +25,9 @@
|
||||
#include <QTimer>
|
||||
#include <QtDebug>
|
||||
|
||||
PrettyImageView::PrettyImageView(QWidget* parent)
|
||||
PrettyImageView::PrettyImageView(QNetworkAccessManager* network, QWidget* parent)
|
||||
: QScrollArea(parent),
|
||||
network_(network),
|
||||
container_(new QWidget(this)),
|
||||
layout_(new QHBoxLayout(container_)),
|
||||
current_index_(-1),
|
||||
@ -66,7 +67,7 @@ bool PrettyImageView::eventFilter(QObject* obj, QEvent* event) {
|
||||
}
|
||||
|
||||
void PrettyImageView::AddImage(const QUrl& url) {
|
||||
PrettyImage* image = new PrettyImage(url, container_);
|
||||
PrettyImage* image = new PrettyImage(url, network_, container_);
|
||||
connect(image, SIGNAL(destroyed()), SLOT(ScrollToCurrent()));
|
||||
connect(image, SIGNAL(Loaded()), SLOT(ScrollToCurrent()));
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
class QHBoxLayout;
|
||||
class QMenu;
|
||||
class QNetworkAccessManager;
|
||||
class QNetworkReply;
|
||||
class QPropertyAnimation;
|
||||
class QTimeLine;
|
||||
@ -32,7 +33,7 @@ class PrettyImageView : public QScrollArea {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PrettyImageView(QWidget* parent = 0);
|
||||
PrettyImageView(QNetworkAccessManager* network, QWidget* parent = 0);
|
||||
|
||||
static const char* kSettingsGroup;
|
||||
|
||||
@ -52,6 +53,8 @@ private slots:
|
||||
private:
|
||||
bool eventFilter(QObject*, QEvent*);
|
||||
|
||||
QNetworkAccessManager* network_;
|
||||
|
||||
QWidget* container_;
|
||||
QHBoxLayout* layout_;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user