setting.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*****************************************************************
  2. * Copyright (C) 2012 Marco Bavagnoli - lil.deimos@gmail.com *
  3. ******************************************************************/
  4. #ifndef SETTINGS_H
  5. #define SETTINGS_H
  6. #include <QObject>
  7. #include <QSettings>
  8. #include <QVariant>
  9. #include <QDir>
  10. #include <QList>
  11. #include <QDateTime>
  12. class Settings : public QObject
  13. {
  14. Q_OBJECT
  15. public:
  16. explicit Settings(QString, QString, QObject *parent = 0);
  17. void setFilePath(const QString &);
  18. QString filePath() const;
  19. Q_INVOKABLE void setValue(const QString & key, const QVariant & value);
  20. Q_INVOKABLE QVariant getValue(const QString & key, const QVariant & defaultValue = QVariant()) const;
  21. Q_INVOKABLE void removeArray( const QString & key);
  22. Q_INVOKABLE void removeArrayEntry( const QString & key , int index);
  23. Q_INVOKABLE void appendToArray( const QString & key, QMap<QString, QVariant> values);
  24. Q_INVOKABLE QList< QVariantMap > getArray( const QString & key);
  25. Q_INVOKABLE QString getArrayJson( const QString & key);
  26. Q_INVOKABLE QString getArrayXml( const QString & key);
  27. Q_INVOKABLE bool checkValueArray( const QString & key, const QString & arrayKey , const QString & value);
  28. Q_INVOKABLE int getIndexOfValueInArray( const QString & key, const QString & arrayKey , const QString & value );
  29. // Time functions
  30. Q_INVOKABLE int getTimeZone();
  31. Q_INVOKABLE QDateTime stringToDate(QString s);
  32. private:
  33. QString m_confFile;
  34. signals:
  35. public slots:
  36. };
  37. #endif