Salome HOME
1. Correction for perfomance problem by Apply button state update: do not listen...
[modules/shaper.git] / src / PartSet / PartSet_WidgetFileSelector.cpp
index 0b91dc048ac2f79fa1e7083eee9f74c5f3f234f6..f8c46f4082fb2bc275a5891ef9ec2787c3d78d64 100644 (file)
 
 #include <ModelAPI_AttributeString.h>
 
+#include <ExchangePlugin_ExportFeature.h>
+
 PartSet_WidgetFileSelector::PartSet_WidgetFileSelector(QWidget* theParent,
                                                        ModuleBase_IWorkshop* theWorkshop,
-                                                       const Config_WidgetAPI* theData,
-                                                       const std::string& theParentId)
-: ModuleBase_WidgetFileSelector(theParent, theData, theParentId)
-, myWorkshop(theWorkshop)
+                                                       const Config_WidgetAPI* theData)
+: ModuleBase_WidgetFileSelector(theParent, theData),
+  myWorkshop(theWorkshop)
 {
 }
 
-bool PartSet_WidgetFileSelector::restoreValue()
+bool PartSet_WidgetFileSelector::restoreValueCustom()
 {
   // A rare case when plugin was not loaded.
   if (!myFeature)
     return false;
 
   DataPtr aData = myFeature->data();
-  AttributeStringPtr aStringAttr = aData->string("export_file_format");
+  AttributeStringPtr aStringAttr = aData->string(ExchangePlugin_ExportFeature::FILE_PATH_ID());
   mySelectedFilter = formatToFilter(shortFormatToFullFormat(QString::fromStdString(aStringAttr->value())));
 
-  return ModuleBase_WidgetFileSelector::restoreValue();
+  return ModuleBase_WidgetFileSelector::restoreValueCustom();
 }
 
-bool PartSet_WidgetFileSelector::storeValueCustom() const
+bool PartSet_WidgetFileSelector::storeValueCustom()
 {
   // A rare case when plugin was not loaded.
   if (!myFeature)
     return false;
 
   DataPtr aData = myFeature->data();
-  AttributeStringPtr aStringAttr = aData->string("export_file_format");
+  AttributeStringPtr aStringAttr = aData->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID());
   aStringAttr->setValue(filterToShortFormat(mySelectedFilter).toStdString());
 
   return ModuleBase_WidgetFileSelector::storeValueCustom();
 }
 
-QString PartSet_WidgetFileSelector::filterToShortFormat( const QString & theFilter )
-{
-  return theFilter.section(' ', 0, 0);
-}
-
 QString PartSet_WidgetFileSelector::shortFormatToFullFormat( const QString & theFormat ) const
 {
   foreach(const QString & eachFormat, getValidatorFormats())