Salome HOME
0df8574486dccd240e8e66762f724c72510796b3
[modules/shaper.git] / src / ModuleBase / ModuleBase_Preferences.cpp
1 // Copyright (C) 2014-2023  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "ModuleBase_Preferences.h"
21 //#include "ModuleBase_Constants.h"
22
23 #include <Config_PropManager.h>
24
25 #include <TopAbs_ShapeEnum.hxx>
26
27 #include <SUIT_ResourceMgr.h>
28 #include <SUIT_PreferenceMgr.h>
29 #include <Qtx.h>
30
31 #include <QLayout>
32 #include <QApplication>
33 #include <QDialogButtonBox>
34 #include <QPushButton>
35
36 #ifdef WIN32
37 #pragma warning(disable : 4456) // for nested foreach
38 #endif
39
40 const QString ModuleBase_Preferences::VIEWER_SECTION = "Viewer";
41 const QString ModuleBase_Preferences::MENU_SECTION = "Menu";
42 const QString ModuleBase_Preferences::GENERAL_SECTION = "General";
43
44 SUIT_ResourceMgr* ModuleBase_Preferences::myResourceMgr = 0;
45
46 SUIT_ResourceMgr* ModuleBase_Preferences::resourceMgr()
47 {
48   if (!myResourceMgr) {
49     myResourceMgr = new SUIT_ResourceMgr("SHAPER");
50     myResourceMgr->setCurrentFormat("xml");
51   }
52   return myResourceMgr;
53 }
54
55 bool ModuleBase_Preferences::editPreferences(ModuleBase_Prefs& theModified)
56 {
57   ModuleBase_PreferencesDlg aDlg(resourceMgr(), QApplication::activeWindow());
58   aDlg.exec();
59   if (aDlg.isChanged()) {
60     aDlg.modified(theModified);
61     resourceMgr()->save();
62     return true;
63   }
64   return false;
65 }
66
67 void ModuleBase_Preferences::updateConfigByResources()
68 {
69   Config_Properties aProps = Config_PropManager::getProperties();
70   Config_Properties::iterator aIt;
71   for (aIt = aProps.begin(); aIt != aProps.end(); ++aIt) {
72     Config_Prop* aProp = (*aIt);
73     QString aVal = myResourceMgr->stringValue(QString(aProp->section().c_str()),
74                                               QString(aProp->name().c_str()));
75     if (!aVal.isEmpty()) {
76       aProp->setValue(aVal.toStdString());
77     }
78   }
79 }
80
81 void ModuleBase_Preferences::updateResourcesByConfig()
82 {
83   Config_Properties aProps = Config_PropManager::getProperties();
84   Config_Properties::iterator aIt;
85   for (aIt = aProps.begin(); aIt != aProps.end(); ++aIt) {
86     Config_Prop* aProp = (*aIt);
87     myResourceMgr->setValue(QString(aProp->section().c_str()), QString(aProp->name().c_str()),
88                             QString(aProp->value().c_str()));
89   }
90 }
91
92 void ModuleBase_Preferences::resetConfig()
93 {
94   Config_Properties aProps = Config_PropManager::getProperties();
95   Config_Properties::iterator aIt;
96   for (aIt = aProps.begin(); aIt != aProps.end(); ++aIt) {
97     Config_Prop* aProp = (*aIt);
98     aProp->setValue(aProp->defaultValue());
99   }
100 }
101
102 void ModuleBase_Preferences::loadCustomProps()
103 {
104   if(!myResourceMgr)
105     return;
106   QStringList aSections = myResourceMgr->sections();
107   foreach (QString aSection, aSections)
108   {
109     QStringList aParams = myResourceMgr->parameters(aSection);
110     foreach (QString aParam, aParams)
111     {
112       Config_Prop* aProp = Config_PropManager::registerProp(aSection.toStdString(),
113                                        aParam.toStdString(), "", Config_Prop::Disabled);
114       aProp->setValue(myResourceMgr->stringValue(aSection, aParam).toStdString());
115     }
116   }
117 }
118
119
120 void ModuleBase_Preferences::createEditContent(ModuleBase_IPrefMgr* thePref, int thePage)
121 {
122   thePref->prefMgr()->setItemIcon(thePage, QIcon(":pictures/module.png"));
123   createGeneralTab(thePref, thePage);
124   createCustomPage(thePref, thePage);
125   updateSketchTab(thePref, thePage);
126 }
127
128 void ModuleBase_Preferences::resetResourcePreferences(SUIT_PreferenceMgr* thePref)
129 {
130   if (!thePref)
131     return;
132
133   QtxResourceMgr::WorkingMode aPrev =
134     thePref->resourceMgr()->setWorkingMode(QtxResourceMgr::IgnoreUserValues);
135   thePref->retrieve();
136   thePref->resourceMgr()->setWorkingMode(aPrev);
137 }
138
139 void ModuleBase_Preferences::resetConfigPropPreferences(SUIT_PreferenceMgr* thePref)
140 {
141   resetConfig();
142   updateResourcesByConfig();
143
144   // retrieve the reset resource values to the preferences items
145   Config_Properties aProps = Config_PropManager::getProperties();
146   Config_Properties::iterator aIt;
147   QStringList aValues;
148   QStringList aSections;
149   for (aIt = aProps.begin(); aIt != aProps.end(); ++aIt) {
150     Config_Prop* aProp = (*aIt);
151     aValues.append(QString(aProp->name().c_str()));
152     if (!aSections.contains(aProp->section().c_str()))
153       aSections.append(aProp->section().c_str());
154     QtxPreferenceItem* anItem = thePref->findItem(QString(aProp->title().c_str()), true);
155     if (anItem)
156       anItem->retrieve();
157   }
158 }
159
160 void ModuleBase_Preferences::createGeneralTab(ModuleBase_IPrefMgr* thePref, int thePageId)
161 {
162   int generalTab = thePref->addPreference(QObject::tr("General"), thePageId,
163     SUIT_PreferenceMgr::Auto, QString(), QString());
164   thePref->setItemProperty("columns", 2, generalTab);
165
166   QStringList actItemList;
167   actItemList << QObject::tr("Last part")
168     << QObject::tr("All parts")
169     << QObject::tr("No activation");
170
171   QList<QVariant> actIdList;
172   actIdList << 0 << 1 << 2;
173
174   // Group related to creation of a study
175   int group = thePref->addPreference(QObject::tr("Creation a study"), generalTab,
176                                      SUIT_PreferenceMgr::Auto, QString(), QString());
177
178   int actId = thePref->addPreference(QObject::tr("Create new part"), group, SUIT_PreferenceMgr::Bool,
179                                      ModuleBase_Preferences::GENERAL_SECTION, "create_init_part");
180
181   // Group related to running a python script
182   group = thePref->addPreference(QObject::tr("Launching a python script"), generalTab,
183                                  SUIT_PreferenceMgr::Auto, QString(), QString());
184
185   QStringList visuItemList;
186   visuItemList << QObject::tr("Last item in each folder")
187                << QObject::tr("All items")
188                << QObject::tr("No visualization");
189
190   QList<QVariant> visuIdList;
191   visuIdList << 0 << 1 << 2;
192
193   int visuId = thePref->addPreference(QObject::tr("Display"), group, SUIT_PreferenceMgr::Selector,
194                                       ModuleBase_Preferences::GENERAL_SECTION,
195                                       "part_visualization_script");
196   thePref->setItemProperty("strings", visuItemList, visuId);
197   thePref->setItemProperty("indexes", visuIdList, visuId);
198
199   // Group related to opening a study
200   group = thePref->addPreference(QObject::tr("Opening a study"), generalTab,
201                                  SUIT_PreferenceMgr::Auto, QString(), QString());
202
203   actId = thePref->addPreference(QObject::tr("Activate"), group, SUIT_PreferenceMgr::Selector,
204                                  ModuleBase_Preferences::GENERAL_SECTION,
205                                  "part_activation_study");
206   thePref->setItemProperty("strings", actItemList, actId);
207   thePref->setItemProperty("indexes", actIdList, actId);
208
209   visuItemList.clear();
210   visuItemList << QObject::tr("As stored in HDF")
211                << QObject::tr("Last item in each folder")
212                << QObject::tr("All items")
213                << QObject::tr("No visualization");
214
215   visuIdList.clear();
216   visuIdList << 0 << 1 << 2 << 3;
217
218   visuId = thePref->addPreference(QObject::tr("Display"), group, SUIT_PreferenceMgr::Selector,
219                                   ModuleBase_Preferences::GENERAL_SECTION,
220                                   "part_visualization_study");
221   thePref->setItemProperty("strings", visuItemList, visuId);
222   thePref->setItemProperty("indexes", visuIdList, visuId);
223 }
224
225 void ModuleBase_Preferences::updateSketchTab(ModuleBase_IPrefMgr* thePref, int thePageId)
226 {
227   int sketchTab   = thePref->addPreference(QObject::tr("Sketch"), thePageId,
228                              SUIT_PreferenceMgr::Auto, QString(), QString());
229   int allowChange = thePref->addPreference(
230                            QObject::tr("Allow automatic constraint substitution/remove"),
231                            sketchTab, SUIT_PreferenceMgr::GroupBox,
232                            "Sketch", "allow_change_constraint");
233   thePref->addPreference(QObject::tr("Notify automatic constraint substitution/remove"),
234            allowChange, SUIT_PreferenceMgr::Bool, "Sketch", "notify_change_constraint");
235 }
236
237 void ModuleBase_Preferences::createCustomPage(ModuleBase_IPrefMgr* thePref, int thePageId)
238 {
239   SUIT_ResourceMgr* aResMgr = ModuleBase_Preferences::resourceMgr();
240
241   // Make a Tab from each section
242   std::list<std::string> aSections = Config_PropManager::getSections();
243   std::list<std::string>::const_iterator it;
244   for (it = aSections.cbegin(); it != aSections.cend(); ++it) {
245     Config_Properties aProps = Config_PropManager::getProperties(*it);
246     int aTab = thePref->prefMgr()->addItem(QString((*it).c_str()), thePageId);
247     thePref->prefMgr()->setItemProperty("columns", 2, aTab);
248
249     Config_Properties::const_iterator aIt;
250     for (aIt = aProps.cbegin(); aIt != aProps.cend(); ++aIt) {
251       Config_Prop* aProp = (*aIt);
252       // check that the property is defined
253       QString aSection(aProp->section().c_str());
254       QString aName(aProp->name().c_str());
255       if (!aResMgr->hasValue(aSection, aName))
256         aResMgr->setValue(aSection, aName, QString(aProp->value().c_str()));
257
258       // Add item
259       if (aProp->type() != Config_Prop::Disabled) {
260         SUIT_PreferenceMgr::PrefItemType aPrefType = SUIT_PreferenceMgr::Auto;
261         switch (aProp->type()) {
262         case Config_Prop::Directory:
263           aPrefType = SUIT_PreferenceMgr::File;
264           break;
265         case Config_Prop::Cursor:
266           aPrefType = SUIT_PreferenceMgr::Selector;
267           break;
268         default:
269           aPrefType = (SUIT_PreferenceMgr::PrefItemType) aProp->type();
270         }
271
272         int anId = thePref->addPreference(QObject::tr(aProp->title().c_str()), aTab, aPrefType,
273                                           QString::fromStdString(aProp->section()),
274                                           QString::fromStdString(aProp->name()));
275
276         switch (aProp->type()) {
277         case Config_Prop::Directory:
278           thePref->setItemProperty("path_type", Qtx::PT_Directory, anId);
279           break;
280         case SUIT_PreferenceMgr::DblSpin:
281           if (aProp->min() != "") {
282             double aMin = QString(aProp->min().c_str()).toDouble();
283             thePref->setItemProperty("min", aMin, anId);
284           }
285           if (aProp->max() != "") {
286             double aMax = QString(aProp->max().c_str()).toDouble();
287             thePref->setItemProperty("max", aMax, anId);
288           }
289           break;
290         case SUIT_PreferenceMgr::IntSpin:
291           if (aProp->min() != "") {
292             int aMin = QString(aProp->min().c_str()).toInt();
293             thePref->setItemProperty("min", aMin, anId);
294           }
295           if (aProp->max() != "") {
296             int aMax = QString(aProp->max().c_str()).toInt();
297             thePref->setItemProperty("max", aMax, anId);
298           }
299           break;
300         case Config_Prop::Cursor:
301           {
302             QList<QVariant> aIndicesList;
303             QList<QVariant> aIconsList;
304             aIndicesList << 0 << 1 << 2;
305             aIconsList << QPixmap(":pictures/ArrowCursor.png") <<
306               QPixmap(":pictures/CrossCursor.png") <<
307               QPixmap(":pictures/HandCursor.png");
308
309             thePref->setItemProperty("indexes", aIndicesList, anId);
310             thePref->setItemProperty("icons", aIconsList, anId);
311           }
312           break;
313         default: // [to avoid compilation warnings]
314           break;
315         }
316       }
317     }
318   }
319 }
320
321 /**
322 * Implementation of preferences manager interface
323 */
324 class ModuleBase_PrefMgr: public ModuleBase_IPrefMgr
325 {
326 public:
327   /// Constructor
328   /// \param theMgr a preferences manager
329   ModuleBase_PrefMgr(ModuleBase_PreferencesMgr* theMgr):myMgr(theMgr) {}
330
331   virtual int addPreference(const QString& theLbl, int pId,
332                             SUIT_PreferenceMgr::PrefItemType theType,
333                             const QString& theSection, const QString& theName )
334   {
335     return myMgr->addItem(theLbl, pId, theType, theSection, theName);
336   }
337
338   virtual void setItemProperty( const QString& thePropName, const QVariant& theValue,
339                                const int theId = -1) {
340     myMgr->setItemProperty(thePropName, theValue, theId);
341   }
342
343   virtual SUIT_PreferenceMgr* prefMgr() const { return myMgr; }
344
345 private:
346   ModuleBase_PreferencesMgr* myMgr;
347 };
348
349 //**********************************************************
350 //**********************************************************
351 //**********************************************************
352 ModuleBase_PreferencesDlg::ModuleBase_PreferencesDlg(SUIT_ResourceMgr* theResurces,
353   QWidget* theParent)
354     : QDialog(theParent,
355       Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint),
356       myIsChanged(false)
357 {
358   setWindowTitle(tr("Edit preferences"));
359
360   QVBoxLayout* main = new QVBoxLayout(this);
361   main->setMargin(5);
362   main->setSpacing(5);
363
364   myPreferences = new ModuleBase_PreferencesMgr(theResurces, this);
365   main->addWidget(myPreferences);
366
367   setFocusProxy(myPreferences);
368   myPreferences->setFrameStyle(QFrame::Box | QFrame::Sunken);
369
370   QDialogButtonBox* aBtnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel |
371                                                    QDialogButtonBox::Reset,
372                                                    Qt::Horizontal, this);
373   QPushButton* aDefaultButton = aBtnBox->button(QDialogButtonBox::Reset);
374   aDefaultButton->setText(tr("Default"));
375   connect(aDefaultButton, SIGNAL(clicked()), this, SLOT(onDefault()));
376
377   main->addWidget(aBtnBox);
378   connect(aBtnBox, SIGNAL(accepted()), this, SLOT(accept()));
379   connect(aBtnBox, SIGNAL(rejected()), this, SLOT(reject()));
380   createEditors();
381
382   myPreferences->retrieve();
383 }
384
385 ModuleBase_PreferencesDlg::~ModuleBase_PreferencesDlg()
386 {
387 }
388
389 void ModuleBase_PreferencesDlg::createEditors()
390 {
391   int aPage = myPreferences->addItem(tr("Desktop"));
392   myPreferences->setItemIcon(aPage, QIcon(":pictures/view_prefs.png"));
393
394   createMenuPage(aPage);
395   createViewerPage(aPage);
396
397   aPage = myPreferences->addItem(tr("Module"));
398   myPreferences->setItemIcon(aPage, QIcon(":pictures/module.png"));
399
400   ModuleBase_PrefMgr aMgr(myPreferences);
401   ModuleBase_Preferences::createEditContent(&aMgr, aPage);
402 }
403
404 void ModuleBase_PreferencesDlg::createViewerPage(int thePageId)
405 {
406   int viewTab = myPreferences->addItem(tr("Viewer"), thePageId);
407
408   QStringList gradList;
409   gradList << tr("Horizontal gradient") << tr("Vertical gradient") << tr("First diagonal gradient")
410            << tr("Second diagonal gradient") << tr("First corner gradient")
411            << tr("Second corner gradient") << tr("Third corner gradient")
412            << tr("Fourth corner gradient");
413
414   QList<QVariant> idList;
415   for (int i = 0; i < gradList.size(); i++)
416     idList << i;
417
418   int bgGroup = myPreferences->addItem(tr("Background"), viewTab);
419
420   QString aImgFiles("Image files (*.bmp *.gif *.pix *.xwd *.rgb *.rs)");
421
422   int bgId = myPreferences->addItem(tr("Viewer 3d"), bgGroup, SUIT_PreferenceMgr::Background,
423                                     ModuleBase_Preferences::VIEWER_SECTION, "background");
424   myPreferences->setItemProperty("gradient_names", gradList, bgId);
425   myPreferences->setItemProperty("gradient_ids", idList, bgId);
426   myPreferences->setItemProperty("texture_enabled", true, bgId);
427   myPreferences->setItemProperty("texture_center_enabled", true, bgId);
428   myPreferences->setItemProperty("texture_tile_enabled", true, bgId);
429   myPreferences->setItemProperty("texture_stretch_enabled", true, bgId);
430   myPreferences->setItemProperty("custom_enabled", false, bgId);
431   myPreferences->setItemProperty("image_formats", aImgFiles, bgId);
432
433   // Create other parameters group in viewer tab
434   int selectionGroup = myPreferences->addItem(tr("Default selection"), viewTab);
435   myPreferences->setItemProperty("columns", 3, selectionGroup);
436   myPreferences->addItem(tr("Faces"), selectionGroup,
437                          SUIT_PreferenceMgr::Bool,
438                          ModuleBase_Preferences::VIEWER_SECTION, "face-selection");
439   myPreferences->addItem(tr("Edges"), selectionGroup,
440                          SUIT_PreferenceMgr::Bool,
441                          ModuleBase_Preferences::VIEWER_SECTION, "edge-selection");
442   myPreferences->addItem(tr("Vertices"), selectionGroup,
443                          SUIT_PreferenceMgr::Bool,
444                          ModuleBase_Preferences::VIEWER_SECTION, "vertex-selection");
445
446   int sensitivityGroup = myPreferences->addItem(tr("Selection sensitivity"), viewTab);
447   myPreferences->setItemProperty("columns", 2, sensitivityGroup);
448   myPreferences->addItem(tr("Vertex"), sensitivityGroup, SUIT_PreferenceMgr::DblSpin,
449                          ModuleBase_Preferences::VIEWER_SECTION, "point-selection-sensitivity");
450   myPreferences->addItem(tr("Edge"), sensitivityGroup, SUIT_PreferenceMgr::DblSpin,
451                          ModuleBase_Preferences::VIEWER_SECTION, "edge-selection-sensitivity");
452
453   int highlightGroup = myPreferences->addItem(tr("Additional highlighting"), viewTab);
454   myPreferences->setItemProperty("columns", 2, highlightGroup);
455   myPreferences->addItem(tr("In 3d mode"), highlightGroup,
456     SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::VIEWER_SECTION, "highlighting-3d");
457   myPreferences->addItem(tr("In 2d mode"), highlightGroup,
458     SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::VIEWER_SECTION, "highlighting-2d");
459
460   int colorScaleGroup = myPreferences->addItem(tr("Color scale"), viewTab);
461   myPreferences->setItemProperty("columns", 4, colorScaleGroup);
462   int aItem = myPreferences->addItem(tr("X position"), colorScaleGroup,
463     SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_x_position");
464   myPreferences->setItemProperty("min", 0, aItem);
465   myPreferences->setItemProperty("max", 1, aItem);
466   aItem = myPreferences->addItem(tr("Y position"), colorScaleGroup,
467     SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_y_position");
468   myPreferences->setItemProperty("min", 0, aItem);
469   myPreferences->setItemProperty("max", 1, aItem);
470   aItem = myPreferences->addItem(tr("Width"), colorScaleGroup,
471     SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_width");
472   myPreferences->setItemProperty("min", 0, aItem);
473   myPreferences->setItemProperty("max", 1, aItem);
474   aItem = myPreferences->addItem(tr("Height"), colorScaleGroup,
475     SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_height");
476   myPreferences->setItemProperty("min", 0, aItem);
477   myPreferences->setItemProperty("max", 1, aItem);
478   aItem = myPreferences->addItem(tr("Intervals number"), colorScaleGroup,
479     SUIT_PreferenceMgr::Integer, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_nb_intervals");
480   myPreferences->setItemProperty("min", 0, aItem);
481   myPreferences->setItemProperty("max", 100, aItem);
482   aItem = myPreferences->addItem(tr("Text height"), colorScaleGroup,
483     SUIT_PreferenceMgr::Integer, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_text_height");
484   myPreferences->setItemProperty("min", 0, aItem);
485   myPreferences->setItemProperty("max", 100, aItem);
486   aItem = myPreferences->addItem(tr("Text color"), colorScaleGroup,
487     SUIT_PreferenceMgr::Color, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_text_color");
488 }
489
490 void ModuleBase_PreferencesDlg::createMenuPage(int thePageId)
491 {
492   int aMenuTab = myPreferences->addItem(tr("Main menu"), thePageId);
493
494   int aSizeGroup = myPreferences->addItem(tr("Size"), aMenuTab);
495   myPreferences->setItemProperty("columns", 1, aSizeGroup);
496
497   int aRowsNb = myPreferences->addItem(tr("Number of rows"), aSizeGroup,
498                                        SUIT_PreferenceMgr::IntSpin,
499                                        ModuleBase_Preferences::MENU_SECTION,
500                                        "rows_number");
501   myPreferences->setItemProperty("min", 1, aRowsNb);
502   myPreferences->setItemProperty("max", 6, aRowsNb);
503
504   myPreferences->addItem(tr("Show Status Bar"), aSizeGroup,
505                          SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::MENU_SECTION,
506                          "status_bar");
507 }
508
509 void ModuleBase_PreferencesDlg::accept()
510 {
511   myPreferences->store();
512   myIsChanged = true;
513
514   // Save custom properties
515   ModuleBase_Preferences::updateConfigByResources();
516   QDialog::accept();
517 }
518
519 void ModuleBase_PreferencesDlg::modified(ModuleBase_Prefs& theModified) const
520 {
521   theModified = myPreferences->modified();
522 }
523
524 void ModuleBase_PreferencesDlg::onDefault()
525 {
526   // reset main resources. It throwns all resource manager items to the
527   // initial/default state. If there is no a default state of the item,
528   // it will be filled with an empty value. It concernerned to plugin
529   // config items, like visualization color. The main xml do not contains
530   // default values for them. So, it is important to reset the config
531   // properties after reseting the resources preferences.
532   ModuleBase_Preferences::resetResourcePreferences(myPreferences);
533   // reset plugin's resources. It fills the config resources with the default
534   // values, stores result in the resource manager and retrieve the preferences
535   // items with these values.
536   ModuleBase_Preferences::resetConfigPropPreferences(myPreferences);
537 }
538
539 void ModuleBase_PreferencesDlg::showEvent(QShowEvent* theEvent)
540 {
541   QDialog::showEvent(theEvent);
542   adjustSize();
543 }
544
545 //**********************************************************
546 //**********************************************************
547 //**********************************************************
548 void ModuleBase_PreferencesMgr::changedResources(const ResourceMap& theMap)
549 {
550   myModified.clear();
551   ResourceMap::ConstIterator it;
552   QString sec, param;
553   for (it = theMap.begin(); it != theMap.end(); ++it) {
554     ModuleBase_Pref aPref;
555     it.key()->resource(aPref.first, aPref.second);
556     myModified.append(aPref);
557   }
558 }