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 : ModuleBase_WidgetFileSelector(theParent, theData),
20 myWorkshop(theWorkshop)
24 bool PartSet_WidgetFileSelector::restoreValueCustom()
26 // A rare case when plugin was not loaded.
30 DataPtr aData = myFeature->data();
31 AttributeStringPtr aStringAttr = aData->string(ExchangePlugin_ExportFeature::FILE_PATH_ID());
32 mySelectedFilter = formatToFilter(shortFormatToFullFormat(QString::fromStdString(aStringAttr->value())));
34 return ModuleBase_WidgetFileSelector::restoreValueCustom();
37 bool PartSet_WidgetFileSelector::storeValueCustom() const
39 // A rare case when plugin was not loaded.
43 DataPtr aData = myFeature->data();
44 AttributeStringPtr aStringAttr = aData->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID());
45 aStringAttr->setValue(filterToShortFormat(mySelectedFilter).toStdString());
47 return ModuleBase_WidgetFileSelector::storeValueCustom();
50 QString PartSet_WidgetFileSelector::shortFormatToFullFormat( const QString & theFormat ) const
52 foreach(const QString & eachFormat, getValidatorFormats())
53 if (filterToShortFormat(formatToFilter(eachFormat)) == theFormat)