KissCount/src/view/AccountPanel.hpp

98 lines
2.8 KiB
C++

/*
Copyright 2010-2012 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
#include <QTreeWidget>
#include <QCalendarWidget>
#include <QTableWidget>
#include <QRadioButton>
#include <QStandardItemModel>
#include "view.hpp"
#include <model/model.hpp>
#include "grid/GridAccount.hpp"
#include "CostRepartitionBanner.hpp"
class GridAccount;
class AccountPanel: public KissPanel
{
Q_OBJECT;
public:
AccountPanel(KissCount* kiss, wxUI *parent, bool lowResolution);
AccountPanel(KissCount* kiss, wxUI *parent, bool lowResolution, int month, int year, int mode);
~AccountPanel();
void Init(KissCount* kiss, wxUI *parent, int curMode);
KissPanel* CreatePanel();
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);
void UpdateStats();
int _curMonth, _curYear;
private slots:
void OnOperationModified();
void OnAccountModified(int row, int column);
void OnTreeRightClick(const QPoint & pos);
void OnTreeChange (QTreeWidgetItem * item, int column);
void OnMenuGenerate();
void OnMenuDelete();
void OnCalendarChange();
void OnModeChange();
void OnGroup();
void OnUnGroup();
void OnUpdateNextMonths();
void OnSnapshots();
private:
QTreeWidget *_tree;
QCalendarWidget* _calendar;
GridAccount* _grid;
QTableWidget* _accountsGrid, *_statsGrid;
CostRepartitionBanner* _costRepartitionBanner;
int *_categoriesValues, *_tagsValues;
// wxRadioBox *_radioMode;
std::map<QString, int> _categoriesIndexes;
std::map<QString, int> _tagsIndexes;
std::vector<Operation>* _curOperations;
QString* _categories, *_tags, *_accounts;
std::map<int, int> _accountsInitValues;
int _fixCosts;
QRadioButton *_virtual, *_real, *_check;
bool _inModification;
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