diff options
Diffstat (limited to 'src/statistics/ProgressPage.cpp')
-rw-r--r-- | src/statistics/ProgressPage.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/statistics/ProgressPage.cpp b/src/statistics/ProgressPage.cpp new file mode 100644 index 0000000..7676173 --- /dev/null +++ b/src/statistics/ProgressPage.cpp @@ -0,0 +1,41 @@ +#include "ProgressPage.h"
+#include "StatisticsParams.h"
+#include "../charts/PieChart.h"
+#include "../dictionary/CardPack.h"
+
+ProgressPage::ProgressPage(const StatisticsParams* statParams):
+ BaseStatPage(statParams)
+{
+ init();
+}
+
+QWidget* ProgressPage::createChart()
+{
+ chart = new PieChart;
+ chart->setColors({"#39c900", "#ece900", "#ff0000"});
+ return chart;
+}
+
+void ProgressPage::updateDataSet()
+{
+ updateCardsNumbers();
+ totalReviewsLabel->setText(tr("Total: %1").arg(allCardsNum));
+ chart->setDataSet(getDataSet());
+}
+
+void ProgressPage::updateCardsNumbers()
+{
+ const CardPack* pack = statParams->getCardPack();
+ allCardsNum = pack->cardsNum();
+ newCardsNum = pack->getNewCards().size();
+ toBeRepeated = pack->getActiveCards().size();
+}
+
+QList<DataPoint> ProgressPage::getDataSet() const
+{
+ QList<DataPoint> dataSet;
+ dataSet << DataPoint(tr("Studied"), allCardsNum - newCardsNum - toBeRepeated);
+ dataSet << DataPoint(tr("Scheduled for today"), toBeRepeated);
+ dataSet << DataPoint(tr("New"), newCardsNum);
+ return dataSet;
+}
|