udpplugin-core.cpp

Go to the documentation of this file.
00001 #include "udpplugin.h"
00002 
00003 
00004 /** Called by BCore Initialize -
00005  ** Sets variables, loads classes for message bus, and loads saved settings.
00006  **/
00007 void UdpPlugin::CoreInit(const BCore* core)
00008 {
00009     qDebug("Udp-> CoreInit()");
00010     bcore = (BCore*) core;
00011 
00012     // Make sure all dialogs are NULL for saving
00013     SenderDlog = NULL;
00014     ReceiverDlog = NULL;
00015 
00016     // Load settings and saved dialog states
00017     LoadSettings();
00018 }
00019 
00020 /** Saves state of all dialogs and any other settings this plugin needs.
00021  **/
00022 void UdpPlugin::SaveSettings()
00023 {
00024     bool SDlog;
00025     bool RDlog;
00026 
00027     // set dialog states for saving
00028     if(NULL == SenderDlog) SDlog = false;
00029     else SDlog = true;
00030 
00031     if(NULL == ReceiverDlog) RDlog = false;
00032     else RDlog = true;
00033 
00034     // Save dialog states
00035     bcore->settings->setValue("UdpPlugin", "SenderDialog_Open", SDlog );
00036     bcore->settings->setValue("UdpPlugin", "ReceiverDialog_Open", RDlog );
00037 }
00038 
00039 /** Loads state of all dialogs and any other settings this plugin needs.
00040  **/
00041 void UdpPlugin::LoadSettings()
00042 {
00043     // get dialog states and load dialogs if needed
00044     if(bcore->settings->getValue("UdpPlugin", "SenderDialog_Open", false ).toBool())
00045         getDock(commands()[1]);
00046 
00047     if(bcore->settings->getValue("UdpPlugin", "ReceiverDialog_Open", false ).toBool())
00048         getDock(commands()[2]);
00049 }
00050 
00051 void UdpPlugin::Module(const QString name, const QStringList params)
00052 {
00053     if (!Modules.contains(name))
00054         Modules[name] = new BBoB_Module((QWidget*) this, name);
00055 
00056     // Process parameters
00057     QStringList::const_iterator constIterator;
00058     for (constIterator = params.constBegin(); constIterator != params.constEnd(); ++constIterator)
00059     {
00060         QString param = (*constIterator);
00061         ++constIterator;
00062         QString value = (*constIterator);
00063         Modules[name]->setParam(param, value);
00064     }
00065 }
00066 
00067 

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