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_MIXER_LIBRARY}
|
||||
PkgConfig::LIBAV
|
||||
fmt
|
||||
)
|
||||
|
||||
install(TARGETS CryliaPlayer
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
PageNavModule::PageNavModule(QWidget* parent) :
|
||||
QFrame(parent),
|
||||
home(new PageNavigator(new HomePage( ), "Home", ":icons/home-outline.svg", "#81D4FA")),
|
||||
localFiles(new PageNavigator(new LocalFolderPage( ), "Local Files", ":icons/folder-outline.svg", "#FFE082")),
|
||||
playlist(new PageNavigator(new PlaylistPage( ), "Playlist", ":icons/magnify.svg", "#CE93D8")),
|
||||
settings(new PageNavigator(new SettingsPage( ), "Settings", ":icons/magnify.svg", "#C5E1A5")) {
|
||||
home(new PageButton(QString("Home"), QString("#81D4FA"), QString(":icons/home-outline.svg"), new HomePage( ), this)),
|
||||
localFiles(new PageButton("Local Files", QString("#FFE082"), QString(":icons/folder-outline.svg"), new LocalFolderPage( ), this)),
|
||||
playlist(new PageButton("Playlist", QString("#CE93D8"), QString(":icons/magnify.svg"), new PlaylistPage( ), this)),
|
||||
settings(new PageButton("Settings", QString("#C5E1A5"), QString(":icons/magnify.svg"), new SettingsPage( ), this)) {
|
||||
|
||||
this->setStyleSheet(R"(
|
||||
background-color: #282828;
|
||||
@@ -23,35 +23,35 @@ PageNavModule::PageNavModule(QWidget* parent) :
|
||||
layout->addWidget(localFiles);
|
||||
layout->addWidget(playlist);
|
||||
|
||||
home->select( );
|
||||
home->Select( );
|
||||
|
||||
PageManager& pageManager = PageManager::getInstance( );
|
||||
connect(home, &PageNavigator::SelectedChanged, [&pageManager, this](Page* page) {
|
||||
home->select( );
|
||||
localFiles->unselect( );
|
||||
playlist->unselect( );
|
||||
settings->unselect( );
|
||||
connect(home, &NavButton::SelectedChanged, [&pageManager, this](Page* page) {
|
||||
home->Select( );
|
||||
localFiles->Unselect( );
|
||||
playlist->Unselect( );
|
||||
settings->Unselect( );
|
||||
emit pageManager.ActivePageChanged(page);
|
||||
});
|
||||
connect(localFiles, &PageNavigator::SelectedChanged, [&pageManager, this](Page* page) {
|
||||
home->unselect( );
|
||||
localFiles->select( );
|
||||
playlist->unselect( );
|
||||
settings->unselect( );
|
||||
connect(localFiles, &NavButton::SelectedChanged, [&pageManager, this](Page* page) {
|
||||
home->Unselect( );
|
||||
localFiles->Select( );
|
||||
playlist->Unselect( );
|
||||
settings->Unselect( );
|
||||
emit pageManager.ActivePageChanged(page);
|
||||
});
|
||||
connect(playlist, &PageNavigator::SelectedChanged, [&pageManager, this](Page* page) {
|
||||
home->unselect( );
|
||||
localFiles->unselect( );
|
||||
playlist->select( );
|
||||
settings->unselect( );
|
||||
connect(playlist, &NavButton::SelectedChanged, [&pageManager, this](Page* page) {
|
||||
home->Unselect( );
|
||||
localFiles->Unselect( );
|
||||
playlist->Select( );
|
||||
settings->Unselect( );
|
||||
emit pageManager.ActivePageChanged(page);
|
||||
});
|
||||
connect(settings, &PageNavigator::SelectedChanged, [&pageManager, this](Page* page) {
|
||||
home->unselect( );
|
||||
localFiles->unselect( );
|
||||
playlist->unselect( );
|
||||
settings->select( );
|
||||
connect(settings, &NavButton::SelectedChanged, [&pageManager, this](Page* page) {
|
||||
home->Unselect( );
|
||||
localFiles->Unselect( );
|
||||
playlist->Unselect( );
|
||||
settings->Select( );
|
||||
emit pageManager.ActivePageChanged(page);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
#include <QVector>
|
||||
#include <QFrame>
|
||||
#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 "../../Pages/Home/HomePage.h"
|
||||
#include "../../Pages/Playlist/PlaylistPage.h"
|
||||
@@ -16,12 +18,12 @@
|
||||
class PageNavModule : public QFrame {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QVector<PageNavigator*>* pages;
|
||||
QVector<NavButton*>* pages;
|
||||
|
||||
PageNavigator* home;
|
||||
PageNavigator* localFiles;
|
||||
PageNavigator* playlist;
|
||||
PageNavigator* settings;
|
||||
NavButton* home;
|
||||
NavButton* localFiles;
|
||||
NavButton* playlist;
|
||||
NavButton* settings;
|
||||
|
||||
public:
|
||||
PageNavModule(QWidget* parent = nullptr);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
HomePage::HomePage(QWidget* parent) : Page(parent) {
|
||||
|
||||
setStyleSheet(R"(
|
||||
background-color: #28FF28;
|
||||
background-color: #282828;
|
||||
border-radius: 12px;
|
||||
)");
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
LocalFolderPage::LocalFolderPage(QWidget* parent) : Page(parent) {
|
||||
|
||||
setStyleSheet(R"(
|
||||
background-color: #FF2828;
|
||||
background-color: #282828;
|
||||
border-radius: 12px;
|
||||
)");
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
PlaylistPage::PlaylistPage(QWidget* parent) :Page(parent) {
|
||||
|
||||
setStyleSheet(R"(
|
||||
background-color: #2828ff;
|
||||
background-color: #282828;
|
||||
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 <iostream>
|
||||
#include "NavButton.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);
|
||||
}
|
||||
};
|
||||
|
||||
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);
|
||||
void NavButton::setupButton( ) {
|
||||
QSvgRenderer renderer(iconPath);
|
||||
|
||||
QPixmap pixmap(32, 32);
|
||||
pixmap.fill(Qt::transparent);
|
||||
@@ -30,10 +17,10 @@ PageNavigator::PageNavigator(Page* page, QString text, QString icon, QString col
|
||||
m_icon->setObjectName("icon");
|
||||
m_text->setObjectName("Text");
|
||||
|
||||
setObjectName("PageNavigator");
|
||||
setObjectName("NavButton");
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
setStyleSheet(R"(
|
||||
#PageNavigator{
|
||||
#NavButton{
|
||||
border: 4px solid #414141;
|
||||
border-radius: 6px;
|
||||
}
|
||||
@@ -60,30 +47,15 @@ PageNavigator::PageNavigator(Page* page, QString text, QString icon, QString col
|
||||
|
||||
}
|
||||
|
||||
void PageNavigator::unselect( ) {
|
||||
setStyleSheet(R"(
|
||||
#PageNavigator{
|
||||
border: 4px solid #414141;
|
||||
border-radius: 6px;
|
||||
}
|
||||
#Text{
|
||||
color: #E0E0E0;
|
||||
}
|
||||
)");
|
||||
NavButton::NavButton(QString text, QString color, QString icon_path, Page* page, QWidget* parent = nullptr) :
|
||||
QPushButton(parent),
|
||||
m_text(new QLabel(text)),
|
||||
m_color(new QString(color)),
|
||||
m_icon(new SquareIcon( )),
|
||||
page(page),
|
||||
iconPath(icon_path),
|
||||
color(color) {
|
||||
setupButton( );
|
||||
}
|
||||
|
||||
void PageNavigator::select( ) {
|
||||
setStyleSheet(R"(
|
||||
#PageNavigator{
|
||||
border: 4px solid )" + m_color + R"(;
|
||||
border-radius: 6px;
|
||||
}
|
||||
#Text{
|
||||
color: #E0E0E0;
|
||||
}
|
||||
)");
|
||||
}
|
||||
|
||||
QString PageNavigator::GetText( ) {
|
||||
return m_text->text( );
|
||||
}
|
||||
NavButton::~NavButton( ) { }
|
||||
@@ -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 <QApplication>
|
||||
#include <iostream>
|
||||
#include <fmt/core.h>
|
||||
|
||||
bool CheckValidFile(std::filesystem::path path) {
|
||||
//Allow to start with a song
|
||||
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;
|
||||
}
|
||||
std::string extension = path.extension( ).string( );
|
||||
|
||||
Reference in New Issue
Block a user