File indexing completed on 2024-05-12 16:42:19
0001 /* 0002 SPDX-FileCopyrightText: 2017-2018 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef MODELENUMS_H 0007 #define MODELENUMS_H 0008 0009 #include <QHashFunctions> 0010 #include <qnamespace.h> 0011 #include <QMetaType> 0012 0013 namespace eAccountsModel { 0014 enum class Column { 0015 FirstColumnMarker = 0, 0016 Account = 0, // CAUTION! Assumption is being made that Account column number is always 0 and you shouldn't change this 0017 Type, 0018 Tax, 0019 VAT, 0020 CostCenter, 0021 TotalBalance, 0022 PostedValue, 0023 TotalValue, 0024 AccountNumber, 0025 AccountSortCode, 0026 LastColumnMarker, 0027 }; 0028 0029 inline uint qHash(const Column key, uint seed) { 0030 return ::qHash(static_cast<uint>(key), seed); 0031 } 0032 0033 enum class Role { 0034 ID = Qt::UserRole, /**< The account id is stored in this role in column 0 as a string.*/ 0035 Favorite = Qt::UserRole + 1, /**< The 'account is favorite' property is stored in this role in column 0 as a bool.*/ 0036 Account = Qt::UserRole + 2, /**< The MyMoneyAccount is stored in this role in column 0.*/ 0037 Balance = Qt::UserRole + 3, /**< The account balance is stored in this role in column 0 as a MyMoneyMoney object.*/ 0038 Value = Qt::UserRole + 4, /**< The account value (the balance converted to base currency) is stored in this role in column 0 as a MyMoneyMoney object.*/ 0039 TotalValue = Qt::UserRole + 5, /**< The account total value (the value of the account and of child accounts) is stored in this role in column 0 as a MyMoneyMoney object.*/ 0040 DisplayOrder = Qt::UserRole + 9, /**< This role is used by the filtering proxies to order the accounts for displaying.*/ 0041 FullName = Qt::UserRole + 10, /**< This role is used to provide the full pathname of the account */ 0042 }; 0043 0044 inline uint qHash(const Role key, uint seed) { 0045 return ::qHash(static_cast<uint>(key), seed); 0046 } 0047 } 0048 0049 namespace eLedgerModel { 0050 enum class Column { 0051 Number = 0, 0052 Date, 0053 Security, 0054 CostCenter, 0055 Detail, 0056 Reconciliation, 0057 Payment, 0058 Deposit, 0059 Quantity, 0060 Price, 0061 Amount, 0062 Value, 0063 Balance, 0064 0065 // insert new columns above this line 0066 LastColumn 0067 }; 0068 0069 enum class Role { 0070 // Roles returning values 0071 PostDate = Qt::UserRole, 0072 PayeeName, 0073 Account, 0074 CounterAccount, 0075 SplitCount, 0076 Reconciliation, 0077 ReconciliationShort, 0078 ReconciliationLong, 0079 SplitShares, 0080 ShareAmount, 0081 ShareAmountSuffix, 0082 SplitValue, 0083 Memo, 0084 SingleLineMemo, 0085 Number, 0086 Erroneous, 0087 Import, 0088 Split, 0089 Transaction, 0090 0091 // Roles returning ids 0092 TransactionId, 0093 SplitId, 0094 TransactionSplitId, 0095 PayeeId, 0096 AccountId, 0097 CounterAccountId, 0098 CostCenterId, 0099 ScheduleId, 0100 TransactionCommodity, 0101 0102 // A pseudo role to emit the dataChanged() signal when 0103 // used with setData() 0104 EmitDataChanged, 0105 0106 }; 0107 } 0108 0109 /** 0110 * Make it possible to hold eAccountsModel::Column objects inside @ref QVariant objects. 0111 */ 0112 Q_DECLARE_METATYPE(eAccountsModel::Column) 0113 0114 #endif