glexampleplugin-core.cpp

Go to the documentation of this file.
00001 #include "glexampleplugin.h"
00002 
00003 
00004 /** Called by BCore Initialize -
00005  ** Sets variables, loads classes for message bus, and loads saved settings.
00006  **/
00007 void GlExamplePlugin::CoreInit(const BCore* core)
00008 {
00009     qDebug("GlExample-> CoreInit()");
00010     bcore = (BCore*) core;
00011 
00012     if (QGLFormat::hasOpenGL())
00013     {
00014         qDebug("     OpenGL: FOUND");
00015         // enable Examples menu here
00016         commandList << tr("Open GL Example");
00017 
00018         if (QGLFormat::hasOpenGLOverlays())
00019         {
00020             qDebug("     OpenGL: has Overlays");
00021             // Enable overlay example here
00022             commandList << tr("OpenGL Overlay Example");
00023 
00024         }
00025 
00026         if (QGLPixelBuffer::hasOpenGLPbuffers())
00027         {
00028             qDebug("     OpenGL: has Pixel Buffers");
00029             // enable pixel buffer example here
00030             commandList << tr("OpenGL Pixel Buffer Example");
00031         }
00032 
00033         if (QGLFramebufferObject::hasOpenGLFramebufferObjects())
00034         {
00035             qDebug("     OpenGL: has Frame Buffer");
00036             // enable frame buffer example here
00037             commandList << tr("OpenGL Frame Buffer Example");
00038         }
00039     }
00040 
00041     // Make sure all dialogs are NULL for saving
00042     GlDlog = NULL;
00043 
00044     // Load settings and saved dialog states
00045     LoadSettings();
00046 
00047 }
00048 
00049 void GlExamplePlugin::SaveSettings()
00050 {
00051     bool GDlog;
00052 
00053     // set dialog states for saving
00054 //  if(NULL == GlDlog) GDlog = false;
00055 //  else
00056 //      GDlog = bcore->isDockVisible(GlDlog);
00057 
00058     // Just an example, no need to save actual state
00059     GDlog = false;
00060 
00061     // Save dialog states
00062     bcore->settings->setValue("GlExamplePlugin", "GlDialog_Open", GDlog );
00063 }
00064 
00065 /** Loads state of all dialogs and any other settings this plugin needs.
00066  **/
00067 void GlExamplePlugin::LoadSettings()
00068 {
00069     // get dialog states and load dialogs if needed
00070     if(bcore->settings->getValue("GlExamplePlugin", "GlDialog_Open", false ).toBool())
00071         getDock("OpenGL Frame Buffer Example");
00072 }
00073 
00074 void GlExamplePlugin::Module(const QString name, const QStringList params)
00075 {
00076     if (!Modules.contains(name))
00077         Modules[name] = new GlExampleModule((QWidget*) this, name);
00078 
00079     // Process parameters
00080     QStringList::const_iterator constIterator;
00081     for (constIterator = params.constBegin(); constIterator != params.constEnd(); ++constIterator)
00082     {
00083         QString param = (*constIterator);
00084         ++constIterator;
00085         QString value = (*constIterator);
00086         Modules[name]->setParam(param, value);
00087     }
00088 }
00089 
00090 

Generated on Sun Oct 28 22:51:27 2007 for BBoB by  doxygen 1.5.3