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.
BIN
.cache/clangd/index/DatabaseManager.cpp.A503032B25B9DAAF.idx
Normal file
BIN
.cache/clangd/index/DatabaseManager.cpp.A503032B25B9DAAF.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/DatabaseManager.h.23E39B73DE500DF4.idx
Normal file
BIN
.cache/clangd/index/DatabaseManager.h.23E39B73DE500DF4.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/FloatingControls.cpp.9D6FC09D4D6F0FCF.idx
Normal file
BIN
.cache/clangd/index/FloatingControls.cpp.9D6FC09D4D6F0FCF.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/FloatingControls.h.D700FFEBDCCA4F1D.idx
Normal file
BIN
.cache/clangd/index/FloatingControls.h.D700FFEBDCCA4F1D.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/HomePage.cpp.9F3A1A2E76067ACC.idx
Normal file
BIN
.cache/clangd/index/HomePage.cpp.9F3A1A2E76067ACC.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/HomePage.h.CF8699CD8CEC90BC.idx
Normal file
BIN
.cache/clangd/index/HomePage.h.CF8699CD8CEC90BC.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/LocalFolderPage.cpp.54733FBF83D2A274.idx
Normal file
BIN
.cache/clangd/index/LocalFolderPage.cpp.54733FBF83D2A274.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/LocalFolderPage.h.D9CD5A943852BAF0.idx
Normal file
BIN
.cache/clangd/index/LocalFolderPage.h.D9CD5A943852BAF0.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/MainWidget.cpp.5DFC36EBDED209E4.idx
Normal file
BIN
.cache/clangd/index/MainWidget.cpp.5DFC36EBDED209E4.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/MainWidget.h.9D6875C73901EEB4.idx
Normal file
BIN
.cache/clangd/index/MainWidget.h.9D6875C73901EEB4.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/MainWindow.cpp.6F03657BD43A954A.idx
Normal file
BIN
.cache/clangd/index/MainWindow.cpp.6F03657BD43A954A.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/MainWindow.h.86D281384F92517D.idx
Normal file
BIN
.cache/clangd/index/MainWindow.h.86D281384F92517D.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/MusicPlayer.cpp.35246BE0F9B744D8.idx
Normal file
BIN
.cache/clangd/index/MusicPlayer.cpp.35246BE0F9B744D8.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/MusicPlayer.h.55673DB92FB3CBAC.idx
Normal file
BIN
.cache/clangd/index/MusicPlayer.h.55673DB92FB3CBAC.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/NavButton.cpp.232950D13D6E2515.idx
Normal file
BIN
.cache/clangd/index/NavButton.cpp.232950D13D6E2515.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/NavButton.h.B2661538EA8CB03C.idx
Normal file
BIN
.cache/clangd/index/NavButton.h.B2661538EA8CB03C.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/Page.h.7236B7411CB0711C.idx
Normal file
BIN
.cache/clangd/index/Page.h.7236B7411CB0711C.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/PageButton.cpp.BCA2460698AE4C50.idx
Normal file
BIN
.cache/clangd/index/PageButton.cpp.BCA2460698AE4C50.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/PageButton.h.511EB232CEA388B7.idx
Normal file
BIN
.cache/clangd/index/PageButton.h.511EB232CEA388B7.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/PageManager.cpp.1B1901F3F7E349D2.idx
Normal file
BIN
.cache/clangd/index/PageManager.cpp.1B1901F3F7E349D2.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/PageManager.h.540F872042D01058.idx
Normal file
BIN
.cache/clangd/index/PageManager.h.540F872042D01058.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/PageNavModule.cpp.B8A5436AE1D26BC0.idx
Normal file
BIN
.cache/clangd/index/PageNavModule.cpp.B8A5436AE1D26BC0.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/PageNavModule.h.A94ED7D15479146B.idx
Normal file
BIN
.cache/clangd/index/PageNavModule.h.A94ED7D15479146B.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/PlaylistButton.cpp.D5C68B99FD7FDD82.idx
Normal file
BIN
.cache/clangd/index/PlaylistButton.cpp.D5C68B99FD7FDD82.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/PlaylistButton.h.9600C49697E3BC79.idx
Normal file
BIN
.cache/clangd/index/PlaylistButton.h.9600C49697E3BC79.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/PlaylistNavModule.cpp.974D2EF27CEAA00B.idx
Normal file
BIN
.cache/clangd/index/PlaylistNavModule.cpp.974D2EF27CEAA00B.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/PlaylistNavModule.h.73386ED7039B9D14.idx
Normal file
BIN
.cache/clangd/index/PlaylistNavModule.h.73386ED7039B9D14.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/PlaylistPage.cpp.C16327D31185E2F1.idx
Normal file
BIN
.cache/clangd/index/PlaylistPage.cpp.C16327D31185E2F1.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/PlaylistPage.h.3202C9FD0097ABBA.idx
Normal file
BIN
.cache/clangd/index/PlaylistPage.h.3202C9FD0097ABBA.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/QOverlayout.cpp.B4E1724C37909521.idx
Normal file
BIN
.cache/clangd/index/QOverlayout.cpp.B4E1724C37909521.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/QOverlayout.h.35ABCC70DC986F47.idx
Normal file
BIN
.cache/clangd/index/QOverlayout.h.35ABCC70DC986F47.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/SettingsPage.cpp.0F7B559628C24FAD.idx
Normal file
BIN
.cache/clangd/index/SettingsPage.cpp.0F7B559628C24FAD.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/SettingsPage.h.4C6A7DAE17AA1AE9.idx
Normal file
BIN
.cache/clangd/index/SettingsPage.h.4C6A7DAE17AA1AE9.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/SongHistory.hpp.46F986F57DCF6132.idx
Normal file
BIN
.cache/clangd/index/SongHistory.hpp.46F986F57DCF6132.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/SongQueue.cpp.E3B5F5C8C8F97897.idx
Normal file
BIN
.cache/clangd/index/SongQueue.cpp.E3B5F5C8C8F97897.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/SongQueue.h.E8386E8A98EC7134.idx
Normal file
BIN
.cache/clangd/index/SongQueue.h.E8386E8A98EC7134.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/SvgToPixmap.hpp.26FC7AEAAFB57F5A.idx
Normal file
BIN
.cache/clangd/index/SvgToPixmap.hpp.26FC7AEAAFB57F5A.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/audio.cpp.D0B3798878719D8D.idx
Normal file
BIN
.cache/clangd/index/audio.cpp.D0B3798878719D8D.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/audio.h.F9F96F778B99E274.idx
Normal file
BIN
.cache/clangd/index/audio.h.F9F96F778B99E274.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/main.cpp.6CC56DDB3575B3B3.idx
Normal file
BIN
.cache/clangd/index/main.cpp.6CC56DDB3575B3B3.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/song.cpp.0710647CC76D17C2.idx
Normal file
BIN
.cache/clangd/index/song.cpp.0710647CC76D17C2.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/song.h.B99CA1C6DB8FDD85.idx
Normal file
BIN
.cache/clangd/index/song.h.B99CA1C6DB8FDD85.idx
Normal file
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( );
|
|
||||||
};
|
|
||||||
@@ -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( );
|
|
||||||
}
|
|
||||||
48
src/View/Widgets/NavigatorButton/NavButton.h
Normal file
48
src/View/Widgets/NavigatorButton/NavButton.h
Normal file
@@ -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);
|
||||||
|
};
|
||||||
31
src/View/Widgets/NavigatorButton/PageButton/PageButton.cpp
Normal file
31
src/View/Widgets/NavigatorButton/PageButton/PageButton.cpp
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
)");
|
||||||
|
}
|
||||||
15
src/View/Widgets/NavigatorButton/PageButton/PageButton.h
Normal file
15
src/View/Widgets/NavigatorButton/PageButton/PageButton.h
Normal file
@@ -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);
|
|
||||||
};
|
|
||||||
@@ -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