add new readme file

This commit is contained in:
Andrei Yankovich 2022-01-18 17:25:02 +03:00
parent 948efe4687
commit ea1da8a928
16 changed files with 189 additions and 59 deletions

View File

@ -40,9 +40,9 @@ file(MAKE_DIRECTORY ${TARGET_DIR})
if (DEFINED TARGET_PLATFORM_TOOLCHAIN)
if (${TARGET_PLATFORM_TOOLCHAIN} STREQUAL "wasm32")
set(DOCTOR_PILL_TESTS OFF)
set(DOCTOR_PILL_EXAMPLE OFF)
message("Disable DOCTOR_PILL_TESTS and DOCTOR_PILL_EXAMPLE for wasm paltform because wasm not support tests and an example.")
message("This library depend of the qt concurent library, but The concurent is not available in qt wasm")
initAll()
return()
endif()
endif()

154
README.md
View File

@ -1,15 +1,145 @@
# CMakeProject
Template repository for cmake project
Fork me and replase DoctorPill to Name of your new project.
# Doctor Pill
The Doctor pill is simple qt / qml library for fast develop fixes for applications that already released and working in production.
1. Clone this repository
2. Run ./init.sh NewProjectName
The library has c++ interface DP::iPill and QML view for diagnostic gui applications.
# This template supports next build targets:
For Disable the gui part of the library use the DOCTOR_PILL_GUI option.
| Command or make target | Description |
|------|------|
| **make test** | The run tests for a project (dependet of Qt Tests, so you need to add Qt in Cmake using CMAKE_PREFIX_PATH) |
| **make doc** | The generate a documentation for a project (dependet of doxygen) |
| **make deploy** | The generate distribution for a project (dependet of CQtDeployer) |
| **make release** | The prepare Qt Installer framework repository for a project, generate a snap package and APK file for android (dependet of CQtDeployer, snapcraft, AndroidDeployer). |
## BUILD OPTIONS
``` cmake
option(DOCTOR_PILL_GUI "Enable gui qml model for build" ON)
option(DOCTOR_PILL_TESTS "Enable tests of this library" ON)
option(DOCTOR_PILL_EXAMPLE "Enable example app of this library" ON)
```
## Include to cmake project
1. add as a submodule this repo
``` bash
git submodule add https://github.com/QuasarApp/DoctorPill.git
```
2. Add to build the DoctorPill as a subdirectory
``` cmake
set(DOCTOR_PILL_GUI ON) # you may change it if you need.
set(DOCTOR_PILL_TESTS OFF) you may change it if you need.
set(DOCTOR_PILL_EXAMPLE OFF) you may change it if you need.
add_subdirectory(DoctorPill)
```
## Using
### Wihout GUI
#### Create a new pill object.
```cpp
#include <doctorpill.h>
class MyPill: DP::iPill {
QString name() const override {
return "My pill";
};
QString description() const override {
return "Description of my pill";
};
protected:
bool diagnostic() const override {
// some code for search bug
};
bool fix() const override {
// some code for fix found bug
};
};
```
#### Use your self created pills
```cpp
#include <doctorpill.h>
// ...
DP::Doctor _doctor;
if (_doctor.fix({QSharedPointer<MyPill>::create()})) {
// app fixed successfull
} else {
// fail to fix app
}
// ...
```
### Use GUI QML wrapper
For working with gui wrapper you need to initialize this library before include gui module in to your qml file.
#### initialize the library (main.cpp)
``` cpp
int main(int argc, char *argv[]) {
QCoreApplication::setOrganizationName("QuasarApp");
QCoreApplication::setApplicationName("DoctorPillExample");
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
if (!DP::init(&engine)) {
return -1;
}
DP::DoctorModel model({QSharedPointer<SomePill>::create()});
// see next code view
engine.load("qrc:/Main.qml");
if (engine.rootObjects().isEmpty())
return -2;
// Add new doctor pill model to view
QQmlContext* rootContext = engine.rootContext();
if (rootContext)
rootContext->setContextProperty("doctorPillModel", &model);
return app.exec();
}
```
#### Using qml view (main.qml)
```qml
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Controls.Material 2.15
import DoctorPillModule 1.0
ApplicationWindow {
width: 800
height: 600
visible: true
DoctorView {
anchors.fill: parent
// use added model in qml file.
model: (doctorPillModel)? doctorPillModel: null
}
}
```

