Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
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
21#include <ui/qt/capture_file.h>
22
25
26class PreferenceManager : public QObject
27{
28public:
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
36protected:
37 explicit PreferenceManager(QObject * parent = Q_NULLPTR);
38
39private:
40 static QMap<int, PreferenceFactory*> & factories();
41};
42
43class PreferenceFactory : public QObject
44{
45public:
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
Definition preference_manager.h:44
Definition preference_manager.h:27
Definition pref_models.h:70
Definition wireshark_preference.h:20