redid the navbuttons to also work for playlists and added fmt lib
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -60,6 +60,7 @@ target_link_libraries(CryliaPlayer PRIVATE
|
|||||||
${SDL_LIBRARIES}
|
${SDL_LIBRARIES}
|
||||||
${SDL_MIXER_LIBRARY}
|
${SDL_MIXER_LIBRARY}
|
||||||
PkgConfig::LIBAV
|
PkgConfig::LIBAV
|
||||||
|
fmt
|
||||||
)
|
)
|
||||||
|
|
||||||
install(TARGETS CryliaPlayer
|
install(TARGETS CryliaPlayer
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
PageNavModule::PageNavModule(QWidget* parent) :
|
PageNavModule::PageNavModule(QWidget* parent) :
|
||||||
QFrame(parent),
|
QFrame(parent),
|
||||||
home(new PageNavigator(new HomePage( ), "Home", ":icons/home-outline.svg", "#81D4FA")),
|
home(new PageButton(QString("Home"), QString("#81D4FA"), QString(":icons/home-outline.svg"), new HomePage( ), this)),
|
||||||
localFiles(new PageNavigator(new LocalFolderPage( ), "Local Files", ":icons/folder-outline.svg", "#FFE082")),
|
localFiles(new PageButton("Local Files", QString("#FFE082"), QString(":icons/folder-outline.svg"), new LocalFolderPage( ), this)),
|
||||||
playlist(new PageNavigator(new PlaylistPage( ), "Playlist", ":icons/magnify.svg", "#CE93D8")),
|
playlist(new PageButton("Playlist", QString("#CE93D8"), QString(":icons/magnify.svg"), new PlaylistPage( ), this)),
|
||||||
settings(new PageNavigator(new SettingsPage( ), "Settings", ":icons/magnify.svg", "#C5E1A5")) {
|
settings(new PageButton("Settings", QString("#C5E1A5"), QString(":icons/magnify.svg"), new SettingsPage( ), this)) {
|
||||||
|
|
||||||
this->setStyleSheet(R"(
|
this->setStyleSheet(R"(
|
||||||
background-color: #282828;
|
background-color: #282828;
|
||||||
@@ -23,35 +23,35 @@ PageNavModule::PageNavModule(QWidget* parent) :
|
|||||||
layout->addWidget(localFiles);
|
layout->addWidget(localFiles);
|
||||||
layout->addWidget(playlist);
|
layout->addWidget(playlist);
|
||||||
|
|
||||||
home->select( );
|
home->Select( );
|
||||||
|
|
||||||
PageManager& pageManager = PageManager::getInstance( );
|
PageManager& pageManager = PageManager::getInstance( );
|
||||||
connect(home, &PageNavigator::SelectedChanged, [&pageManager, this](Page* page) {
|
connect(home, &NavButton::SelectedChanged, [&pageManager, this](Page* page) {
|
||||||
home->select( );
|
home->Select( );
|
||||||
localFiles->unselect( );
|
localFiles->Unselect( );
|
||||||
playlist->unselect( );
|
playlist->Unselect( );
|
||||||
settings->unselect( );
|
settings->Unselect( );
|
||||||
emit pageManager.ActivePageChanged(page);
|
emit pageManager.ActivePageChanged(page);
|
||||||
});
|
});
|
||||||
connect(localFiles, &PageNavigator::SelectedChanged, [&pageManager, this](Page* page) {
|
connect(localFiles, &NavButton::SelectedChanged, [&pageManager, this](Page* page) {
|
||||||
home->unselect( );
|
home->Unselect( );
|
||||||
localFiles->select( );
|
localFiles->Select( );
|
||||||
playlist->unselect( );
|
playlist->Unselect( );
|
||||||
settings->unselect( );
|
settings->Unselect( );
|
||||||
emit pageManager.ActivePageChanged(page);
|
emit pageManager.ActivePageChanged(page);
|
||||||
});
|
});
|
||||||
connect(playlist, &PageNavigator::SelectedChanged, [&pageManager, this](Page* page) {
|
connect(playlist, &NavButton::SelectedChanged, [&pageManager, this](Page* page) {
|
||||||
home->unselect( );
|
home->Unselect( );
|
||||||
localFiles->unselect( );
|
localFiles->Unselect( );
|
||||||
playlist->select( );
|
playlist->Select( );
|
||||||
settings->unselect( );
|
settings->Unselect( );
|
||||||
emit pageManager.ActivePageChanged(page);
|
emit pageManager.ActivePageChanged(page);
|
||||||
});
|
});
|
||||||
connect(settings, &PageNavigator::SelectedChanged, [&pageManager, this](Page* page) {
|
connect(settings, &NavButton::SelectedChanged, [&pageManager, this](Page* page) {
|
||||||
home->unselect( );
|
home->Unselect( );
|
||||||
localFiles->unselect( );
|
localFiles->Unselect( );
|
||||||
playlist->unselect( );
|
playlist->Unselect( );
|
||||||
settings->select( );
|
settings->Select( );
|
||||||
emit pageManager.ActivePageChanged(page);
|
emit pageManager.ActivePageChanged(page);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,10 @@
|
|||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
#include <QSizePolicy>
|
#include <QSizePolicy>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#include "../../Widgets/PageNavigator/PageNavigator.h"
|
#include "../../Widgets/NavigatorButton/NavButton.h"
|
||||||
|
#include "../../Widgets/NavigatorButton/PageButton/PageButton.h"
|
||||||
#include "../../Tools/SvgToPixmap.hpp"
|
#include "../../Tools/SvgToPixmap.hpp"
|
||||||
#include "../../Pages/Home/HomePage.h"
|
#include "../../Pages/Home/HomePage.h"
|
||||||
#include "../../Pages/Playlist/PlaylistPage.h"
|
#include "../../Pages/Playlist/PlaylistPage.h"
|
||||||
@@ -16,12 +18,12 @@
|
|||||||
class PageNavModule : public QFrame {
|
class PageNavModule : public QFrame {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
QVector<PageNavigator*>* pages;
|
QVector<NavButton*>* pages;
|
||||||
|
|
||||||
PageNavigator* home;
|
NavButton* home;
|
||||||
PageNavigator* localFiles;
|
NavButton* localFiles;
|
||||||
PageNavigator* playlist;
|
NavButton* playlist;
|
||||||
PageNavigator* settings;
|
NavButton* settings;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageNavModule(QWidget* parent = nullptr);
|
PageNavModule(QWidget* parent = nullptr);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
HomePage::HomePage(QWidget* parent) : Page(parent) {
|
HomePage::HomePage(QWidget* parent) : Page(parent) {
|
||||||
|
|
||||||
setStyleSheet(R"(
|
setStyleSheet(R"(
|
||||||
background-color: #28FF28;
|
background-color: #282828;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
)");
|
)");
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
LocalFolderPage::LocalFolderPage(QWidget* parent) : Page(parent) {
|
LocalFolderPage::LocalFolderPage(QWidget* parent) : Page(parent) {
|
||||||
|
|
||||||
setStyleSheet(R"(
|
setStyleSheet(R"(
|
||||||
background-color: #FF2828;
|
background-color: #282828;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
)");
|
)");
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
PlaylistPage::PlaylistPage(QWidget* parent) :Page(parent) {
|
PlaylistPage::PlaylistPage(QWidget* parent) :Page(parent) {
|
||||||
|
|
||||||
setStyleSheet(R"(
|
setStyleSheet(R"(
|
||||||
background-color: #2828ff;
|
background-color: #282828;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
)");
|
)");
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
#include "NavigationButton.h"
|
|
||||||
|
|
||||||
NavigationButton::NavigationButton( ) { }
|
|
||||||
|
|
||||||
NavigationButton::~NavigationButton( ) { }
|
|
||||||
|
|
||||||
void setSelected(NavigationButton* newSelected);
|
|
||||||
NavigationButton getSelected( ) { }
|
|
||||||
|
|
||||||
void NavigationButton::select( ) { }
|
|
||||||
void NavigationButton::unselect( ) { }
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
class NavigationButton : public QPushButton {
|
|
||||||
Q_OBJECT
|
|
||||||
private:
|
|
||||||
QLabel* m_icon;
|
|
||||||
QLabel* m_name;
|
|
||||||
QString* m_colorHex;
|
|
||||||
|
|
||||||
static NavigationButton* m_selected;
|
|
||||||
|
|
||||||
public:
|
|
||||||
static void setSelected(NavigationButton* newSelected);
|
|
||||||
static NavigationButton* getSelected( );
|
|
||||||
|
|
||||||
NavigationButton( );
|
|
||||||
~NavigationButton( );
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void unselected( );
|
|
||||||
void selected( );
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void select( );
|
|
||||||
void unselect( );
|
|
||||||
|
|
||||||
};
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#include "PagesButton.h"
|
|
||||||
|
|
||||||
PagesButton::PagesButton( ) { }
|
|
||||||
PagesButton::~PagesButton( ) { }
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "../NavigationButton.h"
|
|
||||||
|
|
||||||
class PagesButton : NavigationButton {
|
|
||||||
private:
|
|
||||||
|
|
||||||
public:
|
|
||||||
PagesButton( );
|
|
||||||
~PagesButton( );
|
|
||||||
};
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#include "PlaylistButton.h"
|
|
||||||
|
|
||||||
PlaylistButton::PlaylistButton( ) { }
|
|
||||||
PlaylistButton::~PlaylistButton( ) { }
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "../NavigationButton.h"
|
|
||||||
|
|
||||||
class PlaylistButton : NavigationButton {
|
|
||||||
private:
|
|
||||||
|
|
||||||
public:
|
|
||||||
PlaylistButton( );
|
|
||||||
~PlaylistButton( );
|
|
||||||
};
|
|
||||||
+15
-43
@@ -1,20 +1,7 @@
|
|||||||
#include "PageNavigator.h"
|
#include "NavButton.h"
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
class SquareIcon : public QLabel {
|
void NavButton::setupButton( ) {
|
||||||
public:
|
QSvgRenderer renderer(iconPath);
|
||||||
QSize sizeHint( ) const override {
|
|
||||||
QSize hint = QLabel::sizeHint( );
|
|
||||||
int side = qMin(hint.width( ), hint.height( ));
|
|
||||||
return QSize(side, side);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
PageNavigator::PageNavigator(Page* page, QString text, QString icon, QString color, QWidget* parent)
|
|
||||||
:page(page), m_text(new QLabel(text)), m_icon(new SquareIcon( )), m_color(color), m_iconPath(icon) {
|
|
||||||
|
|
||||||
|
|
||||||
QSvgRenderer renderer(icon);
|
|
||||||
|
|
||||||
QPixmap pixmap(32, 32);
|
QPixmap pixmap(32, 32);
|
||||||
pixmap.fill(Qt::transparent);
|
pixmap.fill(Qt::transparent);
|
||||||
@@ -30,10 +17,10 @@ PageNavigator::PageNavigator(Page* page, QString text, QString icon, QString col
|
|||||||
m_icon->setObjectName("icon");
|
m_icon->setObjectName("icon");
|
||||||
m_text->setObjectName("Text");
|
m_text->setObjectName("Text");
|
||||||
|
|
||||||
setObjectName("PageNavigator");
|
setObjectName("NavButton");
|
||||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
setStyleSheet(R"(
|
setStyleSheet(R"(
|
||||||
#PageNavigator{
|
#NavButton{
|
||||||
border: 4px solid #414141;
|
border: 4px solid #414141;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
@@ -60,30 +47,15 @@ PageNavigator::PageNavigator(Page* page, QString text, QString icon, QString col
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PageNavigator::unselect( ) {
|
NavButton::NavButton(QString text, QString color, QString icon_path, Page* page, QWidget* parent = nullptr) :
|
||||||
setStyleSheet(R"(
|
QPushButton(parent),
|
||||||
#PageNavigator{
|
m_text(new QLabel(text)),
|
||||||
border: 4px solid #414141;
|
m_color(new QString(color)),
|
||||||
border-radius: 6px;
|
m_icon(new SquareIcon( )),
|
||||||
}
|
page(page),
|
||||||
#Text{
|
iconPath(icon_path),
|
||||||
color: #E0E0E0;
|
color(color) {
|
||||||
}
|
setupButton( );
|
||||||
)");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PageNavigator::select( ) {
|
NavButton::~NavButton( ) { }
|
||||||
setStyleSheet(R"(
|
|
||||||
#PageNavigator{
|
|
||||||
border: 4px solid )" + m_color + R"(;
|
|
||||||
border-radius: 6px;
|
|
||||||
}
|
|
||||||
#Text{
|
|
||||||
color: #E0E0E0;
|
|
||||||
}
|
|
||||||
)");
|
|
||||||
}
|
|
||||||
|
|
||||||
QString PageNavigator::GetText( ) {
|
|
||||||
return m_text->text( );
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QString>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QColor>
|
||||||
|
#include <QSvgRenderer>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
|
||||||
|
#include "../../../View/Pages/Page.h"
|
||||||
|
|
||||||
|
class SquareIcon : public QLabel {
|
||||||
|
public:
|
||||||
|
QSize sizeHint( ) const override {
|
||||||
|
QSize hint = QLabel::sizeHint( );
|
||||||
|
int side = qMin(hint.width( ), hint.height( ));
|
||||||
|
return QSize(side, side);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class NavButton : public QPushButton {
|
||||||
|
Q_OBJECT
|
||||||
|
protected:
|
||||||
|
QLabel* m_text;
|
||||||
|
SquareIcon* m_icon;
|
||||||
|
QString* m_color;
|
||||||
|
|
||||||
|
Page* page;
|
||||||
|
|
||||||
|
QString iconPath;
|
||||||
|
QString color;
|
||||||
|
private:
|
||||||
|
void setupButton( );
|
||||||
|
public:
|
||||||
|
NavButton(QString, QString, QString, Page*, QWidget*);
|
||||||
|
NavButton(QString, QString, QPixmap, Page*, QWidget*);
|
||||||
|
~NavButton( );
|
||||||
|
|
||||||
|
void SetText(QString newText) { m_text->setText(newText); }
|
||||||
|
QString GetText( ) { return m_text->text( ); }
|
||||||
|
|
||||||
|
virtual void Select( ) = 0;
|
||||||
|
virtual void Unselect( ) = 0;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void SelectedChanged(Page* page);
|
||||||
|
};
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
#include "PageButton.h"
|
||||||
|
|
||||||
|
PageButton::PageButton(QString text, QString color, QString path, Page* page, QWidget* parent = nullptr) :
|
||||||
|
NavButton(text, color, path, page, parent) { }
|
||||||
|
|
||||||
|
PageButton::~PageButton( ) { }
|
||||||
|
|
||||||
|
|
||||||
|
void PageButton::Select( ) {
|
||||||
|
setStyleSheet(R"(
|
||||||
|
#NavButton{
|
||||||
|
border: 4px solid )" + color + R"(;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
#Text{
|
||||||
|
color: #E0E0E0;
|
||||||
|
}
|
||||||
|
)");
|
||||||
|
}
|
||||||
|
|
||||||
|
void PageButton::Unselect( ) {
|
||||||
|
setStyleSheet(R"(
|
||||||
|
#NavButton{
|
||||||
|
border: 4px solid #414141;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
#Text{
|
||||||
|
color: #E0E0E0;
|
||||||
|
}
|
||||||
|
)");
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "../NavButton.h"
|
||||||
|
|
||||||
|
class PageButton : public NavButton {
|
||||||
|
|
||||||
|
public:
|
||||||
|
PageButton(QString, QString, QString, Page*, QWidget*);
|
||||||
|
PageButton(QString, QString, QPixmap, Page*, QWidget*);
|
||||||
|
~PageButton( );
|
||||||
|
|
||||||
|
void Select( );
|
||||||
|
void Unselect( );
|
||||||
|
};
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
#include "PlaylistButton.h"
|
||||||
|
|
||||||
|
void PlaylistButton::Select( ) {
|
||||||
|
setStyleSheet(R"(
|
||||||
|
#NavButton{
|
||||||
|
border: 4px solid )" + color + R"(;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
#Text{
|
||||||
|
color: #E0E0E0;
|
||||||
|
}
|
||||||
|
)");
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlaylistButton::Unselect( ) {
|
||||||
|
setStyleSheet(R"(
|
||||||
|
#NavButton{
|
||||||
|
border: 4px solid #414141;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
#Text{
|
||||||
|
color: #E0E0E0;
|
||||||
|
}
|
||||||
|
)");
|
||||||
|
}
|
||||||
|
|
||||||
|
PlaylistButton::PlaylistButton(QString text, QString color, QString path, Page* page, QWidget* parent = nullptr) :
|
||||||
|
NavButton(text, color, path, page, parent) { }
|
||||||
|
|
||||||
|
PlaylistButton::~PlaylistButton( ) { }
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "../NavButton.h"
|
||||||
|
|
||||||
|
class PlaylistButton : public NavButton {
|
||||||
|
private:
|
||||||
|
//!Add Associated Playlist
|
||||||
|
public:
|
||||||
|
PlaylistButton(QString, QString, QString, Page*, QWidget*);
|
||||||
|
PlaylistButton(QString, QString, QPixmap, Page*, QWidget*);
|
||||||
|
~PlaylistButton( );
|
||||||
|
|
||||||
|
void Select( );
|
||||||
|
void Unselect( );
|
||||||
|
};
|
||||||
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QLayout>
|
|
||||||
#include <QFont>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QColor>
|
|
||||||
#include <QGraphicsColorizeEffect>
|
|
||||||
|
|
||||||
#include "../../Tools/SvgToPixmap.hpp"
|
|
||||||
#include "../../Pages/Page.h"
|
|
||||||
|
|
||||||
class PageNavigator :public QPushButton {
|
|
||||||
Q_OBJECT
|
|
||||||
private:
|
|
||||||
QLabel* m_text;
|
|
||||||
QLabel* m_icon;
|
|
||||||
QString m_iconPath;
|
|
||||||
QString m_color;
|
|
||||||
Page* page;
|
|
||||||
|
|
||||||
public:
|
|
||||||
PageNavigator(Page* page, QString text, QString icon, QString color, QWidget* parent = nullptr);
|
|
||||||
|
|
||||||
void unselect( );
|
|
||||||
void select( );
|
|
||||||
|
|
||||||
QString GetText( );
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void SelectedChanged(Page* page);
|
|
||||||
};
|
|
||||||
+2
-1
@@ -3,11 +3,12 @@
|
|||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <fmt/core.h>
|
||||||
|
|
||||||
bool CheckValidFile(std::filesystem::path path) {
|
bool CheckValidFile(std::filesystem::path path) {
|
||||||
//Allow to start with a song
|
//Allow to start with a song
|
||||||
if (!std::filesystem::exists(path) || !std::filesystem::is_regular_file(path)) {
|
if (!std::filesystem::exists(path) || !std::filesystem::is_regular_file(path)) {
|
||||||
std::cerr << "ERROR: Path or file doesn't exist / is valid" << std::endl;
|
fmt::print("ERROR: Path or file doesn't exist / is valid");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::string extension = path.extension( ).string( );
|
std::string extension = path.extension( ).string( );
|
||||||
|
|||||||
Reference in New Issue
Block a user