File indexing completed on 2024-06-16 04:46:41
0001 /* This file is part of the KDE project 0002 SPDX-FileCopyrightText: 2009 Laurent Montel <montel@kde.org> 0003 SPDX-FileCopyrightText: 2017 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com> 0004 SPDX-FileCopyrightText: 2018 Michael Kiefer <Michael-Kiefer@web.de> 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef REPORTTABIMPL_H 0009 #define REPORTTABIMPL_H 0010 0011 #include <QWidget> 0012 #include <QDoubleValidator> 0013 0014 class DateRangeDlg; 0015 0016 namespace Ui 0017 { 0018 class ReportTabGeneral; 0019 class ReportTabRowColPivot; 0020 class ReportTabRowColQuery; 0021 class ReportTabChart; 0022 class ReportTabRange; 0023 class ReportTabCapitalGain; 0024 class ReportTabPerformance; 0025 } 0026 0027 class ReportTabGeneral : public QWidget 0028 { 0029 Q_DISABLE_COPY(ReportTabGeneral) 0030 0031 public: 0032 explicit ReportTabGeneral(QWidget *parent); 0033 ~ReportTabGeneral(); 0034 0035 Ui::ReportTabGeneral* ui; 0036 }; 0037 0038 class ReportTabRowColPivot : public QWidget 0039 { 0040 Q_DISABLE_COPY(ReportTabRowColPivot) 0041 0042 public: 0043 explicit ReportTabRowColPivot(QWidget *parent); 0044 ~ReportTabRowColPivot(); 0045 0046 Ui::ReportTabRowColPivot* ui; 0047 }; 0048 0049 class ReportTabRowColQuery : public QWidget 0050 { 0051 Q_OBJECT 0052 Q_DISABLE_COPY(ReportTabRowColQuery) 0053 0054 public: 0055 explicit ReportTabRowColQuery(QWidget *parent); 0056 ~ReportTabRowColQuery(); 0057 0058 Ui::ReportTabRowColQuery* ui; 0059 private Q_SLOTS: 0060 void slotHideTransactionsChanged(bool checked); 0061 }; 0062 0063 class ReportTabChart : public QWidget 0064 { 0065 Q_OBJECT 0066 Q_DISABLE_COPY(ReportTabChart) 0067 0068 public: 0069 explicit ReportTabChart(QWidget *parent); 0070 ~ReportTabChart(); 0071 0072 Ui::ReportTabChart* ui; 0073 void setNegExpenses(bool set); 0074 0075 private Q_SLOTS: 0076 void slotChartTypeChanged(int index); 0077 }; 0078 0079 class ReportTabRange : public QWidget 0080 { 0081 Q_OBJECT 0082 Q_DISABLE_COPY(ReportTabRange) 0083 0084 public: 0085 explicit ReportTabRange(QWidget *parent); 0086 ~ReportTabRange(); 0087 0088 Ui::ReportTabRange* ui; 0089 DateRangeDlg *m_dateRange; 0090 void setRangeLogarythmic(bool set); 0091 private: 0092 enum EDimension { eRangeStart = 0, eRangeEnd, eMajorTick, eMinorTick}; 0093 bool m_logYaxis; 0094 /** 0095 * Update data range start and data range end text validators 0096 * and re-validate the contents of those text fields against the updated validator. 0097 * If re-validation fails, arbitrary default values will be set depending on vertical axis type. 0098 * This function should be called when vertical axis type or labels precision changed. 0099 */ 0100 void updateDataRangeValidators(const int& precision); 0101 private Q_SLOTS: 0102 void slotEditingFinished(ReportTabRange::EDimension dim); 0103 void slotEditingFinishedStart(); 0104 void slotEditingFinishedEnd(); 0105 void slotEditingFinishedMajor(); 0106 void slotEditingFinishedMinor(); 0107 void slotYLabelsPrecisionChanged(const int &value); 0108 void slotDataLockChanged(int index); 0109 }; 0110 0111 class ReportTabCapitalGain : public QWidget 0112 { 0113 Q_OBJECT 0114 Q_DISABLE_COPY(ReportTabCapitalGain) 0115 0116 public: 0117 explicit ReportTabCapitalGain(QWidget *parent); 0118 ~ReportTabCapitalGain(); 0119 0120 Ui::ReportTabCapitalGain* ui; 0121 0122 private Q_SLOTS: 0123 void slotInvestmentSumChanged(int index); 0124 }; 0125 0126 class ReportTabPerformance : public QWidget 0127 { 0128 public: 0129 explicit ReportTabPerformance(QWidget *parent); 0130 ~ReportTabPerformance(); 0131 0132 Ui::ReportTabPerformance* ui; 0133 }; 0134 0135 class MyDoubleValidator : public QDoubleValidator 0136 { 0137 public: 0138 explicit MyDoubleValidator(int decimals, QObject * parent = 0); 0139 0140 QValidator::State validate(QString &s, int &i) const final override; 0141 }; 0142 0143 class MyLogarithmicDoubleValidator : public QDoubleValidator 0144 { 0145 public: 0146 explicit MyLogarithmicDoubleValidator(const int decimals, const qreal defaultValue, QObject *parent = nullptr); 0147 0148 QValidator::State validate(QString &s, int &i) const final Q_DECL_OVERRIDE; 0149 void fixup(QString &input) const final Q_DECL_OVERRIDE; 0150 private: 0151 QString m_defaultText; 0152 }; 0153 #endif /* REPORTTABIMPL_H */ 0154