BALL  1.5.0
pluginDialog.h
Go to the documentation of this file.
1 #ifndef BALL_VIEW_PLUGINDIALOG_H
2 #define BALL_VIEW_PLUGINDIALOG_H
3 
4 #ifndef BALL_VIEW_KERNEL_PREFERENCESENTRY
6 #endif
7 
8 #ifndef BALL_VIEW_KERNEL_MODULARWIDGET_H
10 #endif
11 
12 #ifndef BALL_PLUGIN_PLUGINHANDLER_H
14 #endif
15 
16 #include <QtCore/QModelIndex>
17 
18 namespace Ui
19 {
20  class PluginDialogData;
21 }
22 
23 namespace BALL
24 {
25  namespace VIEW
26  {
27  class VIEWPlugin;
28 
34  {
35  Q_OBJECT
36 
37  public:
38  explicit PluginModel ( QObject* parent = 0 );
39 
40  int rowCount(const QModelIndex& /* parent */ = QModelIndex()) const;
41  QVariant data(const QModelIndex& i, int role) const;
42  void pluginsLoaded();
43  private:
44  int num_rows_;
45  };
46 
52  {
53  Q_OBJECT
54 
55  public:
56  explicit PluginDirectoryModel ( QObject* parent = 0 );
57 
58  int rowCount(const QModelIndex& /* parent */ = QModelIndex()) const;
59  QVariant data(const QModelIndex& i, int role) const;
60 
61  void addDirectory(const QString& dir);
62  void removeDirectory(const QModelIndex& index);
63  };
64 
74  : public QWidget,
75  public ModularWidget,
76  public PreferencesEntry,
77  public PluginHandler
78  {
79  Q_OBJECT
80 
81  public:
83 
84  PluginDialog(Preferences* preferences, QWidget* parent, const char *name = "PluginDialog");
85  virtual ~PluginDialog();
86 
93  virtual void initializeWidget(MainControl& main_control);
94 
100  virtual void finalizeWidget(MainControl& main_control);
101 
102  virtual void writePreferenceEntries(INIFile& inifile);
103  virtual void readPreferenceEntries(const INIFile& inifile);
104 
105  virtual void registerChildEntry(PreferencesEntry* child);
106  virtual void unregisterChildEntry(PreferencesEntry* child);
107 
108  virtual void restoreDefaultValues(bool /* all */ = false);
109 
110  bool canHandle(BALLPlugin* plugin) const;
111  bool specificSetup_(BALLPlugin* plugin);
112  bool specificShutdown_(BALLPlugin* plugin);
113 
114  protected:
119  virtual void setDefaultPluginDirectory();
120 
121  protected Q_SLOTS:
122  virtual void addPluginDirectory();
123  virtual void removePluginDirectory();
124  virtual void directorySelectionChanged(const QModelIndex&, const QModelIndex& /* previous */);
125  virtual void pluginChanged(QModelIndex current, const QModelIndex& /* previous */);
126  virtual void togglePluginState();
127 
128  private:
129  QModelIndex active_index_;
130  PluginModel plugin_model_;
131  PluginDirectoryModel plugin_dir_model_;
132  Preferences* preferences_;
133 
134  Ui::PluginDialogData* ui_;
135  std::list<PreferencesEntry*> child_entries_;
136  };
137  }
138 }
139 
140 #endif
141 
#define BALL_EMBEDDABLE(TYPE, BASE)
Definition: embeddable.h:31
Definition: constants.h:13
QVariant data(const QModelIndex &i, int role) const
int rowCount(const QModelIndex &=QModelIndex()) const
PluginModel(QObject *parent=0)
PluginDirectoryModel(QObject *parent=0)
void removeDirectory(const QModelIndex &index)
void addDirectory(const QString &dir)
QVariant data(const QModelIndex &i, int role) const
int rowCount(const QModelIndex &=QModelIndex()) const
#define BALL_VIEW_EXPORT
Definition: COMMON/global.h:52