]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModuleBase/ModuleBase_Preferences.cpp
Salome HOME
669014dda780a75905ebf848e99900d28850dad8
[modules/shaper.git] / src / ModuleBase / ModuleBase_Preferences.cpp
1 // Copyright (C) 2014-2022  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 opening a study
175   int group = thePref->addPreference(QObject::tr("Opening a study"), generalTab,
176                                      SUIT_PreferenceMgr::Auto, QString(), QString());
177
178   int actId = thePref->addPreference(QObject::tr("Activate"), group, SUIT_PreferenceMgr::Selector,
179                                      ModuleBase_Preferences::GENERAL_SECTION,
180                                      "part_activation_study");
181   thePref->setItemProperty("strings", actItemList, actId);
182   thePref->setItemProperty("indexes", actIdList, actId);
183
184   QStringList visuItemList;
185   visuItemList << QObject::tr("As stored in HDF")
186                << 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 << 3;
192
193   int visuId = thePref->addPreference(QObject::tr("Display"), group, SUIT_PreferenceMgr::Selector,
194                                       ModuleBase_Preferences::GENERAL_SECTION,
195                                       "part_visualization_study");
196   thePref->setItemProperty("strings", visuItemList, visuId);
197   thePref->setItemProperty("indexes", visuIdList, visuId);
198
199   // Group related to running a python script
200   group = thePref->addPreference(QObject::tr("Launching a python script"), generalTab,
201                                  SUIT_PreferenceMgr::Auto, QString(), QString());
202
203   visuItemList.clear();
204   visuItemList << QObject::tr("Last item in each folder")
205                << QObject::tr("All items")
206                << QObject::tr("No visualization");
207
208   visuIdList.clear();
209   visuIdList << 0 << 1 << 2;
210
211   visuId = thePref->addPreference(QObject::tr("Display"), group, SUIT_PreferenceMgr::Selector,
212                                   ModuleBase_Preferences::GENERAL_SECTION,
213                                   "part_visualization_script");
214   thePref->setItemProperty("strings", visuItemList, visuId);
215   thePref->setItemProperty("indexes", visuIdList, visuId);
216 }
217
218 void ModuleBase_Preferences::updateSketchTab(ModuleBase_IPrefMgr* thePref, int thePageId)
219 {
220   int sketchTab   = thePref->addPreference(QObject::tr("Sketch"), thePageId,
221                              SUIT_PreferenceMgr::Auto, QString(), QString());
222   int allowChange = thePref->addPreference(
223                            QObject::tr("Allow automatic constraint substitution/remove"),
224                            sketchTab, SUIT_PreferenceMgr::GroupBox,
225                            "Sketch", "allow_change_constraint");
226   thePref->addPreference(QObject::tr("Notify automatic constraint substitution/remove"),
227            allowChange, SUIT_PreferenceMgr::Bool, "Sketch", "notify_change_constraint");
228 }
229
230 void ModuleBase_Preferences::createCustomPage(ModuleBase_IPrefMgr* thePref, int thePageId)
231 {
232   SUIT_ResourceMgr* aResMgr = ModuleBase_Preferences::resourceMgr();
233
234   // Make a Tab from each section
235   std::list<std::string> aSections = Config_PropManager::getSections();
236   std::list<std::string>::const_iterator it;
237   for (it = aSections.cbegin(); it != aSections.cend(); ++it) {
238     Config_Properties aProps = Config_PropManager::getProperties(*it);
239     int aTab = thePref->prefMgr()->addItem(QString((*it).c_str()), thePageId);
240     thePref->prefMgr()->setItemProperty("columns", 2, aTab);
241
242     Config_Properties::const_iterator aIt;
243     for (aIt = aProps.cbegin(); aIt != aProps.cend(); ++aIt) {
244       Config_Prop* aProp = (*aIt);
245       // check that the property is defined
246       QString aSection(aProp->section().c_str());
247       QString aName(aProp->name().c_str());
248       if (!aResMgr->hasValue(aSection, aName))
249         aResMgr->setValue(aSection, aName, QString(aProp->value().c_str()));
250
251       // Add item
252       if (aProp->type() != Config_Prop::Disabled) {
253         SUIT_PreferenceMgr::PrefItemType aPrefType = SUIT_PreferenceMgr::Auto;
254         switch (aProp->type()) {
255         case Config_Prop::Directory:
256           aPrefType = SUIT_PreferenceMgr::File;
257           break;
258         case Config_Prop::Cursor:
259           aPrefType = SUIT_PreferenceMgr::Selector;
260           break;
261         default:
262           aPrefType = (SUIT_PreferenceMgr::PrefItemType) aProp->type();
263         }
264
265         int anId = thePref->addPreference(QObject::tr(aProp->title().c_str()), aTab, aPrefType,
266                                           QString::fromStdString(aProp->section()),
267                                           QString::fromStdString(aProp->name()));
268
269         switch (aProp->type()) {
270         case Config_Prop::Directory:
271           thePref->setItemProperty("path_type", Qtx::PT_Directory, anId);
272           break;
273         case SUIT_PreferenceMgr::DblSpin:
274           if (aProp->min() != "") {
275             double aMin = QString(aProp->min().c_str()).toDouble();
276             thePref->setItemProperty("min", aMin, anId);
277           }
278           if (aProp->max() != "") {
279             double aMax = QString(aProp->max().c_str()).toDouble();
280             thePref->setItemProperty("max", aMax, anId);
281           }
282           break;
283         case SUIT_PreferenceMgr::IntSpin:
284           if (aProp->min() != "") {
285             int aMin = QString(aProp->min().c_str()).toInt();
286             thePref->setItemProperty("min", aMin, anId);
287           }
288           if (aProp->max() != "") {
289             int aMax = QString(aProp->max().c_str()).toInt();
290             thePref->setItemProperty("max", aMax, anId);
291           }
292           break;
293         case Config_Prop::Cursor:
294           {
295             QList<QVariant> aIndicesList;
296             QList<QVariant> aIconsList;
297             aIndicesList << 0 << 1 << 2;
298             aIconsList << QPixmap(":pictures/ArrowCursor.png") <<
299               QPixmap(":pictures/CrossCursor.png") <<
300               QPixmap(":pictures/HandCursor.png");
301
302             thePref->setItemProperty("indexes", aIndicesList, anId);
303             thePref->setItemProperty("icons", aIconsList, anId);
304           }
305           break;
306         default: // [to avoid compilation warnings]
307           break;
308         }
309       }
310     }
311   }
312 }
313
314 /**
315 * Implementation of preferences manager interface
316 */
317 class ModuleBase_PrefMgr: public ModuleBase_IPrefMgr
318 {
319 public:
320   /// Constructor
321   /// \param theMgr a preferences manager
322   ModuleBase_PrefMgr(ModuleBase_PreferencesMgr* theMgr):myMgr(theMgr) {}
323
324   virtual int addPreference(const QString& theLbl, int pId,
325                             SUIT_PreferenceMgr::PrefItemType theType,
326                             const QString& theSection, const QString& theName )
327   {
328     return myMgr->addItem(theLbl, pId, theType, theSection, theName);
329   }
330
331   virtual void setItemProperty( const QString& thePropName, const QVariant& theValue,
332                                const int theId = -1) {
333     myMgr->setItemProperty(thePropName, theValue, theId);
334   }
335
336   virtual SUIT_PreferenceMgr* prefMgr() const { return myMgr; }
337
338 private:
339   ModuleBase_PreferencesMgr* myMgr;
340 };
341
342 //**********************************************************
343 //**********************************************************
344 //**********************************************************
345 ModuleBase_PreferencesDlg::ModuleBase_PreferencesDlg(SUIT_ResourceMgr* theResurces,
346   QWidget* theParent)
347     : QDialog(theParent,
348       Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint),
349       myIsChanged(false)
350 {
351   setWindowTitle(tr("Edit preferences"));
352
353   QVBoxLayout* main = new QVBoxLayout(this);
354   main->setMargin(5);
355   main->setSpacing(5);
356
357   myPreferences = new ModuleBase_PreferencesMgr(theResurces, this);
358   main->addWidget(myPreferences);
359
360   setFocusProxy(myPreferences);
361   myPreferences->setFrameStyle(QFrame::Box | QFrame::Sunken);
362
363   QDialogButtonBox* aBtnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel |
364                                                    QDialogButtonBox::Reset,
365                                                    Qt::Horizontal, this);
366   QPushButton* aDefaultButton = aBtnBox->button(QDialogButtonBox::Reset);
367   aDefaultButton->setText(tr("Default"));
368   connect(aDefaultButton, SIGNAL(clicked()), this, SLOT(onDefault()));
369
370   main->addWidget(aBtnBox);
371   connect(aBtnBox, SIGNAL(accepted()), this, SLOT(accept()));
372   connect(aBtnBox, SIGNAL(rejected()), this, SLOT(reject()));
373   createEditors();
374
375   myPreferences->retrieve();
376 }
377
378 ModuleBase_PreferencesDlg::~ModuleBase_PreferencesDlg()
379 {
380 }
381
382 void ModuleBase_PreferencesDlg::createEditors()
383 {
384   int aPage = myPreferences->addItem(tr("Desktop"));
385   myPreferences->setItemIcon(aPage, QIcon(":pictures/view_prefs.png"));
386
387   createMenuPage(aPage);
388   createViewerPage(aPage);
389
390   aPage = myPreferences->addItem(tr("Module"));
391   myPreferences->setItemIcon(aPage, QIcon(":pictures/module.png"));
392
393   ModuleBase_PrefMgr aMgr(myPreferences);
394   ModuleBase_Preferences::createEditContent(&aMgr, aPage);
395 }
396
397 void ModuleBase_PreferencesDlg::createViewerPage(int thePageId)
398 {
399   int viewTab = myPreferences->addItem(tr("Viewer"), thePageId);
400
401   QStringList gradList;
402   gradList << tr("Horizontal gradient") << tr("Vertical gradient") << tr("First diagonal gradient")
403            << tr("Second diagonal gradient") << tr("First corner gradient")
404            << tr("Second corner gradient") << tr("Third corner gradient")
405            << tr("Fourth corner gradient");
406
407   QList<QVariant> idList;
408   for (int i = 0; i < gradList.size(); i++)
409     idList << i;
410
411   int bgGroup = myPreferences->addItem(tr("Background"), viewTab);
412
413   QString aImgFiles("Image files (*.bmp *.gif *.pix *.xwd *.rgb *.rs)");
414
415   int bgId = myPreferences->addItem(tr("Viewer 3d"), bgGroup, SUIT_PreferenceMgr::Background,
416                                     ModuleBase_Preferences::VIEWER_SECTION, "background");
417   myPreferences->setItemProperty("gradient_names", gradList, bgId);
418   myPreferences->setItemProperty("gradient_ids", idList, bgId);
419   myPreferences->setItemProperty("texture_enabled", true, bgId);
420   myPreferences->setItemProperty("texture_center_enabled", true, bgId);
421   myPreferences->setItemProperty("texture_tile_enabled", true, bgId);
422   myPreferences->setItemProperty("texture_stretch_enabled", true, bgId);
423   myPreferences->setItemProperty("custom_enabled", false, bgId);
424   myPreferences->setItemProperty("image_formats", aImgFiles, bgId);
425
426   // Create other parameters group in viewer tab
427   int selectionGroup = myPreferences->addItem(tr("Default selection"), viewTab);
428   myPreferences->setItemProperty("columns", 3, selectionGroup);
429   myPreferences->addItem(tr("Faces"), selectionGroup,
430                          SUIT_PreferenceMgr::Bool,
431                          ModuleBase_Preferences::VIEWER_SECTION, "face-selection");
432   myPreferences->addItem(tr("Edges"), selectionGroup,
433                          SUIT_PreferenceMgr::Bool,
434                          ModuleBase_Preferences::VIEWER_SECTION, "edge-selection");
435   myPreferences->addItem(tr("Vertices"), selectionGroup,
436                          SUIT_PreferenceMgr::Bool,
437                          ModuleBase_Preferences::VIEWER_SECTION, "vertex-selection");
438
439   int sensitivityGroup = myPreferences->addItem(tr("Selection sensitivity"), viewTab);
440   myPreferences->setItemProperty("columns", 2, sensitivityGroup);
441   myPreferences->addItem(tr("Vertex"), sensitivityGroup, SUIT_PreferenceMgr::DblSpin,
442                          ModuleBase_Preferences::VIEWER_SECTION, "point-selection-sensitivity");
443   myPreferences->addItem(tr("Edge"), sensitivityGroup, SUIT_PreferenceMgr::DblSpin,
444                          ModuleBase_Preferences::VIEWER_SECTION, "edge-selection-sensitivity");
445
446   int highlightGroup = myPreferences->addItem(tr("Additional highlighting"), viewTab);
447   myPreferences->setItemProperty("columns", 2, highlightGroup);
448   myPreferences->addItem(tr("In 3d mode"), highlightGroup,
449     SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::VIEWER_SECTION, "highlighting-3d");
450   myPreferences->addItem(tr("In 2d mode"), highlightGroup,
451     SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::VIEWER_SECTION, "highlighting-2d");
452
453   int colorScaleGroup = myPreferences->addItem(tr("Color scale"), viewTab);
454   myPreferences->setItemProperty("columns", 4, colorScaleGroup);
455   int aItem = myPreferences->addItem(tr("X position"), colorScaleGroup,
456     SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_x_position");
457   myPreferences->setItemProperty("min", 0, aItem);
458   myPreferences->setItemProperty("max", 1, aItem);
459
460   aItem = myPreferences->addItem(tr("Y position"), colorScaleGroup,
461     SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_y_position");
462   myPreferences->setItemProperty("min", 0, aItem);
463   myPreferences->setItemProperty("max", 1, aItem);
464
465   aItem = myPreferences->addItem(tr("Width"), colorScaleGroup,
466     SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_width");
467   myPreferences->setItemProperty("min", 0, aItem);
468   myPreferences->setItemProperty("max", 1, aItem);
469
470   aItem = myPreferences->addItem(tr("Height"), colorScaleGroup,
471     SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_height");
472   myPreferences->setItemProperty("min", 0, aItem);
473   myPreferences->setItemProperty("max", 1, aItem);
474
475   aItem = myPreferences->addItem(tr("Intervals number"), colorScaleGroup,
476     SUIT_PreferenceMgr::Integer, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_nb_intervals");
477   myPreferences->setItemProperty("min", 0, aItem);
478   myPreferences->setItemProperty("max", 100, aItem);
479
480   aItem = myPreferences->addItem(tr("Text height"), colorScaleGroup,
481     SUIT_PreferenceMgr::Integer, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_text_height");
482   myPreferences->setItemProperty("min", 0, aItem);
483   myPreferences->setItemProperty("max", 100, aItem);
484
485   aItem = myPreferences->addItem(tr("Text color"), colorScaleGroup,
486     SUIT_PreferenceMgr::Color, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_text_color");
487 }
488
489 void ModuleBase_PreferencesDlg::createMenuPage(int thePageId)
490 {
491   int aMenuTab = myPreferences->addItem(tr("Main menu"), thePageId);
492
493   int aSizeGroup = myPreferences->addItem(tr("Size"), aMenuTab);
494   myPreferences->setItemProperty("columns", 1, aSizeGroup);
495
496   int aRowsNb = myPreferences->addItem(tr("Number of rows"), aSizeGroup,
497                                        SUIT_PreferenceMgr::IntSpin,
498                                        ModuleBase_Preferences::MENU_SECTION,
499                                        "rows_number");
500   myPreferences->setItemProperty("min", 1, aRowsNb);
501   myPreferences->setItemProperty("max", 6, aRowsNb);
502
503   myPreferences->addItem(tr("Show Status Bar"), aSizeGroup,
504                          SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::MENU_SECTION,
505                          "status_bar");
506 }
507
508 void ModuleBase_PreferencesDlg::accept()
509 {
510   myPreferences->store();
511   myIsChanged = true;
512
513   // Save custom properties
514   ModuleBase_Preferences::updateConfigByResources();
515   QDialog::accept();
516 }
517
518 void ModuleBase_PreferencesDlg::modified(ModuleBase_Prefs& theModified) const
519 {
520   theModified = myPreferences->modified();
521 }
522
523 void ModuleBase_PreferencesDlg::onDefault()
524 {
525   // reset main resources. It throwns all resource manager items to the
526   // initial/default state. If there is no a default state of the item,
527   // it will be filled with an empty value. It concernerned to plugin
528   // config items, like visualization color. The main xml do not contains
529   // default values for them. So, it is important to reset the config
530   // properties after reseting the resources preferences.
531   ModuleBase_Preferences::resetResourcePreferences(myPreferences);
532   // reset plugin's resources. It fills the config resources with the default
533   // values, stores result in the resource manager and retrieve the preferences
534   // items with these values.
535   ModuleBase_Preferences::resetConfigPropPreferences(myPreferences);
536 }
537
538 void ModuleBase_PreferencesDlg::showEvent(QShowEvent* theEvent)
539 {
540   QDialog::showEvent(theEvent);
541   adjustSize();
542 }
543
544 //**********************************************************
545 //**********************************************************
546 //**********************************************************
547 void ModuleBase_PreferencesMgr::changedResources(const ResourceMap& theMap)
548 {
549   myModified.clear();
550   ResourceMap::ConstIterator it;
551   QString sec, param;
552   for (it = theMap.begin(); it != theMap.end(); ++it) {
553     ModuleBase_Pref aPref;
554     it.key()->resource(aPref.first, aPref.second);
555     myModified.append(aPref);
556   }
557 }