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 #include <ExchangePlugin_ExportFeature.h>
16 PartSet_WidgetFileSelector::PartSet_WidgetFileSelector(QWidget* theParent,
17 ModuleBase_IWorkshop* theWorkshop,
18 const Config_WidgetAPI* theData,
19 const std::string& theParentId)
20 : ModuleBase_WidgetFileSelector(theParent, theData, theParentId)
21 , myWorkshop(theWorkshop)
25 bool PartSet_WidgetFileSelector::restoreValueCustom()
27 // A rare case when plugin was not loaded.
31 DataPtr aData = myFeature->data();
32 AttributeStringPtr aStringAttr = aData->string(ExchangePlugin_ExportFeature::FILE_PATH_ID());
33 mySelectedFilter = formatToFilter(shortFormatToFullFormat(QString::fromStdString(aStringAttr->value())));
35 return ModuleBase_WidgetFileSelector::restoreValueCustom();
38 bool PartSet_WidgetFileSelector::storeValueCustom() const
40 // A rare case when plugin was not loaded.
44 DataPtr aData = myFeature->data();
45 AttributeStringPtr aStringAttr = aData->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID());
46 aStringAttr->setValue(filterToShortFormat(mySelectedFilter).toStdString());
48 return ModuleBase_WidgetFileSelector::storeValueCustom();
51 QString PartSet_WidgetFileSelector::shortFormatToFullFormat( const QString & theFormat ) const
53 foreach(const QString & eachFormat, getValidatorFormats())
54 if (filterToShortFormat(formatToFilter(eachFormat)) == theFormat)