/*! * * Copyright (c) 2021-2022 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file MSettings.h * \author (last) Behrouz NematiPour * \date (last) 10-Aug-2021 * \author (original) Behrouz NematiPour * \date (original) 29-Mar-2021 * */ #pragma once // Qt #include #include #include // Project #include "main.h" // Doxygen : do not remove // Define #define _Settings Storage::MSettings::I() // namespace namespace Storage { // FixMe: the model and controller need review and some functionalities need to be moved. // FixMe: the controller should be the Singleton not the model. class MSettings : public QObject { Q_OBJECT struct KeyValue { QString category; QString location; QList keys; QList values; }; QMap _settings; QMap _category; QMutex _mutex; // Singleton SINGLETON(MSettings) public: QStringList categorys(); QStringList groups (); QStringList groups (const QString &vCategory); QStringList keys (const QString &vGroup ); QString key (const QString &vGroup , uint vIndex); QVariantList values (const QString &vGroup ); QVariant value (const QString &vGroup , const QString &vKey); QString location (const QString &vGroup ); void add (const QString &vGroup, const QString &vKey, const QVariant &vValue, const QString &vLocation, const QString &vCategory); // the utility static functions private : QString _datetimeFormat = "MM/dd/yyyy HH:mm:ss"; public : void datetimeFormat(); public : QString getDatetimeFormat() { return _datetimeFormat; } }; } typedef struct{} SettingsData; // it has literally been defined to be used for overloading