changeset 54:466ac9870df9

add stub pages (to be implemented)
author Paper <mrpapersonic@gmail.com>
date Tue, 26 Sep 2023 11:18:50 -0400
parents a6e51a03112e
children d10b6c6b432e 6ff7aabeb9d7
files CMakeLists.txt include/gui/pages/history.h include/gui/pages/search.h include/gui/pages/seasons.h include/gui/pages/torrents.h src/gui/pages/history.cpp src/gui/pages/search.cpp src/gui/pages/seasons.cpp src/gui/pages/torrents.cpp src/gui/window.cpp
diffstat 10 files changed, 92 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- 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
--- /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 <QWidget>
+
+class HistoryWidget : public QWidget {
+		Q_OBJECT
+
+	public:
+		HistoryWidget(QWidget* parent = nullptr);
+};
+
+#endif // __gui__pages__history_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 <QWidget>
+
+class SearchWidget : public QWidget {
+		Q_OBJECT
+
+	public:
+		SearchWidget(QWidget* parent = nullptr);
+};
+
+#endif // __gui__pages__search_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 <QWidget>
+
+class SeasonsWidget : public QWidget {
+		Q_OBJECT
+
+	public:
+		SeasonsWidget(QWidget* parent = nullptr);
+};
+
+#endif // __gui__pages__seasons_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 <QWidget>
+
+class TorrentsWidget : public QWidget {
+		Q_OBJECT
+
+	public:
+		TorrentsWidget(QWidget* parent = nullptr);
+};
+
+#endif // __gui__pages__torrents_h
--- /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"
--- /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"
--- /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"
--- /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"
--- 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"));