#ifndef SETTINGS_H
#define SETTINGS_H

#include <QObject>
#include <QSettings>

class Settings : public QSettings
{
    Q_OBJECT
public:
    Settings(const QString &fileName, Format format, const QString group, QObject *parent = nullptr);
    ~Settings();

    QString group() const;
    void setGroup(const QString &group);

    QVariant value(const QString &key, const QVariant &defaultValue = QVariant());
    void setValue(const QString &key, const QVariant &value);

    void remove(const QString &key);
    bool contains(const QString &key);

    QList<QMap<QString, QVariant> > readArray(const QString &prefix);
    void setArray(const QString &prefix, const QList<QMap<QString, QVariant> > &hashList);

    void clear();

    QStringList allKeys();
    QStringList childGroups();

signals:
    void settingsChanged();

protected:
    bool event(QEvent *event);

private:
    QString m_group;

};

#endif // SETTINGS_H
