diff src/gui/window.cpp @ 44:619cbd6e69f9

filesystem: fix CreateDirectories function
author Paper <mrpapersonic@gmail.com>
date Fri, 22 Sep 2023 13:52:11 -0400
parents 9ae9365dd4ea
children d0adc4aedfc8
line wrap: on
line diff
--- a/src/gui/window.cpp	Fri Sep 22 12:06:49 2023 -0400
+++ b/src/gui/window.cpp	Fri Sep 22 13:52:11 2023 -0400
@@ -121,6 +121,46 @@
 		SettingsDialog dialog(this);
 		dialog.exec();
 	});
+	action->setMenuRole(QAction::PreferencesRole);
+
+	menu = menubar->addMenu("&View");
+
+	std::map<QAction*, int> page_to_index_map = {};
+
+	QActionGroup* pages_group = new QActionGroup(this);
+	pages_group->setExclusive(true);
+
+	action = pages_group->addAction(menu->addAction("&Now Playing"));
+	page_to_index_map[action] = 0;
+	action = pages_group->addAction(menu->addAction("&Anime List"));
+	page_to_index_map[action] = 1;
+	action->setChecked(true);
+	action = pages_group->addAction(menu->addAction("&History"));
+	page_to_index_map[action] = 2;
+	action = pages_group->addAction(menu->addAction("&Statistics"));
+	page_to_index_map[action] = 3;
+	action = pages_group->addAction(menu->addAction("S&earch"));
+	page_to_index_map[action] = 4;
+	action = pages_group->addAction(menu->addAction("Se&asons"));
+	page_to_index_map[action] = 5;
+	action = pages_group->addAction(menu->addAction("&Torrents"));
+	page_to_index_map[action] = 6;
+
+	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;
+		}
+	});
+
+	menu = menubar->addMenu("&Help");
+	action = menu->addAction("About &Qt", qApp, [this]{
+		qApp->aboutQt();
+	});
+	action->setMenuRole(QAction::AboutQtRole);
 
 	setMenuBar(menubar);