tmp commit

This commit is contained in:
Andrei Yankovich 2022-01-17 18:49:39 +03:00
parent 5e8283cea7
commit ed955426bc
5 changed files with 41 additions and 11 deletions

View File

@ -20,9 +20,6 @@ set(CMAKE_AUTOUIC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (ANDROID OR IOS)
set(BUILD_SHARED_LIBS ON)
endif()
if (NOT QT_VERSION_MAJOR)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
@ -34,7 +31,7 @@ include(submodules/CMake/QuasarApp.cmake)
updateGitVars()
set(DoctorPill_VERSION "0.${GIT_COMMIT_COUNT}.${GIT_COMMIT_HASH}")
option(DOCTOR_PILL_GUI "Enable gui qml model for build" OFF)
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)
@ -56,9 +53,15 @@ endif()
initAll()
if (DOCTOR_PILL_GUI)
add_definitions(-DDOCTOR_PILL_GUI ON)
else()
set(DOCTOR_PILL_EXAMPLE OFF)
endif()
add_subdirectory(src/Library)
if (DEFINED DOCTOR_PILL_EXAMPLE)
if (DOCTOR_PILL_EXAMPLE)
add_subdirectory(src/Example)
endif()

View File

@ -20,6 +20,7 @@ namespace DP {
class DoctorModel: public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(double progress READ progress WRITE setProgress NOTIFY progressChanged)
Q_PROPERTY(int state READ state WRITE setState NOTIFY stateChanged)

View File

@ -5,6 +5,15 @@
</qresource>
<qresource prefix="/DoctorPillTr">
<file>languages/en.qm</file>
<file>languages/de.qm</file>
<file>languages/es.qm</file>
<file>languages/fr.qm</file>
<file>languages/ja.qm</file>
<file>languages/pl.qm</file>
<file>languages/ru.qm</file>
<file>languages/tr.qm</file>
<file>languages/uk.qm</file>
<file>languages/zh.qm</file>
</qresource>
<qresource prefix="/icons">
<file>icons/Failed.png</file>

View File

@ -6,10 +6,12 @@
//#
#include "doctorpill.h"
#ifdef DOCTOR_PILL_GUI
#include <QQmlApplicationEngine>
#endif
namespace DP {
#ifdef DOCTOR_PILL_GUI
bool init(QQmlApplicationEngine *engine) {
if (!engine)
@ -25,5 +27,10 @@ bool init(QQmlApplicationEngine *engine) {
return true;
}
#else
bool init() {
return true;
}
#endif
}

View File

@ -10,29 +10,39 @@
#include "DoctorPillCore/ipill.h"
#include "DoctorPillCore/doctortest.h"
#ifdef DOCTOR_PILL_GUI
#include "DoctorPillGui/doctormodel.h"
inline void initDoctorPillResources() {
Q_INIT_RESOURCE(DoctorPill);
Q_INIT_RESOURCE(DoctorPillRes);
}
class QQmlApplicationEngine;
class DoctorModel;
#endif
/**
* @brief DP This is base name space of the DoctorPill(DP) library. Please if you use the gui application and gui models then invoke the DP::init method before use this library.
*/
namespace DP {
#ifdef DOCTOR_PILL_GUI
/**
* @brief init This function initialize the qml gui classes of the DoctorPill library.
* @note if you do not use GUI then this function do nothing.
* @param engine This is qml engine pointer if this pointer is invalid then finction return false.
* @param customModel This is a custom c++ nodel of qml view. IF this option sets to nullptr then doctorpill will use default model.
* @return return true if the library initialized successful else false.
*
* @see DoctorModel
*/
bool DOCTOR_PILL_EXPORT init(QQmlApplicationEngine *engine);
#else
/**
* @brief init This function is empty wrapper for non gui build
* @return always return true.
*
* @see DoctorModel
*/
bool DOCTOR_PILL_EXPORT init();
#endif
}