Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/widgets/kmymoneyreportconfigtabimpl.h
Show All 15 Lines | 1 | /* This file is part of the KDE project | |||
---|---|---|---|---|---|
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
17 | Boston, MA 02110-1301, USA. | 17 | Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #ifndef KMYMONEYREPORTCONFIGTABIMPL_H | 20 | #ifndef KMYMONEYREPORTCONFIGTABIMPL_H | ||
21 | #define KMYMONEYREPORTCONFIGTABIMPL_H | 21 | #define KMYMONEYREPORTCONFIGTABIMPL_H | ||
22 | 22 | | |||
23 | #include <QWidget> | 23 | #include <QWidget> | ||
24 | #include <QDoubleValidator> | ||||
25 | | ||||
26 | class DateRangeDlg; | ||||
24 | 27 | | |||
25 | namespace Ui | 28 | namespace Ui | ||
26 | { | 29 | { | ||
27 | class kMyMoneyReportConfigTab1Decl; | 30 | class kMyMoneyReportConfigTab1Decl; | ||
28 | class kMyMoneyReportConfigTab2Decl; | 31 | class kMyMoneyReportConfigTab2Decl; | ||
29 | class kMyMoneyReportConfigTab3Decl; | 32 | class kMyMoneyReportConfigTab3Decl; | ||
30 | class kMyMoneyReportConfigTabChartDecl; | 33 | class kMyMoneyReportConfigTabChartDecl; | ||
31 | }; | 34 | class kMyMoneyReportConfigTabRangeDecl; | ||
35 | } | ||||
32 | 36 | | |||
33 | class kMyMoneyReportConfigTab1Decl : public QWidget | 37 | class kMyMoneyReportConfigTab1Decl : public QWidget | ||
34 | { | 38 | { | ||
35 | public: | 39 | public: | ||
36 | kMyMoneyReportConfigTab1Decl(QWidget *parent); | 40 | kMyMoneyReportConfigTab1Decl(QWidget *parent); | ||
37 | virtual ~kMyMoneyReportConfigTab1Decl(); | 41 | virtual ~kMyMoneyReportConfigTab1Decl(); | ||
38 | private: | 42 | private: | ||
39 | Ui::kMyMoneyReportConfigTab1Decl* ui; | 43 | Ui::kMyMoneyReportConfigTab1Decl* ui; | ||
Show All 14 Lines | 57 | public: | |||
54 | kMyMoneyReportConfigTab3Decl(QWidget *parent); | 58 | kMyMoneyReportConfigTab3Decl(QWidget *parent); | ||
55 | virtual ~kMyMoneyReportConfigTab3Decl(); | 59 | virtual ~kMyMoneyReportConfigTab3Decl(); | ||
56 | private: | 60 | private: | ||
57 | Ui::kMyMoneyReportConfigTab3Decl* ui; | 61 | Ui::kMyMoneyReportConfigTab3Decl* ui; | ||
58 | }; | 62 | }; | ||
59 | 63 | | |||
60 | class kMyMoneyReportConfigTabChartDecl : public QWidget | 64 | class kMyMoneyReportConfigTabChartDecl : public QWidget | ||
61 | { | 65 | { | ||
66 | Q_OBJECT | ||||
62 | public: | 67 | public: | ||
63 | kMyMoneyReportConfigTabChartDecl(QWidget *parent); | 68 | kMyMoneyReportConfigTabChartDecl(QWidget *parent); | ||
64 | virtual ~kMyMoneyReportConfigTabChartDecl(); | 69 | virtual ~kMyMoneyReportConfigTabChartDecl(); | ||
65 | private: | | |||
66 | Ui::kMyMoneyReportConfigTabChartDecl* ui; | 70 | Ui::kMyMoneyReportConfigTabChartDecl* ui; | ||
71 | private slots: | ||||
72 | void slotChartTypeChanged(int index); | ||||
73 | }; | ||||
74 | | ||||
75 | class kMyMoneyReportConfigTabRangeDecl : public QWidget | ||||
76 | { | ||||
77 | Q_OBJECT | ||||
78 | public: | ||||
79 | kMyMoneyReportConfigTabRangeDecl(QWidget *parent); | ||||
80 | virtual ~kMyMoneyReportConfigTabRangeDecl(); | ||||
81 | Ui::kMyMoneyReportConfigTabRangeDecl* ui; | ||||
82 | DateRangeDlg *m_dateRange; | ||||
83 | void setRangeLogarythmic(bool set); | ||||
84 | private: | ||||
85 | enum EDimension { eRangeStart = 0, eRangeEnd, eMajorTick, eMinorTick}; | ||||
86 | private slots: | ||||
87 | void slotEditingFinished(EDimension dim); | ||||
88 | void slotEditingFinishedStart(); | ||||
89 | void slotEditingFinishedEnd(); | ||||
90 | void slotEditingFinishedMajor(); | ||||
91 | void slotEditingFinishedMinor(); | ||||
92 | void slotDataLockChanged(int index); | ||||
67 | }; | 93 | }; | ||
68 | 94 | | |||
95 | class MyDoubleValidator : public QDoubleValidator | ||||
96 | { | ||||
97 | public: | ||||
98 | MyDoubleValidator(int decimals, QObject * parent = 0) : | ||||
99 | QDoubleValidator(0, 0, decimals, parent) | ||||
100 | { | ||||
101 | } | ||||
102 | | ||||
103 | QValidator::State validate(QString &s, int &i) const | ||||
104 | { | ||||
105 | Q_UNUSED(i); | ||||
106 | if (s.isEmpty() || s == "-") { | ||||
107 | return QValidator::Intermediate; | ||||
108 | } | ||||
109 | | ||||
110 | QChar decimalPoint = locale().decimalPoint(); | ||||
111 | | ||||
112 | if(s.indexOf(decimalPoint) != -1) { | ||||
113 | int charsAfterPoint = s.length() - s.indexOf(decimalPoint) - 1; | ||||
114 | | ||||
115 | if (charsAfterPoint > decimals()) { | ||||
116 | return QValidator::Invalid; | ||||
117 | } | ||||
118 | } | ||||
119 | | ||||
120 | bool ok; | ||||
121 | locale().toDouble(s, &ok); | ||||
122 | | ||||
123 | if (ok) { | ||||
124 | return QValidator::Acceptable; | ||||
125 | } else { | ||||
126 | return QValidator::Invalid; | ||||
127 | } | ||||
128 | } | ||||
129 | }; | ||||
69 | #endif /* KMYMONEYREPORTCONFIGTABIMPL_H */ | 130 | #endif /* KMYMONEYREPORTCONFIGTABIMPL_H */ | ||
70 | 131 | |