Skip to content

Commit

Permalink
[RFR] : Refactor the Transactions Table
Browse files Browse the repository at this point in the history
  • Loading branch information
aiekick committed Jun 19, 2024
1 parent 05e4f8f commit 0facccd
Show file tree
Hide file tree
Showing 13 changed files with 822 additions and 981 deletions.
8 changes: 4 additions & 4 deletions src/Frontend/Tables/CategoriesTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void CategoriesTable::unload() {
}

bool CategoriesTable::drawMenu() {
if (ADataTable::drawMenu()) {
if (m_drawAccountMenu()) {
m_updateCategories();
return true;
}
Expand All @@ -36,7 +36,7 @@ RowID CategoriesTable::m_getItemRowID(const size_t& vIdx) const {
return 0; // the db row id cant be 0
}

double CategoriesTable::m_getItemAmount(const size_t& vIdx) const {
double CategoriesTable::m_getItemBarAmount(const size_t& vIdx) const {
return m_Categories.at(vIdx).amount;
}

Expand All @@ -46,7 +46,7 @@ void CategoriesTable::m_drawTableContent(const size_t& vIdx, const double& vMaxA
m_drawColumnDebit(e.debit);
m_drawColumnCredit(e.credit);
m_drawColumnAmount(e.amount);
m_drawColumnBars(e.amount, vMaxAmount);
m_drawColumnBars(e.amount, vMaxAmount, 100.0f);
}

void CategoriesTable::m_setupColumns() {
Expand All @@ -63,7 +63,7 @@ void CategoriesTable::m_drawContextMenuContent() {
CTOOL_DEBUG_BREAK;
}

void CategoriesTable::m_doActionOnDblClick() {
void CategoriesTable::m_doActionOnDblClick(const size_t& vIdx, const RowID& vRowID) {
CTOOL_DEBUG_BREAK;
}

Expand Down
10 changes: 5 additions & 5 deletions src/Frontend/Tables/CategoriesTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ class CategoriesTable : public ADataTable {
CategoriesTable();
~CategoriesTable();

bool load();
void unload();
bool drawMenu();
bool load() final;
void unload() final;
bool drawMenu() final;

protected:
size_t m_getItemsCount() const final;
RowID m_getItemRowID(const size_t& vIdx) const final;
double m_getItemAmount(const size_t& vIdx) const final;
double m_getItemBarAmount(const size_t& vIdx) const final;
void m_drawTableContent(const size_t& vIdx, const double& vMaxAmount) final;
void m_setupColumns() final;
void m_drawContextMenuContent() final;
void m_doActionOnDblClick() final;
void m_doActionOnDblClick(const size_t& vIdx, const RowID& vRowID) final;

private:
void m_updateCategories();
Expand Down
8 changes: 4 additions & 4 deletions src/Frontend/Tables/EntitiesTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void EntitiesTable::unload() {
}

bool EntitiesTable::drawMenu() {
if (ADataTable::drawMenu()) {
if (m_drawAccountMenu()) {
m_updateEntities();
return true;
}
Expand All @@ -36,7 +36,7 @@ RowID EntitiesTable::m_getItemRowID(const size_t& vIdx) const {
return 0; // the db row id cant be 0
}

double EntitiesTable::m_getItemAmount(const size_t& vIdx) const {
double EntitiesTable::m_getItemBarAmount(const size_t& vIdx) const {
return m_Entities.at(vIdx).amount;
}

Expand All @@ -46,7 +46,7 @@ void EntitiesTable::m_drawTableContent(const size_t& vIdx, const double& vMaxAmo
m_drawColumnDebit(e.debit);
m_drawColumnCredit(e.credit);
m_drawColumnAmount(e.amount);
m_drawColumnBars(e.amount, vMaxAmount);
m_drawColumnBars(e.amount, vMaxAmount, 100.0f);
}

void EntitiesTable::m_setupColumns() {
Expand All @@ -63,7 +63,7 @@ void EntitiesTable::m_drawContextMenuContent() {
CTOOL_DEBUG_BREAK;
}

void EntitiesTable::m_doActionOnDblClick() {
void EntitiesTable::m_doActionOnDblClick(const size_t& vIdx, const RowID& vRowID) {
CTOOL_DEBUG_BREAK;
}

Expand Down
10 changes: 5 additions & 5 deletions src/Frontend/Tables/EntitiesTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ class EntitiesTable : public ADataTable {
EntitiesTable();
~EntitiesTable();

bool load();
void unload();
bool drawMenu();
bool load() final;
void unload() final;
bool drawMenu() final;

protected:
size_t m_getItemsCount() const final;
RowID m_getItemRowID(const size_t& vIdx) const final;
double m_getItemAmount(const size_t& vIdx) const final;
double m_getItemBarAmount(const size_t& vIdx) const final;
void m_drawTableContent(const size_t& vIdx, const double& vMaxAmount) final;
void m_setupColumns() final;
void m_drawContextMenuContent() final;
void m_doActionOnDblClick() final;
void m_doActionOnDblClick(const size_t& vIdx, const RowID& vRowID) final;

private:
void m_updateEntities();
Expand Down
8 changes: 4 additions & 4 deletions src/Frontend/Tables/OperationsTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void OperationsTable::unload() {
}

bool OperationsTable::drawMenu() {
if (ADataTable::drawMenu()) {
if (m_drawAccountMenu()) {
m_updateOperations();
return true;
}
Expand All @@ -36,7 +36,7 @@ RowID OperationsTable::m_getItemRowID(const size_t& vIdx) const {
return 0; // the db row id cant be 0
}

double OperationsTable::m_getItemAmount(const size_t& vIdx) const {
double OperationsTable::m_getItemBarAmount(const size_t& vIdx) const {
return m_Operations.at(vIdx).amount;
}

Expand All @@ -46,7 +46,7 @@ void OperationsTable::m_drawTableContent(const size_t& vIdx, const double& vMaxA
m_drawColumnDebit(e.debit);
m_drawColumnCredit(e.credit);
m_drawColumnAmount(e.amount);
m_drawColumnBars(e.amount, vMaxAmount);
m_drawColumnBars(e.amount, vMaxAmount, 100.0f);
}

void OperationsTable::m_setupColumns() {
Expand All @@ -63,7 +63,7 @@ void OperationsTable::m_drawContextMenuContent() {
CTOOL_DEBUG_BREAK;
}

void OperationsTable::m_doActionOnDblClick() {
void OperationsTable::m_doActionOnDblClick(const size_t& vIdx, const RowID& vRowID) {
CTOOL_DEBUG_BREAK;
}

Expand Down
10 changes: 5 additions & 5 deletions src/Frontend/Tables/OperationsTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ class OperationsTable : public ADataTable {
OperationsTable();
~OperationsTable();

bool load();
void unload();
bool drawMenu();
bool load() final;
void unload() final;
bool drawMenu() final;

protected:
size_t m_getItemsCount() const final;
RowID m_getItemRowID(const size_t& vIdx) const final;
double m_getItemAmount(const size_t& vIdx) const final;
double m_getItemBarAmount(const size_t& vIdx) const final;
void m_drawTableContent(const size_t& vIdx, const double& vMaxAmount) final;
void m_setupColumns() final;
void m_drawContextMenuContent() final;
void m_doActionOnDblClick() final;
void m_doActionOnDblClick(const size_t& vIdx, const RowID& vRowID) final;

private:
void m_updateOperations();
Expand Down
Loading

0 comments on commit 0facccd

Please sign in to comment.