Wireshark
4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
ui
qt
manager
preference_manager.h
Go to the documentation of this file.
1
10
#ifndef PREFERENCE_MANAGER_H
11
#define PREFERENCE_MANAGER_H
12
13
#include <config.h>
14
15
#include <QObject>
16
#include <QMetaObject>
17
#include <QHash>
18
#include <QActionGroup>
19
20
#include <
ui/qt/models/pref_models.h
>
21
#include <
ui/qt/capture_file.h
>
22
23
class
PreferenceFactory
;
24
class
WiresharkPreference
;
25
26
class
PreferenceManager
:
public
QObject
27
{
28
public
:
29
static
PreferenceManager
* instance();
30
virtual
~PreferenceManager
();
31
32
void
registerType(
int
pref,
PreferenceFactory
* factory);
33
void
reuseType(
int
pref,
int
reuseFor);
34
WiresharkPreference
* getPreference(
PrefsItem
* item);
35
36
protected
:
37
explicit
PreferenceManager
(QObject * parent = Q_NULLPTR);
38
39
private
:
40
static
QMap<int, PreferenceFactory*> & factories();
41
};
42
43
class
PreferenceFactory
:
public
QObject
44
{
45
public
:
46
virtual
~PreferenceFactory
();
47
virtual
WiresharkPreference
* create(QObject * parent = Q_NULLPTR) = 0;
48
};
49
50
#define REGISTER_PREFERENCE_TYPE(pref_id, preference_class) \
51
class preference_class##pref_id##Factory : public PreferenceFactory { \
52
public: \
53
preference_class##pref_id##Factory() \
54
{ \
55
PreferenceManager::instance()->registerType(pref_id, this); \
56
} \
57
virtual WiresharkPreference *create(QObject * parent) { \
58
WiresharkPreference * newPrefHandler = new preference_class(parent); \
59
return newPrefHandler; \
60
} \
61
}; \
62
static preference_class##pref_id##Factory global_##preference_class##pref_id##Factory;
63
64
#endif
// PREFERENCE_MANAGER_H
capture_file.h
PreferenceFactory
Definition
preference_manager.h:44
PreferenceManager
Definition
preference_manager.h:27
PrefsItem
Definition
pref_models.h:70
WiresharkPreference
Definition
wireshark_preference.h:20
pref_models.h
Generated by
1.9.8