Skip to content

Commit

Permalink
fix compile errors
Browse files Browse the repository at this point in the history
Crylia committed May 8, 2024
1 parent 62b596e commit 9a1b856
Showing 155 changed files with 668 additions and 83,354 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified .cache/clangd/index/FloatingControls.cpp.9D6FC09D4D6F0FCF.idx
Binary file not shown.
Binary file modified .cache/clangd/index/FloatingControls.h.D700FFEBDCCA4F1D.idx
Binary file not shown.
Binary file modified .cache/clangd/index/HomePage.cpp.9F3A1A2E76067ACC.idx
Binary file not shown.
Binary file modified .cache/clangd/index/HomePage.h.CF8699CD8CEC90BC.idx
Binary file not shown.
Binary file modified .cache/clangd/index/LocalFolderPage.cpp.54733FBF83D2A274.idx
Binary file not shown.
Binary file modified .cache/clangd/index/LocalFolderPage.h.D9CD5A943852BAF0.idx
Binary file not shown.
Binary file modified .cache/clangd/index/MainWidget.cpp.5DFC36EBDED209E4.idx
Binary file not shown.
Binary file modified .cache/clangd/index/MainWidget.h.9D6875C73901EEB4.idx
Binary file not shown.
Binary file modified .cache/clangd/index/MainWindow.cpp.6F03657BD43A954A.idx
Binary file not shown.
Binary file not shown.
Binary file modified .cache/clangd/index/MusicPlayer.cpp.35246BE0F9B744D8.idx
Binary file not shown.
Binary file not shown.
Binary file modified .cache/clangd/index/NavButton.cpp.232950D13D6E2515.idx
Binary file not shown.
Binary file modified .cache/clangd/index/NavButton.h.B2661538EA8CB03C.idx
Binary file not shown.
Binary file modified .cache/clangd/index/PageButton.cpp.BCA2460698AE4C50.idx
Binary file not shown.
Binary file modified .cache/clangd/index/PageManager.cpp.1B1901F3F7E349D2.idx
Binary file not shown.
Binary file modified .cache/clangd/index/PageManager.h.540F872042D01058.idx
Binary file not shown.
Binary file modified .cache/clangd/index/PageNavModule.cpp.B8A5436AE1D26BC0.idx
Binary file not shown.
Binary file modified .cache/clangd/index/PageNavModule.h.A94ED7D15479146B.idx
Binary file not shown.
Binary file modified .cache/clangd/index/PlaylistButton.cpp.D5C68B99FD7FDD82.idx
Binary file not shown.
Binary file modified .cache/clangd/index/PlaylistButton.h.9600C49697E3BC79.idx
Binary file not shown.
Binary file modified .cache/clangd/index/PlaylistNavModule.cpp.974D2EF27CEAA00B.idx
Binary file not shown.
Binary file modified .cache/clangd/index/PlaylistNavModule.h.73386ED7039B9D14.idx
Binary file not shown.
Binary file modified .cache/clangd/index/PlaylistPage.cpp.C16327D31185E2F1.idx
Binary file not shown.
Binary file modified .cache/clangd/index/PlaylistPage.h.3202C9FD0097ABBA.idx
Binary file not shown.
Binary file modified .cache/clangd/index/QOverlayout.cpp.B4E1724C37909521.idx
Binary file not shown.
Binary file modified .cache/clangd/index/QOverlayout.h.35ABCC70DC986F47.idx
Binary file not shown.
Binary file modified .cache/clangd/index/SettingsPage.cpp.0F7B559628C24FAD.idx
Binary file not shown.
Binary file modified .cache/clangd/index/SettingsPage.h.4C6A7DAE17AA1AE9.idx
Binary file not shown.
Binary file modified .cache/clangd/index/SongHistory.hpp.46F986F57DCF6132.idx
Binary file not shown.
Binary file modified .cache/clangd/index/SongQueue.cpp.E3B5F5C8C8F97897.idx
Binary file not shown.
Binary file removed .cache/clangd/index/SongQueue.h.E8386E8A98EC7134.idx
Binary file not shown.
Binary file modified .cache/clangd/index/SvgToPixmap.hpp.26FC7AEAAFB57F5A.idx
Binary file not shown.
Binary file removed .cache/clangd/index/audio.cpp.D0B3798878719D8D.idx
Binary file not shown.
Binary file removed .cache/clangd/index/audio.h.F9F96F778B99E274.idx
Binary file not shown.
Binary file modified .cache/clangd/index/main.cpp.6CC56DDB3575B3B3.idx
Binary file not shown.
Binary file removed .cache/clangd/index/song.cpp.0710647CC76D17C2.idx
Binary file not shown.
Binary file removed .cache/clangd/index/song.h.B99CA1C6DB8FDD85.idx
Binary file not shown.
30 changes: 22 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -9,22 +9,34 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Set compiler flags
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
# For GCC or G++
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
elseif(MSVC)
# For Visual Studio
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Wall")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Wall")
endif()


