Commit 9f487f25bc32d7eb8919532fa42027ea599b6f66
- Diff rendering mode:
- inline
- side by side
src/expensesgraph.cpp
(2 / 2)
|   | |||
| 162 | 162 | X_LABEL_WIDTH, | |
| 163 | 163 | X_LABEL_HEIGHT, | |
| 164 | 164 | Qt::AlignCenter, | |
| 165 | QString("1")); | ||
| 165 | QString("%1").arg(_model->label(0))); | ||
| 166 | 166 | painter.setPen(pen); | |
| 167 | 167 | x = xStart + (xStep *xStepsPerLabel); | |
| 168 | 168 | for (i = xStepsPerLabel + 1; i<=_model->xDivisions(); i+=xStepsPerLabel) { | |
| … | … | ||
| 175 | 175 | X_LABEL_WIDTH, | |
| 176 | 176 | X_LABEL_HEIGHT, | |
| 177 | 177 | Qt::AlignCenter, | |
| 178 | QString("%1").arg(i)); | ||
| 178 | QString("%1").arg(_model->label(i-1))); | ||
| 179 | 179 | painter.setPen(pen); | |
| 180 | 180 | x += xStep * xStepsPerLabel; | |
| 181 | 181 | } |
src/expensesgraphmodel.cpp
(6 / 0)
|   | |||
| 1 | #include "expensesgraphmodel.h" | ||
| 2 | |||
| 3 | ExpensesGraphModel::ExpensesGraphModel(QObject *parent) | ||
| 4 | : QObject(parent) | ||
| 5 | { | ||
| 6 | } |
src/expensesgraphmodel.h
(27 / 0)
|   | |||
| 1 | #ifndef EXPENSESGRAPHMODEL_H | ||
| 2 | #define EXPENSESGRAPHMODEL_H | ||
| 3 | |||
| 4 | #include <QObject> | ||
| 5 | |||
| 6 | class ExpensesGraphModel : public QObject | ||
| 7 | { | ||
| 8 | Q_OBJECT | ||
| 9 | public: | ||
| 10 | ExpensesGraphModel(QObject *parent = 0); | ||
| 11 | |||
| 12 | virtual double budget() = 0; | ||
| 13 | virtual double totalExpense() = 0; | ||
| 14 | virtual double maxExpense() = 0; | ||
| 15 | virtual bool isCurrent() = 0; | ||
| 16 | virtual int xDivisions() = 0; | ||
| 17 | virtual double value(int i) = 0; | ||
| 18 | virtual int label(int i) = 0; | ||
| 19 | |||
| 20 | signals: | ||
| 21 | void expensesChanged(); | ||
| 22 | void budgetChanged(); | ||
| 23 | |||
| 24 | private: | ||
| 25 | }; | ||
| 26 | |||
| 27 | #endif |
src/monthdata.cpp
(5 / 0)
|   | |||
| 143 | 143 | { | |
| 144 | 144 | return _date.daysInMonth(); | |
| 145 | 145 | } | |
| 146 | |||
| 147 | int MonthData::label(int index) | ||
| 148 | { | ||
| 149 | return index + 1; | ||
| 150 | } |
src/monthdata.h
(1 / 0)
|   | |||
| 38 | 38 | QDate date(); | |
| 39 | 39 | void clear(); | |
| 40 | 40 | int xDivisions(); | |
| 41 | int label(int i); | ||
| 41 | 42 | ||
| 42 | 43 | signals: | |
| 43 | 44 |
src/summarydata.cpp
(5 / 0)
|   | |||
| 150 | 150 | { | |
| 151 | 151 | return _values.value(index); | |
| 152 | 152 | } | |
| 153 | |||
| 154 | int SummaryData::label(int index) | ||
| 155 | { | ||
| 156 | return (index + _startMonth) % 12; | ||
| 157 | } |
src/summarydata.h
(1 / 0)
|   | |||
| 40 | 40 | bool isCurrent(); | |
| 41 | 41 | int xDivisions(); | |
| 42 | 42 | double value(int i); | |
| 43 | int label(int i); | ||
| 43 | 44 | ||
| 44 | 45 | const QList<Concept*>& concepts(); | |
| 45 | 46 |
src/summarywindow.cpp
(11 / 0)
|   | |||
| 79 | 79 | chart = new ConceptsChart(); | |
| 80 | 80 | vbox->addWidget(chart, 1); | |
| 81 | 81 | ||
| 82 | viewLabel = new QLabel(tr("Monthly accumulated view")); | ||
| 83 | vbox->addWidget(viewLabel, 0, Qt::AlignCenter); | ||
| 82 | 84 | graph = new ExpensesGraph(); | |
| 83 | 85 | vbox->addWidget(graph, 1); | |
| 84 | 86 | ||
| … | … | ||
| 88 | 88 | statistics->setChecked(true); | |
| 89 | 89 | chart->hide(); | |
| 90 | 90 | graph->hide(); | |
| 91 | viewLabel->hide(); | ||
| 91 | 92 | } | |
| 92 | 93 | ||
| 93 | 94 | SummaryWindow::~SummaryWindow() | |
| … | … | ||
| 103 | 103 | statsBox->show(); | |
| 104 | 104 | chart->hide(); | |
| 105 | 105 | graph->hide(); | |
| 106 | viewLabel->hide(); | ||
| 106 | 107 | } | |
| 107 | 108 | ||
| 108 | 109 | void SummaryWindow::itemsSelected() | |
| … | … | ||
| 111 | 111 | statsBox->hide(); | |
| 112 | 112 | chart->show(); | |
| 113 | 113 | graph->hide(); | |
| 114 | viewLabel->hide(); | ||
| 114 | 115 | } | |
| 115 | 116 | ||
| 116 | 117 | void SummaryWindow::evolutionSelected() | |
| … | … | ||
| 119 | 119 | statsBox->hide(); | |
| 120 | 120 | chart->hide(); | |
| 121 | 121 | graph->show(); | |
| 122 | viewLabel->show(); | ||
| 122 | 123 | } | |
| 123 | 124 | ||
| 124 | 125 | void SummaryWindow::setSummaryData(SummaryData *data) | |
| … | … | ||
| 175 | 175 | { | |
| 176 | 176 | if (graph->isVisible()) { | |
| 177 | 177 | graph->changeView(); | |
| 178 | if (graph->accumulated()) { | ||
| 179 | viewLabel->setText(tr("Monthly accumulated view")); | ||
| 180 | } else { | ||
| 181 | viewLabel->setText(tr("Month expenses view")); | ||
| 182 | } | ||
| 178 | 183 | } | |
| 179 | 184 | } |
src/summarywindow.h
(2 / 0)
|   | |||
| 49 | 49 | ||
| 50 | 50 | /* items stuff */ | |
| 51 | 51 | ConceptsChart *chart; | |
| 52 | |||
| 53 | QLabel *viewLabel; | ||
| 52 | 54 | ExpensesGraph *graph; | |
| 53 | 55 | ||
| 54 | 56 | SummaryData *summaryData; |

