Skip to content

Commit

Permalink
use new remotepixmap class
Browse files Browse the repository at this point in the history
  • Loading branch information
keshavbhatt committed Apr 22, 2021
1 parent 20a6822 commit 402c48a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/songitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
#include <QDesktopServices>
#include <QGraphicsOpacityEffect>

SongItem::SongItem(QWidget *parent) :
SongItem::SongItem(QWidget *parent, QNetworkAccessManager *manager) :
QWidget(parent),
ui(new Ui::SongItem)
{
ui->setupUi(this);

this->networkManager_ = manager;

animate();
}

Expand Down Expand Up @@ -39,7 +41,7 @@ void SongItem::init(QString artist,QString title,QString album,QString release_d
this->artist = artist;
this->spotify_url = spotify_url;

ui->cover->setRemotePixmap(iconUrl,"qrc:///icons/app/icon-256.png");
ui->cover->init(this->networkManager_,iconUrl,"qrc:///icons/app/icon-256.png");
ui->titleLabel->setText(title);
ui->artistLabel->setText("by: "+artist);
ui->albumLabel->setText("from: "+album+" ("+release_date+")");
Expand Down
4 changes: 3 additions & 1 deletion src/songitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <QWidget>
#include <QMediaPlayer>
#include <QtNetwork>

namespace Ui {
class SongItem;
Expand All @@ -13,7 +14,7 @@ class SongItem : public QWidget
Q_OBJECT

public:
explicit SongItem(QWidget *parent = nullptr);
explicit SongItem(QWidget *parent = nullptr, QNetworkAccessManager *manager = nullptr);
~SongItem();

signals:
Expand All @@ -39,6 +40,7 @@ private slots:
Ui::SongItem *ui;
QString preview_url, title, artist, spotify_url;
QMediaPlayer *player = nullptr;
QNetworkAccessManager *networkManager_ = nullptr;
};

#endif // SONGITEM_H
6 changes: 3 additions & 3 deletions src/songitem.ui
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="RemotePixmapLabel" name="cover">
<widget class="RemotePixmapLabel2" name="cover">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -191,9 +191,9 @@
<header>elidedlabel.h</header>
</customwidget>
<customwidget>
<class>RemotePixmapLabel</class>
<class>RemotePixmapLabel2</class>
<extends>QLabel</extends>
<header>remotepixmaplabel.h</header>
<header>remotepixmaplabel2.h</header>
</customwidget>
</customwidgets>
<resources>
Expand Down

0 comments on commit 402c48a

Please sign in to comment.