diff --git a/doctor.cpp b/doctor.cpp new file mode 100644 index 0000000..74db51d --- /dev/null +++ b/doctor.cpp @@ -0,0 +1,17 @@ +/* + * Copyright (C) 2018-2022 QuasarApp. + * Distributed under the lgplv3 software license, see the accompanying + * Everyone is permitted to copy and distribute verbatim copies + * of this license document, but changing it is not allowed. +*/ + +#include "doctor.h" + +namespace QuasarAppUtils { + +Doctor::Doctor() +{ + +} + +} diff --git a/doctor.h b/doctor.h new file mode 100644 index 0000000..9a805a6 --- /dev/null +++ b/doctor.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2018-2022 QuasarApp. + * Distributed under the lgplv3 software license, see the accompanying + * Everyone is permitted to copy and distribute verbatim copies + * of this license document, but changing it is not allowed. +*/ + +#ifndef DOCTOR_H +#define DOCTOR_H + +#include + +namespace QuasarAppUtils { + +class iPill; +/** + * @brief The Doctor class is class that execute pills objects. + * The Doctor check issue that will be executed and if the issue realy then execute fix. + * @warning This is dangerous system because you may create bug in pill and doctor that will execute this pill may broke users app. + * @see iPill + */ +class Doctor: public QObject +{ + Q_OBJECT +public: + /** + * @brief Doctor This is base contructor of doctor calss. + * @param base This is list of known issues. + */ + Doctor(const QList>& base); + + /** + * @brief diagnostick This method run full diagnostick of this application. + * If the @a fix is true then doctor try fix the foundet issues. + * If the @a fix value if false then the Doctor emit the sigTroubleDetected signal. + * @param fix set this argument to tru if you want fix all foundet issues. + */ + void diagnostick(bool fix = false) const; + + /** + * @brief fix + * @param pill + */ + void fix(const QList>& pill) const; +signals: + /** + * @brief sigTroubleDetected This signal will emited when The doctor object found issues in this application. + * @param issues + * @see Doctor::diagnostick + */ + void sigTroubleDetected(QList> issues); + + /** + * @brief sigFixesFailed This signal emited when the doctor can't fix foundet issues. + * @param issues This is list of the unfixable issues. + */ + void sigFixesFailed(QList> issues); + + /** + * @brief sigFixesFinishedSuccessful This signal emited when the doctor fix foundet issues successfull. + * @param issues This is list of the fixed issues. + */ + void sigFixesFinishedSuccessful(QList> issues); + + +private: + QHash> _pillsData; +}; + + +} + +#endif // DOCTOR_H diff --git a/ipill.cpp b/ipill.cpp new file mode 100644 index 0000000..eb74275 --- /dev/null +++ b/ipill.cpp @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2018-2022 QuasarApp. + * Distributed under the lgplv3 software license, see the accompanying + * Everyone is permitted to copy and distribute verbatim copies + * of this license document, but changing it is not allowed. +*/ + + +#include "ipill.h" + +namespace QuasarAppUtils { + +iPill::iPill() +{ + +} + + +} diff --git a/ipill.h b/ipill.h new file mode 100644 index 0000000..9708fa0 --- /dev/null +++ b/ipill.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2018-2022 QuasarApp. + * Distributed under the lgplv3 software license, see the accompanying + * Everyone is permitted to copy and distribute verbatim copies + * of this license document, but changing it is not allowed. +*/ + + +#ifndef IPILL_H +#define IPILL_H + +#include + + +namespace QuasarAppUtils { + +/** + * @brief The iPill class is base interface for the pill object. + * The Pill object is independet tool that must be fix one issue for runned application. + * + * ## For Example: + * + * You has a sume bug, but you don't known about this bug. + * This big broken the database for your users, but you still don't known about this. + * You found this bug and create new patch for fix it, but databae of your users alredy broken, and you users can't fix this issues yasterself. + * So you can create a pill for fix broked database and delive to your users for fix thes issue. + * + * The Pill object structure should be has: + * * The Action that should be check if contains this issue or not ... + * * The Action taht should be fix issue. + * * Description of the issue. + * * Name of the issue. + * + * * @see iPill + */ +class iPill +{ +public: + iPill(); + + /** + * @brief name This method should be return name of this pill. + * @return name of this pill. + */ + virtual QString name() const = 0; + + /** + * @brief description This method should be return dital description of the issue that this pill will fix after execute (accept). + * @return string valeu with description. + */ + virtual QString description() const = 0; + +protected: + + /** + * @brief diagnostick This method execute action that should be check if exits issues or not. + * @note This method will executed only on the Doctor object. + * @return true if the issues is detected. + */ + virtual bool diagnostick() const = 0; + + /** + * @brief fix This method should be fix detected issue. + * @return true if the issue fixes successful else false + */ + virtual bool fix() const = 0; + + + friend class Doctor; +}; + +} +#endif // IPILL_H