find_package(QT NAMES Qt6 REQUIRED COMPONENTS Widgets Qml Svg Core Sql)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Qml Svg Core Sql)

find_package(SDL2 QUIET)

if(NOT SDL2_FOUND)
message(STATUS "SDL2 not found. Fallback to SDL3.")
message(STATUS "SDL2 not found. Fallback to SDL3.")

# Find SDL3 package
find_package(SDL3 REQUIRED CONFIG)
set(SDL_INCLUDE_DIRS ${SDL3_INCLUDE_DIRS})
set(SDL_LIBRARIES ${SDL3_LIBRARIES})
# Find SDL3 package
find_package(SDL3 REQUIRED CONFIG)
set(SDL_INCLUDE_DIRS ${SDL3_INCLUDE_DIRS})
set(SDL_LIBRARIES ${SDL3_LIBRARIES})
else()
message(STATUS "SDL2 found.")
set(SDL_INCLUDE_DIRS ${SDL2_INCLUDE_DIRS})
set(SDL_LIBRARIES ${SDL2_LIBRARIES})
message(STATUS "SDL2 found.")
set(SDL_INCLUDE_DIRS ${SDL2_INCLUDE_DIRS})
set(SDL_LIBRARIES ${SDL2_LIBRARIES})
endif()

find_library(SDL_MIXER_LIBRARY NAMES SDL2_mixer SDL3_mixer)
@@ -61,6 +73,8 @@ target_link_libraries(CryliaPlayer PRIVATE
${SDL_MIXER_LIBRARY}
PkgConfig::LIBAV
fmt
stdc++fs
#mavx
)

