1 | #ifndef OPTIONSTAB_H
|
---|
2 | #define OPTIONSTAB_H
|
---|
3 |
|
---|
4 | #include <qcstring.h>
|
---|
5 | #include <qstring.h>
|
---|
6 | #include <qobject.h>
|
---|
7 | #include <qptrlist.h>
|
---|
8 |
|
---|
9 | struct Options;
|
---|
10 | class Icon;
|
---|
11 | class QWidget;
|
---|
12 | class PsiCon;
|
---|
13 |
|
---|
14 | class OptionsTab : public QObject
|
---|
15 | {
|
---|
16 | Q_OBJECT
|
---|
17 | public:
|
---|
18 | OptionsTab(QObject *parent, const char *name = 0);
|
---|
19 | OptionsTab(QObject *parent, QCString id, QCString parentId, QString name, QString desc, QString tabIconName = QString::null, QString iconName = QString::null);
|
---|
20 | ~OptionsTab();
|
---|
21 |
|
---|
22 | virtual QCString id() const; // Unique identifier, i.e. "plugins_misha's_cool-plugin"
|
---|
23 | virtual QCString parentId() const; // Identifier of parent tab, i.e. "general"
|
---|
24 |
|
---|
25 | virtual QString tabName() const; // "General"
|
---|
26 | virtual Icon *tabIcon() const; // default implementation returns 0
|
---|
27 |
|
---|
28 | virtual QString name() const; // "Roster"
|
---|
29 | virtual QString desc() const; // "You can configure your roster here"
|
---|
30 | virtual Icon *icon() const; // default implementation returns 0
|
---|
31 |
|
---|
32 | virtual QWidget *widget() = 0; // Actual widget that contains checkboxes, pushbuttons, etc.
|
---|
33 | // the widget is reparented after this call
|
---|
34 | virtual bool stretchable() const; // return 'true' if widget() is stretchable and wants a lot of space
|
---|
35 |
|
---|
36 | signals:
|
---|
37 | void dataChanged();
|
---|
38 | //void addWidgetChangedSignal(QString widgetName, QCString signal);
|
---|
39 | void noDirty(bool);
|
---|
40 | void connectDataChanged(QWidget *);
|
---|
41 |
|
---|
42 | public slots:
|
---|
43 | virtual void setData(PsiCon *, QWidget *parentDialog);
|
---|
44 | virtual void applyOptions(Options *opt);
|
---|
45 | virtual void restoreOptions(const Options *opt);
|
---|
46 | virtual void tabAdded(OptionsTab *tab); // called when tab 'tab' specifies this tab as parent
|
---|
47 |
|
---|
48 | private:
|
---|
49 | QCString v_id, v_parentId;
|
---|
50 | QString v_name, v_desc, v_tabIconName, v_iconName;
|
---|
51 | };
|
---|
52 |
|
---|
53 | class MetaOptionsTab : public OptionsTab
|
---|
54 | {
|
---|
55 | Q_OBJECT
|
---|
56 | public:
|
---|
57 | MetaOptionsTab(QObject *parent, const char *name = 0);
|
---|
58 | MetaOptionsTab(QObject *parent, QCString id, QCString parentId, QString name, QString desc, QString tabIconName = QString::null, QString iconName = QString::null);
|
---|
59 | ~MetaOptionsTab();
|
---|
60 |
|
---|
61 | QWidget *widget();
|
---|
62 | void applyOptions(Options *opt);
|
---|
63 | void restoreOptions(const Options *opt);
|
---|
64 |
|
---|
65 | void setData(PsiCon *, QWidget *);
|
---|
66 | bool stretchable() const { return true; }
|
---|
67 |
|
---|
68 | void addTab(OptionsTab *);
|
---|
69 |
|
---|
70 | private:
|
---|
71 | void init();
|
---|
72 | QWidget *w;
|
---|
73 | QPtrList<OptionsTab> tabs;
|
---|
74 | };
|
---|
75 |
|
---|
76 | #endif
|
---|