https://github.com/quasarapp/doctorpill
This is simple library for create productions fixes for your applications.
https://github.com/quasarapp/doctorpill
Last synced: over 1 year ago
JSON representation
This is simple library for create productions fixes for your applications.
- Host: GitHub
- URL: https://github.com/quasarapp/doctorpill
- Owner: QuasarApp
- License: gpl-3.0
- Created: 2022-01-13T18:51:54.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-12-31T09:09:14.000Z (over 2 years ago)
- Last Synced: 2025-01-20T13:40:18.073Z (over 1 year ago)
- Language: C++
- Homepage: https://quasarapp.ddns.net:3031/docs/QuasarApp/DoctorPill/latest/
- Size: 427 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Doctor Pill
The Doctor pill is simple qt / qml library for fast develop fixes for applications that already released and working in production.
The library has c++ interface DP::iPill and QML view for diagnostic gui applications.
For Disable the gui part of the library use the DOCTOR_PILL_GUI option.

## 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
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
// ...
DP::Doctor _doctor;
if (_doctor.fix({QSharedPointer::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
#include
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::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
}
}
```