# HG changeset patch # User Paper # Date 1695741530 14400 # Node ID 466ac9870df97f6ae051f8baa1bc143494165cb5 # Parent a6e51a03112ebd3064899b3734a1d3ffde972f7e add stub pages (to be implemented) diff -r a6e51a03112e -r 466ac9870df9 CMakeLists.txt --- a/CMakeLists.txt Mon Sep 25 22:50:54 2023 -0400 +++ b/CMakeLists.txt Tue Sep 26 11:18:50 2023 -0400 @@ -49,6 +49,11 @@ src/gui/pages/anime_list.cpp src/gui/pages/now_playing.cpp src/gui/pages/statistics.cpp + src/gui/pages/search.cpp + src/gui/pages/seasons.cpp + src/gui/pages/torrents.cpp + src/gui/pages/history.cpp + # Custom widgets src/gui/widgets/sidebar.cpp diff -r a6e51a03112e -r 466ac9870df9 include/gui/pages/history.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/gui/pages/history.h Tue Sep 26 11:18:50 2023 -0400 @@ -0,0 +1,12 @@ +#ifndef __gui__pages__history_h +#define __gui__pages__history_h +#include + +class HistoryWidget : public QWidget { + Q_OBJECT + + public: + HistoryWidget(QWidget* parent = nullptr); +}; + +#endif // __gui__pages__history_h diff -r a6e51a03112e -r 466ac9870df9 include/gui/pages/search.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/gui/pages/search.h Tue Sep 26 11:18:50 2023 -0400 @@ -0,0 +1,12 @@ +#ifndef __gui__pages__search_h +#define __gui__pages__search_h +#include + +class SearchWidget : public QWidget { + Q_OBJECT + + public: + SearchWidget(QWidget* parent = nullptr); +}; + +#endif // __gui__pages__search_h diff -r a6e51a03112e -r 466ac9870df9 include/gui/pages/seasons.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/gui/pages/seasons.h Tue Sep 26 11:18:50 2023 -0400 @@ -0,0 +1,12 @@ +#ifndef __gui__pages__seasons_h +#define __gui__pages__seasons_h +#include + +class SeasonsWidget : public QWidget { + Q_OBJECT + + public: + SeasonsWidget(QWidget* parent = nullptr); +}; + +#endif // __gui__pages__seasons_h diff -r a6e51a03112e -r 466ac9870df9 include/gui/pages/torrents.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/gui/pages/torrents.h Tue Sep 26 11:18:50 2023 -0400 @@ -0,0 +1,12 @@ +#ifndef __gui__pages__torrents_h +#define __gui__pages__torrents_h +#include + +class TorrentsWidget : public QWidget { + Q_OBJECT + + public: + TorrentsWidget(QWidget* parent = nullptr); +}; + +#endif // __gui__pages__torrents_h diff -r a6e51a03112e -r 466ac9870df9 src/gui/pages/history.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/gui/pages/history.cpp Tue Sep 26 11:18:50 2023 -0400 @@ -0,0 +1,6 @@ +#include "gui/pages/history.h" + +HistoryWidget::HistoryWidget(QWidget* parent) : QWidget(parent) { +} + +#include "gui/pages/moc_history.cpp" diff -r a6e51a03112e -r 466ac9870df9 src/gui/pages/search.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/gui/pages/search.cpp Tue Sep 26 11:18:50 2023 -0400 @@ -0,0 +1,6 @@ +#include "gui/pages/search.h" + +SearchWidget::SearchWidget(QWidget* parent) : QWidget(parent) { +} + +#include "gui/pages/moc_search.cpp" diff -r a6e51a03112e -r 466ac9870df9 src/gui/pages/seasons.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/gui/pages/seasons.cpp Tue Sep 26 11:18:50 2023 -0400 @@ -0,0 +1,6 @@ +#include "gui/pages/seasons.h" + +SeasonsWidget::SeasonsWidget(QWidget* parent) : QWidget(parent) { +} + +#include "gui/pages/moc_seasons.cpp" diff -r a6e51a03112e -r 466ac9870df9 src/gui/pages/torrents.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/gui/pages/torrents.cpp Tue Sep 26 11:18:50 2023 -0400 @@ -0,0 +1,6 @@ +#include "gui/pages/torrents.h" + +TorrentsWidget::TorrentsWidget(QWidget* parent) : QWidget(parent) { +} + +#include "gui/pages/moc_torrents.cpp" diff -r a6e51a03112e -r 466ac9870df9 src/gui/window.cpp --- a/src/gui/window.cpp Mon Sep 25 22:50:54 2023 -0400 +++ b/src/gui/window.cpp Tue Sep 26 11:18:50 2023 -0400 @@ -7,6 +7,10 @@ #include "gui/pages/anime_list.h" #include "gui/pages/now_playing.h" #include "gui/pages/statistics.h" +#include "gui/pages/seasons.h" +#include "gui/pages/search.h" +#include "gui/pages/torrents.h" +#include "gui/pages/history.h" #include "gui/widgets/sidebar.h" #include "services/services.h" #include @@ -53,16 +57,13 @@ QStackedWidget* stack = new QStackedWidget(main_widget); stack->addWidget(new NowPlayingWidget(main_widget)); stack->addWidget(new AnimeListWidget(main_widget)); + stack->addWidget(new HistoryWidget(main_widget)); stack->addWidget(new StatisticsWidget(main_widget)); + stack->addWidget(new SearchWidget(main_widget)); + stack->addWidget(new SeasonsWidget(main_widget)); + stack->addWidget(new TorrentsWidget(main_widget)); - connect(sidebar, &SideBar::CurrentItemChanged, stack, [stack](int index) { - switch (index) { - case 0: - case 1: stack->setCurrentIndex(index); break; - case 3: stack->setCurrentIndex(2); break; - default: break; - } - }); + connect(sidebar, &SideBar::CurrentItemChanged, stack, &QStackedWidget::setCurrentIndex); sidebar->setCurrentRow(2); /* Menu Bar */ @@ -167,15 +168,14 @@ action->setCheckable(true); page_to_index_map[action] = 6; + connect(stack, &QStackedWidget::currentChanged, this, [pages_group, sidebar](int index){ + pages_group->actions()[index]->setChecked(true); + }); + connect(pages_group, &QActionGroup::triggered, this, [page_to_index_map, stack](QAction* action) { - int index = page_to_index_map.at(action); - switch (index) { - case 0: - case 1: stack->setCurrentIndex(index); break; - case 3: stack->setCurrentIndex(2); - default: break; - } + stack->setCurrentIndex(page_to_index_map.at(action)); }); + menu->addSeparator(); menu->addAction(tr("Show sidebar"));