tcpplugin-core.cpp

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

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