summaryrefslogtreecommitdiffstats
path: root/noatun/library/noatun/pref.h
blob: fe29fdf135a97306be2944c7969e67a15c4851a7 (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
#ifndef NOATUNPREF_H
#define NOATUNPREF_H

#include <kdialogbase.h>
#include <tqptrlist.h>
#include <kdemacros.h>

class CModule;

/**
 * Noatun configuration dialog
 **/
class NoatunPreferences : public KDialogBase
{
Q_OBJECT
  TQ_OBJECT
friend class CModule;

public:
	/**
	 * @internal
	 **/
	NoatunPreferences(TQWidget *);

public:
	/**
	 * Display noatun preferences dialog
	 **/
	virtual void show();
	/**
	 * Display noatun preferences dialog showing @p module
	 * Useful if you want to display your own plugin configuration tab
	 **/
	virtual void show(CModule *module);

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

private:
	void add(CModule *);
	void remove(CModule *);

private:
	class NoatunPreferencesPrivate;
	NoatunPreferencesPrivate *d;

	TQPtrList<CModule> mModules;
};

/**
 * @short Base class for a configuration sheet that is shown in preferences dialog
 *
 * Create your GUI in constructor, reimplement reopen() and save() and
 * you're all set.
 **/
class KDE_EXPORT CModule : public TQWidget
{
Q_OBJECT
  TQ_OBJECT

public:
	/**
	 * arguments are short and long descriptions
	 * for this module, respectively
	 *
	 * parent is the object that is this modules virtual-parent.
	 * When that is deleted, this also will go away, automagically.
	 **/
	CModule(const TQString &name, const TQString &description, const TQString &icon, TQObject *parent=0);

	virtual ~CModule();

public slots:
	/**
	 * save all your options, and apply them
	 **/
	virtual void save() {}
	/**
	 * reload all options (e.g., read config files)
	 **/
	virtual void reopen() {}

private slots:
	void ownerDeleted();

private:
	class CModulePrivate;
	CModulePrivate *d;
};


#endif // NOATUNPREF_H