removeAccents refactorized out to the AccentsNormalizer class
[mdictionary] / trunk / src / includes / settings.h
index 9434fb6..9a8e043 100644 (file)
 
 *******************************************************************************/
 
-//Created by Bartosz Szatkowski
+/*! /file settings.h
+\brief Settings object for pluggins \see Settings
+
+\author Bartosz Szatkowski <bulislaw@linux.com>
+*/
 
 #ifndef SETTINGS_H
 #define SETTINGS_H
 
 #include <QString>
 #include <QHash>
-#include "CommonDictInterface.h"
+#include <QDebug>
 
-class CommonDictInterface;
+/*! Plugins or dictionaries may need to keep some of configuration between
+  sessions, moreover Backbone or GUI may want store some additional info in
+  plugin Settings.
 
-//! Plugin specific configuration
+  Its important for plugin to store all information given it in Settings.*/
 class Settings {
   public:
     Settings(){}
-    //! \retrun value fo given key
-    //! \param key
+    Settings(const Settings* set) {
+        _settings = QHash<QString, QString>(set->_settings);
+    }
+    ~Settings(){}
+
+    /*! \returns value fo given key
+         \param key
+    */
     QString value(const QString key) const {
-        if(!settings.contains(key)) {
+        if(!_settings.contains(key)) {
             return QString();
         }
-        return settings[key];
+        return _settings[key];
     }
 
     //! sets key to value
     void setValue(const QString key, const QString value) {
-        settings.insert(key, value);
+        _settings.insert(key, value);
+    }
+
+    QList<QString> keys() const {
+        return _settings.keys();
     }
 
 private:
-    QHash<QString, QString> settings;
+    QHash<QString, QString> _settings;
 };
 
 #endif // SETTINGS_H