diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d7d0e4..2df0220 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # -# Copyright (C) 2020-2021 QuasarApp. -# Distributed under the lgplv3 software license, see the accompanying +# Copyright (C) 2020-2022 QuasarApp. +# Distributed under the GPLv3 software license, see the accompanying # Everyone is permitted to copy and distribute verbatim copies # of this license document, but changing it is not allowed. # @@ -33,46 +33,43 @@ include(submodules/CMake/QuasarApp.cmake) updateGitVars() set(DoctorPill_VERSION "0.${GIT_COMMIT_COUNT}.${GIT_COMMIT_HASH}") -set(DoctorPill_PACKAGE_ID "quasarapp.core.DoctorPill") -if (NOT DEFINED DoctorPill_TESTS) - set(DoctorPill_TESTS ON) +option(DOCTOR_PILL_GUI "Enable gui qml model for build" OFF) + +if (NOT DEFINED DOCTOR_PILL_TESTS) + set(DOCTOR_PILL_TESTS ON) if (DEFINED TARGET_PLATFORM_TOOLCHAIN) if (${TARGET_PLATFORM_TOOLCHAIN} STREQUAL "wasm32") - set(DoctorPill_TESTS OFF) + set(DOCTOR_PILL_TESTS OFF) + set(DOCTOR_EXAMPLE_TESTS OFF) endif() endif() if (ANDROID OR IOS) - set(DoctorPill_TESTS OFF) + set(DOCTOR_PILL_TESTS OFF) + set(DOCTOR_EXAMPLE_TESTS OFF) endif() - if (NOT QT_VERSION_MAJOR) - set(DoctorPill_TESTS OFF) - endif() endif() -if (NOT DEFINED DoctorPill_EXAMPLE) - set(DoctorPill_EXAMPLE ON) +if (NOT DEFINED DOCTOR_EXAMPLE_TESTS) + set(DOCTOR_EXAMPLE_TESTS ON) if (NOT QT_VERSION_MAJOR) - set(DoctorPill_EXAMPLE OFF) + set(DOCTOR_EXAMPLE_TESTS OFF) endif() endif() initAll() -updateGitVars() -set(DOCTOR_PILL_VERSION "0.${GIT_COMMIT_COUNT}.${GIT_COMMIT_HASH}") - add_subdirectory(src/Library) -if (DEFINED DoctorPill_EXAMPLE) +if (DEFINED DOCTOR_EXAMPLE_TESTS) add_subdirectory(src/Example) endif() -if (DoctorPill_TESTS) +if (DOCTOR_PILL_TESTS) add_subdirectory(tests) else() message("The ${PROJECT_NAME} tests is disabled.") diff --git a/src/Example/CMakeLists.txt b/src/Example/CMakeLists.txt index cbf6297..8810102 100644 --- a/src/Example/CMakeLists.txt +++ b/src/Example/CMakeLists.txt @@ -1,6 +1,6 @@ # -# Copyright (C) 2021-2021 QuasarApp. -# Distributed under the lgplv3 software license, see the accompanying +# Copyright (C) 2021-2022 QuasarApp. +# Distributed under the GPLv3 software license, see the accompanying # Everyone is permitted to copy and distribute verbatim copies # of this license document, but changing it is not allowed. # @@ -8,7 +8,6 @@ cmake_minimum_required(VERSION 3.14) set(CURRENT_PROJECT "${PROJECT_NAME}Eaxample") -option(SIGN_APP "This option enable od disabled sign apk and aab files" ON) file(GLOB SOURCE_CPP "*.cpp" @@ -52,79 +51,6 @@ target_include_directories(${CURRENT_PROJECT} PRIVATE ${PRIVATE_INCUDE_DIR}) SET(TARGET_DIR "${CMAKE_SOURCE_DIR}/Distro") file(MAKE_DIRECTORY ${TARGET_DIR}) -if (ANDROID) - - set(ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/android CACHE INTERNAL "") - set(ENV{ANDROID_API_VERSION} 31) - set(ANDROID_API_VERSION $ENV{ANDROID_API_VERSION}) - set(OPENSSL_ROOT_PATH "$ENV{OPENSSL_ROOT_DIR}") - - set(DoctorPill_EXTRA_LIBS - ${PROJECT_NAME} -# libName - ) - -# find_package(Qt${QT_VERSION_MAJOR} COMPONENTS AndroidExtras REQUIRED) -# target_link_libraries(${CURRENT_PROJECT} PRIVATE Qt${QT_VERSION_MAJOR}::AndroidExtras) - - if (SIGN_APP) - message("SIGN_APP") - addDeploySignedAPK(${CURRENT_PROJECT} - "${CMAKE_CURRENT_LIST_DIR}/android" - "QuasarAppProject" - "${SIGPATH}/quasarapp.keystore" - "${SIGPASS_QUASARAPP}" - "${TARGET_DIR}" - "${DoctorPill_EXTRA_LIBS}") - - else() - message("NO_SIGN_APP") - - addDeployAPK(${CURRENT_PROJECT} - "${CMAKE_CURRENT_LIST_DIR}/android" - "${TARGET_DIR}" - "${DoctorPill_EXTRA_LIBS}") - - endif() - set(manifest_file "${CMAKE_CURRENT_SOURCE_DIR}/android/AndroidManifest.xml") - configure_file("${manifest_file}.in" ${manifest_file} @ONLY) - - set(gradle_file "${CMAKE_CURRENT_SOURCE_DIR}/android/build.gradle") - configure_file("${gradle_file}.in" ${gradle_file} @ONLY) - - file(GLOB java_files - "android/src/com/quasarapp/androidtools/*.java" - "android/*.xml" - "android/*.gradle" - "android/gradlew" - "android/gradle.*" - - ) - - add_custom_target(${name}Android - SOURCES ${java_files} - ) - -elseif(IOS) -# set_xcode_property(${CURRENT_PROJECT} PRODUCT_BUNDLE_IDENTIFIER ${CHEATCARD_PACKAGE_ID} All) - - set_target_properties(${CURRENT_PROJECT} PROPERTIES - MACOSX_BUNDLE_GUI_IDENTIFIER ${DoctorPill_PACKAGE_ID} - MACOSX_BUNDLE_BUNDLE_VERSION ${DoctorPill_VERSION} - MACOSX_BUNDLE_SHORT_VERSION_STRING ${DoctorPill_VERSION} - ) -else() - # Desctop deploying - - message(GIT_COMMIT_COUNT = ${GIT_COMMIT_COUNT}) - - set(DeployFile "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/DoctorPill.json") - configure_file("${DeployFile}.in" ${DeployFile} @ONLY) - - addDeployFromCustomFile("DoctorPill" ${DeployFile}) - -endif() - if(QT_VERSION_MAJOR EQUAL 6) # Add This line if your project use the Quick module # qt_import_qml_plugins(${CURRENT_PROJECT}) diff --git a/src/Example/Deploy/DoctorPill.json b/src/Example/Deploy/DoctorPill.json index 28b46d1..e0fe852 100644 --- a/src/Example/Deploy/DoctorPill.json +++ b/src/Example/Deploy/DoctorPill.json @@ -13,7 +13,7 @@ ], "extraLib": "crypto", "targetDir": "/home/andrei/gitHub/DoctorPill/Distro", - "deployVersion": "0.1.2f207ec", + "deployVersion": "0.2.4486fd9", } diff --git a/src/Example/main.cpp b/src/Example/main.cpp index f3f95a6..ed1305d 100644 --- a/src/Example/main.cpp +++ b/src/Example/main.cpp @@ -1,6 +1,6 @@ //# -//# Copyright (C) 2021-2021 QuasarApp. -//# Distributed under the lgplv3 software license, see the accompanying +//# Copyright (C) 2021-2022 QuasarApp. +//# Distributed under the GPLv3 software license, see the accompanying //# Everyone is permitted to copy and distribute verbatim copies //# of this license document, but changing it is not allowed. //# diff --git a/src/Library/CMakeLists.txt b/src/Library/CMakeLists.txt index 6cfbc70..529a57d 100644 --- a/src/Library/CMakeLists.txt +++ b/src/Library/CMakeLists.txt @@ -1,38 +1,40 @@ # -# Copyright (C) 2020-2021 QuasarApp. -# Distributed under the lgplv3 software license, see the accompanying +# Copyright (C) 2020-2022 QuasarApp. +# Distributed under the GPLv3 software license, see the accompanying # Everyone is permitted to copy and distribute verbatim copies # of this license document, but changing it is not allowed. # cmake_minimum_required(VERSION 3.14) -add_definitions(-DDoctorPill_LIBRARY) +add_definitions(-DDOCTOR_PILL_LIBRARY) file(GLOB SOURCE_CPP - "*DoctorPill/*.cpp" - "private/*.cpp" + "*.cpp" + "*DoctorPillCore/*.cpp" ) -if (${QT_VERSION_MAJOR}) +if (DOCTOR_PILL_GUI) + file(GLOB SOURCE_CPP_GUI + "*DoctorPillGui/*.cpp" + ) + file(GLOB SOURCE_QRC "*.qrc" - "DoctorPill/*.qrc" - "private/*.qrc" + "DoctorPillCore/*.qrc" ) endif() + set(PUBLIC_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") set(PRIVATE_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/private") -add_library(${PROJECT_NAME} ${SOURCE_CPP} ${SOURCE_QRC}) +add_library(${PROJECT_NAME} ${SOURCE_CPP} ${SOURCE_QRC} ${SOURCE_CPP_GUI}) +target_link_libraries(${PROJECT_NAME} PUBLIC Qt${QT_VERSION_MAJOR}::Core ) -if (${QT_VERSION_MAJOR}) - target_link_libraries(${PROJECT_NAME} PUBLIC Qt${QT_VERSION_MAJOR}::Core ) -endif() target_include_directories(${PROJECT_NAME} PUBLIC ${PUBLIC_INCUDE_DIR}) target_include_directories(${PROJECT_NAME} PRIVATE ${PRIVATE_INCUDE_DIR}) diff --git a/src/Library/DoctorPill.qrc b/src/Library/DoctorPill.qrc index 3816532..513560b 100644 --- a/src/Library/DoctorPill.qrc +++ b/src/Library/DoctorPill.qrc @@ -1,7 +1,7 @@ DoctorPillModule/qmldir - DoctorPillModule/DoctorPill.qml + DoctorPillModule/DoctorView.qml languages/en.qm diff --git a/src/Library/DoctorPill/DoctorPill.h b/src/Library/DoctorPill/DoctorPill.h deleted file mode 100644 index b9cc4b8..0000000 --- a/src/Library/DoctorPill/DoctorPill.h +++ /dev/null @@ -1,16 +0,0 @@ -//# -//# Copyright (C) 2021-2021 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 "DoctorPill_global.h" - -inline void initDoctorPillResources() { Q_INIT_RESOURCE(DoctorPill); } - -namespace DoctorPill { - -bool DoctorPill_EXPORT init(); - -}; diff --git a/src/Library/DoctorPillCore/doctor.cpp b/src/Library/DoctorPillCore/doctor.cpp new file mode 100644 index 0000000..40ca973 --- /dev/null +++ b/src/Library/DoctorPillCore/doctor.cpp @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2018-2022 QuasarApp. + * Distributed under the GPLv3 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" + +#include "doctor.h" + +namespace DP { + +Doctor::Doctor(const QList > &base) { + _pillsData = base; +} + +void Doctor::diagnostic(bool fix) const { + + QList > failed; + QList > detected; + QList > fixedSuccessful; + + for (const auto &pill: _pillsData) { + if (pill->diagnostic()) { + if (fix) { + if (!pill->fix()) { + failed.push_back(pill); + } else { + fixedSuccessful.push_back(pill); + } + } else { + detected.push_back(pill); + } + } + } + + if (failed.size()) { + emit sigFixesFailed(failed); + } + + if (detected.count()) { + emit sigTroubleDetected(detected); + } + + if (fixedSuccessful.count()) { + emit sigFixesFinishedSuccessful(fixedSuccessful); + } +} + +void Doctor::fix(const QList > &pills) const { + + QList > failed; + QList > fixedSuccessful; + + for (const auto &pill: pills) { + if (pill->diagnostic()) { + if (!pill->fix()) { + failed.push_back(pill); + } else { + fixedSuccessful.push_back(pill); + } + } + } + + if (failed.size()) { + emit sigFixesFailed(failed); + } + + if (fixedSuccessful.count()) { + emit sigFixesFinishedSuccessful(fixedSuccessful); + } +} + +void Doctor::addPill(const QSharedPointer &pill) { + _pillsData.push_back(pill); +} + +} diff --git a/src/Library/DoctorPillCore/doctor.h b/src/Library/DoctorPillCore/doctor.h new file mode 100644 index 0000000..88b14f7 --- /dev/null +++ b/src/Library/DoctorPillCore/doctor.h @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2018-2022 QuasarApp. + * Distributed under the GPLv3 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 "ipill.h" +#include "doctorpill_global.h" +#include + +namespace DP { + +/** + * @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_PILL_EXPORT 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 diagnostic This method run full diagnostic 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. + * @see Doctor::fix + * @see Doctor::addPill + * @see Doctor::sigFixesFailed + * @see Doctor::sigFixesFinishedSuccessful + */ + void diagnostic(bool fix = false) const; + + /** + * @brief fix This method try run fixes by input pills. + * @note All fixes will be checked before execute fix. + * @param pills This is list of fixes that will be executed. + * @see Doctor::diagnostic + * @see Doctor::addPill + * @see Doctor::sigFixesFailed + * @see Doctor::sigFixesFinishedSuccessful + */ + void fix(const QList>& pills) const; + + /** + * @brief addPill This method add new pill object to doctor library + * @param pill This is pill object. + * @see Doctor::diagnostic + * @see Doctor::fix + * @see Doctor::sigFixesFailed + * @see Doctor::sigFixesFinishedSuccessful + */ + void addPill(const QSharedPointer& pill); +signals: + /** + * @brief sigTroubleDetected This signal will emited when The doctor object found issues in this application. + * @param issues this is list of detected issues. + * @see Doctor::diagnostic + * @see Doctor::fix + * @see Doctor::sigFixesFailed + * @see Doctor::sigFixesFinishedSuccessful + */ + void sigTroubleDetected(QList> issues) const; + + /** + * @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) const; + + /** + * @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) const; + +private: + QList> _pillsData; +}; + + +} + +#endif // DOCTOR_H diff --git a/src/Library/DoctorPillCore/doctortest.cpp b/src/Library/DoctorPillCore/doctortest.cpp new file mode 100644 index 0000000..fca3f95 --- /dev/null +++ b/src/Library/DoctorPillCore/doctortest.cpp @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2018-2022 QuasarApp. + * Distributed under the GPLv3 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 "doctortest.h" +#include "ipill.h" + +namespace DP { + +DoctorTest::DoctorTest() { +} + +bool DoctorTest::test(const QSharedPointer &pill, + bool appIsBroken) const { + + if (pill->diagnostic() != appIsBroken) { + return false; + } + + if (appIsBroken && !pill->fix()) { + return false; + } + + return pill->diagnostic(); +} + +} diff --git a/src/Library/DoctorPillCore/doctortest.h b/src/Library/DoctorPillCore/doctortest.h new file mode 100644 index 0000000..1913375 --- /dev/null +++ b/src/Library/DoctorPillCore/doctortest.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2018-2022 QuasarApp. + * Distributed under the GPLv3 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 DOCTORTEST_H +#define DOCTORTEST_H + +#include +#include "doctorpill_global.h" + +namespace DP { + +class iPill; +class Doctor; + +/** + * @brief The DoctorTest class This class contains auto tests for pills objects. + * @see Doctor class for get more information. + */ +class DOCTOR_PILL_EXPORT DoctorTest +{ +public: + DoctorTest(); + + /** + * @brief test This method run simple test for the pill object. + * **Test algorithm** + * + * 1. Doctor run the iPill::diagnostic method. + * 2. If an @a appIsBroken is false then diagnostic method should return true + * 3. If an @a appIsBroken is true then diagnostic method should return true. + * 4. Doctor run the fix and check diagnostic method again. + * 5. The diagnostic method should return false value. + * + * @param pill This is checked pill for solve issue. + * @param appIsBroken bollean variable that should be true if app is broken else false. + * @return true if test passed elase false. + */ + bool test(const QSharedPointer& pill, bool appIsBroken) const; + +}; + +} +#endif // DOCTORTEST_H diff --git a/src/Library/DoctorPillCore/ipill.cpp b/src/Library/DoctorPillCore/ipill.cpp new file mode 100644 index 0000000..edabf13 --- /dev/null +++ b/src/Library/DoctorPillCore/ipill.cpp @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2018-2022 QuasarApp. + * Distributed under the GPLv3 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 DP { + +iPill::iPill() +{ + +} + + +} diff --git a/src/Library/DoctorPillCore/ipill.h b/src/Library/DoctorPillCore/ipill.h new file mode 100644 index 0000000..a0c452b --- /dev/null +++ b/src/Library/DoctorPillCore/ipill.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2018-2022 QuasarApp. + * Distributed under the GPLv3 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 +#include "doctorpill_global.h" + +namespace DP { + +/** + * @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 DOCTOR_PILL_EXPORT 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 diagnostic 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 diagnostic() 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; + friend class DoctorTest; +}; + +} +#endif // IPILL_H diff --git a/src/Library/DoctorPillGui/pillsmodel.cpp b/src/Library/DoctorPillGui/pillsmodel.cpp new file mode 100644 index 0000000..ef20aa3 --- /dev/null +++ b/src/Library/DoctorPillGui/pillsmodel.cpp @@ -0,0 +1,98 @@ +//# +//# Copyright (C) 2021-2022 QuasarApp. +//# Distributed under the GPLv3 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 "pillsmodel.h" +#include + +namespace DP { + +PillsModel::PillsModel(const QList> &base): + _doctor(base) +{ + +} + +int PillsModel::rowCount(const QModelIndex &) const { + return _viewData.count(); +} + +QVariant PillsModel::data(const QModelIndex &index, int role) const { + + if (index.row() < 0 || index.row() >= rowCount()) { + return ""; + } + + Issue item = *std::next(_viewData.begin(), index.row()); + + if (!item._pill) { + return "Internal Error"; + } + + if (role == Roles::Name) { + return item._pill->name(); + } + + if (role == Roles::Description) { + return item._pill->description(); + } + + if (role == Roles::Status) { + return item._status; + } + + return "Unknown"; +} + +QHash PillsModel::roleNames() const { + QHash roles; + + roles[Roles::Name] = "issueName"; + roles[Roles::Description] = "issueDescription"; + roles[Roles::Status] = "issueStatus"; + + return roles; +} + +void PillsModel::usePill(QString pillName) { + + auto pill = _viewData.value(pillName, {}); + if (!pill._pill) + return; + + _doctor.fix({pill._pill}); +} + +void PillsModel::diagnostic() { + _doctor.diagnostic(); +} + +void PillsModel::handleFixFailed(QList> failed) { + + for (const auto &pill : qAsConst(failed)) { + _viewData[pill->name()]._status = static_cast(IssueStatus::Failed); + } +} + +void PillsModel::handleFixSuccessful(QList> successful) { + + for (const auto &pill : qAsConst(successful)) { + _viewData[pill->name()]._status = static_cast(IssueStatus::Solved); + } +} + +void PillsModel::handleBugDetected(QList> bugDetected) { + + beginResetModel(); + + _viewData.clear(); + for (const auto &pill : qAsConst(bugDetected)) { + _viewData[pill->name()] = Issue{0, pill}; + } + + endResetModel(); +} +} diff --git a/src/Library/DoctorPillGui/pillsmodel.h b/src/Library/DoctorPillGui/pillsmodel.h new file mode 100644 index 0000000..02650ed --- /dev/null +++ b/src/Library/DoctorPillGui/pillsmodel.h @@ -0,0 +1,62 @@ +//# +//# Copyright (C) 2021-2022 QuasarApp. +//# Distributed under the GPLv3 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 PILLSMODEL_H +#define PILLSMODEL_H + +#include +#include + +namespace DP { + +struct Issue { + int _status = 0; + QSharedPointer _pill = nullptr; +}; + +/** + * @brief The PillsModel class This is gui model of available pills. + */ +class PillsModel: public QAbstractListModel +{ + Q_OBJECT + + enum Roles { + Name = Qt::UserRole, + Description, + Status + }; + + enum IssueStatus { + Detected, + Solved, + Failed + }; + +public: + PillsModel(const QList> &base); + void addPill(const QSharedPointer& pill); + + int rowCount(const QModelIndex &parent = {}) const override; + QVariant data(const QModelIndex &index, int role) const override; + QHash roleNames() const override; + + Q_INVOKABLE void usePill(QString pillName); + Q_INVOKABLE void diagnostic(); + +private slots: + void handleFixFailed(QList>); + void handleFixSuccessful(QList>); + void handleBugDetected(QList>); + +private: + Doctor _doctor; + QHash _viewData; +}; + +} +#endif // PILLSMODEL_H diff --git a/src/Library/DoctorPillModule/DoctorPill.qml b/src/Library/DoctorPillModule/DoctorPill.qml deleted file mode 100644 index 95b8b53..0000000 --- a/src/Library/DoctorPillModule/DoctorPill.qml +++ /dev/null @@ -1,12 +0,0 @@ -//# -//# Copyright (C) 2021-2021 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. -//# - -import QtQuick 2.15 - -Item { - -} diff --git a/src/Library/DoctorPillModule/DoctorView.qml b/src/Library/DoctorPillModule/DoctorView.qml new file mode 100644 index 0000000..23e8d3f --- /dev/null +++ b/src/Library/DoctorPillModule/DoctorView.qml @@ -0,0 +1,262 @@ +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Controls.Material 2.15 +import QtQuick.Layouts 1.15 + +import "Style" + +CPage { + id: root; + property var model : null + implicitHeight: 0x0 + + title: qsTr("Doctor page. The Doctor can help you to fix your app."); + ColumnLayout { + + Label { + id: atansionMsg + text: qsTr("Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing."); + } + + Label { + id: descriptionMsg + text: qsTr("This is your personal application doctor room! The doctor automatically check your application to exits errors. If the Doctor found any errors he suggest solution of your issue"); + } + + Label { + id: allIsFineMsg + text: qsTr("The Doctor not found any issues. If you sure that application is works wrong then you can contact with developers."); + } + + Button { + id: contactButton + text: qsTr("Contact with Developers"); + } + + ProgressBar { + id: progress + indeterminate: true; + } + + Button { + id: diagnosticButton + text: qsTr("Diagnostic"); + + onClicked: { + if (root.model) { + root.model.diagnostic(); + } + } + } + + ListView { + id: list + anchors.fill: parent + model: root.model + visible: (root.model)? root.model.rowCount(): false + delegate: Component { + RowLayout { + + function getSourceImage(status) { + switch(status) { + case 0: return ""; // detected + case 1: return ""; // solved + case 2: return ""; // failed + default: return "";// unknown status + } + } + + Item { + Layout.fillWidth: true + } + + Image { + id: bugStatuss + fillMode: Image.PreserveAspectFit + source: getSourceImage(issueStatus) + Layout.preferredHeight: 60 + Layout.preferredWidth: height + } + + Label { + text: issueName + } + + Label { + text: issueDescription + } + + Button { + text: qsTr("Repair"); + } + + Item { + Layout.fillWidth: true + } + + width: list.width + } + } + } + } + + state: "beginDiagnostic" + + //beginDiagnostic + //searchBugs + //bugFound + //allIsFine + states: [ + State { + name: "beginDiagnostic" + PropertyChanges { + target: atansionMsg; + visible: true + } + + PropertyChanges { + target: descriptionMsg; + visible: true + } + + PropertyChanges { + target: allIsFineMsg; + visible: false + } + + PropertyChanges { + target: contactButton; + visible: false + } + + PropertyChanges { + target: progress; + visible: false + } + + PropertyChanges { + target: diagnosticButton; + visible: true + } + + PropertyChanges { + target: list; + visible: false + } + }, + + State { + name: "searchBugs" + PropertyChanges { + target: atansionMsg; + visible: false + } + + PropertyChanges { + target: descriptionMsg; + visible: false + } + + PropertyChanges { + target: allIsFineMsg; + visible: false + } + + PropertyChanges { + target: contactButton; + visible: false + } + + PropertyChanges { + target: progress; + visible: true + } + + PropertyChanges { + target: diagnosticButton; + visible: false + } + + PropertyChanges { + target: list; + visible: false + } + }, + + State { + name: "bugFound" + PropertyChanges { + target: atansionMsg; + visible: false + } + + PropertyChanges { + target: descriptionMsg; + visible: false + } + + PropertyChanges { + target: allIsFineMsg; + visible: false + } + + PropertyChanges { + target: contactButton; + visible: false + } + + PropertyChanges { + target: progress; + visible: false + } + + PropertyChanges { + target: diagnosticButton; + visible: false + } + + PropertyChanges { + target: list; + visible: true + } + }, + + State { + name: "allIsFine" + PropertyChanges { + target: atansionMsg; + visible: false + } + + PropertyChanges { + target: descriptionMsg; + visible: false + } + + PropertyChanges { + target: allIsFineMsg; + visible: true + } + + PropertyChanges { + target: contactButton; + visible: true + } + + PropertyChanges { + target: progress; + visible: false + } + + PropertyChanges { + target: diagnosticButton; + visible: false + } + + PropertyChanges { + target: list; + visible: false + } + } + ] +} diff --git a/src/Library/DoctorPillModule/qmldir b/src/Library/DoctorPillModule/qmldir index 56870f8..d2aca21 100644 --- a/src/Library/DoctorPillModule/qmldir +++ b/src/Library/DoctorPillModule/qmldir @@ -1,3 +1,3 @@ module QuasarAppCreditsModule -DoctorPill 1.0 DoctorPill.qml +DoctorView 1.0 DoctorView.qml diff --git a/src/Library/DoctorPill/DoctorPill.cpp b/src/Library/doctorpill.cpp similarity index 63% rename from src/Library/DoctorPill/DoctorPill.cpp rename to src/Library/doctorpill.cpp index 0eec033..1a180ab 100644 --- a/src/Library/DoctorPill/DoctorPill.cpp +++ b/src/Library/doctorpill.cpp @@ -1,11 +1,11 @@ //# -//# Copyright (C) 2021-2021 QuasarApp. -//# Distributed under the lgplv3 software license, see the accompanying +//# Copyright (C) 2021-2022 QuasarApp. +//# Distributed under the GPLv3 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 "DoctorPill.h" +#include "doctorpill.h" namespace DoctorPill { diff --git a/src/Library/doctorpill.h b/src/Library/doctorpill.h new file mode 100644 index 0000000..0888406 --- /dev/null +++ b/src/Library/doctorpill.h @@ -0,0 +1,19 @@ +//# +//# Copyright (C) 2021-2022 QuasarApp. +//# Distributed under the GPLv3 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 "DoctorPillCore/doctor.h" +#include "DoctorPillCore/ipill.h" +#include "DoctorPillCore/doctortest.h" + +inline void initDoctorPillResources() { Q_INIT_RESOURCE(DoctorPill); } + +namespace DoctorPill { + +bool DOCTOR_PILL_EXPORT init(); + +}; diff --git a/src/Library/DoctorPill/DoctorPill_global.h b/src/Library/doctorpill_global.h similarity index 53% rename from src/Library/DoctorPill/DoctorPill_global.h rename to src/Library/doctorpill_global.h index 6c780cf..933c00c 100644 --- a/src/Library/DoctorPill/DoctorPill_global.h +++ b/src/Library/doctorpill_global.h @@ -1,6 +1,6 @@ //# -//# Copyright (C) 2018-2021 QuasarApp. -//# Distributed under the lgplv3 software license, see the accompanying +//# Copyright (C) 2018-2022 QuasarApp. +//# Distributed under the GPLv3 software license, see the accompanying //# Everyone is permitted to copy and distribute verbatim copies //# of this license document, but changing it is not allowed. //# @@ -10,10 +10,10 @@ #include -#if defined(DoctorPill_LIBRARY) -# define DoctorPill_EXPORT Q_DECL_EXPORT +#if defined(DOCTOR_PILL_LIBRARY) +# define DOCTOR_PILL_EXPORT Q_DECL_EXPORT #else -# define DoctorPill_EXPORT Q_DECL_IMPORT +# define DOCTOR_PILL_EXPORT Q_DECL_IMPORT #endif #endif //DoctorPill_GLOBAL_H diff --git a/src/Library/languages/de.ts b/src/Library/languages/de.ts index 6401616..bfd65a0 100644 --- a/src/Library/languages/de.ts +++ b/src/Library/languages/de.ts @@ -1,4 +1,54 @@ + + DP::PillsModel + + Failed to fix bugs! + + + + List of incoplite bugs: %0 + + + + Bug fixed successfull! + + + + List of fixed bugs: %0 + + + + + DoctorView + + Doctor page. The Doctor can help you to fix your app. + + + + Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing. + + + + This is your personal application doctor room! The doctor automatically check your application to exits errors. If the Doctor found any errors he suggest solution of your issue + + + + The Doctor not found any issues. If you sure that application is works wrong then you can contact with developers. + + + + Contact with Developers + + + + Diagnostic + + + + Repair + + + diff --git a/src/Library/languages/en.ts b/src/Library/languages/en.ts index 6401616..bfd65a0 100644 --- a/src/Library/languages/en.ts +++ b/src/Library/languages/en.ts @@ -1,4 +1,54 @@ + + DP::PillsModel + + Failed to fix bugs! + + + + List of incoplite bugs: %0 + + + + Bug fixed successfull! + + + + List of fixed bugs: %0 + + + + + DoctorView + + Doctor page. The Doctor can help you to fix your app. + + + + Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing. + + + + This is your personal application doctor room! The doctor automatically check your application to exits errors. If the Doctor found any errors he suggest solution of your issue + + + + The Doctor not found any issues. If you sure that application is works wrong then you can contact with developers. + + + + Contact with Developers + + + + Diagnostic + + + + Repair + + + diff --git a/src/Library/languages/es.ts b/src/Library/languages/es.ts index 6401616..bfd65a0 100644 --- a/src/Library/languages/es.ts +++ b/src/Library/languages/es.ts @@ -1,4 +1,54 @@ + + DP::PillsModel + + Failed to fix bugs! + + + + List of incoplite bugs: %0 + + + + Bug fixed successfull! + + + + List of fixed bugs: %0 + + + + + DoctorView + + Doctor page. The Doctor can help you to fix your app. + + + + Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing. + + + + This is your personal application doctor room! The doctor automatically check your application to exits errors. If the Doctor found any errors he suggest solution of your issue + + + + The Doctor not found any issues. If you sure that application is works wrong then you can contact with developers. + + + + Contact with Developers + + + + Diagnostic + + + + Repair + + + diff --git a/src/Library/languages/fr.ts b/src/Library/languages/fr.ts index 6401616..bfd65a0 100644 --- a/src/Library/languages/fr.ts +++ b/src/Library/languages/fr.ts @@ -1,4 +1,54 @@ + + DP::PillsModel + + Failed to fix bugs! + + + + List of incoplite bugs: %0 + + + + Bug fixed successfull! + + + + List of fixed bugs: %0 + + + + + DoctorView + + Doctor page. The Doctor can help you to fix your app. + + + + Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing. + + + + This is your personal application doctor room! The doctor automatically check your application to exits errors. If the Doctor found any errors he suggest solution of your issue + + + + The Doctor not found any issues. If you sure that application is works wrong then you can contact with developers. + + + + Contact with Developers + + + + Diagnostic + + + + Repair + + + diff --git a/src/Library/languages/ja.ts b/src/Library/languages/ja.ts index 6401616..bfd65a0 100644 --- a/src/Library/languages/ja.ts +++ b/src/Library/languages/ja.ts @@ -1,4 +1,54 @@ + + DP::PillsModel + + Failed to fix bugs! + + + + List of incoplite bugs: %0 + + + + Bug fixed successfull! + + + + List of fixed bugs: %0 + + + + + DoctorView + + Doctor page. The Doctor can help you to fix your app. + + + + Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing. + + + + This is your personal application doctor room! The doctor automatically check your application to exits errors. If the Doctor found any errors he suggest solution of your issue + + + + The Doctor not found any issues. If you sure that application is works wrong then you can contact with developers. + + + + Contact with Developers + + + + Diagnostic + + + + Repair + + + diff --git a/src/Library/languages/pl.ts b/src/Library/languages/pl.ts index 6401616..bfd65a0 100644 --- a/src/Library/languages/pl.ts +++ b/src/Library/languages/pl.ts @@ -1,4 +1,54 @@ + + DP::PillsModel + + Failed to fix bugs! + + + + List of incoplite bugs: %0 + + + + Bug fixed successfull! + + + + List of fixed bugs: %0 + + + + + DoctorView + + Doctor page. The Doctor can help you to fix your app. + + + + Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing. + + + + This is your personal application doctor room! The doctor automatically check your application to exits errors. If the Doctor found any errors he suggest solution of your issue + + + + The Doctor not found any issues. If you sure that application is works wrong then you can contact with developers. + + + + Contact with Developers + + + + Diagnostic + + + + Repair + + + diff --git a/src/Library/languages/ru.ts b/src/Library/languages/ru.ts index 6401616..bfd65a0 100644 --- a/src/Library/languages/ru.ts +++ b/src/Library/languages/ru.ts @@ -1,4 +1,54 @@ + + DP::PillsModel + + Failed to fix bugs! + + + + List of incoplite bugs: %0 + + + + Bug fixed successfull! + + + + List of fixed bugs: %0 + + + + + DoctorView + + Doctor page. The Doctor can help you to fix your app. + + + + Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing. + + + + This is your personal application doctor room! The doctor automatically check your application to exits errors. If the Doctor found any errors he suggest solution of your issue + + + + The Doctor not found any issues. If you sure that application is works wrong then you can contact with developers. + + + + Contact with Developers + + + + Diagnostic + + + + Repair + + + diff --git a/src/Library/languages/tr.ts b/src/Library/languages/tr.ts index 6401616..bfd65a0 100644 --- a/src/Library/languages/tr.ts +++ b/src/Library/languages/tr.ts @@ -1,4 +1,54 @@ + + DP::PillsModel + + Failed to fix bugs! + + + + List of incoplite bugs: %0 + + + + Bug fixed successfull! + + + + List of fixed bugs: %0 + + + + + DoctorView + + Doctor page. The Doctor can help you to fix your app. + + + + Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing. + + + + This is your personal application doctor room! The doctor automatically check your application to exits errors. If the Doctor found any errors he suggest solution of your issue + + + + The Doctor not found any issues. If you sure that application is works wrong then you can contact with developers. + + + + Contact with Developers + + + + Diagnostic + + + + Repair + + + diff --git a/src/Library/languages/uk.ts b/src/Library/languages/uk.ts index 6401616..bfd65a0 100644 --- a/src/Library/languages/uk.ts +++ b/src/Library/languages/uk.ts @@ -1,4 +1,54 @@ + + DP::PillsModel + + Failed to fix bugs! + + + + List of incoplite bugs: %0 + + + + Bug fixed successfull! + + + + List of fixed bugs: %0 + + + + + DoctorView + + Doctor page. The Doctor can help you to fix your app. + + + + Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing. + + + + This is your personal application doctor room! The doctor automatically check your application to exits errors. If the Doctor found any errors he suggest solution of your issue + + + + The Doctor not found any issues. If you sure that application is works wrong then you can contact with developers. + + + + Contact with Developers + + + + Diagnostic + + + + Repair + + + diff --git a/src/Library/languages/zh.ts b/src/Library/languages/zh.ts index 6401616..bfd65a0 100644 --- a/src/Library/languages/zh.ts +++ b/src/Library/languages/zh.ts @@ -1,4 +1,54 @@ + + DP::PillsModel + + Failed to fix bugs! + + + + List of incoplite bugs: %0 + + + + Bug fixed successfull! + + + + List of fixed bugs: %0 + + + + + DoctorView + + Doctor page. The Doctor can help you to fix your app. + + + + Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing. + + + + This is your personal application doctor room! The doctor automatically check your application to exits errors. If the Doctor found any errors he suggest solution of your issue + + + + The Doctor not found any issues. If you sure that application is works wrong then you can contact with developers. + + + + Contact with Developers + + + + Diagnostic + + + + Repair + + + diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 99f4e41..b5ef9e2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,6 +1,6 @@ # -# Copyright (C) 2020-2021 QuasarApp. -# Distributed under the lgplv3 software license, see the accompanying +# Copyright (C) 2020-2022 QuasarApp. +# Distributed under the GPLv3 software license, see the accompanying # Everyone is permitted to copy and distribute verbatim copies # of this license document, but changing it is not allowed. # diff --git a/tests/tstMain.cpp b/tests/tstMain.cpp index d3a1d0d..3de0628 100644 --- a/tests/tstMain.cpp +++ b/tests/tstMain.cpp @@ -1,6 +1,6 @@ //# -//# Copyright (C) 2020-2021 QuasarApp. -//# Distributed under the lgplv3 software license, see the accompanying +//# Copyright (C) 2020-2022 QuasarApp. +//# Distributed under the GPLv3 software license, see the accompanying //# Everyone is permitted to copy and distribute verbatim copies //# of this license document, but changing it is not allowed. //# diff --git a/tests/units/exampletest.cpp b/tests/units/exampletest.cpp index 33b3816..930ba02 100644 --- a/tests/units/exampletest.cpp +++ b/tests/units/exampletest.cpp @@ -1,6 +1,6 @@ //# -//# Copyright (C) 2020-2021 QuasarApp. -//# Distributed under the lgplv3 software license, see the accompanying +//# Copyright (C) 2020-2022 QuasarApp. +//# Distributed under the GPLv3 software license, see the accompanying //# Everyone is permitted to copy and distribute verbatim copies //# of this license document, but changing it is not allowed. //# diff --git a/tests/units/exampletest.h b/tests/units/exampletest.h index c7a2c2d..98357e4 100644 --- a/tests/units/exampletest.h +++ b/tests/units/exampletest.h @@ -1,6 +1,6 @@ //# -//# Copyright (C) 2020-2021 QuasarApp. -//# Distributed under the lgplv3 software license, see the accompanying +//# Copyright (C) 2020-2022 QuasarApp. +//# Distributed under the GPLv3 software license, see the accompanying //# Everyone is permitted to copy and distribute verbatim copies //# of this license document, but changing it is not allowed. //# diff --git a/tests/units/test.cpp b/tests/units/test.cpp index 042dffc..b5439b3 100644 --- a/tests/units/test.cpp +++ b/tests/units/test.cpp @@ -1,6 +1,6 @@ //# -//# Copyright (C) 2020-2021 QuasarApp. -//# Distributed under the lgplv3 software license, see the accompanying +//# Copyright (C) 2020-2022 QuasarApp. +//# Distributed under the GPLv3 software license, see the accompanying //# Everyone is permitted to copy and distribute verbatim copies //# of this license document, but changing it is not allowed. //# diff --git a/tests/units/test.h b/tests/units/test.h index b5719ef..d4ccf07 100644 --- a/tests/units/test.h +++ b/tests/units/test.h @@ -1,6 +1,6 @@ //# -//# Copyright (C) 2020-2021 QuasarApp. -//# Distributed under the lgplv3 software license, see the accompanying +//# Copyright (C) 2020-2022 QuasarApp. +//# Distributed under the GPLv3 software license, see the accompanying //# Everyone is permitted to copy and distribute verbatim copies //# of this license document, but changing it is not allowed. //# diff --git a/tests/units/testutils.cpp b/tests/units/testutils.cpp index 6941d76..48d56d4 100644 --- a/tests/units/testutils.cpp +++ b/tests/units/testutils.cpp @@ -1,6 +1,6 @@ //# -//# Copyright (C) 2020-2021 QuasarApp. -//# Distributed under the lgplv3 software license, see the accompanying +//# Copyright (C) 2020-2022 QuasarApp. +//# Distributed under the GPLv3 software license, see the accompanying //# Everyone is permitted to copy and distribute verbatim copies //# of this license document, but changing it is not allowed. //# diff --git a/tests/units/testutils.h b/tests/units/testutils.h index ec1e9d3..742614d 100644 --- a/tests/units/testutils.h +++ b/tests/units/testutils.h @@ -1,6 +1,6 @@ //# -//# Copyright (C) 2020-2021 QuasarApp. -//# Distributed under the lgplv3 software license, see the accompanying +//# Copyright (C) 2020-2022 QuasarApp. +//# Distributed under the GPLv3 software license, see the accompanying //# Everyone is permitted to copy and distribute verbatim copies //# of this license document, but changing it is not allowed. //#