Index: sources/view/settings/VSettings.h =================================================================== diff -u -r6f2622be80fcaee8d71baf78404627381157970c -r6c6f1f5d466badd9b4fd67be7c907234c342b2a2 --- sources/view/settings/VSettings.h (.../VSettings.h) (revision 6f2622be80fcaee8d71baf78404627381157970c) +++ sources/view/settings/VSettings.h (.../VSettings.h) (revision 6c6f1f5d466badd9b4fd67be7c907234c342b2a2) @@ -1,13 +1,13 @@ /*! * - * Copyright (c) 2021-2022 Diality Inc. - All Rights Reserved. + * 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) 04-May-2021 + * \author (last) Vy + * \date (last) 04-Apr-2023 * \author (original) Behrouz NematiPour * \date (original) 29-Mar-2021 * @@ -23,13 +23,37 @@ #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()); + 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. @@ -39,12 +63,38 @@ PROPERTY(QStringList , categorys , {} ) PROPERTY(QVariantMap , instructions , {} ) - SETTINGS(QString , servicePass ,"123" , Storage::Settings_Category_SettingsSystem , "Service" , "Password" ) - SETTINGS(quint8 , alarmVolume , 100 , Storage::Settings_Category_SettingsSystem , "Alarm" , "Volume" ) + PROPERTY(bool , isDefaultServicePassword , false ) + + SETTINGS(QString , servicePass , "" , Storage::Settings_Category_SettingsSystem , "Service" , "Password" ) + SETTINGS(quint8 , alarmVolume , 5 , Storage::Settings_Category_SettingsSystem , "Alarm" , "Volume" ) + SETTINGS(bool , roWaterMode , false , Storage::Settings_Category_SettingsSystem , "RoWaterMode" , "RoWaterMode" ) SETTINGS(bool , noCANBus , false , Storage::Settings_Category_NoCANBus , "Navigation" , "Create Treatment To Patient ID" ) + TRIGGER (bool , encryptionPass, false ) + VIEW_DEC(VSettings, SettingsData) +private: + void initConnectionsSettings(); + + 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 defaultPassword (); + bool isPasswordDefault (); + QString hashedPassword (const QString &vPassword, bool vIsService); + +public slots: + bool isPasswordValid (const QString &vPassword); + + bool isServicePasswordMatch (const QString &vPassword); + void updateServicePassword (const QString &vPassword); + void checkServicePasswordSet (); + +private slots: + void onActionReceive (GuiActionType vAction, const QVariantList &vData); + }; }