1 | /* This file is part of the KDE project |
2 | Copyright (C) 2009 Dag Andersen <danders@get2net.dk> |
3 | |
4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. |
8 | |
9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 | Boston, MA 02110-1301, USA. |
18 | */ |
19 | |
20 | #ifndef KPTCONFIGBASE_H |
21 | #define KPTCONFIGBASE_H |
22 | |
23 | #include "kpttask.h" |
24 | |
25 | class KLocale; |
26 | |
27 | namespace KPlato |
28 | { |
29 | |
30 | class KPLATOKERNEL_EXPORT ConfigBase : public QObject |
31 | { |
32 | Q_OBJECT |
33 | public: |
34 | ConfigBase(); |
35 | virtual ~ConfigBase(); |
36 | |
37 | void setReadWrite(bool readWrite) { m_readWrite = readWrite; } |
38 | Task &taskDefaults() const { |
39 | const_cast<ConfigBase*>( this )->setDefaultValues( *m_taskDefaults ); |
40 | return *m_taskDefaults; |
41 | } |
42 | void setTaskDefaults( Task * ); |
43 | |
44 | virtual void setDefaultValues( Task & ) {} |
45 | virtual QPair<int, int> durationUnitRange() const { return QPair<int, int>(); } |
46 | virtual int minimumDurationUnit() const { return Duration::Unit_h; } |
47 | virtual int maximumDurationUnit() const { return Duration::Unit_Y; } |
48 | |
49 | QBrush summaryTaskLevelColor( int level ) const; |
50 | virtual bool summaryTaskLevelColorsEnabled() const; |
51 | virtual QBrush summaryTaskDefaultColor() const; |
52 | virtual QBrush summaryTaskLevelColor_1() const; |
53 | virtual QBrush summaryTaskLevelColor_2() const; |
54 | virtual QBrush summaryTaskLevelColor_3() const; |
55 | virtual QBrush summaryTaskLevelColor_4() const; |
56 | |
57 | virtual QBrush taskNormalColor() const; |
58 | virtual QBrush taskErrorColor() const; |
59 | virtual QBrush taskCriticalColor() const; |
60 | virtual QBrush taskFinishedColor() const; |
61 | |
62 | virtual QBrush milestoneNormalColor() const; |
63 | virtual QBrush milestoneErrorColor() const; |
64 | virtual QBrush milestoneCriticalColor() const; |
65 | virtual QBrush milestoneFinishedColor() const; |
66 | |
67 | void setLocale( KLocale *locale ); |
68 | const KLocale *locale() const; |
69 | KLocale *locale(); |
70 | |
71 | static QBrush gradientBrush( const QColor &c ); |
72 | |
73 | protected: |
74 | bool m_readWrite; |
75 | |
76 | private: |
77 | Task *m_taskDefaults; |
78 | |
79 | KLocale *m_locale; |
80 | |
81 | }; |
82 | |
83 | } //KPlato namespace |
84 | |
85 | #endif // CONFIGBASE_H |
86 | |