diff src/gui/pages/statistics.cc @ 102:b315f3759c56

*: big patch 1. use a wrapper for mINI that enables case sensitivity (personal preference) 2. rename dark_theme.cc to theme.cc and change it to be a class 3. include the "dep" folder so we don't have stupidity in json.h or ini.h 4. I think the graph was also tweaked a lot in this, nothing is constexpr and size is found at runtime...
author Paper <mrpapersonic@gmail.com>
date Fri, 03 Nov 2023 21:32:52 -0400
parents 2f373d48f889
children 6d8da6e64d61
line wrap: on
line diff
--- a/src/gui/pages/statistics.cc	Fri Nov 03 14:06:02 2023 -0400
+++ b/src/gui/pages/statistics.cc	Fri Nov 03 21:32:52 2023 -0400
@@ -40,8 +40,13 @@
 	QVBoxLayout* content_layout = new QVBoxLayout(content);
 	_score_distribution_graph.reset(new Graph<int>(content));
 	content_layout->addWidget(_score_distribution_graph.get());
-	content_layout->setContentsMargins(0, 0, 0, 0);
-	content->setContentsMargins(12, 0, 0, 0);
+	content_layout->setSpacing(0);
+	/* For some reason, when we set the margin to 12 on any paragraphs it 
+	   actually doesn't draw them 12 pixels away. It draws them ~15 pixels
+	   away! I'm assuming this is just Qt's widgets being weird (they usually are)
+	   and I hope it's nothing I *really* have to worry about... */
+	content_layout->setContentsMargins(15, 0, 0, 0);
+	content->setContentsMargins(0, 0, 0, 0);
 
 	score_dist_layout->addWidget(content);
 	score_dist_layout->setContentsMargins(0, 0, 0, 0);
@@ -69,7 +74,7 @@
 #define ADD_TIME_SEGMENT(r, x, s, p) \
 	if (x > 0) \
 	r << x << ((x == 1) ? s : p)
-std::string StatisticsPage::MinutesToDateString(int minutes) {
+std::string StatisticsPage::MinutesToDateString(const int minutes) {
 	/* ew */
 	int years = (minutes * (1 / 525949.2F));
 	int months = (minutes * (1 / 43829.1F)) - (years * 12);
@@ -86,7 +91,7 @@
 	return return_stream.str();
 }
 
-std::string StatisticsPage::SecondsToDateString(int sec) {
+std::string StatisticsPage::SecondsToDateString(const int sec) {
 	/* this is all fairly unnecessary, but works:tm: */
 	int years = sec * (1 / 31556952.0F);
 	int months = sec * (1 / 2629746.0F) - (years * 12);
@@ -107,7 +112,7 @@
 }
 #undef ADD_TIME_SEGMENT
 
-inline int GetTotalWithScore(int score) {
+inline int GetTotalWithScore(const int score) {
 	int count = 0;
 	for (const auto& item : Anime::db.items)
 		if (item.second.IsInUserList() && item.second.GetUserScore() == score)