Create replacement repo for previous corrupted one
This commit is contained in:
19
src/components/albumButton/albumButton.cpp
Normal file
19
src/components/albumButton/albumButton.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "albumButton.h"
|
||||
#include <QPixmap>
|
||||
#include <QIcon>
|
||||
|
||||
AlbumButton::AlbumButton(const AlbumData& item, QWidget* parent)
|
||||
: QPushButton(parent), item_(item)
|
||||
{
|
||||
QPixmap pix(item.imagePath);
|
||||
QPixmap scaled = pix.scaled(200, 200, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
|
||||
setIcon(QIcon(scaled));
|
||||
setIconSize(QSize(200, 200));
|
||||
setFixedSize(210, 210);
|
||||
setStyleSheet("border: none;");
|
||||
|
||||
connect(this, &QPushButton::clicked, this, [this]() {
|
||||
emit activated(item_);
|
||||
});
|
||||
}
|
||||
16
src/components/albumButton/albumButton.h
Normal file
16
src/components/albumButton/albumButton.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include <QPushButton>
|
||||
#include "src/data/albumInformation.h"
|
||||
|
||||
class AlbumButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AlbumButton(const AlbumData& item, QWidget* parent = nullptr);
|
||||
|
||||
signals:
|
||||
void activated(const AlbumData& item);
|
||||
|
||||
private:
|
||||
AlbumData item_;
|
||||
};
|
||||
42
src/components/albumTile/albumtile.cpp
Normal file
42
src/components/albumTile/albumtile.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#include "albumtile.h"
|
||||
#include <QPixmap>
|
||||
#include <QMouseEvent>
|
||||
|
||||
AlbumTile::AlbumTile(const AlbumData& item, QWidget* parent)
|
||||
: QWidget(parent), item_(item)
|
||||
{
|
||||
auto* layout = new QVBoxLayout(this);
|
||||
layout->setAlignment(Qt::AlignCenter);
|
||||
layout->setSpacing(6);
|
||||
|
||||
// Cover Image
|
||||
QPixmap pix(item.imagePath);
|
||||
QLabel* cover = new QLabel;
|
||||
cover->setPixmap(
|
||||
pix.scaled(200, 200, Qt::KeepAspectRatio, Qt::SmoothTransformation)
|
||||
);
|
||||
cover->setAlignment(Qt::AlignCenter);
|
||||
|
||||
// Album Label
|
||||
QLabel* albumLabel = new QLabel(item.album);
|
||||
albumLabel->setAlignment(Qt::AlignCenter);
|
||||
albumLabel->setStyleSheet("font-weight: 600; font-size: 14px;");
|
||||
|
||||
// Artist Label
|
||||
QLabel* artistLabel = new QLabel(item.artist);
|
||||
artistLabel->setAlignment(Qt::AlignCenter);
|
||||
artistLabel->setStyleSheet("color: #888; font-size: 12px;");
|
||||
|
||||
layout->addWidget(cover);
|
||||
layout->addWidget(albumLabel);
|
||||
layout->addWidget(artistLabel);
|
||||
|
||||
setCursor(Qt::PointingHandCursor);
|
||||
}
|
||||
|
||||
// Simple click handler
|
||||
void AlbumTile::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
emit activated(item_);
|
||||
QWidget::mousePressEvent(event);
|
||||
}
|
||||
23
src/components/albumTile/albumtile.h
Normal file
23
src/components/albumTile/albumtile.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
#include <QMouseEvent>
|
||||
#include "src/data/albumInformation.h"
|
||||
|
||||
class AlbumTile : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AlbumTile(const AlbumData& item, QWidget* parent = nullptr);
|
||||
|
||||
signals:
|
||||
void activated(const AlbumData& item);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent* event) override; // <-- REQUIRED
|
||||
|
||||
private:
|
||||
AlbumData item_;
|
||||
};
|
||||
20
src/components/mediaButton/mediaButton.cpp
Normal file
20
src/components/mediaButton/mediaButton.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "mediaButton.h"
|
||||
#include <QPixmap>
|
||||
#include <QIcon>
|
||||
|
||||
MediaButton::MediaButton(const AlbumData& item, QWidget* parent)
|
||||
: QPushButton(parent), item_(item)
|
||||
{
|
||||
QPixmap pix(item.imagePath);
|
||||
if (!pix.isNull()) {
|
||||
QPixmap scaled = pix.scaled(200, 200, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
this->setIcon(QIcon(scaled));
|
||||
this->setIconSize(QSize(200, 200));
|
||||
this->setFixedSize(210, 210);
|
||||
this->setStyleSheet("border: none;");
|
||||
}
|
||||
|
||||
connect(this, &QPushButton::clicked, this, [this]() {
|
||||
emit activated(item_);
|
||||
});
|
||||
}
|
||||
15
src/components/mediaButton/mediaButton.h
Normal file
15
src/components/mediaButton/mediaButton.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include <QPushButton>
|
||||
#include "src/data/albumInformation.h"
|
||||
|
||||
class MediaButton : public QPushButton {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MediaButton(const AlbumData& item, QWidget* parent = nullptr);
|
||||
|
||||
signals:
|
||||
void activated(const AlbumData& item);
|
||||
|
||||
private:
|
||||
AlbumData item_;
|
||||
};
|
||||
Reference in New Issue
Block a user