1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
4 * PartSet_WidgetFileSelector.cpp
6 * Created on: May 18, 2015
10 #include "PartSet_WidgetFileSelector.h"
12 #include <ModelAPI_AttributeString.h>
14 PartSet_WidgetFileSelector::PartSet_WidgetFileSelector(QWidget* theParent,
15 ModuleBase_IWorkshop* theWorkshop,
16 const Config_WidgetAPI* theData,
17 const std::string& theParentId)
18 : ModuleBase_WidgetFileSelector(theParent, theData, theParentId)
19 , myWorkshop(theWorkshop)
23 bool PartSet_WidgetFileSelector::restoreValue()
25 // A rare case when plugin was not loaded.
29 DataPtr aData = myFeature->data();
30 AttributeStringPtr aStringAttr = aData->string("export_file_format");
31 mySelectedFilter = formatToFilter(shortFormatToFullFormat(QString::fromStdString(aStringAttr->value())));
33 return ModuleBase_WidgetFileSelector::restoreValue();
36 bool PartSet_WidgetFileSelector::storeValueCustom() const
38 // A rare case when plugin was not loaded.
42 DataPtr aData = myFeature->data();
43 AttributeStringPtr aStringAttr = aData->string("export_file_format");
44 aStringAttr->setValue(filterToShortFormat(mySelectedFilter).toStdString());
46 return ModuleBase_WidgetFileSelector::storeValueCustom();
49 QString PartSet_WidgetFileSelector::shortFormatToFullFormat( const QString & theFormat ) const
51 foreach(const QString & eachFormat, getValidatorFormats())
52 if (filterToShortFormat(formatToFilter(eachFormat)) == theFormat)