changeset 48:e613772f41d5

statistics.cpp: show requests made
author Paper <mrpapersonic@gmail.com>
date Mon, 25 Sep 2023 01:07:22 -0400
parents d8eb763e6661
children f4bea5ef5b8a
files include/core/session.h src/gui/pages/statistics.cpp src/gui/widgets/optional_date.cpp src/gui/window.cpp src/services/anilist.cpp
diffstat 5 files changed, 26 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/include/core/session.h	Mon Sep 25 00:43:38 2023 -0400
+++ b/include/core/session.h	Mon Sep 25 01:07:22 2023 -0400
@@ -6,7 +6,7 @@
 struct Session {
 		Config config;
 		Session() { timer.start(); }
-		void AppendRequest() { requests++; };
+		void IncrementRequests() { requests++; };
 		int GetRequests() { return requests; };
 		int uptime() { return timer.elapsed(); }
 
--- a/src/gui/pages/statistics.cpp	Mon Sep 25 00:43:38 2023 -0400
+++ b/src/gui/pages/statistics.cpp	Mon Sep 25 01:07:22 2023 -0400
@@ -29,7 +29,7 @@
 	anime_list_data = anime_list_paragraph->GetParagraph();
 
 	TextWidgets::LabelledTextParagraph* application_paragraph =
-	    new TextWidgets::LabelledTextParagraph("Minori", "Uptime:\nRequests made:", "", this);
+	    new TextWidgets::LabelledTextParagraph("Minori", "Uptime:\nRequests made:", "\n", this);
 	application_data = application_paragraph->GetParagraph();
 
 	layout()->addWidget(anime_list_paragraph);
--- a/src/gui/widgets/optional_date.cpp	Mon Sep 25 00:43:38 2023 -0400
+++ b/src/gui/widgets/optional_date.cpp	Mon Sep 25 01:07:22 2023 -0400
@@ -15,7 +15,7 @@
 	_checkbox->setCheckState(enabled ? Qt::Checked : Qt::Unchecked);
 	_checkbox->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
 
-	layout->addWidget(_checkbox);
+	layout->addWidget(_checkbox, 0, Qt::AlignVCenter);
 
 	_dateedit = new QDateEdit(this);
 	_dateedit->setDisplayFormat("yyyy-MM-dd");
--- a/src/gui/window.cpp	Mon Sep 25 00:43:38 2023 -0400
+++ b/src/gui/window.cpp	Mon Sep 25 01:07:22 2023 -0400
@@ -68,15 +68,21 @@
 	QAction* action;
 	QMenuBar* menubar = new QMenuBar(parent);
 	QMenu* menu = menubar->addMenu("&File");
+
 	QMenu* submenu = menu->addMenu("&Library folders");
 	action = submenu->addAction("&Add new folder...");
+
 	action = menu->addAction("&Scan available episodes");
 
 	menu->addSeparator();
 
 	action = menu->addAction("Play &next episode");
+	action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N));
 	action = menu->addAction("Play &random episode");
+	action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
+
 	menu->addSeparator();
+
 	action = menu->addAction("E&xit", qApp, &QApplication::quit);
 
 	menu = menubar->addMenu("&Services");
@@ -84,6 +90,7 @@
 		Services::Synchronize();
 		((AnimeListWidget*)stack->widget((int)Pages::ANIME_LIST))->Refresh();
 	});
+	action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
 
 	menu->addSeparator();
 
@@ -131,19 +138,32 @@
 	pages_group->setExclusive(true);
 
 	action = pages_group->addAction(menu->addAction("&Now Playing"));
+	action->setCheckable(true);
 	page_to_index_map[action] = 0;
+
 	action = pages_group->addAction(menu->addAction("&Anime List"));
 	page_to_index_map[action] = 1;
+
+	action->setCheckable(true);
 	action->setChecked(true);
 	action = pages_group->addAction(menu->addAction("&History"));
+	action->setCheckable(true);
 	page_to_index_map[action] = 2;
+
 	action = pages_group->addAction(menu->addAction("&Statistics"));
+	action->setCheckable(true);
 	page_to_index_map[action] = 3;
+
 	action = pages_group->addAction(menu->addAction("S&earch"));
+	action->setCheckable(true);
 	page_to_index_map[action] = 4;
+
 	action = pages_group->addAction(menu->addAction("Se&asons"));
+	action->setCheckable(true);
 	page_to_index_map[action] = 5;
+
 	action = pages_group->addAction(menu->addAction("&Torrents"));
+	action->setCheckable(true);
 	page_to_index_map[action] = 6;
 
 	connect(pages_group, &QActionGroup::triggered, this, [page_to_index_map, stack](QAction* action) {
@@ -155,6 +175,8 @@
 			default: break;
 		}
 	});
+	menu->addSeparator();
+	menu->addAction("Show sidebar");
 
 	menu = menubar->addMenu("&Help");
 	action = menu->addAction("About &Qt", qApp, [this] { qApp->aboutQt(); });
--- a/src/services/anilist.cpp	Mon Sep 25 00:43:38 2023 -0400
+++ b/src/services/anilist.cpp	Mon Sep 25 01:07:22 2023 -0400
@@ -59,6 +59,7 @@
 		/* Use system certs... useful on Windows. */
 		curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);
 		CURLcode res = curl_easy_perform(curl);
+		session.IncrementRequests();
 		curl_slist_free_all(list);
 		curl_easy_cleanup(curl);
 		if (res != CURLE_OK) {