X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetCreatorFactory.cpp;h=d9f10f31ce9df6d5a50c760aadd8bbfc4b9c3690;hb=9c0937c3fce2633ae166b8a70fe43998f4babd1d;hp=6fd77e0615ccea862d6e9118f1ebe82c38f2ed4f;hpb=818bc197ba38350efb1a88e5735687a9da5ed6c3;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetCreatorFactory.cpp b/src/ModuleBase/ModuleBase_WidgetCreatorFactory.cpp index 6fd77e061..d9f10f31c 100755 --- a/src/ModuleBase/ModuleBase_WidgetCreatorFactory.cpp +++ b/src/ModuleBase/ModuleBase_WidgetCreatorFactory.cpp @@ -9,7 +9,7 @@ #include -#include +#include #include @@ -19,7 +19,8 @@ std::shared_ptr MY_WIDGET_CREATOR_FACTORY; std::shared_ptr ModuleBase_WidgetCreatorFactory::get() { if (!MY_WIDGET_CREATOR_FACTORY) { - MY_WIDGET_CREATOR_FACTORY = std::shared_ptr(new ModuleBase_WidgetCreatorFactory()); + MY_WIDGET_CREATOR_FACTORY = + std::shared_ptr(new ModuleBase_WidgetCreatorFactory()); } return MY_WIDGET_CREATOR_FACTORY; } @@ -36,38 +37,44 @@ void ModuleBase_WidgetCreatorFactory::registerCreator(const WidgetCreatorPtr& th { std::set::const_iterator anIt, aLast; /// fill map of panels - const std::set& aPanelTypes = theCreator->panelTypes(); + std::set aPanelTypes; + theCreator->panelTypes(aPanelTypes); for (anIt = aPanelTypes.begin(), aLast = aPanelTypes.end(); anIt != aLast; anIt++) { std::string aKey = *anIt; if (!myPanelToCreator.contains(aKey)) myPanelToCreator[aKey] = theCreator; else { - Events_Error::send("The" + aKey + " panel XML definition has been already \ -used by another widget creator"); + Events_InfoMessage("ModuleBase_WidgetCreatorFactory", + "The %1 panel XML definition has been already used by another widget creator") + .arg(aKey).send(); } } /// fill map of widgets - const std::set& aTypes = theCreator->widgetTypes(); + std::set aTypes; + theCreator->widgetTypes(aTypes); for (anIt = aTypes.begin(), aLast = aTypes.end(); anIt != aLast; anIt++) { std::string aKey = *anIt; if (!myCreators.contains(aKey)) myCreators[aKey] = theCreator; else { - Events_Error::send("The" + aKey + " widget XML definition has been already \ -used by another widget creator"); + Events_InfoMessage("ModuleBase_WidgetCreatorFactory", + "The %1 widget XML definition has been already used by another widget creator") + .arg(aKey).send(); } } /// fill map of pages - const std::set& aPTypes = theCreator->pageTypes(); + std::set aPTypes; + theCreator->pageTypes(aPTypes); for (anIt = aPTypes.begin(), aLast = aPTypes.end(); anIt != aLast; anIt++) { std::string aKey = *anIt; if (!myPageToCreator.contains(aKey)) myPageToCreator[aKey] = theCreator; else { - Events_Error::send("The" + aKey + " page XML definition has been already \ -used by another widget creator"); + Events_InfoMessage("ModuleBase_WidgetCreatorFactory", + "The %1 page XML definition has been already used by another widget creator") + .arg(aKey).send(); } } } @@ -77,12 +84,14 @@ bool ModuleBase_WidgetCreatorFactory::hasPanelWidget(const std::string& theType) return myPanelToCreator.contains(theType); } -QWidget* ModuleBase_WidgetCreatorFactory::createPanel(const std::string& theType, QWidget* theParent) +QWidget* ModuleBase_WidgetCreatorFactory::createPanelByType(const std::string& theType, + QWidget* theParent, + const FeaturePtr& theFeature) { QWidget* aPanel = 0; if (myPanelToCreator.contains(theType)) { WidgetCreatorPtr aCreator = myPanelToCreator[theType]; - aPanel = aCreator->createPanelByType(theType, theParent); + aPanel = aCreator->createPanelByType(theType, theParent, theFeature); } return aPanel; }