mirror of
https://github.com/QuasarApp/DoctorPill.git
synced 2025-04-26 17:54:44 +00:00
add new readme file
This commit is contained in:
parent
948efe4687
commit
ea1da8a928
@ -40,9 +40,9 @@ file(MAKE_DIRECTORY ${TARGET_DIR})
|
|||||||
|
|
||||||
if (DEFINED TARGET_PLATFORM_TOOLCHAIN)
|
if (DEFINED TARGET_PLATFORM_TOOLCHAIN)
|
||||||
if (${TARGET_PLATFORM_TOOLCHAIN} STREQUAL "wasm32")
|
if (${TARGET_PLATFORM_TOOLCHAIN} STREQUAL "wasm32")
|
||||||
set(DOCTOR_PILL_TESTS OFF)
|
message("This library depend of the qt concurent library, but The concurent is not available in qt wasm")
|
||||||
set(DOCTOR_PILL_EXAMPLE OFF)
|
initAll()
|
||||||
message("Disable DOCTOR_PILL_TESTS and DOCTOR_PILL_EXAMPLE for wasm paltform because wasm not support tests and an example.")
|
return()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
154
README.md
154
README.md
@ -1,15 +1,145 @@
|
|||||||
# CMakeProject
|
# Doctor Pill
|
||||||
Template repository for cmake project
|
The Doctor pill is simple qt / qml library for fast develop fixes for applications that already released and working in production.
|
||||||
Fork me and replase DoctorPill to Name of your new project.
|
|
||||||
|
|
||||||
1. Clone this repository
|
The library has c++ interface DP::iPill and QML view for diagnostic gui applications.
|
||||||
2. Run ./init.sh NewProjectName
|
|
||||||
|
|
||||||
# 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 |
|
## BUILD OPTIONS
|
||||||
|------|------|
|
|
||||||
| **make test** | The run tests for a project (dependet of Qt Tests, so you need to add Qt in Cmake using CMAKE_PREFIX_PATH) |
|
``` cmake
|
||||||
| **make doc** | The generate a documentation for a project (dependet of doxygen) |
|
option(DOCTOR_PILL_GUI "Enable gui qml model for build" ON)
|
||||||
| **make deploy** | The generate distribution for a project (dependet of CQtDeployer) |
|
option(DOCTOR_PILL_TESTS "Enable tests of this library" ON)
|
||||||
| **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). |
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
@ -10,6 +10,6 @@ ApplicationWindow {
|
|||||||
|
|
||||||
DoctorView {
|
DoctorView {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
model: (doctorPillMpdel)? doctorPillMpdel: null
|
model: (doctorPillModel)? doctorPillModel: null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
QQmlContext* rootContext = engine.rootContext();
|
QQmlContext* rootContext = engine.rootContext();
|
||||||
if (rootContext)
|
if (rootContext)
|
||||||
rootContext->setContextProperty("doctorPillMpdel", &model);
|
rootContext->setContextProperty("doctorPillModel", &model);
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ namespace DP {
|
|||||||
/**
|
/**
|
||||||
* @brief The PillsModel class This is gui model of available pills.
|
* @brief The PillsModel class This is gui model of available pills.
|
||||||
*/
|
*/
|
||||||
class DoctorModel: public QAbstractListModel
|
class DOCTOR_PILL_EXPORT DoctorModel: public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: qsTr("Repair");
|
text: qsTr("Fix");
|
||||||
visible: issueStatus === 0
|
visible: issueStatus === 0
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (root.model) {
|
if (root.model) {
|
||||||
|
@ -19,10 +19,6 @@
|
|||||||
<source>Diagnostic</source>
|
<source>Diagnostic</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Repair</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source><b>Attention</b>: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
<source><b>Attention</b>: 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>
|
<translation type="unfinished"></translation>
|
||||||
@ -47,5 +43,9 @@
|
|||||||
<source>I know what I'm doing</source>
|
<source>I know what I'm doing</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Fix</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -19,10 +19,6 @@
|
|||||||
<source>Diagnostic</source>
|
<source>Diagnostic</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Repair</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source><b>Attention</b>: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
<source><b>Attention</b>: 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>
|
<translation type="unfinished"></translation>
|
||||||
@ -47,5 +43,9 @@
|
|||||||
<source>I know what I'm doing</source>
|
<source>I know what I'm doing</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Fix</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -19,10 +19,6 @@
|
|||||||
<source>Diagnostic</source>
|
<source>Diagnostic</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Repair</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source><b>Attention</b>: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
<source><b>Attention</b>: 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>
|
<translation type="unfinished"></translation>
|
||||||
@ -47,5 +43,9 @@
|
|||||||
<source>I know what I'm doing</source>
|
<source>I know what I'm doing</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Fix</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -19,10 +19,6 @@
|
|||||||
<source>Diagnostic</source>
|
<source>Diagnostic</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Repair</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source><b>Attention</b>: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
<source><b>Attention</b>: 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>
|
<translation type="unfinished"></translation>
|
||||||
@ -47,5 +43,9 @@
|
|||||||
<source>I know what I'm doing</source>
|
<source>I know what I'm doing</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Fix</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -19,10 +19,6 @@
|
|||||||
<source>Diagnostic</source>
|
<source>Diagnostic</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Repair</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source><b>Attention</b>: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
<source><b>Attention</b>: 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>
|
<translation type="unfinished"></translation>
|
||||||
@ -47,5 +43,9 @@
|
|||||||
<source>I know what I'm doing</source>
|
<source>I know what I'm doing</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Fix</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -19,10 +19,6 @@
|
|||||||
<source>Diagnostic</source>
|
<source>Diagnostic</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Repair</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source><b>Attention</b>: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
<source><b>Attention</b>: 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>
|
<translation type="unfinished"></translation>
|
||||||
@ -47,5 +43,9 @@
|
|||||||
<source>I know what I'm doing</source>
|
<source>I know what I'm doing</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Fix</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -19,10 +19,6 @@
|
|||||||
<source>Diagnostic</source>
|
<source>Diagnostic</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Repair</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source><b>Attention</b>: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
<source><b>Attention</b>: 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>
|
<translation type="unfinished"></translation>
|
||||||
@ -47,5 +43,9 @@
|
|||||||
<source>I know what I'm doing</source>
|
<source>I know what I'm doing</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Fix</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -19,10 +19,6 @@
|
|||||||
<source>Diagnostic</source>
|
<source>Diagnostic</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Repair</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source><b>Attention</b>: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
<source><b>Attention</b>: 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>
|
<translation type="unfinished"></translation>
|
||||||
@ -47,5 +43,9 @@
|
|||||||
<source>I know what I'm doing</source>
|
<source>I know what I'm doing</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Fix</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -19,10 +19,6 @@
|
|||||||
<source>Diagnostic</source>
|
<source>Diagnostic</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Repair</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source><b>Attention</b>: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
<source><b>Attention</b>: 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>
|
<translation type="unfinished"></translation>
|
||||||
@ -47,5 +43,9 @@
|
|||||||
<source>I know what I'm doing</source>
|
<source>I know what I'm doing</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Fix</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -19,10 +19,6 @@
|
|||||||
<source>Diagnostic</source>
|
<source>Diagnostic</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Repair</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source><b>Attention</b>: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
<source><b>Attention</b>: 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>
|
<translation type="unfinished"></translation>
|
||||||
@ -47,5 +43,9 @@
|
|||||||
<source>I know what I'm doing</source>
|
<source>I know what I'm doing</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Fix</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user