Refactored JsonParser to not use roles (or their names) directly.
This commit is contained in:
@ -13,10 +13,9 @@ static QHash<int, QByteArray> ROLE_NAMES = {{NameRole, "Name"},
|
||||
{InfoRole, "Info"},
|
||||
{AmountRole, "Amount"},
|
||||
{FactorRole, "Factor"}};
|
||||
// TODO ? use a data structure containing the type information of each column
|
||||
// ([QString, QString, QString, int, double], {{NameRole, QString},...})
|
||||
// instead of INT_COLUMNS,...
|
||||
static QList<QString> INT_COLUMNS = {"Amount", "Factor"};
|
||||
static QList<UserRoles> STRING_ROLES = {NameRole, DescriptionRole, InfoRole};
|
||||
static QList<UserRoles> INT_ROLES = {AmountRole};
|
||||
static QList<UserRoles> DOUBLE_ROLES = {FactorRole};
|
||||
|
||||
/// JSON keys
|
||||
static const QString ITEM_KEY_STRING = "items";
|
||||
@ -24,6 +23,7 @@ static const QString ITEM_KEY_STRING = "items";
|
||||
/// file naming
|
||||
static const QString ITEM_FILE_NAME = ITEM_KEY_STRING + ".json";
|
||||
|
||||
/// functions
|
||||
static int GET_ROLE_FOR_COLUMN(const int column) {
|
||||
switch (column) {
|
||||
case 0:
|
||||
|
||||
Reference in New Issue
Block a user