File indexing completed on 2024-05-19 05:08:23
0001 /* 0002 SPDX-FileCopyrightText: 2021 Thomas Baumgart <tbaumgart@kde.org> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef LEDGERVIEWSETTINGS_H 0007 #define LEDGERVIEWSETTINGS_H 0008 0009 // ---------------------------------------------------------------------------- 0010 // QT Includes 0011 0012 #include <QObject> 0013 #include <QScopedPointer> 0014 0015 // ---------------------------------------------------------------------------- 0016 // KDE Includes 0017 0018 // ---------------------------------------------------------------------------- 0019 // Project Includes 0020 0021 #include "ledgersortorder.h" 0022 #include "mymoneyenums.h" 0023 #include "widgetenums.h" 0024 0025 class LedgerViewSettingsPrivate; 0026 class LedgerViewSettings : public QObject 0027 { 0028 Q_OBJECT 0029 0030 public: 0031 typedef enum { 0032 SortOrderStd, 0033 SortOrderSearch, 0034 SortOrderInvest = SortOrderStd, // in future use separate sort order 0035 SortOrderReconcileStd, 0036 SortOrderReconcileInvest, 0037 } SortOrderType; 0038 0039 typedef enum { 0040 DontShowReconciliationHeader, 0041 ShowLastReconciliationHeader, 0042 ShowAllReconciliationHeader, 0043 } ReconciliationHeader; 0044 0045 static LedgerViewSettings* instance(); 0046 ~LedgerViewSettings(); 0047 0048 bool showLedgerLens() const; 0049 bool showTransactionDetails() const; 0050 bool showAllSplits() const; 0051 ReconciliationHeader showReconciliationEntries() const; 0052 bool hideReconciledTransactions() const; 0053 QDate hideTransactionsBefore() const; 0054 LedgerSortOrder sortOrder(SortOrderType type) const; 0055 void flushChanges(); 0056 0057 public Q_SLOTS: 0058 void setShowLedgerLens(bool show); 0059 void setShowTransactionDetails(bool show); 0060 void setShowAllSplits(bool show); 0061 0062 /** 0063 * This method changes the global filter for 0064 * all instances of LedgerFilterBase and derived objects to 0065 * filter out any transaction with a post date prior to 0066 * @a date. If @a date is an invalid QDate, then the 0067 * filter is inactive. 0068 */ 0069 void setHideTransactionsBefore(const QDate& date); 0070 0071 /** 0072 * This method changes the global filter for 0073 * all instances of LedgerFilterBase and derived objects to 0074 * filter out any reconciled transaction. 0075 */ 0076 void setHideReconciledTransactions(bool hide); 0077 0078 /** 0079 * Controls visibility of the reconciliation entries in the ledgers 0080 */ 0081 void setShowReconciliationEntries(LedgerViewSettings::ReconciliationHeader showHeader); 0082 0083 void setSortOrder(LedgerViewSettings::SortOrderType type, const QString& sortOrder); 0084 0085 Q_SIGNALS: 0086 void settingsChanged(); 0087 0088 private: 0089 LedgerViewSettings(); 0090 LedgerViewSettingsPrivate* const d; 0091 0092 Q_DISABLE_COPY(LedgerViewSettings) 0093 }; 0094 0095 #endif // LEDGERVIEWSETTINGS_H