KissCount

KissCount Commit Details

Date:2014-11-10 13:50:00 (5 years 8 months ago)
Author:Grégory Soutadé
Branch:dev, master, qt5
Commit:459e07ee1114d4dddb1723580645182ba5369a4c
Parents: 57d4b90182b0cadc310ebe9e7f28b1205f8a22ec
Message:Second version

Changes:
Msrc/model/Database.cpp (1 diff)
Msrc/view/AccountPanel.cpp (1 diff)
Msrc/view/SearchBanner.cpp (1 diff)
Msrc/view/SearchPanel.cpp (3 diffs)
Msrc/view/SearchPanel.hpp (2 diffs)
Msrc/view/grid/GridAccount.cpp (6 diffs)

File differences

src/model/Database.cpp
14191419
14201420
14211421
1422
1422
14231423
14241424
14251425
if (tags.size())
{
if (firstCond) req += " AND " ; else firstCond = true;
req += "category IN ('";
req += "tag IN ('";
it = tags.begin();
req += QString::number(*it);
it++;
src/view/AccountPanel.cpp
191191
192192
193193
194
195
194
195
196
197
196198
197199
198200
{
delete[] _categoriesValues;
delete[] _categories;
delete[] _tagsValues;
delete[] _tags;
if (_tagsValues)
delete[] _tagsValues;
if (_tags)
delete[] _tags;
delete[] _accounts;
}
src/view/SearchBanner.cpp
228228
229229
230230
231
232
233
231
232
233
234234
235235
236236
if (_category->item(i)->checkState() == Qt::Checked)
categories.push_back((i) ? user->_categories[i-1].id : 0);
for(i=0; i<user->GetTagsNumber()+1; i++)
if (_tag->item(i)->checkState() == Qt::Checked)
tags.push_back((i) ? user->_tags[i-1].id : 0);
for(i=0; i<user->GetTagsNumber(); i++)
if (_tag->item(i+1)->checkState() == Qt::Checked)
tags.push_back(user->_tags[i].id);
types |= (_optype->item(0)->checkState() == Qt::Checked) ? Database::FIX_OP : 0;
types |= (_optype->item(1)->checkState() == Qt::Checked) ? Database::NON_FIX_OP : 0;
src/view/SearchPanel.cpp
5252
5353
5454
55
5556
5657
5758
5859
60
5961
6062
6163
......
7274
7375
7476
77
7578
7679
7780
......
255258
256259
257260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
258306
259307
260308
_changeAccountButton = new QPushButton(_("Change account"));
_changeCategoryButton = new QPushButton(_("Change category"));
_changeTagButton = new QPushButton(_("Change tag"));
_renameButton = new QPushButton(_("Rename"));
connect(_changeAccountButton, SIGNAL(clicked()), this, SLOT(OnButtonChangeAccount()));
connect(_changeCategoryButton, SIGNAL(clicked()), this, SLOT(OnButtonChangeCategory()));
connect(_changeTagButton, SIGNAL(clicked()), this, SLOT(OnButtonChangeTag()));
connect(_renameButton, SIGNAL(clicked()), this, SLOT(OnButtonRename()));
_categories = new QString[user->GetCategoriesNumber()] ;
vbox2->addWidget(_changeAccountButton);
vbox2->addWidget(_changeCategoryButton);
vbox2->addWidget(_changeTagButton);
vbox2->addWidget(_renameButton);
hbox->addLayout(vbox2);
_wxUI->NeedReload();
}
static void ChangeTag(Operation* op, void** params)
{
int* tag = (int*) params[0];
op->tag = *tag;
}
void SearchPanel::OnButtonChangeTag()
{
int i, a;
std::vector<int> rows;
User* user = _kiss->GetUser();
QStringList tags;
std::vector<Operation>::iterator it;
QString res;
int tag;
void * params[] = {&tag};
if (!_operations) return;
_grid->GetSelectedOperations(&rows);
tags << _("None");
for(i=0; i < user->GetTagsNumber(); i++)
tags << _(user->_tags[i].name.toStdString().c_str());
res = QInputDialog::getItem(0, "KissCount", _("Choose a new tag"), tags, 0, false);
if (res.length())
{
a = tags.indexOf(res);
tag = user->_tags[a].id ;
}
else
{
tag = 0;
}
_grid->MassUpdate(rows, true, ChangeTag, params);
UpdateCostRepartition();
_wxUI->NeedReload();
}
static void ChangeName(Operation* op, void** params)
{
QString* description = (QString*) params[0];
src/view/SearchPanel.hpp
4545
4646
4747
48
4948
5049
5150
5251
5352
53
5454
5555
5656
......
6363
6464
6565
66
66
6767
6868
6969
void OnShow();
private slots:
/* void OnEnter(wxCommandEvent& event); */
void OnButtonSearch();
void OnOperationModified();
void OnButtonChangeAccount();
void OnButtonChangeCategory();
void OnButtonChangeTag();
void OnButtonRename();
private:
QString* _categories;
int *_categoriesValues;
std::map<int, int> _categoriesIndexes;
QPushButton* _searchButton, *_renameButton, *_changeAccountButton, *_changeCategoryButton;
QPushButton* _searchButton, *_renameButton, *_changeAccountButton, *_changeCategoryButton, *_changeTagButton;
static void OnEnter(void* caller);
};
src/view/grid/GridAccount.cpp
121121
122122
123123
124
124
125
125126
126127
127128
......
246247
247248
248249
249
250
250251
251252
252253
......
405406
406407
407408
408
409
410
411
412
409413
410414
411415
......
448452
449453
450454
455
451456
452457
453458
......
10341039
10351040
10361041
1042
10371043
10381044
10391045
......
11171123
11181124
11191125
1126
1127
1128
1129
1130
11201131
11211132
11221133
}
_tags = new QString[user->GetTagsNumber()] ;
for(i=0, tagIt = user->_tags.begin();
_tags[0] = _("No Tag");
for(i=1, tagIt = user->_tags.begin();
tagIt != user->_tags.end();
tagIt++, i++)
{
ChoiceDelegate* categoryEditor = new ChoiceDelegate(this, _categories, user->GetCategoriesNumber()-1);
setItemDelegateForColumn(CATEGORY, categoryEditor);
ChoiceDelegate* tagEditor = new ChoiceDelegate(this, _tags, user->GetTagsNumber());
ChoiceDelegate* tagEditor = new ChoiceDelegate(this, _tags, user->GetTagsNumber()+1);
setItemDelegateForColumn(TAG, tagEditor);
ChoiceDelegate* accountEditor = new ChoiceDelegate(this, _accounts, _nbAccounts);
if (!fix && !op.meta)
setItem(line, CATEGORY, new QTableWidgetItem(_(cat.name.toStdString().c_str())));
setItem(line, TAG, new QTableWidgetItem(_(tag.name.toStdString().c_str())));
if (tag.id)
setItem(line, TAG, new QTableWidgetItem(_(tag.name.toStdString().c_str())));
else
setItem(line, TAG, new QTableWidgetItem(""));
checkBox = new QCheckBox();
checkBox->setCheckState(Qt::Unchecked);
if (op.meta)
resizeColumnToContents(TREE);
resizeColumnToContents(CATEGORY);
resizeColumnToContents(TAG);
resizeColumnToContents(ACCOUNT);
}
}
catch (User::TagNotFound e)
{
op_complete++;
setItem(row, TAG, new QTableWidgetItem(""));
}
op_complete--;
}
if (need_insertion)
InsertIntoGrid(new_op);
else
{
resizeColumnToContents(CATEGORY);
resizeColumnToContents(TAG);
}
if (new_op.parent)
{

Archive Download the corresponding diff file