|
a/src/qtgui/confgui/confgui.h |
|
b/src/qtgui/confgui/confgui.h |
|
... |
|
... |
34 |
* The widgets are typically linked to a temporary configuration object, which
|
34 |
* The widgets are typically linked to a temporary configuration object, which
|
35 |
* is then copied to the actual configuration if the data is accepted, or
|
35 |
* is then copied to the actual configuration if the data is accepted, or
|
36 |
* destroyed and recreated as a copy if Cancel is pressed (you have to
|
36 |
* destroyed and recreated as a copy if Cancel is pressed (you have to
|
37 |
* delete/recreate the widgets in this case as the links are no longer valid).
|
37 |
* delete/recreate the widgets in this case as the links are no longer valid).
|
38 |
*/
|
38 |
*/
|
|
|
39 |
#include "autoconfig.h"
|
|
|
40 |
|
39 |
#include <string>
|
41 |
#include <string>
|
40 |
#include <limits.h>
|
42 |
#include <limits.h>
|
41 |
|
43 |
|
42 |
#include <qglobal.h>
|
44 |
#include <qglobal.h>
|
43 |
#include <qstring.h>
|
45 |
#include <qstring.h>
|
44 |
#include <qwidget.h>
|
46 |
#include <qwidget.h>
|
45 |
|
47 |
|
46 |
#include "refcntr.h"
|
48 |
#include MEMORY_INCLUDE
|
47 |
|
|
|
48 |
using std::string;
|
|
|
49 |
|
49 |
|
50 |
class QHBoxLayout;
|
50 |
class QHBoxLayout;
|
51 |
class QLineEdit;
|
51 |
class QLineEdit;
|
52 |
class QListWidget;
|
52 |
class QListWidget;
|
53 |
class QSpinBox;
|
53 |
class QSpinBox;
|
|
... |
|
... |
59 |
|
59 |
|
60 |
// A class to isolate the gui widget from the config storage mechanism
|
60 |
// A class to isolate the gui widget from the config storage mechanism
|
61 |
class ConfLinkRep {
|
61 |
class ConfLinkRep {
|
62 |
public:
|
62 |
public:
|
63 |
virtual ~ConfLinkRep() {}
|
63 |
virtual ~ConfLinkRep() {}
|
64 |
virtual bool set(const string& val) = 0;
|
64 |
virtual bool set(const std::string& val) = 0;
|
65 |
virtual bool get(string& val) = 0;
|
65 |
virtual bool get(std::string& val) = 0;
|
66 |
};
|
66 |
};
|
67 |
typedef RefCntr<ConfLinkRep> ConfLink;
|
67 |
typedef STD_SHARED_PTR<ConfLinkRep> ConfLink;
|
68 |
|
68 |
|
69 |
// Useful to store/manage data which has no direct representation in
|
69 |
// Useful to store/manage data which has no direct representation in
|
70 |
// the config, ie list of subkey directories
|
70 |
// the config, ie list of subkey directories
|
71 |
class ConfLinkNullRep : public ConfLinkRep {
|
71 |
class ConfLinkNullRep : public ConfLinkRep {
|
72 |
public:
|
72 |
public:
|
73 |
virtual ~ConfLinkNullRep() {}
|
73 |
virtual ~ConfLinkNullRep() {}
|
74 |
virtual bool set(const string&)
|
74 |
virtual bool set(const std::string&)
|
75 |
{
|
75 |
{
|
76 |
return true;
|
76 |
return true;
|
77 |
}
|
77 |
}
|
78 |
virtual bool get(string& val) {val = ""; return true;}
|
78 |
virtual bool get(std::string& val) {val = ""; return true;}
|
79 |
};
|
79 |
};
|
80 |
|
80 |
|
81 |
// A widget to let the user change one configuration
|
81 |
// A widget to let the user change one configuration
|
82 |
// parameter. Subclassed for specific parameter types. Basically
|
82 |
// parameter. Subclassed for specific parameter types. Basically
|
83 |
// has a label and some kind of entry widget
|
83 |
// has a label and some kind of entry widget
|