Files clean-up
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
#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_);
|
||||
});
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
#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_;
|
||||
};
|
||||
@@ -1,20 +0,0 @@
|
||||
#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_);
|
||||
});
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#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_;
|
||||
};
|
||||
10
src/main.cpp
10
src/main.cpp
@@ -6,18 +6,18 @@
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
QApplication app(argc, argv);
|
||||
|
||||
QTranslator translator;
|
||||
const QStringList uiLanguages = QLocale::system().uiLanguages();
|
||||
for (const QString &locale : uiLanguages) {
|
||||
const QString baseName = "Music-Player_" + QLocale(locale).name();
|
||||
if (translator.load(":/i18n/" + baseName)) {
|
||||
a.installTranslator(&translator);
|
||||
app.installTranslator(&translator);
|
||||
break;
|
||||
}
|
||||
}
|
||||
MusicSelector w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
MusicSelector window;
|
||||
window.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
@@ -18,8 +18,7 @@ MusicSelector::MusicSelector(QWidget* parent)
|
||||
setLayout(flow);
|
||||
|
||||
// Set Media Folder
|
||||
QString projectRoot = QDir(QCoreApplication::applicationDirPath())
|
||||
.absoluteFilePath("../../../../.."); // Escape the .app bundle
|
||||
QString projectRoot = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath("../../../../.."); // Escape the .app bundle
|
||||
|
||||
// Now manually append your real resources dir:
|
||||
QString mediaFolder = projectRoot + "/resources/media";
|
||||
@@ -76,7 +75,7 @@ QList<AlbumData> MusicSelector::scanFolder(const QString& root)
|
||||
audioFiles.append(f.absoluteFilePath());
|
||||
}
|
||||
|
||||
// 🔍 DEBUG GOES HERE, where artistInfo, albumInfo, image, audioFiles exist
|
||||
// DEBUG HERE, where artistInfo, albumInfo, image, audioFiles exist
|
||||
qDebug() << "Artist:" << artistInfo.fileName();
|
||||
qDebug() << "Album:" << albumInfo.fileName();
|
||||
qDebug() << "Image found:" << image;
|
||||
|
||||
@@ -10,7 +10,7 @@ public:
|
||||
explicit MusicSelector(QWidget *parent = nullptr);
|
||||
|
||||
private:
|
||||
QList<AlbumData> scanFolder(const QString& root); // <-- RIGHT HERE
|
||||
QList<AlbumData> scanFolder(const QString& root);
|
||||
|
||||
QGridLayout* grid;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user