comparison src/gui/pages/statistics.cpp @ 46:d0adc4aedfc8

*: update... this commit: 1. consolidates dark theme stuff to dark_theme.cpp 2. creates a new widgets folder to store all of our custom widgets 3. creates the list settings page in the information dialog, although much of it is nonfunctional: it doesn't save, and the status doesn't even get filled in... we'll fix this later!
author Paper <mrpapersonic@gmail.com>
date Sat, 23 Sep 2023 01:02:15 -0400
parents 9ae9365dd4ea
children d8eb763e6661
comparison
equal deleted inserted replaced
45:4b05bc7668eb 46:d0adc4aedfc8
1 #include "gui/pages/statistics.h" 1 #include "gui/pages/statistics.h"
2 #include "core/anime_db.h" 2 #include "core/anime_db.h"
3 #include "core/session.h" 3 #include "core/session.h"
4 #include "gui/pages/anime_list.h" 4 #include "gui/pages/anime_list.h"
5 #include "gui/ui_utils.h" 5 #include "gui/widgets/text.h"
6 #include <QString> 6 #include <QString>
7 #include <QTextDocument> 7 #include <QTextDocument>
8 #include <QTextStream> 8 #include <QTextStream>
9 #include <QTimer> 9 #include <QTimer>
10 #include <QVBoxLayout> 10 #include <QVBoxLayout>
16 16
17 setFrameShape(QFrame::Panel); 17 setFrameShape(QFrame::Panel);
18 setFrameShadow(QFrame::Sunken); 18 setFrameShadow(QFrame::Sunken);
19 19
20 QPalette pal = QPalette(); 20 QPalette pal = QPalette();
21 pal.setColor(QPalette::Window, Qt::white);
22 setPalette(pal);
21 setAutoFillBackground(true); 23 setAutoFillBackground(true);
22 setPalette(pal);
23 24
24 UiUtils::LabelledTextParagraph* anime_list_paragraph = new UiUtils::LabelledTextParagraph( 25 TextWidgets::LabelledTextParagraph* anime_list_paragraph = new TextWidgets::LabelledTextParagraph(
25 "Anime list", 26 "Anime list",
26 "Anime count:\nEpisode count:\nTime spent watching:\nTime to complete:\nAverage score:\nScore deviation:", "\n\n\n\n\n", 27 "Anime count:\nEpisode count:\nTime spent watching:\nTime to complete:\nAverage score:\nScore deviation:", "\n\n\n\n\n",
27 this); 28 this);
28 anime_list_data = anime_list_paragraph->GetParagraph(); 29 anime_list_data = anime_list_paragraph->GetParagraph();
29 30
30 UiUtils::LabelledTextParagraph* application_paragraph = 31 TextWidgets::LabelledTextParagraph* application_paragraph =
31 new UiUtils::LabelledTextParagraph("Minori", "Uptime:", "", this); 32 new TextWidgets::LabelledTextParagraph("Minori", "Uptime:", "", this);
32 application_data = application_paragraph->GetParagraph(); 33 application_data = application_paragraph->GetParagraph();
33 34
34 layout()->addWidget(anime_list_paragraph); 35 layout()->addWidget(anime_list_paragraph);
35 layout()->addWidget(application_paragraph); 36 layout()->addWidget(application_paragraph);
36 ((QBoxLayout*)layout())->addStretch(); 37 ((QBoxLayout*)layout())->addStretch();
99 ts << Anime::db.GetTotalEpisodeAmount() << '\n'; 100 ts << Anime::db.GetTotalEpisodeAmount() << '\n';
100 ts << MinutesToDateString(Anime::db.GetTotalWatchedAmount()).c_str() << '\n'; 101 ts << MinutesToDateString(Anime::db.GetTotalWatchedAmount()).c_str() << '\n';
101 ts << MinutesToDateString(Anime::db.GetTotalPlannedAmount()).c_str() << '\n'; 102 ts << MinutesToDateString(Anime::db.GetTotalPlannedAmount()).c_str() << '\n';
102 ts << Anime::db.GetAverageScore() << '\n'; 103 ts << Anime::db.GetAverageScore() << '\n';
103 ts << Anime::db.GetScoreDeviation(); 104 ts << Anime::db.GetScoreDeviation();
104 UiUtils::SetPlainTextEditData(anime_list_data, string); 105 TextWidgets::SetPlainTextEditData(anime_list_data, string);
105 106
106 /* Application */ 107 /* Application */
107 // UiUtils::SetPlainTextEditData(application_data, QString::number(session.uptime() / 1000)); 108 // UiUtils::SetPlainTextEditData(application_data, QString::number(session.uptime() / 1000));
108 UiUtils::SetPlainTextEditData(application_data, QString(SecondsToDateString(session.uptime() / 1000).c_str())); 109 TextWidgets::SetPlainTextEditData(application_data, QString(SecondsToDateString(session.uptime() / 1000).c_str()));
109 } 110 }
110 111
111 #include "gui/pages/moc_statistics.cpp" 112 #include "gui/pages/moc_statistics.cpp"