2011-09-04 19:25:53 +02:00
|
|
|
/*
|
|
|
|
Copyright 2010-2011 Grégory Soutadé
|
|
|
|
|
|
|
|
This file is part of KissCount.
|
|
|
|
|
|
|
|
KissCount is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
KissCount is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ACCOUNTPANEL_H
|
|
|
|
#define ACCOUNTPANEL_H
|
|
|
|
|
2011-09-04 21:01:32 +02:00
|
|
|
#include <QTreeWidget>
|
2011-09-06 19:47:02 +02:00
|
|
|
#include <QCalendarWidget>
|
2011-09-13 21:39:22 +02:00
|
|
|
#include <QTableWidget>
|
|
|
|
#include <QRadioButton>
|
2011-09-21 20:47:54 +02:00
|
|
|
#include <QStandardItemModel>
|
|
|
|
#include "pieview.hpp"
|
2011-09-04 21:01:32 +02:00
|
|
|
|
2011-09-04 19:25:53 +02:00
|
|
|
#include "view.hpp"
|
|
|
|
|
|
|
|
#include <model/model.hpp>
|
2011-10-20 11:11:59 +02:00
|
|
|
#include "grid/GridAccount.hpp"
|
2011-09-04 19:25:53 +02:00
|
|
|
|
|
|
|
class GridAccount;
|
|
|
|
|
|
|
|
class AccountPanel: public KissPanel
|
|
|
|
{
|
|
|
|
Q_OBJECT;
|
|
|
|
|
|
|
|
public:
|
|
|
|
AccountPanel(KissCount* kiss, wxUI *parent);
|
|
|
|
~AccountPanel();
|
|
|
|
|
|
|
|
KissPanel* CreatePanel();
|
|
|
|
QPushButton* GetButton();
|
|
|
|
QString GetToolTip();
|
|
|
|
void OnShow();
|
|
|
|
|
|
|
|
void ChangeUser();
|
|
|
|
void LoadYear(int year, bool showMonth=true);
|
|
|
|
void ShowMonth(int month, int year);
|
|
|
|
void GenerateMonth(int month, int year);
|
2011-11-01 18:01:17 +01:00
|
|
|
void UpdateStats();
|
2011-09-04 19:25:53 +02:00
|
|
|
|
2011-09-21 20:47:54 +02:00
|
|
|
int _curMonth, _curYear;
|
|
|
|
|
|
|
|
private slots:
|
2011-09-04 19:25:53 +02:00
|
|
|
void OnOperationModified();
|
2011-10-30 09:27:03 +01:00
|
|
|
void OnAccountModified(int row, int column);
|
2011-10-31 09:15:37 +01:00
|
|
|
void OnTreeRightClick(const QPoint & pos);
|
2011-10-24 21:05:12 +02:00
|
|
|
void OnTreeChange (QTreeWidgetItem * item, int column);
|
2011-09-04 19:25:53 +02:00
|
|
|
void OnMenuGenerate();
|
|
|
|
void OnMenuDelete();
|
|
|
|
void OnCalendarChange();
|
|
|
|
void OnModeChange();
|
|
|
|
void OnGroup();
|
|
|
|
void OnUnGroup();
|
|
|
|
void OnUpdateNextMonths();
|
|
|
|
|
|
|
|
private:
|
2011-09-04 21:01:32 +02:00
|
|
|
QTreeWidget *_tree;
|
2011-09-06 19:47:02 +02:00
|
|
|
QCalendarWidget* _calendar;
|
2011-10-20 11:11:59 +02:00
|
|
|
GridAccount* _grid;
|
2011-09-13 21:39:22 +02:00
|
|
|
QTableWidget* _accountsGrid, *_statsGrid;
|
2011-09-21 20:47:54 +02:00
|
|
|
PieView* _pie;
|
2011-09-04 19:25:53 +02:00
|
|
|
double *_categoriesValues;
|
|
|
|
// wxRadioBox *_radioMode;
|
|
|
|
std::map<QString, int> _categoriesIndexes;
|
|
|
|
std::vector<Operation>* _curOperations;
|
|
|
|
QString* _categories, *_accounts;
|
2011-09-13 21:39:22 +02:00
|
|
|
std::map<int, double> _accountsInitValues;
|
2011-09-21 20:47:54 +02:00
|
|
|
QStandardItemModel* _dataset;
|
2011-09-04 19:25:53 +02:00
|
|
|
int _fixCosts;
|
2011-09-13 21:39:22 +02:00
|
|
|
QRadioButton *_virtual, *_real, *_check;
|
2011-11-01 18:01:17 +01:00
|
|
|
bool _inModification;
|
2011-09-04 19:25:53 +02:00
|
|
|
|
|
|
|
void InitStatsGrid(User* user);
|
|
|
|
void InitAccountsGrid(User* user, int month, int year);
|
|
|
|
void InsertOperation(User* user, Operation* op, int line, bool fix);
|
|
|
|
void GetTreeSelection(int* month, int* year);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|