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.
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)
- add as a submodule this repo
git submodule add https://github.com/QuasarApp/DoctorPill.git
- Add to build the DoctorPill as a subdirectory
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)
#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
};
};
#include <doctorpill.h>
// ...
DP::Doctor _doctor;
if (_doctor.fix({QSharedPointer<MyPill>::create()})) {
// app fixed successfull
} else {
// fail to fix app
}
// ...
For working with gui wrapper you need to initialize this library before include gui module in to your qml file.
#include <doctorpillgui.h>
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();
}
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
}
}