BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 #include <QtGui/QItemDelegate>
18 #include <QtGui/QDialog>
19 
20 namespace Ui
21 {
22  class PluginDialogData;
23 }
24 
25 namespace BALL
26 {
27  namespace VIEW
28  {
29  class VIEWPlugin;
30 
31 /* class PluginItemDelegate : public QItemDelegate
32  {
33  Q_OBJECT
34 
35  public:
36  QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
37  void paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const;
38  };
39 */
40 
46  {
47  Q_OBJECT
48 
49  public:
50  explicit PluginModel ( QObject* parent = 0 );
51 
52  int rowCount(const QModelIndex& parent = QModelIndex()) const;
53  QVariant data(const QModelIndex& i, int role) const;
54  void pluginsLoaded();
55  private:
56  int num_rows_;
57  };
58 
64  {
65  Q_OBJECT
66 
67  public:
68  explicit PluginDirectoryModel ( QObject* parent = 0 );
69 
70  int rowCount(const QModelIndex& parent = QModelIndex()) const;
71  QVariant data(const QModelIndex& i, int role) const;
72 
73  void addDirectory(const QString& dir);
74  void removeDirectory(const QModelIndex& index);
75  };
76 
86  : public QWidget,
87  public ModularWidget,
88  public PreferencesEntry,
89  public PluginHandler
90  {
91  Q_OBJECT
92 
93  public:
95 
96  PluginDialog(Preferences* preferences, QWidget* parent, const char *name = "PluginDialog");
97  virtual ~PluginDialog();
98 
105  virtual void initializeWidget(MainControl& main_control);
106 
112  virtual void finalizeWidget(MainControl& main_control);
113 
114  virtual void writePreferenceEntries(INIFile& inifile);
115  virtual void readPreferenceEntries(const INIFile& inifile);
116 
117  virtual void registerChildEntry(PreferencesEntry* child);
118  virtual void unregisterChildEntry(PreferencesEntry* child);
119 
120  bool canHandle(BALLPlugin* plugin) const;
121  bool specificSetup_(BALLPlugin* plugin);
122  bool specificShutdown_(BALLPlugin* plugin);
123 
124  protected slots:
125  virtual void addPluginDirectory();
126  virtual void removePluginDirectory();
127  virtual void directorySelectionChanged(const QModelIndex&);
128  virtual void pluginChanged(QModelIndex i);
129  virtual void togglePluginState();
130 
131  private:
132  QModelIndex active_index_;
133  PluginModel plugin_model_;
134  PluginDirectoryModel plugin_dir_model_;
135  Preferences* preferences_;
136 
137  Ui::PluginDialogData* ui_;
138  std::list<PreferencesEntry*> child_entries_;
139  };
140  }
141 }
142 
143 #endif
144 
PluginModel(QObject *parent=0)
#define BALL_VIEW_EXPORT
Definition: COMMON/global.h:52
int rowCount(const QModelIndex &parent=QModelIndex()) const
QVariant data(const QModelIndex &i, int role) const
PluginDirectoryModel(QObject *parent=0)
#define BALL_EMBEDDABLE(TYPE, BASE)
Definition: embeddable.h:31
int rowCount(const QModelIndex &parent=QModelIndex()) const
void addDirectory(const QString &dir)
void removeDirectory(const QModelIndex &index)
QVariant data(const QModelIndex &i, int role) const