Code_TYMPAN  4.4.0
Industrial site acoustic simulation
OPreferenceManager.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14  */
15 
16 /*
17  *
18  */
19 
20 #include "OPreferenceManager.h"
21 #include "DOMSave.h"
22 #include "Tympan/core/macros.h"
23 
24 #include <qfile.h>
25 #include <iostream>
26 #include <qtextstream.h>
27 
28 using namespace ::std;
29 
31 static const int _strBufferSize = 64;
32 
34 // OPreferenceManager
35 
37 {
39  setXMLRootNodeName("Preferences");
40  setXMLParamNodeName("Preference");
41  setCurrentDirectory("Main");
42 }
43 
44 OPreferenceManager::OPreferenceManager(const QString& currentDirectory)
45 {
47  setXMLRootNodeName("Preferences");
48  setXMLParamNodeName("Preference");
49  setCurrentDirectory(currentDirectory);
50 }
51 
52 OPreferenceManager::OPreferenceManager(const QString& rootNodeName, const QString& paramNodeName)
53 {
55  setXMLRootNodeName(rootNodeName);
56  setXMLParamNodeName(paramNodeName);
57  setCurrentDirectory("Main");
58 }
59 
60 OPreferenceManager::OPreferenceManager(const QString& rootNodeName, const QString& paramNodeName,
61  const QString& currentDirectory)
62 {
64  setXMLRootNodeName(rootNodeName);
65  setXMLParamNodeName(paramNodeName);
66  setCurrentDirectory(currentDirectory);
67 }
68 
70 {
71  reset();
72 }
73 
74 void OPreferenceManager::loadDefault(const char* defaultParams[][2], int nbParams)
75 {
77  // Charge le map avec les valeurs par defaut.
78  for (int i = 0; i < nbParams; i++)
79  {
80  (_prefDirs._dirMap[_curDir])._prefMap[defaultParams[i][0]] = defaultParams[i][1];
81  }
82 }
83 
85 {
86  _curDir = dir;
87 }
88 
90 {
92  // On vide le tableau, les QStrings sont effaces proprement...
93  _prefDirs._dirMap.clear();
94 }
95 
96 bool OPreferenceManager::readXML(QString fileName)
97 {
99  // int retval = 0;
100 
101  QDomDocument doc;
102  QFile file(fileName);
103  if (!file.open(QIODevice::ReadOnly))
104  {
105  std::cerr << "\nError when open '" << fileName.toLatin1().data() << "'\n";
106  return false;
107  }
108  QString errorMsg;
109  int errorLine = 0;
110  int errorColumn = 0;
111  if (!doc.setContent(&file, &errorMsg, &errorLine, &errorColumn))
112  {
113  std::cerr << "\nError during parsing: '" << fileName.toLatin1().data() << "'\n"
114  << "error message is: \n"
115  << errorMsg.toLatin1().constData() << "\n"
116  << "in line:" << errorLine << " in column:" << errorColumn << endl;
117  file.close();
118  return false;
119  }
120  file.close();
121  // On recupere le noeud Document
122  QDomDocument domDocument = doc;
123 
124  // On recupere l'element XML root du document
125  QDomElement rootElement = domDocument.documentElement();
126 
127  // Recense tous les elements enfants du root
128  QDomNodeList nodeList = rootElement.childNodes();
129 
130  QString str;
131 
132  int nodecount = nodeList.length();
133 
134  // Pour chaque noeud enfant du noeud root
135  for (int i = 0; i < nodecount; i++)
136  {
137  QDomNode curElem = nodeList.item(i);
138 
139  if (curElem.isElement())
140  {
141  // Le nom de la categorie
142  QString dir = curElem.nodeName();
143  // Recense tous les elements enfants du courant
144  QDomNodeList nodeList2 = curElem.childNodes();
145 
146  int nodecount2 = nodeList2.length();
147 
148  for (int j = 0; j < nodecount2; j++)
149  {
150  QDomElement curElem2 = nodeList2.item(j).toElement();
151  // Si c'est un noeud 'Preference'
152  if (!curElem2.isNull() && (_xmlParamNodeName == curElem2.nodeName()))
153  {
154  // On recupere les champs 'name' et 'value' du noeud
155  QString name = curElem2.attribute("key");
156  QString value = curElem2.attribute("value");
157  if (value.isEmpty())
158  {
159  value = "0";
160  }
161 
162  // Ajout de l'entree au tableau associatif
163  _prefDirs._dirMap[dir]._prefMap[name] = value;
164  }
165  }
166  }
167  }
168 
169  return true;
170 }
171 
172 bool OPreferenceManager::writeXML(QString fileName)
173 {
174  bool res = false;
175 
176  QDomImplementation domImpl;
177  // Declaration du type de document (DTD)
178  QString qualifiedName = _xmlRootNodeName; // Nom du noeud root
179  QString systemId = ""; //"Tympan.dtd "; // URI de la DTD
180 
181  QDomDocumentType docType = domImpl.createDocumentType(qualifiedName, QString(), systemId);
182  // Creation d'un Document XML vide (Precision: document != fichier)
183  QDomDocument domDocument = domImpl.createDocument(QString(), // root element namespace URI.
184  _xmlRootNodeName, // root element name
185  docType); // document type object (DTD).
186  // Recuperation du noeud root du document
187  QDomElement rootElement = domDocument.documentElement();
188  // Iteration du tableau associatif des preferences
189  ODirMap::ODirMapIt iter;
190  for (iter = _prefDirs._dirMap.begin(); iter != _prefDirs._dirMap.end(); iter++)
191  {
192  // La categorie correspondante
193  QString dir = (*iter).first;
194 
195  // Creation d'un nouveau noeud
196  QDomElement dirElem = domDocument.createElement(dir);
197  // Ajout du noeud au noeud root
198  rootElement.appendChild(dirElem);
199  // Iteration du tableau associatif des preferences
200  OPrefMap::OPrefMapIt iter2;
201  for (iter2 = _prefDirs._dirMap[dir]._prefMap.begin(); iter2 != _prefDirs._dirMap[dir]._prefMap.end();
202  iter2++)
203  {
204  // Creation d'un nouveau noeud
205  QDomElement prefElem = domDocument.createElement(_xmlParamNodeName);
206  // Ajout du noeud au noeud root
207  dirElem.appendChild(prefElem);
208 
209  // Ajout des attributs au nouveau noeud
210  prefElem.setAttribute("key", ((*iter2).first));
211  prefElem.setAttribute("value", ((*iter2).second));
212  }
213  }
214 
215  QFile file(fileName);
216  if (!file.open(QIODevice::WriteOnly))
217  {
218  return res;
219  }
220 
221  QTextStream ts(&file);
222  ts.setCodec("utf-8");
223  ts << domDocument.toString();
224 
225  file.close();
226 
227  res = true;
228  return res;
229 }
230 
231 bool OPreferenceManager::exists(const QString& pref)
232 {
233  return exists(_curDir, pref);
234 }
235 
236 bool OPreferenceManager::exists(const QString& dir, const QString& pref)
237 {
239  ite = _prefDirs._dirMap[dir]._prefMap.find(pref);
240  return (ite != _prefDirs._dirMap[dir]._prefMap.end());
241 }
242 
243 QString OPreferenceManager::getDirectory(const QString& pref)
244 {
245  ODirMap::ODirMapIt ite;
246  QString dir;
247 
248  // On parcours la totalite du tableau associatif
249  for (ite = _prefDirs._dirMap.begin(); ite != _prefDirs._dirMap.end(); ite++)
250  {
251  // La categorie courante
252  dir = (*ite).first;
253 
254  if (exists(dir, pref))
255  {
256  // On retourne le nom de la categorie
257  return dir;
258  }
259  }
260 
261  return dir;
262 }
263 
264 void OPreferenceManager::setString(const QString& pref, const QString& value)
265 {
266  setString(_curDir, pref, value);
267 }
268 
269 void OPreferenceManager::setString(const QString& dir, const QString& pref, const QString& value)
270 {
272  // ODirMap::iterator it;
273  _prefDirs._dirMap[dir]._prefMap.erase(pref);
274  // preference[pref] = value;
275 
276  // QString test = preference[pref];
277  // preference->insert(make_pair(pref, value));
278  // pair<QString, QString> couple = make_pair(pref, value);
279  // it = _prefDirs.find(dir);
280  // *it.insert(couple);
281  _prefDirs._dirMap[dir]._prefMap[pref] = value;
282 }
283 
284 QString OPreferenceManager::getString(const QString& pref)
285 {
286  return getString(_curDir, pref);
287 }
288 
289 QString OPreferenceManager::getString(const QString& dir, const QString& pref)
290 {
291  return _prefDirs._dirMap[dir]._prefMap[pref];
292 }
293 
294 void OPreferenceManager::setStringArray(const QString& pref, const QString* valueArray, const int& sizeArray)
295 {
296  setStringArray(_curDir, pref, valueArray, sizeArray);
297 }
298 
299 void OPreferenceManager::setStringArray(const QString& dir, const QString& pref, const QString* valueArray,
300  const int& sizeArray)
301 {
302  if (sizeArray <= 0)
303  {
304  return;
305  }
306 
307  for (int i = 0; i < sizeArray; i++)
308  {
309  setString(dir, pref + intToString(i), valueArray[i]);
310  }
311 }
312 
313 QString* OPreferenceManager::getStringArray(const QString& pref, int& sizeArray)
314 {
315  return getStringArray(_curDir, pref, sizeArray);
316 }
317 
318 QString* OPreferenceManager::getStringArray(const QString& dir, const QString& pref, int& sizeArray)
319 {
320  sizeArray = 0;
321 
322  // Recherche de la taille du tableau
323  while (exists(dir, pref + intToString(sizeArray)))
324  {
325  ++sizeArray;
326  }
327 
328  if (sizeArray <= 0)
329  {
330  return NULL;
331  }
332 
333  // Tableau de QString a retourner
334  QString* strs = new QString[sizeArray];
335 
336  for (int i = 0; i < sizeArray; i++)
337  {
338  strs[i] = getString(dir, pref + intToString(i));
339  }
340 
341  return strs;
342 }
343 
344 #if TY_ARCH_TYPE == TY_ARCHITECTURE_64
345 void OPreferenceManager::setUInt(const QString& pref, const unsigned int& value)
346 {
347  setUInt(_curDir, pref, value);
348 }
349 
350 void OPreferenceManager::setUInt(const QString& dir, const QString& pref, const unsigned int& value)
351 {
353  _prefDirs._dirMap[dir]._prefMap[pref] = uintToString(value);
354 }
355 
356 void OPreferenceManager::setUInt(const QString& pref, const size_t& value)
357 {
358  setUInt(_curDir, pref, value);
359 }
360 
361 void OPreferenceManager::setUInt(const QString& dir, const QString& pref, const size_t& value)
362 {
364  _prefDirs._dirMap[dir]._prefMap[pref] = uintToString(value);
365 }
366 
367  #if TY_COMPILER == TY_COMPILER_MSVC
368 void OPreferenceManager::setUInt(const QString& pref, const unsigned long& value)
369 {
370  setUInt(_curDir, pref, value);
371 }
372 
373 void OPreferenceManager::setUInt(const QString& dir, const QString& pref, const unsigned long& value)
374 {
376  _prefDirs._dirMap[dir]._prefMap[pref] = uintToString(value);
377 }
378  #endif
379 #else
380 void OPreferenceManager::setUInt(const QString& pref, const size_t& value)
381 {
382  setUInt(_curDir, pref, value);
383 }
384 
385 void OPreferenceManager::setUInt(const QString& dir, const QString& pref, const size_t& value)
386 {
388  _prefDirs._dirMap[dir]._prefMap[pref] = uintToString(value);
389 }
390 
391 void OPreferenceManager::setUInt(const QString& pref, const unsigned long& value)
392 {
393  setUInt(_curDir, pref, value);
394 }
395 
396 void OPreferenceManager::setUInt(const QString& dir, const QString& pref, const unsigned long& value)
397 {
399  _prefDirs._dirMap[dir]._prefMap[pref] = uintToString(value);
400 }
401 #endif
402 
403 void OPreferenceManager::setInt(const QString& pref, const int& value)
404 {
405  setInt(_curDir, pref, value);
406 }
407 
408 void OPreferenceManager::setInt(const QString& dir, const QString& pref, const int& value)
409 {
411  _prefDirs._dirMap[dir]._prefMap[pref] = intToString(value);
412 }
413 
414 int OPreferenceManager::getInt(const QString& pref)
415 {
416  return getInt(_curDir, pref);
417 }
418 
419 int OPreferenceManager::getInt(const QString& dir, const QString& pref)
420 {
421  QString str = _prefDirs._dirMap[dir]._prefMap[pref];
422  int res = str.toFloat();
423  return res;
424 }
425 
426 void OPreferenceManager::setBool(const QString& pref, const bool& value)
427 {
428  setBool(_curDir, pref, value);
429 }
430 
431 void OPreferenceManager::setBool(const QString& dir, const QString& pref, const bool& value)
432 {
434  _prefDirs._dirMap[dir]._prefMap[pref] = value ? "true" : "false";
435 }
436 
437 bool OPreferenceManager::getBool(const QString& pref)
438 {
439  return getBool(_curDir, pref);
440 }
441 
442 bool OPreferenceManager::getBool(const QString& dir, const QString& pref)
443 {
444  if (!exists(dir, pref)) // az++
445  {
446  return false;
447  }
448  QString sValue = _prefDirs._dirMap[dir]._prefMap[pref]; // az++
449  if (sValue.isEmpty())
450  {
451  return false;
452  }
453  return (_prefDirs._dirMap[dir]._prefMap[pref] == "true") ? true : false;
454 }
455 
456 void OPreferenceManager::setFloat(const QString& pref, const float& value)
457 {
458  setFloat(_curDir, pref, value);
459 }
460 
461 void OPreferenceManager::setFloat(const QString& dir, const QString& pref, const float& value)
462 {
464  _prefDirs._dirMap[dir]._prefMap[pref] = floatToString(value);
465 }
466 
467 float OPreferenceManager::getFloat(const QString& pref)
468 {
469  return getFloat(_curDir, pref);
470 }
471 
472 float OPreferenceManager::getFloat(const QString& dir, const QString& pref)
473 {
474  return _prefDirs._dirMap[dir]._prefMap[pref].toFloat();
475 }
476 
477 void OPreferenceManager::setDouble(const QString& pref, const double& value)
478 {
479  setDouble(_curDir, pref, value);
480 }
481 
482 void OPreferenceManager::setDouble(const QString& dir, const QString& pref, const double& value)
483 {
485  _prefDirs._dirMap[dir]._prefMap[pref] = doubleToString(value);
486 }
487 
488 double OPreferenceManager::getDouble(const QString& pref)
489 {
490  return getDouble(_curDir, pref);
491 }
492 
493 double OPreferenceManager::getDouble(const QString& dir, const QString& pref)
494 {
495  return _prefDirs._dirMap[dir]._prefMap[pref].toDouble();
496 }
497 
498 void OPreferenceManager::setFrame(const QString& pref, const int& posX, const int& posY, const int& sizeX,
499  const int& sizeY)
500 {
501  setFrame(_curDir, pref, posX, posY, sizeX, sizeY);
502 }
503 
504 void OPreferenceManager::setFrame(const QString& dir, const QString& pref, const int& posX, const int& posY,
505  const int& sizeX, const int& sizeY)
506 {
508  _prefDirs._dirMap[dir]._prefMap[pref + "PosX"] = intToString(posX);
509  _prefDirs._dirMap[dir]._prefMap[pref + "PosY"] = intToString(posY);
510  _prefDirs._dirMap[dir]._prefMap[pref + "SizeX"] = intToString(sizeX);
511  _prefDirs._dirMap[dir]._prefMap[pref + "SizeY"] = intToString(sizeY);
512 }
513 
514 void OPreferenceManager::getFrame(const QString& pref, int& posX, int& posY, int& sizeX, int& sizeY)
515 {
516  getFrame(_curDir, pref, posX, posY, sizeX, sizeY);
517 }
518 
519 void OPreferenceManager::getFrame(const QString& dir, const QString& pref, int& posX, int& posY, int& sizeX,
520  int& sizeY)
521 {
522  if (_prefDirs._dirMap[dir]._prefMap[pref + "PosX"].isEmpty())
523  {
524  posX = 0;
525  }
526  else
527  {
528  posX = _prefDirs._dirMap[dir]._prefMap[pref + "PosX"].toInt();
529  }
530 
531  if (_prefDirs._dirMap[dir]._prefMap[pref + "PosY"].isEmpty())
532  {
533  posY = 0;
534  }
535  else
536  {
537  posY = _prefDirs._dirMap[dir]._prefMap[pref + "PosY"].toInt();
538  }
539 
540  if (_prefDirs._dirMap[dir]._prefMap[pref + "SizeX"].isEmpty())
541  {
542  sizeX = 400;
543  }
544  else
545  {
546  sizeX = _prefDirs._dirMap[dir]._prefMap[pref + "SizeX"].toInt();
547  }
548 
549  if (_prefDirs._dirMap[dir]._prefMap[pref + "SizeY"].isEmpty())
550  {
551  sizeY = 400;
552  }
553  else
554  {
555  sizeY = _prefDirs._dirMap[dir]._prefMap[pref + "SizeY"].toInt();
556  }
557 }
558 
559 void OPreferenceManager::setPoint(const QString& pref, const int& x, const int& y)
560 {
561  setPoint(_curDir, pref, x, y);
562 }
563 
564 void OPreferenceManager::setPoint(const QString& dir, const QString& pref, const int& x, const int& y)
565 {
567  _prefDirs._dirMap[dir]._prefMap[pref + "X"] = intToString(x);
568  _prefDirs._dirMap[dir]._prefMap[pref + "Y"] = intToString(y);
569 }
570 
571 void OPreferenceManager::getPoint(const QString& pref, int& x, int& y)
572 {
573  getPoint(_curDir, pref, x, y);
574 }
575 
576 void OPreferenceManager::getPoint(const QString& dir, const QString& pref, int& x, int& y)
577 {
578  x = _prefDirs._dirMap[dir]._prefMap[pref + "X"].toInt();
579  y = _prefDirs._dirMap[dir]._prefMap[pref + "Y"].toInt();
580 }
581 
582 void OPreferenceManager::setColor(const QString& pref, const float& r, const float& g, const float& b)
583 {
584  setColor(_curDir, pref, r, g, b);
585 }
586 
587 void OPreferenceManager::setColor(const QString& dir, const QString& pref, const float& r, const float& g,
588  const float& b)
589 {
591  _prefDirs._dirMap[dir]._prefMap[pref + "R"] = floatToString(r);
592  _prefDirs._dirMap[dir]._prefMap[pref + "G"] = floatToString(g);
593  _prefDirs._dirMap[dir]._prefMap[pref + "B"] = floatToString(b);
594 }
595 
596 void OPreferenceManager::getColor(const QString& pref, float& r, float& g, float& b)
597 {
598  getColor(_curDir, pref, r, g, b);
599 }
600 
601 void OPreferenceManager::getColor(const QString& dir, const QString& pref, float& r, float& g, float& b)
602 {
603  r = _prefDirs._dirMap[dir]._prefMap[pref + "R"].toFloat();
604  g = _prefDirs._dirMap[dir]._prefMap[pref + "G"].toFloat();
605  b = _prefDirs._dirMap[dir]._prefMap[pref + "B"].toFloat();
606 }
607 
609 // Methodes statiques utilitaires.
611 
612 #if TY_ARCH_TYPE == TY_ARCHITECTURE_64
613 QString OPreferenceManager::uintToString(const unsigned int& val)
614 {
615  char buffer[_strBufferSize];
616  sprintf_s(buffer, "%d", val);
617  QString str(buffer);
618  return str;
619 }
620 
621 QString OPreferenceManager::uintToString(const size_t& val)
622 {
623  char buffer[_strBufferSize];
624  sprintf_s(buffer, "%zd", val);
625  QString str(buffer);
626  return str;
627 }
628  #if TY_COMPILER == TY_COMPILER_MSVC
629 QString OPreferenceManager::uintToString(const unsigned long& val)
630 {
631  char buffer[_strBufferSize];
632  sprintf_s(buffer, "%lu", val);
633  QString str(buffer);
634  return str;
635 }
636  #endif
637 #else
638 QString OPreferenceManager::uintToString(const size_t& val)
639 {
640  char buffer[_strBufferSize];
641  sprintf_s(buffer, "%d", val);
642  QString str(buffer);
643  return str;
644 }
645 
646 QString OPreferenceManager::uintToString(const unsigned long& val)
647 {
648  char buffer[_strBufferSize];
649  sprintf_s(buffer, "%lu", val);
650  QString str(buffer);
651  return str;
652 }
653 #endif
654 
655 QString OPreferenceManager::intToString(const int& val)
656 {
657  char buffer[_strBufferSize];
658  sprintf_s(buffer, "%d", val);
659  QString str(buffer);
660  return str;
661 }
662 
663 QString OPreferenceManager::floatToString(const float& val)
664 {
665  char buffer[_strBufferSize];
666  sprintf_s(buffer, "%f", val);
667  QString str(buffer);
668  return str;
669 }
670 
671 QString OPreferenceManager::doubleToString(const double& val)
672 {
673  char buffer[_strBufferSize];
674  sprintf_s(buffer, "%f", val);
675  QString str(buffer);
676  return str;
677 }
const char * name
QString _xmlParamNodeName
Nom des noeuds des parametres du fichier XML.
void loadDefault(const char *defaultParams[][2], int nbParams)
Charge le tableau associatif preference/valeur avec les valeurs par defaut.
void getColor(const QString &pref, float &r, float &g, float &b)
Charge les composantes RGB d'une couleur, en float.Utilise la categorie courante.
void setDouble(const QString &pref, const double &value)
Met a jour la valeur associee a une preference.
ODirMap _prefDirs
Tableau associatif parametre/valeur.
static QString doubleToString(const double &val)
QString getDirectory(const QString &pref)
Recherche le nom de la categorie pour une preference donnee.
void setBool(const QString &pref, const bool &value)
Met a jour la valeur associee a une preference. Si la preference n'existe pas, celle-ci est ajoutee a...
static QString floatToString(const float &val)
void setString(const QString &pref, const QString &value)
Met a jour la valeur associee a une preference.
static QString intToString(const int &val)
double getDouble(const QString &pref)
Recherche une ressource et retourne sa valeur associee. Utilise la categorie courante.
float getFloat(const QString &pref)
Recherche une ressource et retourne sa valeur associee. Utilise la categorie courante.
QString _curDir
Le nom de la categorie courante.
QString _xmlRootNodeName
Nom du noeud root du fichier XML.
void setUInt(const QString &pref, const unsigned int &value)
static QString uintToString(const unsigned int &val)
bool writeXML(QString fileName)
Enregistre le fichier de preference au format XML.
bool getBool(const QString &pref)
Recherche une ressource et retourne sa valeur associee. Utilise la categorie courante.
void setFrame(const QString &pref, const int &posX, const int &posY, const int &sizeX, const int &sizeY)
Sauvegarde la position et la taille d'une fenetre.
int getInt(const QString &pref)
Recherche une ressource et retourne sa valeur associee.Utilise la categorie courante.
void setFloat(const QString &pref, const float &value)
Met a jour la valeur associee a une preference.
void setXMLParamNodeName(QString name)
Change le nom des noeuds de parametres dans le fichier XML.
void setXMLRootNodeName(QString name)
Change le nom du noeud root du fichier XML.
bool readXML(QString fileName)
Ouvre un fichier de preference en XML et le parcours pour mettre a jour la tableau de preferences.
QString * getStringArray(const QString &pref, int &sizeArray)
Recherche une ressource et retourne son tableau de valeurs associees. Utilise la categorie courante.
void getPoint(const QString &pref, int &x, int &y)
Charge les coordonnees en pixel d'un point. Utilise la categorie courante.
void setColor(const QString &pref, const float &r, const float &g, const float &b)
Sauvegarde les composantes RGB d'une couleur, en float.Utilise la categorie courante.
void setStringArray(const QString &pref, const QString *valueArray, const int &sizeArray)
Met a jour un tableau de valeurs associees a une preference.
void reset()
Vide le tableau associatif preference/valeur.
bool exists(const QString &pref)
Test si une preference est presente dans le tableau de preferences. Utilise la categorie courante.
void setInt(const QString &pref, const int &value)
Met a jour la valeur associee a une preference.
void setPoint(const QString &pref, const int &x, const int &y)
Sauvegarde les coordonnees en pixel d'un point.
void setCurrentDirectory(QString dir)
Defini la categorie courante pour la lecture et l'ecriture de parametres.
void getFrame(const QString &pref, int &posX, int &posY, int &sizeX, int &sizeY)
Charge la position et la taille d'une fenetre. Utilise la categorie courante.
QString getString(const QString &pref)
Recherche une ressource et retourne sa valeur associee. Utilise la categorie courante.
std::map< QString, OPrefMap >::iterator ODirMapIt
std::map< QString, OPrefMap > _dirMap
std::map< QString, QString >::iterator OPrefMapIt