View File

@ -10,6 +10,6 @@ ApplicationWindow {
DoctorView {
anchors.fill: parent
model: (doctorPillMpdel)? doctorPillMpdel: null
model: (doctorPillModel)? doctorPillModel: null
}
}

View File

@ -133,7 +133,7 @@ int main(int argc, char *argv[]) {
QQmlContext* rootContext = engine.rootContext();
if (rootContext)
rootContext->setContextProperty("doctorPillMpdel", &model);
rootContext->setContextProperty("doctorPillModel", &model);
return app.exec();
}

View File

@ -16,7 +16,7 @@ namespace DP {
/**
* @brief The PillsModel class This is gui model of available pills.
*/
class DoctorModel: public QAbstractListModel
class DOCTOR_PILL_EXPORT DoctorModel: public QAbstractListModel
{
Q_OBJECT

View File

@ -179,7 +179,7 @@ Page {
}
Button {
text: qsTr("Repair");
text: qsTr("Fix");
visible: issueStatus === 0
onClicked: {
if (root.model) {

View File

@ -19,10 +19,6 @@
<source>Diagnostic</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Repair</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;b&gt;Attention&lt;/b&gt;: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
<translation type="unfinished"></translation>
@ -47,5 +43,9 @@
<source>I know what I&apos;m doing</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fix</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -19,10 +19,6 @@
<source>Diagnostic</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Repair</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;b&gt;Attention&lt;/b&gt;: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
<translation type="unfinished"></translation>
@ -47,5 +43,9 @@
<source>I know what I&apos;m doing</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fix</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -19,10 +19,6 @@
<source>Diagnostic</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Repair</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;b&gt;Attention&lt;/b&gt;: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
<translation type="unfinished"></translation>
@ -47,5 +43,9 @@
<source>I know what I&apos;m doing</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fix</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -19,10 +19,6 @@
<source>Diagnostic</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Repair</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;b&gt;Attention&lt;/b&gt;: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
<translation type="unfinished"></translation>
@ -47,5 +43,9 @@
<source>I know what I&apos;m doing</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fix</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -19,10 +19,6 @@
<source>Diagnostic</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Repair</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;b&gt;Attention&lt;/b&gt;: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
<translation type="unfinished"></translation>
@ -47,5 +43,9 @@
<source>I know what I&apos;m doing</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fix</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -19,10 +19,6 @@
<source>Diagnostic</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Repair</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;b&gt;Attention&lt;/b&gt;: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
<translation type="unfinished"></translation>
@ -47,5 +43,9 @@
<source>I know what I&apos;m doing</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fix</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -19,10 +19,6 @@
<source>Diagnostic</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Repair</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;b&gt;Attention&lt;/b&gt;: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
<translation type="unfinished"></translation>
@ -47,5 +43,9 @@
<source>I know what I&apos;m doing</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fix</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -19,10 +19,6 @@
<source>Diagnostic</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Repair</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;b&gt;Attention&lt;/b&gt;: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
<translation type="unfinished"></translation>
@ -47,5 +43,9 @@
<source>I know what I&apos;m doing</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fix</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -19,10 +19,6 @@
<source>Diagnostic</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Repair</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;b&gt;Attention&lt;/b&gt;: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
<translation type="unfinished"></translation>
@ -47,5 +43,9 @@
<source>I know what I&apos;m doing</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fix</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -19,10 +19,6 @@
<source>Diagnostic</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Repair</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;b&gt;Attention&lt;/b&gt;: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
<translation type="unfinished"></translation>
@ -47,5 +43,9 @@
<source>I know what I&apos;m doing</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fix</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>