Index: sources/view/settings/VSettings.h =================================================================== diff -u -r2216ac6ac7f77437a7c29ac8b4043be01bc4609e -r6c6f1f5d466badd9b4fd67be7c907234c342b2a2 --- sources/view/settings/VSettings.h (.../VSettings.h) (revision 2216ac6ac7f77437a7c29ac8b4043be01bc4609e) +++ sources/view/settings/VSettings.h (.../VSettings.h) (revision 6c6f1f5d466badd9b4fd67be7c907234c342b2a2) @@ -1,13 +1,13 @@ /*! * - * Copyright (c) 2019-2020 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.cpp - * \author (last) Behrouz NematiPour - * \date (last) 29-Mar-2021 + * \file VSettings.h + * \author (last) Vy + * \date (last) 04-Apr-2023 * \author (original) Behrouz NematiPour * \date (original) 29-Mar-2021 * @@ -22,19 +22,79 @@ #include "main.h" #include "MSettings.h" #include "VView.h" +#include "StorageGlobals.h" +#include "GuiController.h" namespace View { class VSettings : public QObject { Q_OBJECT - CONSTANT(QString , groupFormat, "%1^%2" ) - PROPERTY(bool , initialized, false ) - PROPERTY(QVariantMap, category , {} ) - PROPERTY(QVariantMap, settings , {} ) + 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. + // 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 , {} ) + + 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); + }; }