Mercurial > minori
diff src/gui/window.cpp @ 54:466ac9870df9
add stub pages (to be implemented)
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Tue, 26 Sep 2023 11:18:50 -0400 |
parents | 75c804f713b2 |
children | b7a1c0010ffd |
line wrap: on
line diff
--- 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 <QApplication> @@ -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"));