install(TARGETS CryliaPlayer
70 changes: 0 additions & 70 deletions debug/.qt/QtDeploySupport.cmake

This file was deleted.

1 change: 0 additions & 1 deletion debug/.qt/QtDeployTargets.cmake

This file was deleted.

1,583 changes: 0 additions & 1,583 deletions debug/CMakeCache.txt

This file was deleted.

92 changes: 0 additions & 92 deletions debug/CMakeFiles/3.29.1/CMakeCXXCompiler.cmake

This file was deleted.

Binary file not shown.
15 changes: 0 additions & 15 deletions debug/CMakeFiles/3.29.1/CMakeSystem.cmake

This file was deleted.

878 changes: 0 additions & 878 deletions debug/CMakeFiles/3.29.1/CompilerIdCXX/CMakeCXXCompilerId.cpp

This file was deleted.

Binary file removed debug/CMakeFiles/3.29.1/CompilerIdCXX/a.out
Binary file not shown.
350 changes: 0 additions & 350 deletions debug/CMakeFiles/CMakeConfigureLog.yaml

This file was deleted.

16 changes: 0 additions & 16 deletions debug/CMakeFiles/CMakeDirectoryInformation.cmake

This file was deleted.

4 changes: 0 additions & 4 deletions debug/CMakeFiles/CMakeRuleHashes.txt

This file was deleted.

This file was deleted.

1,096 changes: 0 additions & 1,096 deletions debug/CMakeFiles/CryliaPlayer.dir/CryliaPlayer_autogen/mocs_compilation.cpp.o.d

This file was deleted.

47 changes: 0 additions & 47 deletions debug/CMakeFiles/CryliaPlayer.dir/DependInfo.cmake

This file was deleted.

534 changes: 0 additions & 534 deletions debug/CMakeFiles/CryliaPlayer.dir/build.make

This file was deleted.

63 changes: 0 additions & 63 deletions debug/CMakeFiles/CryliaPlayer.dir/cmake_clean.cmake

This file was deleted.

14,984 changes: 0 additions & 14,984 deletions debug/CMakeFiles/CryliaPlayer.dir/compiler_depend.internal

This file was deleted.

18,933 changes: 0 additions & 18,933 deletions debug/CMakeFiles/CryliaPlayer.dir/compiler_depend.make

This file was deleted.

2 changes: 0 additions & 2 deletions debug/CMakeFiles/CryliaPlayer.dir/compiler_depend.ts

This file was deleted.

2 changes: 0 additions & 2 deletions debug/CMakeFiles/CryliaPlayer.dir/depend.make

This file was deleted.

10 changes: 0 additions & 10 deletions debug/CMakeFiles/CryliaPlayer.dir/flags.make

This file was deleted.

1 change: 0 additions & 1 deletion debug/CMakeFiles/CryliaPlayer.dir/link.txt

This file was deleted.

28 changes: 0 additions & 28 deletions debug/CMakeFiles/CryliaPlayer.dir/progress.make

This file was deleted.

This file was deleted.

This file was deleted.

983 changes: 0 additions & 983 deletions debug/CMakeFiles/CryliaPlayer.dir/src/View/Layouts/QOverlayout.cpp.o.d

This file was deleted.

935 changes: 0 additions & 935 deletions debug/CMakeFiles/CryliaPlayer.dir/src/View/MainWidget.cpp.o.d

This file was deleted.

1,084 changes: 0 additions & 1,084 deletions debug/CMakeFiles/CryliaPlayer.dir/src/View/MainWindow.cpp.o.d

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

340 changes: 0 additions & 340 deletions debug/CMakeFiles/CryliaPlayer.dir/src/View/Pages/Home/HomePage.cpp.o.d

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

146 changes: 0 additions & 146 deletions debug/CMakeFiles/CryliaPlayer.dir/src/core/SongQueue/SongQueue.cpp.o.d

This file was deleted.

446 changes: 0 additions & 446 deletions debug/CMakeFiles/CryliaPlayer.dir/src/core/audio/audio.cpp.o.d

This file was deleted.

This file was deleted.

105 changes: 0 additions & 105 deletions debug/CMakeFiles/CryliaPlayer.dir/src/core/song/song.cpp.o.d

This file was deleted.

1,086 changes: 0 additions & 1,086 deletions debug/CMakeFiles/CryliaPlayer.dir/src/main.cpp.o.d

This file was deleted.

This file was deleted.

Empty file.

This file was deleted.

1,535 changes: 0 additions & 1,535 deletions debug/CMakeFiles/CryliaPlayer_autogen.dir/AutogenInfo.json

This file was deleted.

2 changes: 0 additions & 2 deletions debug/CMakeFiles/CryliaPlayer_autogen.dir/AutogenUsed.txt

This file was deleted.

23 changes: 0 additions & 23 deletions debug/CMakeFiles/CryliaPlayer_autogen.dir/DependInfo.cmake

This file was deleted.

7,025 changes: 0 additions & 7,025 deletions debug/CMakeFiles/CryliaPlayer_autogen.dir/ParseCache.txt

This file was deleted.

94 changes: 0 additions & 94 deletions debug/CMakeFiles/CryliaPlayer_autogen.dir/build.make

This file was deleted.

10 changes: 0 additions & 10 deletions debug/CMakeFiles/CryliaPlayer_autogen.dir/cmake_clean.cmake

This file was deleted.

5,924 changes: 0 additions & 5,924 deletions debug/CMakeFiles/CryliaPlayer_autogen.dir/compiler_depend.internal

This file was deleted.

9,949 changes: 0 additions & 9,949 deletions debug/CMakeFiles/CryliaPlayer_autogen.dir/compiler_depend.make

This file was deleted.

2 changes: 0 additions & 2 deletions debug/CMakeFiles/CryliaPlayer_autogen.dir/compiler_depend.ts

This file was deleted.

2 changes: 0 additions & 2 deletions debug/CMakeFiles/CryliaPlayer_autogen.dir/progress.make

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions debug/CMakeFiles/TargetDirectories.txt

This file was deleted.

1 change: 0 additions & 1 deletion debug/CMakeFiles/cmake.check_cache

This file was deleted.

1 change: 0 additions & 1 deletion debug/CMakeFiles/progress.marks

This file was deleted.

Binary file removed debug/CryliaPlayer
Binary file not shown.
7 changes: 0 additions & 7 deletions debug/CryliaPlayer.desktop

This file was deleted.

410 changes: 0 additions & 410 deletions debug/CryliaPlayer_autogen/3DODUE3C73/moc_Page.cpp.d

This file was deleted.

427 changes: 0 additions & 427 deletions debug/CryliaPlayer_autogen/AGCHITCVVE/moc_HomePage.cpp.d

This file was deleted.

938 changes: 0 additions & 938 deletions debug/CryliaPlayer_autogen/COGQYPW2KU/moc_FloatingControls.cpp.d

This file was deleted.

592 changes: 0 additions & 592 deletions debug/CryliaPlayer_autogen/CVJAWHJWUK/moc_MusicPlayer.cpp.d

This file was deleted.

416 changes: 0 additions & 416 deletions debug/CryliaPlayer_autogen/F6UBO54SDY/moc_PlaylistNavModule.cpp.d

This file was deleted.

956 changes: 0 additions & 956 deletions debug/CryliaPlayer_autogen/GT66W5ZSTU/moc_MainWidget.cpp.d

This file was deleted.

1,074 changes: 0 additions & 1,074 deletions debug/CryliaPlayer_autogen/GT66W5ZSTU/moc_MainWindow.cpp.d

This file was deleted.

453 changes: 0 additions & 453 deletions debug/CryliaPlayer_autogen/JNA6RAIDCM/moc_PageNavModule.cpp.d

This file was deleted.

427 changes: 0 additions & 427 deletions debug/CryliaPlayer_autogen/PEYXJO7ZAH/moc_PlaylistPage.cpp.d

This file was deleted.

412 changes: 0 additions & 412 deletions debug/CryliaPlayer_autogen/SE5LNZAIHG/moc_PageManager.cpp.d

This file was deleted.

427 changes: 0 additions & 427 deletions debug/CryliaPlayer_autogen/TGRORH44XD/moc_SettingsPage.cpp.d

This file was deleted.

436 changes: 0 additions & 436 deletions debug/CryliaPlayer_autogen/WT263M6TY3/moc_NavButton.cpp.d

This file was deleted.

1,954 changes: 0 additions & 1,954 deletions debug/CryliaPlayer_autogen/deps

This file was deleted.

13 changes: 0 additions & 13 deletions debug/CryliaPlayer_autogen/mocs_compilation.cpp

This file was deleted.

Empty file.
94 changes: 0 additions & 94 deletions debug/cmake_install.cmake

This file was deleted.

52 changes: 29 additions & 23 deletions src/Controller/MusicPlayer/MusicPlayer.cpp
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
#include "MusicPlayer.h"
#include "MusicPlayer.hpp"
#include <memory>

MusicPlayer::MusicPlayer()
: songQueue(new SongQueue()), songHistory(new SongHistory<Song *>()) {
// TODO: Replace later with automatic song extraction
Song *argsSong = {new Song(
"REPLACE ME", "REPLACE ME", "REPLACE ME", "", "", "", "", "", "", "", "",
"", CliArgHandler::getInstance().getInputFile().toStdString(), 0, "")};

if (argsSong->GetPath() != "") {
PlaySong(argsSong);
auto argsSong{std::make_unique<Song>(
QString("REPLACE ME"), QString("REPLACE ME"), QString("REPLACE ME"),
QString(""), QString(""), QString(""), QString(""), QString(""),
QString(""), QString(""), QString(""), QString(""),
CliArgHandler::getInstance().getInputFile(), 0)};

if (argsSong->path() != "") {
PlaySong(std::move(argsSong));
}
}

void MusicPlayer::PlaySong(Song *song) {
songQueue->SetTop(song);
void MusicPlayer::PlaySong(std::unique_ptr<Song> song) {
songQueue->SetTop(song.get());
songHistory->push(songQueue->Top());

audio.PlaySong(songQueue->Top()->GetPath());
audio.PlaySong(songQueue->Top()->path());

emit SongChanged();
}
@@ -31,20 +33,20 @@ void MusicPlayer::NextSong() {
songHistory->push(songQueue->Top());
songQueue->Next();

audio.PlaySong(songQueue->Top()->GetPath());
audio.PlaySong(songQueue->Top()->path());
emit SongChanged();
}

void MusicPlayer::NextSong(Song *song, bool isPrioQueue) {
void MusicPlayer::NextSong(std::unique_ptr<Song> song, bool isPrioQueue) {
if (songQueue->IsEmpty()) {
audio.StopMusic();
return;
}

songHistory->push(songQueue->Top());
songQueue->JumpToSong(song, isPrioQueue);
songQueue->JumpToSong(song.get(), isPrioQueue);

audio.PlaySong(songQueue->Top()->GetPath());
audio.PlaySong(songQueue->Top()->path());
emit SongChanged();
}

@@ -55,7 +57,7 @@ void MusicPlayer::PreviousSong() {
songQueue->SetTop(songHistory->top());
songHistory->pop();

audio.PlaySong(songQueue->Top()->GetPath());
audio.PlaySong(songQueue->Top()->path());
emit SongChanged();
}

@@ -70,28 +72,32 @@ int MusicPlayer::GetSongProgression() {
return audio.IsMusicPlaying() == 1 ? audio.GetMusicPos() : 0;
}

Song *MusicPlayer::GetCurrentlyPlaying() { return songQueue->Top(); }
std::unique_ptr<Song> MusicPlayer::GetCurrentlyPlaying() {
return std::unique_ptr<Song>(songQueue->Top());
}

// For the PriorityQueue
void MusicPlayer::AddSongToQueue(Song *song) {
songQueue->AddToPriorityQueue(song);
void MusicPlayer::AddSongToQueue(std::unique_ptr<Song> song) {
songQueue->AddToPriorityQueue(song.get());
}

void MusicPlayer::RemoveSongFromQueue(Song *song) {
songQueue->RemoveSongFromPriorityQueue(song);
void MusicPlayer::RemoveSongFromQueue(std::unique_ptr<Song> song) {
songQueue->RemoveSongFromPriorityQueue(song.get());
}

void MusicPlayer::MoveSongInQueue(Song *songToMove, Song *otherSong,
void MusicPlayer::MoveSongInQueue(std::unique_ptr<Song> songToMove,
std::unique_ptr<Song> otherSong,
bool beforeElseAfter) {
songQueue->MoveSongInPriorityQueue(songToMove, otherSong, beforeElseAfter);
songQueue->MoveSongInPriorityQueue(songToMove.get(), otherSong.get(),
beforeElseAfter);
}

void MusicPlayer::shuffleHandler() {
shuffle ? songQueue->ShufflePlaylist() : songQueue->RestorePlaylist();
}

void MusicPlayer::setQueueLoop() {
loop == All ? songQueue->LinkQueue(true) : songQueue->LinkQueue(false);
loop == Loop::All ? songQueue->LinkQueue(true) : songQueue->LinkQueue(false);
}

bool MusicPlayer::IsPlaying() { return audio.IsMusicPaused(); }
Original file line number Diff line number Diff line change
@@ -3,11 +3,11 @@
#include <QObject>
#include <QPixmap>

#include "../../core/CliArgHandler/CliArgHandler.h"
#include "../../core/Audio/Audio.hpp"
#include "../../core/CliArgHandler/CliArgHandler.hpp"
#include "../../core/Song/Song.hpp"
#include "../../core/SongHistory/SongHistory.hpp"
#include "../../core/SongQueue/SongQueue.h"
#include "../../core/audio/audio.h"
#include "../../core/song/song.h"
#include "../../core/SongQueue/SongQueue.hpp"

class MusicPlayer : public QObject {
Q_OBJECT
@@ -23,7 +23,7 @@ class MusicPlayer : public QObject {
// 0 no shuffle, 1 shuffling
int shuffle = 0;
// None, Once, All
Loop loop = None;
Loop loop = Loop::None;
// 0 stopped, 1 playing
bool playing = 0;

@@ -49,7 +49,7 @@ class MusicPlayer : public QObject {
*
* @param song Song that will start playing
*/
void PlaySong(Song *song);
void PlaySong(std::unique_ptr<Song> song);

/**
* @brief Skip the current song and play the next in queue,
@@ -65,7 +65,7 @@ class MusicPlayer : public QObject {
* @param song
* @param isPrioQueue If the song is in the prio queue or normal queue
*/
void NextSong(Song *song, bool isPrioQueue);
void NextSong(std::unique_ptr<Song> song, bool isPrioQueue);

/**
* @brief Rewind the currently playing song to the beginning if playtime >= 5
@@ -93,7 +93,7 @@ class MusicPlayer : public QObject {
*
* @return Song& Song thats currently playing
*/
Song *GetCurrentlyPlaying();
std::unique_ptr<Song> GetCurrentlyPlaying();

/**
* @brief Will either play or pause a current song, if not song is active it
@@ -120,9 +120,10 @@ class MusicPlayer : public QObject {
void SetVolume(u_short volume) { audio.SetVolume(volume); }
int GetSongDuration() { return audio.GetMusicDuration(); }

void AddSongToQueue(Song *song);
void RemoveSongFromQueue(Song *song);
void MoveSongInQueue(Song *songToMove, Song *otherSong, bool beforeElseAfter);
void AddSongToQueue(std::unique_ptr<Song> song);
void RemoveSongFromQueue(std::unique_ptr<Song> song);
void MoveSongInQueue(std::unique_ptr<Song> songToMove,
std::unique_ptr<Song> otherSong, bool beforeElseAfter);

signals:
void SongChanged();
80 changes: 40 additions & 40 deletions src/View/MainWidget.cpp
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
#include "MainWidget.h"
#include "MainWidget.hpp"

void MainWidget::setupMainWidget() {
void MainWidget::setupMainWidget( ) {
setContentsMargins(10, 10, 10, 10);
QOverlayout *ol = new QOverlayout(this);
QOverlayout* ol = new QOverlayout(this);
setLayout(ol);

QVBoxLayout *vbox = new QVBoxLayout();
QVBoxLayout* vbox = new QVBoxLayout( );
floatingControlls = new FloatingControls(this);
vbox->addWidget(floatingControlls, 0, Qt::AlignBottom);

QHBoxLayout *hbox = new QHBoxLayout();
QVBoxLayout *vbox2 = new QVBoxLayout();
QHBoxLayout* hbox = new QHBoxLayout( );
QVBoxLayout* vbox2 = new QVBoxLayout( );
vbox2->addWidget(pageNav);
vbox2->addWidget(playlistNav);
hbox->addLayout(vbox2);
QHBoxLayout *stackedLayout = new QHBoxLayout();
QHBoxLayout* stackedLayout = new QHBoxLayout( );
stackedLayout->addWidget(homePage);
stackedLayout->addWidget(playlistPage);
stackedLayout->addWidget(localFolderPage);
stackedLayout->addWidget(settingsPage);

pageManager.GetActivePage()->setVisible(true);
pageManager.GetActivePage( )->setVisible(true);
playlistPage->setVisible(false);
localFolderPage->setVisible(false);
settingsPage->setVisible(false);
@@ -34,41 +34,41 @@ void MainWidget::setupMainWidget() {
ol->addItem(vbox);

connect(&pageManager, &PageManager::ActivePageChanged,
[this, stackedLayout](Page *page) {
if (page->GetName() == "home") {
stackedLayout->itemAt(0)->widget()->setVisible(true);
stackedLayout->itemAt(1)->widget()->setVisible(false);
stackedLayout->itemAt(2)->widget()->setVisible(false);
stackedLayout->itemAt(3)->widget()->setVisible(false);
} else if (page->GetName() == "playlist") {
stackedLayout->itemAt(0)->widget()->setVisible(false);
stackedLayout->itemAt(1)->widget()->setVisible(true);
stackedLayout->itemAt(2)->widget()->setVisible(false);
stackedLayout->itemAt(3)->widget()->setVisible(false);
} else if (page->GetName() == "localFolder") {
stackedLayout->itemAt(0)->widget()->setVisible(false);
stackedLayout->itemAt(1)->widget()->setVisible(false);
stackedLayout->itemAt(2)->widget()->setVisible(true);
stackedLayout->itemAt(3)->widget()->setVisible(false);
} else if (page->GetName() == "settings") {
stackedLayout->itemAt(0)->widget()->setVisible(false);
stackedLayout->itemAt(1)->widget()->setVisible(false);
stackedLayout->itemAt(2)->widget()->setVisible(false);
stackedLayout->itemAt(3)->widget()->setVisible(true);
}
});
[this, stackedLayout](Page* page) {
if (page->GetName( ) == "home") {
stackedLayout->itemAt(0)->widget( )->setVisible(true);
stackedLayout->itemAt(1)->widget( )->setVisible(false);
stackedLayout->itemAt(2)->widget( )->setVisible(false);
stackedLayout->itemAt(3)->widget( )->setVisible(false);
} else if (page->GetName( ) == "playlist") {
stackedLayout->itemAt(0)->widget( )->setVisible(false);
stackedLayout->itemAt(1)->widget( )->setVisible(true);
stackedLayout->itemAt(2)->widget( )->setVisible(false);
stackedLayout->itemAt(3)->widget( )->setVisible(false);
} else if (page->GetName( ) == "localFolder") {
stackedLayout->itemAt(0)->widget( )->setVisible(false);
stackedLayout->itemAt(1)->widget( )->setVisible(false);
stackedLayout->itemAt(2)->widget( )->setVisible(true);
stackedLayout->itemAt(3)->widget( )->setVisible(false);
} else if (page->GetName( ) == "settings") {
stackedLayout->itemAt(0)->widget( )->setVisible(false);
stackedLayout->itemAt(1)->widget( )->setVisible(false);
stackedLayout->itemAt(2)->widget( )->setVisible(false);
stackedLayout->itemAt(3)->widget( )->setVisible(true);
}
});
}

void MainWidget::PageChangedAction() {}
void MainWidget::PageChangedAction( ) { }

MainWidget::MainWidget(QWidget *parent)
: QWidget(parent), pageNav(new PageNavModule(this)),
playlistNav(new PlaylistNavModule(this)),
playlistPage(new PlaylistPage(this)), homePage(new HomePage(this)),
localFolderPage(new LocalFolderPage(this)),
settingsPage(new SettingsPage(this)) {
MainWidget::MainWidget(QWidget* parent)
: QWidget(parent), pageNav(new PageNavModule(this)),
playlistNav(new PlaylistNavModule(this)),
playlistPage(new PlaylistPage(this)), homePage(new HomePage(this)),
localFolderPage(new LocalFolderPage(this)),
settingsPage(new SettingsPage(this)) {
pageManager.SetActivePage(homePage);
setupMainWidget();
setupMainWidget( );
}

MainWidget::~MainWidget() {}
MainWidget::~MainWidget( ) { }
File renamed without changes.
2 changes: 1 addition & 1 deletion src/View/MainWindow.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "MainWindow.h"
#include "MainWindow.hpp"

void MainWindow::setupMainWindow() {
this->setWindowTitle("Crylia Player");
4 changes: 1 addition & 3 deletions src/View/MainWindow.h → src/View/MainWindow.hpp
Original file line number Diff line number Diff line change
@@ -5,10 +5,8 @@
#include <QPixmap>
#include <QVBoxLayout>
#include <QtWidgets>
#include <filesystem>
#include <memory>

#include "MainWidget.h"
#include "MainWidget.hpp"

class MainWindow : public QMainWindow {
Q_OBJECT
Loading

0 comments on commit 9a1b856

Please sign in to comment.