*******************************************************************************/
-//Created by Bartosz Szatkowski
+/*! \file settings.h
+\brief Settings object for plugins \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 to store some additional info in
+ plugin Settings.
-//! Plugin specific configuration
+ It's important for plugin to store all information given to it in Settings.*/
class Settings {
public:
Settings(){}
+ Settings(const Settings* set) {
+ _settings = QHash<QString, QString>(set->_settings);
+ }
+ ~Settings(){}
- /*! \retrun value fo given key
+ /*! \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