/*! * * Copyright (c) 2021-2024 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 RxProfiles.h * \author (last) Behrouz NematiPour * \date (last) 13-Mar-2024 * \author (original) Behrouz NematiPour * \date (original) 04-May-2021 * */ #pragma once // Qt #include #include #include // Project #include "main.h" // Doxygen : do not remove #include "Logger.h" #include "MRxProfilesData.h" // define #define _RxProfilesController Storage::RxProfiles::I() //TODO: Change name to be a controller namespace Storage { /*! * \brief The RxProfiles class * This class is the controller which converts/saves/exports model to be used in the UI/RxProfiles */ class RxProfiles : public QObject { Q_OBJECT const int _interval = 1000; // 1s const int _pendingInterval= 60 ; // 1m int _pendingCounter = 0 ; // const int _RxLimit = 10 ; // SRS- const QString _sep = ","; QString _rxProfilesPath; const char* _rxProfiles = "rxp"; QFutureWatcher _saveWatcher; QFutureWatcher _exportWatcher; QFutureWatcher _importWatcher; QString _dateFormat = "yyyy/MM/dd" ; QString _timeFormat = "HH:mm" ; QString _datetimeFormat = _dateFormat + " " + _timeFormat; enum Role { eTitle, eValue, eCount }; QString string(quint8 vIndex , const QStringList &vStringList) const { QString str = ""; if (vIndex < vStringList.count()) { str = vStringList[vIndex]; str.remove(_sep); } return str; } QString value(quint8 vIndex) const { return string(vIndex, _values );} // Lists QStringList _values; void initConnections(); bool saveLog (const QString &fileName); void saveLogConcurrent (const QString &fileName); bool exportLog (); void exportLogConcurrent(); bool importLog (); void importLogConcurrent(); bool fileLimitReached (); NOTIFIER(isIdle) SINGLETON(RxProfiles) //protected: // void timerEvent(QTimerEvent *) override; public: RxProfilesData initModel(const QFileInfo &rxProfile); void checkFavorite(const QFileInfo &rxProfile); QString rxProfilesPath () ; private slots: void onSave (); void onExport (); void onImport (); void onReceieveRxProfileList ( const QFileInfoList &vRxProfileList ); public slots: // void doFavorite (); void doSave (const QString &fileName); void doExport (); void doImport (); void doInitRxProfiles(); signals: void didNotification ( const QString &vNotification ); void didFilesList ( const QString &vRxProfileList , const QStringList &vRxProfile ); void didRxProfileList ( const QList &vRxProfileDataList); }; }