summaryrefslogtreecommitdiffstats
path: root/atlantikdesigner/designer/group.h
blob: b1ebf9906f48209e308d9a308ee8770a588abbb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#ifndef GROUP_H
#define GROUP_H

#include <qcolor.h>
#include <qptrlist.h>

#include <kdialogbase.h>

#include <atlantic/estategroup.h>

class KColorButton;
class KLineEdit;
class KListBox;
class KPushButton;

class QComboBox;
class QListBoxItem;
class QSpinBox;
class QVGroupBox;

class ConfigEstateGroup
{
	public:
	ConfigEstateGroup() { init(); }
	ConfigEstateGroup(const QString &name) { setName(name); init(); }
	void init() { setHousePrice(0); setGlobalPrice(0); }

	void setHousePrice(int newPrice) { m_housePrice = newPrice; }
	int housePrice()const { return m_housePrice; }
	void setGlobalPrice(int newGlobalPrice) { m_globalPrice = newGlobalPrice; }
	int globalPrice()const { return m_globalPrice; }
	const QString &rentMath() { return m_rentMath; }
	void setRentMath(const QString &newMath) { m_rentMath = newMath; }
	bool dynamicRent()const { return !m_rentMath.isEmpty(); }
	void setName(const QString &name) { m_name = name; }
	const QString &name() { return m_name; }

	const QColor &fgColor() { return m_fgColor; }
	void setFgColor(const QColor &color) { m_fgColor = color; }
	const QColor &bgColor() { return m_bgColor; }
	void setBgColor(const QColor &color) { m_bgColor = color; }

	private:
	QColor m_fgColor;
	QColor m_bgColor;
	QString m_rentMath;
	int m_housePrice;
	int m_globalPrice;
	QString m_name;
};
typedef QValueList<ConfigEstateGroup> ConfigEstateGroupList;

class GroupEditor : public KDialogBase
{
	Q_OBJECT

	public:
	GroupEditor(ConfigEstateGroupList *, QWidget *parent=0);

	signals:
	void changed();
	void update();

	protected slots:
	virtual void slotOk();
	virtual void slotApply();

	private slots:
	void updateSettings(QListBoxItem *item);
	void fgChanged(const QColor &);
	void bgChanged(const QColor &);
	void housePriceChanged(int);
	void globalPriceChanged(int);
	void rentMathChanged(const QString &);
	void add();
	void remove();
	void selectionChanged();

	private:
	KListBox *groups;
	KLineEdit *rentMathEdit;
	KColorButton *fgButton;
	KColorButton *bgButton;
	QWidget *pricesWidget;
	QWidget *mathWidget;
	QSpinBox *housePrice;
	QSpinBox *globalPrice;
	QVGroupBox *colorGroupBox;
	QVGroupBox *pricesGroupBox;
	QVGroupBox *dynamicGroupBox;
	KPushButton *removeB;

	ConfigEstateGroupList *list;
	ConfigEstateGroupList mylist;

	ConfigEstateGroup *currentGroup();
};

#endif