pluginDialog.h

Go to the documentation of this file.
00001 #ifndef BALL_VIEW_PLUGINDIALOG_H
00002 #define BALL_VIEW_PLUGINDIALOG_H
00003 
00004 #ifndef BALL_VIEW_KERNEL_PREFERENCESENTRY
00005 # include <BALL/VIEW/KERNEL/preferencesEntry.h>
00006 #endif
00007 
00008 #ifndef BALL_VIEW_KERNEL_MODULARWIDGET_H
00009 # include <BALL/VIEW/KERNEL/modularWidget.h>
00010 #endif
00011 
00012 #include <BALL/VIEW/UIC/ui_pluginDialog.h>
00013 
00014 #include <QtCore/QModelIndex>
00015 #include <QtGui/QItemDelegate>
00016 #include <QtGui/QDialog>
00017 
00018 namespace BALL
00019 {
00020   namespace VIEW
00021   {
00022     class VIEWPlugin;
00023 
00024 /*    class PluginItemDelegate : public QItemDelegate
00025     {
00026       Q_OBJECT
00027 
00028       public:
00029         QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
00030         void paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const;
00031     };
00032 */
00033     class PluginModel : 
00034       public QAbstractListModel 
00035     {
00036       Q_OBJECT
00037 
00038       public:
00039         PluginModel();
00040 
00041         int rowCount(const QModelIndex& parent = QModelIndex()) const;
00042         QVariant data(const QModelIndex& i, int role) const;
00043         void pluginsLoaded();
00044       private:
00045         int num_rows_;
00046     };
00047 
00048 
00049     
00052     class PluginDialog 
00053       : public QDialog, 
00054         private Ui_PluginDialogData,
00055         public ModularWidget,
00056         public PreferencesEntry
00057     {
00058       Q_OBJECT
00059 
00060       BALL_EMBEDDABLE(PluginDialog, ModularWidget)
00061       
00062       public:
00063         PluginDialog(QWidget* parent, const char *name = "PluginDialog");
00064         virtual ~PluginDialog() {}
00065 
00071       virtual void initializeWidget(MainControl& main_control);
00072 
00077       virtual void finalizeWidget(MainControl& main_control);
00078 
00079       virtual void readPreferenceEntries(const INIFile& inifile);
00080 
00081       protected slots:
00082         virtual void addPluginDirectory();
00083         virtual void removePluginDirectory();
00084         virtual void directorySelectionChanged();
00085         //virtual void close();
00086         //virtual void reject();
00087         virtual void pluginChanged(QModelIndex i);
00088         virtual void togglePluginState();
00089 
00090       private:
00091         QModelIndex active_index_;
00092         PluginModel model_;
00093     };
00094 
00095   }
00096 }
00097 
00098 #endif
00099