Reorganize file structure. Window names are now more clear and components are sorted by window use
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include "src/windows/musicSelector/musicSelector.h"
|
||||
#include "src/windows/albumSelector/albumSelector.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QLocale>
|
||||
@@ -17,7 +17,7 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
}
|
||||
}
|
||||
MusicSelector window;
|
||||
AlbumSelector window;
|
||||
window.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#include "src/windows/musicSelector/musicSelector.h"
|
||||
#include "src/components/albumTile/albumTile.h"
|
||||
#include "src/windows/playerWindow/playerWindow.h"
|
||||
#include "src/windows/albumSelector/albumSelector.h"
|
||||
#include "src/components/albumSelector/albumTile/albumTile.h"
|
||||
#include "src/windows/nowPlaying/nowPlaying.h"
|
||||
#include "src/layout/flowlayout/flowLayout.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QCoreApplication>
|
||||
#include <QFileInfo>
|
||||
|
||||
MusicSelector::MusicSelector(QWidget* parent)
|
||||
AlbumSelector::AlbumSelector(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
setWindowTitle("Album Selector");
|
||||
@@ -36,13 +36,13 @@ MusicSelector::MusicSelector(QWidget* parent)
|
||||
flow->addWidget(tile);
|
||||
|
||||
connect(tile, &AlbumTile::activated, this, [this](const AlbumData& it) {
|
||||
auto* player = new PlayerWindow(it);
|
||||
auto* player = new NowPlaying(it);
|
||||
player->show();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
QList<AlbumData> MusicSelector::scanFolder(const QString& root)
|
||||
QList<AlbumData> AlbumSelector::scanFolder(const QString& root)
|
||||
{
|
||||
QList<AlbumData> results;
|
||||
|
||||
@@ -75,12 +75,6 @@ QList<AlbumData> MusicSelector::scanFolder(const QString& root)
|
||||
audioFiles.append(f.absoluteFilePath());
|
||||
}
|
||||
|
||||
// DEBUG HERE, where artistInfo, albumInfo, image, audioFiles exist
|
||||
qDebug() << "Artist:" << artistInfo.fileName();
|
||||
qDebug() << "Album:" << albumInfo.fileName();
|
||||
qDebug() << "Image found:" << image;
|
||||
qDebug() << "Tracks:" << audioFiles;
|
||||
|
||||
// Only add if album valid
|
||||
if (!image.isEmpty() && !audioFiles.isEmpty())
|
||||
{
|
||||
@@ -3,11 +3,11 @@
|
||||
#include <QGridLayout>
|
||||
#include "src/data/albumInformation.h"
|
||||
|
||||
class MusicSelector : public QWidget
|
||||
class AlbumSelector : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MusicSelector(QWidget *parent = nullptr);
|
||||
explicit AlbumSelector(QWidget *parent = nullptr);
|
||||
|
||||
private:
|
||||
QList<AlbumData> scanFolder(const QString& root);
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "playerWindow.h"
|
||||
#include "nowPlaying.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QFileInfo>
|
||||
#include <QCloseEvent>
|
||||
#include "src/data/cleanerScripts.h"
|
||||
|
||||
PlayerWindow::PlayerWindow(const AlbumData& item, QWidget* parent)
|
||||
NowPlaying::NowPlaying(const AlbumData& item, QWidget* parent)
|
||||
: QWidget(parent), item_(item)
|
||||
{
|
||||
setWindowTitle("Now Playing");
|
||||
@@ -91,7 +91,7 @@ PlayerWindow::PlayerWindow(const AlbumData& item, QWidget* parent)
|
||||
playTrack(index_);
|
||||
}
|
||||
|
||||
void PlayerWindow::playTrack(int idx)
|
||||
void NowPlaying::playTrack(int idx)
|
||||
{
|
||||
if (idx < 0 || idx >= item_.audioFiles.size())
|
||||
return;
|
||||
@@ -111,7 +111,7 @@ void PlayerWindow::playTrack(int idx)
|
||||
trackList_->setCurrentRow(idx);
|
||||
}
|
||||
|
||||
void PlayerWindow::handleTrackFinished()
|
||||
void NowPlaying::handleTrackFinished()
|
||||
{
|
||||
int nextIndex = index_ + 1;
|
||||
|
||||
@@ -123,7 +123,7 @@ void PlayerWindow::handleTrackFinished()
|
||||
playTrack(nextIndex);
|
||||
}
|
||||
|
||||
void PlayerWindow::closeEvent(QCloseEvent* event)
|
||||
void NowPlaying::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
if (player_)
|
||||
player_->stop();
|
||||
@@ -1,24 +1,25 @@
|
||||
#ifndef PLAYERWINDOW_H
|
||||
#define PLAYERWINDOW_H
|
||||
#ifndef NOWPLAYING_H
|
||||
#define NOWPLAYING_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLabel>
|
||||
#include <QMediaPlayer>
|
||||
#include <QAudioOutput>
|
||||
#include <QTimer>
|
||||
#include "src/data/albumInformation.h"
|
||||
#include "src/components/spinningalbumart/spinningAlbumArt.h"
|
||||
#include "src/components/tracklistWidget/tracklistwidget.h"
|
||||
#include "src/components/timePlayedWidget/timePlayedWidget.h"
|
||||
|
||||
class PlayerWindow : public QWidget
|
||||
#include "src/data/albumInformation.h"
|
||||
#include "src/components/nowPlaying/spinningAlbumArt/spinningAlbumArt.h"
|
||||
#include "src/components/nowPlaying/tracklistWidget/tracklistWidget.h"
|
||||
#include "src/components/nowPlaying/timePlayedWidget/timePlayedWidget.h"
|
||||
|
||||
class NowPlaying : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
QSlider* volumeSlider_;
|
||||
TimePlayedWidget* timeIndicator_;
|
||||
|
||||
public:
|
||||
explicit PlayerWindow(const AlbumData& item, QWidget* parent = nullptr);
|
||||
explicit NowPlaying(const AlbumData& item, QWidget* parent = nullptr);
|
||||
void setCurrentRow(int row);
|
||||
|
||||
protected:
|
||||
Reference in New Issue
Block a user