BALL  1.4.1
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 BALL_VIEW_EXPORT 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 BALL_VIEW_EXPORT PluginDialog 
00053       : public QDialog, 
00054         private Ui_PluginDialogData,
00055         public ModularWidget,
00056         public PreferencesEntry
00057     {
00058       Q_OBJECT
00059       
00060       public:
00061 
00062         BALL_EMBEDDABLE(PluginDialog, ModularWidget)
00063 
00064         PluginDialog(QWidget* parent, const char *name = "PluginDialog");
00065         virtual ~PluginDialog() {}
00066 
00072       virtual void initializeWidget(MainControl& main_control);
00073 
00078       virtual void finalizeWidget(MainControl& main_control);
00079 
00080       virtual void writePreferenceEntries(INIFile& inifile);
00081       virtual void readPreferenceEntries(const INIFile& inifile);
00082 
00083       virtual void registerChildEntry(PreferencesEntry* child);
00084       virtual void unregisterChildEntry(PreferencesEntry* child);
00085 
00086       protected slots:
00087         virtual void addPluginDirectory();
00088         virtual void removePluginDirectory();
00089         virtual void directorySelectionChanged();
00090         //virtual void close();
00091         //virtual void reject();
00092         virtual void pluginChanged(QModelIndex i);
00093         virtual void togglePluginState();
00094 
00095       private:
00096         QModelIndex active_index_;
00097         PluginModel model_;
00098 
00099         std::list<PreferencesEntry*> child_entries_;
00100     };
00101 
00102   }
00103 }
00104 
00105 #endif
00106 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines