|
a/src/qtgui/confgui/confgui.h |
|
b/src/qtgui/confgui/confgui.h |
1 |
#ifndef _confgui_h_included_
|
1 |
#ifndef _confgui_h_included_
|
2 |
#define _confgui_h_included_
|
2 |
#define _confgui_h_included_
|
3 |
/* @(#$Id: confgui.h,v 1.3 2007-09-29 09:06:53 dockes Exp $ (C) 2007 J.F.Dockes */
|
3 |
/* @(#$Id: confgui.h,v 1.4 2007-10-01 06:35:31 dockes Exp $ (C) 2007 J.F.Dockes */
|
4 |
|
4 |
|
5 |
#include <string>
|
5 |
#include <string>
|
6 |
|
6 |
|
|
|
7 |
#include <qglobal.h>
|
7 |
#include <qstring.h>
|
8 |
#include <qstring.h>
|
8 |
#include <qwidget.h>
|
9 |
#include <qwidget.h>
|
|
|
10 |
#if QT_VERSION < 0x040000
|
|
|
11 |
#define QHBOXLAYOUT QHBoxLayout
|
|
|
12 |
#define QLISTBOX QListBox
|
|
|
13 |
#else
|
|
|
14 |
#define QHBOXLAYOUT Q3HBoxLayout
|
|
|
15 |
#define QLISTBOX Q3ListBox
|
|
|
16 |
#endif
|
9 |
|
17 |
|
10 |
#include "refcntr.h"
|
18 |
#include "refcntr.h"
|
11 |
|
19 |
|
12 |
using std::string;
|
20 |
using std::string;
|
13 |
|
21 |
|
14 |
class QHBoxLayout;
|
22 |
class QHBOXLAYOUT;
|
15 |
class QLineEdit;
|
23 |
class QLineEdit;
|
16 |
class QListBox;
|
24 |
class QLISTBOX;
|
17 |
class RclConfig;
|
25 |
class RclConfig;
|
18 |
class QSpinBox;
|
26 |
class QSpinBox;
|
19 |
class QComboBox;
|
27 |
class QComboBox;
|
20 |
class QCheckBox;
|
28 |
class QCheckBox;
|
21 |
|
29 |
|
22 |
namespace confgui {
|
30 |
namespace confgui {
|
23 |
|
31 |
|
24 |
// A class to isolate the gui widget from the config storage mechanism
|
32 |
// A class to isolate the gui widget from the config storage mechanism
|
25 |
class ConfLinkRep {
|
33 |
class ConfLinkRep {
|
26 |
public:
|
34 |
public:
|
|
|
35 |
virtual ~ConfLinkRep() {}
|
27 |
virtual bool set(const string& val) = 0;
|
36 |
virtual bool set(const string& val) = 0;
|
28 |
virtual bool get(string& val) = 0;
|
37 |
virtual bool get(string& val) = 0;
|
29 |
};
|
38 |
};
|
30 |
typedef RefCntr<ConfLinkRep> ConfLink;
|
39 |
typedef RefCntr<ConfLinkRep> ConfLink;
|
31 |
|
40 |
|
32 |
class ConfLinkNullRep : public ConfLinkRep {
|
41 |
class ConfLinkNullRep : public ConfLinkRep {
|
33 |
public:
|
42 |
public:
|
|
|
43 |
virtual ~ConfLinkNullRep() {}
|
34 |
virtual bool set(const string&)
|
44 |
virtual bool set(const string&)
|
35 |
{
|
45 |
{
|
36 |
//fprintf(stderr, "Setting value to [%s]\n", val.c_str());
|
46 |
//fprintf(stderr, "Setting value to [%s]\n", val.c_str());
|
37 |
return true;
|
47 |
return true;
|
38 |
}
|
48 |
}
|
|
... |
|
... |
50 |
}
|
60 |
}
|
51 |
virtual void loadValue() = 0;
|
61 |
virtual void loadValue() = 0;
|
52 |
|
62 |
|
53 |
protected:
|
63 |
protected:
|
54 |
ConfLink m_cflink;
|
64 |
ConfLink m_cflink;
|
55 |
QHBoxLayout *m_hl;
|
65 |
QHBOXLAYOUT *m_hl;
|
56 |
|
66 |
|
57 |
virtual bool createCommon(const QString& lbltxt,
|
67 |
virtual bool createCommon(const QString& lbltxt,
|
58 |
const QString& tltptxt);
|
68 |
const QString& tltptxt);
|
59 |
|
69 |
|
60 |
protected slots:
|
70 |
protected slots:
|
|
... |
|
... |
133 |
public:
|
143 |
public:
|
134 |
ConfParamSLW(QWidget *parent, ConfLink cflink,
|
144 |
ConfParamSLW(QWidget *parent, ConfLink cflink,
|
135 |
const QString& lbltxt,
|
145 |
const QString& lbltxt,
|
136 |
const QString& tltptxt);
|
146 |
const QString& tltptxt);
|
137 |
virtual void loadValue();
|
147 |
virtual void loadValue();
|
138 |
QListBox *getListBox() {return m_lb;}
|
148 |
QLISTBOX *getListBox() {return m_lb;}
|
139 |
|
149 |
|
140 |
protected slots:
|
150 |
protected slots:
|
141 |
virtual void showInputDialog();
|
151 |
virtual void showInputDialog();
|
142 |
void deleteSelected();
|
152 |
void deleteSelected();
|
143 |
signals:
|
153 |
signals:
|
144 |
void entryDeleted(QString);
|
154 |
void entryDeleted(QString);
|
145 |
protected:
|
155 |
protected:
|
146 |
QListBox *m_lb;
|
156 |
QLISTBOX *m_lb;
|
147 |
void listToConf();
|
157 |
void listToConf();
|
148 |
|
158 |
|
149 |
};
|
159 |
};
|
150 |
|
160 |
|
151 |
// Dir name list
|
161 |
// Dir name list
|
|
... |
|
... |
173 |
: ConfParamSLW(parent, cflink, lbltxt, tltptxt), m_sl(sl)
|
183 |
: ConfParamSLW(parent, cflink, lbltxt, tltptxt), m_sl(sl)
|
174 |
{
|
184 |
{
|
175 |
}
|
185 |
}
|
176 |
protected slots:
|
186 |
protected slots:
|
177 |
virtual void showInputDialog();
|
187 |
virtual void showInputDialog();
|
|
|
188 |
protected:
|
178 |
const QStringList m_sl;
|
189 |
const QStringList m_sl;
|
179 |
};
|
190 |
};
|
180 |
}
|
191 |
}
|
181 |
|
192 |
|
182 |
#endif /* _confgui_h_included_ */
|
193 |
#endif /* _confgui_h_included_ */
|