KissCount

KissCount Commit Details

Date:2018-11-01 10:58:16 (11 months 18 days ago)
Author:Grégory Soutadé
Branch:dev, master
Commit:fa9f7497f546e4a92aa601c93156c5c8068e012f
Parents: 0a80a781a75807f131c9fa3114acc6611f8cb02a
Message:Remove delete column (replaced by Suppr shortcut)

Changes:
MChangeLog (1 diff)
Msrc/view/AccountPanel.cpp (1 diff)
Msrc/view/CostRepartitionBanner.cpp (3 diffs)
Msrc/view/grid/GridAccount.cpp (11 diffs)
Msrc/view/grid/GridAccount.hpp (3 diffs)

File differences

ChangeLog
1
1
22
33
44
55
66
7
78
89
910
v0.8 (07/10/2018)
v0.8 (01/11/2018)
** User **
Add multi month operation support : Normal operation with description "... (XX/YY)" will be forwarded to next month
Auto fill operation amount if it was the same for the last 3 operations
Add quick transfert dialog (ctrl+t shortcut)
Add ctrl+r shortcut to check/uncheck operations
Remove delete column (replaced by Suppr shortcut)
** Dev **
** Bugs **
Current account value is badly computed if operations are not in date order
src/view/AccountPanel.cpp
202202
203203
204204
205
205
206206
207
207
208208
209209
210210
vbox->addWidget(_costRepartitionBanner);
hbox->addLayout(vbox);
hbox->setStretch(0, 1);
hbox->setStretch(0, 1.5);
hbox->setStretch(1, 4);
hbox->setStretch(2, 1);
hbox->setStretch(2, 1.5);
ChangeUser();
src/view/CostRepartitionBanner.cpp
4444
4545
4646
47
4847
4948
5049
5150
5251
5352
54
55
56
57
58
59
6053
6154
6255
......
6962
7063
7164
72
73
74
75
76
77
78
79
80
81
82
83
8465
8566
8667
......
10485
10586
10687
107
88
10889
10990
11091
QPen pen;
pen.setWidth(2);
pen.setColor(Qt::black);
//_pie->pieDiagram()->setPen(pen);
QLegend* legend = _pie->legend();
legend->detachFromChart();
legend->setAlignment(Qt::AlignTop);
legend->setVisible(false);
legend->setShowToolTips(true);
// legend->setAlignment(Qt::AlignBottom);
//_pie->addLegend(KDChart::Position::South);
// KDChart::Legend* legend = //_pie->legend();
// legend->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
// legend->setOrientation( Qt::Vertical );
_pie->setMargins(QMargins(5, 5, 5, 5));
}
_pie->addSeries(series);
//_pie->setTitle(_("Cost repartition"));
//_pie->setMaximumSize( 200, 400 );
// KDChart::TextAttributes legendTextAttr(legend->textAttributes());
// legendTextAttr.setFontSize(64);
// legendTextAttr.setAutoShrink(true);
// legend->setTextAttributes(legendTextAttr);
// legendTextAttr = KDChart::TextAttributes(legend->titleTextAttributes());
// legendTextAttr.setFontSize(64);
// legendTextAttr.setAutoShrink(true);
// legend->setTitleTextAttributes(legendTextAttr);
_statsGrid = new QTableWidget(this);
_statsGrid->verticalHeader()->setHidden(true);
vbox->addWidget(chartView);
setMaximumWidth(350);
setMaximumWidth(450);
}
void CostRepartitionBanner::Reset()
src/view/grid/GridAccount.cpp
5353
5454
5555
56
56
5757
5858
5959
......
8383
8484
8585
86
87
88
89
9086
9187
9288
......
115111
116112
117113
118
119114
120115
121116
122117
123
124118
125119
126120
......
128122
129123
130124
125
131126
132127
133128
......
141136
142137
143138
139
140
141
142
144143
145144
146145
......
330329
331330
332331
333
334332
335333
336334
......
469467
470468
471469
472
473
474
475
476
477
478470
479471
480472
......
547539
548540
549541
550
551542
552543
553544
......
624615
625616
626617
627
628
629
630618
631619
632620
......
919907
920908
921909
922
923
924
925
926910
927911
928912
929913
930914
931
932
933915
934
935916
936917
937918
......
17361717
17371718
17381719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
_loadOperations(false),
_curMonth(0), _curYear(0), _treeSignalMapper(this), _checkSignalMapper(this),
_deleteSignalMapper(this), _inModification(false), _completer(0),
_transfertCompletionIndex(0), _ctrlT(0)
_transfertCompletionIndex(0), _ctrlT(0), _ctrlR(0), _suppr(0)
{
DEFAULT_FONT(font);
int i;
item->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
setItem(0, i, item);
}
label = new QLabel();
label->setPixmap(QPixmap(DELETE_ICON));
label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
setCellWidget(0, OP_DELETE, label);
label = new QLabel();
label->setPixmap(QPixmap(CHECKED_ICON));
resizeColumnToContents(TAG);
resizeColumnToContents(OP_DATE);
resizeColumnToContents(ACCOUNT);
resizeColumnToContents(OP_DELETE);
resizeColumnToContents(CHECKED);
connect(&_treeSignalMapper, SIGNAL(mapped(int)), this, SLOT(OnMetaClicked(int)));
connect(&_checkSignalMapper, SIGNAL(mapped(int)), this, SLOT(OnCheckClicked(int)));
connect(&_deleteSignalMapper, SIGNAL(mapped(int)), this, SLOT(OnDeleteClicked(int)));
setItemDelegate(new TableViewDelegate(this));
connect(this, SIGNAL(cellChanged(int, int)), this, SLOT(OnOperationModified(int, int)));
{
_ctrlT = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_T), this, SLOT(OnCtrlT()));
_ctrlR = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_R), this, SLOT(OnCtrlR()));
_suppr = new QShortcut(QKeySequence(Qt::Key_Delete), this, SLOT(OnSuppr()));
}
}
delete _completer;
if (_ctrlT)
delete _ctrlT;
if (_ctrlR)
delete _ctrlR;
if (_suppr)
delete _suppr;
}
void GridAccount::ResetWeeks()
resizeColumnToContents(CATEGORY);
resizeColumnToContents(OP_DATE);
resizeColumnToContents(ACCOUNT);
resizeColumnToContents(OP_DELETE);
resizeColumnToContents(CHECKED);
resizeRowsToContents();
else
setItem(line, TAG, new QTableWidgetItem(""));
checkBox = new QCheckBox();
checkBox->setCheckState(Qt::Unchecked);
InsertCenteredWidget(line, OP_DELETE, checkBox);
_deleteSignalMapper.setMapping(checkBox, op.id);
connect(checkBox, SIGNAL(stateChanged(int)), &_deleteSignalMapper, SLOT(map()));
checkBox = new QCheckBox();
checkBox->setCheckState((op.checked) ? Qt::Checked : Qt::Unchecked);
InsertCenteredWidget(line, CHECKED, checkBox);
}
SET_READ_ONLY(this->item(line, CHECKED));
SET_READ_ONLY(this->item(line, OP_DELETE));
SET_ROW_FONT(line, user->GetCategoryFont(0));
}
QCheckBox* checkBox = qobject_cast<QCheckBox*> (GetCenteredWidget(line, CHECKED));
if (checkBox)
checkBox->disconnect(&_checkSignalMapper, SLOT(map()));
checkBox = qobject_cast<QCheckBox*> (GetCenteredWidget(line, OP_DELETE));
if (checkBox)
checkBox->disconnect(&_deleteSignalMapper, SLOT(map()));
removeRow(line);
_displayedOperations.erase(_displayedOperations.begin()+line);
if (op.fix_cost) _fixCosts--;
if (_inModification || _loadOperations) return;
QCheckBox* checkBox = qobject_cast<QCheckBox*> (_deleteSignalMapper.mapping(id));
if (checkBox->checkState() == Qt::Unchecked) return;
it = std::find(_displayedOperations.begin(), _displayedOperations.end(), id);
if (it == _displayedOperations.end()) return ;
if (QMessageBox::question(0, "KissCount", _("Are you sure want to delete : \n")+it->description, QMessageBox::Yes|QMessageBox::No) == QMessageBox::No)
{
checkBox->setCheckState(Qt::Unchecked);
return;
}
op = *it; // Make a copy
rows.push_back(row);
}
}
void GridAccount::OnSuppr(void)
{
QModelIndexList selected = selectedIndexes();
std::vector<int> rows;
std::vector<int>::iterator it;
int row;
for (int i = 0; i < selected.size(); ++i)
{
row = selected[i].row();
it = std::find(rows.begin(), rows.end(), row);
if (it != rows.end())
continue;
OnDeleteClicked(_displayedOperations[row].id);
rows.push_back(row);
}
}
src/view/grid/GridAccount.hpp
4343
4444
4545
46
46
4747
4848
4949
......
7373
7474
7575
76
7677
7778
7879
......
8990
9091
9192
92
93
9394
9495
9596
public:
class OperationNotFound {};
enum {TREE, DESCRIPTION, OP_DATE, DEBIT, CREDIT, CATEGORY, TAG, ACCOUNT, OP_DELETE, CHECKED, NUMBER_COLS_OPS};
enum {TREE, DESCRIPTION, OP_DATE, DEBIT, CREDIT, CATEGORY, TAG, ACCOUNT, CHECKED, NUMBER_COLS_OPS};
GridAccount(KissCount* kiss, KissPanel *parent,
bool canAddOperation, bool setWeek, bool synchronizeWithDatabase);
void OnDeleteClicked(int id);
void OnCtrlT(void);
void OnCtrlR(void);
void OnSuppr(void);
private:
KissPanel* _parent;
bool _inModification;
QCompleter* _completer;
int _transfertCompletionIndex;
QShortcut* _ctrlT, *_ctrlR;
QShortcut* _ctrlT, *_ctrlR, *_suppr;
void SetWeek(int week, int line);
void ResetWeeks();

Archive Download the corresponding diff file