mirror of
https://github.com/QuasarApp/DoctorPill.git
synced 2025-04-26 09:44:41 +00:00
separate to gui and core libs
This commit is contained in:
parent
8c18da429a
commit
ffa27ffe5a
5
.gitignore
vendored
5
.gitignore
vendored
@ -69,5 +69,6 @@ _deps
|
|||||||
# Configured files
|
# Configured files
|
||||||
build.gradle
|
build.gradle
|
||||||
AndroidManifest.xml
|
AndroidManifest.xml
|
||||||
src/Example/Deploy/RENAME_ME.json
|
src/Example/Deploy/DoctorPill.json
|
||||||
src/Library/doctorpill_global.h
|
src/Core/doctorpill_global.h
|
||||||
|
src/GUI/doctorpill_gui_global.h
|
||||||
|
@ -53,15 +53,16 @@ if (ANDROID OR IOS)
|
|||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
initAll()
|
initAll()
|
||||||
|
|
||||||
|
add_subdirectory(src/Core)
|
||||||
|
|
||||||
if (NOT DOCTOR_PILL_GUI)
|
if (NOT DOCTOR_PILL_GUI)
|
||||||
set(DOCTOR_PILL_EXAMPLE OFF)
|
set(DOCTOR_PILL_EXAMPLE OFF)
|
||||||
|
else()
|
||||||
|
add_subdirectory(src/GUI)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(src/Library)
|
|
||||||
|
|
||||||
if (DOCTOR_PILL_EXAMPLE)
|
if (DOCTOR_PILL_EXAMPLE)
|
||||||
add_subdirectory(src/Example)
|
add_subdirectory(src/Example)
|
||||||
endif()
|
endif()
|
||||||
|
31
src/Core/CMakeLists.txt
Normal file
31
src/Core/CMakeLists.txt
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2020-2022 QuasarApp.
|
||||||
|
# Distributed under the GPLv3 software license, see the accompanying
|
||||||
|
# Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
# of this license document, but changing it is not allowed.
|
||||||
|
#
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
|
||||||
|
add_definitions(-DDOCTOR_PILL_LIBRARY)
|
||||||
|
|
||||||
|
file(GLOB SOURCE_CPP
|
||||||
|
"*.cpp"
|
||||||
|
"DoctorPillCore/*.cpp"
|
||||||
|
"*.h"
|
||||||
|
"DoctorPillCore/*.h"
|
||||||
|
)
|
||||||
|
|
||||||
|
set(ALL_SOURCES ${SOURCE_CPP})
|
||||||
|
|
||||||
|
set(PUBLIC_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
|
set(PRIVATE_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/private")
|
||||||
|
|
||||||
|
add_library(${PROJECT_NAME} ${ALL_SOURCES})
|
||||||
|
target_link_libraries(${PROJECT_NAME} PUBLIC Qt${QT_VERSION_MAJOR}::Core )
|
||||||
|
|
||||||
|
target_include_directories(${PROJECT_NAME} PUBLIC ${PUBLIC_INCUDE_DIR})
|
||||||
|
target_include_directories(${PROJECT_NAME} PRIVATE ${PRIVATE_INCUDE_DIR})
|
||||||
|
|
||||||
|
set(global_file "${CMAKE_CURRENT_SOURCE_DIR}/doctorpill_global.h")
|
||||||
|
configure_file("${global_file}.in" ${global_file} @ONLY)
|
15
src/Core/doctorpill.cpp
Normal file
15
src/Core/doctorpill.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
//#
|
||||||
|
//# Copyright (C) 2021-2022 QuasarApp.
|
||||||
|
//# Distributed under the GPLv3 software license, see the accompanying
|
||||||
|
//# Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
//# of this license document, but changing it is not allowed.
|
||||||
|
//#
|
||||||
|
|
||||||
|
#include "doctorpill.h"
|
||||||
|
|
||||||
|
namespace DP {
|
||||||
|
|
||||||
|
QString version() {
|
||||||
|
return DOCTOR_PILL_VERSION;
|
||||||
|
}
|
||||||
|
}
|
26
src/Core/doctorpill.h
Normal file
26
src/Core/doctorpill.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
//#
|
||||||
|
//# Copyright (C) 2021-2022 QuasarApp.
|
||||||
|
//# Distributed under the GPLv3 software license, see the accompanying
|
||||||
|
//# Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
//# of this license document, but changing it is not allowed.
|
||||||
|
//#
|
||||||
|
|
||||||
|
#ifndef DOCTOR_PILL_H
|
||||||
|
#define DOCTOR_PILL_H
|
||||||
|
|
||||||
|
#include "DoctorPillCore/doctor.h"
|
||||||
|
#include "DoctorPillCore/doctortest.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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 {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief version This method return string value of lib version
|
||||||
|
* @return string value of lib version.
|
||||||
|
*/
|
||||||
|
QString version();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // DOCTOR_PILL_H
|
@ -17,7 +17,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DOCTOR_PILL_VERSION "@DOCTOR_PILL_VERSION@"
|
#define DOCTOR_PILL_VERSION "@DOCTOR_PILL_VERSION@"
|
||||||
#define @DOCTOR_PILL_DEFINE@
|
|
||||||
|
|
||||||
#endif //DoctorPill_GLOBAL_H
|
#endif //DoctorPill_GLOBAL_H
|
||||||
|
|
@ -7,47 +7,34 @@
|
|||||||
|
|
||||||
cmake_minimum_required(VERSION 3.14)
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
|
||||||
add_definitions(-DDOCTOR_PILL_LIBRARY)
|
add_definitions(-DDOCTOR_PILL_GUI_LIBRARY)
|
||||||
|
|
||||||
file(GLOB SOURCE_CPP
|
set(CURRENT_PROJECT ${PROJECT_NAME}GUI)
|
||||||
|
|
||||||
|
file(GLOB SOURCE_CPP_GUI
|
||||||
|
"DoctorPillGui/*.cpp"
|
||||||
|
"DoctorPillGui/*.h"
|
||||||
"*.cpp"
|
"*.cpp"
|
||||||
"DoctorPillCore/*.cpp"
|
|
||||||
"*.h"
|
"*.h"
|
||||||
"DoctorPillCore/*.h"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (DOCTOR_PILL_GUI)
|
file(GLOB SOURCE_QRC
|
||||||
file(GLOB SOURCE_CPP_GUI
|
"*.qrc"
|
||||||
"DoctorPillGui/*.cpp"
|
"DoctorPillCore/*.qrc"
|
||||||
"DoctorPillGui/*.h"
|
)
|
||||||
|
|
||||||
)
|
|
||||||
|
|
||||||
file(GLOB SOURCE_QRC
|
|
||||||
"*.qrc"
|
|
||||||
"DoctorPillCore/*.qrc"
|
|
||||||
)
|
|
||||||
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(ALL_SOURCES ${SOURCE_CPP} ${SOURCE_QRC} ${SOURCE_CPP_GUI})
|
set(ALL_SOURCES ${SOURCE_CPP} ${SOURCE_QRC} ${SOURCE_CPP_GUI})
|
||||||
|
|
||||||
set(PUBLIC_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
set(PUBLIC_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
set(PRIVATE_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/private")
|
set(PRIVATE_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/private")
|
||||||
|
|
||||||
add_library(${PROJECT_NAME} ${ALL_SOURCES})
|
add_library(${CURRENT_PROJECT} ${ALL_SOURCES})
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC Qt${QT_VERSION_MAJOR}::Core )
|
|
||||||
|
|
||||||
set(DOCTOR_PILL_DEFINE "DOCTOR_PILL_WITHOUT_GUI")
|
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Quick Concurrent REQUIRED)
|
||||||
if (DOCTOR_PILL_GUI)
|
target_link_libraries(${CURRENT_PROJECT} PUBLIC ${PROJECT_NAME} Qt${QT_VERSION_MAJOR}::Concurrent Qt${QT_VERSION_MAJOR}::Quick )
|
||||||
set(DOCTOR_PILL_DEFINE "DOCTOR_PILL_WITH_GUI")
|
|
||||||
|
|
||||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Quick Concurrent REQUIRED)
|
target_include_directories(${CURRENT_PROJECT} PUBLIC ${PUBLIC_INCUDE_DIR})
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC Qt${QT_VERSION_MAJOR}::Concurrent Qt${QT_VERSION_MAJOR}::Quick )
|
target_include_directories(${CURRENT_PROJECT} PRIVATE ${PRIVATE_INCUDE_DIR})
|
||||||
endif()
|
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} PUBLIC ${PUBLIC_INCUDE_DIR})
|
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE ${PRIVATE_INCUDE_DIR})
|
|
||||||
|
|
||||||
|
|
||||||
set(LANGS ${CMAKE_CURRENT_SOURCE_DIR}/languages/en.ts
|
set(LANGS ${CMAKE_CURRENT_SOURCE_DIR}/languages/en.ts
|
||||||
@ -61,9 +48,9 @@ set(LANGS ${CMAKE_CURRENT_SOURCE_DIR}/languages/en.ts
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/languages/es.ts
|
${CMAKE_CURRENT_SOURCE_DIR}/languages/es.ts
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/languages/pl.ts)
|
${CMAKE_CURRENT_SOURCE_DIR}/languages/pl.ts)
|
||||||
|
|
||||||
prepareQM(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/../ "${LANGS}")
|
prepareQM(${CURRENT_PROJECT} ${CMAKE_CURRENT_SOURCE_DIR}/../ "${LANGS}")
|
||||||
|
|
||||||
set(QML_IMPORT_PATH ${QML_IMPORT_PATH} "${CMAKE_CURRENT_SOURCE_DIR}" CACHE STRING "" FORCE)
|
set(QML_IMPORT_PATH ${QML_IMPORT_PATH} "${CMAKE_CURRENT_SOURCE_DIR}" CACHE STRING "" FORCE)
|
||||||
|
|
||||||
set(global_file "${CMAKE_CURRENT_SOURCE_DIR}/doctorpill_global.h")
|
set(global_file "${CMAKE_CURRENT_SOURCE_DIR}/doctorpill_gui_global.h")
|
||||||
configure_file("${global_file}.in" ${global_file} @ONLY)
|
configure_file("${global_file}.in" ${global_file} @ONLY)
|
@ -10,13 +10,14 @@
|
|||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
#include <DoctorPillCore/doctor.h>
|
#include <DoctorPillCore/doctor.h>
|
||||||
|
#include <doctorpill_gui_global.h>
|
||||||
|
|
||||||
namespace DP {
|
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 DOCTOR_PILL_EXPORT DoctorModel: public QAbstractListModel
|
class DOCTOR_PILL_GUI_EXPORT DoctorModel: public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
20
src/GUI/doctorpill_gui_global.h.in
Normal file
20
src/GUI/doctorpill_gui_global.h.in
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
//#
|
||||||
|
//# Copyright (C) 2018-2022 QuasarApp.
|
||||||
|
//# Distributed under the GPLv3 software license, see the accompanying
|
||||||
|
//# Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
//# of this license document, but changing it is not allowed.
|
||||||
|
//#
|
||||||
|
|
||||||
|
#ifndef DoctorPill_GUI_GLOBAL_H
|
||||||
|
#define DoctorPill_GUI_GLOBAL_H
|
||||||
|
|
||||||
|
#include <QtCore/qglobal.h>
|
||||||
|
|
||||||
|
#if defined(DOCTOR_PILL_GUI_LIBRARY)
|
||||||
|
# define DOCTOR_PILL_GUI_EXPORT Q_DECL_EXPORT
|
||||||
|
#else
|
||||||
|
# define DOCTOR_PILL_GUI_EXPORT Q_DECL_IMPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif //DoctorPill_GUI_GLOBAL_H
|
||||||
|
|
@ -5,13 +5,11 @@
|
|||||||
//# of this license document, but changing it is not allowed.
|
//# of this license document, but changing it is not allowed.
|
||||||
//#
|
//#
|
||||||
|
|
||||||
#include "doctorpill.h"
|
#include "doctorpillgui.h"
|
||||||
#ifdef DOCTOR_PILL_WITH_GUI
|
|
||||||
#include <QQmlApplicationEngine>
|
#include <QQmlApplicationEngine>
|
||||||
#endif
|
|
||||||
namespace DP {
|
namespace DP {
|
||||||
|
|
||||||
#ifdef DOCTOR_PILL_WITH_GUI
|
|
||||||
bool init(QQmlApplicationEngine *engine) {
|
bool init(QQmlApplicationEngine *engine) {
|
||||||
|
|
||||||
if (!engine)
|
if (!engine)
|
||||||
@ -28,14 +26,4 @@ bool init(QQmlApplicationEngine *engine) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
bool init() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QString version() {
|
|
||||||
return DOCTOR_PILL_VERSION;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -5,14 +5,12 @@
|
|||||||
//# of this license document, but changing it is not allowed.
|
//# of this license document, but changing it is not allowed.
|
||||||
//#
|
//#
|
||||||
|
|
||||||
#ifndef DOCTOR_PILL_H
|
#ifndef DOCTOR_PILL_GUI_H
|
||||||
#define DOCTOR_PILL_H
|
#define DOCTOR_PILL_GUI_H
|
||||||
|
|
||||||
#include "DoctorPillCore/doctor.h"
|
#include "DoctorPillCore/doctor.h"
|
||||||
#include "DoctorPillCore/doctortest.h"
|
#include "DoctorPillCore/doctortest.h"
|
||||||
|
|
||||||
#ifdef DOCTOR_PILL_WITH_GUI
|
|
||||||
|
|
||||||
#include "DoctorPillGui/doctormodel.h"
|
#include "DoctorPillGui/doctormodel.h"
|
||||||
|
|
||||||
inline void initDoctorPillResources() {
|
inline void initDoctorPillResources() {
|
||||||
@ -20,14 +18,9 @@ inline void initDoctorPillResources() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class QQmlApplicationEngine;
|
class QQmlApplicationEngine;
|
||||||
#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 {
|
namespace DP {
|
||||||
|
|
||||||
#ifdef DOCTOR_PILL_WITH_GUI
|
|
||||||
/**
|
/**
|
||||||
* @brief init This function initialize the qml gui classes of the DoctorPill library.
|
* @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.
|
* @note if you do not use GUI then this function do nothing.
|
||||||
@ -37,21 +30,6 @@ namespace DP {
|
|||||||
* @see DoctorModel
|
* @see DoctorModel
|
||||||
*/
|
*/
|
||||||
bool DOCTOR_PILL_EXPORT init(QQmlApplicationEngine *engine);
|
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
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief version This method return string value of lib version
|
|
||||||
* @return string value of lib version.
|
|
||||||
*/
|
|
||||||
QString version();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DOCTOR_PILL_H
|
#endif // DOCTOR_PILL_GUI_H
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
Loading…
x
Reference in New Issue
Block a user