/*! * * Copyright (c) 2021-2023 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 VSettings.h * \author (last) Behrouz NematiPour * \date (last) 28-Oct-2022 * \author (original) Behrouz NematiPour * \date (original) 29-Mar-2021 * */ #pragma once // Qt #include #include // Project #include "main.h" #include "MSettings.h" #include "VView.h" #include "StorageGlobals.h" #include "GuiController.h" namespace View { class VSettings : public QObject { Q_OBJECT QString _location = QString(Storage::Settings_Category_InstructionsImagesLoc).arg(Storage::Settings_Path_Name); typedef QList TKeysList; typedef struct { QString location; TKeysList keys ; QVariantList values ; } TInstruction ; QMap _instructionMap; typedef qint16 TID ; typedef qint16 TParamIndex ; typedef struct { QString group ; quint16 keyIndex; quint16 locIndex; quint16 prmIndex; QString prmExtra; quint16 prmRound; } TLocation; typedef QList TLocationList; typedef QMap TReplacements; TReplacements _replacements; TRIGGER ( bool , adjustment , 0 ) // TODO: This view needs modification and it needs to isolate the settings and have its own specific properties, not the complete settings exposed to QML and let QML access it. // Don't use QVariantHash, qml doesn't like it and won't show the values, *** and not even complains/errors ***. CONSTANT(QString , groupFormat , "%1^%2" ) PROPERTY(bool , initialized , false ) PROPERTY(QStringList , categorys , {} ) PROPERTY(QVariantMap , instructions , {} ) SETTINGS(QString , servicePass , "" , Storage::Settings_Category_SettingsSystem , "Service" , "Password" ) SETTINGS(quint8 , alarmVolume , 100 , Storage::Settings_Category_SettingsSystem , "Alarm" , "Volume" ) SETTINGS(bool , noCANBus , false , Storage::Settings_Category_NoCANBus , "Navigation" , "Create Treatment To Patient ID" ) VIEW_DEC(VSettings, SettingsData) private: TKeysList updateReplacements ( const QString &vGroup, const QStringList &vKeys ); void updateInstructions ( const QString &vGroup, const TKeysList &vKeysList, const QVariantList &vValues ); void updateInstructions ( const QString &vGroup ); QString encryptString (const QString &vString ); public slots: bool isPasswordValid (const QString &vPassword); bool isPasswordMatch (const QString &vPassword); void updatePassword (const QString &vPassword); private slots: void onActionReceive (GuiActionType vAction, const QVariantList &vData); }; }