diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e0ff5f..5b57c6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,18 +9,18 @@ project(libs) set(PIP_CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pip/cmake") set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" "${PIP_CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/qad/cmake") set(LIBPROJECT 1) +include(GenerateExportHeader) include(SDKMacros) include(DeployMacros) -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) if(NOT DEFINED BUILD_NUMBER) set(BUILD_NUMBER 9999) endif() if("x${BUILD_NUMBER}" STREQUAL "x") set(BUILD_NUMBER 0) endif() -set(_COMPANY SHS) -set(_DOMAIN org.SHS) include_directories(${CMAKE_CURRENT_BINARY_DIR}/pip) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/qad) +include_directories(${CMAKE_CURRENT_BINARY_DIR}/piqt) if(MINGW) find_package(MinGW REQUIRED) else() @@ -45,21 +45,22 @@ if (DEFINED ANDROID_PLATFORM) #message("${ANDROID_NDK}/sysroot/usr/include") endif() set(INSTALL_PREFIX "") -set(_plugins_default_ 1) +set(_plugins_default_ ON) if(CMAKE_CROSSCOMPILING) if (DEFINED ANDROID_PLATFORM) - set(_plugins_default_ 0) + set(_plugins_default_ OFF) set(INSTALL_PREFIX "${CMAKE_FIND_ROOT_PATH}/") else() set(INSTALL_PREFIX "${CMAKE_STAGING_PREFIX}") endif() endif() -option(CROSSTOOLS "Crosstools minimal build" 0) -option(LIB "System install" 1) -option(QGLVIEW "Build QGLview library and utils" 0) -option(QGLENGINE "Build QGLENGINE library and utils" 0) +option(CROSSTOOLS "Crosstools minimal build" OFF) +option(LIB "System install" ON) +option(QGLVIEW "Build QGLview library and utils" OFF) +option(QGLENGINE "Build QGLENGINE library and utils" OFF) option(UTILS "Build various utils" ${_plugins_default_}) option(DESIGNER_PLUGINS "Build qt designer plugins" ${_plugins_default_}) +option(STATIC_LIB OFF) if (CROSSTOOLS) set(LIB 1) set(QGLVIEW 0) @@ -115,6 +116,7 @@ if(WIN32) endif() set(QAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qad) +set(ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) if (CROSSTOOLS) @@ -149,13 +151,17 @@ else() foreach(F ${PIP_MAIN_FOLDERS}) list(APPEND PIP_INCLUDES "${F}") endforeach(F) + add_subdirectory(cd_utils) + include_directories("${CMAKE_CURRENT_SOURCE_DIR}/cd_utils" "${CMAKE_CURRENT_BINARY_DIR}/cd_utils") set(_DIRS) if (SomeQtFound) message(STATUS "Building Qt-derived targets for ${QtVersions}") add_subdirectory(qad) - set(_DIRS piqt piqt_utils qcd_utils) + include_directories(${qad_includes}) + add_subdirectory(piqt) + include_directories(${piqt_includes}) + set(_DIRS) if (Qt5) - list(APPEND _DIRS) if (QGLVIEW) list(APPEND _DIRS qglview) endif() @@ -165,16 +171,11 @@ else() endif() foreach(_D ${_DIRS}) list(APPEND QT_MULTILIB_LIST ${_D}) + add_subdirectory(${_D}) endforeach(_D) - include_directories(piqt) else() message(STATUS "None of Qt found, skip Qt-derived targets") endif() - include_directories(cd_utils) - list(INSERT _DIRS 0 cd_utils) - foreach(_D ${_DIRS}) - add_subdirectory(${_D}) - endforeach(_D) endif() diff --git a/SDKMacros.cmake b/SDKMacros.cmake index 77db2e1..73f89a7 100644 --- a/SDKMacros.cmake +++ b/SDKMacros.cmake @@ -1,35 +1,99 @@ -macro(sdk_install _DIR _TARGET _H_FILES _QM_FILES) +macro(sdk_install _DIR IS_APP _TARGET _H_FILES _QM_FILES) #message("QM=${_QM_FILES}") - if(LIB) - if(WIN32) - if(NOT "x${_H_FILES}" STREQUAL "x") + if((NOT ${IS_APP}) AND (NOT "${_H_FILES}" STREQUAL "")) + if(LIB) + if(WIN32) install(FILES ${_H_FILES} DESTINATION ${MINGW_INCLUDE}/${_DIR}) - endif() - qt_install(TARGETS ${_TARGET} ARCHIVE DESTINATION ${MINGW_LIB}) - qt_install(TARGETS ${_TARGET} RUNTIME DESTINATION ${MINGW_BIN}) - qt_install(TARGETS ${_TARGET} RUNTIME DESTINATION QtBin) - else() - if (NOT "x${_H_FILES}" STREQUAL "x") + else() install(FILES ${_H_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${_DIR}) endif() - qt_install(TARGETS ${_TARGET} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) - endif() - if(NOT "x${_QM_FILES}" STREQUAL "x") - qt_install(LANG ${_QM_FILES} DESTINATION QtLang) - endif() - else() - if(NOT "x${_H_FILES}" STREQUAL "x") + else() install(FILES ${_H_FILES} DESTINATION include/${_DIR}) endif() - if(WIN32) - qt_install(TARGETS ${_TARGET} RUNTIME DESTINATION bin) - qt_install(TARGETS ${_TARGET} ARCHIVE DESTINATION lib) + endif() + if (NOT "${_TARGET}" STREQUAL "") + if(LIB) + if(WIN32) + if (${IS_APP}) + qt_install(TARGETS ${_TARGET} DESTINATION ${MINGW_BIN}) + qt_install(TARGETS ${_TARGET} DESTINATION QtBin) + else() + qt_install(TARGETS ${_TARGET} ARCHIVE DESTINATION ${MINGW_LIB}) + qt_install(TARGETS ${_TARGET} RUNTIME DESTINATION ${MINGW_BIN}) + qt_install(TARGETS ${_TARGET} RUNTIME DESTINATION QtBin) + endif() + else() + if (${IS_APP}) + qt_install(TARGETS ${_TARGET} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) + else() + qt_install(TARGETS ${_TARGET} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) + endif() + endif() + if(NOT "x${_QM_FILES}" STREQUAL "x") + qt_install(LANG ${_QM_FILES} DESTINATION QtLang) + endif() else() - qt_install(TARGETS ${_TARGET} DESTINATION lib) - endif() - if(NOT "x${_QM_FILES}" STREQUAL "x") - qt_install(LANG ${_QM_FILES} DESTINATION lang) + if(${IS_APP}) + qt_install(TARGETS ${_TARGET} DESTINATION bin) + else() + if(WIN32) + qt_install(TARGETS ${_TARGET} RUNTIME DESTINATION bin) + qt_install(TARGETS ${_TARGET} ARCHIVE DESTINATION lib) + else() + qt_install(TARGETS ${_TARGET} DESTINATION lib) + endif() + endif() + if(NOT "x${_QM_FILES}" STREQUAL "x") + qt_install(LANG ${_QM_FILES} DESTINATION lang) + endif() endif() endif() endmacro() + + +macro(add_directories_with_include multilib_prefix) + set(DIRS) + file(GLOB _dl "[^.]*") + foreach(_d ${_dl}) + if(IS_DIRECTORY ${_d}) + list(APPEND DIRS ${_d}) + endif() + endforeach() + + set(inc_var ${multilib_prefix}includes) + set(${inc_var}) + foreach(_d ${DIRS}) + get_filename_component(_dname "${_d}" NAME) + list(APPEND QT_MULTILIB_LIST ${multilib_prefix}${_dname}) + list(APPEND ${inc_var} "${_d}") + list(APPEND ${inc_var} "${CMAKE_CURRENT_BINARY_DIR}/${_dname}") + endforeach() + + include_directories(${${inc_var}}) + foreach(_d ${DIRS}) + add_subdirectory(${_d}) + endforeach() + + set(QT_MULTILIB_LIST ${QT_MULTILIB_LIST} PARENT_SCOPE) + set(${inc_var} ${${inc_var}} PARENT_SCOPE) + if (LIB) + set(_ALL_TARGETS ${_ALL_TARGETS} PARENT_SCOPE) + endif() +endmacro() + + +macro(add_directories multilib_prefix) + include_directories(${${multilib_prefix}includes}) + file(GLOB _dl "[^.]*") + foreach(_d ${_dl}) + if(IS_DIRECTORY ${_d}) + add_subdirectory(${_d}) + endif() + endforeach() + + if (LIB) + set(_ALL_TARGETS ${_ALL_TARGETS} PARENT_SCOPE) + endif() +endmacro() + diff --git a/android.toolchain.cmake.add b/android.toolchain.cmake.add deleted file mode 100644 index 58617f7..0000000 --- a/android.toolchain.cmake.add +++ /dev/null @@ -1,6 +0,0 @@ -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY FIRST) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE FIRST) -set(CMAKE_PREFIX_PATH /soft/android/${ANDROID_ABI}) -list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_PREFIX_PATH}/lib) -include_directories(${CMAKE_PREFIX_PATH}/include) diff --git a/cd_utils/CMakeLists.txt b/cd_utils/CMakeLists.txt index c58b05e..f1c6a5d 100644 --- a/cd_utils/CMakeLists.txt +++ b/cd_utils/CMakeLists.txt @@ -1,67 +1,18 @@ cmake_minimum_required(VERSION 3.0) project(cd_utils) -if (NOT LIBPROJECT) - find_package(PIP REQUIRED) - option(LIB "System install" 1) - option(DEBUG "Build with -g3" 0) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall") - if (DEBUG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3") - endif() -endif() -if (MINGW) - find_package(MinGW REQUIRED) -endif() +find_package(MinGW REQUIRED) include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${PIP_INCLUDES}) -#file(GLOB HDRS_UTILS "*.h") -#file(GLOB CPPS_UTILS "*.cpp") file(GLOB CPPS_UTILS "cdutils_*.cpp") file(GLOB HDRS_UTILS "cdutils_*.h") -if (DEFINED ENV{QNX_HOST}) - add_library(${PROJECT_NAME} STATIC ${CPPS_UTILS} ${HDRS_UTILS}) -else() - add_library(${PROJECT_NAME} SHARED ${CPPS_UTILS} ${HDRS_UTILS}) -endif() +add_library(${PROJECT_NAME} SHARED ${CPPS_UTILS} ${HDRS_UTILS}) target_link_libraries(${PROJECT_NAME} ${PIP_LIBRARY}) - -# # Apple crosscompiling rpath patch -# if (APPLE AND CMAKE_CROSSCOMPILING AND CMAKE_MACOSX_RPATH) - # foreach(_RP ${CMAKE_INSTALL_RPATH}) - # add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD - # COMMAND "${CMAKE_INSTALL_NAME_TOOL}" - # "-add_rpath" "${_RP}" - # "$/$" - # COMMENT "Add to ${PROJECT_NAME} rpath \"${_RP}\"") - # endforeach() -# endif() +generate_export_header(${PROJECT_NAME}) +list(APPEND HDRS_UTILS "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_export.h") add_executable(cdutilstest "cdutilstest.cpp" "cdtest.h") target_link_libraries(cdutilstest ${PIP_LIBRARY} ${PROJECT_NAME}) message(STATUS "Building ${PROJECT_NAME}") -if(NOT LIBPROJECT) - if(LIB) - if(WIN32) - if(MINGW) - set(CMAKE_INSTALL_PREFIX ${MINGW_DIR}) - endif() - else() - if (DEFINED ANDROID_PLATFORM) - set(CMAKE_INSTALL_PREFIX ${ANDROID_SYSTEM_LIBRARY_PATH}/usr) - else() - if(CMAKE_CROSSCOMPILING) - set(CMAKE_INSTALL_PREFIX ${CMAKE_STAGING_PREFIX}) - else() - set(CMAKE_INSTALL_PREFIX ${INSTALL_PREFIX}/usr/local) - endif() - endif() - endif() - message(STATUS "Install ${PROJECT_NAME} to system \"${CMAKE_INSTALL_PREFIX}\"") - else() - message(STATUS "Install ${PROJECT_NAME} to local \"bin\", \"lib\" and \"include\"") - endif() -endif() - if(LIB) list(APPEND _ALL_TARGETS ${PROJECT_NAME}) set(_ALL_TARGETS ${_ALL_TARGETS} PARENT_SCOPE) diff --git a/cd_utils/cdutils_c.h b/cd_utils/cdutils_c.h index 543f58c..a517e8c 100644 --- a/cd_utils/cdutils_c.h +++ b/cd_utils/cdutils_c.h @@ -21,12 +21,13 @@ #define CDUTILS_C_H #include "cdutils_interface.h" +#include "cd_utils_export.h" namespace CDUtils { -class CInterface: public Interface +class CD_UTILS_EXPORT CInterface: public Interface { PIOBJECT_SUBCLASS(CInterface, Interface) public: @@ -40,6 +41,6 @@ public: } -extern CDUtils::CInterface C; +extern CD_UTILS_EXPORT CDUtils::CInterface C; #endif // CDUTILS_C_H diff --git a/cd_utils/cdutils_core.h b/cd_utils/cdutils_core.h index ad1a780..a0d4e79 100644 --- a/cd_utils/cdutils_core.h +++ b/cd_utils/cdutils_core.h @@ -24,6 +24,7 @@ #include "cdutils_protocol.h" #include "piconnection.h" #include "pidatatransfer.h" +#include "cd_utils_export.h" namespace CDUtils { @@ -31,7 +32,7 @@ namespace CDUtils { class CDCore; -class __Core_Initializer__ { +class CD_UTILS_EXPORT __Core_Initializer__ { public: __Core_Initializer__(); ~__Core_Initializer__(); @@ -40,7 +41,7 @@ public: }; -class CDCore: public PIObject +class CD_UTILS_EXPORT CDCore: public PIObject { PIOBJECT(CDUtils::CDCore) friend class __Core_Initializer__; diff --git a/cd_utils/cdutils_interface.h b/cd_utils/cdutils_interface.h index 7465e05..635ed1d 100644 --- a/cd_utils/cdutils_interface.h +++ b/cd_utils/cdutils_interface.h @@ -22,6 +22,7 @@ #include "cdutils_types.h" #include "piobject.h" +#include "cd_utils_export.h" namespace CDUtils { @@ -29,7 +30,7 @@ namespace CDUtils { class CDCore; -class Interface: public PIObject +class CD_UTILS_EXPORT Interface: public PIObject { PIOBJECT(CDUtils::Interface) public: diff --git a/cd_utils/cdutils_k.h b/cd_utils/cdutils_k.h index 49bb247..a3190f1 100644 --- a/cd_utils/cdutils_k.h +++ b/cd_utils/cdutils_k.h @@ -21,12 +21,13 @@ #define CDUTILS_K_H #include "cdutils_interface.h" +#include "cd_utils_export.h" namespace CDUtils { -class KInterface: public Interface +class CD_UTILS_EXPORT KInterface: public Interface { PIOBJECT_SUBCLASS(KInterface, Interface) public: @@ -41,6 +42,6 @@ public: } -extern CDUtils::KInterface K; +extern CD_UTILS_EXPORT CDUtils::KInterface K; #endif // CDUTILS_K_H diff --git a/cd_utils/cdutils_m.h b/cd_utils/cdutils_m.h index 0e809d3..2585b66 100644 --- a/cd_utils/cdutils_m.h +++ b/cd_utils/cdutils_m.h @@ -21,12 +21,13 @@ #define CDUTILS_M_H #include "cdutils_interface.h" +#include "cd_utils_export.h" namespace CDUtils { -class MInterface: public Interface +class CD_UTILS_EXPORT MInterface: public Interface { PIOBJECT_SUBCLASS(MInterface, Interface) public: @@ -50,6 +51,6 @@ private: } -extern CDUtils::MInterface M; +extern CD_UTILS_EXPORT CDUtils::MInterface M; #endif // CDUTILS_M_H diff --git a/cd_utils/cdutils_parser.h b/cd_utils/cdutils_parser.h index deee7ae..4b23fa3 100644 --- a/cd_utils/cdutils_parser.h +++ b/cd_utils/cdutils_parser.h @@ -20,6 +20,7 @@ #ifndef CDUTILS_PARSER_H #define CDUTILS_PARSER_H +#include "cd_utils_export.h" class PIIODevice; @@ -29,7 +30,7 @@ class CDSection; namespace CDParser { -CDSection parse(PIIODevice * d, int cdsection_type); +CD_UTILS_EXPORT CDSection parse(PIIODevice * d, int cdsection_type); } diff --git a/cd_utils/cdutils_protocol.h b/cd_utils/cdutils_protocol.h index f47cf97..c9b541c 100644 --- a/cd_utils/cdutils_protocol.h +++ b/cd_utils/cdutils_protocol.h @@ -20,7 +20,8 @@ #ifndef CDUTILS_PROTOCOL_H #define CDUTILS_PROTOCOL_H -#include "pibytearray.h" +#include "pistring.h" +#include "cd_utils_export.h" namespace CDUtils { @@ -48,12 +49,12 @@ namespace CDUtils { # pragma pack(push,1) - struct PacketHeader { + struct CD_UTILS_EXPORT PacketHeader { int type; // CDPacketType int session_id; }; - struct PacketKDirectChange { + struct CD_UTILS_EXPORT PacketKDirectChange { PIDeque path; PIString value; }; diff --git a/cd_utils/cdutils_types.h b/cd_utils/cdutils_types.h index 7f1c4a1..299e4a9 100644 --- a/cd_utils/cdutils_types.h +++ b/cd_utils/cdutils_types.h @@ -23,6 +23,7 @@ #include "pistring.h" #include "pimap.h" #include "pivariant.h" +#include "cd_utils_export.h" class PIIODevice; class PIEvaluator; @@ -47,7 +48,7 @@ enum MessageType { typedef PIFlags UpdateModeFlags; -class CDType { +class CD_UTILS_EXPORT CDType { friend class CDSection; friend class CDCore; friend class Interface; @@ -112,7 +113,7 @@ protected: }; -class CDSection { +class CD_UTILS_EXPORT CDSection { friend class CDCore; friend class Interface; friend class XInterface; diff --git a/cd_utils/cdutils_x.h b/cd_utils/cdutils_x.h index f53fc67..b0a8e3c 100644 --- a/cd_utils/cdutils_x.h +++ b/cd_utils/cdutils_x.h @@ -21,12 +21,13 @@ #define CDUTILS_X_H #include "cdutils_interface.h" +#include "cd_utils_export.h" namespace CDUtils { -class XInterface: public Interface +class CD_UTILS_EXPORT XInterface: public Interface { PIOBJECT_SUBCLASS(XInterface, Interface) public: @@ -51,6 +52,6 @@ public: } -extern CDUtils::XInterface X; +extern CD_UTILS_EXPORT CDUtils::XInterface X; #endif // CDUTILS_X_H diff --git a/pip b/pip index 9834ac1..cc580d9 160000 --- a/pip +++ b/pip @@ -1 +1 @@ -Subproject commit 9834ac177bfae3f0bfa14c083e3857560ec59b38 +Subproject commit cc580d9385d780cfc0ee34734fbbc1d18d73d961 diff --git a/piqt/CMakeLists.txt b/piqt/CMakeLists.txt index ca1c9a8..9366a34 100644 --- a/piqt/CMakeLists.txt +++ b/piqt/CMakeLists.txt @@ -1,49 +1,57 @@ cmake_minimum_required(VERSION 3.0) -project(piqt) -if(NOT LIBPROJECT) - find_package(PIP REQUIRED) - option(LIB "System install" 0) - option(DEBUG "Build with -g3" 0) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall") - if(DEBUG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3") - endif() +cmake_policy(SET CMP0017 NEW) # need include() with .cmake +set(_PIQt_MAJOR 1) +set(_PIQt_MINOR 0) +set(_PIQt_REVISION 0) +set(_PIQt_SUFFIX ) +set(_PIQt_COMPANY SHS) +set(_PIQt_DOMAIN org.SHS) +if(NOT DEFINED BUILD_NUMBER) + set(BUILD_NUMBER 9999) endif() -find_package(QAD REQUIRED) -list(APPEND QT_MULTILIB_LIST ${PROJECT_NAME}) -set(QT_MULTILIB_LIST ${QT_MULTILIB_LIST} PARENT_SCOPE) -include_directories(${PIP_INCLUDES} ${QAD_INCLUDES}) -file(GLOB SRC "*.h" "*.cpp" "*.ui" "*.qrc" "lang/*.ts") -find_qt(${QtVersions} Core Gui Positioning) -qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM) -qt_add_library(${PROJECT_NAME} SHARED out_CPP) -qt_target_link_libraries(${PROJECT_NAME} pip qad_utils qad_widgets) -message(STATUS "Building ${PROJECT_NAME}") -if(LIBPROJECT) - sdk_install("pip" "${PROJECT_NAME}" "${out_HDR}" "${out_QM}") + +include(QADMacros) + +if(STATIC_LIB) + set(PIQt_LIB_TYPE STATIC) + add_definitions(-DPIQt_STATIC_DEFINE) else() - if(LIB) - if(WIN32) - install(FILES ${out_HDR} DESTINATION ${MINGW_INCLUDE}/pip) - if(NOT "x${out_QM}" STREQUAL "x") - qt_install(FILES ${out_QM} DESTINATION QtLang) - endif() - qt_install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION ${MINGW_LIB}) - qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${MINGW_BIN}) - qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION QtBin) - else() - install(FILES ${out_HDR} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/pip) - qt_install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) - endif() - message(STATUS "Install ${PROJECT_NAME} to system \"${CMAKE_INSTALL_PREFIX}\"") - else() - if(WIN32) - qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin) - qt_install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib) - else() - qt_install(TARGETS ${PROJECT_NAME} DESTINATION lib) - endif() - install(FILES ${out_HDR} DESTINATION include/pip) - message(STATUS "Install ${PROJECT_NAME} to local \"bin\", \"lib\" and \"include\"") - endif() + set(PIQt_LIB_TYPE SHARED) endif() + +set(PIQt_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/piqt_version.h") +set_version(PIQt + MAJOR "${_PIQt_MAJOR}" + MINOR "${_PIQt_MINOR}" + REVISION "${_PIQt_REVISION}" + BUILD "${BUILD_NUMBER}" + SUFFIX "${_PIQt_SUFFIX}" + OUTPUT "${PIQt_VERSION_FILE}") +set_deploy_property(PIQt ${_PIQt_LIB_TYPE} + FULLNAME "${_PIQt_DOMAIN}.*" + COMPANY "${_PIQt_COMPANY}") + +macro(piqt_library NAME _MODULES _LIBS) + _qt_project(${NAME} FALSE "PIQt" "${_MODULES}" "pip;${_LIBS}" ${ARGN}) + _qt_install(${NAME} FALSE "pip" "out_HDR" "out_QM") +endmacro() + +macro(piqt_application NAME _MODULES _LIBS) + _qt_project(${NAME} TRUE "PIQt" "${_MODULES}" "pip;${_LIBS}" ${ARGN}) + _qt_install(${NAME} TRUE "pip" "" "out_QM") +endmacro() + + +include_directories(${PIP_INCLUDES}) +add_subdirectory(libs) +if (UTILS) + add_subdirectory(utils) +endif() + + +set(QT_MULTILIB_LIST ${QT_MULTILIB_LIST} PARENT_SCOPE) +set(piqt_includes ${piqt_includes} PARENT_SCOPE) +if (LIB) + set(_ALL_TARGETS ${_ALL_TARGETS} PARENT_SCOPE) +endif() + diff --git a/piqt/libs/CMakeLists.txt b/piqt/libs/CMakeLists.txt new file mode 100644 index 0000000..c20718c --- /dev/null +++ b/piqt/libs/CMakeLists.txt @@ -0,0 +1 @@ +add_directories_with_include("piqt_") diff --git a/piqt/libs/core/CMakeLists.txt b/piqt/libs/core/CMakeLists.txt new file mode 100644 index 0000000..fc48469 --- /dev/null +++ b/piqt/libs/core/CMakeLists.txt @@ -0,0 +1 @@ +piqt_library(piqt "Gui;Positioning" "qad_utils;qad_widgets") diff --git a/piqt/piqt.cpp b/piqt/libs/core/piqt.cpp similarity index 100% rename from piqt/piqt.cpp rename to piqt/libs/core/piqt.cpp diff --git a/piqt/piqt.h b/piqt/libs/core/piqt.h similarity index 87% rename from piqt/piqt.h rename to piqt/libs/core/piqt.h index 002b9e0..b30171f 100644 --- a/piqt/piqt.h +++ b/piqt/libs/core/piqt.h @@ -29,13 +29,14 @@ #if QT_VERSION >= 0x050200 # include "pigeoposition.h" #endif +#include "piqt_export.h" class QGeoCoordinate; -const QVariant PI2QVariant(const PIVariant & v); -const PIVariant Q2PIVariant(const QVariant & v); +PIQT_EXPORT const QVariant PI2QVariant(const PIVariant & v); +PIQT_EXPORT const PIVariant Q2PIVariant(const QVariant & v); //inline const QString PI2QString(const PIString & v) {return QString::fromLocal8Bit(v.data());} inline const QString PI2QString(const PIString & v) {return QString::fromUtf8(v.dataUTF8());} @@ -124,20 +125,20 @@ inline PropertyStorage PI2QPropertyStorage(const PIPropertyStorage & props) { } -const QAD::Enum PI2QADEnum(const PIVariantTypes::Enum & el); -const QAD::File PI2QADFile(const PIVariantTypes::File & v); -const QAD::Dir PI2QADDir(const PIVariantTypes::Dir & v); -const QAD::IODevice PI2QADIODevice(const PIVariantTypes::IODevice & v); -const PIVariantTypes::Enum QAD2PIEnum(const QAD::Enum & el); -const PIVariantTypes::File QAD2PIFile(const QAD::File & v); -const PIVariantTypes::Dir QAD2PIDir(const QAD::Dir & v); -const PIVariantTypes::IODevice QAD2PIIODevice(const QAD::IODevice & v); +PIQT_EXPORT const QAD::Enum PI2QADEnum(const PIVariantTypes::Enum & el); +PIQT_EXPORT const QAD::File PI2QADFile(const PIVariantTypes::File & v); +PIQT_EXPORT const QAD::Dir PI2QADDir(const PIVariantTypes::Dir & v); +PIQT_EXPORT const QAD::IODevice PI2QADIODevice(const PIVariantTypes::IODevice & v); +PIQT_EXPORT const PIVariantTypes::Enum QAD2PIEnum(const QAD::Enum & el); +PIQT_EXPORT const PIVariantTypes::File QAD2PIFile(const QAD::File & v); +PIQT_EXPORT const PIVariantTypes::Dir QAD2PIDir(const QAD::Dir & v); +PIQT_EXPORT const PIVariantTypes::IODevice QAD2PIIODevice(const QAD::IODevice & v); //inline const PIVariant QString2PIVariant(const QString & v) {return PIVariant::readFromString(QString2PIString(v));} #if QT_VERSION >= 0x050200 -const QGeoCoordinate PI2QGeoPosition(const PIGeoPosition & v); -const PIGeoPosition Q2PIGeoPosition(const QGeoCoordinate & v); +PIQT_EXPORT const QGeoCoordinate PI2QGeoPosition(const PIGeoPosition & v); +PIQT_EXPORT const PIGeoPosition Q2PIGeoPosition(const QGeoCoordinate & v); #endif template diff --git a/piqt_utils/qpiconnection.cpp b/piqt/libs/core/qpiconnection.cpp similarity index 100% rename from piqt_utils/qpiconnection.cpp rename to piqt/libs/core/qpiconnection.cpp diff --git a/piqt_utils/qpiconnection.h b/piqt/libs/core/qpiconnection.h similarity index 93% rename from piqt_utils/qpiconnection.h rename to piqt/libs/core/qpiconnection.h index 3eba8b5..7061724 100644 --- a/piqt_utils/qpiconnection.h +++ b/piqt/libs/core/qpiconnection.h @@ -25,8 +25,10 @@ #include "piconnection.h" #include "qpiconfig.h" #include "piqt.h" +#include "piqt_export.h" -class QPIConnection: public QObject, public PIConnection { + +class PIQT_EXPORT QPIConnection: public QObject, public PIConnection { Q_OBJECT PIOBJECT_SUBCLASS(QPIConnection, PIConnection) public: diff --git a/piqt/libs/qcd/CMakeLists.txt b/piqt/libs/qcd/CMakeLists.txt new file mode 100644 index 0000000..f3e84e8 --- /dev/null +++ b/piqt/libs/qcd/CMakeLists.txt @@ -0,0 +1 @@ +piqt_library(qcd_utils "Gui" "pip;qad_utils;qad_widgets;qad_graphic;cd_utils;piqt") diff --git a/qcd_utils/qcd_core.cpp b/piqt/libs/qcd/qcd_core.cpp similarity index 96% rename from qcd_utils/qcd_core.cpp rename to piqt/libs/qcd/qcd_core.cpp index c77e70e..95511a8 100644 --- a/qcd_utils/qcd_core.cpp +++ b/piqt/libs/qcd/qcd_core.cpp @@ -1,297 +1,297 @@ -#include "qcd_core.h" -#include "cdutils_k.h" -#include "cdutils_core.h" -#include "piqt.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace CDUtils; - - -int __QCore_Initializer__::count_(0); -QCDCore * __QCore_Initializer__::__instance__(0); - - -__QCore_Initializer__::__QCore_Initializer__() { - count_++; - if (count_ > 1) return; - __instance__ = new QCDCore(); -} - - -__QCore_Initializer__::~__QCore_Initializer__() { - count_--; - if (count_ > 0) return; - if (__instance__ != 0) { - delete __instance__; - __instance__ = 0; - } -} - - - - -QCDCore::QCDCore() { - setObjectName("QCDCore"); - setName("QCDCore"); - CONNECTU(&K, changedGlobal, this, K_ChangedGlobal); - updating = direct_on = false; -} - - -QCDCore::~QCDCore() { -} - - -void QCDCore::K_ChangedGlobal() { - QMetaObject::invokeMethod(this, "updateBindedWidgets", Qt::QueuedConnection); -} - - -void QCDCore::slotBool(bool v) { - QWidget * w = (QWidget*)sender(); - if (!w || updating) return; - QList > pathes = binded_widgets.values(w); - foreach (const PIDeque & path, pathes) - K[path].setValue(PIString::fromBool(v)); - K.calculate(); - emit updateViewRequest(); -} - - -void QCDCore::slotInt(int v) { - QWidget * w = (QWidget*)sender(); - if (!w || updating) return; - QList > pathes = binded_widgets.values(w); - foreach (const PIDeque & path, pathes) - K[path].setValue(PIString::fromNumber(v)); - finishEdit(pathes); -} - - -void QCDCore::slotDouble(double v) { - QWidget * w = (QWidget*)sender(); - if (!w || updating) return; - QList > pathes = binded_widgets.values(w); - foreach (const PIDeque & path, pathes) - K[path].setValue(PIString::fromNumber(v)); - finishEdit(pathes); -} - - -void QCDCore::slotText(QString v) { - QWidget * w = (QWidget*)sender(); - if (!w || updating) return; - QList > pathes = binded_widgets.values(w); - foreach (const PIDeque & path, pathes) - K[path].setValue(Q2PIString(v)); - finishEdit(pathes); -} - - -void QCDCore::slotVariant(QVariant v) { - QWidget * w = (QWidget*)sender(); - if (!w || updating) return; - QList > pathes = binded_widgets.values(w); - foreach (const PIDeque & path, pathes) - K[path].setVariantValue(Q2PIVariant(v)); - finishEdit(pathes); -} - - -void QCDCore::slotDestroyed(QObject * o) { - if (!o) return; - if (!binded_widgets.contains((QWidget*)o)) return; - binded_widgets.remove((QWidget*)o); -} - - -int QCDCore::bindWindow(QWidget * wnd) { - if (!wnd) return 0; - //K.root().makePath(); - return bindWidgets(wnd->findChildren()); -} - - -int QCDCore::bindWidgets(QList wl) { - int ret = 0; - foreach (QWidget * w, wl) - if (bindWidget(w)) ++ret; - return ret; -} - - -bool QCDCore::bindWidget(QWidget * w) { - if (!w) return false; - QString on = w->objectName(); - QString cn = w->metaObject()->className(); - if (cn == "CDView") { - bindView(w); - return false; - } - PIVector ak = K.root().children(); - piForeachC (CDType * k, ak) { - if (!on.endsWith(PI2QString(k->pathString().join("_")))) continue; - if (bindWidget(w, *k)) return true; - } - return false; -} - - -bool QCDCore::bindWidget(QWidget * w, const CDType & k) { - if (!w) return false; - //piCout << "bind..." << k.name() << k.path(); - QString cn = w->metaObject()->className(); - bool ok = false; - if (cn == "QCheckBox" || cn == "QGroupBox") { - connect(w, SIGNAL(toggled(bool)), this, SLOT(slotBool(bool)), Qt::UniqueConnection); - ok = true; - } - if (cn == "QSpinBox" || cn == "QSlider" || cn == "QScrollBar") { - connect(w, SIGNAL(valueChanged(int)), this, SLOT(slotInt(int)), Qt::UniqueConnection); - ok = true; - } - if (cn == "QDoubleSpinBox" || cn == "SpinSlider" || cn == "EvalSpinBox") { - connect(w, SIGNAL(valueChanged(double)), this, SLOT(slotDouble(double)), Qt::UniqueConnection); - ok = true; - } - if (cn == "QLineEdit" || cn == "CLineEdit") { - connect(w, SIGNAL(textChanged(QString)), this, SLOT(slotText(QString)), Qt::UniqueConnection); - ok = true; - } - if (cn == "QVariantEdit") { - connect(w, SIGNAL(valueChanged(QVariant)), this, SLOT(slotVariant(QVariant)), Qt::UniqueConnection); - ok = true; - } - if (cn == "CDView") { - bindView(w); - } - connect(w, SIGNAL(destroyed(QObject*)), this, SLOT(slotDestroyed(QObject*)), Qt::UniqueConnection); - setWidgetValue(w, k); - if (!ok) return false; - //piCout << k.name() << k.path() << "ok"; - binded_widgets.insert(w, k.path()); - return true; -} - - -void QCDCore::updateBindedWidgets() { - QMapIterator > it(binded_widgets); - QWidgetList to_remove; - updating = true; - while (it.hasNext()) { - QWidget * w = it.next().key(); - if (!K.exists(it.value())) - to_remove << w; - else - setWidgetValue(w, K[it.value()]); - } - foreach (QWidget * w, to_remove) - unbindWidget(w); - updating = false; -} - - -void QCDCore::bindView(QWidget * v) { - CDView * w = qobject_cast(v); - if (!w) return; - connect(this, SIGNAL(updateViewRequest()), w, SLOT(refreshValues()), Qt::UniqueConnection); -} - - -void QCDCore::setWidgetValue(QWidget * w, const CDType & k) { - if (!w) return; - QString cn = w->metaObject()->className(); - if (cn == "QCheckBox") qobject_cast(w)->setChecked(k.toBool()); - if (cn == "QGroupBox") qobject_cast(w)->setChecked(k.toBool()); - if (cn == "QSpinBox") qobject_cast(w)->setValue(k.toInt()); - if (cn == "QSlider") qobject_cast(w)->setValue(k.toInt()); - if (cn == "QScrollBar") qobject_cast(w)->setValue(k.toInt()); - if (cn == "QDoubleSpinBox") qobject_cast(w)->setValue(k.toDouble()); - if (cn == "SpinSlider") qobject_cast(w)->setValue(k.toDouble()); - if (cn == "QLineEdit") qobject_cast(w)->setText(PI2QString(k.value())); - if (cn == "CLineEdit") qobject_cast(w)->setText(PI2QString(k.value())); - if (cn == "EvalSpinBox") qobject_cast(w)->setValue(k.toDouble()); - if (cn == "QVariantEdit") qobject_cast(w)->setValue(PI2QVariant(k.variantValue())); -} - - -void QCDCore::finishEdit(const QList > & pathes) { - K.calculate(); - if (direct_on) { - foreach (const PIDeque & path, pathes) - K.directChange(K[path]); - } - emit updateViewRequest(); -} - - -int QCDCore::unbindWindow(QWidget * wnd) { - if (!wnd) return 0; - return unbindWidgets(wnd->findChildren()); -} - - -int QCDCore::unbindWidgets(QList wl) { - int ret = 0; - foreach (QWidget * w, wl) - if (unbindWidget(w)) ++ret; - return ret; -} - - -bool QCDCore::unbindWidget(QWidget * w) { - if (!w) return false; - //qDebug() << "unbind" << w; - if (!binded_widgets.contains(w)) return false; - QString cn = w->metaObject()->className(); - if (cn == "QCheckBox" || cn == "QGroupBox") - disconnect(w, SIGNAL(toggled(bool)), this, SLOT(slotBool(bool))); - if (cn == "QSpinBox" || cn == "QSlider" || cn == "QScrollBar") - disconnect(w, SIGNAL(valueChanged(int)), this, SLOT(slotInt(int))); - if (cn == "QDoubleSpinBox" || cn == "SpinSlider" || cn == "EvalSpinBox") - disconnect(w, SIGNAL(valueChanged(double)), this, SLOT(slotDouble(double))); - if (cn == "QLineEdit" || cn == "CLineEdit") - disconnect(w, SIGNAL(textChanged(QString)), this, SLOT(slotText(QString))); - if (cn == "QVariantEdit") - disconnect(w, SIGNAL(valueChanged(QVariant)), this, SLOT(slotVariant(QVariant))); - //qDebug() << "remove b" << binded_widgets.size(); - binded_widgets.remove(w); - //qDebug() << "remove a" << binded_widgets.size(); - return true; -} - - -void QCDCore::unbindAllWidgets() { - QMap > bwm = binded_widgets; - QMapIterator > it(bwm); - while (it.hasNext()) { - QWidget * w = it.next().key(); - unbindWidget(w); - } - binded_widgets.clear(); -} - - -void QCDCore::updateBindedWidget(const CDType & k_) { - QMapIterator > it(binded_widgets); - updating = true; - while (it.hasNext()) { - QWidget * w = it.next().key(); - const CDType & k(K[it.value()]); - if (k.path() != k_.path()) continue; - setWidgetValue(w, k); - } - updating = false; -} +#include "qcd_core.h" +#include "cdutils_k.h" +#include "cdutils_core.h" +#include "piqt.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace CDUtils; + + +int __QCore_Initializer__::count_(0); +QCDCore * __QCore_Initializer__::__instance__(0); + + +__QCore_Initializer__::__QCore_Initializer__() { + count_++; + if (count_ > 1) return; + __instance__ = new QCDCore(); +} + + +__QCore_Initializer__::~__QCore_Initializer__() { + count_--; + if (count_ > 0) return; + if (__instance__ != 0) { + delete __instance__; + __instance__ = 0; + } +} + + + + +QCDCore::QCDCore() { + setObjectName("QCDCore"); + setName("QCDCore"); + CONNECTU(&K, changedGlobal, this, K_ChangedGlobal); + updating = direct_on = false; +} + + +QCDCore::~QCDCore() { +} + + +void QCDCore::K_ChangedGlobal() { + QMetaObject::invokeMethod(this, "updateBindedWidgets", Qt::QueuedConnection); +} + + +void QCDCore::slotBool(bool v) { + QWidget * w = (QWidget*)sender(); + if (!w || updating) return; + QList > pathes = binded_widgets.values(w); + foreach (const PIDeque & path, pathes) + K[path].setValue(PIString::fromBool(v)); + K.calculate(); + emit updateViewRequest(); +} + + +void QCDCore::slotInt(int v) { + QWidget * w = (QWidget*)sender(); + if (!w || updating) return; + QList > pathes = binded_widgets.values(w); + foreach (const PIDeque & path, pathes) + K[path].setValue(PIString::fromNumber(v)); + finishEdit(pathes); +} + + +void QCDCore::slotDouble(double v) { + QWidget * w = (QWidget*)sender(); + if (!w || updating) return; + QList > pathes = binded_widgets.values(w); + foreach (const PIDeque & path, pathes) + K[path].setValue(PIString::fromNumber(v)); + finishEdit(pathes); +} + + +void QCDCore::slotText(QString v) { + QWidget * w = (QWidget*)sender(); + if (!w || updating) return; + QList > pathes = binded_widgets.values(w); + foreach (const PIDeque & path, pathes) + K[path].setValue(Q2PIString(v)); + finishEdit(pathes); +} + + +void QCDCore::slotVariant(QVariant v) { + QWidget * w = (QWidget*)sender(); + if (!w || updating) return; + QList > pathes = binded_widgets.values(w); + foreach (const PIDeque & path, pathes) + K[path].setVariantValue(Q2PIVariant(v)); + finishEdit(pathes); +} + + +void QCDCore::slotDestroyed(QObject * o) { + if (!o) return; + if (!binded_widgets.contains((QWidget*)o)) return; + binded_widgets.remove((QWidget*)o); +} + + +int QCDCore::bindWindow(QWidget * wnd) { + if (!wnd) return 0; + //K.root().makePath(); + return bindWidgets(wnd->findChildren()); +} + + +int QCDCore::bindWidgets(QList wl) { + int ret = 0; + foreach (QWidget * w, wl) + if (bindWidget(w)) ++ret; + return ret; +} + + +bool QCDCore::bindWidget(QWidget * w) { + if (!w) return false; + QString on = w->objectName(); + QString cn = w->metaObject()->className(); + if (cn == "CDView") { + bindView(w); + return false; + } + PIVector ak = K.root().children(); + piForeachC (CDType * k, ak) { + if (!on.endsWith(PI2QString(k->pathString().join("_")))) continue; + if (bindWidget(w, *k)) return true; + } + return false; +} + + +bool QCDCore::bindWidget(QWidget * w, const CDType & k) { + if (!w) return false; + //piCout << "bind..." << k.name() << k.path(); + QString cn = w->metaObject()->className(); + bool ok = false; + if (cn == "QCheckBox" || cn == "QGroupBox") { + connect(w, SIGNAL(toggled(bool)), this, SLOT(slotBool(bool)), Qt::UniqueConnection); + ok = true; + } + if (cn == "QSpinBox" || cn == "QSlider" || cn == "QScrollBar") { + connect(w, SIGNAL(valueChanged(int)), this, SLOT(slotInt(int)), Qt::UniqueConnection); + ok = true; + } + if (cn == "QDoubleSpinBox" || cn == "SpinSlider" || cn == "EvalSpinBox") { + connect(w, SIGNAL(valueChanged(double)), this, SLOT(slotDouble(double)), Qt::UniqueConnection); + ok = true; + } + if (cn == "QLineEdit" || cn == "CLineEdit") { + connect(w, SIGNAL(textChanged(QString)), this, SLOT(slotText(QString)), Qt::UniqueConnection); + ok = true; + } + if (cn == "QVariantEdit") { + connect(w, SIGNAL(valueChanged(QVariant)), this, SLOT(slotVariant(QVariant)), Qt::UniqueConnection); + ok = true; + } + if (cn == "CDView") { + bindView(w); + } + connect(w, SIGNAL(destroyed(QObject*)), this, SLOT(slotDestroyed(QObject*)), Qt::UniqueConnection); + setWidgetValue(w, k); + if (!ok) return false; + //piCout << k.name() << k.path() << "ok"; + binded_widgets.insert(w, k.path()); + return true; +} + + +void QCDCore::updateBindedWidgets() { + QMapIterator > it(binded_widgets); + QWidgetList to_remove; + updating = true; + while (it.hasNext()) { + QWidget * w = it.next().key(); + if (!K.exists(it.value())) + to_remove << w; + else + setWidgetValue(w, K[it.value()]); + } + foreach (QWidget * w, to_remove) + unbindWidget(w); + updating = false; +} + + +void QCDCore::bindView(QWidget * v) { + CDView * w = qobject_cast(v); + if (!w) return; + connect(this, SIGNAL(updateViewRequest()), w, SLOT(refreshValues()), Qt::UniqueConnection); +} + + +void QCDCore::setWidgetValue(QWidget * w, const CDType & k) { + if (!w) return; + QString cn = w->metaObject()->className(); + if (cn == "QCheckBox") qobject_cast(w)->setChecked(k.toBool()); + if (cn == "QGroupBox") qobject_cast(w)->setChecked(k.toBool()); + if (cn == "QSpinBox") qobject_cast(w)->setValue(k.toInt()); + if (cn == "QSlider") qobject_cast(w)->setValue(k.toInt()); + if (cn == "QScrollBar") qobject_cast(w)->setValue(k.toInt()); + if (cn == "QDoubleSpinBox") qobject_cast(w)->setValue(k.toDouble()); + if (cn == "SpinSlider") qobject_cast(w)->setValue(k.toDouble()); + if (cn == "QLineEdit") qobject_cast(w)->setText(PI2QString(k.value())); + if (cn == "CLineEdit") qobject_cast(w)->setText(PI2QString(k.value())); + if (cn == "EvalSpinBox") qobject_cast(w)->setValue(k.toDouble()); + if (cn == "QVariantEdit") qobject_cast(w)->setValue(PI2QVariant(k.variantValue())); +} + + +void QCDCore::finishEdit(const QList > & pathes) { + K.calculate(); + if (direct_on) { + foreach (const PIDeque & path, pathes) + K.directChange(K[path]); + } + emit updateViewRequest(); +} + + +int QCDCore::unbindWindow(QWidget * wnd) { + if (!wnd) return 0; + return unbindWidgets(wnd->findChildren()); +} + + +int QCDCore::unbindWidgets(QList wl) { + int ret = 0; + foreach (QWidget * w, wl) + if (unbindWidget(w)) ++ret; + return ret; +} + + +bool QCDCore::unbindWidget(QWidget * w) { + if (!w) return false; + //qDebug() << "unbind" << w; + if (!binded_widgets.contains(w)) return false; + QString cn = w->metaObject()->className(); + if (cn == "QCheckBox" || cn == "QGroupBox") + disconnect(w, SIGNAL(toggled(bool)), this, SLOT(slotBool(bool))); + if (cn == "QSpinBox" || cn == "QSlider" || cn == "QScrollBar") + disconnect(w, SIGNAL(valueChanged(int)), this, SLOT(slotInt(int))); + if (cn == "QDoubleSpinBox" || cn == "SpinSlider" || cn == "EvalSpinBox") + disconnect(w, SIGNAL(valueChanged(double)), this, SLOT(slotDouble(double))); + if (cn == "QLineEdit" || cn == "CLineEdit") + disconnect(w, SIGNAL(textChanged(QString)), this, SLOT(slotText(QString))); + if (cn == "QVariantEdit") + disconnect(w, SIGNAL(valueChanged(QVariant)), this, SLOT(slotVariant(QVariant))); + //qDebug() << "remove b" << binded_widgets.size(); + binded_widgets.remove(w); + //qDebug() << "remove a" << binded_widgets.size(); + return true; +} + + +void QCDCore::unbindAllWidgets() { + QMap > bwm = binded_widgets; + QMapIterator > it(bwm); + while (it.hasNext()) { + QWidget * w = it.next().key(); + unbindWidget(w); + } + binded_widgets.clear(); +} + + +void QCDCore::updateBindedWidget(const CDType & k_) { + QMapIterator > it(binded_widgets); + updating = true; + while (it.hasNext()) { + QWidget * w = it.next().key(); + const CDType & k(K[it.value()]); + if (k.path() != k_.path()) continue; + setWidgetValue(w, k); + } + updating = false; +} diff --git a/qcd_utils/qcd_core.h b/piqt/libs/qcd/qcd_core.h similarity index 93% rename from qcd_utils/qcd_core.h rename to piqt/libs/qcd/qcd_core.h index 01a8b0f..64695ff 100644 --- a/qcd_utils/qcd_core.h +++ b/piqt/libs/qcd/qcd_core.h @@ -1,96 +1,97 @@ -/* - QCD Utils - Qt bindings/utilites for CD Utils - - Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#ifndef QCD_CORE_H -#define QCD_CORE_H - -#include -#include -#include -#include "piobject.h" -#include "cdutils_types.h" - - -class QCDCore; - - -class __QCore_Initializer__ { -public: - __QCore_Initializer__(); - ~__QCore_Initializer__(); - static int count_; - static QCDCore * __instance__; -}; - - -class QCDCore: public QObject, public PIObject -{ - Q_OBJECT - PIOBJECT(QCDCore) - friend class __QCore_Initializer__; -public: - static QCDCore * instance() {return __QCore_Initializer__::__instance__;} - - int bindWindow(QWidget * wnd); - int bindWidgets(QList wl); - bool bindWidget(QWidget * w); - bool bindWidget(QWidget * w, const CDUtils::CDType & k); - - int unbindWindow(QWidget * wnd); - int unbindWidgets(QList wl); - bool unbindWidget(QWidget * w); - void unbindAllWidgets(); - - void updateBindedWidget(const CDUtils::CDType & k_); - void setDirectKEnabled(bool yes) {direct_on = yes;} - bool isDirectKEnabled() const {return direct_on;} - -private: - QCDCore(); - ~QCDCore(); - - void bindView(QWidget * v); - void setWidgetValue(QWidget * w, const CDUtils::CDType & k); - void finishEdit(const QList > & pathes); - EVENT_HANDLER(void, K_ChangedGlobal); - - QMultiMap > binded_widgets; - bool updating, direct_on; - -private slots: - void slotBool(bool v); - void slotInt(int v); - void slotDouble(double v); - void slotText(QString v); - void slotVariant(QVariant v); - void slotDestroyed(QObject * ); - -public slots: - void updateBindedWidgets(); - -signals: - void updateViewRequest(); - -}; - - -static __QCore_Initializer__ __QCore_initializer__; - - -#endif // QCD_CORE_H +/* + QCD Utils - Qt bindings/utilites for CD Utils + + Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +#ifndef QCD_CORE_H +#define QCD_CORE_H + +#include +#include +#include +#include "piobject.h" +#include "cdutils_types.h" +#include "qcd_utils_export.h" + + +class QCDCore; + + +class QCD_UTILS_EXPORT __QCore_Initializer__ { +public: + __QCore_Initializer__(); + ~__QCore_Initializer__(); + static int count_; + static QCDCore * __instance__; +}; + + +class QCD_UTILS_EXPORT QCDCore: public QObject, public PIObject +{ + Q_OBJECT + PIOBJECT(QCDCore) + friend class __QCore_Initializer__; +public: + static QCDCore * instance() {return __QCore_Initializer__::__instance__;} + + int bindWindow(QWidget * wnd); + int bindWidgets(QList wl); + bool bindWidget(QWidget * w); + bool bindWidget(QWidget * w, const CDUtils::CDType & k); + + int unbindWindow(QWidget * wnd); + int unbindWidgets(QList wl); + bool unbindWidget(QWidget * w); + void unbindAllWidgets(); + + void updateBindedWidget(const CDUtils::CDType & k_); + void setDirectKEnabled(bool yes) {direct_on = yes;} + bool isDirectKEnabled() const {return direct_on;} + +private: + QCDCore(); + ~QCDCore(); + + void bindView(QWidget * v); + void setWidgetValue(QWidget * w, const CDUtils::CDType & k); + void finishEdit(const QList > & pathes); + EVENT_HANDLER(void, K_ChangedGlobal); + + QMultiMap > binded_widgets; + bool updating, direct_on; + +private slots: + void slotBool(bool v); + void slotInt(int v); + void slotDouble(double v); + void slotText(QString v); + void slotVariant(QVariant v); + void slotDestroyed(QObject * ); + +public slots: + void updateBindedWidgets(); + +signals: + void updateViewRequest(); + +}; + + +static __QCore_Initializer__ __QCore_initializer__; + + +#endif // QCD_CORE_H diff --git a/qcd_utils/qcd_graphic.cpp b/piqt/libs/qcd/qcd_graphic.cpp similarity index 94% rename from qcd_utils/qcd_graphic.cpp rename to piqt/libs/qcd/qcd_graphic.cpp index 5eac6f6..c53a9ae 100644 --- a/qcd_utils/qcd_graphic.cpp +++ b/piqt/libs/qcd/qcd_graphic.cpp @@ -1,40 +1,40 @@ -#include "qcd_graphic.h" -#include "ui_qcd_graphic.h" -#include "cdutils_core.h" -#include "cdutils_x.h" -#include "graphic.h" -#include "piqt.h" - -using namespace CDUtils; - - -CDGraphicWidget::CDGraphicWidget(QWidget * p): QWidget(p) { - ui = new Ui::CDGraphicWidget(); - ui->setupUi(this); - ui->graphic->setGraphicsCount(0); -} - - -Graphic * CDGraphicWidget::graphic() const { - return ui->graphic; -} - - -void CDGraphicWidget::setConfigVisible(bool on) { - ui->widgetConfig->setVisible(on); -} - - -bool CDGraphicWidget::isConfigVisible() const { - return ui->widgetConfig->isVisible(); -} - - -EvalSpinBox * CDGraphicWidget::evalSpinBoxHistory() { - return ui->evalHistory; -} - - -EvalSpinBox * CDGraphicWidget::evalSpinBoxVisible() { - return ui->evalVisible; -} +#include "qcd_graphic.h" +#include "ui_qcd_graphic.h" +#include "cdutils_core.h" +#include "cdutils_x.h" +#include "graphic.h" +#include "piqt.h" + +using namespace CDUtils; + + +CDGraphicWidget::CDGraphicWidget(QWidget * p): QWidget(p) { + ui = new Ui::CDGraphicWidget(); + ui->setupUi(this); + ui->graphic->setGraphicsCount(0); +} + + +Graphic * CDGraphicWidget::graphic() const { + return ui->graphic; +} + + +void CDGraphicWidget::setConfigVisible(bool on) { + ui->widgetConfig->setVisible(on); +} + + +bool CDGraphicWidget::isConfigVisible() const { + return ui->widgetConfig->isVisible(); +} + + +EvalSpinBox * CDGraphicWidget::evalSpinBoxHistory() { + return ui->evalHistory; +} + + +EvalSpinBox * CDGraphicWidget::evalSpinBoxVisible() { + return ui->evalVisible; +} diff --git a/qcd_utils/qcd_graphic.h b/piqt/libs/qcd/qcd_graphic.h similarity index 92% rename from qcd_utils/qcd_graphic.h rename to piqt/libs/qcd/qcd_graphic.h index 45529b4..68b7fd8 100644 --- a/qcd_utils/qcd_graphic.h +++ b/piqt/libs/qcd/qcd_graphic.h @@ -1,66 +1,67 @@ -/* - QCD Utils - Qt bindings/utilites for CD Utils - - Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#ifndef QCD_GRAPHIC_H -#define QCD_GRAPHIC_H - -#include -#include -#include - -namespace CDUtils { - class CDType; - class CDSection; -} - -namespace Ui { - class CDGraphicWidget; -} - -class Graphic; -class Graphic; - - -class CDGraphicWidget: public QWidget { - Q_OBJECT - friend class CDGraphics; - friend class GDockWidget; -public: - CDGraphicWidget(QWidget * p = 0); - - Graphic * graphic() const; - bool isConfigVisible() const; - - EvalSpinBox * evalSpinBoxHistory(); - EvalSpinBox * evalSpinBoxVisible(); - -public slots: - void setConfigVisible(bool on); - -private: - Ui::CDGraphicWidget * ui; - -private slots: - -signals: - -}; - - -#endif // QCD_GRAPHIC_H +/* + QCD Utils - Qt bindings/utilites for CD Utils + + Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +#ifndef QCD_GRAPHIC_H +#define QCD_GRAPHIC_H + +#include +#include +#include +#include "qcd_utils_export.h" + +namespace CDUtils { + class CDType; + class CDSection; +} + +namespace Ui { + class CDGraphicWidget; +} + +class Graphic; +class Graphic; + + +class QCD_UTILS_EXPORT CDGraphicWidget: public QWidget { + Q_OBJECT + friend class CDGraphics; + friend class GDockWidget; +public: + CDGraphicWidget(QWidget * p = 0); + + Graphic * graphic() const; + bool isConfigVisible() const; + + EvalSpinBox * evalSpinBoxHistory(); + EvalSpinBox * evalSpinBoxVisible(); + +public slots: + void setConfigVisible(bool on); + +private: + Ui::CDGraphicWidget * ui; + +private slots: + +signals: + +}; + + +#endif // QCD_GRAPHIC_H diff --git a/qcd_utils/qcd_graphic.ui b/piqt/libs/qcd/qcd_graphic.ui similarity index 96% rename from qcd_utils/qcd_graphic.ui rename to piqt/libs/qcd/qcd_graphic.ui index 511ed61..f08198f 100644 --- a/qcd_utils/qcd_graphic.ui +++ b/piqt/libs/qcd/qcd_graphic.ui @@ -1,169 +1,169 @@ - - - CDGraphicWidget - - - - 0 - 0 - 470 - 380 - - - - CD Pult - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Graphic::Autofit|Graphic::BorderInputs|Graphic::Clear|Graphic::Configure|Graphic::CursorAxis|Graphic::Fullscreen|Graphic::Legend|Graphic::OnlyExpandY|Graphic::Pause|Graphic::Save - - - false - - - false - - - 100.000000000000000 - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - History: - - - - - - - 100.000000000000000 - - - - - - - Qt::Horizontal - - - - 1 - 20 - - - - - - - - Visible: - - - - - - - -1.000000000000000 - - - - - - - Qt::Horizontal - - - - 1 - 20 - - - - - - - - - - - - Graphic - QFrame -
graphic.h
-
- - EvalSpinBox - QWidget -
evalspinbox.h
-
-
- - - - evalHistory - valueChanged(double) - graphic - setHistorySize(double) - - - 148 - 363 - - - 156 - 297 - - - - - evalVisible - valueChanged(double) - graphic - setMaxVisibleTime(double) - - - 345 - 361 - - - 342 - 337 - - - - -
+ + + CDGraphicWidget + + + + 0 + 0 + 470 + 380 + + + + CD Pult + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Graphic::Autofit|Graphic::BorderInputs|Graphic::Clear|Graphic::Configure|Graphic::CursorAxis|Graphic::Fullscreen|Graphic::Legend|Graphic::OnlyExpandY|Graphic::Pause|Graphic::Save + + + false + + + false + + + 100.000000000000000 + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + History: + + + + + + + 100.000000000000000 + + + + + + + Qt::Horizontal + + + + 1 + 20 + + + + + + + + Visible: + + + + + + + -1.000000000000000 + + + + + + + Qt::Horizontal + + + + 1 + 20 + + + + + + + + + + + + Graphic + QFrame +
graphic.h
+
+ + EvalSpinBox + QWidget +
evalspinbox.h
+
+
+ + + + evalHistory + valueChanged(double) + graphic + setHistorySize(double) + + + 148 + 363 + + + 156 + 297 + + + + + evalVisible + valueChanged(double) + graphic + setMaxVisibleTime(double) + + + 345 + 361 + + + 342 + 337 + + + + +
diff --git a/qcd_utils/qcd_modedialog.cpp b/piqt/libs/qcd/qcd_modedialog.cpp similarity index 95% rename from qcd_utils/qcd_modedialog.cpp rename to piqt/libs/qcd/qcd_modedialog.cpp index 9612588..c6e2bb6 100644 --- a/qcd_utils/qcd_modedialog.cpp +++ b/piqt/libs/qcd/qcd_modedialog.cpp @@ -1,46 +1,46 @@ -#include "qcd_modedialog.h" -#include "ui_qcd_modedialog.h" - - -QCDModeDialog::QCDModeDialog(QWidget * parent): QDialog(parent) { - ui = new Ui::QCDModeDialog(); - ui->setupUi(this); -} - - -QCDModeDialog::~QCDModeDialog() { - delete ui; -} - - -CDUtils::UpdateModeFlags QCDModeDialog::mode() const { - CDUtils::UpdateModeFlags ret = 0; - if (ui->checkSaveIndex->isChecked()) ret |= CDUtils::SaveByIndex; - if (ui->checkSaveName->isChecked()) ret |= CDUtils::SaveByName; - if (ui->checkMerge->isChecked()) ret |= CDUtils::Merge; - return ret; -} - - -void QCDModeDialog::changeEvent(QEvent *e) { - QDialog::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - ui->retranslateUi(this); - break; - default: - break; - } -} - - -void QCDModeDialog::on_checkSaveIndex_clicked(bool checked) { - if (!checked) return; - ui->checkSaveName->setChecked(false); -} - - -void QCDModeDialog::on_checkSaveName_clicked(bool checked) { - if (!checked) return; - ui->checkSaveIndex->setChecked(false); -} +#include "qcd_modedialog.h" +#include "ui_qcd_modedialog.h" + + +QCDModeDialog::QCDModeDialog(QWidget * parent): QDialog(parent) { + ui = new Ui::QCDModeDialog(); + ui->setupUi(this); +} + + +QCDModeDialog::~QCDModeDialog() { + delete ui; +} + + +CDUtils::UpdateModeFlags QCDModeDialog::mode() const { + CDUtils::UpdateModeFlags ret = 0; + if (ui->checkSaveIndex->isChecked()) ret |= CDUtils::SaveByIndex; + if (ui->checkSaveName->isChecked()) ret |= CDUtils::SaveByName; + if (ui->checkMerge->isChecked()) ret |= CDUtils::Merge; + return ret; +} + + +void QCDModeDialog::changeEvent(QEvent *e) { + QDialog::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} + + +void QCDModeDialog::on_checkSaveIndex_clicked(bool checked) { + if (!checked) return; + ui->checkSaveName->setChecked(false); +} + + +void QCDModeDialog::on_checkSaveName_clicked(bool checked) { + if (!checked) return; + ui->checkSaveIndex->setChecked(false); +} diff --git a/qcd_utils/qcd_modedialog.h b/piqt/libs/qcd/qcd_modedialog.h similarity index 93% rename from qcd_utils/qcd_modedialog.h rename to piqt/libs/qcd/qcd_modedialog.h index 5554d4d..dc57713 100644 --- a/qcd_utils/qcd_modedialog.h +++ b/piqt/libs/qcd/qcd_modedialog.h @@ -1,50 +1,51 @@ -/* - QCD Utils - Qt bindings/utilites for CD Utils - - Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#ifndef QCD_MODEDIALOG_H -#define QCD_MODEDIALOG_H - -#include -#include - -namespace Ui { - class QCDModeDialog; -} - -class QCDModeDialog: public QDialog -{ - Q_OBJECT -public: - explicit QCDModeDialog(QWidget * parent = 0); - ~QCDModeDialog(); - - CDUtils::UpdateModeFlags mode() const; - -protected: - void changeEvent(QEvent *e); - - Ui::QCDModeDialog * ui; - -private slots: - void on_checkSaveIndex_clicked(bool checked); - void on_checkSaveName_clicked(bool checked); - -}; - -#endif // QCD_MODEDIALOG_H +/* + QCD Utils - Qt bindings/utilites for CD Utils + + Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +#ifndef QCD_MODEDIALOG_H +#define QCD_MODEDIALOG_H + +#include +#include +#include "qcd_utils_export.h" + +namespace Ui { + class QCDModeDialog; +} + +class QCD_UTILS_EXPORT QCDModeDialog: public QDialog +{ + Q_OBJECT +public: + explicit QCDModeDialog(QWidget * parent = 0); + ~QCDModeDialog(); + + CDUtils::UpdateModeFlags mode() const; + +protected: + void changeEvent(QEvent *e); + + Ui::QCDModeDialog * ui; + +private slots: + void on_checkSaveIndex_clicked(bool checked); + void on_checkSaveName_clicked(bool checked); + +}; + +#endif // QCD_MODEDIALOG_H diff --git a/qcd_utils/qcd_modedialog.ui b/piqt/libs/qcd/qcd_modedialog.ui similarity index 95% rename from qcd_utils/qcd_modedialog.ui rename to piqt/libs/qcd/qcd_modedialog.ui index 0c3d1dd..38c2dff 100644 --- a/qcd_utils/qcd_modedialog.ui +++ b/piqt/libs/qcd/qcd_modedialog.ui @@ -1,98 +1,98 @@ - - - QCDModeDialog - - - - 0 - 0 - 251 - 152 - - - - Update description mode - - - - - - Save by index - - - - - - - Save by name - - - - - - - Merge - - - - - - - Qt::Vertical - - - - 20 - 1 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - QCDModeDialog - accept() - - - 106 - 131 - - - 101 - 146 - - - - - buttonBox - rejected() - QCDModeDialog - reject() - - - 182 - 127 - - - 169 - 146 - - - - - + + + QCDModeDialog + + + + 0 + 0 + 251 + 152 + + + + Update description mode + + + + + + Save by index + + + + + + + Save by name + + + + + + + Merge + + + + + + + Qt::Vertical + + + + 20 + 1 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + QCDModeDialog + accept() + + + 106 + 131 + + + 101 + 146 + + + + + buttonBox + rejected() + QCDModeDialog + reject() + + + 182 + 127 + + + 169 + 146 + + + + + diff --git a/qcd_utils/qcd_model.cpp b/piqt/libs/qcd/qcd_model.cpp similarity index 96% rename from qcd_utils/qcd_model.cpp rename to piqt/libs/qcd/qcd_model.cpp index 1f7fa32..2b1f203 100644 --- a/qcd_utils/qcd_model.cpp +++ b/piqt/libs/qcd/qcd_model.cpp @@ -1,460 +1,460 @@ -#include "qcd_model.h" -#include "cdutils_interface.h" -#include "cdutils_core.h" -#include "cdutils_x.h" -#include "piqt.h" -#include -#include -#include -#include -#include "qvariantedit.h" -#include "qad_types.h" - - -using namespace CDUtils; - -// CDKItem - -CDItem::CDItem(CDUtils::Interface * i, int _index, CDItem::CDItemType type, CDItem *parent) { - interface = i; - index_ = _index; - parent_ = parent; - type_ = type; - item_count = 0; - expanded = true; -} - - -CDItem::~CDItem() { - qDeleteAll(childs); -} - - -QVariant CDItem::data(int column, int role) const { - if (role == Qt::BackgroundRole) { - switch (type_) { - case ItemCDType: { - CDType & t(interface->section(buildPath())[index_]); - if (t.errorString().isEmpty()) return QBrush(QColor(255, 250, 230)); - else return QBrush(QColor(255, 128, 128)); - } - case ItemCDSection: return QBrush(QColor(230, 250, 230)); - } - } - if (role == Qt::CheckStateRole && type_ == ItemCDType) { - CDType & t(interface->section(buildPath())[index_]); - if (column == cValue && t.cd_type() == CDType::cdK) { - if (t.type() == "b") return t.toBool() ? Qt::Checked : Qt::Unchecked; - else QVariant(); - } - if (column == cName_Cmd && t.cd_type() == CDType::cdX) { - return t.isSelectedX() ? Qt::Checked : Qt::Unchecked; - } - } - if (role == Qt::ToolTipRole && type_ == ItemCDType) { - CDType & t(interface->section(buildPath())[index_]); - return PI2QString(t.errorString()); - } - if (role != Qt::DisplayRole && role != Qt::EditRole) return QVariant(); - PIDeque path = buildPath(); - CDSection & rs = interface->section(path); - CDSection s; - switch (type_) { - case ItemCDType: - switch (column) { - case cID: return QString::number(index_); - case cName_Cmd: return PI2QString(rs[index_].name()); - case cType: return stringType(rs[index_].type()); - case cXMode: return QVariant::fromValue(xModeEnum(rs[index_].xmode())); - case cXAvg: return rs[index_].avg(); - case cExpression: return PI2QString(rs[index_].formula()); - case cValue: return value(rs[index_], role); - case cComment: return PI2QString(rs[index_].comment()); - default: break; - } - break; - case ItemCDSection: - s = rs.section(index_); -// piCout << rs.name << rs.alias << s.name << s.alias; - switch (column) { - case cID: return QString("[") + QString::number(index_) + QString("]"); - case cName_Cmd: return PI2QString(s.alias); - case cType: return PI2QString(s.name); - default: break; - } - break; - } - return QVariant(); -} - - -QVariant CDItem::value(CDType & t, int role) const { - if (t.type() == "f") return t.toDouble(); - if (t.type() == "n") return t.toInt(); - if (t.type() == "b") return t.toBool(); - if (t.type() == "e") { - QAD::Enum et = PI2QADEnum(t.enumValues()); - et.selectValue(t.toInt()); - if (role == Qt::EditRole) return QVariant::fromValue(et); - else return et.selectedName(); - } - return PI2QString(t.value()); -} - - -bool CDItem::setData(int column, const QVariant & value) { - if (type_ == ItemCDType) { - CDType & t(interface->section(buildPath())[index_]); - if ((column == cExpression || column == cValue) && (t.cd_type() == CDType::cdK)) { - interface->section(buildPath())[index_].setValue(Q2PIString(value.toString())); - interface->calculate(); - return true; - } - if (t.cd_type() == CDType::cdX) { - switch (column) { - case cName_Cmd: - X.setEnabled(t, value.toBool()); - return true; - case cXMode: - t.setXMode((CDType::XMode)value.toInt()); - return true; - case cXAvg: - t.setAvg(piMax(value.toInt(), 1)); - return true; - default: break; - } - } - } - return false; -} - - -PIDeque CDItem::buildPath() const { - PIDeque path; - CDItem * p = parent_; - while (p) { - path.push_front(p->index_); - p = p->parent_; - } - path.take_front(); - return path; -} - - -QString CDItem::stringType(const PIString & t) const { - QString n = PI2QString(t); - if (n.isEmpty()) return QString(""); - switch (n[0].toLatin1()) { - case 'l': return QString("list"); break; - case 'b': return QString("bool"); break; - case 'n': return QString("int"); break; - case 'f': return QString("double"); break; - case 'c': return QString("color"); break; - case 'r': return QString("rect"); break; - case 'a': return QString("rect"); break; - case 'p': return QString("point"); break; - case 'v': return QString("vector"); break; - case 'i': return QString("IP"); break; - case 'e': return QString("enum"); break; - case 'F': return QString("file"); break; - case 'D': return QString("dir"); break; - } - return QString("string"); -} - - -QAD::Enum CDItem::xModeEnum(int v) const { - QAD::Enum ret; - ret << QAD::Enumerator(CDType::X_Current, "Current") - << QAD::Enumerator(CDType::X_All_Avg, "All, Averaging"); - ret.selectValue(v); - return ret; -} - - -// CDKDelegate - -CDDelegate::CDDelegate(QObject *parent) : QStyledItemDelegate(parent) { -} - - -void CDDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const { - CDItem * item = ((CDItemModel*)index.model())->getItem(index); - if (item) { - if (item->itemType() == CDItem::ItemCDType && item->interface->cdType() == CDType::cdC) { - QStyleOptionButton bo; - bo.direction = option.direction; - bo.fontMetrics = option.fontMetrics; - bo.palette = option.palette; - bo.rect = option.rect; - bo.state = option.state;// & ~(QStyle::State_HasFocus | QStyle::State_MouseOver); - bo.text = item->data(1, Qt::DisplayRole).toString(); - QWidget * v = (QWidget*)(painter->device()); - if (v) { - QPoint cp = v->mapFromGlobal(QCursor::pos()); - if (bo.rect.contains(cp, true)) { - //bo.state |= QStyle::State_MouseOver; - if (qApp->mouseButtons().testFlag(Qt::LeftButton)) - bo.state |= QStyle::State_On; - } - } - qApp->style()->drawControl(QStyle::CE_PushButton, &bo, painter); - return; - } - } - QStyledItemDelegate::paint(painter, option, index); - -} - - -QWidget * CDDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const { - return new QVariantEdit(parent); -} - - -void CDDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const { - QVariantEdit *edit = static_cast(editor); - edit->setValue(index.model()->data(index, Qt::EditRole)); -} - - -void CDDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { - QVariantEdit *edit = static_cast(editor); - QVariant v = edit->value(); - if (v.canConvert()) { - QAD::Enum et = v.value(); - model->setData(index, et.selectedValue(), Qt::EditRole); - } else model->setData(index, v, Qt::EditRole); -} - - -void CDDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const { - editor->setGeometry(option.rect); -} - - -QSize CDDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const { - QSize s = QStyledItemDelegate::sizeHint(option, index); - s.setWidth(s.width() + 20); - return s; -} - - -// CDItemModel - -CDItemModel::CDItemModel(int type_, QObject *parent) : QAbstractItemModel(parent) { - interface = new Interface((CDType::cdT)type_); - root = 0; - internalRebuild(); -} - - -CDItemModel::~CDItemModel() { - delete root; - delete interface; -} - - -QVariant CDItemModel::data(const QModelIndex &index, int role) const { - if (!index.isValid()) return QVariant(); - CDItem * item = getItem(index); - return item->data(index.column(), role); -} - - -QVariant CDItemModel::headerData(int section, Qt::Orientation orientation, int role) const { - if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { - switch (section) { - case cID: return tr("Index"); - case cName_Cmd: return interface->cdType() == CDType::cdC ? tr("Command") : tr("Name"); - case cType: return tr("Type"); - case cXMode: return tr("Mode"); - case cXAvg: return tr("Averaging"); - case cExpression: return tr("Expression"); - case cValue: return tr("Value"); - case cComment: return tr("Comment"); - } - } - return QVariant(); -} - - -QModelIndex CDItemModel::index(int row, int column, const QModelIndex &parent) const { - if (parent.isValid() && parent.column() != cID) return QModelIndex(); - CDItem * p = getItem(parent); - CDItem * c = p->childs.value(row, 0); - if (c) return createIndex(row, column, c); - else return QModelIndex(); -} - - -QModelIndex CDItemModel::parent(const QModelIndex &index) const { - if (!index.isValid()) return QModelIndex(); - CDItem * c = getItem(index); - CDItem * p = c->parent_; - if (p == root) return QModelIndex(); - return createIndex(p->parent_->childs.indexOf(p), cID, p); -} - - -int CDItemModel::rowCount(const QModelIndex &parent) const { - CDItem * p = getItem(parent); - return p->childs.count(); -} - - -int CDItemModel::columnCount(const QModelIndex &parent) const { - return cLastColumn; -} - - -Qt::ItemFlags CDItemModel::flags(const QModelIndex & index) const { - if (!index.isValid()) return 0; - Qt::ItemFlags f = Qt::ItemIsEnabled | Qt::ItemIsSelectable; - CDItem * item = getItem(index); - if (!item) return 0; - if (item->type_ == CDItem::ItemCDType) { - CDType & t(interface->section(item->buildPath())[item->index_]); - if (t.cd_type() == CDType::cdK) { - if (index.column() == cExpression || index.column() == cValue) - f |= Qt::ItemIsEditable; - if (index.column() == cValue && t.type() == "b") - f |= Qt::ItemIsUserCheckable; - if (index.column() == cName_Cmd) - f |= Qt::ItemIsDragEnabled; - } - if (t.cd_type() == CDType::cdX) { - if (index.column() == cXMode || index.column() == cXAvg) - f |= Qt::ItemIsEditable; - if (index.column() == cName_Cmd) - f |= Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled; - } - } - return f; -} - - -bool CDItemModel::setData(const QModelIndex & index, const QVariant & value, int role) { - if (role == Qt::CheckStateRole && (index.column() == cName_Cmd || index.column() == cValue)) { - CDItem * item = getItem(index); - if (item->type_ == CDItem::ItemCDType) { - CDType & t(interface->section(item->buildPath())[item->index_]); - if (index.column() == cValue && (t.cd_type() == CDType::cdK)) { - if (t.type() == "b") { - bool result = item->setData(index.column(), PI2QString(PIString::fromBool(value.toBool()))); - QModelIndex rin(CDItemModel::index(index.row(), cExpression, index.parent())); - emit dataChanged(rin, rin); - return result; - } - } - if (index.column() == cName_Cmd && (t.cd_type() == CDType::cdX)) { - bool result = item->setData(index.column(), value); - //QModelIndex rin(CDItemModel::index(index.row(), 1, index.parent())); - //emit dataChanged(rin, rin); - return result; - } - } - } - if (role != Qt::EditRole) return false; - CDItem * item = getItem(index); - bool result = item->setData(index.column(), value); - if (result) { - QModelIndex rin(CDItemModel::index(index.row(), cExpression, index.parent())); - emit dataChanged(rin, rin); - emit dataChanged(index, index); - } - return result; -} - - -QMimeData * CDItemModel::mimeData(const QModelIndexList & indexes) const { - if (indexes.size() == 1) { - QModelIndex index = indexes[0]; - if (index.isValid()/* && interface->cdType() == CDType::cdX*/) { - CDItem * item = getItem(index); - if (item) { - CDType & t(interface->section(item->buildPath())[item->index_]); - QMimeData * mime = new QMimeData(); - mime->setText(PI2QString(CDCore::instance()->typeLetter(interface->cdType()) + - CDCore::pathToString(t.path()))); - return mime; - } - } - } - return QAbstractItemModel::mimeData(indexes); -} - - -void CDItemModel::rebuildModel() { - beginResetModel(); - internalRebuild(); - endResetModel(); -} - - -void CDItemModel::buildItem(CDItem * it, CDSection & r) { - //piCout << "build item" << r.name << r.alias; - auto i = r.cd.makeIterator(); - while (i.next()) { - it->childs << new CDItem(interface, i.key(), CDItem::ItemCDType, it); - } - it->item_count = it->childs.size(); - auto j = r.s.makeIterator(); - while (j.next()) { - it->childs << new CDItem(interface, j.key(), CDItem::ItemCDSection, it); - buildItem(it->childs.back(), j.valueRef()); - } -} - - -void CDItemModel::updateModel() { - beginResetModel(); - endResetModel(); -} - - -void CDItemModel::internalRebuild() { - //qDebug() << "[CDKItemModel]" << "internalRebuild()"; - if (root) delete root; - root = new CDItem(interface, 0, CDItem::ItemCDSection, 0); - CDSection & r = interface->root(); - buildItem(root, r); -} - - -CDItem * CDItemModel::getItem(const QModelIndex &index) const { - if (index.isValid()) { - CDItem * item = static_cast(index.internalPointer()); - if (item) return item; - } - return root; -} - - -QModelIndex CDItemModel::indexByPath(const PIDeque & path, int column) const { - if (path.isEmpty()) return QModelIndex(); - CDItem * item = root; - //piCout << path << "..."; - bool ok = false; - for (int i = 0; i < path.size_s() - 1; ++i) { - ok = false; - foreach (CDItem * j, item->childs) - if (j->type_ == CDItem::ItemCDSection && j->index_ == path[i]) { - item = j; - ok = true; - break; - } - if (!ok) return QModelIndex(); - } - ok = false; - foreach (CDItem * j, item->childs) - if (j->type_ == CDItem::ItemCDType && j->index_ == path.back()) { - item = j; - ok = true; - break; - } - if (!ok || !item->parent_) return QModelIndex(); - QModelIndex ret = createIndex(item->parent_->childs.indexOf(item), column, item); - //piCout << path << Q2PIString(item->data(cName_Cmd, Qt::DisplayRole).toString()) << getItem(ret)->buildPath(); - return ret; -} +#include "qcd_model.h" +#include "cdutils_interface.h" +#include "cdutils_core.h" +#include "cdutils_x.h" +#include "piqt.h" +#include +#include +#include +#include +#include "qvariantedit.h" +#include "qad_types.h" + + +using namespace CDUtils; + +// CDKItem + +CDItem::CDItem(CDUtils::Interface * i, int _index, CDItem::CDItemType type, CDItem *parent) { + interface = i; + index_ = _index; + parent_ = parent; + type_ = type; + item_count = 0; + expanded = true; +} + + +CDItem::~CDItem() { + qDeleteAll(childs); +} + + +QVariant CDItem::data(int column, int role) const { + if (role == Qt::BackgroundRole) { + switch (type_) { + case ItemCDType: { + CDType & t(interface->section(buildPath())[index_]); + if (t.errorString().isEmpty()) return QBrush(QColor(255, 250, 230)); + else return QBrush(QColor(255, 128, 128)); + } + case ItemCDSection: return QBrush(QColor(230, 250, 230)); + } + } + if (role == Qt::CheckStateRole && type_ == ItemCDType) { + CDType & t(interface->section(buildPath())[index_]); + if (column == cValue && t.cd_type() == CDType::cdK) { + if (t.type() == "b") return t.toBool() ? Qt::Checked : Qt::Unchecked; + else QVariant(); + } + if (column == cName_Cmd && t.cd_type() == CDType::cdX) { + return t.isSelectedX() ? Qt::Checked : Qt::Unchecked; + } + } + if (role == Qt::ToolTipRole && type_ == ItemCDType) { + CDType & t(interface->section(buildPath())[index_]); + return PI2QString(t.errorString()); + } + if (role != Qt::DisplayRole && role != Qt::EditRole) return QVariant(); + PIDeque path = buildPath(); + CDSection & rs = interface->section(path); + CDSection s; + switch (type_) { + case ItemCDType: + switch (column) { + case cID: return QString::number(index_); + case cName_Cmd: return PI2QString(rs[index_].name()); + case cType: return stringType(rs[index_].type()); + case cXMode: return QVariant::fromValue(xModeEnum(rs[index_].xmode())); + case cXAvg: return rs[index_].avg(); + case cExpression: return PI2QString(rs[index_].formula()); + case cValue: return value(rs[index_], role); + case cComment: return PI2QString(rs[index_].comment()); + default: break; + } + break; + case ItemCDSection: + s = rs.section(index_); +// piCout << rs.name << rs.alias << s.name << s.alias; + switch (column) { + case cID: return QString("[") + QString::number(index_) + QString("]"); + case cName_Cmd: return PI2QString(s.alias); + case cType: return PI2QString(s.name); + default: break; + } + break; + } + return QVariant(); +} + + +QVariant CDItem::value(CDType & t, int role) const { + if (t.type() == "f") return t.toDouble(); + if (t.type() == "n") return t.toInt(); + if (t.type() == "b") return t.toBool(); + if (t.type() == "e") { + QAD::Enum et = PI2QADEnum(t.enumValues()); + et.selectValue(t.toInt()); + if (role == Qt::EditRole) return QVariant::fromValue(et); + else return et.selectedName(); + } + return PI2QString(t.value()); +} + + +bool CDItem::setData(int column, const QVariant & value) { + if (type_ == ItemCDType) { + CDType & t(interface->section(buildPath())[index_]); + if ((column == cExpression || column == cValue) && (t.cd_type() == CDType::cdK)) { + interface->section(buildPath())[index_].setValue(Q2PIString(value.toString())); + interface->calculate(); + return true; + } + if (t.cd_type() == CDType::cdX) { + switch (column) { + case cName_Cmd: + X.setEnabled(t, value.toBool()); + return true; + case cXMode: + t.setXMode((CDType::XMode)value.toInt()); + return true; + case cXAvg: + t.setAvg(piMax(value.toInt(), 1)); + return true; + default: break; + } + } + } + return false; +} + + +PIDeque CDItem::buildPath() const { + PIDeque path; + CDItem * p = parent_; + while (p) { + path.push_front(p->index_); + p = p->parent_; + } + path.take_front(); + return path; +} + + +QString CDItem::stringType(const PIString & t) const { + QString n = PI2QString(t); + if (n.isEmpty()) return QString(""); + switch (n[0].toLatin1()) { + case 'l': return QString("list"); break; + case 'b': return QString("bool"); break; + case 'n': return QString("int"); break; + case 'f': return QString("double"); break; + case 'c': return QString("color"); break; + case 'r': return QString("rect"); break; + case 'a': return QString("rect"); break; + case 'p': return QString("point"); break; + case 'v': return QString("vector"); break; + case 'i': return QString("IP"); break; + case 'e': return QString("enum"); break; + case 'F': return QString("file"); break; + case 'D': return QString("dir"); break; + } + return QString("string"); +} + + +QAD::Enum CDItem::xModeEnum(int v) const { + QAD::Enum ret; + ret << QAD::Enumerator(CDType::X_Current, "Current") + << QAD::Enumerator(CDType::X_All_Avg, "All, Averaging"); + ret.selectValue(v); + return ret; +} + + +// CDKDelegate + +CDDelegate::CDDelegate(QObject *parent) : QStyledItemDelegate(parent) { +} + + +void CDDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const { + CDItem * item = ((CDItemModel*)index.model())->getItem(index); + if (item) { + if (item->itemType() == CDItem::ItemCDType && item->interface->cdType() == CDType::cdC) { + QStyleOptionButton bo; + bo.direction = option.direction; + bo.fontMetrics = option.fontMetrics; + bo.palette = option.palette; + bo.rect = option.rect; + bo.state = option.state;// & ~(QStyle::State_HasFocus | QStyle::State_MouseOver); + bo.text = item->data(1, Qt::DisplayRole).toString(); + QWidget * v = (QWidget*)(painter->device()); + if (v) { + QPoint cp = v->mapFromGlobal(QCursor::pos()); + if (bo.rect.contains(cp, true)) { + //bo.state |= QStyle::State_MouseOver; + if (qApp->mouseButtons().testFlag(Qt::LeftButton)) + bo.state |= QStyle::State_On; + } + } + qApp->style()->drawControl(QStyle::CE_PushButton, &bo, painter); + return; + } + } + QStyledItemDelegate::paint(painter, option, index); + +} + + +QWidget * CDDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const { + return new QVariantEdit(parent); +} + + +void CDDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const { + QVariantEdit *edit = static_cast(editor); + edit->setValue(index.model()->data(index, Qt::EditRole)); +} + + +void CDDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { + QVariantEdit *edit = static_cast(editor); + QVariant v = edit->value(); + if (v.canConvert()) { + QAD::Enum et = v.value(); + model->setData(index, et.selectedValue(), Qt::EditRole); + } else model->setData(index, v, Qt::EditRole); +} + + +void CDDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const { + editor->setGeometry(option.rect); +} + + +QSize CDDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const { + QSize s = QStyledItemDelegate::sizeHint(option, index); + s.setWidth(s.width() + 20); + return s; +} + + +// CDItemModel + +CDItemModel::CDItemModel(int type_, QObject *parent) : QAbstractItemModel(parent) { + interface = new Interface((CDType::cdT)type_); + root = 0; + internalRebuild(); +} + + +CDItemModel::~CDItemModel() { + delete root; + delete interface; +} + + +QVariant CDItemModel::data(const QModelIndex &index, int role) const { + if (!index.isValid()) return QVariant(); + CDItem * item = getItem(index); + return item->data(index.column(), role); +} + + +QVariant CDItemModel::headerData(int section, Qt::Orientation orientation, int role) const { + if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { + switch (section) { + case cID: return tr("Index"); + case cName_Cmd: return interface->cdType() == CDType::cdC ? tr("Command") : tr("Name"); + case cType: return tr("Type"); + case cXMode: return tr("Mode"); + case cXAvg: return tr("Averaging"); + case cExpression: return tr("Expression"); + case cValue: return tr("Value"); + case cComment: return tr("Comment"); + } + } + return QVariant(); +} + + +QModelIndex CDItemModel::index(int row, int column, const QModelIndex &parent) const { + if (parent.isValid() && parent.column() != cID) return QModelIndex(); + CDItem * p = getItem(parent); + CDItem * c = p->childs.value(row, 0); + if (c) return createIndex(row, column, c); + else return QModelIndex(); +} + + +QModelIndex CDItemModel::parent(const QModelIndex &index) const { + if (!index.isValid()) return QModelIndex(); + CDItem * c = getItem(index); + CDItem * p = c->parent_; + if (p == root) return QModelIndex(); + return createIndex(p->parent_->childs.indexOf(p), cID, p); +} + + +int CDItemModel::rowCount(const QModelIndex &parent) const { + CDItem * p = getItem(parent); + return p->childs.count(); +} + + +int CDItemModel::columnCount(const QModelIndex &parent) const { + return cLastColumn; +} + + +Qt::ItemFlags CDItemModel::flags(const QModelIndex & index) const { + if (!index.isValid()) return Qt::ItemFlags(); + Qt::ItemFlags f = Qt::ItemIsEnabled | Qt::ItemIsSelectable; + CDItem * item = getItem(index); + if (!item) return Qt::ItemFlags(); + if (item->type_ == CDItem::ItemCDType) { + CDType & t(interface->section(item->buildPath())[item->index_]); + if (t.cd_type() == CDType::cdK) { + if (index.column() == cExpression || index.column() == cValue) + f |= Qt::ItemIsEditable; + if (index.column() == cValue && t.type() == "b") + f |= Qt::ItemIsUserCheckable; + if (index.column() == cName_Cmd) + f |= Qt::ItemIsDragEnabled; + } + if (t.cd_type() == CDType::cdX) { + if (index.column() == cXMode || index.column() == cXAvg) + f |= Qt::ItemIsEditable; + if (index.column() == cName_Cmd) + f |= Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled; + } + } + return f; +} + + +bool CDItemModel::setData(const QModelIndex & index, const QVariant & value, int role) { + if (role == Qt::CheckStateRole && (index.column() == cName_Cmd || index.column() == cValue)) { + CDItem * item = getItem(index); + if (item->type_ == CDItem::ItemCDType) { + CDType & t(interface->section(item->buildPath())[item->index_]); + if (index.column() == cValue && (t.cd_type() == CDType::cdK)) { + if (t.type() == "b") { + bool result = item->setData(index.column(), PI2QString(PIString::fromBool(value.toBool()))); + QModelIndex rin(CDItemModel::index(index.row(), cExpression, index.parent())); + emit dataChanged(rin, rin); + return result; + } + } + if (index.column() == cName_Cmd && (t.cd_type() == CDType::cdX)) { + bool result = item->setData(index.column(), value); + //QModelIndex rin(CDItemModel::index(index.row(), 1, index.parent())); + //emit dataChanged(rin, rin); + return result; + } + } + } + if (role != Qt::EditRole) return false; + CDItem * item = getItem(index); + bool result = item->setData(index.column(), value); + if (result) { + QModelIndex rin(CDItemModel::index(index.row(), cExpression, index.parent())); + emit dataChanged(rin, rin); + emit dataChanged(index, index); + } + return result; +} + + +QMimeData * CDItemModel::mimeData(const QModelIndexList & indexes) const { + if (indexes.size() == 1) { + QModelIndex index = indexes[0]; + if (index.isValid()/* && interface->cdType() == CDType::cdX*/) { + CDItem * item = getItem(index); + if (item) { + CDType & t(interface->section(item->buildPath())[item->index_]); + QMimeData * mime = new QMimeData(); + mime->setText(PI2QString(CDCore::instance()->typeLetter(interface->cdType()) + + CDCore::pathToString(t.path()))); + return mime; + } + } + } + return QAbstractItemModel::mimeData(indexes); +} + + +void CDItemModel::rebuildModel() { + beginResetModel(); + internalRebuild(); + endResetModel(); +} + + +void CDItemModel::buildItem(CDItem * it, CDSection & r) { + //piCout << "build item" << r.name << r.alias; + auto i = r.cd.makeIterator(); + while (i.next()) { + it->childs << new CDItem(interface, i.key(), CDItem::ItemCDType, it); + } + it->item_count = it->childs.size(); + auto j = r.s.makeIterator(); + while (j.next()) { + it->childs << new CDItem(interface, j.key(), CDItem::ItemCDSection, it); + buildItem(it->childs.back(), j.valueRef()); + } +} + + +void CDItemModel::updateModel() { + beginResetModel(); + endResetModel(); +} + + +void CDItemModel::internalRebuild() { + //qDebug() << "[CDKItemModel]" << "internalRebuild()"; + if (root) delete root; + root = new CDItem(interface, 0, CDItem::ItemCDSection, 0); + CDSection & r = interface->root(); + buildItem(root, r); +} + + +CDItem * CDItemModel::getItem(const QModelIndex &index) const { + if (index.isValid()) { + CDItem * item = static_cast(index.internalPointer()); + if (item) return item; + } + return root; +} + + +QModelIndex CDItemModel::indexByPath(const PIDeque & path, int column) const { + if (path.isEmpty()) return QModelIndex(); + CDItem * item = root; + //piCout << path << "..."; + bool ok = false; + for (int i = 0; i < path.size_s() - 1; ++i) { + ok = false; + foreach (CDItem * j, item->childs) + if (j->type_ == CDItem::ItemCDSection && j->index_ == path[i]) { + item = j; + ok = true; + break; + } + if (!ok) return QModelIndex(); + } + ok = false; + foreach (CDItem * j, item->childs) + if (j->type_ == CDItem::ItemCDType && j->index_ == path.back()) { + item = j; + ok = true; + break; + } + if (!ok || !item->parent_) return QModelIndex(); + QModelIndex ret = createIndex(item->parent_->childs.indexOf(item), column, item); + //piCout << path << Q2PIString(item->data(cName_Cmd, Qt::DisplayRole).toString()) << getItem(ret)->buildPath(); + return ret; +} diff --git a/qcd_utils/qcd_model.h b/piqt/libs/qcd/qcd_model.h similarity index 93% rename from qcd_utils/qcd_model.h rename to piqt/libs/qcd/qcd_model.h index bfc92da..506f0f0 100644 --- a/qcd_utils/qcd_model.h +++ b/piqt/libs/qcd/qcd_model.h @@ -1,132 +1,133 @@ -/* - QCD Utils - Qt bindings/utilites for CD Utils - - Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#ifndef QCD_MODEL_H -#define QCD_MODEL_H - -#include -#include -#include -#include "pistring.h" - -namespace CDUtils { - class CDType; - class CDSection; - class Interface; - - enum Column { - cID , - cName_Cmd , - cType , - cXMode , - cXAvg , - cExpression, - cValue , - cComment , - cLastColumn, - }; -} - -namespace QAD { - struct Enum; -} - -class CDItemModel; - - -class CDItem { - friend class CDItemModel; - friend class CDView; -public: - enum CDItemType{ItemCDType, ItemCDSection}; - CDItem(CDUtils::Interface * interface, int _index, CDItemType type, CDItem * parent); - ~CDItem(); - QVariant data(int column, int role) const; - QVariant value(CDUtils::CDType & t, int role) const; - bool setData(int column, const QVariant & value); - CDItemType itemType() const {return type_;} - PIDeque buildPath() const; - int index() const {return index_;} - - CDUtils::Interface * interface; - bool expanded; - -private: - QString stringType(const PIString & t) const; - QAD::Enum xModeEnum(int v) const; - - CDItem * parent_; - int index_, item_count; - CDItemType type_; - QList childs; -}; - - -class CDDelegate : public QStyledItemDelegate -{ - Q_OBJECT -public: - CDDelegate(QObject *parent = 0); - - void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const; - QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; - void setEditorData(QWidget *editor, const QModelIndex &index) const; - void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; - void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; - QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; - -}; - - -class CDItemModel : public QAbstractItemModel { - Q_OBJECT - friend class CDView; -public: - explicit CDItemModel(int type_, QObject *parent = 0); - ~CDItemModel(); - - QVariant data(const QModelIndex & index, int role) const; - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; - QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const; - QModelIndex parent(const QModelIndex &index) const; - int rowCount(const QModelIndex &parent = QModelIndex()) const; - int columnCount(const QModelIndex &parent = QModelIndex()) const; - Qt::ItemFlags flags(const QModelIndex &index) const; - bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); - QMimeData * mimeData(const QModelIndexList & indexes) const; - CDItem * getItem(const QModelIndex & index) const; - QModelIndex indexByPath(const PIDeque & path, int column = CDUtils::cID) const; - - void buildItem(CDItem * it, CDUtils::CDSection &r); - -public slots: - void rebuildModel(); - void updateModel(); - -private: - void internalRebuild(); - - CDUtils::Interface * interface; - CDItem * root; - -signals: - -}; - -#endif // QCD_MODEL_H +/* + QCD Utils - Qt bindings/utilites for CD Utils + + Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +#ifndef QCD_MODEL_H +#define QCD_MODEL_H + +#include +#include +#include +#include "pistring.h" +#include "qcd_utils_export.h" + +namespace CDUtils { + class CDType; + class CDSection; + class Interface; + + enum Column { + cID , + cName_Cmd , + cType , + cXMode , + cXAvg , + cExpression, + cValue , + cComment , + cLastColumn, + }; +} + +namespace QAD { + struct Enum; +} + +class CDItemModel; + + +class QCD_UTILS_EXPORT CDItem { + friend class CDItemModel; + friend class CDView; +public: + enum CDItemType{ItemCDType, ItemCDSection}; + CDItem(CDUtils::Interface * interface, int _index, CDItemType type, CDItem * parent); + ~CDItem(); + QVariant data(int column, int role) const; + QVariant value(CDUtils::CDType & t, int role) const; + bool setData(int column, const QVariant & value); + CDItemType itemType() const {return type_;} + PIDeque buildPath() const; + int index() const {return index_;} + + CDUtils::Interface * interface; + bool expanded; + +private: + QString stringType(const PIString & t) const; + QAD::Enum xModeEnum(int v) const; + + CDItem * parent_; + int index_, item_count; + CDItemType type_; + QList childs; +}; + + +class QCD_UTILS_EXPORT CDDelegate : public QStyledItemDelegate +{ + Q_OBJECT +public: + CDDelegate(QObject *parent = 0); + + void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const; + QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; + void setEditorData(QWidget *editor, const QModelIndex &index) const; + void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; + void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; + QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; + +}; + + +class QCD_UTILS_EXPORT CDItemModel : public QAbstractItemModel { + Q_OBJECT + friend class CDView; +public: + explicit CDItemModel(int type_, QObject *parent = 0); + ~CDItemModel(); + + QVariant data(const QModelIndex & index, int role) const; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const; + QModelIndex parent(const QModelIndex &index) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + Qt::ItemFlags flags(const QModelIndex &index) const; + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + QMimeData * mimeData(const QModelIndexList & indexes) const; + CDItem * getItem(const QModelIndex & index) const; + QModelIndex indexByPath(const PIDeque & path, int column = CDUtils::cID) const; + + void buildItem(CDItem * it, CDUtils::CDSection &r); + +public slots: + void rebuildModel(); + void updateModel(); + +private: + void internalRebuild(); + + CDUtils::Interface * interface; + CDItem * root; + +signals: + +}; + +#endif // QCD_MODEL_H diff --git a/qcd_utils/qcd_view.cpp b/piqt/libs/qcd/qcd_view.cpp similarity index 96% rename from qcd_utils/qcd_view.cpp rename to piqt/libs/qcd/qcd_view.cpp index 5ecea4c..619c46e 100644 --- a/qcd_utils/qcd_view.cpp +++ b/piqt/libs/qcd/qcd_view.cpp @@ -1,371 +1,371 @@ -#include -#include -#include -#include "cdutils_k.h" -#include "cdutils_x.h" -#include "cdutils_c.h" -#include "cdutils_m.h" -#include "cdutils_core.h" -#include "qcd_view.h" -#include "qcd_model.h" -#include "piqt.h" -#include "pifile.h" - -using namespace CDUtils; - - -CDView::CDView(QWidget * parent) : QTreeView(parent) { - type_ = -1; - model_ = 0; - proxy_ = 0; - connect(this, SIGNAL(clicked(QModelIndex)), this, SLOT(indexClicked(QModelIndex))); - connect(this, SIGNAL(_qcd_sendFailed()), this, SLOT(cd_sendFailed()), Qt::QueuedConnection); - connect(this, SIGNAL(_qcd_sendSucceed()), this, SLOT(cd_sendSucceed()), Qt::QueuedConnection); - connect(this, SIGNAL(_qcd_receiveFailed()), this, SLOT(cd_receiveFailed()), Qt::QueuedConnection); - connect(this, SIGNAL(_qcd_receiveSucceed()), this, SLOT(cd_receiveSucceed()), Qt::QueuedConnection); - connect(this, SIGNAL(_qcd_receivedX()), this, SLOT(cd_receivedX()), Qt::QueuedConnection); - connect(this, SIGNAL(_qcd_changedGlobal()), this, SLOT(cd_changedGlobal()), Qt::QueuedConnection); -} - - -CDView::~CDView() { - if (model_) { - delete model_; - delete proxy_; - } - model_ = 0; - proxy_ = 0; -} - - -void CDView::setType(int cdt) { - if (cdt < 0) return; - if (type_ >= 0) return; - type_ = cdt; - switch ((CDType::cdT)type_) { - case CDType::cdK: - CONNECTU(&K, sended, this, pi_cd_sendSucceed); - CONNECTU(&K, sendFailed, this, pi_cd_sendFailed); - CONNECTU(&K, received, this, pi_cd_receiveSucceed); - CONNECTU(&K, receiveFailed, this, pi_cd_receiveFailed); - CONNECTU(&K, changedGlobal, this, pi_cd_changedGlobal); - break; - case CDType::cdX: - CONNECTU(&X, sended, this, pi_cd_sendSucceed); - CONNECTU(&X, sendFailed, this, pi_cd_sendFailed); - CONNECTU(&X, received, this, pi_cd_receiveSucceed); - CONNECTU(&X, receiveFailed, this, pi_cd_receiveFailed); - CONNECTU(&X, receivedX, this, pi_cd_receivedX); - CONNECTU(&X, changedGlobal, this, pi_cd_changedGlobal); - break; - case CDType::cdC: - CONNECTU(&C, sended, this, pi_cd_sendSucceed); - CONNECTU(&C, sendFailed, this, pi_cd_sendFailed); - CONNECTU(&C, received, this, pi_cd_receiveSucceed); - CONNECTU(&C, receiveFailed, this, pi_cd_receiveFailed); - CONNECTU(&C, changedGlobal, this, pi_cd_changedGlobal); - break; - case CDType::cdM: - CONNECTU(&M, sended, this, pi_cd_sendSucceed); - CONNECTU(&M, sendFailed, this, pi_cd_sendFailed); - CONNECTU(&M, received, this, pi_cd_receiveSucceed); - CONNECTU(&M, receiveFailed, this, pi_cd_receiveFailed); - CONNECTU(&M, changedGlobal, this, pi_cd_changedGlobal); - CONNECTU(&M, messageReceived, this, pi_cd_messageReceived); - break; - default: break; - } - -} - - -void CDView::mousePressEvent(QMouseEvent * e) { - if (type_ == CDType::cdC) { - QModelIndex i = indexAt(e->pos()); - if (i.isValid() && i.column() == cName_Cmd) - update(i); - } - QTreeView::mousePressEvent(e); -} - - -void CDView::mouseReleaseEvent(QMouseEvent * e) { - if (type_ == CDType::cdC) { - QModelIndex i = indexAt(e->pos()); - if (i.isValid() && i.column() == cName_Cmd) - update(i); - } - QTreeView::mouseReleaseEvent(e); -} - - -void CDView::currentChanged(const QModelIndex & cur, const QModelIndex & prev) { - if (type_ == CDType::cdC) { - if (prev.isValid() && prev.column() == cName_Cmd) - update(prev); - } - QTreeView::currentChanged(cur, prev); -} - - -void CDView::refresh() { - if (type_ < 0) return; - if (!model_) { - model_ = new CDItemModel(type_); - proxy_ = new QSortFilterProxyModel(); -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) - proxy_->setRecursiveFilteringEnabled(true); -#endif - proxy_->setFilterKeyColumn(-1); - proxy_->setFilterCaseSensitivity(Qt::CaseInsensitive); - proxy_->setSourceModel(model_); - setModel(proxy_); - setItemDelegateForColumn(type_ == CDType::cdC ? cName_Cmd : cValue, new CDDelegate()); - if (type_ == CDType::cdX) - setItemDelegateForColumn(cXMode, new CDDelegate()); - } - model_->rebuildModel(); - switch ((CDType::cdT)type_) { - case CDType::cdK: - setColumnHidden(cXMode, true); - setColumnHidden(cXAvg, true); - break; - case CDType::cdX: - setColumnHidden(cExpression, true); - break; - case CDType::cdC: - case CDType::cdM: - setColumnHidden(cType, true); - setColumnHidden(cXMode, true); - setColumnHidden(cXAvg, true); - setColumnHidden(cExpression, true); - setColumnHidden(cValue, true); - break; - default: break; - } - expandAll(); - for (int i = 0; i < model_->columnCount(); i++) resizeColumnToContents(i); -} - - -void CDView::refreshValues() { - if (!model_) return; - model_->dataChanged(model_->index(0, 0), model_->index(model_->columnCount() - 1, model_->rowCount() - 1)); -} - - -void CDView::setFile(const QString & filename) { - switch ((CDType::cdT)type_) { - case CDType::cdK: K.setFileName(Q2PIString(filename)); break; - case CDType::cdX: X.setFileName(Q2PIString(filename)); break; - case CDType::cdC: C.setFileName(Q2PIString(filename)); break; - case CDType::cdM: M.setFileName(Q2PIString(filename)); break; - default: break; - } -} - - -bool CDView::inProgress() const { - switch ((CDType::cdT)type_) { - case CDType::cdK: return K.inProgress(); break; - case CDType::cdX: return X.inProgress(); break; - case CDType::cdC: return C.inProgress(); break; - case CDType::cdM: return M.inProgress(); break; - default: break; - } - return false; -} - - -void CDView::startX(double freq) { - switch ((CDType::cdT)type_) { - case CDType::cdX: X.start(freq); break; - default: break; - } -} - - -CDSection * CDView::root() { - return CDCore::instance()->root((CDType::cdT)type_); -} - - -QString CDView::typeLetter() const { - return PI2QString(CDCore::instance()->typeLetter((CDType::cdT)type_)); -} - - -void CDView::send() { - busyStatusChanged(true); - switch ((CDType::cdT)type_) { - case CDType::cdK: K.send(); break; - case CDType::cdX: X.send(); break; - case CDType::cdC: C.send(); break; - case CDType::cdM: M.send(); break; - default: break; - } -} - - -void CDView::receive() { - busyStatusChanged(true); - switch ((CDType::cdT)type_) { - case CDType::cdK: K.request(); break; - case CDType::cdX: X.request(); break; - case CDType::cdC: C.request(); break; - case CDType::cdM: M.request(); break; - default: break; - } -} - - -void CDView::save() { - switch ((CDType::cdT)type_) { - case CDType::cdK: K.writeFile(); break; - case CDType::cdX: X.writeFile(); break; - case CDType::cdC: C.writeFile(); break; - case CDType::cdM: M.writeFile(); break; - default: break; - } -} - - -void CDView::load() { - switch ((CDType::cdT)type_) { - case CDType::cdK: - K.readFile(); - K.calculate(); - break; - case CDType::cdX: - X.readFile(); - X.calculate(); - break; - case CDType::cdC: - C.readFile(); - C.calculate(); - break; - case CDType::cdM: - M.readFile(); - M.calculate(); - break; - default: break; - } - refresh(); -} - - -void CDView::clear() { - //piCout << "clearK"; - switch ((CDType::cdT)type_) { - case CDType::cdK: K.root() = CDSection(); break; - case CDType::cdX: X.root() = CDSection(); break; - case CDType::cdC: C.root() = CDSection(); break; - case CDType::cdM: M.root() = CDSection(); break; - default: break; - } - refresh(); -} - - -void CDView::buildFromHeader(const QString & description, int mode) { - if (description.isEmpty()) return; - PIString desc_file = Q2PIString(QDir::current().relativeFilePath(description)); - PIFile f(desc_file, PIIODevice::ReadOnly); - switch ((CDType::cdT)type_) { - case CDType::cdK: K.update(&f, mode); break; - case CDType::cdX: X.update(&f, mode); break; - case CDType::cdC: C.update(&f, mode); break; - case CDType::cdM: M.update(&f, mode); break; - default: break; - } - refresh(); -} - - -void CDView::calculate() { - switch ((CDType::cdT)type_) { - case CDType::cdK: K.calculate(); break; - case CDType::cdX: X.calculate(); break; - case CDType::cdC: C.calculate(); break; - case CDType::cdM: M.calculate(); break; - default: break; - } -} - - -void CDView::filter(const QString & f) { - proxy_->setFilterRegExp(QRegExp(f, Qt::CaseInsensitive)); -} - - -void CDView::indexClicked(const QModelIndex & i) { - if (!model_ || !i.isValid() || type_ != CDType::cdC || i.column() != cName_Cmd) return; - CDItem * item = model_->getItem(i); - if (!item) return; - if (item->itemType() != CDItem::ItemCDType) return; - CDType & t(model_->interface->section(item->buildPath())[item->index()]); - C.sendCommand(t); - emit commandSended(PI2QString(t.pathString().join("."))); - //piCout << t; - qDebug() << PI2QString(t.pathString().join(".")); -} - - -void CDView::cd_sendFailed() { - busyStatusChanged(false); - emit messageStatus("send failed"); - emit sendFailed(); -} - - -void CDView::cd_sendSucceed() { - busyStatusChanged(false); - emit messageStatus("send success"); - emit sendSucceed(); -} - - -void CDView::cd_receiveFailed() { - busyStatusChanged(false); - emit messageStatus("receive failed"); - emit receiveFailed(); -} - - -void CDView::cd_receiveSucceed() { - refresh(); - busyStatusChanged(false); - emit messageStatus("receive success"); - emit receiveSucceed(); -} - - -void CDView::cd_receivedX() { - X.lock(); - PIVector > xl = X.enabledList(); - //piCout << "X" << xl.size(); - piForeachC (PIDeque & x, xl) { - CDType & t(X[x]); - //piCout << t; - //piCout << t.path(); - if (t.cd_type() != CDType::cdX) continue; - update(model_->indexByPath(t.path(), cValue)); - //piCout << CDCore::pathToString(t.path()) << t.toDouble() << "model"; - //qDebug() << "val" << model_->data(model_->indexByPath(t.path(), cValue), Qt::DisplayRole).toDouble(); - } - X.unlock(); - emit receivedX(); -} - - -void CDView::cd_changedGlobal() { - emit changedGlobal(); -} - - -void CDView::pi_cd_messageReceived(PIDeque path, int type, PIString msg) { - QMetaObject::invokeMethod(this, "messageReceived", Qt::QueuedConnection, - Q_ARG(QString, PI2QString(CDCore::pathToString(path))), - Q_ARG(int, type), - Q_ARG(QString, PI2QString(msg))); -} +#include +#include +#include +#include "cdutils_k.h" +#include "cdutils_x.h" +#include "cdutils_c.h" +#include "cdutils_m.h" +#include "cdutils_core.h" +#include "qcd_view.h" +#include "qcd_model.h" +#include "piqt.h" +#include "pifile.h" + +using namespace CDUtils; + + +CDView::CDView(QWidget * parent) : QTreeView(parent) { + type_ = -1; + model_ = 0; + proxy_ = 0; + connect(this, SIGNAL(clicked(QModelIndex)), this, SLOT(indexClicked(QModelIndex))); + connect(this, SIGNAL(_qcd_sendFailed()), this, SLOT(cd_sendFailed()), Qt::QueuedConnection); + connect(this, SIGNAL(_qcd_sendSucceed()), this, SLOT(cd_sendSucceed()), Qt::QueuedConnection); + connect(this, SIGNAL(_qcd_receiveFailed()), this, SLOT(cd_receiveFailed()), Qt::QueuedConnection); + connect(this, SIGNAL(_qcd_receiveSucceed()), this, SLOT(cd_receiveSucceed()), Qt::QueuedConnection); + connect(this, SIGNAL(_qcd_receivedX()), this, SLOT(cd_receivedX()), Qt::QueuedConnection); + connect(this, SIGNAL(_qcd_changedGlobal()), this, SLOT(cd_changedGlobal()), Qt::QueuedConnection); +} + + +CDView::~CDView() { + if (model_) { + delete model_; + delete proxy_; + } + model_ = 0; + proxy_ = 0; +} + + +void CDView::setType(int cdt) { + if (cdt < 0) return; + if (type_ >= 0) return; + type_ = cdt; + switch ((CDType::cdT)type_) { + case CDType::cdK: + CONNECTU(&K, sended, this, pi_cd_sendSucceed); + CONNECTU(&K, sendFailed, this, pi_cd_sendFailed); + CONNECTU(&K, received, this, pi_cd_receiveSucceed); + CONNECTU(&K, receiveFailed, this, pi_cd_receiveFailed); + CONNECTU(&K, changedGlobal, this, pi_cd_changedGlobal); + break; + case CDType::cdX: + CONNECTU(&X, sended, this, pi_cd_sendSucceed); + CONNECTU(&X, sendFailed, this, pi_cd_sendFailed); + CONNECTU(&X, received, this, pi_cd_receiveSucceed); + CONNECTU(&X, receiveFailed, this, pi_cd_receiveFailed); + CONNECTU(&X, receivedX, this, pi_cd_receivedX); + CONNECTU(&X, changedGlobal, this, pi_cd_changedGlobal); + break; + case CDType::cdC: + CONNECTU(&C, sended, this, pi_cd_sendSucceed); + CONNECTU(&C, sendFailed, this, pi_cd_sendFailed); + CONNECTU(&C, received, this, pi_cd_receiveSucceed); + CONNECTU(&C, receiveFailed, this, pi_cd_receiveFailed); + CONNECTU(&C, changedGlobal, this, pi_cd_changedGlobal); + break; + case CDType::cdM: + CONNECTU(&M, sended, this, pi_cd_sendSucceed); + CONNECTU(&M, sendFailed, this, pi_cd_sendFailed); + CONNECTU(&M, received, this, pi_cd_receiveSucceed); + CONNECTU(&M, receiveFailed, this, pi_cd_receiveFailed); + CONNECTU(&M, changedGlobal, this, pi_cd_changedGlobal); + CONNECTU(&M, messageReceived, this, pi_cd_messageReceived); + break; + default: break; + } + +} + + +void CDView::mousePressEvent(QMouseEvent * e) { + if (type_ == CDType::cdC) { + QModelIndex i = indexAt(e->pos()); + if (i.isValid() && i.column() == cName_Cmd) + update(i); + } + QTreeView::mousePressEvent(e); +} + + +void CDView::mouseReleaseEvent(QMouseEvent * e) { + if (type_ == CDType::cdC) { + QModelIndex i = indexAt(e->pos()); + if (i.isValid() && i.column() == cName_Cmd) + update(i); + } + QTreeView::mouseReleaseEvent(e); +} + + +void CDView::currentChanged(const QModelIndex & cur, const QModelIndex & prev) { + if (type_ == CDType::cdC) { + if (prev.isValid() && prev.column() == cName_Cmd) + update(prev); + } + QTreeView::currentChanged(cur, prev); +} + + +void CDView::refresh() { + if (type_ < 0) return; + if (!model_) { + model_ = new CDItemModel(type_); + proxy_ = new QSortFilterProxyModel(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + proxy_->setRecursiveFilteringEnabled(true); +#endif + proxy_->setFilterKeyColumn(-1); + proxy_->setFilterCaseSensitivity(Qt::CaseInsensitive); + proxy_->setSourceModel(model_); + setModel(proxy_); + setItemDelegateForColumn(type_ == CDType::cdC ? cName_Cmd : cValue, new CDDelegate()); + if (type_ == CDType::cdX) + setItemDelegateForColumn(cXMode, new CDDelegate()); + } + model_->rebuildModel(); + switch ((CDType::cdT)type_) { + case CDType::cdK: + setColumnHidden(cXMode, true); + setColumnHidden(cXAvg, true); + break; + case CDType::cdX: + setColumnHidden(cExpression, true); + break; + case CDType::cdC: + case CDType::cdM: + setColumnHidden(cType, true); + setColumnHidden(cXMode, true); + setColumnHidden(cXAvg, true); + setColumnHidden(cExpression, true); + setColumnHidden(cValue, true); + break; + default: break; + } + expandAll(); + for (int i = 0; i < model_->columnCount(); i++) resizeColumnToContents(i); +} + + +void CDView::refreshValues() { + if (!model_) return; + model_->dataChanged(model_->index(0, 0), model_->index(model_->columnCount() - 1, model_->rowCount() - 1)); +} + + +void CDView::setFile(const QString & filename) { + switch ((CDType::cdT)type_) { + case CDType::cdK: K.setFileName(Q2PIString(filename)); break; + case CDType::cdX: X.setFileName(Q2PIString(filename)); break; + case CDType::cdC: C.setFileName(Q2PIString(filename)); break; + case CDType::cdM: M.setFileName(Q2PIString(filename)); break; + default: break; + } +} + + +bool CDView::inProgress() const { + switch ((CDType::cdT)type_) { + case CDType::cdK: return K.inProgress(); break; + case CDType::cdX: return X.inProgress(); break; + case CDType::cdC: return C.inProgress(); break; + case CDType::cdM: return M.inProgress(); break; + default: break; + } + return false; +} + + +void CDView::startX(double freq) { + switch ((CDType::cdT)type_) { + case CDType::cdX: X.start(freq); break; + default: break; + } +} + + +CDSection * CDView::root() { + return CDCore::instance()->root((CDType::cdT)type_); +} + + +QString CDView::typeLetter() const { + return PI2QString(CDCore::instance()->typeLetter((CDType::cdT)type_)); +} + + +void CDView::send() { + busyStatusChanged(true); + switch ((CDType::cdT)type_) { + case CDType::cdK: K.send(); break; + case CDType::cdX: X.send(); break; + case CDType::cdC: C.send(); break; + case CDType::cdM: M.send(); break; + default: break; + } +} + + +void CDView::receive() { + busyStatusChanged(true); + switch ((CDType::cdT)type_) { + case CDType::cdK: K.request(); break; + case CDType::cdX: X.request(); break; + case CDType::cdC: C.request(); break; + case CDType::cdM: M.request(); break; + default: break; + } +} + + +void CDView::save() { + switch ((CDType::cdT)type_) { + case CDType::cdK: K.writeFile(); break; + case CDType::cdX: X.writeFile(); break; + case CDType::cdC: C.writeFile(); break; + case CDType::cdM: M.writeFile(); break; + default: break; + } +} + + +void CDView::load() { + switch ((CDType::cdT)type_) { + case CDType::cdK: + K.readFile(); + K.calculate(); + break; + case CDType::cdX: + X.readFile(); + X.calculate(); + break; + case CDType::cdC: + C.readFile(); + C.calculate(); + break; + case CDType::cdM: + M.readFile(); + M.calculate(); + break; + default: break; + } + refresh(); +} + + +void CDView::clear() { + //piCout << "clearK"; + switch ((CDType::cdT)type_) { + case CDType::cdK: K.root() = CDSection(); break; + case CDType::cdX: X.root() = CDSection(); break; + case CDType::cdC: C.root() = CDSection(); break; + case CDType::cdM: M.root() = CDSection(); break; + default: break; + } + refresh(); +} + + +void CDView::buildFromHeader(const QString & description, int mode) { + if (description.isEmpty()) return; + PIString desc_file = Q2PIString(QDir::current().relativeFilePath(description)); + PIFile f(desc_file, PIIODevice::ReadOnly); + switch ((CDType::cdT)type_) { + case CDType::cdK: K.update(&f, mode); break; + case CDType::cdX: X.update(&f, mode); break; + case CDType::cdC: C.update(&f, mode); break; + case CDType::cdM: M.update(&f, mode); break; + default: break; + } + refresh(); +} + + +void CDView::calculate() { + switch ((CDType::cdT)type_) { + case CDType::cdK: K.calculate(); break; + case CDType::cdX: X.calculate(); break; + case CDType::cdC: C.calculate(); break; + case CDType::cdM: M.calculate(); break; + default: break; + } +} + + +void CDView::filter(const QString & f) { + proxy_->setFilterRegExp(QRegExp(f, Qt::CaseInsensitive)); +} + + +void CDView::indexClicked(const QModelIndex & i) { + if (!model_ || !i.isValid() || type_ != CDType::cdC || i.column() != cName_Cmd) return; + CDItem * item = model_->getItem(i); + if (!item) return; + if (item->itemType() != CDItem::ItemCDType) return; + CDType & t(model_->interface->section(item->buildPath())[item->index()]); + C.sendCommand(t); + emit commandSended(PI2QString(t.pathString().join("."))); + //piCout << t; + qDebug() << PI2QString(t.pathString().join(".")); +} + + +void CDView::cd_sendFailed() { + busyStatusChanged(false); + emit messageStatus("send failed"); + emit sendFailed(); +} + + +void CDView::cd_sendSucceed() { + busyStatusChanged(false); + emit messageStatus("send success"); + emit sendSucceed(); +} + + +void CDView::cd_receiveFailed() { + busyStatusChanged(false); + emit messageStatus("receive failed"); + emit receiveFailed(); +} + + +void CDView::cd_receiveSucceed() { + refresh(); + busyStatusChanged(false); + emit messageStatus("receive success"); + emit receiveSucceed(); +} + + +void CDView::cd_receivedX() { + X.lock(); + PIVector > xl = X.enabledList(); + //piCout << "X" << xl.size(); + piForeachC (PIDeque & x, xl) { + CDType & t(X[x]); + //piCout << t; + //piCout << t.path(); + if (t.cd_type() != CDType::cdX) continue; + update(model_->indexByPath(t.path(), cValue)); + //piCout << CDCore::pathToString(t.path()) << t.toDouble() << "model"; + //qDebug() << "val" << model_->data(model_->indexByPath(t.path(), cValue), Qt::DisplayRole).toDouble(); + } + X.unlock(); + emit receivedX(); +} + + +void CDView::cd_changedGlobal() { + emit changedGlobal(); +} + + +void CDView::pi_cd_messageReceived(PIDeque path, int type, PIString msg) { + QMetaObject::invokeMethod(this, "messageReceived", Qt::QueuedConnection, + Q_ARG(QString, PI2QString(CDCore::pathToString(path))), + Q_ARG(int, type), + Q_ARG(QString, PI2QString(msg))); +} diff --git a/qcd_utils/qcd_view.h b/piqt/libs/qcd/qcd_view.h similarity index 95% rename from qcd_utils/qcd_view.h rename to piqt/libs/qcd/qcd_view.h index 76d2130..ff3d68a 100644 --- a/qcd_utils/qcd_view.h +++ b/piqt/libs/qcd/qcd_view.h @@ -1,112 +1,113 @@ -/* - QCD Utils - Qt bindings/utilites for CD Utils - - Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#ifndef QCD_VIEW_H -#define QCD_VIEW_H - -#include "piobject.h" -#include - -namespace CDUtils { - class CDType; - class CDSection; -} - -class CDItemModel; -class QSortFilterProxyModel; - -class CDView: public QTreeView, public PIObject -{ - Q_OBJECT - PIOBJECT(CDView) -public: - explicit CDView(QWidget *parent = 0); - ~CDView(); - - void setType(int cdt); - void setFile(const QString & filename); - bool inProgress() const; - void startX(double freq = 20.); - CDUtils::CDSection * root(); - QString typeLetter() const; - - CDItemModel * CDModel() {return model_;} - -protected: - void mousePressEvent(QMouseEvent * ); - void mouseReleaseEvent(QMouseEvent * ); - void currentChanged(const QModelIndex & cur, const QModelIndex & prev); - -public slots: - void refresh(); - void refreshValues(); - void send(); - void receive(); - void save(); - void load(); - void clear(); - void buildFromHeader(const QString & description, int mode = 2); - void calculate(); - void filter(const QString & f); - -private slots: - void indexClicked(const QModelIndex & i); - void cd_sendFailed(); - void cd_sendSucceed(); - void cd_receiveFailed(); - void cd_receiveSucceed(); - void cd_receivedX(); - void cd_changedGlobal(); - -private: - bool filterTree(const QModelIndex & ti, const QString & filter); - EVENT_HANDLER(void, pi_cd_sendFailed) {emit _qcd_sendFailed();} - EVENT_HANDLER(void, pi_cd_sendSucceed) {emit _qcd_sendSucceed();} - EVENT_HANDLER(void, pi_cd_receiveFailed) {emit _qcd_receiveFailed();} - EVENT_HANDLER(void, pi_cd_receiveSucceed) {emit _qcd_receiveSucceed();} - EVENT_HANDLER(void, pi_cd_receivedX) {emit _qcd_receivedX();} - EVENT_HANDLER(void, pi_cd_changedGlobal) {emit _qcd_changedGlobal();} - EVENT_HANDLER3(void, pi_cd_messageReceived, PIDeque, path, int, type, PIString, msg); - - CDItemModel * model_; - QSortFilterProxyModel * proxy_; - int type_; - -signals: - void sendFailed(); - void sendSucceed(); - void receiveFailed(); - void receiveSucceed(); - void receivedX(); - void changedGlobal(); - void messageStatus(QString msg); - void commandSended(QString msg); - void messageReceived(QString path, int type, QString msg); - void busyStatusChanged(bool busy); - - void _qcd_sendFailed(); // PRIVATE - void _qcd_sendSucceed(); // PRIVATE - void _qcd_receiveFailed(); // PRIVATE - void _qcd_receiveSucceed(); // PRIVATE - void _qcd_receivedX(); // PRIVATE - void _qcd_changedGlobal(); // PRIVATE - -}; - -#endif // QCD_VIEW_H +/* + QCD Utils - Qt bindings/utilites for CD Utils + + Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +#ifndef QCD_VIEW_H +#define QCD_VIEW_H + +#include +#include "piobject.h" +#include "qcd_utils_export.h" + +namespace CDUtils { + class CDType; + class CDSection; +} + +class CDItemModel; +class QSortFilterProxyModel; + +class QCD_UTILS_EXPORT CDView: public QTreeView, public PIObject +{ + Q_OBJECT + PIOBJECT(CDView) +public: + explicit CDView(QWidget *parent = 0); + ~CDView(); + + void setType(int cdt); + void setFile(const QString & filename); + bool inProgress() const; + void startX(double freq = 20.); + CDUtils::CDSection * root(); + QString typeLetter() const; + + CDItemModel * CDModel() {return model_;} + +protected: + void mousePressEvent(QMouseEvent * ); + void mouseReleaseEvent(QMouseEvent * ); + void currentChanged(const QModelIndex & cur, const QModelIndex & prev); + +public slots: + void refresh(); + void refreshValues(); + void send(); + void receive(); + void save(); + void load(); + void clear(); + void buildFromHeader(const QString & description, int mode = 2); + void calculate(); + void filter(const QString & f); + +private slots: + void indexClicked(const QModelIndex & i); + void cd_sendFailed(); + void cd_sendSucceed(); + void cd_receiveFailed(); + void cd_receiveSucceed(); + void cd_receivedX(); + void cd_changedGlobal(); + +private: + bool filterTree(const QModelIndex & ti, const QString & filter); + EVENT_HANDLER(void, pi_cd_sendFailed) {emit _qcd_sendFailed();} + EVENT_HANDLER(void, pi_cd_sendSucceed) {emit _qcd_sendSucceed();} + EVENT_HANDLER(void, pi_cd_receiveFailed) {emit _qcd_receiveFailed();} + EVENT_HANDLER(void, pi_cd_receiveSucceed) {emit _qcd_receiveSucceed();} + EVENT_HANDLER(void, pi_cd_receivedX) {emit _qcd_receivedX();} + EVENT_HANDLER(void, pi_cd_changedGlobal) {emit _qcd_changedGlobal();} + EVENT_HANDLER3(void, pi_cd_messageReceived, PIDeque, path, int, type, PIString, msg); + + CDItemModel * model_; + QSortFilterProxyModel * proxy_; + int type_; + +signals: + void sendFailed(); + void sendSucceed(); + void receiveFailed(); + void receiveSucceed(); + void receivedX(); + void changedGlobal(); + void messageStatus(QString msg); + void commandSended(QString msg); + void messageReceived(QString path, int type, QString msg); + void busyStatusChanged(bool busy); + + void _qcd_sendFailed(); // PRIVATE + void _qcd_sendSucceed(); // PRIVATE + void _qcd_receiveFailed(); // PRIVATE + void _qcd_receiveSucceed(); // PRIVATE + void _qcd_receivedX(); // PRIVATE + void _qcd_changedGlobal(); // PRIVATE + +}; + +#endif // QCD_VIEW_H diff --git a/piqt/libs/widgets/CMakeLists.txt b/piqt/libs/widgets/CMakeLists.txt new file mode 100644 index 0000000..d7e4002 --- /dev/null +++ b/piqt/libs/widgets/CMakeLists.txt @@ -0,0 +1,9 @@ +include(PIPMacros) +pip_code_model(CCM "${ROOT_DIR}/pip/libs/main/io_devices/piiodevice.h" "${ROOT_DIR}/pip/libs/main/io_utils/pipacketextractor.h" OPTIONS "-DPIP_EXPORT" "-Es") +piqt_library(piqt_utils "Gui" "qad_utils;qad_widgets;qad_blockview;piqt" ${CCM}) + +foreach(_v ${_QT_VERSIONS_}) + if (LOCAL_FOUND${_v}) + add_dependencies(piqt_utils${_v} pip_cmg) + endif() +endforeach() diff --git a/piqt_utils/piqt_connection_edit.cpp b/piqt/libs/widgets/piqt_connection_edit.cpp similarity index 100% rename from piqt_utils/piqt_connection_edit.cpp rename to piqt/libs/widgets/piqt_connection_edit.cpp diff --git a/piqt_utils/piqt_connection_edit.h b/piqt/libs/widgets/piqt_connection_edit.h similarity index 96% rename from piqt_utils/piqt_connection_edit.h rename to piqt/libs/widgets/piqt_connection_edit.h index 007eeea..72f198b 100644 --- a/piqt_utils/piqt_connection_edit.h +++ b/piqt/libs/widgets/piqt_connection_edit.h @@ -22,6 +22,8 @@ #include #include "piconnection.h" +#include "piqt_utils_export.h" + namespace Ui { class ConnectionEdit; @@ -31,7 +33,7 @@ class FilterItem; class DeviceItem; class SenderItem; -class ConnectionEdit: public QDialog { +class PIQT_UTILS_EXPORT ConnectionEdit: public QDialog { Q_OBJECT public: explicit ConnectionEdit(QWidget * parent = 0); diff --git a/piqt_utils/piqt_connection_edit.ui b/piqt/libs/widgets/piqt_connection_edit.ui similarity index 89% rename from piqt_utils/piqt_connection_edit.ui rename to piqt/libs/widgets/piqt_connection_edit.ui index eb99380..afc8fb5 100644 --- a/piqt_utils/piqt_connection_edit.ui +++ b/piqt/libs/widgets/piqt_connection_edit.ui @@ -22,14 +22,20 @@ - - - QFrame::StyledPanel - - - QFrame::Raised - + + + 0 + + + 0 + + + 0 + + + 0 + @@ -268,7 +274,7 @@ Add - + :/icons/list-add.png:/icons/list-add.png @@ -282,8 +288,8 @@ Modify - - :/icons/document-save-.png:/icons/document-save-.png + + :/icons/document-save.png:/icons/document-save.png @@ -330,7 +336,16 @@ false - + + 0 + + + 0 + + + 0 + + 0 @@ -371,7 +386,16 @@ false - + + 0 + + + 0 + + + 0 + + 0 @@ -400,7 +424,16 @@ false - + + 0 + + + 0 + + + 0 + + 0 @@ -451,7 +484,16 @@ false - + + 0 + + + 0 + + + 0 + + 0 @@ -500,7 +542,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -535,7 +586,16 @@ false - + + 0 + + + 0 + + + 0 + + 0 @@ -622,7 +682,7 @@ Add - + :/icons/list-add.png:/icons/list-add.png @@ -636,7 +696,7 @@ Modify - + :/icons/document-save-.png:/icons/document-save-.png @@ -727,7 +787,7 @@ Add - + :/icons/list-add.png:/icons/list-add.png @@ -741,7 +801,7 @@ Modify - + :/icons/document-save-.png:/icons/document-save-.png @@ -764,7 +824,7 @@ Remove - + :/icons/edit-delete.png:/icons/edit-delete.png @@ -775,8 +835,8 @@ Clear - - :/icons/edit-clear-.png:/icons/edit-clear-.png + + :/icons/edit-clear.png:/icons/edit-clear.png @@ -840,7 +900,7 @@ - + @@ -875,22 +935,6 @@ - - lineName - editingFinished() - ConnectionEdit - recreateConnection() - - - 644 - 29 - - - 662 - -5 - - - recreateConnection() diff --git a/piqt_utils/piqt_connection_view.cpp b/piqt/libs/widgets/piqt_connection_view.cpp similarity index 100% rename from piqt_utils/piqt_connection_view.cpp rename to piqt/libs/widgets/piqt_connection_view.cpp diff --git a/piqt_utils/piqt_connection_view.h b/piqt/libs/widgets/piqt_connection_view.h similarity index 95% rename from piqt_utils/piqt_connection_view.h rename to piqt/libs/widgets/piqt_connection_view.h index 8889c78..0e6730f 100644 --- a/piqt_utils/piqt_connection_view.h +++ b/piqt/libs/widgets/piqt_connection_view.h @@ -22,13 +22,14 @@ #include "blockview.h" #include "piconnection.h" +#include "piqt_utils_export.h" const int __CV_Device = 1; const int __CV_Filter = 2; const int __CV_Sender = 3; -class DeviceItem: public BlockItem { +class PIQT_UTILS_EXPORT DeviceItem: public BlockItem { public: DeviceItem(); @@ -54,7 +55,7 @@ protected: }; -class FilterItem: public BlockItem { +class PIQT_UTILS_EXPORT FilterItem: public BlockItem { public: FilterItem(); @@ -84,7 +85,7 @@ protected: }; -class SenderItem: public BlockItem { +class PIQT_UTILS_EXPORT SenderItem: public BlockItem { public: SenderItem(); @@ -104,7 +105,7 @@ protected: }; -class ConnectionView: public BlockView { +class PIQT_UTILS_EXPORT ConnectionView: public BlockView { Q_OBJECT public: explicit ConnectionView(QWidget * parent = 0); diff --git a/piqt_utils/piqt_highlighter.cpp b/piqt/libs/widgets/piqt_highlighter.cpp similarity index 100% rename from piqt_utils/piqt_highlighter.cpp rename to piqt/libs/widgets/piqt_highlighter.cpp diff --git a/piqt_utils/piqt_highlighter.h b/piqt/libs/widgets/piqt_highlighter.h similarity index 90% rename from piqt_utils/piqt_highlighter.h rename to piqt/libs/widgets/piqt_highlighter.h index 9140c2a..67899cf 100644 --- a/piqt_utils/piqt_highlighter.h +++ b/piqt/libs/widgets/piqt_highlighter.h @@ -23,10 +23,11 @@ #include #include #include +#include "piqt_utils_export.h" class QTextDocument; -class ConfigHighlighter : public QSyntaxHighlighter +class PIQT_UTILS_EXPORT ConfigHighlighter : public QSyntaxHighlighter { Q_OBJECT public: @@ -37,7 +38,7 @@ public: private: void highlightBlock(const QString &text); - struct HighlightingRule { + struct PIQT_UTILS_EXPORT HighlightingRule { QRegExp pattern; QTextCharFormat format; }; diff --git a/piqt_utils/piqt_iodevice_edit.cpp b/piqt/libs/widgets/piqt_iodevice_edit.cpp similarity index 100% rename from piqt_utils/piqt_iodevice_edit.cpp rename to piqt/libs/widgets/piqt_iodevice_edit.cpp diff --git a/piqt_utils/piqt_iodevice_edit.h b/piqt/libs/widgets/piqt_iodevice_edit.h similarity index 88% rename from piqt_utils/piqt_iodevice_edit.h rename to piqt/libs/widgets/piqt_iodevice_edit.h index d9770fb..764cd6b 100644 --- a/piqt_utils/piqt_iodevice_edit.h +++ b/piqt/libs/widgets/piqt_iodevice_edit.h @@ -22,13 +22,14 @@ #include #include "qad_types.h" +#include "piqt_utils_export.h" class QLineEdit; class QToolButton; class IODeviceEditDialog; -class IODeviceEdit: public QWidget { +class PIQT_UTILS_EXPORT IODeviceEdit: public QWidget { Q_OBJECT Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged) Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) @@ -60,12 +61,14 @@ signals: }; -class __IODeviceEditRegistrator__ { +class PIQT_UTILS_EXPORT __IODeviceEditRegistrator__ { public: __IODeviceEditRegistrator__(); }; static __IODeviceEditRegistrator__ __iodeviceeditregistrator__; -void QAD_IODevice_toString(const QVariant & v, QString & r); +PIQT_UTILS_EXPORT void QAD_IODevice_toString(const QVariant & v, QString & r); + + #endif // PIQT_IODEVICE_EDIT_H diff --git a/piqt_utils/piqt_iodevice_edit_dialog.cpp b/piqt/libs/widgets/piqt_iodevice_edit_dialog.cpp similarity index 100% rename from piqt_utils/piqt_iodevice_edit_dialog.cpp rename to piqt/libs/widgets/piqt_iodevice_edit_dialog.cpp diff --git a/piqt_utils/piqt_iodevice_edit_dialog.h b/piqt/libs/widgets/piqt_iodevice_edit_dialog.h similarity index 93% rename from piqt_utils/piqt_iodevice_edit_dialog.h rename to piqt/libs/widgets/piqt_iodevice_edit_dialog.h index 0c846cd..0ccfa5f 100644 --- a/piqt_utils/piqt_iodevice_edit_dialog.h +++ b/piqt/libs/widgets/piqt_iodevice_edit_dialog.h @@ -23,12 +23,13 @@ #include #include "qad_types.h" #include "propertystorage.h" +#include "piqt_utils_export.h" namespace Ui { class IODeviceEditDialog; } -class IODeviceEditDialog: public QDialog { +class PIQT_UTILS_EXPORT IODeviceEditDialog: public QDialog { Q_OBJECT public: explicit IODeviceEditDialog(QWidget * parent = 0); diff --git a/piqt_utils/piqt_iodevice_edit_dialog.ui b/piqt/libs/widgets/piqt_iodevice_edit_dialog.ui similarity index 100% rename from piqt_utils/piqt_iodevice_edit_dialog.ui rename to piqt/libs/widgets/piqt_iodevice_edit_dialog.ui diff --git a/piqt/utils/CMakeLists.txt b/piqt/utils/CMakeLists.txt new file mode 100644 index 0000000..4dbf12d --- /dev/null +++ b/piqt/utils/CMakeLists.txt @@ -0,0 +1 @@ +add_directories("piqt_") diff --git a/piqt/utils/cd_pult/CMakeLists.txt b/piqt/utils/cd_pult/CMakeLists.txt new file mode 100644 index 0000000..1ffaae3 --- /dev/null +++ b/piqt/utils/cd_pult/CMakeLists.txt @@ -0,0 +1,14 @@ +project(cd_pult) +if(APPLE) + set(APP_ICON "") +elseif(WIN32) + set(APP_ICON "") +else() + set(APP_ICON "") +endif() +set(APP_INFO "CD Pult") +piqt_application(${PROJECT_NAME} "Gui;Widgets" "qad_utils;qad_widgets;qad_graphic;qad_application;qcd_utils;piqt_utils") +if (Qt5_FOUND) + import_version(${PROJ_NAME}5 ${PROJECT_NAME}) + deploy_target(${PROJECT_NAME}5 DEPLOY_DIR ${CMAKE_CURRENT_BINARY_DIR} DESTINATION ${ROOT_DIR}/release) +endif() diff --git a/qcd_utils/pult/cddirectk.cpp b/piqt/utils/cd_pult/cddirectk.cpp similarity index 96% rename from qcd_utils/pult/cddirectk.cpp rename to piqt/utils/cd_pult/cddirectk.cpp index f2dc425..ce7e756 100644 --- a/qcd_utils/pult/cddirectk.cpp +++ b/piqt/utils/cd_pult/cddirectk.cpp @@ -1,312 +1,312 @@ -#include "cddirectk.h" -#include "ui_cddirectk_type_dialog.h" -#include "cdutils_core.h" -#include "cdutils_k.h" -#include "qcd_core.h" -#include "qcd_model.h" -#include "graphic.h" -#include "piqt.h" -#include "qvariantedit.h" -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace CDUtils; - - -KDockWidget::KDockWidget(QString title, QMainWindow * p): QDockWidget(title, p) { - da = p; - menu = new QMenu(this); - QAction * a = new QAction(QIcon(":/icons/document-edit.png"), "Rename ...", this); - connect(a, SIGNAL(triggered(bool)), this, SLOT(rename())); - dactions << a; - a = new QAction(QIcon(":/icons/edit-delete.png"), "Remove", this); - connect(a, SIGNAL(triggered(bool)), this, SIGNAL(removeRequest())); - dactions << a; - menu_k = new QMenu(this); - menu_k->setTitle(tr("Remove K")); - lay = new QFormLayout(); - lay->setContentsMargins(0, qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin), 0, 0); - lay->setLabelAlignment(Qt::AlignRight | Qt::AlignVCenter); - QWidget * w = new QWidget(); - w->setAcceptDrops(true); - w->installEventFilter(this); - w->setLayout(lay); - setWidget(w); - type_dialog = new CDDirectKTypeDialog(); -} - - -void KDockWidget::addK(const CDType & t, CDDirectKTypeDialog::TypeInfo ti) { - if (t.cd_type() != CDType::cdK) return; - PIDeque xp = t.path(); - if (k_list.contains(xp)) return; - k_list << xp; - info_list << ti; - //piCout << "add" << xp; - QWidget * ve = ti.create(); - //qDebug() << "add" << ve; - lay->addRow(PI2QString(t.pathString().join(".")) + ":", ve); - QCDCore::instance()->bindWidget(ve, t); - //ve->setValue(); -} - - -QByteArray KDockWidget::save() const { - ChunkStream cs; - cs.add(1, windowTitle()) - .add(2, getList(k_list)) - .add(3, info_list); - return cs.data(); -} - - -void KDockWidget::load(QByteArray ba) { - clear(); - if (ba.isEmpty()) return; - ChunkStream cs(ba); - PIVector > list; - QVector ilist; - while (!cs.atEnd()) { - switch (cs.read()) { - case 1: setWindowTitle(cs.getData()); break; - case 2: list = setList(cs.getData()); break; - case 3: ilist = cs.getData >(); break; - default: break; - } - } - ilist.resize(list.size()); - for (int i = 0; i < list.size_s(); ++i) { - addK(K[list[i]], ilist[i]); - } -} - - -void KDockWidget::clear() { - while (lay->rowCount() > 0) - removeRow(0); - k_list.clear(); - info_list.clear(); -} - - -void KDockWidget::changedGlobal() { - //piCout << "changedGlobal ..." << k_list.size_s() << info_list.size() << lay->count() << lay->rowCount(); - for (int i = 0; i < k_list.size_s(); ++i) { - //piCout << "update" << i << "0"; - if (!K.exists(k_list[i])) { - k_list.remove(i); - info_list.remove(i); - removeRow(i); - --i; - continue; - } - //piCout << "update" << i << "1"; - QLabel * lbl = qobject_cast(lay->itemAt(i, QFormLayout::LabelRole)->widget()); - //piCout << "update" << i << "2"; - if (lbl) lbl->setText(PI2QString(K[k_list[i]].pathString().join(".")) + ":"); - //piCout << "update" << i << "3"; - } - //piCout << "changedGlobal ok"; -} - - -bool KDockWidget::eventFilter(QObject * o, QEvent * e) { - //if (o == graphic->viewport()) { - switch (e->type()) { - case QEvent::DragMove: { - QDragMoveEvent * de = (QDragMoveEvent*)e; - const QMimeData * mime = de->mimeData(); - if (!mime) break; - if (!mime->text().startsWith("k")) break; - de->setDropAction(Qt::CopyAction); - de->accept(); - return true; - } break; - case QEvent::DragEnter: { - QDragEnterEvent * de = (QDragEnterEvent*)e; - const QMimeData * mime = de->mimeData(); - if (!mime) break; - if (!mime->text().startsWith("k")) break; - de->setDropAction(Qt::CopyAction); - de->accept(); - return true; - } break; - case QEvent::Drop: { - QDropEvent * de = (QDropEvent*)e; - const QMimeData * mime = de->mimeData(); - if (!mime) break; - //qDebug() << "drop" << mime->text(); - if (!mime->text().startsWith("k")) break; - CDDirectKTypeDialog::TypeInfo ti; - CDType & k(K[CDCore::stringToPath(Q2PIString(mime->text().mid(1)))]); - if (k.type().left(1) == "n" || k.type().left(1) == "f") { - if (type_dialog->exec() == QDialog::Accepted) - ti = type_dialog->getType(); - else - return true; - } - addK(k, ti); - de->accept(); - return true; - } break; - default: break; - } - //} - return QWidget::eventFilter(o, e); -} - - -void KDockWidget::contextMenuEvent(QContextMenuEvent * e) { - qDeleteAll(menu_k->actions()); - menu_k->clear(); - for (int i = 0; i < k_list.size_s(); ++i) { - QAction * a = new QAction(PI2QString(K[k_list[i]].pathString().join(".")), this); - a->setData(i); - connect(a, SIGNAL(triggered(bool)), this, SLOT(removeK())); - menu_k->addAction(a); - } - QMenu * mwm = da->createPopupMenu(); - menu->clear(); - menu->addActions(dactions); - menu->addMenu(menu_k); - menu->addSeparator(); - menu->addActions(mwm->actions()); - menu->popup(e->globalPos()); - mwm->deleteLater(); -} - - -void KDockWidget::removeRow(int r) { - if (r < 0 || r >= lay->rowCount()) return; -#if QT_VERSION >= 0x050800 - QFormLayout::TakeRowResult rr = lay->takeRow(r); - if (rr.fieldItem) {delete rr.fieldItem->widget(); delete rr.fieldItem;} - if (rr.labelItem) {delete rr.labelItem->widget(); delete rr.labelItem;} -#else - piForTimes (2) { - QLayoutItem * i = lay->itemAt(r+r); - lay->removeItem(i); - if (i) {delete i->widget(); delete i;} - } -#endif -} - - -void KDockWidget::rename() { - QString nn = QInputDialog::getText(this, tr("Rename area"), tr("New area name:"), - QLineEdit::Normal, windowTitle()); - if (nn.isEmpty()) return; - setWindowTitle(nn); -} - - -void KDockWidget::removeK() { - QAction * a = qobject_cast(sender()); - if (!a) return; - int ind = a->data().toInt(); - if (ind < 0 || ind >= k_list.size_s()) return; - k_list.remove(ind); - if (ind >= 0 && ind < info_list.size()) - info_list.remove(ind); - removeRow(ind); -} - - - - -CDDirectK::CDDirectK(QWidget * parent) : QWidget(parent), Ui::CDDirectK() { - setupUi(this); - da = new QMainWindow(); - da->setWindowFlags(frame->windowFlags()); - da->setDockNestingEnabled(true); - layoutMain->addWidget(da); -} - - -CDDirectK::~CDDirectK() { -} - - -void CDDirectK::reset() { - qDeleteAll(docks); - docks.clear(); -} - - -QByteArray CDDirectK::save() const { - ChunkStream cs; - QVector dstates; - foreach (KDockWidget * d, docks) { - dstates << d->save(); - } - cs.add(1, docks.size()) - .add(2, dstates) - .add(3, da->saveState()); - return cs.data(); -} - - -void CDDirectK::load(QByteArray ba) { - reset(); - if (ba.isEmpty()) return; - ChunkStream cs(ba); - while (!cs.atEnd()) { - switch (cs.read()) { - case 1: { - int s = cs.getData(); - piForTimes (s) - addArea(); - } break; - case 2: { - QVector dstates = cs.getData >(); - for (int i = 0; i < piMini(dstates.size(), docks.size()); ++i) - docks[i]->load(dstates[i]); - } break; - case 3: da->restoreState(cs.getData()); break; - default: break; - } - } -} - - -void CDDirectK::addArea() { - KDockWidget * dw = new KDockWidget(QString("area %1").arg(docks.size()), da); - connect(dw, SIGNAL(removeRequest()), this, SLOT(removeArea())); - da->addDockWidget(Qt::RightDockWidgetArea, dw); - docks << dw; - for (int i = 0; i < docks.size(); ++i) - docks[i]->setObjectName(QString("dock_%1").arg(i)); -} - - -void CDDirectK::changedGlobal() { - foreach (KDockWidget * d, docks) - d->changedGlobal(); -} - - -void CDDirectK::removeArea() { - KDockWidget * d = qobject_cast(sender()); - if (!d) return; - docks.removeAll(d); - d->deleteLater(); - for (int i = 0; i < docks.size(); ++i) - docks[i]->setObjectName(QString("dock_%1").arg(i)); -} - - -void CDDirectK::on_buttonAdd_clicked() { - addArea(); -} - - -void CDDirectK::on_buttonRemoveAll_clicked() { - qDeleteAll(docks); - docks.clear(); -} +#include "cddirectk.h" +#include "ui_cddirectk_type_dialog.h" +#include "cdutils_core.h" +#include "cdutils_k.h" +#include "qcd_core.h" +#include "qcd_model.h" +#include "graphic.h" +#include "piqt.h" +#include "qvariantedit.h" +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace CDUtils; + + +KDockWidget::KDockWidget(QString title, QMainWindow * p): QDockWidget(title, p) { + da = p; + menu = new QMenu(this); + QAction * a = new QAction(QIcon(":/icons/document-edit.png"), "Rename ...", this); + connect(a, SIGNAL(triggered(bool)), this, SLOT(rename())); + dactions << a; + a = new QAction(QIcon(":/icons/edit-delete.png"), "Remove", this); + connect(a, SIGNAL(triggered(bool)), this, SIGNAL(removeRequest())); + dactions << a; + menu_k = new QMenu(this); + menu_k->setTitle(tr("Remove K")); + lay = new QFormLayout(); + lay->setContentsMargins(0, qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin), 0, 0); + lay->setLabelAlignment(Qt::AlignRight | Qt::AlignVCenter); + QWidget * w = new QWidget(); + w->setAcceptDrops(true); + w->installEventFilter(this); + w->setLayout(lay); + setWidget(w); + type_dialog = new CDDirectKTypeDialog(); +} + + +void KDockWidget::addK(const CDType & t, CDDirectKTypeDialog::TypeInfo ti) { + if (t.cd_type() != CDType::cdK) return; + PIDeque xp = t.path(); + if (k_list.contains(xp)) return; + k_list << xp; + info_list << ti; + //piCout << "add" << xp; + QWidget * ve = ti.create(); + //qDebug() << "add" << ve; + lay->addRow(PI2QString(t.pathString().join(".")) + ":", ve); + QCDCore::instance()->bindWidget(ve, t); + //ve->setValue(); +} + + +QByteArray KDockWidget::save() const { + ChunkStream cs; + cs.add(1, windowTitle()) + .add(2, getList(k_list)) + .add(3, info_list); + return cs.data(); +} + + +void KDockWidget::load(QByteArray ba) { + clear(); + if (ba.isEmpty()) return; + ChunkStream cs(ba); + PIVector > list; + QVector ilist; + while (!cs.atEnd()) { + switch (cs.read()) { + case 1: setWindowTitle(cs.getData()); break; + case 2: list = setList(cs.getData()); break; + case 3: ilist = cs.getData >(); break; + default: break; + } + } + ilist.resize(list.size()); + for (int i = 0; i < list.size_s(); ++i) { + addK(K[list[i]], ilist[i]); + } +} + + +void KDockWidget::clear() { + while (lay->rowCount() > 0) + removeRow(0); + k_list.clear(); + info_list.clear(); +} + + +void KDockWidget::changedGlobal() { + //piCout << "changedGlobal ..." << k_list.size_s() << info_list.size() << lay->count() << lay->rowCount(); + for (int i = 0; i < k_list.size_s(); ++i) { + //piCout << "update" << i << "0"; + if (!K.exists(k_list[i])) { + k_list.remove(i); + info_list.remove(i); + removeRow(i); + --i; + continue; + } + //piCout << "update" << i << "1"; + QLabel * lbl = qobject_cast(lay->itemAt(i, QFormLayout::LabelRole)->widget()); + //piCout << "update" << i << "2"; + if (lbl) lbl->setText(PI2QString(K[k_list[i]].pathString().join(".")) + ":"); + //piCout << "update" << i << "3"; + } + //piCout << "changedGlobal ok"; +} + + +bool KDockWidget::eventFilter(QObject * o, QEvent * e) { + //if (o == graphic->viewport()) { + switch (e->type()) { + case QEvent::DragMove: { + QDragMoveEvent * de = (QDragMoveEvent*)e; + const QMimeData * mime = de->mimeData(); + if (!mime) break; + if (!mime->text().startsWith("k")) break; + de->setDropAction(Qt::CopyAction); + de->accept(); + return true; + } break; + case QEvent::DragEnter: { + QDragEnterEvent * de = (QDragEnterEvent*)e; + const QMimeData * mime = de->mimeData(); + if (!mime) break; + if (!mime->text().startsWith("k")) break; + de->setDropAction(Qt::CopyAction); + de->accept(); + return true; + } break; + case QEvent::Drop: { + QDropEvent * de = (QDropEvent*)e; + const QMimeData * mime = de->mimeData(); + if (!mime) break; + //qDebug() << "drop" << mime->text(); + if (!mime->text().startsWith("k")) break; + CDDirectKTypeDialog::TypeInfo ti; + CDType & k(K[CDCore::stringToPath(Q2PIString(mime->text().mid(1)))]); + if (k.type().left(1) == "n" || k.type().left(1) == "f") { + if (type_dialog->exec() == QDialog::Accepted) + ti = type_dialog->getType(); + else + return true; + } + addK(k, ti); + de->accept(); + return true; + } break; + default: break; + } + //} + return QWidget::eventFilter(o, e); +} + + +void KDockWidget::contextMenuEvent(QContextMenuEvent * e) { + qDeleteAll(menu_k->actions()); + menu_k->clear(); + for (int i = 0; i < k_list.size_s(); ++i) { + QAction * a = new QAction(PI2QString(K[k_list[i]].pathString().join(".")), this); + a->setData(i); + connect(a, SIGNAL(triggered(bool)), this, SLOT(removeK())); + menu_k->addAction(a); + } + QMenu * mwm = da->createPopupMenu(); + menu->clear(); + menu->addActions(dactions); + menu->addMenu(menu_k); + menu->addSeparator(); + menu->addActions(mwm->actions()); + menu->popup(e->globalPos()); + mwm->deleteLater(); +} + + +void KDockWidget::removeRow(int r) { + if (r < 0 || r >= lay->rowCount()) return; +#if QT_VERSION >= 0x050800 + QFormLayout::TakeRowResult rr = lay->takeRow(r); + if (rr.fieldItem) {delete rr.fieldItem->widget(); delete rr.fieldItem;} + if (rr.labelItem) {delete rr.labelItem->widget(); delete rr.labelItem;} +#else + piForTimes (2) { + QLayoutItem * i = lay->itemAt(r+r); + lay->removeItem(i); + if (i) {delete i->widget(); delete i;} + } +#endif +} + + +void KDockWidget::rename() { + QString nn = QInputDialog::getText(this, tr("Rename area"), tr("New area name:"), + QLineEdit::Normal, windowTitle()); + if (nn.isEmpty()) return; + setWindowTitle(nn); +} + + +void KDockWidget::removeK() { + QAction * a = qobject_cast(sender()); + if (!a) return; + int ind = a->data().toInt(); + if (ind < 0 || ind >= k_list.size_s()) return; + k_list.remove(ind); + if (ind >= 0 && ind < info_list.size()) + info_list.remove(ind); + removeRow(ind); +} + + + + +CDDirectK::CDDirectK(QWidget * parent) : QWidget(parent), Ui::CDDirectK() { + setupUi(this); + da = new QMainWindow(); + da->setWindowFlags(frame->windowFlags()); + da->setDockNestingEnabled(true); + layoutMain->addWidget(da); +} + + +CDDirectK::~CDDirectK() { +} + + +void CDDirectK::reset() { + qDeleteAll(docks); + docks.clear(); +} + + +QByteArray CDDirectK::save() const { + ChunkStream cs; + QVector dstates; + foreach (KDockWidget * d, docks) { + dstates << d->save(); + } + cs.add(1, docks.size()) + .add(2, dstates) + .add(3, da->saveState()); + return cs.data(); +} + + +void CDDirectK::load(QByteArray ba) { + reset(); + if (ba.isEmpty()) return; + ChunkStream cs(ba); + while (!cs.atEnd()) { + switch (cs.read()) { + case 1: { + int s = cs.getData(); + piForTimes (s) + addArea(); + } break; + case 2: { + QVector dstates = cs.getData >(); + for (int i = 0; i < piMini(dstates.size(), docks.size()); ++i) + docks[i]->load(dstates[i]); + } break; + case 3: da->restoreState(cs.getData()); break; + default: break; + } + } +} + + +void CDDirectK::addArea() { + KDockWidget * dw = new KDockWidget(QString("area %1").arg(docks.size()), da); + connect(dw, SIGNAL(removeRequest()), this, SLOT(removeArea())); + da->addDockWidget(Qt::RightDockWidgetArea, dw); + docks << dw; + for (int i = 0; i < docks.size(); ++i) + docks[i]->setObjectName(QString("dock_%1").arg(i)); +} + + +void CDDirectK::changedGlobal() { + foreach (KDockWidget * d, docks) + d->changedGlobal(); +} + + +void CDDirectK::removeArea() { + KDockWidget * d = qobject_cast(sender()); + if (!d) return; + docks.removeAll(d); + d->deleteLater(); + for (int i = 0; i < docks.size(); ++i) + docks[i]->setObjectName(QString("dock_%1").arg(i)); +} + + +void CDDirectK::on_buttonAdd_clicked() { + addArea(); +} + + +void CDDirectK::on_buttonRemoveAll_clicked() { + qDeleteAll(docks); + docks.clear(); +} diff --git a/qcd_utils/pult/cddirectk.h b/piqt/utils/cd_pult/cddirectk.h similarity index 94% rename from qcd_utils/pult/cddirectk.h rename to piqt/utils/cd_pult/cddirectk.h index b5d71f4..47ade06 100644 --- a/qcd_utils/pult/cddirectk.h +++ b/piqt/utils/cd_pult/cddirectk.h @@ -1,77 +1,77 @@ -#ifndef CDDIRECTK_H -#define CDDIRECTK_H - -#include "cdgraphics.h" -#include "ui_cddirectk.h" -#include "cddirectk_type_dialog.h" - -class QFormLayout; - - -class KDockWidget: public QDockWidget { - Q_OBJECT -public: - KDockWidget(QString title = QString(), QMainWindow * p = 0); - - void addK(const CDUtils::CDType & t, CDDirectKTypeDialog::TypeInfo ti); - QByteArray save() const; - void load(QByteArray ba); - void clear(); - void changedGlobal(); - - QFormLayout * lay; - -private: - bool eventFilter(QObject * o, QEvent * e); - void contextMenuEvent(QContextMenuEvent * e); - void removeRow(int r); - - QMenu * menu, * menu_k; - QList dactions; - QMainWindow * da; - CDDirectKTypeDialog * type_dialog; - PIVector > k_list; - QVector info_list; - -private slots: - void rename(); - void removeK(); - -signals: - void removeRequest(); - -}; - - - - -class CDDirectK: public QWidget, public Ui::CDDirectK -{ - Q_OBJECT -public: - explicit CDDirectK(QWidget *parent = 0); - ~CDDirectK(); - - void reset(); - QByteArray save() const; - void load(QByteArray ba); - -private: - void addArea(); - - QList docks; - QMainWindow * da; - -public slots: - void changedGlobal(); - -private slots: - void removeArea(); - void on_buttonAdd_clicked(); - void on_buttonRemoveAll_clicked(); - -signals: - -}; - -#endif // CDDIRECTK_H +#ifndef CDDIRECTK_H +#define CDDIRECTK_H + +#include "cdgraphics.h" +#include "ui_cddirectk.h" +#include "cddirectk_type_dialog.h" + +class QFormLayout; + + +class KDockWidget: public QDockWidget { + Q_OBJECT +public: + KDockWidget(QString title = QString(), QMainWindow * p = 0); + + void addK(const CDUtils::CDType & t, CDDirectKTypeDialog::TypeInfo ti); + QByteArray save() const; + void load(QByteArray ba); + void clear(); + void changedGlobal(); + + QFormLayout * lay; + +private: + bool eventFilter(QObject * o, QEvent * e); + void contextMenuEvent(QContextMenuEvent * e); + void removeRow(int r); + + QMenu * menu, * menu_k; + QList dactions; + QMainWindow * da; + CDDirectKTypeDialog * type_dialog; + PIVector > k_list; + QVector info_list; + +private slots: + void rename(); + void removeK(); + +signals: + void removeRequest(); + +}; + + + + +class CDDirectK: public QWidget, public Ui::CDDirectK +{ + Q_OBJECT +public: + explicit CDDirectK(QWidget *parent = 0); + ~CDDirectK(); + + void reset(); + QByteArray save() const; + void load(QByteArray ba); + +private: + void addArea(); + + QList docks; + QMainWindow * da; + +public slots: + void changedGlobal(); + +private slots: + void removeArea(); + void on_buttonAdd_clicked(); + void on_buttonRemoveAll_clicked(); + +signals: + +}; + +#endif // CDDIRECTK_H diff --git a/qcd_utils/pult/cddirectk.ui b/piqt/utils/cd_pult/cddirectk.ui similarity index 96% rename from qcd_utils/pult/cddirectk.ui rename to piqt/utils/cd_pult/cddirectk.ui index a14e715..731498b 100644 --- a/qcd_utils/pult/cddirectk.ui +++ b/piqt/utils/cd_pult/cddirectk.ui @@ -1,85 +1,85 @@ - - - CDDirectK - - - - 0 - 0 - 624 - 411 - - - - CD Pult - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::StyledPanel - - - - 0 - - - 0 - - - - - Add new - - - - :/icons/list-add.png:/icons/list-add.png - - - - - - - Remove all - - - - :/icons/edit-delete.png:/icons/edit-delete.png - - - - - - - Qt::Horizontal - - - - 1 - 20 - - - - - - - - - - - - - - + + + CDDirectK + + + + 0 + 0 + 624 + 411 + + + + CD Pult + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QFrame::StyledPanel + + + + 0 + + + 0 + + + + + Add new + + + + :/icons/list-add.png:/icons/list-add.png + + + + + + + Remove all + + + + :/icons/edit-delete.png:/icons/edit-delete.png + + + + + + + Qt::Horizontal + + + + 1 + 20 + + + + + + + + + + + + + + diff --git a/qcd_utils/pult/cddirectk_type_dialog.cpp b/piqt/utils/cd_pult/cddirectk_type_dialog.cpp similarity index 95% rename from qcd_utils/pult/cddirectk_type_dialog.cpp rename to piqt/utils/cd_pult/cddirectk_type_dialog.cpp index ba95141..c6be2fa 100644 --- a/qcd_utils/pult/cddirectk_type_dialog.cpp +++ b/piqt/utils/cd_pult/cddirectk_type_dialog.cpp @@ -1,76 +1,76 @@ -#include "cddirectk_type_dialog.h" -#include "cdutils_core.h" -#include "qcd_core.h" -#include "qcd_model.h" -#include "piqt.h" -#include "spinslider.h" -#include "qvariantedit.h" - - -CDDirectKTypeDialog::CDDirectKTypeDialog(QWidget * parent) : QDialog(parent), Ui::CDDirectKTypeDialog() { - setupUi(this); -} - - -CDDirectKTypeDialog::~CDDirectKTypeDialog() { -} - - -CDDirectKTypeDialog::TypeInfo CDDirectKTypeDialog::getType() const { - if (!groupBox->isChecked()) return TypeInfo(); - TypeInfo ret; - ret.type = comboType->currentIndex(); - ret.params_d[0] = evalMin->value(); - ret.params_d[1] = evalMax->value(); - ret.params_d[2] = spinDecimals->value(); - ret.params_d[3] = evalStep->value(); - ret.params_s[0] = linePrefix->text(); - ret.params_s[1] = lineSuffix->text(); - return ret; -} - - - - -CDDirectKTypeDialog::TypeInfo::TypeInfo(int type_) { - type = type_; - params_d.resize(4); - params_s.resize(2); -} - - -QWidget * CDDirectKTypeDialog::TypeInfo::create() { - params_d.resize(4); - params_s.resize(2); - switch (type) { - case 0: { - QDoubleSpinBox * ret = new QDoubleSpinBox(); - ret->setMinimum(params_d[0]); - ret->setMaximum(params_d[1]); - ret->setDecimals(params_d[2]); - ret->setSingleStep(params_d[3]); - ret->setPrefix(params_s[0]); - ret->setSuffix(params_s[1]); - return ret; - } break; - case 1: { - QSlider * ret = new QSlider(Qt::Horizontal); - ret->setMinimum(params_d[0]); - ret->setMaximum(params_d[1]); - ret->setSingleStep(params_d[3]); - return ret; - } break; - case 2: { - SpinSlider * ret = new SpinSlider(); - ret->setMinimum(params_d[0]); - ret->setMaximum(params_d[1]); - ret->setDecimals(params_d[2]); - ret->setSingleStep(params_d[3]); - ret->setPrefix(params_s[0]); - ret->setSuffix(params_s[1]); - return ret; - } break; - default: break; - } - return new QVariantEdit(); -} +#include "cddirectk_type_dialog.h" +#include "cdutils_core.h" +#include "qcd_core.h" +#include "qcd_model.h" +#include "piqt.h" +#include "spinslider.h" +#include "qvariantedit.h" + + +CDDirectKTypeDialog::CDDirectKTypeDialog(QWidget * parent) : QDialog(parent), Ui::CDDirectKTypeDialog() { + setupUi(this); +} + + +CDDirectKTypeDialog::~CDDirectKTypeDialog() { +} + + +CDDirectKTypeDialog::TypeInfo CDDirectKTypeDialog::getType() const { + if (!groupBox->isChecked()) return TypeInfo(); + TypeInfo ret; + ret.type = comboType->currentIndex(); + ret.params_d[0] = evalMin->value(); + ret.params_d[1] = evalMax->value(); + ret.params_d[2] = spinDecimals->value(); + ret.params_d[3] = evalStep->value(); + ret.params_s[0] = linePrefix->text(); + ret.params_s[1] = lineSuffix->text(); + return ret; +} + + + + +CDDirectKTypeDialog::TypeInfo::TypeInfo(int type_) { + type = type_; + params_d.resize(4); + params_s.resize(2); +} + + +QWidget * CDDirectKTypeDialog::TypeInfo::create() { + params_d.resize(4); + params_s.resize(2); + switch (type) { + case 0: { + QDoubleSpinBox * ret = new QDoubleSpinBox(); + ret->setMinimum(params_d[0]); + ret->setMaximum(params_d[1]); + ret->setDecimals(params_d[2]); + ret->setSingleStep(params_d[3]); + ret->setPrefix(params_s[0]); + ret->setSuffix(params_s[1]); + return ret; + } break; + case 1: { + QSlider * ret = new QSlider(Qt::Horizontal); + ret->setMinimum(params_d[0]); + ret->setMaximum(params_d[1]); + ret->setSingleStep(params_d[3]); + return ret; + } break; + case 2: { + SpinSlider * ret = new SpinSlider(); + ret->setMinimum(params_d[0]); + ret->setMaximum(params_d[1]); + ret->setDecimals(params_d[2]); + ret->setSingleStep(params_d[3]); + ret->setPrefix(params_s[0]); + ret->setSuffix(params_s[1]); + return ret; + } break; + default: break; + } + return new QVariantEdit(); +} diff --git a/qcd_utils/pult/cddirectk_type_dialog.h b/piqt/utils/cd_pult/cddirectk_type_dialog.h similarity index 95% rename from qcd_utils/pult/cddirectk_type_dialog.h rename to piqt/utils/cd_pult/cddirectk_type_dialog.h index c3ee06a..9881864 100644 --- a/qcd_utils/pult/cddirectk_type_dialog.h +++ b/piqt/utils/cd_pult/cddirectk_type_dialog.h @@ -1,44 +1,44 @@ -#ifndef CDDIRECTK_TYPE_DIALOG_H -#define CDDIRECTK_TYPE_DIALOG_H - -#include -#include "ui_cddirectk_type_dialog.h" - - -class CDDirectKTypeDialog: public QDialog, public Ui::CDDirectKTypeDialog -{ - Q_OBJECT -public: - explicit CDDirectKTypeDialog(QWidget * parent = 0); - ~CDDirectKTypeDialog(); - - struct TypeInfo { - TypeInfo(int type_ = -1); - QWidget * create(); - int type; - QVector params_d; - QVector params_s; - }; - - TypeInfo getType() const; - -private: - -public slots: - -private slots: - -signals: - -}; - -inline QDataStream & operator <<(QDataStream & s, const CDDirectKTypeDialog::TypeInfo & v) { - s << v.type << v.params_d << v.params_s; - return s; -} -inline QDataStream & operator >>(QDataStream & s, CDDirectKTypeDialog::TypeInfo & v) { - s >> v.type >> v.params_d >> v.params_s; - return s; -} - -#endif // CDDIRECTK_TYPE_DIALOG_H +#ifndef CDDIRECTK_TYPE_DIALOG_H +#define CDDIRECTK_TYPE_DIALOG_H + +#include +#include "ui_cddirectk_type_dialog.h" + + +class CDDirectKTypeDialog: public QDialog, public Ui::CDDirectKTypeDialog +{ + Q_OBJECT +public: + explicit CDDirectKTypeDialog(QWidget * parent = 0); + ~CDDirectKTypeDialog(); + + struct TypeInfo { + TypeInfo(int type_ = -1); + QWidget * create(); + int type; + QVector params_d; + QVector params_s; + }; + + TypeInfo getType() const; + +private: + +public slots: + +private slots: + +signals: + +}; + +inline QDataStream & operator <<(QDataStream & s, const CDDirectKTypeDialog::TypeInfo & v) { + s << v.type << v.params_d << v.params_s; + return s; +} +inline QDataStream & operator >>(QDataStream & s, CDDirectKTypeDialog::TypeInfo & v) { + s >> v.type >> v.params_d >> v.params_s; + return s; +} + +#endif // CDDIRECTK_TYPE_DIALOG_H diff --git a/qcd_utils/pult/cddirectk_type_dialog.ui b/piqt/utils/cd_pult/cddirectk_type_dialog.ui similarity index 96% rename from qcd_utils/pult/cddirectk_type_dialog.ui rename to piqt/utils/cd_pult/cddirectk_type_dialog.ui index 3c4ac3a..0b5ec15 100644 --- a/qcd_utils/pult/cddirectk_type_dialog.ui +++ b/piqt/utils/cd_pult/cddirectk_type_dialog.ui @@ -1,232 +1,232 @@ - - - CDDirectKTypeDialog - - - - 0 - 0 - 275 - 310 - - - - CD Pult - - - - - - Custom - - - true - - - - - - - QFormLayout::AllNonFixedFieldsGrow - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Type: - - - - - - - - Spin - - - - - Slider - - - - - SpinSlider - - - - - - - - Min: - - - - - - - - - - Max: - - - - - - - 100.000000000000000 - - - - - - - Decimals: - - - - - - - - - - Single step: - - - - - - - 1.000000000000000 - - - - - - - Prefix: - - - - - - - - - - Suffix: - - - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 1 - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - CLineEdit - QLineEdit -
clineedit.h
-
- - EvalSpinBox - QWidget -
evalspinbox.h
-
-
- - - - groupBox - toggled(bool) - widget - setEnabled(bool) - - - 86 - 49 - - - 94 - 91 - - - - - buttonBox - accepted() - CDDirectKTypeDialog - accept() - - - 297 - 285 - - - 315 - 280 - - - - - buttonBox - rejected() - CDDirectKTypeDialog - reject() - - - 281 - 290 - - - 283 - 307 - - - - -
+ + + CDDirectKTypeDialog + + + + 0 + 0 + 275 + 310 + + + + CD Pult + + + + + + Custom + + + true + + + + + + + QFormLayout::AllNonFixedFieldsGrow + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Type: + + + + + + + + Spin + + + + + Slider + + + + + SpinSlider + + + + + + + + Min: + + + + + + + + + + Max: + + + + + + + 100.000000000000000 + + + + + + + Decimals: + + + + + + + + + + Single step: + + + + + + + 1.000000000000000 + + + + + + + Prefix: + + + + + + + + + + Suffix: + + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 1 + + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + CLineEdit + QLineEdit +
clineedit.h
+
+ + EvalSpinBox + QWidget +
evalspinbox.h
+
+
+ + + + groupBox + toggled(bool) + widget + setEnabled(bool) + + + 86 + 49 + + + 94 + 91 + + + + + buttonBox + accepted() + CDDirectKTypeDialog + accept() + + + 297 + 285 + + + 315 + 280 + + + + + buttonBox + rejected() + CDDirectKTypeDialog + reject() + + + 281 + 290 + + + 283 + 307 + + + + +
diff --git a/qcd_utils/pult/cdgraphics.cpp b/piqt/utils/cd_pult/cdgraphics.cpp similarity index 96% rename from qcd_utils/pult/cdgraphics.cpp rename to piqt/utils/cd_pult/cdgraphics.cpp index 0cb72ba..b067683 100644 --- a/qcd_utils/pult/cdgraphics.cpp +++ b/piqt/utils/cd_pult/cdgraphics.cpp @@ -1,354 +1,354 @@ -#include "cdgraphics.h" -//#include "ui_qcd_graphic.h" -#include "cdutils_core.h" -#include "cdutils_x.h" -#include "qcd_core.h" -#include "qcd_model.h" -#include "qcd_graphic.h" -#include "graphic.h" -#include "piqt.h" -#include -#include -#include -#include -#include -#include -#include - -using namespace CDUtils; - - -QStringList CDUtils::getList(const PIVector > & x_list) { - QStringList ret; - piForeachC (PIDeque & p, x_list) - ret << PI2QString(CDCore::pathToString(p)); - return ret; -} - - -PIVector > CDUtils::setList(const QStringList & l) { - PIVector > ret; - foreach (QString s, l) - ret << CDCore::stringToPath(Q2PIString(s)); - return ret; -} - - - - -GDockWidget::GDockWidget(QString title, QMainWindow * p): QDockWidget(title, p) { - da = p; - menu = new QMenu(this); - QAction * a = new QAction(QIcon(":/icons/document-edit.png"), "Rename ...", this); - connect(a, SIGNAL(triggered(bool)), this, SLOT(rename())); - dactions << a; - a = new QAction(QIcon(":/icons/edit-delete.png"), "Remove", this); - connect(a, SIGNAL(triggered(bool)), this, SIGNAL(removeRequest())); - dactions << a; - menu_x = new QMenu(this); - menu_x->setTitle(tr("Remove X")); - graphic = new CDGraphicWidget(); - graphic->graphic()->viewport()->setAcceptDrops(true); - graphic->graphic()->viewport()->installEventFilter(this); - setWidget(graphic); -} - - -void GDockWidget::addX(const CDType & t) { - if (t.cd_type() != CDType::cdX) return; - PIDeque xp = t.path(); - if (x_list.contains(xp)) return; - x_list << xp; - int gind = graphic->graphic()->graphicsCount(); - graphic->graphic()->setGraphicsCount(gind + 1); - graphic->graphic()->setGraphicName(PI2QString(t.pathString().join(".")), gind); -} - - -void GDockWidget::drawX(const PIMap > & data) { - for (int i = 0; i < x_list.size_s(); ++i) { - PIString sp = CDCore::pathToString(x_list[i]); - const PIVector & ch(data[sp]); - for (int j = 0; j < ch.size_s(); ++j) - graphic->graphic()->addPoint(ch[j], i, false); - } - graphic->graphic()->updateGraphics(); -} - - -QByteArray GDockWidget::save() const { - ChunkStream cs; - cs.add(1, windowTitle()) - .add(2, getList(x_list)) - .add(3, graphic->graphic()->save()) - .add(4, graphic->evalSpinBoxHistory()->expression()) - .add(5, graphic->evalSpinBoxVisible()->expression()); - return cs.data(); -} - - -void GDockWidget::load(QByteArray ba) { - if (ba.isEmpty()) return; - ChunkStream cs(ba); - while (!cs.atEnd()) { - switch (cs.read()) { - case 1: setWindowTitle(cs.getData()); break; - case 2: x_list = setList(cs.getData()); break; - case 3: graphic->graphic()->load(cs.getData()); break; - case 4: graphic->evalSpinBoxHistory()->setExpression(cs.getData()); break; - case 5: graphic->evalSpinBoxVisible()->setExpression(cs.getData()); break; - default: break; - } - } -} - - -void GDockWidget::changedGlobal() { - for (int i = 0; i < x_list.size_s(); ++i) { - if (!X.exists(x_list[i])) { - x_list.remove(i); - graphic->graphic()->removeGraphic(i); - --i; - continue; - } - graphic->graphic()->setGraphicName(PI2QString(X[x_list[i]].pathString().join(".")), i); - } -} - - -bool GDockWidget::eventFilter(QObject * o, QEvent * e) { - //if (o == graphic->viewport()) { - switch (e->type()) { - case QEvent::DragMove: { - QDragMoveEvent * de = (QDragMoveEvent*)e; - const QMimeData * mime = de->mimeData(); - //qDebug() << "enter" << mime; - if (!mime) break; - if (!mime->text().startsWith("x")) break; - de->setDropAction(Qt::CopyAction); - de->accept(); - return true; - } break; - case QEvent::DragEnter: { - QDragEnterEvent * de = (QDragEnterEvent*)e; - const QMimeData * mime = de->mimeData(); - //qDebug() << "enter" << mime; - if (!mime) break; - if (!mime->text().startsWith("x")) break; - de->setDropAction(Qt::CopyAction); - de->accept(); - return true; - } break; - case QEvent::Drop: { - QDropEvent * de = (QDropEvent*)e; - const QMimeData * mime = de->mimeData(); - if (!mime) break; - //qDebug() << "drop" << mime->text(); - if (!mime->text().startsWith("x")) break; - addX(X[CDCore::stringToPath(Q2PIString(mime->text().mid(1)))]); - de->accept(); - return true; - } break; - default: break; - } - //} - return QWidget::eventFilter(o, e); -} - - -void GDockWidget::contextMenuEvent(QContextMenuEvent * e) { - if (graphic->graphic()->underMouse()) return; - qDeleteAll(menu_x->actions()); - menu_x->clear(); - for (int i = 0; i < graphic->graphic()->graphicsCount(); ++i) { - QPixmap icon(da->iconSize()); - icon.fill(graphic->graphic()->graphic(i).pen.color()); - QAction * a = new QAction(QIcon(icon), graphic->graphic()->graphic(i).name, this); - a->setData(i); - connect(a, SIGNAL(triggered(bool)), this, SLOT(removeX())); - menu_x->addAction(a); - } - QMenu * mwm = da->createPopupMenu(); - menu->clear(); - menu->addActions(dactions); - menu->addMenu(menu_x); - menu->addSeparator(); - menu->addActions(mwm->actions()); - menu->popup(e->globalPos()); - mwm->deleteLater(); -} - - -CDGraphicWidget * GDockWidget::viewportGraphic(QObject * o) const { - if (!o) return 0; - while (!qobject_cast(o) && o) - o = o->parent(); - return qobject_cast(o); -} - - -void GDockWidget::rename() { - QString nn = QInputDialog::getText(this, tr("Rename area"), tr("New area name:"), - QLineEdit::Normal, windowTitle()); - if (nn.isEmpty()) return; - setWindowTitle(nn); -} - - -void GDockWidget::removeX() { - QAction * a = qobject_cast(sender()); - if (!a) return; - int ind = a->data().toInt(); - if (ind < 0 || ind >= x_list.size_s()) return; - x_list.remove(ind); - graphic->graphic()->removeGraphic(ind); -} - - - - -CDGraphics::CDGraphics(QWidget * parent) : QWidget(parent), Ui::CDGraphics() { - setupUi(this); - da = new QMainWindow(); - da->setWindowFlags(frame->windowFlags()); - da->setDockNestingEnabled(true); - layoutMain->addWidget(da); -} - - -CDGraphics::~CDGraphics() { -} - - -void CDGraphics::reset() { - qDeleteAll(docks); - docks.clear(); -} - - -QByteArray CDGraphics::save() const { - ChunkStream cs; - QVector dstates; - foreach (GDockWidget * d, docks) { - dstates << d->save(); - } - cs.add(1, docks.size()) - .add(2, dstates) - .add(3, da->saveState()); - X.lock(); - cs.add(4, getList(X.enabledList())); - X.unlock(); - cs.add(5, buttonConfigVisible->isChecked()); - return cs.data(); -} - - -void CDGraphics::load(QByteArray ba) { - reset(); - if (ba.isEmpty()) return; - ChunkStream cs(ba); - while (!cs.atEnd()) { - switch (cs.read()) { - case 1: { - int s = cs.getData(); - piForTimes (s) - addGraphic(); - } break; - case 2: { - QVector dstates = cs.getData >(); - for (int i = 0; i < piMini(dstates.size(), docks.size()); ++i) - docks[i]->load(dstates[i]); - } break; - case 3: da->restoreState(cs.getData()); break; - case 4: - X.lock(); - X.setEnabledList(setList(cs.getData())); - X.unlock(); - break; - case 5: - buttonConfigVisible->setChecked(cs.getData()); - break; - default: break; - } - } -} - - -GDockWidget * CDGraphics::graphicDock(Graphic * o) const { - if (!o) return 0; - foreach (GDockWidget * d, docks) - if (d->widget() == o) - return d; - return 0; -} - - -void CDGraphics::addGraphic() { - GDockWidget * dw = new GDockWidget(QString("area %1").arg(docks.size()), da); - connect(dw, SIGNAL(removeRequest()), this, SLOT(removeGraphic())); - connect(buttonConfigVisible, SIGNAL(toggled(bool)), dw->graphic, SLOT(setConfigVisible(bool))); - connect(buttonLegendVisible, SIGNAL(clicked(bool)), dw->graphic->graphic(), SLOT(setLegendVisible(bool))); - connect(buttonBorderInputsVisible, SIGNAL(clicked(bool)), dw->graphic->graphic(), SLOT(setBorderInputsVisible(bool))); - connect(buttonPause, SIGNAL(clicked(bool)), dw->graphic->graphic(), SLOT(setPaused(bool))); - dw->graphic->setConfigVisible(buttonConfigVisible->isChecked()); - dw->graphic->graphic()->setLegendVisible(buttonLegendVisible->isChecked()); - dw->graphic->graphic()->setBorderInputsVisible(buttonBorderInputsVisible->isChecked()); - da->addDockWidget(Qt::RightDockWidgetArea, dw); - docks << dw; - for (int i = 0; i < docks.size(); ++i) - docks[i]->setObjectName(QString("dock_%1").arg(i)); -} - - -void CDGraphics::receivedX() { - PIMap > data; - X.lock(); - PIVector > x_list = X.enabledList(); - PIVector ch; - piForeachC (PIDeque & p, x_list) { - CDType & t(X[p]); - if (t.xmode_rec() == CDType::X_Current) - ch.resize(1).fill(t.toDouble()); - else - ch = t.history; - t.history.clear(); - data[CDCore::pathToString(t.path())] = ch; - } - //piCout << data; - X.unlock(); - foreach (GDockWidget * d, docks) - d->drawX(data); -} - - -void CDGraphics::changedGlobal() { - foreach (GDockWidget * d, docks) - d->changedGlobal(); -} - - -void CDGraphics::removeGraphic() { - GDockWidget * d = qobject_cast(sender()); - if (!d) return; - docks.removeAll(d); - d->deleteLater(); - for (int i = 0; i < docks.size(); ++i) - docks[i]->setObjectName(QString("dock_%1").arg(i)); -} - - -void CDGraphics::on_buttonAdd_clicked() { - addGraphic(); -} - - -void CDGraphics::on_buttonClear_clicked() { - foreach (GDockWidget * d, docks) - d->graphic->graphic()->clear(); -} - - -void CDGraphics::on_buttonRemoveAll_clicked() { - qDeleteAll(docks); - docks.clear(); -} +#include "cdgraphics.h" +//#include "ui_qcd_graphic.h" +#include "cdutils_core.h" +#include "cdutils_x.h" +#include "qcd_core.h" +#include "qcd_model.h" +#include "qcd_graphic.h" +#include "graphic.h" +#include "piqt.h" +#include +#include +#include +#include +#include +#include +#include + +using namespace CDUtils; + + +QStringList CDUtils::getList(const PIVector > & x_list) { + QStringList ret; + piForeachC (PIDeque & p, x_list) + ret << PI2QString(CDCore::pathToString(p)); + return ret; +} + + +PIVector > CDUtils::setList(const QStringList & l) { + PIVector > ret; + foreach (QString s, l) + ret << CDCore::stringToPath(Q2PIString(s)); + return ret; +} + + + + +GDockWidget::GDockWidget(QString title, QMainWindow * p): QDockWidget(title, p) { + da = p; + menu = new QMenu(this); + QAction * a = new QAction(QIcon(":/icons/document-edit.png"), "Rename ...", this); + connect(a, SIGNAL(triggered(bool)), this, SLOT(rename())); + dactions << a; + a = new QAction(QIcon(":/icons/edit-delete.png"), "Remove", this); + connect(a, SIGNAL(triggered(bool)), this, SIGNAL(removeRequest())); + dactions << a; + menu_x = new QMenu(this); + menu_x->setTitle(tr("Remove X")); + graphic = new CDGraphicWidget(); + graphic->graphic()->viewport()->setAcceptDrops(true); + graphic->graphic()->viewport()->installEventFilter(this); + setWidget(graphic); +} + + +void GDockWidget::addX(const CDType & t) { + if (t.cd_type() != CDType::cdX) return; + PIDeque xp = t.path(); + if (x_list.contains(xp)) return; + x_list << xp; + int gind = graphic->graphic()->graphicsCount(); + graphic->graphic()->setGraphicsCount(gind + 1); + graphic->graphic()->setGraphicName(PI2QString(t.pathString().join(".")), gind); +} + + +void GDockWidget::drawX(const PIMap > & data) { + for (int i = 0; i < x_list.size_s(); ++i) { + PIString sp = CDCore::pathToString(x_list[i]); + const PIVector & ch(data[sp]); + for (int j = 0; j < ch.size_s(); ++j) + graphic->graphic()->addPoint(ch[j], i, false); + } + graphic->graphic()->updateGraphics(); +} + + +QByteArray GDockWidget::save() const { + ChunkStream cs; + cs.add(1, windowTitle()) + .add(2, getList(x_list)) + .add(3, graphic->graphic()->save()) + .add(4, graphic->evalSpinBoxHistory()->expression()) + .add(5, graphic->evalSpinBoxVisible()->expression()); + return cs.data(); +} + + +void GDockWidget::load(QByteArray ba) { + if (ba.isEmpty()) return; + ChunkStream cs(ba); + while (!cs.atEnd()) { + switch (cs.read()) { + case 1: setWindowTitle(cs.getData()); break; + case 2: x_list = setList(cs.getData()); break; + case 3: graphic->graphic()->load(cs.getData()); break; + case 4: graphic->evalSpinBoxHistory()->setExpression(cs.getData()); break; + case 5: graphic->evalSpinBoxVisible()->setExpression(cs.getData()); break; + default: break; + } + } +} + + +void GDockWidget::changedGlobal() { + for (int i = 0; i < x_list.size_s(); ++i) { + if (!X.exists(x_list[i])) { + x_list.remove(i); + graphic->graphic()->removeGraphic(i); + --i; + continue; + } + graphic->graphic()->setGraphicName(PI2QString(X[x_list[i]].pathString().join(".")), i); + } +} + + +bool GDockWidget::eventFilter(QObject * o, QEvent * e) { + //if (o == graphic->viewport()) { + switch (e->type()) { + case QEvent::DragMove: { + QDragMoveEvent * de = (QDragMoveEvent*)e; + const QMimeData * mime = de->mimeData(); + //qDebug() << "enter" << mime; + if (!mime) break; + if (!mime->text().startsWith("x")) break; + de->setDropAction(Qt::CopyAction); + de->accept(); + return true; + } break; + case QEvent::DragEnter: { + QDragEnterEvent * de = (QDragEnterEvent*)e; + const QMimeData * mime = de->mimeData(); + //qDebug() << "enter" << mime; + if (!mime) break; + if (!mime->text().startsWith("x")) break; + de->setDropAction(Qt::CopyAction); + de->accept(); + return true; + } break; + case QEvent::Drop: { + QDropEvent * de = (QDropEvent*)e; + const QMimeData * mime = de->mimeData(); + if (!mime) break; + //qDebug() << "drop" << mime->text(); + if (!mime->text().startsWith("x")) break; + addX(X[CDCore::stringToPath(Q2PIString(mime->text().mid(1)))]); + de->accept(); + return true; + } break; + default: break; + } + //} + return QWidget::eventFilter(o, e); +} + + +void GDockWidget::contextMenuEvent(QContextMenuEvent * e) { + if (graphic->graphic()->underMouse()) return; + qDeleteAll(menu_x->actions()); + menu_x->clear(); + for (int i = 0; i < graphic->graphic()->graphicsCount(); ++i) { + QPixmap icon(da->iconSize()); + icon.fill(graphic->graphic()->graphic(i).pen.color()); + QAction * a = new QAction(QIcon(icon), graphic->graphic()->graphic(i).name, this); + a->setData(i); + connect(a, SIGNAL(triggered(bool)), this, SLOT(removeX())); + menu_x->addAction(a); + } + QMenu * mwm = da->createPopupMenu(); + menu->clear(); + menu->addActions(dactions); + menu->addMenu(menu_x); + menu->addSeparator(); + menu->addActions(mwm->actions()); + menu->popup(e->globalPos()); + mwm->deleteLater(); +} + + +CDGraphicWidget * GDockWidget::viewportGraphic(QObject * o) const { + if (!o) return 0; + while (!qobject_cast(o) && o) + o = o->parent(); + return qobject_cast(o); +} + + +void GDockWidget::rename() { + QString nn = QInputDialog::getText(this, tr("Rename area"), tr("New area name:"), + QLineEdit::Normal, windowTitle()); + if (nn.isEmpty()) return; + setWindowTitle(nn); +} + + +void GDockWidget::removeX() { + QAction * a = qobject_cast(sender()); + if (!a) return; + int ind = a->data().toInt(); + if (ind < 0 || ind >= x_list.size_s()) return; + x_list.remove(ind); + graphic->graphic()->removeGraphic(ind); +} + + + + +CDGraphics::CDGraphics(QWidget * parent) : QWidget(parent), Ui::CDGraphics() { + setupUi(this); + da = new QMainWindow(); + da->setWindowFlags(frame->windowFlags()); + da->setDockNestingEnabled(true); + layoutMain->addWidget(da); +} + + +CDGraphics::~CDGraphics() { +} + + +void CDGraphics::reset() { + qDeleteAll(docks); + docks.clear(); +} + + +QByteArray CDGraphics::save() const { + ChunkStream cs; + QVector dstates; + foreach (GDockWidget * d, docks) { + dstates << d->save(); + } + cs.add(1, docks.size()) + .add(2, dstates) + .add(3, da->saveState()); + X.lock(); + cs.add(4, getList(X.enabledList())); + X.unlock(); + cs.add(5, buttonConfigVisible->isChecked()); + return cs.data(); +} + + +void CDGraphics::load(QByteArray ba) { + reset(); + if (ba.isEmpty()) return; + ChunkStream cs(ba); + while (!cs.atEnd()) { + switch (cs.read()) { + case 1: { + int s = cs.getData(); + piForTimes (s) + addGraphic(); + } break; + case 2: { + QVector dstates = cs.getData >(); + for (int i = 0; i < piMini(dstates.size(), docks.size()); ++i) + docks[i]->load(dstates[i]); + } break; + case 3: da->restoreState(cs.getData()); break; + case 4: + X.lock(); + X.setEnabledList(setList(cs.getData())); + X.unlock(); + break; + case 5: + buttonConfigVisible->setChecked(cs.getData()); + break; + default: break; + } + } +} + + +GDockWidget * CDGraphics::graphicDock(Graphic * o) const { + if (!o) return 0; + foreach (GDockWidget * d, docks) + if (d->widget() == o) + return d; + return 0; +} + + +void CDGraphics::addGraphic() { + GDockWidget * dw = new GDockWidget(QString("area %1").arg(docks.size()), da); + connect(dw, SIGNAL(removeRequest()), this, SLOT(removeGraphic())); + connect(buttonConfigVisible, SIGNAL(toggled(bool)), dw->graphic, SLOT(setConfigVisible(bool))); + connect(buttonLegendVisible, SIGNAL(clicked(bool)), dw->graphic->graphic(), SLOT(setLegendVisible(bool))); + connect(buttonBorderInputsVisible, SIGNAL(clicked(bool)), dw->graphic->graphic(), SLOT(setBorderInputsVisible(bool))); + connect(buttonPause, SIGNAL(clicked(bool)), dw->graphic->graphic(), SLOT(setPaused(bool))); + dw->graphic->setConfigVisible(buttonConfigVisible->isChecked()); + dw->graphic->graphic()->setLegendVisible(buttonLegendVisible->isChecked()); + dw->graphic->graphic()->setBorderInputsVisible(buttonBorderInputsVisible->isChecked()); + da->addDockWidget(Qt::RightDockWidgetArea, dw); + docks << dw; + for (int i = 0; i < docks.size(); ++i) + docks[i]->setObjectName(QString("dock_%1").arg(i)); +} + + +void CDGraphics::receivedX() { + PIMap > data; + X.lock(); + PIVector > x_list = X.enabledList(); + PIVector ch; + piForeachC (PIDeque & p, x_list) { + CDType & t(X[p]); + if (t.xmode_rec() == CDType::X_Current) + ch.resize(1).fill(t.toDouble()); + else + ch = t.history; + t.history.clear(); + data[CDCore::pathToString(t.path())] = ch; + } + //piCout << data; + X.unlock(); + foreach (GDockWidget * d, docks) + d->drawX(data); +} + + +void CDGraphics::changedGlobal() { + foreach (GDockWidget * d, docks) + d->changedGlobal(); +} + + +void CDGraphics::removeGraphic() { + GDockWidget * d = qobject_cast(sender()); + if (!d) return; + docks.removeAll(d); + d->deleteLater(); + for (int i = 0; i < docks.size(); ++i) + docks[i]->setObjectName(QString("dock_%1").arg(i)); +} + + +void CDGraphics::on_buttonAdd_clicked() { + addGraphic(); +} + + +void CDGraphics::on_buttonClear_clicked() { + foreach (GDockWidget * d, docks) + d->graphic->graphic()->clear(); +} + + +void CDGraphics::on_buttonRemoveAll_clicked() { + qDeleteAll(docks); + docks.clear(); +} diff --git a/qcd_utils/pult/cdgraphics.h b/piqt/utils/cd_pult/cdgraphics.h similarity index 94% rename from qcd_utils/pult/cdgraphics.h rename to piqt/utils/cd_pult/cdgraphics.h index 33ca214..51e3483 100644 --- a/qcd_utils/pult/cdgraphics.h +++ b/piqt/utils/cd_pult/cdgraphics.h @@ -1,92 +1,92 @@ -#ifndef CDGRAPHICS_H -#define CDGRAPHICS_H - -#include -#include -#include -#include "ui_cdgraphics.h" -#include "qcd_graphic.h" -#include - -namespace CDUtils { - class CDType; - class CDSection; - QStringList getList(const PIVector > & x_list); - PIVector > setList(const QStringList & l); -} - -class QMainWindow; -class Graphic; - - - - -class GDockWidget: public QDockWidget { - Q_OBJECT -public: - GDockWidget(QString title = QString(), QMainWindow * p = 0); - - void addX(const CDUtils::CDType & t); - void drawX(const PIMap > & data); - QByteArray save() const; - void load(QByteArray ba); - void changedGlobal(); - - CDGraphicWidget * graphic; - -private: - bool eventFilter(QObject * o, QEvent * e); - void contextMenuEvent(QContextMenuEvent * e); - CDGraphicWidget * viewportGraphic(QObject * o) const; - - QMenu * menu, * menu_x; - QList dactions; - QMainWindow * da; - PIVector > x_list; - -private slots: - void rename(); - void removeX(); - -signals: - void removeRequest(); - -}; - - - - -class CDGraphics : public QWidget, public Ui::CDGraphics -{ - Q_OBJECT -public: - explicit CDGraphics(QWidget *parent = 0); - ~CDGraphics(); - - void reset(); - QByteArray save() const; - void load(QByteArray ba); - -private: - GDockWidget * graphicDock(Graphic * o) const; - void addXToGraphic(const QString & xp, Graphic * g); - void addGraphic(); - - QList docks; - QMainWindow * da; - -public slots: - void receivedX(); - void changedGlobal(); - -private slots: - void removeGraphic(); - void on_buttonAdd_clicked(); - void on_buttonClear_clicked(); - void on_buttonRemoveAll_clicked(); - -signals: - -}; - -#endif // CDGRAPHICS_H +#ifndef CDGRAPHICS_H +#define CDGRAPHICS_H + +#include +#include +#include +#include "ui_cdgraphics.h" +#include "qcd_graphic.h" +#include + +namespace CDUtils { + class CDType; + class CDSection; + QStringList getList(const PIVector > & x_list); + PIVector > setList(const QStringList & l); +} + +class QMainWindow; +class Graphic; + + + + +class GDockWidget: public QDockWidget { + Q_OBJECT +public: + GDockWidget(QString title = QString(), QMainWindow * p = 0); + + void addX(const CDUtils::CDType & t); + void drawX(const PIMap > & data); + QByteArray save() const; + void load(QByteArray ba); + void changedGlobal(); + + CDGraphicWidget * graphic; + +private: + bool eventFilter(QObject * o, QEvent * e); + void contextMenuEvent(QContextMenuEvent * e); + CDGraphicWidget * viewportGraphic(QObject * o) const; + + QMenu * menu, * menu_x; + QList dactions; + QMainWindow * da; + PIVector > x_list; + +private slots: + void rename(); + void removeX(); + +signals: + void removeRequest(); + +}; + + + + +class CDGraphics : public QWidget, public Ui::CDGraphics +{ + Q_OBJECT +public: + explicit CDGraphics(QWidget *parent = 0); + ~CDGraphics(); + + void reset(); + QByteArray save() const; + void load(QByteArray ba); + +private: + GDockWidget * graphicDock(Graphic * o) const; + void addXToGraphic(const QString & xp, Graphic * g); + void addGraphic(); + + QList docks; + QMainWindow * da; + +public slots: + void receivedX(); + void changedGlobal(); + +private slots: + void removeGraphic(); + void on_buttonAdd_clicked(); + void on_buttonClear_clicked(); + void on_buttonRemoveAll_clicked(); + +signals: + +}; + +#endif // CDGRAPHICS_H diff --git a/qcd_utils/pult/cdgraphics.ui b/piqt/utils/cd_pult/cdgraphics.ui similarity index 96% rename from qcd_utils/pult/cdgraphics.ui rename to piqt/utils/cd_pult/cdgraphics.ui index 9974f72..6a40b06 100644 --- a/qcd_utils/pult/cdgraphics.ui +++ b/piqt/utils/cd_pult/cdgraphics.ui @@ -1,168 +1,168 @@ - - - CDGraphics - - - - 0 - 0 - 624 - 411 - - - - CD Pult - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::StyledPanel - - - - 0 - - - 0 - - - - - Add new - - - - :/icons/list-add.png:/icons/list-add.png - - - - - - - Clear all - - - - :/icons/edit-clear.png:/icons/edit-clear.png - - - - - - - Remove all - - - - :/icons/edit-delete.png:/icons/edit-delete.png - - - - - - - Remove all - - - - :/icons/layer-visible-off.png - :/icons/layer-visible-on.png:/icons/layer-visible-off.png - - - true - - - true - - - - - - - Remove all - - - - :/icons/legend.png:/icons/legend.png - - - true - - - true - - - - - - - Remove all - - - - :/icons/media-playback-pause.png:/icons/media-playback-pause.png - - - true - - - false - - - - - - - Remove all - - - - :/icons/border-line.png:/icons/border-line.png - - - true - - - false - - - - - - - Qt::Horizontal - - - - 1 - 20 - - - - - - - - - - - - - - - - - + + + CDGraphics + + + + 0 + 0 + 624 + 411 + + + + CD Pult + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QFrame::StyledPanel + + + + 0 + + + 0 + + + + + Add new + + + + :/icons/list-add.png:/icons/list-add.png + + + + + + + Clear all + + + + :/icons/edit-clear.png:/icons/edit-clear.png + + + + + + + Remove all + + + + :/icons/edit-delete.png:/icons/edit-delete.png + + + + + + + Remove all + + + + :/icons/layer-visible-off.png + :/icons/layer-visible-on.png:/icons/layer-visible-off.png + + + true + + + true + + + + + + + Remove all + + + + :/icons/legend.png:/icons/legend.png + + + true + + + true + + + + + + + Remove all + + + + :/icons/media-playback-pause.png:/icons/media-playback-pause.png + + + true + + + false + + + + + + + Remove all + + + + :/icons/border-line.png:/icons/border-line.png + + + true + + + false + + + + + + + Qt::Horizontal + + + + 1 + 20 + + + + + + + + + + + + + + + + + diff --git a/piqt/utils/cd_pult/cdpult.qrc b/piqt/utils/cd_pult/cdpult.qrc new file mode 100644 index 0000000..08a59ac --- /dev/null +++ b/piqt/utils/cd_pult/cdpult.qrc @@ -0,0 +1,16 @@ + + + ../../../qad/icons/dialog-information.png + ../../../qad/icons/dialog-cancel.png + ../../../qad/icons/dialog-ok-apply.png + ../../../qad/icons/document-revert.png + ../../../qad/icons/view-refresh.png + ../../../qad/icons/format-stroke-color.png + icons/db-export.png + icons/db-import.png + icons/timer.png + icons/flame.png + icons/Apps-accessories-calculator-icon.png + icons/accessories-text-editor.png + + diff --git a/qcd_utils/pult/cdpultwindow.cpp b/piqt/utils/cd_pult/cdpultwindow.cpp similarity index 97% rename from qcd_utils/pult/cdpultwindow.cpp rename to piqt/utils/cd_pult/cdpultwindow.cpp index ce58fb3..c388c5a 100644 --- a/qcd_utils/pult/cdpultwindow.cpp +++ b/piqt/utils/cd_pult/cdpultwindow.cpp @@ -1,292 +1,292 @@ -#include "edockwidget.h" -#include "cdpultwindow.h" -#include "cdutils_core.h" -#include "cdutils_k.h" -#include "cdutils_x.h" -#include "cdutils_m.h" -#include "qcd_core.h" -#include "qcd_view.h" -#include "qcd_model.h" -#include "qcd_modedialog.h" -#include "chunkstream.h" -#include "qvariantedit.h" -#include "piqt.h" -#include "piqt_highlighter.h" -#include "qcodeedit.h" -#include -#include -#include -#include - -using namespace CDUtils; - - -CDPultWindow::CDPultWindow(QWidget *parent) : EMainWindow(parent), Ui::CDPultWindow() { - setupUi(this); - centralWidget()->hide(); - setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North); - CDCore::instance()->initPult(); - def_config = codeConfig->text(); - checkDefaultConfig->setChecked(true); - new ConfigHighlighter(codeConfig->document()); - widgetK->setType(CDUtils::CDType::cdK); - widgetX->setType(CDUtils::CDType::cdX); - widgetC->setType(CDUtils::CDType::cdC); - widgetM->setType(CDUtils::CDType::cdM); - editFileK->setValue(QVariant::fromValue(QAD::File("", "*.dat"))); - editFileX->setValue(QVariant::fromValue(QAD::File("", "*.dat"))); - editFileC->setValue(QVariant::fromValue(QAD::File("", "*.dat"))); - editFileM->setValue(QVariant::fromValue(QAD::File("", "*.dat"))); - log_icons[CDViewWidget::OKIcon] = QIcon(":/icons/dialog-ok-apply.png"); - log_icons[CDViewWidget::FailIcon] = QIcon(":/icons/dialog-cancel.png"); - log_icons[CDViewWidget::WaitIcon] = QIcon(":/icons/timer.png"); - setRecentMenu(menuOpen_recent); - ribbon = new Ribbon(this); - session.setFile("session_cdpult.conf"); - session.addEntry(this); - session.addEntry(ribbon->tabWidget()); - session.load(); - reset(); - connect(widgetK, SIGNAL(addToLog(CDViewWidget::LogIcon,QString)), this, SLOT(addToLog(CDViewWidget::LogIcon,QString))); - connect(widgetX, SIGNAL(addToLog(CDViewWidget::LogIcon,QString)), this, SLOT(addToLog(CDViewWidget::LogIcon,QString))); - connect(widgetC, SIGNAL(addToLog(CDViewWidget::LogIcon,QString)), this, SLOT(addToLog(CDViewWidget::LogIcon,QString))); - connect(widgetM, SIGNAL(addToLog(CDViewWidget::LogIcon,QString)), this, SLOT(addToLog(CDViewWidget::LogIcon,QString))); - connect(widgetK->view, SIGNAL(changedGlobal()), widgetDirectK, SLOT(changedGlobal())); - connect(widgetX->view, SIGNAL(changedGlobal()), widgetGraphics, SLOT(changedGlobal())); - connect(widgetX->view, SIGNAL(receivedX()), widgetGraphics, SLOT(receivedX())); - connect(widgetM->view, SIGNAL(messageReceived(QString,int,QString)), this, SLOT(messageReceived(QString,int,QString))); - QCDCore::instance()->bindWidget(widgetK->view); - QCDCore::instance()->setDirectKEnabled(true); - X.start(); - if (windowState() == Qt::WindowMinimized) - setWindowState(Qt::WindowNoState); -} - - -CDPultWindow::~CDPultWindow() { -} - - -void CDPultWindow::loadFile(const QString & fp) { - load(fp); -} - - -void CDPultWindow::apply(bool sessions) { - CDCore::instance()->stop(); - widgetK->setFile(editFileK->value().value().file); - widgetX->setFile(editFileX->value().value().file); - widgetC->setFile(editFileC->value().value().file); - widgetM->setFile(editFileM->value().value().file); - if (checkDefaultConfig->isChecked()) - CDCore::instance()->initPult(); - else - CDCore::instance()->init(Q2PIString(codeConfig->text()), true); - widgetX->view->startX(); - if (sessions) { - widgetGraphics->load(session_gr); - widgetDirectK->load(session_dk); - if (!session_mw.isEmpty()) - restoreState(session_mw); - X.lock(); - PIVector > x_list = X.enabledList(); - X.unlock(); - piForeachC (PIDeque & p, x_list) - X.enable(X[p]); - ((CDItemModel*)widgetX->view->model())->updateModel(); - widgetX->view->expandAll(); - } - dockCDKView->setVisible(checkHasK->isChecked()); - dockCDXView->setVisible(checkHasX->isChecked()); - dockCDCView->setVisible(checkHasC->isChecked()); - dockCDMView->setVisible(checkHasM->isChecked()); - QMetaObject::invokeMethod(this, "changedDock", Qt::QueuedConnection); -} - - -void CDPultWindow::closeEvent(QCloseEvent *e) { - EMainWindow::closeEvent(e); - if (!e->isAccepted()) - return; - QApplication::closeAllWindows(); - session.save(); - session.setFile(QString()); -} - - -void CDPultWindow::reset(bool full) { - setWindowTitle(QString("CD Pult")); - widgetK->reset(); - setChanged(false); -} - - -bool CDPultWindow::load(const QString & path) { - qApp->setOverrideCursor(Qt::WaitCursor); - QPIConfig conf(path, QIODevice::ReadOnly); - QAD::File f = editFileK->value().value(); - checkSyncFiles->setChecked(false); - editFileK->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_k").toString(), f.filter))); - editFileX->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_x").toString(), f.filter))); - editFileC->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_c").toString(), f.filter))); - editFileM->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_m").toString(), f.filter))); - checkSyncFiles->setChecked(conf.getValue("sync_files").toBool()); - lineSessionName->setText(conf.getValue("session_name").toString()); - last_icon = conf.getValue("icon_path").toString(); - setAppIcon(conf.getValue("icon").toByteArray()); - checkHasK->setChecked(conf.getValue("has_k").toBool()); - checkHasX->setChecked(conf.getValue("has_x").toBool()); - checkHasC->setChecked(conf.getValue("has_c").toBool()); - checkHasM->setChecked(conf.getValue("has_m").toBool()); - checkDefaultConfig->setChecked(conf.getValue("default_config").toBool()); - codeConfig->setText(QByteArray2QString(conf.getValue("config").toByteArray())); - if (codeConfig->text().isEmpty()) - codeConfig->setText(def_config); - session_gr = conf.getValue("session_gr").toByteArray(); - session_dk = conf.getValue("session_dk").toByteArray(); - session_mw = conf.getValue("session_mw").toByteArray(); - setChanged(false); - file_name = path; - apply(true); - qApp->restoreOverrideCursor(); - return true; -} - - -bool CDPultWindow::save(const QString & path) { - session_gr = widgetGraphics->save(); - session_dk = widgetDirectK->save(); - session_mw = saveState(); - QPIConfig conf(path, QIODevice::ReadWrite); - conf.clear(); - conf.setValue("file_k", editFileK->value().value().file); - conf.setValue("file_x", editFileX->value().value().file); - conf.setValue("file_c", editFileC->value().value().file); - conf.setValue("file_m", editFileM->value().value().file); - conf.setValue("sync_files", checkSyncFiles->isChecked()); - conf.setValue("session_name", lineSessionName->text()); - conf.setValue("icon_path", last_icon); - conf.setValue("icon", appIcon()); - conf.setValue("has_k", checkHasK->isChecked()); - conf.setValue("has_x", checkHasX->isChecked()); - conf.setValue("has_c", checkHasC->isChecked()); - conf.setValue("has_m", checkHasM->isChecked()); - conf.setValue("default_config", checkDefaultConfig->isChecked()); - conf.setValue("config", QString2QByteArray(codeConfig->text())); - conf.setValue("session_gr", session_gr); - conf.setValue("session_dk", session_dk); - conf.setValue("session_mw", session_mw); - file_name = path; - return true; - - //widgetK->setFile(path); - //widgetK->save(); -} - - -void CDPultWindow::loadingSession(QPIConfig & conf) { - setRecentFiles(conf.getValue("recent files").toStringList()); -} - - -void CDPultWindow::savingSession(QPIConfig & conf) { - conf.setValue("recent files", recentFiles()); -} - - -QByteArray CDPultWindow::appIcon() const { - QByteArray ret; - if (icon.isNull()) return ret; - QBuffer buff(&ret); - buff.open(QIODevice::WriteOnly); - icon.save(&buff, "png"); - //qDebug() << "s" << ret.size(); - return ret; -} - - -void CDPultWindow::setAppIcon(QByteArray ba) { - if (ba.isEmpty()) { - icon = QImage(); - setWindowIcon(QIcon()); - return; - } - //qDebug() << "l" << ba.size(); - icon = QImage::fromData(ba); - setWindowIcon(QIcon(QPixmap::fromImage(icon))); - //qDebug() << QApplication::windowIcon().availableSizes(); -} - - -void CDPultWindow::addToLog(CDViewWidget::LogIcon icon, const QString & msg) { - QListWidgetItem * ni = new QListWidgetItem(log_icons[icon], "(" + QTime::currentTime().toString() + ") " + msg); - bool s = listLog->verticalScrollBar()->value() == listLog->verticalScrollBar()->maximum(); - listLog->addItem(ni); - if (s) listLog->scrollToBottom(); -} - - -void CDPultWindow::messageReceived(QString path, int type, QString msg) { - MessageType mt = (MessageType)type; - const CDType & t(M.root()[CDCore::stringToPath(Q2PIString(path))]); - if (t.cd_type() != CDType::cdM) return; - if (mt == MessageBox) - QMessageBox::information(this, windowTitle(), QString("[%1]\n%2").arg(PI2QString(t.name()), msg)); -} - - -void CDPultWindow::on_editFileK_valueChanged(const QVariant & p) { - if (!checkSyncFiles->isChecked()) return; - QFileInfo fi(p.value().file); - if (fi.path().isEmpty()) return; - QString n = fi.baseName(); - QString xn(n), cn(n), mn(n); - if (n.contains("k")) { - xn.replace(n.indexOf("k"), 1, "x"); - cn.replace(n.indexOf("k"), 1, "c"); - mn.replace(n.indexOf("k"), 1, "m"); - } else { - xn += "_x"; - cn += "_c"; - mn += "_m"; - } - QString ext = fi.suffix(), dot, dir; - QString kfn(fi.filePath()); - if (!ext.isEmpty()) { - kfn.chop(ext.size()); - if (kfn.endsWith(".")) { - kfn.chop(1); - dot = "."; - } - } - if (!fi.path().isEmpty() && fi.path() != ".") { - dir = fi.path(); - if (!dir.endsWith("/")) - dir += "/"; - } - QAD::File f = editFileK->value().value(); - f.file = dir + xn + dot + ext; editFileX->setValue(QVariant::fromValue(f)); - f.file = dir + cn + dot + ext; editFileC->setValue(QVariant::fromValue(f)); - f.file = dir + mn + dot + ext; editFileM->setValue(QVariant::fromValue(f)); -} - - -void CDPultWindow::on_buttonSessionApply_clicked() { - apply(false); -} - - -void CDPultWindow::on_lineSessionName_textChanged(const QString & t) { - setWindowTitle(QString("CD Pult - %1").arg(t)); -} - - -void CDPultWindow::on_buttonIcon_clicked() { - QList ifl = QImageReader::supportedImageFormats(); - QStringList sfl; foreach (QByteArray s, ifl) sfl << ("*." + QString(s).toLower()); - QString f = QFileDialog::getOpenFileName(this, tr("Select icon"), last_icon, tr("Images") + " (" + sfl.join(" ") + ")"); - if (f.isEmpty()) return; - last_icon = f; - icon = QImage(last_icon); - setWindowIcon(QIcon(QPixmap::fromImage(icon))); -} +#include "edockwidget.h" +#include "cdpultwindow.h" +#include "cdutils_core.h" +#include "cdutils_k.h" +#include "cdutils_x.h" +#include "cdutils_m.h" +#include "qcd_core.h" +#include "qcd_view.h" +#include "qcd_model.h" +#include "qcd_modedialog.h" +#include "chunkstream.h" +#include "qvariantedit.h" +#include "piqt.h" +#include "piqt_highlighter.h" +#include "qcodeedit.h" +#include +#include +#include +#include + +using namespace CDUtils; + + +CDPultWindow::CDPultWindow(QWidget *parent) : EMainWindow(parent), Ui::CDPultWindow() { + setupUi(this); + centralWidget()->hide(); + setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North); + CDCore::instance()->initPult(); + def_config = codeConfig->text(); + checkDefaultConfig->setChecked(true); + new ConfigHighlighter(codeConfig->document()); + widgetK->setType(CDUtils::CDType::cdK); + widgetX->setType(CDUtils::CDType::cdX); + widgetC->setType(CDUtils::CDType::cdC); + widgetM->setType(CDUtils::CDType::cdM); + editFileK->setValue(QVariant::fromValue(QAD::File("", "*.dat"))); + editFileX->setValue(QVariant::fromValue(QAD::File("", "*.dat"))); + editFileC->setValue(QVariant::fromValue(QAD::File("", "*.dat"))); + editFileM->setValue(QVariant::fromValue(QAD::File("", "*.dat"))); + log_icons[CDViewWidget::OKIcon] = QIcon(":/icons/dialog-ok-apply.png"); + log_icons[CDViewWidget::FailIcon] = QIcon(":/icons/dialog-cancel.png"); + log_icons[CDViewWidget::WaitIcon] = QIcon(":/icons/timer.png"); + setRecentMenu(menuOpen_recent); + ribbon = new Ribbon(this); + session.setFile("session_cdpult.conf"); + session.addEntry(this); + session.addEntry(ribbon->tabWidget()); + session.load(); + reset(); + connect(widgetK, SIGNAL(addToLog(CDViewWidget::LogIcon,QString)), this, SLOT(addToLog(CDViewWidget::LogIcon,QString))); + connect(widgetX, SIGNAL(addToLog(CDViewWidget::LogIcon,QString)), this, SLOT(addToLog(CDViewWidget::LogIcon,QString))); + connect(widgetC, SIGNAL(addToLog(CDViewWidget::LogIcon,QString)), this, SLOT(addToLog(CDViewWidget::LogIcon,QString))); + connect(widgetM, SIGNAL(addToLog(CDViewWidget::LogIcon,QString)), this, SLOT(addToLog(CDViewWidget::LogIcon,QString))); + connect(widgetK->view, SIGNAL(changedGlobal()), widgetDirectK, SLOT(changedGlobal())); + connect(widgetX->view, SIGNAL(changedGlobal()), widgetGraphics, SLOT(changedGlobal())); + connect(widgetX->view, SIGNAL(receivedX()), widgetGraphics, SLOT(receivedX())); + connect(widgetM->view, SIGNAL(messageReceived(QString,int,QString)), this, SLOT(messageReceived(QString,int,QString))); + QCDCore::instance()->bindWidget(widgetK->view); + QCDCore::instance()->setDirectKEnabled(true); + X.start(); + if (windowState() == Qt::WindowMinimized) + setWindowState(Qt::WindowNoState); +} + + +CDPultWindow::~CDPultWindow() { +} + + +void CDPultWindow::loadFile(const QString & fp) { + load(fp); +} + + +void CDPultWindow::apply(bool sessions) { + CDCore::instance()->stop(); + widgetK->setFile(editFileK->value().value().file); + widgetX->setFile(editFileX->value().value().file); + widgetC->setFile(editFileC->value().value().file); + widgetM->setFile(editFileM->value().value().file); + if (checkDefaultConfig->isChecked()) + CDCore::instance()->initPult(); + else + CDCore::instance()->init(Q2PIString(codeConfig->text()), true); + widgetX->view->startX(); + if (sessions) { + widgetGraphics->load(session_gr); + widgetDirectK->load(session_dk); + if (!session_mw.isEmpty()) + restoreState(session_mw); + X.lock(); + PIVector > x_list = X.enabledList(); + X.unlock(); + piForeachC (PIDeque & p, x_list) + X.enable(X[p]); + ((CDItemModel*)widgetX->view->model())->updateModel(); + widgetX->view->expandAll(); + } + dockCDKView->setVisible(checkHasK->isChecked()); + dockCDXView->setVisible(checkHasX->isChecked()); + dockCDCView->setVisible(checkHasC->isChecked()); + dockCDMView->setVisible(checkHasM->isChecked()); + QMetaObject::invokeMethod(this, "changedDock", Qt::QueuedConnection); +} + + +void CDPultWindow::closeEvent(QCloseEvent *e) { + EMainWindow::closeEvent(e); + if (!e->isAccepted()) + return; + QApplication::closeAllWindows(); + session.save(); + session.setFile(QString()); +} + + +void CDPultWindow::reset(bool full) { + setWindowTitle(QString("CD Pult")); + widgetK->reset(); + setChanged(false); +} + + +bool CDPultWindow::load(const QString & path) { + qApp->setOverrideCursor(Qt::WaitCursor); + QPIConfig conf(path, QIODevice::ReadOnly); + QAD::File f = editFileK->value().value(); + checkSyncFiles->setChecked(false); + editFileK->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_k").toString(), f.filter))); + editFileX->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_x").toString(), f.filter))); + editFileC->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_c").toString(), f.filter))); + editFileM->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_m").toString(), f.filter))); + checkSyncFiles->setChecked(conf.getValue("sync_files").toBool()); + lineSessionName->setText(conf.getValue("session_name").toString()); + last_icon = conf.getValue("icon_path").toString(); + setAppIcon(conf.getValue("icon").toByteArray()); + checkHasK->setChecked(conf.getValue("has_k").toBool()); + checkHasX->setChecked(conf.getValue("has_x").toBool()); + checkHasC->setChecked(conf.getValue("has_c").toBool()); + checkHasM->setChecked(conf.getValue("has_m").toBool()); + checkDefaultConfig->setChecked(conf.getValue("default_config").toBool()); + codeConfig->setText(QByteArray2QString(conf.getValue("config").toByteArray())); + if (codeConfig->text().isEmpty()) + codeConfig->setText(def_config); + session_gr = conf.getValue("session_gr").toByteArray(); + session_dk = conf.getValue("session_dk").toByteArray(); + session_mw = conf.getValue("session_mw").toByteArray(); + setChanged(false); + file_name = path; + apply(true); + qApp->restoreOverrideCursor(); + return true; +} + + +bool CDPultWindow::save(const QString & path) { + session_gr = widgetGraphics->save(); + session_dk = widgetDirectK->save(); + session_mw = saveState(); + QPIConfig conf(path, QIODevice::ReadWrite); + conf.clear(); + conf.setValue("file_k", editFileK->value().value().file); + conf.setValue("file_x", editFileX->value().value().file); + conf.setValue("file_c", editFileC->value().value().file); + conf.setValue("file_m", editFileM->value().value().file); + conf.setValue("sync_files", checkSyncFiles->isChecked()); + conf.setValue("session_name", lineSessionName->text()); + conf.setValue("icon_path", last_icon); + conf.setValue("icon", appIcon()); + conf.setValue("has_k", checkHasK->isChecked()); + conf.setValue("has_x", checkHasX->isChecked()); + conf.setValue("has_c", checkHasC->isChecked()); + conf.setValue("has_m", checkHasM->isChecked()); + conf.setValue("default_config", checkDefaultConfig->isChecked()); + conf.setValue("config", QString2QByteArray(codeConfig->text())); + conf.setValue("session_gr", session_gr); + conf.setValue("session_dk", session_dk); + conf.setValue("session_mw", session_mw); + file_name = path; + return true; + + //widgetK->setFile(path); + //widgetK->save(); +} + + +void CDPultWindow::loadingSession(QPIConfig & conf) { + setRecentFiles(conf.getValue("recent files").toStringList()); +} + + +void CDPultWindow::savingSession(QPIConfig & conf) { + conf.setValue("recent files", recentFiles()); +} + + +QByteArray CDPultWindow::appIcon() const { + QByteArray ret; + if (icon.isNull()) return ret; + QBuffer buff(&ret); + buff.open(QIODevice::WriteOnly); + icon.save(&buff, "png"); + //qDebug() << "s" << ret.size(); + return ret; +} + + +void CDPultWindow::setAppIcon(QByteArray ba) { + if (ba.isEmpty()) { + icon = QImage(); + setWindowIcon(QIcon()); + return; + } + //qDebug() << "l" << ba.size(); + icon = QImage::fromData(ba); + setWindowIcon(QIcon(QPixmap::fromImage(icon))); + //qDebug() << QApplication::windowIcon().availableSizes(); +} + + +void CDPultWindow::addToLog(CDViewWidget::LogIcon icon, const QString & msg) { + QListWidgetItem * ni = new QListWidgetItem(log_icons[icon], "(" + QTime::currentTime().toString() + ") " + msg); + bool s = listLog->verticalScrollBar()->value() == listLog->verticalScrollBar()->maximum(); + listLog->addItem(ni); + if (s) listLog->scrollToBottom(); +} + + +void CDPultWindow::messageReceived(QString path, int type, QString msg) { + MessageType mt = (MessageType)type; + const CDType & t(M.root()[CDCore::stringToPath(Q2PIString(path))]); + if (t.cd_type() != CDType::cdM) return; + if (mt == MessageBox) + QMessageBox::information(this, windowTitle(), QString("[%1]\n%2").arg(PI2QString(t.name()), msg)); +} + + +void CDPultWindow::on_editFileK_valueChanged(const QVariant & p) { + if (!checkSyncFiles->isChecked()) return; + QFileInfo fi(p.value().file); + if (fi.path().isEmpty()) return; + QString n = fi.baseName(); + QString xn(n), cn(n), mn(n); + if (n.contains("k")) { + xn.replace(n.indexOf("k"), 1, "x"); + cn.replace(n.indexOf("k"), 1, "c"); + mn.replace(n.indexOf("k"), 1, "m"); + } else { + xn += "_x"; + cn += "_c"; + mn += "_m"; + } + QString ext = fi.suffix(), dot, dir; + QString kfn(fi.filePath()); + if (!ext.isEmpty()) { + kfn.chop(ext.size()); + if (kfn.endsWith(".")) { + kfn.chop(1); + dot = "."; + } + } + if (!fi.path().isEmpty() && fi.path() != ".") { + dir = fi.path(); + if (!dir.endsWith("/")) + dir += "/"; + } + QAD::File f = editFileK->value().value(); + f.file = dir + xn + dot + ext; editFileX->setValue(QVariant::fromValue(f)); + f.file = dir + cn + dot + ext; editFileC->setValue(QVariant::fromValue(f)); + f.file = dir + mn + dot + ext; editFileM->setValue(QVariant::fromValue(f)); +} + + +void CDPultWindow::on_buttonSessionApply_clicked() { + apply(false); +} + + +void CDPultWindow::on_lineSessionName_textChanged(const QString & t) { + setWindowTitle(QString("CD Pult - %1").arg(t)); +} + + +void CDPultWindow::on_buttonIcon_clicked() { + QList ifl = QImageReader::supportedImageFormats(); + QStringList sfl; foreach (QByteArray s, ifl) sfl << ("*." + QString(s).toLower()); + QString f = QFileDialog::getOpenFileName(this, tr("Select icon"), last_icon, tr("Images") + " (" + sfl.join(" ") + ")"); + if (f.isEmpty()) return; + last_icon = f; + icon = QImage(last_icon); + setWindowIcon(QIcon(QPixmap::fromImage(icon))); +} diff --git a/qcd_utils/pult/cdpultwindow.h b/piqt/utils/cd_pult/cdpultwindow.h similarity index 96% rename from qcd_utils/pult/cdpultwindow.h rename to piqt/utils/cd_pult/cdpultwindow.h index 6e8c499..dad2c2b 100644 --- a/qcd_utils/pult/cdpultwindow.h +++ b/piqt/utils/cd_pult/cdpultwindow.h @@ -1,53 +1,53 @@ -#ifndef CDPULTWINDOW_H -#define CDPULTWINDOW_H - -#include "emainwindow.h" -#include "ui_cdpultwindow.h" -#include "cdviewwidget.h" -#include "ribbon.h" -#include "piobject.h" - - -class CDPultWindow : public EMainWindow, public Ui::CDPultWindow -{ - Q_OBJECT - Q_ENUMS(LogIcon) -public: - - explicit CDPultWindow(QWidget *parent = 0); - ~CDPultWindow(); - void loadFile(const QString & fp); - void apply(bool sessions); - -private: - - void closeEvent(QCloseEvent *); - void reset(bool full = false); - bool load(const QString & path); - bool save(const QString & path); - QString loadFilter() {return "Pult session(*.conf)";} - QString saveFilter() {return loadFilter();} - void loadingSession(QPIConfig & conf); - void savingSession(QPIConfig & conf); - - QByteArray appIcon() const; - void setAppIcon(QByteArray ba); - - Ribbon * ribbon; - QMap log_icons; - QByteArray session_gr, session_dk, session_mw; - QString def_config, last_icon; - QImage icon; - -private slots: - void addToLog(CDViewWidget::LogIcon icon, const QString & msg); - void messageReceived(QString path, int type, QString msg); - - void on_editFileK_valueChanged(const QVariant & p); - void on_buttonSessionApply_clicked(); - - void on_lineSessionName_textChanged(const QString & t); - void on_buttonIcon_clicked(); -}; - -#endif // CDPULTWINDOW_H +#ifndef CDPULTWINDOW_H +#define CDPULTWINDOW_H + +#include "emainwindow.h" +#include "ui_cdpultwindow.h" +#include "cdviewwidget.h" +#include "ribbon.h" +#include "piobject.h" + + +class CDPultWindow : public EMainWindow, public Ui::CDPultWindow +{ + Q_OBJECT + Q_ENUMS(LogIcon) +public: + + explicit CDPultWindow(QWidget *parent = 0); + ~CDPultWindow(); + void loadFile(const QString & fp); + void apply(bool sessions); + +private: + + void closeEvent(QCloseEvent *); + void reset(bool full = false); + bool load(const QString & path); + bool save(const QString & path); + QString loadFilter() {return "Pult session(*.conf)";} + QString saveFilter() {return loadFilter();} + void loadingSession(QPIConfig & conf); + void savingSession(QPIConfig & conf); + + QByteArray appIcon() const; + void setAppIcon(QByteArray ba); + + Ribbon * ribbon; + QMap log_icons; + QByteArray session_gr, session_dk, session_mw; + QString def_config, last_icon; + QImage icon; + +private slots: + void addToLog(CDViewWidget::LogIcon icon, const QString & msg); + void messageReceived(QString path, int type, QString msg); + + void on_editFileK_valueChanged(const QVariant & p); + void on_buttonSessionApply_clicked(); + + void on_lineSessionName_textChanged(const QString & t); + void on_buttonIcon_clicked(); +}; + +#endif // CDPULTWINDOW_H diff --git a/qcd_utils/pult/cdpultwindow.ui b/piqt/utils/cd_pult/cdpultwindow.ui similarity index 96% rename from qcd_utils/pult/cdpultwindow.ui rename to piqt/utils/cd_pult/cdpultwindow.ui index e7a1904..ee0273c 100644 --- a/qcd_utils/pult/cdpultwindow.ui +++ b/piqt/utils/cd_pult/cdpultwindow.ui @@ -1,612 +1,612 @@ - - - CDPultWindow - - - - 0 - 0 - 798 - 593 - - - - CD Pult - - - true - - - QMainWindow::AllowNestedDocks|QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks - - - - - - 0 - 0 - 798 - 24 - - - - - Main - - - - Open recent - - - - :/icons/document-open-recent.png:/icons/document-open-recent.png - - - - - - - - - - - - - :/icons/document-edit.png:/icons/document-edit.png - - - K - - - 1 - - - - - 0 - - - - - - - - - - - :/icons/dialog-information.png:/icons/dialog-information.png - - - Log - - - 8 - - - - - - - QAbstractItemView::NoEditTriggers - - - false - - - true - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - QAbstractItemView::ScrollPerPixel - - - QAbstractItemView::ScrollPerPixel - - - - - - - - - - :/icons/qvariantedit.png:/icons/qvariantedit.png - - - X - - - 1 - - - - - - - - - - - - - :/icons/configure.png:/icons/configure.png - - - Session - - - 2 - - - - - - - Apply - - - - :/icons/dialog-ok-apply.png:/icons/dialog-ok-apply.png - - - - - - - QFormLayout::AllNonFixedFieldsGrow - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - Name: - - - - - - - - - - - - Select icon... - - - - :/icons/view-preview.png:/icons/view-preview.png - - - - - - - - - K file: - - - - - - - - - - X file: - - - - - - - - - - C file: - - - - - - - - - - Sync files - - - - - - - - - K - - - - - - - X - - - - - - - C - - - - - - - M - - - - - - - - - Default config - - - - - - - M file: - - - - - - - - - - - - - 0 - 0 - - - - include = ip.conf -[connection] -device.cd = eth://udp:${ip.pult}:27002:${ip.app}:27001 #s -[] - - - - - DejaVu Sans Mono - 9 - - - - - - - - - - - :/icons/legend.png:/icons/legend.png - - - C - - - 1 - - - - - - - - - - - - - :/icons/format-stroke-color.png:/icons/format-stroke-color.png - - - Graphics - - - 8 - - - - - - - - - - - - - :/icons/tools-wizard.png:/icons/tools-wizard.png - - - Direct K - - - 8 - - - - - - - - - - - - - :/icons/accessories-text-editor.png:/icons/accessories-text-editor.png - - - M - - - 1 - - - - - - - - - - - - - :/icons/document-open.png:/icons/document-open.png - - - Open... - - - Ctrl+O - - - - - - :/icons/document-save.png:/icons/document-save.png - - - Save - - - Ctrl+S - - - - - - :/icons/document-save-as.png:/icons/document-save-as.png - - - Save As... - - - Ctrl+Shift+S - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EMainWindow - QMainWindow -
emainwindow.h
- 1 -
- - CLineEdit - QLineEdit -
clineedit.h
-
- - QCodeEdit - QWidget -
qcodeedit.h
-
- - QVariantEdit - QWidget -
qvariantedit.h
-
- - EDockWidget - QDockWidget -
edockwidget.h
- 1 -
- - CDViewWidget - QWidget -
cdviewwidget.h
- 1 -
- - CDGraphics - QWidget -
cdgraphics.h
- 1 -
- - CDDirectK - QWidget -
cddirectk.h
- 1 -
-
- - - - - - - - - actionSave - triggered() - CDPultWindow - saveFile() - - - -1 - -1 - - - 399 - 299 - - - - - actionSaveAs - triggered() - CDPultWindow - saveAsFile() - - - -1 - -1 - - - 399 - 299 - - - - - actionOpen - triggered() - CDPultWindow - openFile() - - - -1 - -1 - - - 399 - 299 - - - - - checkSyncFiles - toggled(bool) - editFileX - setDisabled(bool) - - - 786 - 220 - - - 786 - 151 - - - - - checkSyncFiles - toggled(bool) - editFileC - setDisabled(bool) - - - 786 - 220 - - - 786 - 172 - - - - - checkDefaultConfig - toggled(bool) - codeConfig - setDisabled(bool) - - - 786 - 276 - - - 581 - 304 - - - - - checkSyncFiles - toggled(bool) - editFileM - setDisabled(bool) - - - 767 - 205 - - - 767 - 187 - - - - -
+ + + CDPultWindow + + + + 0 + 0 + 798 + 593 + + + + CD Pult + + + true + + + QMainWindow::AllowNestedDocks|QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks + + + + + + 0 + 0 + 798 + 24 + + + + + Main + + + + Open recent + + + + :/icons/document-open-recent.png:/icons/document-open-recent.png + + + + + + + + + + + + + :/icons/document-edit.png:/icons/document-edit.png + + + K + + + 1 + + + + + 0 + + + + + + + + + + + :/icons/dialog-information.png:/icons/dialog-information.png + + + Log + + + 8 + + + + + + + QAbstractItemView::NoEditTriggers + + + false + + + true + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + QAbstractItemView::ScrollPerPixel + + + QAbstractItemView::ScrollPerPixel + + + + + + + + + + :/icons/qvariantedit.png:/icons/qvariantedit.png + + + X + + + 1 + + + + + + + + + + + + + :/icons/configure.png:/icons/configure.png + + + Session + + + 2 + + + + + + + Apply + + + + :/icons/dialog-ok-apply.png:/icons/dialog-ok-apply.png + + + + + + + QFormLayout::AllNonFixedFieldsGrow + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + Name: + + + + + + + + + + + + Select icon... + + + + :/icons/view-preview.png:/icons/view-preview.png + + + + + + + + + K file: + + + + + + + + + + X file: + + + + + + + + + + C file: + + + + + + + + + + Sync files + + + + + + + + + K + + + + + + + X + + + + + + + C + + + + + + + M + + + + + + + + + Default config + + + + + + + M file: + + + + + + + + + + + + + 0 + 0 + + + + include = ip.conf +[connection] +device.cd = eth://udp:${ip.pult}:27002:${ip.app}:27001 #s +[] + + + + + DejaVu Sans Mono + 9 + + + + + + + + + + + :/icons/legend.png:/icons/legend.png + + + C + + + 1 + + + + + + + + + + + + + :/icons/format-stroke-color.png:/icons/format-stroke-color.png + + + Graphics + + + 8 + + + + + + + + + + + + + :/icons/tools-wizard.png:/icons/tools-wizard.png + + + Direct K + + + 8 + + + + + + + + + + + + + :/icons/accessories-text-editor.png:/icons/accessories-text-editor.png + + + M + + + 1 + + + + + + + + + + + + + :/icons/document-open.png:/icons/document-open.png + + + Open... + + + Ctrl+O + + + + + + :/icons/document-save.png:/icons/document-save.png + + + Save + + + Ctrl+S + + + + + + :/icons/document-save-as.png:/icons/document-save-as.png + + + Save As... + + + Ctrl+Shift+S + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EMainWindow + QMainWindow +
emainwindow.h
+ 1 +
+ + CLineEdit + QLineEdit +
clineedit.h
+
+ + QCodeEdit + QWidget +
qcodeedit.h
+
+ + QVariantEdit + QWidget +
qvariantedit.h
+
+ + EDockWidget + QDockWidget +
edockwidget.h
+ 1 +
+ + CDViewWidget + QWidget +
cdviewwidget.h
+ 1 +
+ + CDGraphics + QWidget +
cdgraphics.h
+ 1 +
+ + CDDirectK + QWidget +
cddirectk.h
+ 1 +
+
+ + + + + + + + + actionSave + triggered() + CDPultWindow + saveFile() + + + -1 + -1 + + + 399 + 299 + + + + + actionSaveAs + triggered() + CDPultWindow + saveAsFile() + + + -1 + -1 + + + 399 + 299 + + + + + actionOpen + triggered() + CDPultWindow + openFile() + + + -1 + -1 + + + 399 + 299 + + + + + checkSyncFiles + toggled(bool) + editFileX + setDisabled(bool) + + + 786 + 220 + + + 786 + 151 + + + + + checkSyncFiles + toggled(bool) + editFileC + setDisabled(bool) + + + 786 + 220 + + + 786 + 172 + + + + + checkDefaultConfig + toggled(bool) + codeConfig + setDisabled(bool) + + + 786 + 276 + + + 581 + 304 + + + + + checkSyncFiles + toggled(bool) + editFileM + setDisabled(bool) + + + 767 + 205 + + + 767 + 187 + + + + +
diff --git a/qcd_utils/pult/cdviewwidget.cpp b/piqt/utils/cd_pult/cdviewwidget.cpp similarity index 96% rename from qcd_utils/pult/cdviewwidget.cpp rename to piqt/utils/cd_pult/cdviewwidget.cpp index a01c87a..67fa124 100644 --- a/qcd_utils/pult/cdviewwidget.cpp +++ b/piqt/utils/cd_pult/cdviewwidget.cpp @@ -1,78 +1,78 @@ -#include "cdviewwidget.h" -#include "cdutils_core.h" -#include "qcd_core.h" -#include "qcd_model.h" -#include "qcd_modedialog.h" -#include "qvariantedit.h" -#include - - -CDViewWidget::CDViewWidget(QWidget * parent) : QWidget(parent), Ui::CDViewWidget() { - qRegisterMetaType("CDViewWidget::LogIcon"); - setupUi(this); - connect(view, SIGNAL(sendSucceed()), this, SLOT(sended())); - connect(view, SIGNAL(receiveSucceed()), this, SLOT(received())); - connect(view, SIGNAL(sendFailed()), this, SLOT(sendFailed())); - connect(view, SIGNAL(receiveFailed()), this, SLOT(receiveFailed())); -} - - -CDViewWidget::~CDViewWidget() { -} - - -void CDViewWidget::reset() { - setFile(""); -} - - -void CDViewWidget::setType(int t) { - view->setType((CDUtils::CDType::cdT)t); - tl_u = view->typeLetter().toUpper(); - tl_l = view->typeLetter().toLower(); - view->refresh(); -} - - -void CDViewWidget::setFile(const QString & f) { - view->setFile(f); - view->load(); -} - - -void CDViewWidget::on_buttonSend_clicked() { - if (view->inProgress()) {addToLog(WaitIcon, "processing..."); return;} - addToLog(WaitIcon, "Sending " + tl_u + "..."); - view->send(); -} - - -void CDViewWidget::on_buttonReceive_clicked() { - if (view->inProgress()) {addToLog(WaitIcon, "processing..."); return;} - addToLog(WaitIcon, "Receiving " + tl_u + "..."); - view->receive(); -} - - -void CDViewWidget::on_buttonLoad_clicked() { - view->load(); -} - - -void CDViewWidget::on_buttonSave_clicked() { - view->save(); -} - - -void CDViewWidget::on_buttonParse_clicked() { - QString path = QFileDialog::getOpenFileName(this, "Select header file", "", - QString("%1 Description(%2_description.h);;Headers(*.h)").arg(tl_u, tl_l)); - if (path.isEmpty()) return; - CDUtils::UpdateModeFlags mode = CDUtils::SaveByName; - if (!view->root()->isEmpty()) { - QCDModeDialog cdm; - if (cdm.exec() != QDialog::Accepted) return; - mode = cdm.mode(); - } - view->buildFromHeader(path, mode); -} +#include "cdviewwidget.h" +#include "cdutils_core.h" +#include "qcd_core.h" +#include "qcd_model.h" +#include "qcd_modedialog.h" +#include "qvariantedit.h" +#include + + +CDViewWidget::CDViewWidget(QWidget * parent) : QWidget(parent), Ui::CDViewWidget() { + qRegisterMetaType("CDViewWidget::LogIcon"); + setupUi(this); + connect(view, SIGNAL(sendSucceed()), this, SLOT(sended())); + connect(view, SIGNAL(receiveSucceed()), this, SLOT(received())); + connect(view, SIGNAL(sendFailed()), this, SLOT(sendFailed())); + connect(view, SIGNAL(receiveFailed()), this, SLOT(receiveFailed())); +} + + +CDViewWidget::~CDViewWidget() { +} + + +void CDViewWidget::reset() { + setFile(""); +} + + +void CDViewWidget::setType(int t) { + view->setType((CDUtils::CDType::cdT)t); + tl_u = view->typeLetter().toUpper(); + tl_l = view->typeLetter().toLower(); + view->refresh(); +} + + +void CDViewWidget::setFile(const QString & f) { + view->setFile(f); + view->load(); +} + + +void CDViewWidget::on_buttonSend_clicked() { + if (view->inProgress()) {addToLog(WaitIcon, "processing..."); return;} + addToLog(WaitIcon, "Sending " + tl_u + "..."); + view->send(); +} + + +void CDViewWidget::on_buttonReceive_clicked() { + if (view->inProgress()) {addToLog(WaitIcon, "processing..."); return;} + addToLog(WaitIcon, "Receiving " + tl_u + "..."); + view->receive(); +} + + +void CDViewWidget::on_buttonLoad_clicked() { + view->load(); +} + + +void CDViewWidget::on_buttonSave_clicked() { + view->save(); +} + + +void CDViewWidget::on_buttonParse_clicked() { + QString path = QFileDialog::getOpenFileName(this, "Select header file", "", + QString("%1 Description(%2_description.h);;Headers(*.h)").arg(tl_u, tl_l)); + if (path.isEmpty()) return; + CDUtils::UpdateModeFlags mode = CDUtils::SaveByName; + if (!view->root()->isEmpty()) { + QCDModeDialog cdm; + if (cdm.exec() != QDialog::Accepted) return; + mode = cdm.mode(); + } + view->buildFromHeader(path, mode); +} diff --git a/qcd_utils/pult/cdviewwidget.h b/piqt/utils/cd_pult/cdviewwidget.h similarity index 96% rename from qcd_utils/pult/cdviewwidget.h rename to piqt/utils/cd_pult/cdviewwidget.h index 3145666..9b1abb1 100644 --- a/qcd_utils/pult/cdviewwidget.h +++ b/piqt/utils/cd_pult/cdviewwidget.h @@ -1,41 +1,41 @@ -#ifndef CDVIEWWIDGET_H -#define CDVIEWWIDGET_H - -#include -#include "ui_cdviewwidget.h" - - -class CDViewWidget : public QWidget, public Ui::CDViewWidget -{ - Q_OBJECT -public: - explicit CDViewWidget(QWidget *parent = 0); - ~CDViewWidget(); - - enum LogIcon {NoIcon, OKIcon, FailIcon, WaitIcon}; - - void reset(); - void setType(int t); - void setFile(const QString & f); - -private: - QString tl_u, tl_l; - -private slots: - void sended() {addToLog(OKIcon, tl_u + " " + tr("sended succesfull"));} - void received() {addToLog(OKIcon, tl_u + " " + tr("received succesfull"));} - void sendFailed() {addToLog(FailIcon, tl_u + " " + tr("NOT sended"));} - void receiveFailed() {addToLog(FailIcon, tl_u + " " + tr("NOT received"));} - void on_buttonSend_clicked(); - void on_buttonReceive_clicked(); - void on_buttonLoad_clicked(); - void on_buttonSave_clicked(); - void on_buttonParse_clicked(); - //void on_buttonCalculate_clicked(); - -signals: - void addToLog(CDViewWidget::LogIcon icon, const QString & msg); - -}; - -#endif // CDVIEWWIDGET_H +#ifndef CDVIEWWIDGET_H +#define CDVIEWWIDGET_H + +#include +#include "ui_cdviewwidget.h" + + +class CDViewWidget : public QWidget, public Ui::CDViewWidget +{ + Q_OBJECT +public: + explicit CDViewWidget(QWidget *parent = 0); + ~CDViewWidget(); + + enum LogIcon {NoIcon, OKIcon, FailIcon, WaitIcon}; + + void reset(); + void setType(int t); + void setFile(const QString & f); + +private: + QString tl_u, tl_l; + +private slots: + void sended() {addToLog(OKIcon, tl_u + " " + tr("sended succesfull"));} + void received() {addToLog(OKIcon, tl_u + " " + tr("received succesfull"));} + void sendFailed() {addToLog(FailIcon, tl_u + " " + tr("NOT sended"));} + void receiveFailed() {addToLog(FailIcon, tl_u + " " + tr("NOT received"));} + void on_buttonSend_clicked(); + void on_buttonReceive_clicked(); + void on_buttonLoad_clicked(); + void on_buttonSave_clicked(); + void on_buttonParse_clicked(); + //void on_buttonCalculate_clicked(); + +signals: + void addToLog(CDViewWidget::LogIcon icon, const QString & msg); + +}; + +#endif // CDVIEWWIDGET_H diff --git a/qcd_utils/pult/cdviewwidget.ui b/piqt/utils/cd_pult/cdviewwidget.ui similarity index 96% rename from qcd_utils/pult/cdviewwidget.ui rename to piqt/utils/cd_pult/cdviewwidget.ui index 5b0ff0b..eb2d44c 100644 --- a/qcd_utils/pult/cdviewwidget.ui +++ b/piqt/utils/cd_pult/cdviewwidget.ui @@ -1,176 +1,176 @@ - - - CDViewWidget - - - - 0 - 0 - 689 - 459 - - - - CD Pult - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - Send - - - - :/icons/flame.png:/icons/flame.png - - - - - - - Receive - - - - :/icons/document-revert.png:/icons/document-revert.png - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 20 - 20 - - - - - - - - Load - - - - :/icons/document-open.png:/icons/document-open.png - - - - - - - Save - - - - :/icons/document-save.png:/icons/document-save.png - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 20 - 20 - - - - - - - - Update description ... - - - - :/icons/view-refresh.png:/icons/view-refresh.png - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 1 - 20 - - - - - - - - - - - - Qt::CustomContextMenu - - - QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed - - - true - - - QAbstractItemView::DragOnly - - - QAbstractItemView::ScrollPerPixel - - - QAbstractItemView::ScrollPerPixel - - - - - - - - CDView - QTreeView -
qcd_view.h
-
-
- - - - - -
+ + + CDViewWidget + + + + 0 + 0 + 689 + 459 + + + + CD Pult + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + Send + + + + :/icons/flame.png:/icons/flame.png + + + + + + + Receive + + + + :/icons/document-revert.png:/icons/document-revert.png + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 20 + 20 + + + + + + + + Load + + + + :/icons/document-open.png:/icons/document-open.png + + + + + + + Save + + + + :/icons/document-save.png:/icons/document-save.png + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 20 + 20 + + + + + + + + Update description ... + + + + :/icons/view-refresh.png:/icons/view-refresh.png + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 1 + 20 + + + + + + + + + + + + Qt::CustomContextMenu + + + QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed + + + true + + + QAbstractItemView::DragOnly + + + QAbstractItemView::ScrollPerPixel + + + QAbstractItemView::ScrollPerPixel + + + + + + + + CDView + QTreeView +
qcd_view.h
+
+
+ + + + + +
diff --git a/piqt_utils/piconnedit/icons/Apps-accessories-calculator-icon.png b/piqt/utils/cd_pult/icons/Apps-accessories-calculator-icon.png similarity index 100% rename from piqt_utils/piconnedit/icons/Apps-accessories-calculator-icon.png rename to piqt/utils/cd_pult/icons/Apps-accessories-calculator-icon.png diff --git a/qcd_utils/pult/icons/accessories-text-editor.png b/piqt/utils/cd_pult/icons/accessories-text-editor.png similarity index 100% rename from qcd_utils/pult/icons/accessories-text-editor.png rename to piqt/utils/cd_pult/icons/accessories-text-editor.png diff --git a/qcd_utils/pult/icons/db-export.png b/piqt/utils/cd_pult/icons/db-export.png similarity index 100% rename from qcd_utils/pult/icons/db-export.png rename to piqt/utils/cd_pult/icons/db-export.png diff --git a/qcd_utils/pult/icons/db-import.png b/piqt/utils/cd_pult/icons/db-import.png similarity index 100% rename from qcd_utils/pult/icons/db-import.png rename to piqt/utils/cd_pult/icons/db-import.png diff --git a/qcd_utils/pult/icons/flame.png b/piqt/utils/cd_pult/icons/flame.png similarity index 100% rename from qcd_utils/pult/icons/flame.png rename to piqt/utils/cd_pult/icons/flame.png diff --git a/qcd_utils/pult/icons/timer.png b/piqt/utils/cd_pult/icons/timer.png similarity index 100% rename from qcd_utils/pult/icons/timer.png rename to piqt/utils/cd_pult/icons/timer.png diff --git a/qcd_utils/pult/main.cpp b/piqt/utils/cd_pult/main.cpp similarity index 97% rename from qcd_utils/pult/main.cpp rename to piqt/utils/cd_pult/main.cpp index e40a74c..505f4d0 100644 --- a/qcd_utils/pult/main.cpp +++ b/piqt/utils/cd_pult/main.cpp @@ -1,373 +1,373 @@ -#include -#include "cdpultwindow.h" - -template -class PIHash { - //template friend PIByteArray & operator >>(PIByteArray & s, PIHash & v); - //template friend PIByteArray & operator <<(PIByteArray & s, const PIHash & v); -public: - PIHash() {;} - PIHash(const PIHash & other) {*this = other;} - virtual ~PIHash() {;} - - PIHash & operator =(const PIHash & other) { - if (this == &other) return *this; - clear(); - pih_content = other.pih_content; - return *this; - } - - typedef T mapped_type; - typedef Key key_type; - typedef PIPair value_type; -/* - class iterator { - friend class PIHash; - private: - iterator(const PIHash * v, ssize_t p): parent(v), pos(p) {} - const PIHash * parent; - ssize_t pos; - public: - iterator(): parent(0), pos(0) {} - const Key & key() const {return const_cast * >(parent)->_key(pos);} - T & value() {return const_cast * >(parent)->_value(pos);} - void operator ++() {++pos;} - void operator ++(int) {++pos;} - void operator --() {--pos;} - void operator --(int) {--pos;} - bool operator ==(const iterator & it) const {return (pos == it.pos);} - bool operator !=(const iterator & it) const {return (pos != it.pos);} - }; - - class reverse_iterator { - friend class PIHash; - private: - reverse_iterator(const PIHash * v, ssize_t p): parent(v), pos(p) {} - const PIHash * parent; - ssize_t pos; - public: - reverse_iterator(): parent(0), pos(0) {} - const Key & key() const {return const_cast * >(parent)->_key(pos);} - T & value() const {return const_cast * >(parent)->_value(pos);} - void operator ++() {--pos;} - void operator ++(int) {--pos;} - void operator --() {++pos;} - void operator --(int) {++pos;} - bool operator ==(const reverse_iterator & it) const {return (pos == it.pos);} - bool operator !=(const reverse_iterator & it) const {return (pos != it.pos);} - }; -*/ - class const_iterator { - friend class PIHash; - private: - const_iterator(const PIHash * v, ssize_t p): parent(v), pos(p), bpos(0) { - if (pos == 0) { - pos = -1; - nextPos(); - } - } - void nextPos() { - while (++pos < parent->pih_content.size_s()) { - if (!parent->pih_content[pos].isEmpty()) - return; - } - } - const PIHash * parent; - ssize_t pos, bpos; - public: - const_iterator(): parent(0), pos(0) {} - //const value_type operator *() const {return parent->_pair(pos);} - //const value_type* operator ->() const {cval = parent->_pair(pos); return &cval;} - const Key & key() const {return const_cast * >(parent)->pih_content[pos][bpos].key;} - const T & value() const {return const_cast * >(parent)->pih_content[pos][bpos].value;} - void operator ++() { - if (pos < parent->pih_content.size_s()) { - if (bpos >= parent->pih_content[pos].size_s() - 1) { - bpos = 0; - nextPos(); - } else - ++bpos; - } else { - bpos = 0; - ++pos; - } - printf(" ++: %d %d\n", pos, bpos); - } - //void operator ++(int) {++pos;} - void operator --() { - --pos; - } - //void operator --(int) {--pos;} - bool operator ==(const const_iterator & it) const {return (pos == it.pos && bpos == it.bpos);} - bool operator !=(const const_iterator & it) const {return !(*this == it);} - mutable value_type cval; - }; -/* - class const_reverse_iterator { - friend class PIHash; - private: - const_reverse_iterator(const PIHash * v, ssize_t p): parent(v), pos(p) {} - const PIHash * parent; - ssize_t pos; - public: - const_reverse_iterator(): parent(0), pos(0) {} - const value_type operator *() const {return parent->_pair(pos);} - const value_type* operator ->() const {cval = parent->_pair(pos); return &cval;} - void operator ++() {--pos;} - void operator ++(int) {--pos;} - void operator --() {++pos;} - void operator --(int) {++pos;} - bool operator ==(const const_reverse_iterator & it) const {return (pos == it.pos);} - bool operator !=(const const_reverse_iterator & it) const {return (pos != it.pos);} - mutable value_type cval; - }; -*/ - //iterator begin() {return iterator(this, 0);} - //iterator end() {return iterator(this, size());} - const_iterator begin() const {return const_iterator(this, 0);} - const_iterator end() const {return const_iterator(this, size());} - const_iterator constBegin() const {return const_iterator(this, 0);} - const_iterator constEnd() const {return const_iterator(this, size());} - //reverse_iterator rbegin() {return reverse_iterator(this, size() - 1);} - //reverse_iterator rend() {return reverse_iterator(this, -1);} - //const_reverse_iterator rbegin() const {return const_reverse_iterator(this, size() - 1);} - //const_reverse_iterator rend() const {return const_reverse_iterator(this, -1);} - //const_reverse_iterator constRbegin() const {return const_reverse_iterator(this, size() - 1);} - //const_reverse_iterator constRend() const {return const_reverse_iterator(this, -1);} - - size_t size() const {return pih_content.size();} - int size_s() const {return pih_content.size_s();} - size_t length() const {return pih_content.size();} - size_t capacity() const {return pih_content.size();} - bool isEmpty() const {return (pih_content.size() == 0);} - - T & operator [](const Key & key) { - if (pih_content.isEmpty()) _rehash(1); - uint k = piHash(key); - int i = _index(k); - if (i < pih_content.size_s()) { - PIVector & hv(pih_content[i]); - if (hv.size_s() == 1) { - if (hv[0].key == k) - return hv[0].value; - } - for (int j = 0; j < hv.size_s(); ++j) - if (hv[j].key == k) - return hv[j].value; - } - if (pih_content[i].size_s() >= 4) - _rehash(pih_content.size_s() * 2); - i = _index(k); - pih_content[i] << HashEntry(k); - return pih_content[i].back().value; - } - const T operator [](const Key & key) const {return value(key);} - T & at(const Key & key) {return (*this)[key];} - const T at(const Key & key) const {return (*this)[key];} - - PIHash & operator <<(const PIHash & other) { - if (other.isEmpty()) return *this; - for (int i = 0; i < other.pih_content.size_s(); ++i) - for (int j = 0; j < other.pih_content[i].size_s(); ++j) - insert(other.pih_content[i][j].key, other.pih_content[i][j].value); - return *this; - } - - bool operator ==(const PIHash & t) const {return (pih_content == t.pih_content);} - bool operator !=(const PIHash & t) const {return (pih_content != t.pih_content);} - bool contains(const Key & key) const { - bool f(false); - _find(key, f); - return f; - } - - PIHash & reserve(size_t new_size) {_rehash(new_size); return *this;} - - PIHash & remove(const Key & key) { - uint k = piHash(key); - int i = _index(k); - if (i >= pih_content.size_s()) return *this; - PIVector & hv(pih_content[i]); - for (int j = 0; j < hv.size_s(); ++j) - if (hv[j].key == k) { - hv.remove(j); - --j; - } - return *this; - } - PIHash & erase(const Key & key) {return remove(key);} - PIHash & clear() {pih_content.clear(); return *this;} - - void swap(PIHash & other) { - pih_content.swap(other.pih_content); - } - - PIHash & insert(const Key & key, const T & value) { - (*this)[key] = value; - return *this; - } - const T value(const Key & key, const T & default_ = T()) const { - uint k = piHash(key); - int i = _index(k); - if (i >= pih_content.size_s()) return default_; - const PIVector & hv(pih_content[i]); - for (int j = 0; j < hv.size_s(); ++j) - if (hv[j].key == k) - return hv[j].value; - return default_; - } - PIVector values() const { - PIVector ret; - for (int i = 0; i < pih_content.size_s(); ++i) - for (int j = 0; j < pih_content[i].size_s(); ++j) - ret << pih_content[i][j].value; - return ret; - } - /*Key key(const T & value_, const Key & default_ = Key()) const { - for (int i = 0; i < pih_content.size_s(); ++i) - for (int j = 0; j < pih_content[i].size_s(); ++j) - if (pih_content[i][j].value == value_) - return pih_content[i][j].key; - return default_; - } - PIVector keys() const { - PIVector ret; - for (int i = 0; i < pih_content.size_s(); ++i) - for (int j = 0; j < pih_content[i].size_s(); ++j) - ret << pih_content[i][j].key; - return ret; - }*/ - - /*void dump() { - piCout << "PIHash" << size() << "entries" << PICoutManipulators::NewLine << "content:"; - for (size_t i = 0; i < pih_content.size(); ++i) - piCout << PICoutManipulators::Tab << i << ":" << pih_content[i]; - piCout << "index:"; - for (size_t i = 0; i < pim_index.size(); ++i) - piCout << PICoutManipulators::Tab << i << ":" << pim_index[i].key << "->" << pim_index[i].index; - }*/ - -protected: - struct HashEntry { - HashEntry(uint k = 0, const T & v = T()): key(k), value(v) {;} - uint key; - T value; - bool operator ==(const HashEntry & s) const {return key == s.key;} - bool operator !=(const HashEntry & s) const {return key != s.key;} - bool operator <(const HashEntry & s) const {return key < s.key;} - bool operator >(const HashEntry & s) const {return key > s.key;} - }; - /*template friend PIByteArray & operator >>(PIByteArray & s, PIDeque::HashEntry> & v); - template friend PIByteArray & operator <<(PIByteArray & s, const PIDeque::HashEntry> & v); - - const value_type _pair(ssize_t index) const { - if (index < 0 || index >= pim_index.size_s()) - return value_type(); - //piCout << "_pair" << index << pim_index[index].index; - return value_type(pim_index[index].key, pih_content[pim_index[index].index]); - } - Key & _key(ssize_t index) {return pim_index[index].key;} - T & _value(ssize_t index) {return pih_content[pim_index[index].index];}*/ - - inline size_t asize(size_t s) { - if (s == 0) return 0; - if (pih_content.size() + pih_content.size() >= s && pih_content.size() < s) - return pih_content.size() + pih_content.size(); - ssize_t t = 0, s_ = s - 1; - while (s_ >> t) ++t; - return (1 << t); - } - int _index(const uint & k) const { - return k % pih_content.size_s(); - } - void _rehash(int ns) { - ns = asize(ns); - if (pih_content.size_s() == ns) return; - PIVector > nhc; - nhc.resize(ns); - for (int i = 0; i < pih_content.size_s(); ++i) { - for (int j = 0; j < pih_content[i].size_s(); ++j) { - HashEntry & e(pih_content[i][j]); - int ni = e.key % ns; - nhc[ni] << e; - } - } - pih_content.swap(nhc); - } - - PIVector > pih_content; -}; - - -uint qHash(const PIString & v, uint seed = 0) {return piHash(v);} - - -#include "logview.h" -int main(int argc, char *argv[]) { - QApplication a(argc, argv); -#if QT_VERSION >= 0x050000 - a.setAttribute(Qt::AA_UseHighDpiPixmaps, true); -#endif - //################################ - /*QHash h2; - QMap m2; - PIString prefix = "1234567890"; - PITimeMeasurer tm; - double el = 0.; - - tm.reset(); - for (int i=0; i<10000; ++i) { - h2[prefix + PIString::fromNumber(i)+"1234567890"] = PIString::fromNumber(randomi()); - } - el = tm.elapsed_m(); piCout << el << h2.capacity(); - - tm.reset(); - for (int i=0; i<10000; ++i) { - m2[prefix + PIString::fromNumber(i)+"1234567890"] = PIString::fromNumber(randomi()); - } - el = tm.elapsed_m(); piCout << el; - piCout << "*********"; - - PIString _s; - tm.reset(); - for (int i=0; i<10000; ++i) { - _s = h2.value(prefix + PIString::fromNumber(i)+"1234567890"); - } - el = tm.elapsed_m(); piCout << el << h2.capacity(); - - tm.reset(); - for (int i=0; i<10000; ++i) { - _s = m2.value(prefix + PIString::fromNumber(i)+"1234567890"); - } - el = tm.elapsed_m(); piCout << el; - - return 0;*/ - //################################ -//1245hghgfhfdgshrgnhdsgfhjshdszdgsdgnjedghrbnlcvleabjmbassfdggfhbnsjkgnfdvfdsdfojbwasv213443gr2t4sfth - /*LogView lw; - lw.setLogFont(QFont("dejavu sans mono", 9)); - lw.registerCategory("Warning", "Warning", QImage(":/icons/flame.png"), Qt::darkYellow); - lw.registerCategory("Error", "Error", QImage(":/icons/dialog-cancel.png"), Qt::darkRed, true); - //lw.setLinesLimit(12); - lw.show(); - piForTimes(100) - lw.addText(QString("row %1").arg(_i100)); - lw.addText("-- Up-to-date: C:/sdk/MinGW/x32/i686-w64-mingw32/include/qglengine/scene_tree.h"); - lw.addText("-- Up-to-date: C:/sdk/MinGW/x32/i686-w64-mingw32/include/qglengine/scene_tree.h"); - lw.addText("-- Up-to-date: C:/sdk/MinGW/x32/i686-w64-mingw32/include/qglengine/view_editor.h"); - lw.addText("-- Up-to-date: C:/sdk/MinGW/x32/i686-w64-mingw32/include/qglengine/material_map_editor.h\n" - "-- Up-to-date: C:/sdk/MinGW/x32/i686-w64-mingw32/include/qglengine/materials_editor\n" - "-- Up-to-date: C:/sdk/MinGW/x32/i686-w64-mingw32/include/qglengine/object_editor.h"); - lw.addText("[Warning] sdfkjhdfgj"); - lw.addText("[Error] gbflknwed"); - QLineEdit * le = new QLineEdit(); - QObject::connect(le, &QLineEdit::returnPressed, [&](){lw.addText(le->text());}); - le->show(); - return a.exec();*/ - - CDPultWindow w; - w.show(); - if (a.arguments().size() > 1) - w.loadFile(a.arguments()[1]); - return a.exec(); -} +#include +#include "cdpultwindow.h" + +template +class PIHash { + //template friend PIByteArray & operator >>(PIByteArray & s, PIHash & v); + //template friend PIByteArray & operator <<(PIByteArray & s, const PIHash & v); +public: + PIHash() {;} + PIHash(const PIHash & other) {*this = other;} + virtual ~PIHash() {;} + + PIHash & operator =(const PIHash & other) { + if (this == &other) return *this; + clear(); + pih_content = other.pih_content; + return *this; + } + + typedef T mapped_type; + typedef Key key_type; + typedef PIPair value_type; +/* + class iterator { + friend class PIHash; + private: + iterator(const PIHash * v, ssize_t p): parent(v), pos(p) {} + const PIHash * parent; + ssize_t pos; + public: + iterator(): parent(0), pos(0) {} + const Key & key() const {return const_cast * >(parent)->_key(pos);} + T & value() {return const_cast * >(parent)->_value(pos);} + void operator ++() {++pos;} + void operator ++(int) {++pos;} + void operator --() {--pos;} + void operator --(int) {--pos;} + bool operator ==(const iterator & it) const {return (pos == it.pos);} + bool operator !=(const iterator & it) const {return (pos != it.pos);} + }; + + class reverse_iterator { + friend class PIHash; + private: + reverse_iterator(const PIHash * v, ssize_t p): parent(v), pos(p) {} + const PIHash * parent; + ssize_t pos; + public: + reverse_iterator(): parent(0), pos(0) {} + const Key & key() const {return const_cast * >(parent)->_key(pos);} + T & value() const {return const_cast * >(parent)->_value(pos);} + void operator ++() {--pos;} + void operator ++(int) {--pos;} + void operator --() {++pos;} + void operator --(int) {++pos;} + bool operator ==(const reverse_iterator & it) const {return (pos == it.pos);} + bool operator !=(const reverse_iterator & it) const {return (pos != it.pos);} + }; +*/ + class const_iterator { + friend class PIHash; + private: + const_iterator(const PIHash * v, ssize_t p): parent(v), pos(p), bpos(0) { + if (pos == 0) { + pos = -1; + nextPos(); + } + } + void nextPos() { + while (++pos < parent->pih_content.size_s()) { + if (!parent->pih_content[pos].isEmpty()) + return; + } + } + const PIHash * parent; + ssize_t pos, bpos; + public: + const_iterator(): parent(0), pos(0) {} + //const value_type operator *() const {return parent->_pair(pos);} + //const value_type* operator ->() const {cval = parent->_pair(pos); return &cval;} + const Key & key() const {return const_cast * >(parent)->pih_content[pos][bpos].key;} + const T & value() const {return const_cast * >(parent)->pih_content[pos][bpos].value;} + void operator ++() { + if (pos < parent->pih_content.size_s()) { + if (bpos >= parent->pih_content[pos].size_s() - 1) { + bpos = 0; + nextPos(); + } else + ++bpos; + } else { + bpos = 0; + ++pos; + } + printf(" ++: %d %d\n", pos, bpos); + } + //void operator ++(int) {++pos;} + void operator --() { + --pos; + } + //void operator --(int) {--pos;} + bool operator ==(const const_iterator & it) const {return (pos == it.pos && bpos == it.bpos);} + bool operator !=(const const_iterator & it) const {return !(*this == it);} + mutable value_type cval; + }; +/* + class const_reverse_iterator { + friend class PIHash; + private: + const_reverse_iterator(const PIHash * v, ssize_t p): parent(v), pos(p) {} + const PIHash * parent; + ssize_t pos; + public: + const_reverse_iterator(): parent(0), pos(0) {} + const value_type operator *() const {return parent->_pair(pos);} + const value_type* operator ->() const {cval = parent->_pair(pos); return &cval;} + void operator ++() {--pos;} + void operator ++(int) {--pos;} + void operator --() {++pos;} + void operator --(int) {++pos;} + bool operator ==(const const_reverse_iterator & it) const {return (pos == it.pos);} + bool operator !=(const const_reverse_iterator & it) const {return (pos != it.pos);} + mutable value_type cval; + }; +*/ + //iterator begin() {return iterator(this, 0);} + //iterator end() {return iterator(this, size());} + const_iterator begin() const {return const_iterator(this, 0);} + const_iterator end() const {return const_iterator(this, size());} + const_iterator constBegin() const {return const_iterator(this, 0);} + const_iterator constEnd() const {return const_iterator(this, size());} + //reverse_iterator rbegin() {return reverse_iterator(this, size() - 1);} + //reverse_iterator rend() {return reverse_iterator(this, -1);} + //const_reverse_iterator rbegin() const {return const_reverse_iterator(this, size() - 1);} + //const_reverse_iterator rend() const {return const_reverse_iterator(this, -1);} + //const_reverse_iterator constRbegin() const {return const_reverse_iterator(this, size() - 1);} + //const_reverse_iterator constRend() const {return const_reverse_iterator(this, -1);} + + size_t size() const {return pih_content.size();} + int size_s() const {return pih_content.size_s();} + size_t length() const {return pih_content.size();} + size_t capacity() const {return pih_content.size();} + bool isEmpty() const {return (pih_content.size() == 0);} + + T & operator [](const Key & key) { + if (pih_content.isEmpty()) _rehash(1); + uint k = piHash(key); + int i = _index(k); + if (i < pih_content.size_s()) { + PIVector & hv(pih_content[i]); + if (hv.size_s() == 1) { + if (hv[0].key == k) + return hv[0].value; + } + for (int j = 0; j < hv.size_s(); ++j) + if (hv[j].key == k) + return hv[j].value; + } + if (pih_content[i].size_s() >= 4) + _rehash(pih_content.size_s() * 2); + i = _index(k); + pih_content[i] << HashEntry(k); + return pih_content[i].back().value; + } + const T operator [](const Key & key) const {return value(key);} + T & at(const Key & key) {return (*this)[key];} + const T at(const Key & key) const {return (*this)[key];} + + PIHash & operator <<(const PIHash & other) { + if (other.isEmpty()) return *this; + for (int i = 0; i < other.pih_content.size_s(); ++i) + for (int j = 0; j < other.pih_content[i].size_s(); ++j) + insert(other.pih_content[i][j].key, other.pih_content[i][j].value); + return *this; + } + + bool operator ==(const PIHash & t) const {return (pih_content == t.pih_content);} + bool operator !=(const PIHash & t) const {return (pih_content != t.pih_content);} + bool contains(const Key & key) const { + bool f(false); + _find(key, f); + return f; + } + + PIHash & reserve(size_t new_size) {_rehash(new_size); return *this;} + + PIHash & remove(const Key & key) { + uint k = piHash(key); + int i = _index(k); + if (i >= pih_content.size_s()) return *this; + PIVector & hv(pih_content[i]); + for (int j = 0; j < hv.size_s(); ++j) + if (hv[j].key == k) { + hv.remove(j); + --j; + } + return *this; + } + PIHash & erase(const Key & key) {return remove(key);} + PIHash & clear() {pih_content.clear(); return *this;} + + void swap(PIHash & other) { + pih_content.swap(other.pih_content); + } + + PIHash & insert(const Key & key, const T & value) { + (*this)[key] = value; + return *this; + } + const T value(const Key & key, const T & default_ = T()) const { + uint k = piHash(key); + int i = _index(k); + if (i >= pih_content.size_s()) return default_; + const PIVector & hv(pih_content[i]); + for (int j = 0; j < hv.size_s(); ++j) + if (hv[j].key == k) + return hv[j].value; + return default_; + } + PIVector values() const { + PIVector ret; + for (int i = 0; i < pih_content.size_s(); ++i) + for (int j = 0; j < pih_content[i].size_s(); ++j) + ret << pih_content[i][j].value; + return ret; + } + /*Key key(const T & value_, const Key & default_ = Key()) const { + for (int i = 0; i < pih_content.size_s(); ++i) + for (int j = 0; j < pih_content[i].size_s(); ++j) + if (pih_content[i][j].value == value_) + return pih_content[i][j].key; + return default_; + } + PIVector keys() const { + PIVector ret; + for (int i = 0; i < pih_content.size_s(); ++i) + for (int j = 0; j < pih_content[i].size_s(); ++j) + ret << pih_content[i][j].key; + return ret; + }*/ + + /*void dump() { + piCout << "PIHash" << size() << "entries" << PICoutManipulators::NewLine << "content:"; + for (size_t i = 0; i < pih_content.size(); ++i) + piCout << PICoutManipulators::Tab << i << ":" << pih_content[i]; + piCout << "index:"; + for (size_t i = 0; i < pim_index.size(); ++i) + piCout << PICoutManipulators::Tab << i << ":" << pim_index[i].key << "->" << pim_index[i].index; + }*/ + +protected: + struct HashEntry { + HashEntry(uint k = 0, const T & v = T()): key(k), value(v) {;} + uint key; + T value; + bool operator ==(const HashEntry & s) const {return key == s.key;} + bool operator !=(const HashEntry & s) const {return key != s.key;} + bool operator <(const HashEntry & s) const {return key < s.key;} + bool operator >(const HashEntry & s) const {return key > s.key;} + }; + /*template friend PIByteArray & operator >>(PIByteArray & s, PIDeque::HashEntry> & v); + template friend PIByteArray & operator <<(PIByteArray & s, const PIDeque::HashEntry> & v); + + const value_type _pair(ssize_t index) const { + if (index < 0 || index >= pim_index.size_s()) + return value_type(); + //piCout << "_pair" << index << pim_index[index].index; + return value_type(pim_index[index].key, pih_content[pim_index[index].index]); + } + Key & _key(ssize_t index) {return pim_index[index].key;} + T & _value(ssize_t index) {return pih_content[pim_index[index].index];}*/ + + inline size_t asize(size_t s) { + if (s == 0) return 0; + if (pih_content.size() + pih_content.size() >= s && pih_content.size() < s) + return pih_content.size() + pih_content.size(); + ssize_t t = 0, s_ = s - 1; + while (s_ >> t) ++t; + return (1 << t); + } + int _index(const uint & k) const { + return k % pih_content.size_s(); + } + void _rehash(int ns) { + ns = asize(ns); + if (pih_content.size_s() == ns) return; + PIVector > nhc; + nhc.resize(ns); + for (int i = 0; i < pih_content.size_s(); ++i) { + for (int j = 0; j < pih_content[i].size_s(); ++j) { + HashEntry & e(pih_content[i][j]); + int ni = e.key % ns; + nhc[ni] << e; + } + } + pih_content.swap(nhc); + } + + PIVector > pih_content; +}; + + +uint qHash(const PIString & v, uint seed = 0) {return piHash(v);} + + +#include "logview.h" +int main(int argc, char *argv[]) { + QApplication a(argc, argv); +#if QT_VERSION >= 0x050000 + a.setAttribute(Qt::AA_UseHighDpiPixmaps, true); +#endif + //################################ + /*QHash h2; + QMap m2; + PIString prefix = "1234567890"; + PITimeMeasurer tm; + double el = 0.; + + tm.reset(); + for (int i=0; i<10000; ++i) { + h2[prefix + PIString::fromNumber(i)+"1234567890"] = PIString::fromNumber(randomi()); + } + el = tm.elapsed_m(); piCout << el << h2.capacity(); + + tm.reset(); + for (int i=0; i<10000; ++i) { + m2[prefix + PIString::fromNumber(i)+"1234567890"] = PIString::fromNumber(randomi()); + } + el = tm.elapsed_m(); piCout << el; + piCout << "*********"; + + PIString _s; + tm.reset(); + for (int i=0; i<10000; ++i) { + _s = h2.value(prefix + PIString::fromNumber(i)+"1234567890"); + } + el = tm.elapsed_m(); piCout << el << h2.capacity(); + + tm.reset(); + for (int i=0; i<10000; ++i) { + _s = m2.value(prefix + PIString::fromNumber(i)+"1234567890"); + } + el = tm.elapsed_m(); piCout << el; + + return 0;*/ + //################################ +//1245hghgfhfdgshrgnhdsgfhjshdszdgsdgnjedghrbnlcvleabjmbassfdggfhbnsjkgnfdvfdsdfojbwasv213443gr2t4sfth + /*LogView lw; + lw.setLogFont(QFont("dejavu sans mono", 9)); + lw.registerCategory("Warning", "Warning", QImage(":/icons/flame.png"), Qt::darkYellow); + lw.registerCategory("Error", "Error", QImage(":/icons/dialog-cancel.png"), Qt::darkRed, true); + //lw.setLinesLimit(12); + lw.show(); + piForTimes(100) + lw.addText(QString("row %1").arg(_i100)); + lw.addText("-- Up-to-date: C:/sdk/MinGW/x32/i686-w64-mingw32/include/qglengine/scene_tree.h"); + lw.addText("-- Up-to-date: C:/sdk/MinGW/x32/i686-w64-mingw32/include/qglengine/scene_tree.h"); + lw.addText("-- Up-to-date: C:/sdk/MinGW/x32/i686-w64-mingw32/include/qglengine/view_editor.h"); + lw.addText("-- Up-to-date: C:/sdk/MinGW/x32/i686-w64-mingw32/include/qglengine/material_map_editor.h\n" + "-- Up-to-date: C:/sdk/MinGW/x32/i686-w64-mingw32/include/qglengine/materials_editor\n" + "-- Up-to-date: C:/sdk/MinGW/x32/i686-w64-mingw32/include/qglengine/object_editor.h"); + lw.addText("[Warning] sdfkjhdfgj"); + lw.addText("[Error] gbflknwed"); + QLineEdit * le = new QLineEdit(); + QObject::connect(le, &QLineEdit::returnPressed, [&](){lw.addText(le->text());}); + le->show(); + return a.exec();*/ + + CDPultWindow w; + w.show(); + if (a.arguments().size() > 1) + w.loadFile(a.arguments()[1]); + return a.exec(); +} diff --git a/piqt/utils/piconnedit/CMakeLists.txt b/piqt/utils/piconnedit/CMakeLists.txt new file mode 100644 index 0000000..7467cfa --- /dev/null +++ b/piqt/utils/piconnedit/CMakeLists.txt @@ -0,0 +1,10 @@ +project(piconnedit) +if(APPLE) + set(APP_ICON "") +elseif(WIN32) + set(APP_ICON "") +else() + set(APP_ICON "") +endif() +set(APP_INFO "PIConnection GUI editor") +piqt_application(${PROJECT_NAME} "Gui;Widgets" "qad_utils;qad_widgets;qad_blockview;piqt_utils") diff --git a/piqt/utils/piconnedit/piconnedit.qrc b/piqt/utils/piconnedit/piconnedit.qrc new file mode 100644 index 0000000..d378e6b --- /dev/null +++ b/piqt/utils/piconnedit/piconnedit.qrc @@ -0,0 +1,4 @@ + + + + diff --git a/piqt_utils/piconnedit/piconnedit_main.cpp b/piqt/utils/piconnedit/piconnedit_main.cpp similarity index 98% rename from piqt_utils/piconnedit/piconnedit_main.cpp rename to piqt/utils/piconnedit/piconnedit_main.cpp index d229c04..4cbd265 100644 --- a/piqt_utils/piconnedit/piconnedit_main.cpp +++ b/piqt/utils/piconnedit/piconnedit_main.cpp @@ -30,5 +30,5 @@ int main(int argc, char * argv[]) { } } } - return a.exec(); + return 0; } diff --git a/piqt/utils/pidumper/CMakeLists.txt b/piqt/utils/pidumper/CMakeLists.txt new file mode 100644 index 0000000..7383642 --- /dev/null +++ b/piqt/utils/pidumper/CMakeLists.txt @@ -0,0 +1,10 @@ +project(pidumper) +if(APPLE) + set(APP_ICON "") +elseif(WIN32) + set(APP_ICON "") +else() + set(APP_ICON "") +endif() +set(APP_INFO "PIConnection GUI editor") +piqt_application(${PROJECT_NAME} "Gui;Widgets" "qad_utils;qad_widgets;piqt_utils") diff --git a/piqt_utils/pidumper/pidumper.cpp b/piqt/utils/pidumper/pidumper.cpp similarity index 100% rename from piqt_utils/pidumper/pidumper.cpp rename to piqt/utils/pidumper/pidumper.cpp diff --git a/piqt_utils/pidumper/pidumper.h b/piqt/utils/pidumper/pidumper.h similarity index 100% rename from piqt_utils/pidumper/pidumper.h rename to piqt/utils/pidumper/pidumper.h diff --git a/piqt_utils/pidumper/pidumper.ui b/piqt/utils/pidumper/pidumper.ui similarity index 100% rename from piqt_utils/pidumper/pidumper.ui rename to piqt/utils/pidumper/pidumper.ui diff --git a/piqt_utils/pidumper/pidumper_main.cpp b/piqt/utils/pidumper/pidumper_main.cpp similarity index 100% rename from piqt_utils/pidumper/pidumper_main.cpp rename to piqt/utils/pidumper/pidumper_main.cpp diff --git a/piqt/utils/piintrospector/CMakeLists.txt b/piqt/utils/piintrospector/CMakeLists.txt new file mode 100644 index 0000000..df74f4b --- /dev/null +++ b/piqt/utils/piintrospector/CMakeLists.txt @@ -0,0 +1,13 @@ +project(piintrospector) +if(APPLE) + set(APP_ICON "") +elseif(WIN32) + set(APP_ICON "") +else() + set(APP_ICON "") +endif() +set(APP_INFO "PIConnection GUI editor") +include(PIPMacros) +set(PII_ROOT "${ROOT_DIR}/pip/libs/main/introspection") +pip_code_model(CCM "${PII_ROOT}/piintrospection_server_p.h" "${PII_ROOT}/piintrospection_threads_p.h" OPTIONS "-DPIP_EXPORT" "-Es") +piqt_application(${PROJECT_NAME} "Gui;Widgets" "qad_utils;qad_widgets;qad_application;piqt_utils" ${CCM}) diff --git a/piqt_utils/piintrospector/containers_view.cpp b/piqt/utils/piintrospector/containers_view.cpp similarity index 100% rename from piqt_utils/piintrospector/containers_view.cpp rename to piqt/utils/piintrospector/containers_view.cpp diff --git a/piqt_utils/piintrospector/containers_view.h b/piqt/utils/piintrospector/containers_view.h similarity index 100% rename from piqt_utils/piintrospector/containers_view.h rename to piqt/utils/piintrospector/containers_view.h diff --git a/piqt_utils/piintrospector/containers_view.ui b/piqt/utils/piintrospector/containers_view.ui similarity index 100% rename from piqt_utils/piintrospector/containers_view.ui rename to piqt/utils/piintrospector/containers_view.ui diff --git a/piqt_utils/piintrospector/objects_view.cpp b/piqt/utils/piintrospector/objects_view.cpp similarity index 100% rename from piqt_utils/piintrospector/objects_view.cpp rename to piqt/utils/piintrospector/objects_view.cpp diff --git a/piqt_utils/piintrospector/objects_view.h b/piqt/utils/piintrospector/objects_view.h similarity index 100% rename from piqt_utils/piintrospector/objects_view.h rename to piqt/utils/piintrospector/objects_view.h diff --git a/piqt_utils/piintrospector/objects_view.ui b/piqt/utils/piintrospector/objects_view.ui similarity index 100% rename from piqt_utils/piintrospector/objects_view.ui rename to piqt/utils/piintrospector/objects_view.ui diff --git a/piqt_utils/piintrospector/piintrospector.cpp b/piqt/utils/piintrospector/piintrospector.cpp similarity index 100% rename from piqt_utils/piintrospector/piintrospector.cpp rename to piqt/utils/piintrospector/piintrospector.cpp diff --git a/piqt_utils/piintrospector/piintrospector.h b/piqt/utils/piintrospector/piintrospector.h similarity index 100% rename from piqt_utils/piintrospector/piintrospector.h rename to piqt/utils/piintrospector/piintrospector.h diff --git a/piqt_utils/piintrospector/piintrospector.ui b/piqt/utils/piintrospector/piintrospector.ui similarity index 100% rename from piqt_utils/piintrospector/piintrospector.ui rename to piqt/utils/piintrospector/piintrospector.ui diff --git a/piqt_utils/piintrospector/piintrospector_main.cpp b/piqt/utils/piintrospector/piintrospector_main.cpp similarity index 100% rename from piqt_utils/piintrospector/piintrospector_main.cpp rename to piqt/utils/piintrospector/piintrospector_main.cpp diff --git a/piqt_utils/piintrospector/threads_view.cpp b/piqt/utils/piintrospector/threads_view.cpp similarity index 100% rename from piqt_utils/piintrospector/threads_view.cpp rename to piqt/utils/piintrospector/threads_view.cpp diff --git a/piqt_utils/piintrospector/threads_view.h b/piqt/utils/piintrospector/threads_view.h similarity index 100% rename from piqt_utils/piintrospector/threads_view.h rename to piqt/utils/piintrospector/threads_view.h diff --git a/piqt_utils/piintrospector/threads_view.ui b/piqt/utils/piintrospector/threads_view.ui similarity index 100% rename from piqt_utils/piintrospector/threads_view.ui rename to piqt/utils/piintrospector/threads_view.ui diff --git a/piqt_utils/CMakeLists.txt b/piqt_utils/CMakeLists.txt deleted file mode 100644 index c7c206a..0000000 --- a/piqt_utils/CMakeLists.txt +++ /dev/null @@ -1,73 +0,0 @@ -cmake_minimum_required(VERSION 3.0) -project(piqt_utils) -set(PIQT_UTILS_UTILS 1) -if(LIBPROJECT) - include(PIPMacros) - include(SDKMacros) - set(PIQT_UTILS_UTILS ${UTILS}) -else() - find_package(PIP REQUIRED) - option(LIB "System install" 0) - option(DEBUG "Build with -g3" 0) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall") - if(DEBUG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3") - endif() -endif() -set(LIBTYPE SHARED) -if(DEFINED ENV{QNX_HOST}) - set(LIBTYPE STATIC) -endif() -find_package(QAD REQUIRED) -list(APPEND QT_MULTILIB_LIST ${PROJECT_NAME}) -set(QT_MULTILIB_LIST ${QT_MULTILIB_LIST} PARENT_SCOPE) -include_directories(${PIP_INCLUDES} ${QAD_INCLUDES}) -file(GLOB SRC "*.h" "*.cpp" "*.ui" "*.qrc" "lang/*.ts") -pip_code_model(CCM "../pip/lib/main/io_devices/piiodevice.h" "../pip/lib/main/io_utils/pipacketextractor.h" OPTIONS "-DPIP_EXPORT" "-Es") -find_qt(${QtVersions} Core Gui) -qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM) -qt_add_library(${PROJECT_NAME} ${LIBTYPE} out_CPP CCM) -qt_target_link_libraries(${PROJECT_NAME} pip qad_utils qad_widgets qad_blockview piqt) -message(STATUS "Building ${PROJECT_NAME}") - -if (LIBPROJECT) - foreach(_v ${_QT_VERSIONS_}) - if (LOCAL_FOUND${_v}) - add_dependencies(piqt_utils${_v} pip_cmg) - endif() - endforeach() -endif() - -if (NOT DEFINED ENV{QNX_HOST}) - if (PIQT_UTILS_UTILS) - add_subdirectory(piconnedit) - add_subdirectory(pidumper) - add_subdirectory(piintrospector) - endif() -endif() - -if(LIBPROJECT) - sdk_install("pip" "${PROJECT_NAME}" "${out_HDR}" "${out_QM}") -else() - if(LIB) - if(WIN32) - install(FILES ${out_HDR} DESTINATION ${MINGW_INCLUDE}/pip) - qt_install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION ${MINGW_LIB}) - qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${MINGW_BIN}) - qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION QtBin) - else() - install(FILES ${out_HDR} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/pip) - qt_install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) - endif() - message(STATUS "Install ${PROJECT_NAME} to system \"${CMAKE_INSTALL_PREFIX}\"") - else() - if(WIN32) - qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin) - qt_install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib) - else() - qt_install(TARGETS ${PROJECT_NAME} DESTINATION lib) - endif() - install(FILES ${out_HDR} DESTINATION include/pip) - message(STATUS "Install ${PROJECT_NAME} to local \"bin\", \"lib\" and \"include\"") - endif() -endif() diff --git a/piqt_utils/LICENSE.txt b/piqt_utils/LICENSE.txt deleted file mode 100644 index 0a04128..0000000 --- a/piqt_utils/LICENSE.txt +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/piqt_utils/piconnedit/CMakeLists.txt b/piqt_utils/piconnedit/CMakeLists.txt deleted file mode 100644 index fd96b3d..0000000 --- a/piqt_utils/piconnedit/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -project(piconnedit) -file(GLOB SRC "*.h" "*.cpp" "*.ui" "*.qrc" "lang/*.ts") -find_qt(${QtVersions} Core Gui) -qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM) -qt_add_executable(${PROJECT_NAME} WIN32 out_CPP) -qt_target_link_libraries(${PROJECT_NAME} pip qad_utils qad_widgets piqt_utils) -qt_target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../") -message(STATUS "Building ${PROJECT_NAME}") -if(LIB) - if(WIN32) - qt_install(TARGETS ${PROJECT_NAME} DESTINATION ${MINGW_BIN}) - else() - if (DEFINED ANDROID_PLATFORM) - qt_install(TARGETS ${PROJECT_NAME} DESTINATION ${ANDROID_SYSTEM_LIBRARY_PATH}/usr/bin) - else() - qt_install(TARGETS ${PROJECT_NAME} DESTINATION /usr/local/bin) - endif() - endif() - #message(STATUS "Install ${PROJECT_NAME} to system \"${CMAKE_INSTALL_PREFIX}\"") -else() - qt_install(TARGETS ${PROJECT_NAME} DESTINATION bin) - #message(STATUS "Install ${PROJECT_NAME} to local \"bin\"") -endif() diff --git a/piqt_utils/piconnedit/icons/DALI-designer.png b/piqt_utils/piconnedit/icons/DALI-designer.png deleted file mode 100644 index 23b1946..0000000 Binary files a/piqt_utils/piconnedit/icons/DALI-designer.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/alpha.png b/piqt_utils/piconnedit/icons/alpha.png deleted file mode 100644 index 5435669..0000000 Binary files a/piqt_utils/piconnedit/icons/alpha.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/application-exit.png b/piqt_utils/piconnedit/icons/application-exit.png deleted file mode 100644 index ed5f8b2..0000000 Binary files a/piqt_utils/piconnedit/icons/application-exit.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/applications-engineering.png b/piqt_utils/piconnedit/icons/applications-engineering.png deleted file mode 100644 index 4721d8d..0000000 Binary files a/piqt_utils/piconnedit/icons/applications-engineering.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/archive-extract.png b/piqt_utils/piconnedit/icons/archive-extract.png deleted file mode 100644 index aa7b1fa..0000000 Binary files a/piqt_utils/piconnedit/icons/archive-extract.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/archive-insert-directory.png b/piqt_utils/piconnedit/icons/archive-insert-directory.png deleted file mode 100644 index 0672205..0000000 Binary files a/piqt_utils/piconnedit/icons/archive-insert-directory.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/archive-insert.png b/piqt_utils/piconnedit/icons/archive-insert.png deleted file mode 100644 index 193c25c..0000000 Binary files a/piqt_utils/piconnedit/icons/archive-insert.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/arrow-down.png b/piqt_utils/piconnedit/icons/arrow-down.png deleted file mode 100644 index 03f2014..0000000 Binary files a/piqt_utils/piconnedit/icons/arrow-down.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/arrow-up.png b/piqt_utils/piconnedit/icons/arrow-up.png deleted file mode 100644 index 5e42321..0000000 Binary files a/piqt_utils/piconnedit/icons/arrow-up.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/axis_x.png b/piqt_utils/piconnedit/icons/axis_x.png deleted file mode 100644 index 321899c..0000000 Binary files a/piqt_utils/piconnedit/icons/axis_x.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/axis_y.png b/piqt_utils/piconnedit/icons/axis_y.png deleted file mode 100644 index 7d4d9ec..0000000 Binary files a/piqt_utils/piconnedit/icons/axis_y.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/case-sensitive.png b/piqt_utils/piconnedit/icons/case-sensitive.png deleted file mode 100644 index 39c5c5a..0000000 Binary files a/piqt_utils/piconnedit/icons/case-sensitive.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/checkbox-unchecked.png b/piqt_utils/piconnedit/icons/checkbox-unchecked.png deleted file mode 100644 index 01a7307..0000000 Binary files a/piqt_utils/piconnedit/icons/checkbox-unchecked.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/checkbox.png b/piqt_utils/piconnedit/icons/checkbox.png deleted file mode 100644 index 1c311e2..0000000 Binary files a/piqt_utils/piconnedit/icons/checkbox.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/clients.png b/piqt_utils/piconnedit/icons/clients.png deleted file mode 100644 index 0ae949a..0000000 Binary files a/piqt_utils/piconnedit/icons/clients.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/close.png b/piqt_utils/piconnedit/icons/close.png deleted file mode 100644 index 5492295..0000000 Binary files a/piqt_utils/piconnedit/icons/close.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/code-error.png b/piqt_utils/piconnedit/icons/code-error.png deleted file mode 100644 index 5b4c488..0000000 Binary files a/piqt_utils/piconnedit/icons/code-error.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/code-function.png b/piqt_utils/piconnedit/icons/code-function.png deleted file mode 100644 index e5cea37..0000000 Binary files a/piqt_utils/piconnedit/icons/code-function.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/code-keyword.png b/piqt_utils/piconnedit/icons/code-keyword.png deleted file mode 100644 index 70dc5ef..0000000 Binary files a/piqt_utils/piconnedit/icons/code-keyword.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/code-parents.png b/piqt_utils/piconnedit/icons/code-parents.png deleted file mode 100644 index 7c14d40..0000000 Binary files a/piqt_utils/piconnedit/icons/code-parents.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/code-property.png b/piqt_utils/piconnedit/icons/code-property.png deleted file mode 100644 index d2af8a6..0000000 Binary files a/piqt_utils/piconnedit/icons/code-property.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/code-signal.png b/piqt_utils/piconnedit/icons/code-signal.png deleted file mode 100644 index 3415e62..0000000 Binary files a/piqt_utils/piconnedit/icons/code-signal.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/code-struct.png b/piqt_utils/piconnedit/icons/code-struct.png deleted file mode 100644 index 61544a8..0000000 Binary files a/piqt_utils/piconnedit/icons/code-struct.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/code-union.png b/piqt_utils/piconnedit/icons/code-union.png deleted file mode 100644 index 2f4567a..0000000 Binary files a/piqt_utils/piconnedit/icons/code-union.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/code-variable.png b/piqt_utils/piconnedit/icons/code-variable.png deleted file mode 100644 index d0ec29e..0000000 Binary files a/piqt_utils/piconnedit/icons/code-variable.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/code-word.png b/piqt_utils/piconnedit/icons/code-word.png deleted file mode 100644 index e61f08f..0000000 Binary files a/piqt_utils/piconnedit/icons/code-word.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/configure-.png b/piqt_utils/piconnedit/icons/configure-.png deleted file mode 100644 index 541c14e..0000000 Binary files a/piqt_utils/piconnedit/icons/configure-.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/configure.png b/piqt_utils/piconnedit/icons/configure.png deleted file mode 100644 index 5ce478b..0000000 Binary files a/piqt_utils/piconnedit/icons/configure.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/database.png b/piqt_utils/piconnedit/icons/database.png deleted file mode 100644 index 3041814..0000000 Binary files a/piqt_utils/piconnedit/icons/database.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/debug-run.png b/piqt_utils/piconnedit/icons/debug-run.png deleted file mode 100644 index 9bebb44..0000000 Binary files a/piqt_utils/piconnedit/icons/debug-run.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/designer-qt4.png b/piqt_utils/piconnedit/icons/designer-qt4.png deleted file mode 100644 index 8f699be..0000000 Binary files a/piqt_utils/piconnedit/icons/designer-qt4.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/dialog-close.png b/piqt_utils/piconnedit/icons/dialog-close.png deleted file mode 100644 index 2c2f99e..0000000 Binary files a/piqt_utils/piconnedit/icons/dialog-close.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/dialog-ok-apply.png b/piqt_utils/piconnedit/icons/dialog-ok-apply.png deleted file mode 100644 index f5feac0..0000000 Binary files a/piqt_utils/piconnedit/icons/dialog-ok-apply.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/dialog-warning.png b/piqt_utils/piconnedit/icons/dialog-warning.png deleted file mode 100644 index 80bd694..0000000 Binary files a/piqt_utils/piconnedit/icons/dialog-warning.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/disabled.png b/piqt_utils/piconnedit/icons/disabled.png deleted file mode 100644 index f20b8e0..0000000 Binary files a/piqt_utils/piconnedit/icons/disabled.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/distribute-horizontal-margin.png b/piqt_utils/piconnedit/icons/distribute-horizontal-margin.png deleted file mode 100644 index 3289190..0000000 Binary files a/piqt_utils/piconnedit/icons/distribute-horizontal-margin.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/document-edit.png b/piqt_utils/piconnedit/icons/document-edit.png deleted file mode 100644 index 84e345d..0000000 Binary files a/piqt_utils/piconnedit/icons/document-edit.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/document-new.png b/piqt_utils/piconnedit/icons/document-new.png deleted file mode 100644 index 3092571..0000000 Binary files a/piqt_utils/piconnedit/icons/document-new.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/document-open.png b/piqt_utils/piconnedit/icons/document-open.png deleted file mode 100644 index 8ba5441..0000000 Binary files a/piqt_utils/piconnedit/icons/document-open.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/document-print.png b/piqt_utils/piconnedit/icons/document-print.png deleted file mode 100644 index 8eb1c67..0000000 Binary files a/piqt_utils/piconnedit/icons/document-print.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/document-save-.png b/piqt_utils/piconnedit/icons/document-save-.png deleted file mode 100644 index 7fa489c..0000000 Binary files a/piqt_utils/piconnedit/icons/document-save-.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/document-save-all.png b/piqt_utils/piconnedit/icons/document-save-all.png deleted file mode 100644 index 159857f..0000000 Binary files a/piqt_utils/piconnedit/icons/document-save-all.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/document-save-as.png b/piqt_utils/piconnedit/icons/document-save-as.png deleted file mode 100644 index 9695a56..0000000 Binary files a/piqt_utils/piconnedit/icons/document-save-as.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/document-save.png b/piqt_utils/piconnedit/icons/document-save.png deleted file mode 100644 index 8072aea..0000000 Binary files a/piqt_utils/piconnedit/icons/document-save.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/edit-clear-.png b/piqt_utils/piconnedit/icons/edit-clear-.png deleted file mode 100644 index cee7af6..0000000 Binary files a/piqt_utils/piconnedit/icons/edit-clear-.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/edit-clear-locationbar-rtl.png b/piqt_utils/piconnedit/icons/edit-clear-locationbar-rtl.png deleted file mode 100644 index 6c4b83b..0000000 Binary files a/piqt_utils/piconnedit/icons/edit-clear-locationbar-rtl.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/edit-clear.png b/piqt_utils/piconnedit/icons/edit-clear.png deleted file mode 100644 index 631ed44..0000000 Binary files a/piqt_utils/piconnedit/icons/edit-clear.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/edit-copy.png b/piqt_utils/piconnedit/icons/edit-copy.png deleted file mode 100644 index 477e83a..0000000 Binary files a/piqt_utils/piconnedit/icons/edit-copy.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/edit-cut.png b/piqt_utils/piconnedit/icons/edit-cut.png deleted file mode 100644 index 0732328..0000000 Binary files a/piqt_utils/piconnedit/icons/edit-cut.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/edit-delete.png b/piqt_utils/piconnedit/icons/edit-delete.png deleted file mode 100644 index cc6d2af..0000000 Binary files a/piqt_utils/piconnedit/icons/edit-delete.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/edit-find-.png b/piqt_utils/piconnedit/icons/edit-find-.png deleted file mode 100644 index 64a1e28..0000000 Binary files a/piqt_utils/piconnedit/icons/edit-find-.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/edit-find.png b/piqt_utils/piconnedit/icons/edit-find.png deleted file mode 100644 index 9a462c0..0000000 Binary files a/piqt_utils/piconnedit/icons/edit-find.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/edit-guides.png b/piqt_utils/piconnedit/icons/edit-guides.png deleted file mode 100644 index d264839..0000000 Binary files a/piqt_utils/piconnedit/icons/edit-guides.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/edit-paste.png b/piqt_utils/piconnedit/icons/edit-paste.png deleted file mode 100644 index 6788b02..0000000 Binary files a/piqt_utils/piconnedit/icons/edit-paste.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/edit-redo.png b/piqt_utils/piconnedit/icons/edit-redo.png deleted file mode 100644 index 8de333f..0000000 Binary files a/piqt_utils/piconnedit/icons/edit-redo.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/edit-table-insert-row-below.png b/piqt_utils/piconnedit/icons/edit-table-insert-row-below.png deleted file mode 100644 index a194a68..0000000 Binary files a/piqt_utils/piconnedit/icons/edit-table-insert-row-below.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/edit-undo.png b/piqt_utils/piconnedit/icons/edit-undo.png deleted file mode 100644 index 5071aa1..0000000 Binary files a/piqt_utils/piconnedit/icons/edit-undo.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/employees.png b/piqt_utils/piconnedit/icons/employees.png deleted file mode 100644 index 7ae7383..0000000 Binary files a/piqt_utils/piconnedit/icons/employees.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/expand_s_x.png b/piqt_utils/piconnedit/icons/expand_s_x.png deleted file mode 100644 index b66cb40..0000000 Binary files a/piqt_utils/piconnedit/icons/expand_s_x.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/expand_s_y.png b/piqt_utils/piconnedit/icons/expand_s_y.png deleted file mode 100644 index c2e8f78..0000000 Binary files a/piqt_utils/piconnedit/icons/expand_s_y.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/expand_x.png b/piqt_utils/piconnedit/icons/expand_x.png deleted file mode 100644 index 217e3ea..0000000 Binary files a/piqt_utils/piconnedit/icons/expand_x.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/expand_y.png b/piqt_utils/piconnedit/icons/expand_y.png deleted file mode 100644 index fedf936..0000000 Binary files a/piqt_utils/piconnedit/icons/expand_y.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/format-text-subscript.png b/piqt_utils/piconnedit/icons/format-text-subscript.png deleted file mode 100644 index 206b147..0000000 Binary files a/piqt_utils/piconnedit/icons/format-text-subscript.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/games-solve.png b/piqt_utils/piconnedit/icons/games-solve.png deleted file mode 100644 index 47f11f7..0000000 Binary files a/piqt_utils/piconnedit/icons/games-solve.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/go-jump.png b/piqt_utils/piconnedit/icons/go-jump.png deleted file mode 100644 index 2cd4627..0000000 Binary files a/piqt_utils/piconnedit/icons/go-jump.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/go-next.png b/piqt_utils/piconnedit/icons/go-next.png deleted file mode 100644 index aa7cbb9..0000000 Binary files a/piqt_utils/piconnedit/icons/go-next.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/go-previous.png b/piqt_utils/piconnedit/icons/go-previous.png deleted file mode 100644 index 8230340..0000000 Binary files a/piqt_utils/piconnedit/icons/go-previous.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/graphics.png b/piqt_utils/piconnedit/icons/graphics.png deleted file mode 100644 index 64abcb5..0000000 Binary files a/piqt_utils/piconnedit/icons/graphics.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/groups-edit.png b/piqt_utils/piconnedit/icons/groups-edit.png deleted file mode 100644 index 278c4d6..0000000 Binary files a/piqt_utils/piconnedit/icons/groups-edit.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/item-add.png b/piqt_utils/piconnedit/icons/item-add.png deleted file mode 100644 index 8a422c7..0000000 Binary files a/piqt_utils/piconnedit/icons/item-add.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/item.png b/piqt_utils/piconnedit/icons/item.png deleted file mode 100644 index 50bfddb..0000000 Binary files a/piqt_utils/piconnedit/icons/item.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/lastmoves.png b/piqt_utils/piconnedit/icons/lastmoves.png deleted file mode 100644 index 4454bca..0000000 Binary files a/piqt_utils/piconnedit/icons/lastmoves.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/led_3.png b/piqt_utils/piconnedit/icons/led_3.png deleted file mode 100644 index 604c241..0000000 Binary files a/piqt_utils/piconnedit/icons/led_3.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/led_off.png b/piqt_utils/piconnedit/icons/led_off.png deleted file mode 100644 index fe60f36..0000000 Binary files a/piqt_utils/piconnedit/icons/led_off.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/led_on.png b/piqt_utils/piconnedit/icons/led_on.png deleted file mode 100644 index 946ba73..0000000 Binary files a/piqt_utils/piconnedit/icons/led_on.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/light-+.png b/piqt_utils/piconnedit/icons/light-+.png deleted file mode 100644 index e7d8d80..0000000 Binary files a/piqt_utils/piconnedit/icons/light-+.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/light--.png b/piqt_utils/piconnedit/icons/light--.png deleted file mode 100644 index 9a4942b..0000000 Binary files a/piqt_utils/piconnedit/icons/light--.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/light-254.png b/piqt_utils/piconnedit/icons/light-254.png deleted file mode 100644 index ff6a171..0000000 Binary files a/piqt_utils/piconnedit/icons/light-254.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/light-disable-all.png b/piqt_utils/piconnedit/icons/light-disable-all.png deleted file mode 100644 index 68ee45c..0000000 Binary files a/piqt_utils/piconnedit/icons/light-disable-all.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/light-disable.png b/piqt_utils/piconnedit/icons/light-disable.png deleted file mode 100644 index 4755fd8..0000000 Binary files a/piqt_utils/piconnedit/icons/light-disable.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/light-down.png b/piqt_utils/piconnedit/icons/light-down.png deleted file mode 100644 index 52a577a..0000000 Binary files a/piqt_utils/piconnedit/icons/light-down.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/light-edit.png b/piqt_utils/piconnedit/icons/light-edit.png deleted file mode 100644 index 581a696..0000000 Binary files a/piqt_utils/piconnedit/icons/light-edit.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/light-max.png b/piqt_utils/piconnedit/icons/light-max.png deleted file mode 100644 index 692ce16..0000000 Binary files a/piqt_utils/piconnedit/icons/light-max.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/light-min.png b/piqt_utils/piconnedit/icons/light-min.png deleted file mode 100644 index 42e76b6..0000000 Binary files a/piqt_utils/piconnedit/icons/light-min.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/light-off.png b/piqt_utils/piconnedit/icons/light-off.png deleted file mode 100644 index 3763a5d..0000000 Binary files a/piqt_utils/piconnedit/icons/light-off.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/light-on.png b/piqt_utils/piconnedit/icons/light-on.png deleted file mode 100644 index 8db6a2d..0000000 Binary files a/piqt_utils/piconnedit/icons/light-on.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/light-step-down.png b/piqt_utils/piconnedit/icons/light-step-down.png deleted file mode 100644 index 64b405d..0000000 Binary files a/piqt_utils/piconnedit/icons/light-step-down.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/light-step-up.png b/piqt_utils/piconnedit/icons/light-step-up.png deleted file mode 100644 index 4aaf795..0000000 Binary files a/piqt_utils/piconnedit/icons/light-step-up.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/light-up.png b/piqt_utils/piconnedit/icons/light-up.png deleted file mode 100644 index ddc5eec..0000000 Binary files a/piqt_utils/piconnedit/icons/light-up.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/lights.png b/piqt_utils/piconnedit/icons/lights.png deleted file mode 100644 index 34d2541..0000000 Binary files a/piqt_utils/piconnedit/icons/lights.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/list-add.png b/piqt_utils/piconnedit/icons/list-add.png deleted file mode 100644 index 5724694..0000000 Binary files a/piqt_utils/piconnedit/icons/list-add.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/list-remove.png b/piqt_utils/piconnedit/icons/list-remove.png deleted file mode 100644 index 53506b0..0000000 Binary files a/piqt_utils/piconnedit/icons/list-remove.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/log_parser.png b/piqt_utils/piconnedit/icons/log_parser.png deleted file mode 100644 index cf0ca98..0000000 Binary files a/piqt_utils/piconnedit/icons/log_parser.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/mail.png b/piqt_utils/piconnedit/icons/mail.png deleted file mode 100644 index 81adbf9..0000000 Binary files a/piqt_utils/piconnedit/icons/mail.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/media-flash.png b/piqt_utils/piconnedit/icons/media-flash.png deleted file mode 100644 index d91845b..0000000 Binary files a/piqt_utils/piconnedit/icons/media-flash.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/media-playback-pause.png b/piqt_utils/piconnedit/icons/media-playback-pause.png deleted file mode 100644 index d133bdc..0000000 Binary files a/piqt_utils/piconnedit/icons/media-playback-pause.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/media-playback-stop.png b/piqt_utils/piconnedit/icons/media-playback-stop.png deleted file mode 100644 index 4ecbdf6..0000000 Binary files a/piqt_utils/piconnedit/icons/media-playback-stop.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/media-record.png b/piqt_utils/piconnedit/icons/media-record.png deleted file mode 100644 index 73688e8..0000000 Binary files a/piqt_utils/piconnedit/icons/media-record.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/node-add.png b/piqt_utils/piconnedit/icons/node-add.png deleted file mode 100644 index 80b5c61..0000000 Binary files a/piqt_utils/piconnedit/icons/node-add.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/node.png b/piqt_utils/piconnedit/icons/node.png deleted file mode 100644 index fc8194e..0000000 Binary files a/piqt_utils/piconnedit/icons/node.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/object-locked.png b/piqt_utils/piconnedit/icons/object-locked.png deleted file mode 100644 index 38dff01..0000000 Binary files a/piqt_utils/piconnedit/icons/object-locked.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/piconnection.png b/piqt_utils/piconnedit/icons/piconnection.png deleted file mode 100644 index 47d41d7..0000000 Binary files a/piqt_utils/piconnedit/icons/piconnection.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/piconnection.xcf b/piqt_utils/piconnedit/icons/piconnection.xcf deleted file mode 100644 index a5fdbee..0000000 Binary files a/piqt_utils/piconnedit/icons/piconnection.xcf and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/quickopen.png b/piqt_utils/piconnedit/icons/quickopen.png deleted file mode 100644 index 60cb838..0000000 Binary files a/piqt_utils/piconnedit/icons/quickopen.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/run-build-install-root.png b/piqt_utils/piconnedit/icons/run-build-install-root.png deleted file mode 100644 index 6c7a236..0000000 Binary files a/piqt_utils/piconnedit/icons/run-build-install-root.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/run-build.png b/piqt_utils/piconnedit/icons/run-build.png deleted file mode 100644 index 85a12e8..0000000 Binary files a/piqt_utils/piconnedit/icons/run-build.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/scenes-edit.png b/piqt_utils/piconnedit/icons/scenes-edit.png deleted file mode 100644 index d60c0f6..0000000 Binary files a/piqt_utils/piconnedit/icons/scenes-edit.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/select-add.png b/piqt_utils/piconnedit/icons/select-add.png deleted file mode 100644 index 084ab28..0000000 Binary files a/piqt_utils/piconnedit/icons/select-add.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/select-intersect.png b/piqt_utils/piconnedit/icons/select-intersect.png deleted file mode 100644 index e1b22cc..0000000 Binary files a/piqt_utils/piconnedit/icons/select-intersect.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/select-invert.png b/piqt_utils/piconnedit/icons/select-invert.png deleted file mode 100644 index 1c82ab4..0000000 Binary files a/piqt_utils/piconnedit/icons/select-invert.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/select-none.png b/piqt_utils/piconnedit/icons/select-none.png deleted file mode 100644 index 4f9bb5a..0000000 Binary files a/piqt_utils/piconnedit/icons/select-none.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/select-replace.png b/piqt_utils/piconnedit/icons/select-replace.png deleted file mode 100644 index 80ccde4..0000000 Binary files a/piqt_utils/piconnedit/icons/select-replace.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/select-subtract.png b/piqt_utils/piconnedit/icons/select-subtract.png deleted file mode 100644 index 26eccee..0000000 Binary files a/piqt_utils/piconnedit/icons/select-subtract.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/splash.png b/piqt_utils/piconnedit/icons/splash.png deleted file mode 100644 index 38921fc..0000000 Binary files a/piqt_utils/piconnedit/icons/splash.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/status-off.png b/piqt_utils/piconnedit/icons/status-off.png deleted file mode 100644 index b89267f..0000000 Binary files a/piqt_utils/piconnedit/icons/status-off.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/status-on.png b/piqt_utils/piconnedit/icons/status-on.png deleted file mode 100644 index bb62ff6..0000000 Binary files a/piqt_utils/piconnedit/icons/status-on.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/status-warn.png b/piqt_utils/piconnedit/icons/status-warn.png deleted file mode 100644 index 2afcc5e..0000000 Binary files a/piqt_utils/piconnedit/icons/status-warn.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/system-help.png b/piqt_utils/piconnedit/icons/system-help.png deleted file mode 100644 index 86b6407..0000000 Binary files a/piqt_utils/piconnedit/icons/system-help.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/tool-light-add.png b/piqt_utils/piconnedit/icons/tool-light-add.png deleted file mode 100644 index a16d5fa..0000000 Binary files a/piqt_utils/piconnedit/icons/tool-light-add.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/tool-selection.png b/piqt_utils/piconnedit/icons/tool-selection.png deleted file mode 100644 index 8ca8dbd..0000000 Binary files a/piqt_utils/piconnedit/icons/tool-selection.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/tools-wizard.png b/piqt_utils/piconnedit/icons/tools-wizard.png deleted file mode 100644 index f67fb4c..0000000 Binary files a/piqt_utils/piconnedit/icons/tools-wizard.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/transform-move.png b/piqt_utils/piconnedit/icons/transform-move.png deleted file mode 100644 index 0bd8d04..0000000 Binary files a/piqt_utils/piconnedit/icons/transform-move.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/variable-add.png b/piqt_utils/piconnedit/icons/variable-add.png deleted file mode 100644 index 0a551b1..0000000 Binary files a/piqt_utils/piconnedit/icons/variable-add.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/variable-copy.png b/piqt_utils/piconnedit/icons/variable-copy.png deleted file mode 100644 index 42d91c3..0000000 Binary files a/piqt_utils/piconnedit/icons/variable-copy.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/variable-edit.png b/piqt_utils/piconnedit/icons/variable-edit.png deleted file mode 100644 index 420ace3..0000000 Binary files a/piqt_utils/piconnedit/icons/variable-edit.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/variable-remove.png b/piqt_utils/piconnedit/icons/variable-remove.png deleted file mode 100644 index 0686e7c..0000000 Binary files a/piqt_utils/piconnedit/icons/variable-remove.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/view-grid.png b/piqt_utils/piconnedit/icons/view-grid.png deleted file mode 100644 index 0f1d70c..0000000 Binary files a/piqt_utils/piconnedit/icons/view-grid.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/view-refresh.png b/piqt_utils/piconnedit/icons/view-refresh.png deleted file mode 100644 index afa2a9d..0000000 Binary files a/piqt_utils/piconnedit/icons/view-refresh.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/warning-a.png b/piqt_utils/piconnedit/icons/warning-a.png deleted file mode 100644 index 95cb849..0000000 Binary files a/piqt_utils/piconnedit/icons/warning-a.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/warning-id.png b/piqt_utils/piconnedit/icons/warning-id.png deleted file mode 100644 index a8bc774..0000000 Binary files a/piqt_utils/piconnedit/icons/warning-id.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/window-close.png b/piqt_utils/piconnedit/icons/window-close.png deleted file mode 100644 index ea6b607..0000000 Binary files a/piqt_utils/piconnedit/icons/window-close.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/zoom-fit-best.png b/piqt_utils/piconnedit/icons/zoom-fit-best.png deleted file mode 100644 index 07cfc98..0000000 Binary files a/piqt_utils/piconnedit/icons/zoom-fit-best.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/zoom-in.png b/piqt_utils/piconnedit/icons/zoom-in.png deleted file mode 100644 index 8393e28..0000000 Binary files a/piqt_utils/piconnedit/icons/zoom-in.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/zoom-out.png b/piqt_utils/piconnedit/icons/zoom-out.png deleted file mode 100644 index f66575e..0000000 Binary files a/piqt_utils/piconnedit/icons/zoom-out.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/zoom-range.png b/piqt_utils/piconnedit/icons/zoom-range.png deleted file mode 100644 index c052512..0000000 Binary files a/piqt_utils/piconnedit/icons/zoom-range.png and /dev/null differ diff --git a/piqt_utils/piconnedit/icons/zoom-rect.png b/piqt_utils/piconnedit/icons/zoom-rect.png deleted file mode 100644 index da44fd5..0000000 Binary files a/piqt_utils/piconnedit/icons/zoom-rect.png and /dev/null differ diff --git a/piqt_utils/piconnedit/piconnedit.qrc b/piqt_utils/piconnedit/piconnedit.qrc deleted file mode 100644 index 6ea99d5..0000000 --- a/piqt_utils/piconnedit/piconnedit.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - icons/edit-clear-.png - icons/document-save-.png - - diff --git a/piqt_utils/pidumper/CMakeLists.txt b/piqt_utils/pidumper/CMakeLists.txt deleted file mode 100644 index 464d84d..0000000 --- a/piqt_utils/pidumper/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -project(pidumper) -file(GLOB SRC "*.h" "*.cpp" "*.ui" "*.qrc" "lang/*.ts") -find_qt(${QtVersions} Core Gui) -qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM) -qt_add_executable(${PROJECT_NAME} WIN32 out_CPP) -qt_target_link_libraries(${PROJECT_NAME} pip qad_utils qad_widgets piqt_utils) -qt_target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../") -message(STATUS "Building ${PROJECT_NAME}") -if(LIB) - if(WIN32) - qt_install(TARGETS ${PROJECT_NAME} DESTINATION ${MINGW_BIN}) - else() - if (DEFINED ANDROID_PLATFORM) - qt_install(TARGETS ${PROJECT_NAME} DESTINATION ${ANDROID_SYSTEM_LIBRARY_PATH}/usr/bin) - else() - qt_install(TARGETS ${PROJECT_NAME} DESTINATION /usr/local/bin) - endif() - endif() - #message(STATUS "Install ${PROJECT_NAME} to system \"${CMAKE_INSTALL_PREFIX}\"") -else() - qt_install(TARGETS ${PROJECT_NAME} DESTINATION bin) - #message(STATUS "Install ${PROJECT_NAME} to local \"bin\"") -endif() diff --git a/piqt_utils/piintrospector/CMakeLists.txt b/piqt_utils/piintrospector/CMakeLists.txt deleted file mode 100644 index 3e607b0..0000000 --- a/piqt_utils/piintrospector/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -project(piintrospector) -file(GLOB SRC "*.h" "*.cpp" "*.ui" "*.qrc" "lang/*.ts") -set(PII_ROOT "../../pip/lib/main/introspection") -pip_code_model(PII_CCM "${PII_ROOT}/piintrospection_server_p.h" "${PII_ROOT}/piintrospection_threads_p.h" OPTIONS "-DPIP_EXPORT" "-Es") -find_qt(${QtVersions} Core Gui) -qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM) -qt_add_executable(${PROJECT_NAME} WIN32 out_CPP PII_CCM) -qt_target_link_libraries(${PROJECT_NAME} pip qad_utils qad_widgets qad_application piqt_utils) -qt_target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../") -message(STATUS "Building ${PROJECT_NAME}") -if(LIB) - if(WIN32) - qt_install(TARGETS ${PROJECT_NAME} DESTINATION ${MINGW_BIN}) - else() - if (DEFINED ANDROID_PLATFORM) - qt_install(TARGETS ${PROJECT_NAME} DESTINATION ${ANDROID_SYSTEM_LIBRARY_PATH}/usr/bin) - else() - qt_install(TARGETS ${PROJECT_NAME} DESTINATION /usr/local/bin) - endif() - endif() - #message(STATUS "Install ${PROJECT_NAME} to system \"${CMAKE_INSTALL_PREFIX}\"") -else() - qt_install(TARGETS ${PROJECT_NAME} DESTINATION bin) - #message(STATUS "Install ${PROJECT_NAME} to local \"bin\"") -endif() diff --git a/qad/CMakeLists.txt b/qad/CMakeLists.txt index 210183b..e23b647 100644 --- a/qad/CMakeLists.txt +++ b/qad/CMakeLists.txt @@ -8,35 +8,14 @@ set(_QAD_SUFFIX ) set(_QAD_COMPANY SHS) set(_QAD_DOMAIN org.SHS) -if ("x${CMAKE_MODULE_PATH}" STREQUAL "x") - set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -endif() -if (NOT LIBPROJECT) - set(_plugins_default_ 1) - if (DEFINED ANDROID_PLATFORM) - set(_plugins_default_ 0) - endif() - option(LIB "System install" 1) - option(DEBUG "Build with -g3" 0) - option(DESIGNER_PLUGINS "Build qt designer plugins" ${_plugins_default_}) - option(STATIC_LIB OFF) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall") - if (DEBUG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3") - endif () -endif() - +include(QADMacros) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) -set(EXPORT_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/qad_export.h") - if(STATIC_LIB) set(QAD_LIB_TYPE STATIC) add_definitions(-DQAD_STATIC_DEFINE) - #message(STATUS "Building QAD static libraries") else() set(QAD_LIB_TYPE SHARED) - #message(STATUS "Building QAD shared libraries") endif() if (NOT DEFINED ANDROID_PLATFORM) @@ -59,6 +38,9 @@ set_version(QAD BUILD "${BUILD_NUMBER}" SUFFIX "${_QAD_SUFFIX}" OUTPUT "${QAD_VERSION_FILE}") +set_deploy_property(QAD ${QAD_LIB_TYPE} + FULLNAME "${_QAD_DOMAIN}.*" + COMPANY "${_QAD_COMPANY}") message(STATUS "Building QAD version ${QAD_VERSION} (${QAD_LIB_TYPE})") @@ -86,124 +68,22 @@ file(GLOB CMAKES "cmake/*.cmake" "cmake/*.in") if (LIB) install(FILES ${CMAKES} DESTINATION ${CMAKE_ROOT}/Modules) if (WIN32) - install(FILES ${EXPORT_HEADER} DESTINATION ${MINGW_INCLUDE}/qad) + install(FILES ${QAD_VERSION_FILE} DESTINATION ${MINGW_INCLUDE}/qad) else() - install(FILES ${EXPORT_HEADER} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/qad) + install(FILES ${QAD_VERSION_FILE} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/qad) endif() else() - install(FILES ${EXPORT_HEADER} DESTINATION include/qad) + install(FILES ${QAD_VERSION_FILE} DESTINATION include/qad) endif() -macro(qad_install _TARGET _HDR_VAR _QM_FILES) - if ("${_TARGET}" STREQUAL "qad_utils") - list(APPEND ${_HDR_VAR} "${QAD_VERSION_FILE}") - endif() - if (LIBPROJECT) - sdk_install("qad" "${_TARGET}" "${${_HDR_VAR}}" "${_QM_FILES}") - else() - if (LIB) - if (WIN32) - if(NOT "x${${_HDR_VAR}}" STREQUAL "x") - install(FILES ${${_HDR_VAR}} DESTINATION ${MINGW_INCLUDE}/qad) - endif() - qt_install(TARGETS ${_TARGET} ARCHIVE DESTINATION ${MINGW_LIB}) - qt_install(TARGETS ${_TARGET} RUNTIME DESTINATION ${MINGW_BIN}) - qt_install(TARGETS ${_TARGET} RUNTIME DESTINATION QtBin) - else() - if(NOT "x${${_HDR_VAR}}" STREQUAL "x") - install(FILES ${${_HDR_VAR}} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/qad) - endif() - qt_install(TARGETS ${_TARGET} ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) - endif() - if(NOT "x${_QM_FILES}" STREQUAL "x") - qt_install(LANG ${_QM_FILES} DESTINATION QtLang) - endif() - else() - if(WIN32) - qt_install(TARGETS ${_TARGET} RUNTIME DESTINATION bin) - qt_install(TARGETS ${_TARGET} ARCHIVE DESTINATION lib) - else() - qt_install(TARGETS ${_TARGET} DESTINATION lib) - endif() - if(NOT "x${${_HDR_VAR}}" STREQUAL "x") - install(FILES ${${_HDR_VAR}} DESTINATION include/qad) - endif() - if(NOT "x${_QM_FILES}" STREQUAL "x") - qt_install(LANG ${_QM_FILES} DESTINATION lang) - endif() - endif() - endif() -endmacro() +add_subdirectory(libs) +if (UTILS) + add_subdirectory(utils) +endif() -macro(qad_plugin NAME _MODULES _LIBS) - if (NOT STATIC_LIB) - if(DESIGNER_PLUGINS) - set(PROJ_NAME qad_${NAME}_plugin) - include_directories("..") - add_definitions(-DQT_PLUGIN) - add_definitions(-DQT_NO_DEBUG) - add_definitions(-DQT_SHARED) - add_definitions(-DQDESIGNER_EXPORT_WIDGETS) - find_qt(${QtVersions} Core Designer ${_MODULES}) - qt_sources(SRC) - qt_wrap(${SRC} CPPS out_CPP QMS out_QM) - qt_add_library(${PROJ_NAME} SHARED out_CPP) - qt_target_link_libraries(${PROJ_NAME} ${_LIBS} qad_${NAME} ${_${NAME}_PLUGIN_LIBS}) - if (WIN32) - qt_install(TARGETS ${PROJ_NAME} RUNTIME DESTINATION QtPlugins/designer) - else() - qt_install(TARGETS ${PROJ_NAME} DESTINATION QtPlugins/designer) - endif() - endif() - endif() -endmacro() - -macro(qad_project NAME _MODULES _LIBS) - set(PROJ_NAME qad_${NAME}) - find_qt(${QtVersions} Core ${_MODULES}) - qt_sources(SRC) - import_version(${PROJ_NAME} QAD) - if(NOT STATIC_LIB) - set_deploy_property(${PROJ_NAME} SHARED - LABEL ${PROJ_NAME} - FULLNAME "${_QAD_DOMAIN}.${PROJ_NAME}" - COMPANY ${_QAD_COMPANY} - INFO "QAD ${NAME} library") - else() - set_deploy_property(${PROJ_NAME} STATIC - LABEL ${PROJ_NAME} - FULLNAME "${_QAD_DOMAIN}.${PROJ_NAME}" - COMPANY ${_QAD_COMPANY} - INFO "QAD ${NAME} library") - endif() - make_rc(${PROJ_NAME} out_RC) - qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM ${out_RC}) - qt_add_library(${PROJ_NAME} ${QAD_LIB_TYPE} out_CPP ${EXPORT_HEADER}) - if(NOT STATIC_LIB) - qt_target_compile_definitions(${PROJ_NAME} PRIVATE QAD_SHARED_DEFINE) - endif() - qt_target_link_libraries(${PROJ_NAME} ${_LIBS}) - qad_install(${PROJ_NAME} "out_HDR" "out_QM") - set(${NAME}_UTILS 1) - if (LIBPROJECT) - set(${NAME}_UTILS ${UTILS}) - endif() - message(STATUS "Building ${PROJ_NAME}") - if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/plugin") - set(_${NAME}_PLUGIN_LIBS "${_LIBS}") - add_subdirectory(plugin) - endif() -endmacro() - -set(DIRS utils widgets application blockview graphic sql_table touch_widgets doc) -foreach(D ${DIRS}) - list(APPEND QT_MULTILIB_LIST qad_${D}) -endforeach(D) set(QT_MULTILIB_LIST ${QT_MULTILIB_LIST} PARENT_SCOPE) -foreach(D ${DIRS}) - include_directories(${D}) - add_subdirectory(${D}) -endforeach(D) +set(qad_includes ${qad_includes} PARENT_SCOPE) if (LIB) set(_ALL_TARGETS ${_ALL_TARGETS} PARENT_SCOPE) endif() + diff --git a/qad/application/CMakeLists.txt b/qad/application/CMakeLists.txt deleted file mode 100644 index 1c3f057..0000000 --- a/qad/application/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -qad_project(application "Gui;Widgets" "qad_widgets") diff --git a/qad/application/qad_application.qrc b/qad/application/qad_application.qrc deleted file mode 100644 index aed461c..0000000 --- a/qad/application/qad_application.qrc +++ /dev/null @@ -1,35 +0,0 @@ - - - lang/qad_application_ru.ts - ../icons/application-exit.png - ../icons/dialog-close.png - ../icons/configure.png - ../icons/document-edit.png - ../icons/document-new.png - ../icons/document-save.png - ../icons/document-save-all.png - ../icons/document-save-as.png - ../icons/document-open.png - ../icons/document-open-recent.png - ../icons/document-close.png - ../icons/edit-clear.png - ../icons/edit-clear-locationbar-rtl.png - ../icons/edit-find.png - ../icons/list-add.png - ../icons/edit-delete.png - ../icons/edit-copy.png - ../icons/edit-paste.png - ../icons/edit-undo.png - ../icons/edit-redo.png - ../icons/border-line.png - ../icons/edockwidget.png - ../icons/historyview.png - ../icons/clear-history.png - ../icons/layer-visible-off.png - ../icons/layer-visible-on.png - ../icons/logview.png - ../icons/qt.png - ../icons/select-all.png - ../icons/select-none.png - - diff --git a/qad/blockview/CMakeLists.txt b/qad/blockview/CMakeLists.txt deleted file mode 100644 index 9f788a4..0000000 --- a/qad/blockview/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -qad_project(blockview "Gui;Widgets" "qad_utils;qad_widgets") -if (blockview_UTILS) - add_subdirectory(blockeditor) -endif() diff --git a/qad/blockview/blockeditor/CMakeLists.txt b/qad/blockview/blockeditor/CMakeLists.txt deleted file mode 100644 index d69d9d8..0000000 --- a/qad/blockview/blockeditor/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -project(blockeditor) -import_version(${PROJECT_NAME} QAD) -find_qt(${QtVersions} Core Gui Widgets) -if (Qt5_FOUND) - import_version(${PROJECT_NAME}5 ${PROJECT_NAME}) - import_deploy_properties(${PROJECT_NAME}5 ${PROJECT_NAME}) -endif() -set_deploy_property(${PROJECT_NAME} - LABEL ${PROJECT_NAME} - FULLNAME "${_QAD_DOMAIN}.${PROJECT_NAME}" - COMPANY ${_QAD_COMPANY} - INFO "Editor for BlockView Blocks") -if(APPLE) - #set_deploy_property(${PROJECT_NAME} ICON "icons/blockview.icns") -elseif(WIN32) - set_deploy_property(${PROJECT_NAME} ICON "icons/blockview.ico") -else() - set_deploy_property(${PROJECT_NAME} ICON "icons/blockview.png") -endif() -make_rc(${PROJECT_NAME} out_RC) -qt_sources(SRC) -qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM) -qt_add_executable(${PROJECT_NAME} WIN32 out_CPP ${out_RC}) -qt_target_link_libraries(${PROJECT_NAME} qad_utils qad_widgets qad_blockview) -message(STATUS "Building ${PROJECT_NAME}") -if(LIB) - if(WIN32) - qt_install(TARGETS ${PROJECT_NAME} DESTINATION ${MINGW_BIN}) - else() - if (DEFINED ANDROID_PLATFORM) - qt_install(TARGETS ${PROJECT_NAME} DESTINATION ${ANDROID_SYSTEM_LIBRARY_PATH}/usr/bin) - else() - qt_install(TARGETS ${PROJECT_NAME} DESTINATION /usr/local/bin) - endif() - endif() - #message(STATUS "Install ${PROJECT_NAME} to system \"${CMAKE_INSTALL_PREFIX}\"") -else() - qt_install(TARGETS ${PROJECT_NAME} DESTINATION bin) -endif() -if (Qt5_FOUND) - deploy_target(${PROJECT_NAME}5 VERBOSE DEPLOY_DIR ${CMAKE_CURRENT_BINARY_DIR} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/../release) -endif() diff --git a/qad/blockview/qad_blockview.qrc b/qad/blockview/qad_blockview.qrc deleted file mode 100644 index 03b9335..0000000 --- a/qad/blockview/qad_blockview.qrc +++ /dev/null @@ -1,51 +0,0 @@ - - - ../icons/draw-line.png - ../icons/align-hor.png - ../icons/align-ver.png - ../icons/dialog-close.png - ../icons/edit-clear.png - ../icons/edit-guides.png - ../icons/view-grid.png - ../icons/zoom-fit-best.png - ../icons/configure.png - ../icons/document-save.png - ../icons/edit-clear-locationbar-rtl.png - ../icons/edit-find.png - ../icons/list-add.png - ../icons/edit-delete.png - ../icons/item.png - ../icons/node-add.png - ../icons/node.png - ../icons/edit-copy.png - ../icons/edit-paste.png - ../icons/expand_s_x.png - ../icons/expand_s_y.png - ../icons/expand_x.png - ../icons/expand_y.png - ../icons/border-line.png - ../icons/legend.png - ../icons/blockview.png - ../icons/view-fullscreen.png - ../icons/draw-ellipse.png - ../icons/draw-rectangle.png - ../icons/draw-text.png - ../icons/view-preview.png - ../icons/format-fill-color.png - ../icons/format-stroke-color.png - ../icons/document-open.png - ../icons/align-bottom-center.png - ../icons/align-bottom-left.png - ../icons/align-bottom-right.png - ../icons/align-center-center.png - ../icons/align-center-left.png - ../icons/align-center-right.png - ../icons/align-top-center.png - ../icons/align-top-left.png - ../icons/align-top-right.png - ../icons/z-bottom.png - ../icons/z-down.png - ../icons/z-top.png - ../icons/z-up.png - - diff --git a/qad/cmake/QADMacros.cmake b/qad/cmake/QADMacros.cmake new file mode 100644 index 0000000..63eb900 --- /dev/null +++ b/qad/cmake/QADMacros.cmake @@ -0,0 +1,87 @@ + +macro(_qt_install _TARGET IS_APP _DIR _HDR_VAR _QM_FILES) + sdk_install("${_DIR}" ${IS_APP} "${_TARGET}" "${${_HDR_VAR}}" "${_QM_FILES}") +endmacro() + + +macro(qad_plugin NAME _MODULES _LIBS) + if (NOT STATIC_LIB) + if(DESIGNER_PLUGINS) + set(PROJ_NAME qad_${NAME}_plugin) + include_directories("..") + add_definitions(-DQT_PLUGIN) + add_definitions(-DQT_NO_DEBUG) + add_definitions(-DQT_SHARED) + add_definitions(-DQDESIGNER_EXPORT_WIDGETS) + find_qt(${QtVersions} Core Designer ${_MODULES}) + qt_sources(SRC) + qt_wrap(${SRC} CPPS out_CPP QMS out_QM) + qt_add_library(${PROJ_NAME} SHARED out_CPP) + qt_target_link_libraries(${PROJ_NAME} ${_LIBS} qad_${NAME} ${_${NAME}_PLUGIN_LIBS}) + if (WIN32) + qt_install(TARGETS ${PROJ_NAME} RUNTIME DESTINATION QtPlugins/designer) + else() + qt_install(TARGETS ${PROJ_NAME} DESTINATION QtPlugins/designer) + endif() + endif() + endif() +endmacro() + + +macro(_qt_project NAME IS_APP DOMAIN _MODULES _LIBS) + set(PROJ_NAME ${NAME}) + find_qt(${QtVersions} Core ${_MODULES}) + qt_sources(SRC) + import_version(${PROJ_NAME} ${DOMAIN}) + import_deploy_properties(${PROJ_NAME} ${DOMAIN}) + if (${IS_APP}) + set_deploy_property(${PROJ_NAME} + LABEL ${PROJ_NAME} + FULLNAME "${_${DOMAIN}_DOMAIN}.${PROJ_NAME}" + INFO "${APP_INFO}" + ICON "${APP_ICON}") + else() + set_deploy_property(${PROJ_NAME} SHARED + LABEL ${PROJ_NAME} + FULLNAME "${_${DOMAIN}_DOMAIN}.${PROJ_NAME}" + INFO "${DOMAIN} ${NAME} library") + endif() + make_rc(${PROJ_NAME} out_RC) + qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM ${out_RC}) + if (${IS_APP}) + qt_add_executable(${PROJ_NAME} WIN32 out_CPP ${${DOMAIN}_EXPORT_HEADER} ${ARGN}) + else() + qt_add_library(${PROJ_NAME} ${${DOMAIN}_LIB_TYPE} out_CPP ${${DOMAIN}_EXPORT_HEADER} ${ARGN}) + if(NOT STATIC_LIB) + qt_target_compile_definitions(${PROJ_NAME} PRIVATE ${DOMAIN}_SHARED_DEFINE) + endif() + qt_get_target(${PROJ_NAME} _some_target) + qt_get_target(${PROJ_NAME} _targets) + foreach(_t ${_targets}) + set_target_properties(${_t} PROPERTIES DEFINE_SYMBOL ${PROJ_NAME}_EXPORTS) + endforeach() + set_target_properties(${_some_target} PROPERTIES DEFINE_SYMBOL ${PROJ_NAME}_EXPORTS) + generate_export_header(${_some_target} BASE_NAME "${PROJ_NAME}") + list(APPEND out_HDR "${CMAKE_CURRENT_BINARY_DIR}/${PROJ_NAME}_export.h") + endif() + qt_target_link_libraries(${PROJ_NAME} ${_LIBS}) + list(APPEND QT_MULTILIB_LIST ${PROJ_NAME}) + set(QT_MULTILIB_LIST ${QT_MULTILIB_LIST} PARENT_SCOPE) + message(STATUS "Building ${PROJ_NAME}") + if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/plugin") + set(_${NAME}_PLUGIN_LIBS "${_LIBS}") + add_subdirectory(plugin) + endif() +endmacro() + + +macro(qad_library NAME _MODULES _LIBS) + _qt_project(qad_${NAME} FALSE "QAD" "${_MODULES}" "${_LIBS}") + _qt_install(qad_${NAME} FALSE "qad" "out_HDR" "out_QM") +endmacro() + + +macro(qad_application NAME _MODULES _LIBS) + _qt_project(${NAME} TRUE "QAD" "${_MODULES}" "${_LIBS}") + _qt_install(${NAME} TRUE "qad" "" "out_QM") +endmacro() diff --git a/qad/cmake/QtWraps.cmake b/qad/cmake/QtWraps.cmake index 936a8ab..b25b04d 100644 --- a/qad/cmake/QtWraps.cmake +++ b/qad/cmake/QtWraps.cmake @@ -101,6 +101,23 @@ in Qt_LANG_DIR for _LANG languages and install them to . PATH are additional search paths. You should use "set_lang()" macro before this action + + + +qt_get_target( [Qt4 | Qt5]) + +Write real Qt target name to +If Qt4 or Qt5 specified, search for this version, +otherwise returns greatest version + + + + +qt_get_targets( ) + +Write all real Qt target names to + + ]] @@ -742,3 +759,35 @@ macro(qt_install_lang _NAME) endif() endforeach() endmacro() + + +macro(qt_get_target _NAME _OUT) + set(${_OUT}) + set(_ver) + foreach(_i ${ARGN}) + foreach(_v ${_QT_VERSIONS_}) + if ("x${_i}" STREQUAL "xQt${_v}") + set(_ver ${_v}) + break() + endif() + endforeach() + if (NOT "x${_ver}" STREQUAL "x") + break() + endif() + endforeach() + foreach(_v ${_QT_VERSIONS_}) + if (LOCAL_FOUND${_v} AND (("x${_ver}" STREQUAL "x") OR ((NOT "x${_ver}" STREQUAL "x") AND ("x${_ver}" STREQUAL "x${_v}")))) + set(${_OUT} ${_NAME}${TARGET_SUFFIX_Qt${_v}}) + endif() + endforeach() +endmacro() + + +macro(qt_get_targets _NAME _OUT) + set(${_OUT}) + foreach(_v ${_QT_VERSIONS_}) + if (LOCAL_FOUND${_v}) + list(APPEND ${_OUT} ${_NAME}${TARGET_SUFFIX_Qt${_v}}) + endif() + endforeach() +endmacro() diff --git a/qad/graphic/CMakeLists.txt b/qad/graphic/CMakeLists.txt deleted file mode 100644 index 6c37c79..0000000 --- a/qad/graphic/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -qad_project(graphic "Gui;Widgets;OpenGL" "qad_widgets;qad_utils;${OPENGL_LIBRARIES}") -if (graphic_UTILS) - add_subdirectory(qpicalculator) -endif() diff --git a/qad/graphic/qad_graphic.qrc b/qad/graphic/qad_graphic.qrc deleted file mode 100644 index 3ca1b8e..0000000 --- a/qad/graphic/qad_graphic.qrc +++ /dev/null @@ -1,28 +0,0 @@ - - - ../icons/media-playback-pause.png - ../icons/dialog-close.png - ../icons/edit-clear.png - ../icons/edit-guides.png - ../icons/view-grid.png - ../icons/view-autofit.png - ../icons/configure.png - ../icons/document-save.png - ../icons/edit-clear-locationbar-rtl.png - ../icons/edit-find.png - ../icons/list-add.png - ../icons/edit-delete.png - ../icons/edit-copy.png - ../icons/edit-paste.png - ../icons/expand_s_x.png - ../icons/expand_s_y.png - ../icons/expand_x.png - ../icons/expand_y.png - ../icons/border-line.png - ../icons/legend.png - ../icons/graphic.png - ../icons/view-fullscreen.png - ../icons/pause-back.png - ../icons/pause-front.png - - diff --git a/qad/graphic/qpicalculator/CMakeLists.txt b/qad/graphic/qpicalculator/CMakeLists.txt deleted file mode 100644 index 8fc0ca6..0000000 --- a/qad/graphic/qpicalculator/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -project(qpicalc) -find_qt(${QtVersions} Core Gui Widgets) -qt_sources(SRC) -qt_wrap(${SRC} CPPS out_CPP QMS out_QM) -qt_add_executable(${PROJECT_NAME} WIN32 out_CPP) -qt_target_link_libraries(${PROJECT_NAME} qad_utils qad_widgets qad_graphic) -message(STATUS "Building ${PROJECT_NAME}") -if(LIB) - if(WIN32) - qt_install(TARGETS ${PROJECT_NAME} DESTINATION ${MINGW_BIN}) - else() - if (DEFINED ANDROID_PLATFORM) - qt_install(TARGETS ${PROJECT_NAME} DESTINATION ${ANDROID_SYSTEM_LIBRARY_PATH}/usr/bin) - else() - qt_install(TARGETS ${PROJECT_NAME} DESTINATION /usr/local/bin) - endif() - endif() - #message(STATUS "Install ${PROJECT_NAME} to system \"${CMAKE_INSTALL_PREFIX}\"") -else() - qt_install(TARGETS ${PROJECT_NAME} DESTINATION bin) - #message(STATUS "Install ${PROJECT_NAME} to local \"bin\"") -endif() - diff --git a/qad/graphic/qpicalculator/CMakeLists.txt.user b/qad/graphic/qpicalculator/CMakeLists.txt.user deleted file mode 100644 index 6d91a76..0000000 --- a/qad/graphic/qpicalculator/CMakeLists.txt.user +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - EnvironmentId - {948faa78-0b50-402e-a285-1bca3b08de64} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - false - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - - ProjectExplorer.Project.Target.0 - - DesktopBuild - DesktopBuild - {3c749452-9483-442d-b011-933a1b5dac10} - 0 - 0 - 0 - - false - D:/work/qpicalculator-build - - - - - false - true - Сборка - - CMakeProjectManager.MakeStep - - 1 - Сборка - - ProjectExplorer.BuildSteps.Build - - - - clean - - true - true - Сборка - - CMakeProjectManager.MakeStep - - 1 - Очистка - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - all - - CMakeProjectManager.CMakeBuildConfiguration - - 1 - - - 0 - Установка - - ProjectExplorer.BuildSteps.Deploy - - 1 - Локальная установка - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 3 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - qpicalculator - - false - - 2 - - qpicalculator - - CMakeProjectManager.CMakeRunConfiguration.qpicalculator - 3768 - false - true - false - false - true - - 1 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.FileVersion - 16 - - - Version - 16 - - diff --git a/qad/graphic/qpicalculator/icons/Apps-accessories-calculator-icon.png b/qad/graphic/qpicalculator/icons/Apps-accessories-calculator-icon.png deleted file mode 100644 index 37a3035..0000000 Binary files a/qad/graphic/qpicalculator/icons/Apps-accessories-calculator-icon.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/application-exit.png b/qad/graphic/qpicalculator/icons/application-exit.png deleted file mode 100644 index 4839c61..0000000 Binary files a/qad/graphic/qpicalculator/icons/application-exit.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/arrow-left.png b/qad/graphic/qpicalculator/icons/arrow-left.png deleted file mode 100644 index 0a74ecf..0000000 Binary files a/qad/graphic/qpicalculator/icons/arrow-left.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/arrow-right.png b/qad/graphic/qpicalculator/icons/arrow-right.png deleted file mode 100644 index 0a8a69e..0000000 Binary files a/qad/graphic/qpicalculator/icons/arrow-right.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/axes.png b/qad/graphic/qpicalculator/icons/axes.png deleted file mode 100644 index 11a059d..0000000 Binary files a/qad/graphic/qpicalculator/icons/axes.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/axes_1.png b/qad/graphic/qpicalculator/icons/axes_1.png deleted file mode 100644 index cb54382..0000000 Binary files a/qad/graphic/qpicalculator/icons/axes_1.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/character-set.png b/qad/graphic/qpicalculator/icons/character-set.png deleted file mode 100644 index 9be1a10..0000000 Binary files a/qad/graphic/qpicalculator/icons/character-set.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/configure.png b/qad/graphic/qpicalculator/icons/configure.png deleted file mode 100644 index 5ce478b..0000000 Binary files a/qad/graphic/qpicalculator/icons/configure.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/dialog-close.png b/qad/graphic/qpicalculator/icons/dialog-close.png deleted file mode 100644 index 2c2f99e..0000000 Binary files a/qad/graphic/qpicalculator/icons/dialog-close.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/document-close.png b/qad/graphic/qpicalculator/icons/document-close.png deleted file mode 100644 index d3937b9..0000000 Binary files a/qad/graphic/qpicalculator/icons/document-close.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/document-edit.png b/qad/graphic/qpicalculator/icons/document-edit.png deleted file mode 100644 index 84e345d..0000000 Binary files a/qad/graphic/qpicalculator/icons/document-edit.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/document-open.png b/qad/graphic/qpicalculator/icons/document-open.png deleted file mode 100644 index b225e9a..0000000 Binary files a/qad/graphic/qpicalculator/icons/document-open.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/document-revert.png b/qad/graphic/qpicalculator/icons/document-revert.png deleted file mode 100644 index b224e05..0000000 Binary files a/qad/graphic/qpicalculator/icons/document-revert.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/document-save-as.png b/qad/graphic/qpicalculator/icons/document-save-as.png deleted file mode 100644 index 821ca12..0000000 Binary files a/qad/graphic/qpicalculator/icons/document-save-as.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/document-save.png b/qad/graphic/qpicalculator/icons/document-save.png deleted file mode 100644 index 8072aea..0000000 Binary files a/qad/graphic/qpicalculator/icons/document-save.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/edit-clear-locationbar-rtl.png b/qad/graphic/qpicalculator/icons/edit-clear-locationbar-rtl.png deleted file mode 100644 index 6c4b83b..0000000 Binary files a/qad/graphic/qpicalculator/icons/edit-clear-locationbar-rtl.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/edit-clear.png b/qad/graphic/qpicalculator/icons/edit-clear.png deleted file mode 100644 index 19a1665..0000000 Binary files a/qad/graphic/qpicalculator/icons/edit-clear.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/edit-copy.png b/qad/graphic/qpicalculator/icons/edit-copy.png deleted file mode 100644 index 5cdeb5f..0000000 Binary files a/qad/graphic/qpicalculator/icons/edit-copy.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/edit-cut.png b/qad/graphic/qpicalculator/icons/edit-cut.png deleted file mode 100644 index f4a55e3..0000000 Binary files a/qad/graphic/qpicalculator/icons/edit-cut.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/edit-delete.png b/qad/graphic/qpicalculator/icons/edit-delete.png deleted file mode 100644 index 87cd0b0..0000000 Binary files a/qad/graphic/qpicalculator/icons/edit-delete.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/edit-find.png b/qad/graphic/qpicalculator/icons/edit-find.png deleted file mode 100644 index 9a462c0..0000000 Binary files a/qad/graphic/qpicalculator/icons/edit-find.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/edit-guides.png b/qad/graphic/qpicalculator/icons/edit-guides.png deleted file mode 100644 index d264839..0000000 Binary files a/qad/graphic/qpicalculator/icons/edit-guides.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/edit-paste.png b/qad/graphic/qpicalculator/icons/edit-paste.png deleted file mode 100644 index a4e0a02..0000000 Binary files a/qad/graphic/qpicalculator/icons/edit-paste.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/edit-redo.png b/qad/graphic/qpicalculator/icons/edit-redo.png deleted file mode 100644 index 9bfee2d..0000000 Binary files a/qad/graphic/qpicalculator/icons/edit-redo.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/edit-undo.png b/qad/graphic/qpicalculator/icons/edit-undo.png deleted file mode 100644 index 83e41dc..0000000 Binary files a/qad/graphic/qpicalculator/icons/edit-undo.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/empty_brick.png b/qad/graphic/qpicalculator/icons/empty_brick.png deleted file mode 100644 index b09680b..0000000 Binary files a/qad/graphic/qpicalculator/icons/empty_brick.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/format-fill-color.png b/qad/graphic/qpicalculator/icons/format-fill-color.png deleted file mode 100644 index 6601f53..0000000 Binary files a/qad/graphic/qpicalculator/icons/format-fill-color.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/format-text-bold.png b/qad/graphic/qpicalculator/icons/format-text-bold.png deleted file mode 100644 index 3abb164..0000000 Binary files a/qad/graphic/qpicalculator/icons/format-text-bold.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/format-text-color.png b/qad/graphic/qpicalculator/icons/format-text-color.png deleted file mode 100644 index 9e86afc..0000000 Binary files a/qad/graphic/qpicalculator/icons/format-text-color.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/format-text-italic.png b/qad/graphic/qpicalculator/icons/format-text-italic.png deleted file mode 100644 index 93ec082..0000000 Binary files a/qad/graphic/qpicalculator/icons/format-text-italic.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/format-text-overline.png b/qad/graphic/qpicalculator/icons/format-text-overline.png deleted file mode 100644 index e49a11c..0000000 Binary files a/qad/graphic/qpicalculator/icons/format-text-overline.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/format-text-strikethrough.png b/qad/graphic/qpicalculator/icons/format-text-strikethrough.png deleted file mode 100644 index f248ce0..0000000 Binary files a/qad/graphic/qpicalculator/icons/format-text-strikethrough.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/format-text-underline.png b/qad/graphic/qpicalculator/icons/format-text-underline.png deleted file mode 100644 index 7e47fb8..0000000 Binary files a/qad/graphic/qpicalculator/icons/format-text-underline.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/go-home.png b/qad/graphic/qpicalculator/icons/go-home.png deleted file mode 100644 index aab6a88..0000000 Binary files a/qad/graphic/qpicalculator/icons/go-home.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/go-next.png b/qad/graphic/qpicalculator/icons/go-next.png deleted file mode 100644 index aa7cbb9..0000000 Binary files a/qad/graphic/qpicalculator/icons/go-next.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/go-previous.png b/qad/graphic/qpicalculator/icons/go-previous.png deleted file mode 100644 index 8230340..0000000 Binary files a/qad/graphic/qpicalculator/icons/go-previous.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/graphic_add.png b/qad/graphic/qpicalculator/icons/graphic_add.png deleted file mode 100644 index a002a95..0000000 Binary files a/qad/graphic/qpicalculator/icons/graphic_add.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/graphics.png b/qad/graphic/qpicalculator/icons/graphics.png deleted file mode 100644 index 8cd2359..0000000 Binary files a/qad/graphic/qpicalculator/icons/graphics.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/help-contents.png b/qad/graphic/qpicalculator/icons/help-contents.png deleted file mode 100644 index b3fbea8..0000000 Binary files a/qad/graphic/qpicalculator/icons/help-contents.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/history_brick_add.png b/qad/graphic/qpicalculator/icons/history_brick_add.png deleted file mode 100644 index 808b43d..0000000 Binary files a/qad/graphic/qpicalculator/icons/history_brick_add.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/history_brick_del.png b/qad/graphic/qpicalculator/icons/history_brick_del.png deleted file mode 100644 index da48458..0000000 Binary files a/qad/graphic/qpicalculator/icons/history_brick_del.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/history_brick_move.png b/qad/graphic/qpicalculator/icons/history_brick_move.png deleted file mode 100644 index 7d42f91..0000000 Binary files a/qad/graphic/qpicalculator/icons/history_brick_move.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/history_conn_add.png b/qad/graphic/qpicalculator/icons/history_conn_add.png deleted file mode 100644 index 1f2839f..0000000 Binary files a/qad/graphic/qpicalculator/icons/history_conn_add.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/history_conn_del.png b/qad/graphic/qpicalculator/icons/history_conn_del.png deleted file mode 100644 index 48284dc..0000000 Binary files a/qad/graphic/qpicalculator/icons/history_conn_del.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/history_conn_edit.png b/qad/graphic/qpicalculator/icons/history_conn_edit.png deleted file mode 100644 index 74ecd00..0000000 Binary files a/qad/graphic/qpicalculator/icons/history_conn_edit.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/history_conn_retrace.png b/qad/graphic/qpicalculator/icons/history_conn_retrace.png deleted file mode 100644 index 427f1ce..0000000 Binary files a/qad/graphic/qpicalculator/icons/history_conn_retrace.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/history_convert.png b/qad/graphic/qpicalculator/icons/history_convert.png deleted file mode 100644 index b84e2b7..0000000 Binary files a/qad/graphic/qpicalculator/icons/history_convert.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/history_freq.png b/qad/graphic/qpicalculator/icons/history_freq.png deleted file mode 100644 index 2b68fac..0000000 Binary files a/qad/graphic/qpicalculator/icons/history_freq.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/history_point.xcf b/qad/graphic/qpicalculator/icons/history_point.xcf deleted file mode 100644 index 6c08963..0000000 Binary files a/qad/graphic/qpicalculator/icons/history_point.xcf and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/history_point_add.png b/qad/graphic/qpicalculator/icons/history_point_add.png deleted file mode 100644 index 89f738b..0000000 Binary files a/qad/graphic/qpicalculator/icons/history_point_add.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/history_point_del.png b/qad/graphic/qpicalculator/icons/history_point_del.png deleted file mode 100644 index 970d0d7..0000000 Binary files a/qad/graphic/qpicalculator/icons/history_point_del.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/history_point_move.png b/qad/graphic/qpicalculator/icons/history_point_move.png deleted file mode 100644 index 9a1f895..0000000 Binary files a/qad/graphic/qpicalculator/icons/history_point_move.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/history_seg_add.png b/qad/graphic/qpicalculator/icons/history_seg_add.png deleted file mode 100644 index 2862e21..0000000 Binary files a/qad/graphic/qpicalculator/icons/history_seg_add.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/history_seg_del.png b/qad/graphic/qpicalculator/icons/history_seg_del.png deleted file mode 100644 index 3b8ebaa..0000000 Binary files a/qad/graphic/qpicalculator/icons/history_seg_del.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/history_seg_move.png b/qad/graphic/qpicalculator/icons/history_seg_move.png deleted file mode 100644 index 594711e..0000000 Binary files a/qad/graphic/qpicalculator/icons/history_seg_move.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/history_text_add.png b/qad/graphic/qpicalculator/icons/history_text_add.png deleted file mode 100644 index be78f1e..0000000 Binary files a/qad/graphic/qpicalculator/icons/history_text_add.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/history_text_del.png b/qad/graphic/qpicalculator/icons/history_text_del.png deleted file mode 100644 index 7f6eb67..0000000 Binary files a/qad/graphic/qpicalculator/icons/history_text_del.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/history_text_edit.png b/qad/graphic/qpicalculator/icons/history_text_edit.png deleted file mode 100644 index b2c973e..0000000 Binary files a/qad/graphic/qpicalculator/icons/history_text_edit.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/history_text_move.png b/qad/graphic/qpicalculator/icons/history_text_move.png deleted file mode 100644 index 141876a..0000000 Binary files a/qad/graphic/qpicalculator/icons/history_text_move.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/initial.png b/qad/graphic/qpicalculator/icons/initial.png deleted file mode 100644 index b889071..0000000 Binary files a/qad/graphic/qpicalculator/icons/initial.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/insert-image.png b/qad/graphic/qpicalculator/icons/insert-image.png deleted file mode 100644 index 9a1b321..0000000 Binary files a/qad/graphic/qpicalculator/icons/insert-image.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/insert-text.png b/qad/graphic/qpicalculator/icons/insert-text.png deleted file mode 100644 index 65d645d..0000000 Binary files a/qad/graphic/qpicalculator/icons/insert-text.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/layer-visible-off.png b/qad/graphic/qpicalculator/icons/layer-visible-off.png deleted file mode 100644 index 24277f6..0000000 Binary files a/qad/graphic/qpicalculator/icons/layer-visible-off.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/layer-visible-on.png b/qad/graphic/qpicalculator/icons/layer-visible-on.png deleted file mode 100644 index ea53bd1..0000000 Binary files a/qad/graphic/qpicalculator/icons/layer-visible-on.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/list-add.png b/qad/graphic/qpicalculator/icons/list-add.png deleted file mode 100644 index 1e03be9..0000000 Binary files a/qad/graphic/qpicalculator/icons/list-add.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/mbricks.svg b/qad/graphic/qpicalculator/icons/mbricks.svg deleted file mode 100644 index 38ed473..0000000 --- a/qad/graphic/qpicalculator/icons/mbricks.svg +++ /dev/null @@ -1,351 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - MB - diff --git a/qad/graphic/qpicalculator/icons/mbricks_128.png b/qad/graphic/qpicalculator/icons/mbricks_128.png deleted file mode 100644 index 7eb729b..0000000 Binary files a/qad/graphic/qpicalculator/icons/mbricks_128.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/mbricks_22.png b/qad/graphic/qpicalculator/icons/mbricks_22.png deleted file mode 100644 index cc19f2f..0000000 Binary files a/qad/graphic/qpicalculator/icons/mbricks_22.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/mbricks_256.png b/qad/graphic/qpicalculator/icons/mbricks_256.png deleted file mode 100644 index 22c4f53..0000000 Binary files a/qad/graphic/qpicalculator/icons/mbricks_256.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/mbricks_64.png b/qad/graphic/qpicalculator/icons/mbricks_64.png deleted file mode 100644 index 11fbb75..0000000 Binary files a/qad/graphic/qpicalculator/icons/mbricks_64.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/media-playback-pause.png b/qad/graphic/qpicalculator/icons/media-playback-pause.png deleted file mode 100644 index a9b3113..0000000 Binary files a/qad/graphic/qpicalculator/icons/media-playback-pause.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/media-playback-start.png b/qad/graphic/qpicalculator/icons/media-playback-start.png deleted file mode 100644 index 80ff3a1..0000000 Binary files a/qad/graphic/qpicalculator/icons/media-playback-start.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/media-playback-stop.png b/qad/graphic/qpicalculator/icons/media-playback-stop.png deleted file mode 100644 index 180280e..0000000 Binary files a/qad/graphic/qpicalculator/icons/media-playback-stop.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/media-skip-forward.png b/qad/graphic/qpicalculator/icons/media-skip-forward.png deleted file mode 100644 index 0d22924..0000000 Binary files a/qad/graphic/qpicalculator/icons/media-skip-forward.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/object-flip-horizontal.png b/qad/graphic/qpicalculator/icons/object-flip-horizontal.png deleted file mode 100644 index 6b428d0..0000000 Binary files a/qad/graphic/qpicalculator/icons/object-flip-horizontal.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/player-time.png b/qad/graphic/qpicalculator/icons/player-time.png deleted file mode 100644 index 77ba33c..0000000 Binary files a/qad/graphic/qpicalculator/icons/player-time.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/preferences-desktop-display.png b/qad/graphic/qpicalculator/icons/preferences-desktop-display.png deleted file mode 100644 index bd64701..0000000 Binary files a/qad/graphic/qpicalculator/icons/preferences-desktop-display.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/preferences-desktop-keyboard.png b/qad/graphic/qpicalculator/icons/preferences-desktop-keyboard.png deleted file mode 100644 index d13683f..0000000 Binary files a/qad/graphic/qpicalculator/icons/preferences-desktop-keyboard.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/run-build.png b/qad/graphic/qpicalculator/icons/run-build.png deleted file mode 100644 index d5fa88f..0000000 Binary files a/qad/graphic/qpicalculator/icons/run-build.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/tree.png b/qad/graphic/qpicalculator/icons/tree.png deleted file mode 100644 index 592446a..0000000 Binary files a/qad/graphic/qpicalculator/icons/tree.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/view-center.png b/qad/graphic/qpicalculator/icons/view-center.png deleted file mode 100644 index 8de1c9b..0000000 Binary files a/qad/graphic/qpicalculator/icons/view-center.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/view-fullscreen.png b/qad/graphic/qpicalculator/icons/view-fullscreen.png deleted file mode 100644 index d41fc7e..0000000 Binary files a/qad/graphic/qpicalculator/icons/view-fullscreen.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/view-grid.png b/qad/graphic/qpicalculator/icons/view-grid.png deleted file mode 100644 index 0f1d70c..0000000 Binary files a/qad/graphic/qpicalculator/icons/view-grid.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/view-mode-compact.png b/qad/graphic/qpicalculator/icons/view-mode-compact.png deleted file mode 100644 index d02228c..0000000 Binary files a/qad/graphic/qpicalculator/icons/view-mode-compact.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/view-mode-expanded.png b/qad/graphic/qpicalculator/icons/view-mode-expanded.png deleted file mode 100644 index 59a82d2..0000000 Binary files a/qad/graphic/qpicalculator/icons/view-mode-expanded.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/view-mode-icon.png b/qad/graphic/qpicalculator/icons/view-mode-icon.png deleted file mode 100644 index 78f9f85..0000000 Binary files a/qad/graphic/qpicalculator/icons/view-mode-icon.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/view-refresh.png b/qad/graphic/qpicalculator/icons/view-refresh.png deleted file mode 100644 index 86b6f82..0000000 Binary files a/qad/graphic/qpicalculator/icons/view-refresh.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/view-restore.png b/qad/graphic/qpicalculator/icons/view-restore.png deleted file mode 100644 index 7726c35..0000000 Binary files a/qad/graphic/qpicalculator/icons/view-restore.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/view-tooltips.png b/qad/graphic/qpicalculator/icons/view-tooltips.png deleted file mode 100644 index ca5652c..0000000 Binary files a/qad/graphic/qpicalculator/icons/view-tooltips.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/window-new.png b/qad/graphic/qpicalculator/icons/window-new.png deleted file mode 100644 index 4268189..0000000 Binary files a/qad/graphic/qpicalculator/icons/window-new.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/zoom-fit-best.png b/qad/graphic/qpicalculator/icons/zoom-fit-best.png deleted file mode 100644 index 07cfc98..0000000 Binary files a/qad/graphic/qpicalculator/icons/zoom-fit-best.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/zoom-in.png b/qad/graphic/qpicalculator/icons/zoom-in.png deleted file mode 100644 index 6b7a682..0000000 Binary files a/qad/graphic/qpicalculator/icons/zoom-in.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/zoom-original.png b/qad/graphic/qpicalculator/icons/zoom-original.png deleted file mode 100644 index c894400..0000000 Binary files a/qad/graphic/qpicalculator/icons/zoom-original.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/zoom-out.png b/qad/graphic/qpicalculator/icons/zoom-out.png deleted file mode 100644 index 0ee8c6f..0000000 Binary files a/qad/graphic/qpicalculator/icons/zoom-out.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/zoom-range.png b/qad/graphic/qpicalculator/icons/zoom-range.png deleted file mode 100644 index c052512..0000000 Binary files a/qad/graphic/qpicalculator/icons/zoom-range.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/icons/zoom-rect.png b/qad/graphic/qpicalculator/icons/zoom-rect.png deleted file mode 100644 index da44fd5..0000000 Binary files a/qad/graphic/qpicalculator/icons/zoom-rect.png and /dev/null differ diff --git a/qad/graphic/qpicalculator/qpicalculator.qrc b/qad/graphic/qpicalculator/qpicalculator.qrc deleted file mode 100644 index 823218d..0000000 --- a/qad/graphic/qpicalculator/qpicalculator.qrc +++ /dev/null @@ -1,9 +0,0 @@ - - - icons/edit-clear.png - icons/edit-delete.png - icons/list-add.png - icons/application-exit.png - icons/Apps-accessories-calculator-icon.png - - diff --git a/qcd_utils/pult/icons/dialog-information.png b/qad/icons/dialog-information.png similarity index 100% rename from qcd_utils/pult/icons/dialog-information.png rename to qad/icons/dialog-information.png diff --git a/qad/icons/document-revert.png b/qad/icons/document-revert.png new file mode 100644 index 0000000..70202e2 Binary files /dev/null and b/qad/icons/document-revert.png differ diff --git a/qad/libs/CMakeLists.txt b/qad/libs/CMakeLists.txt new file mode 100644 index 0000000..0d911f8 --- /dev/null +++ b/qad/libs/CMakeLists.txt @@ -0,0 +1 @@ +add_directories_with_include("qad_") diff --git a/qad/libs/application/CMakeLists.txt b/qad/libs/application/CMakeLists.txt new file mode 100644 index 0000000..dc107e3 --- /dev/null +++ b/qad/libs/application/CMakeLists.txt @@ -0,0 +1 @@ +qad_library(application "Gui;Widgets" "qad_widgets") diff --git a/qad/application/aboutwindow.cpp b/qad/libs/application/aboutwindow.cpp similarity index 96% rename from qad/application/aboutwindow.cpp rename to qad/libs/application/aboutwindow.cpp index 14169de..585c58c 100644 --- a/qad/application/aboutwindow.cpp +++ b/qad/libs/application/aboutwindow.cpp @@ -1,217 +1,217 @@ -#include "aboutwindow.h" -#include "ui_aboutwindow.h" -#include "qad_types.h" -#include "qpiconfig.h" -#include -#include -#if QT_VERSION < 0x050000 -# include -#else -# include -#endif - -#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) -# define MOBILE_VIEW -#endif - -QImage AboutWindow::logo; -QVector AboutWindow::versions, AboutWindow::builds; -QString AboutWindow::comment, AboutWindow::stylesheet; - - -AboutWindow::AboutWindow(QWidget * parent): QDialog(parent), ui(new Ui::AboutWindow) { -#ifdef ANDROID - QDialog::setStyleSheet("font: 12pt \"DejaVu Sans\";"); -#endif - if (!stylesheet.isEmpty()) - QDialog::setStyleSheet(stylesheet); - ui->setupUi(this); - ui->labelAuthors->setOpenExternalLinks(true); - QImage logo_im = logo; - if (logo_im.isNull()) - logo_im.load(":/icons/splash.png"); - setWindowTitle(QApplication::applicationName() + " - " + tr("About")); - QIcon ic = QApplication::windowIcon(); - if (ic.isNull()) { - QWidgetList tlw = QApplication::topLevelWidgets(); - foreach (QWidget * w, tlw) - if (!w->windowIcon().isNull()) { - ic = w->windowIcon(); - break; - } - } - if (ic.isNull()) - ic = QIcon(QPixmap::fromImage(logo_im)); - setWindowIcon(ic); - QFormLayout * lay = (QFormLayout*)(ui->groupVersions->layout()); - foreach (SSPair p, versions) { - lay->addRow(p.first, new QLabel(p.second)); - } - lay = (QFormLayout*)(ui->groupBuild->layout()); - foreach (SSPair p, builds) { - lay->addRow(p.first, new QLabel(p.second)); - } - ui->imageView->setPixmap(QPixmap::fromImage(logo_im)); - ui->labelComment->setText(comment); - ui->labelComment->setOpenExternalLinks(true); - ui->labelComment->setHidden(comment.isEmpty()); - //ui->labelArch->setText(QSysInfo::currentCpuArchitecture()); - ui->labelAuthors->setText(authors()); - connect(ui->buttonQt, SIGNAL(clicked()), qApp, SLOT(aboutQt())); -#ifdef MOBILE_VIEW - ui->layoutMain->insertWidget(0, ui->imageView); - //ui->verticalSpacer->changeSize(1, 1, QSizePolicy::Preferred, QSizePolicy::Preferred); -#endif -#ifdef MOBILE_VIEW - ui->layoutMain->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Preferred, QSizePolicy::Expanding)); -#else - QRect r; -# if QT_VERSION < 0x050000 - r = QApplication::desktop()->geometry(); -# else - QScreen * scr = -# if QT_VERSION >= 0x050A00 - QApplication::screenAt(QCursor::pos()); -# else - QApplication::screens()[0]; -# endif - if (scr) { - r.setSize(scr->availableSize() / 2); - r.moveCenter(scr->availableGeometry().center()); - } -# endif - if (r.isValid()) - setGeometry(r); -#endif -} - - -AboutWindow::~AboutWindow() { - delete ui; -} - - -void AboutWindow::setLogo(QImage im) { - logo = im; -} - - -void AboutWindow::setLogo(QString path) { - logo = QImage(path); -} - - -void AboutWindow::addVersion(QString name, QString version) { - if (!name.endsWith(":")) name.append(":"); - foreach (const SSPair & p, versions) { - if (p.first == name) return; - } - version.prepend(""); - if (version.contains("(")) - version.insert(version.indexOf("("), ""); - else - version.append(""); - versions << SSPair(name, version); -} - - -void AboutWindow::addBuildInfo(QString name, QString value) { - if (!name.endsWith(":")) name.append(":"); - foreach (const SSPair & p, builds) { - if (p.first == name) return; - } - builds << SSPair(name, value); -} - - -void AboutWindow::setComment(QString text) { - comment = text; -} - - -void AboutWindow::setStyleSheet(QString ss) { - stylesheet = ss; -} - - -void AboutWindow::show() { - AboutWindow w; - w.exec(); -} - - -int AboutWindow::exec() { -#ifdef MOBILE_VIEW - showFullScreen(); - //setWindowState(Qt::WindowFullScreen); -#endif - return QDialog::exec(); -} - - -void AboutWindow::changeEvent(QEvent *e) { - QDialog::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - ui->retranslateUi(this); - setWindowTitle(QApplication::applicationName() + " - " + tr("About")); - break; - case QEvent::FontChange: - case QEvent::Polish: - ui->buttonOK->setIconSize(preferredIconSize(2., this)); - ui->buttonQt->setIconSize(preferredIconSize(2., this)); - break; - default: break; - } -} - - -void addAuthor(QString & ret, const QString & name, const QString & mail) { - ret += QString("

%1 (%2)

").arg(name, mail, QApplication::applicationName()); -} -QString AboutWindow::authors() { - QString ret, fc; - if (QFile::exists(":/authors.txt")) { - QFile f(":/authors.txt"); - f.open(QIODevice::ReadOnly); - fc = QString::fromUtf8(f.readAll()); - } else { - if (QFile::exists(":/AUTHORS.txt")) { - QFile f(":/AUTHORS.txt"); - f.open(QIODevice::ReadOnly); - fc = QString::fromUtf8(f.readAll()); - } - } - QTextStream ts(&fc, QIODevice::ReadOnly); - QString l = ts.readLine(); - if (l.contains(";")) { - QStringList sl; - while (!ts.atEnd()) { - l = ts.readLine(); - if (l.isEmpty()) continue; - QString name, mail; - sl = l.split(";"); - if (sl.size() > 0) name = sl[0].trimmed(); - if (sl.size() > 1) mail = sl[1].trimmed(); - addAuthor(ret, name, mail); - } - return ret; - } else { - QPIConfig conf(&fc); - QPIConfig::Branch br = conf.allLeaves(); - foreach (QPIConfig::Entry * e, br) { - l = e->toString().trimmed(); - if (!l.contains("<")) continue; - QString name, mail; - name = l.left(l.indexOf("<")); - mail = l.mid(name.size() + 1); - if (mail.endsWith(">")) - mail.chop(1); - name = name.trimmed(); - mail = mail.trimmed(); - addAuthor(ret, name, mail); - } - } - return ret; -} - +#include "aboutwindow.h" +#include "ui_aboutwindow.h" +#include "qad_types.h" +#include "qpiconfig.h" +#include +#include +#if QT_VERSION < 0x050000 +# include +#else +# include +#endif + +#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) +# define MOBILE_VIEW +#endif + +QImage AboutWindow::logo; +QVector AboutWindow::versions, AboutWindow::builds; +QString AboutWindow::comment, AboutWindow::stylesheet; + + +AboutWindow::AboutWindow(QWidget * parent): QDialog(parent), ui(new Ui::AboutWindow) { +#ifdef ANDROID + QDialog::setStyleSheet("font: 12pt \"DejaVu Sans\";"); +#endif + if (!stylesheet.isEmpty()) + QDialog::setStyleSheet(stylesheet); + ui->setupUi(this); + ui->labelAuthors->setOpenExternalLinks(true); + QImage logo_im = logo; + if (logo_im.isNull()) + logo_im.load(":/icons/splash.png"); + setWindowTitle(QApplication::applicationName() + " - " + tr("About")); + QIcon ic = QApplication::windowIcon(); + if (ic.isNull()) { + QWidgetList tlw = QApplication::topLevelWidgets(); + foreach (QWidget * w, tlw) + if (!w->windowIcon().isNull()) { + ic = w->windowIcon(); + break; + } + } + if (ic.isNull()) + ic = QIcon(QPixmap::fromImage(logo_im)); + setWindowIcon(ic); + QFormLayout * lay = (QFormLayout*)(ui->groupVersions->layout()); + foreach (SSPair p, versions) { + lay->addRow(p.first, new QLabel(p.second)); + } + lay = (QFormLayout*)(ui->groupBuild->layout()); + foreach (SSPair p, builds) { + lay->addRow(p.first, new QLabel(p.second)); + } + ui->imageView->setPixmap(QPixmap::fromImage(logo_im)); + ui->labelComment->setText(comment); + ui->labelComment->setOpenExternalLinks(true); + ui->labelComment->setHidden(comment.isEmpty()); + //ui->labelArch->setText(QSysInfo::currentCpuArchitecture()); + ui->labelAuthors->setText(authors()); + connect(ui->buttonQt, SIGNAL(clicked()), qApp, SLOT(aboutQt())); +#ifdef MOBILE_VIEW + ui->layoutMain->insertWidget(0, ui->imageView); + //ui->verticalSpacer->changeSize(1, 1, QSizePolicy::Preferred, QSizePolicy::Preferred); +#endif +#ifdef MOBILE_VIEW + ui->layoutMain->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Preferred, QSizePolicy::Expanding)); +#else + QRect r; +# if QT_VERSION < 0x050000 + r = QApplication::desktop()->geometry(); +# else + QScreen * scr = +# if QT_VERSION >= 0x050A00 + QApplication::screenAt(QCursor::pos()); +# else + QApplication::screens()[0]; +# endif + if (scr) { + r.setSize(scr->availableSize() / 2); + r.moveCenter(scr->availableGeometry().center()); + } +# endif + if (r.isValid()) + setGeometry(r); +#endif +} + + +AboutWindow::~AboutWindow() { + delete ui; +} + + +void AboutWindow::setLogo(QImage im) { + logo = im; +} + + +void AboutWindow::setLogo(QString path) { + logo = QImage(path); +} + + +void AboutWindow::addVersion(QString name, QString version) { + if (!name.endsWith(":")) name.append(":"); + foreach (const SSPair & p, versions) { + if (p.first == name) return; + } + version.prepend(""); + if (version.contains("(")) + version.insert(version.indexOf("("), ""); + else + version.append(""); + versions << SSPair(name, version); +} + + +void AboutWindow::addBuildInfo(QString name, QString value) { + if (!name.endsWith(":")) name.append(":"); + foreach (const SSPair & p, builds) { + if (p.first == name) return; + } + builds << SSPair(name, value); +} + + +void AboutWindow::setComment(QString text) { + comment = text; +} + + +void AboutWindow::setStyleSheet(QString ss) { + stylesheet = ss; +} + + +void AboutWindow::show() { + AboutWindow w; + w.exec(); +} + + +int AboutWindow::exec() { +#ifdef MOBILE_VIEW + showFullScreen(); + //setWindowState(Qt::WindowFullScreen); +#endif + return QDialog::exec(); +} + + +void AboutWindow::changeEvent(QEvent *e) { + QDialog::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + setWindowTitle(QApplication::applicationName() + " - " + tr("About")); + break; + case QEvent::FontChange: + case QEvent::Polish: + ui->buttonOK->setIconSize(preferredIconSize(2., this)); + ui->buttonQt->setIconSize(preferredIconSize(2., this)); + break; + default: break; + } +} + + +void addAuthor(QString & ret, const QString & name, const QString & mail) { + ret += QString("

%1 (%2)

").arg(name, mail, QApplication::applicationName()); +} +QString AboutWindow::authors() { + QString ret, fc; + if (QFile::exists(":/authors.txt")) { + QFile f(":/authors.txt"); + f.open(QIODevice::ReadOnly); + fc = QString::fromUtf8(f.readAll()); + } else { + if (QFile::exists(":/AUTHORS.txt")) { + QFile f(":/AUTHORS.txt"); + f.open(QIODevice::ReadOnly); + fc = QString::fromUtf8(f.readAll()); + } + } + QTextStream ts(&fc, QIODevice::ReadOnly); + QString l = ts.readLine(); + if (l.contains(";")) { + QStringList sl; + while (!ts.atEnd()) { + l = ts.readLine(); + if (l.isEmpty()) continue; + QString name, mail; + sl = l.split(";"); + if (sl.size() > 0) name = sl[0].trimmed(); + if (sl.size() > 1) mail = sl[1].trimmed(); + addAuthor(ret, name, mail); + } + return ret; + } else { + QPIConfig conf(&fc); + QPIConfig::Branch br = conf.allLeaves(); + foreach (QPIConfig::Entry * e, br) { + l = e->toString().trimmed(); + if (!l.contains("<")) continue; + QString name, mail; + name = l.left(l.indexOf("<")); + mail = l.mid(name.size() + 1); + if (mail.endsWith(">")) + mail.chop(1); + name = name.trimmed(); + mail = mail.trimmed(); + addAuthor(ret, name, mail); + } + } + return ret; +} + diff --git a/qad/application/aboutwindow.h b/qad/libs/application/aboutwindow.h similarity index 93% rename from qad/application/aboutwindow.h rename to qad/libs/application/aboutwindow.h index 4b165da..7837cf7 100644 --- a/qad/application/aboutwindow.h +++ b/qad/libs/application/aboutwindow.h @@ -1,82 +1,83 @@ -/* - QAD - Qt ADvanced - - Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#ifndef ABOUTWINDOW_H -#define ABOUTWINDOW_H - -#include "qad_export.h" -#include - -#define ADD_ABOUT_VERSION(lib) \ - { \ - if (lib##_VERSION_BUILD > 0) \ - AboutWindow::addVersion(#lib, lib##_VERSION_NAME " (build " + QString::number(lib##_VERSION_BUILD) + ")"); \ - else \ - AboutWindow::addVersion(#lib, lib##_VERSION_NAME); \ - } -#define ADD_ABOUT_VERSION_NAMED(lib, label) \ - { \ - if (lib##_VERSION_BUILD > 0) \ - AboutWindow::addVersion(label, lib##_VERSION_NAME " (build " + QString::number(lib##_VERSION_BUILD) + ")"); \ - else \ - AboutWindow::addVersion(label, lib##_VERSION_NAME); \ - } -#define ADD_ABOUT_BUILD_INFO(lib) \ - AboutWindow::addBuildInfo("Arch", lib##_ARCH); \ - AboutWindow::addBuildInfo("Compiler", lib##_CXX_COMPILER); \ - AboutWindow::addBuildInfo("CMake", lib##_CMAKE_VERSION); \ - AboutWindow::addBuildInfo("Date", lib##_BUILD_DATE); - -namespace Ui { - class AboutWindow; -} - -class QAD_EXPORT AboutWindow: public QDialog -{ - Q_OBJECT - typedef QPair SSPair; - explicit AboutWindow(QWidget * parent = 0); - ~AboutWindow(); -public: - - static void setLogo(QImage im); - static void setLogo(QString path); - static void addVersion(QString name, QString version); - static void addBuildInfo(QString name, QString value); - static void setComment(QString text); - static void setStyleSheet(QString ss); - - static void show(); - -protected: - virtual void changeEvent(QEvent * e); - virtual int exec(); - - QString authors(); - -private: - Ui::AboutWindow * ui; - - static QImage logo; - static QVector versions, builds; - static QString stylesheet, comment; - -}; - -#endif // ABOUTWINDOW_H +/* + QAD - Qt ADvanced + + Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +#ifndef ABOUTWINDOW_H +#define ABOUTWINDOW_H + +#include +#include "qad_application_export.h" + + +#define ADD_ABOUT_VERSION(lib) \ + { \ + if (lib##_VERSION_BUILD > 0) \ + AboutWindow::addVersion(#lib, lib##_VERSION_NAME " (build " + QString::number(lib##_VERSION_BUILD) + ")"); \ + else \ + AboutWindow::addVersion(#lib, lib##_VERSION_NAME); \ + } +#define ADD_ABOUT_VERSION_NAMED(lib, label) \ + { \ + if (lib##_VERSION_BUILD > 0) \ + AboutWindow::addVersion(label, lib##_VERSION_NAME " (build " + QString::number(lib##_VERSION_BUILD) + ")"); \ + else \ + AboutWindow::addVersion(label, lib##_VERSION_NAME); \ + } +#define ADD_ABOUT_BUILD_INFO(lib) \ + AboutWindow::addBuildInfo("Arch", lib##_ARCH); \ + AboutWindow::addBuildInfo("Compiler", lib##_CXX_COMPILER); \ + AboutWindow::addBuildInfo("CMake", lib##_CMAKE_VERSION); \ + AboutWindow::addBuildInfo("Date", lib##_BUILD_DATE); + +namespace Ui { + class AboutWindow; +} + +class QAD_APPLICATION_EXPORT AboutWindow: public QDialog +{ + Q_OBJECT + typedef QPair SSPair; + explicit AboutWindow(QWidget * parent = 0); + ~AboutWindow(); +public: + + static void setLogo(QImage im); + static void setLogo(QString path); + static void addVersion(QString name, QString version); + static void addBuildInfo(QString name, QString value); + static void setComment(QString text); + static void setStyleSheet(QString ss); + + static void show(); + +protected: + virtual void changeEvent(QEvent * e); + virtual int exec(); + + QString authors(); + +private: + Ui::AboutWindow * ui; + + static QImage logo; + static QVector versions, builds; + static QString stylesheet, comment; + +}; + +#endif // ABOUTWINDOW_H diff --git a/qad/application/aboutwindow.ui b/qad/libs/application/aboutwindow.ui similarity index 96% rename from qad/application/aboutwindow.ui rename to qad/libs/application/aboutwindow.ui index 3167f51..b6a1606 100644 --- a/qad/application/aboutwindow.ui +++ b/qad/libs/application/aboutwindow.ui @@ -1,155 +1,155 @@ - - - AboutWindow - - - - 0 - 0 - 724 - 502 - - - - - About - - - - - - QFrame::NoFrame - - - - - 0 - 0 - 0 - - - - - QPainter::SmoothPixmapTransform|QPainter::TextAntialiasing - - - - - - - - - - - - Versions - - - - QFormLayout::AllNonFixedFieldsGrow - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - Build - - - - QFormLayout::AllNonFixedFieldsGrow - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - Authors - - - - - - - - - - - - - - - - Qt::Vertical - - - - 1 - 1 - - - - - - - - About Qt... - - - - :/icons/qt.png:/icons/qt.png - - - - - - - OK - - - - :/icons/dialog-ok-apply.png:/icons/dialog-ok-apply.png - - - - - - - - - - ImageView - QGraphicsView -
image_view.h
-
-
- - - - - - - buttonOK - clicked() - AboutWindow - close() - - - 712 - 490 - - - 320 - 385 - - - - -
+ + + AboutWindow + + + + 0 + 0 + 724 + 502 + + + + - About + + + + + + QFrame::NoFrame + + + + + 0 + 0 + 0 + + + + + QPainter::SmoothPixmapTransform|QPainter::TextAntialiasing + + + + + + + + + + + + Versions + + + + QFormLayout::AllNonFixedFieldsGrow + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + Build + + + + QFormLayout::AllNonFixedFieldsGrow + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + Authors + + + + + + + + + + + + + + + + Qt::Vertical + + + + 1 + 1 + + + + + + + + About Qt... + + + + :/icons/qt.png:/icons/qt.png + + + + + + + OK + + + + :/icons/dialog-ok-apply.png:/icons/dialog-ok-apply.png + + + + + + + + + + ImageView + QGraphicsView +
image_view.h
+
+
+ + + + + + + buttonOK + clicked() + AboutWindow + close() + + + 712 + 490 + + + 320 + 385 + + + + +
diff --git a/qad/application/edockwidget.cpp b/qad/libs/application/edockwidget.cpp similarity index 100% rename from qad/application/edockwidget.cpp rename to qad/libs/application/edockwidget.cpp diff --git a/qad/application/edockwidget.h b/qad/libs/application/edockwidget.h similarity index 94% rename from qad/application/edockwidget.h rename to qad/libs/application/edockwidget.h index 87dc2fe..5c5807c 100644 --- a/qad/application/edockwidget.h +++ b/qad/libs/application/edockwidget.h @@ -27,10 +27,10 @@ #include #include #include -#include "qad_export.h" +#include "qad_application_export.h" -class QAD_EXPORT EDockWidget: public QDockWidget +class QAD_APPLICATION_EXPORT EDockWidget: public QDockWidget { Q_OBJECT public: diff --git a/qad/application/emainwindow.cpp b/qad/libs/application/emainwindow.cpp similarity index 100% rename from qad/application/emainwindow.cpp rename to qad/libs/application/emainwindow.cpp diff --git a/qad/application/emainwindow.h b/qad/libs/application/emainwindow.h similarity index 96% rename from qad/application/emainwindow.h rename to qad/libs/application/emainwindow.h index 87faa61..2d17ae8 100644 --- a/qad/application/emainwindow.h +++ b/qad/libs/application/emainwindow.h @@ -32,9 +32,10 @@ #include #include "session_manager.h" #include "ribbon.h" +#include "qad_application_export.h" -class QAD_EXPORT UAction: public QAction { +class QAD_APPLICATION_EXPORT UAction: public QAction { Q_OBJECT public: UAction(int ind,const QString & text, QObject * parent): QAction(text, parent) { @@ -67,7 +68,7 @@ signals: }; -class QAD_EXPORT EMainWindow: public QMainWindow +class QAD_APPLICATION_EXPORT EMainWindow: public QMainWindow { Q_OBJECT Q_PROPERTY(int maxRecentItems READ maxRecentItems WRITE setMaxRecentItems) diff --git a/qad/application/etabwidget.cpp b/qad/libs/application/etabwidget.cpp similarity index 100% rename from qad/application/etabwidget.cpp rename to qad/libs/application/etabwidget.cpp diff --git a/qad/application/etabwidget.h b/qad/libs/application/etabwidget.h similarity index 93% rename from qad/application/etabwidget.h rename to qad/libs/application/etabwidget.h index bf0346d..f1d8aeb 100644 --- a/qad/application/etabwidget.h +++ b/qad/libs/application/etabwidget.h @@ -30,10 +30,10 @@ #include #include #include -#include "qad_export.h" +#include "qad_application_export.h" -class QAD_EXPORT ETabWidget: public QTabWidget +class QAD_APPLICATION_EXPORT ETabWidget: public QTabWidget { Q_OBJECT public: @@ -51,7 +51,7 @@ private: void tabRemoved(int) {emit countChanged();} void changeEvent(QEvent * e); - struct TabButton { + struct QAD_APPLICATION_EXPORT TabButton { TabButton(int r, const QIcon & i, const QString & t) {role = r; icon = i; visible = true; srcToolTip = t; toolTip = QApplication::translate("MainWindow", t.toUtf8(), 0/*, QCoreApplication::UnicodeUTF8*/);} int role; bool visible; diff --git a/qad/application/historyview.cpp b/qad/libs/application/historyview.cpp similarity index 100% rename from qad/application/historyview.cpp rename to qad/libs/application/historyview.cpp diff --git a/qad/application/historyview.h b/qad/libs/application/historyview.h similarity index 94% rename from qad/application/historyview.h rename to qad/libs/application/historyview.h index f46d0a4..5c04c17 100644 --- a/qad/application/historyview.h +++ b/qad/libs/application/historyview.h @@ -22,10 +22,10 @@ #include #include -#include "qad_export.h" +#include "qad_application_export.h" -class QAD_EXPORT HistoryView: public QListWidget +class QAD_APPLICATION_EXPORT HistoryView: public QListWidget { Q_OBJECT Q_PROPERTY(bool active READ isActive WRITE setActive) @@ -46,7 +46,7 @@ public: void registerAction(int action, const QString & text, const QImage & icon = QImage()); private: - struct Action { + struct QAD_APPLICATION_EXPORT Action { Action(int i = -1, const QString & t = QString(), const QImage & c = QImage()): id(i), text(t) { QPixmap px = QPixmap::fromImage(c); icon.addPixmap(px, QIcon::Active); @@ -58,7 +58,7 @@ private: QString text; QIcon icon; }; - struct Entry { + struct QAD_APPLICATION_EXPORT Entry { Entry(int a = -1, const QByteArray & c = QByteArray()): action(a), command(c) {} int action; QByteArray command; diff --git a/qad/application/lang/qad_application_en.ts b/qad/libs/application/lang/qad_application_en.ts similarity index 100% rename from qad/application/lang/qad_application_en.ts rename to qad/libs/application/lang/qad_application_en.ts diff --git a/qad/application/lang/qad_application_ru.ts b/qad/libs/application/lang/qad_application_ru.ts similarity index 100% rename from qad/application/lang/qad_application_ru.ts rename to qad/libs/application/lang/qad_application_ru.ts diff --git a/qad/application/lang/update.bat b/qad/libs/application/lang/update.bat similarity index 100% rename from qad/application/lang/update.bat rename to qad/libs/application/lang/update.bat diff --git a/qad/application/logview.cpp b/qad/libs/application/logview.cpp similarity index 100% rename from qad/application/logview.cpp rename to qad/libs/application/logview.cpp diff --git a/qad/application/logview.h b/qad/libs/application/logview.h similarity index 95% rename from qad/application/logview.h rename to qad/libs/application/logview.h index 82880cd..b882c0a 100644 --- a/qad/application/logview.h +++ b/qad/libs/application/logview.h @@ -30,7 +30,7 @@ # include typedef QRegExp QRegularExpression; #endif -#include "qad_export.h" +#include "qad_application_export.h" class QTextEdit; class QTextBlock; @@ -40,7 +40,7 @@ namespace Ui { class LogView; } -class QAD_EXPORT LogView: public QWidget +class QAD_APPLICATION_EXPORT LogView: public QWidget { Q_OBJECT Q_PROPERTY(bool filterVisible READ isFilterVisible WRITE setFilterVisible) @@ -75,7 +75,7 @@ public: void addText(const QString & text, bool insert_newline = true); private: - struct Category { + struct QAD_APPLICATION_EXPORT Category { Category(); void makeIcon(QSize size, QSize size_icon); QString label; diff --git a/qad/application/logview.ui b/qad/libs/application/logview.ui similarity index 100% rename from qad/application/logview.ui rename to qad/libs/application/logview.ui diff --git a/qad/application/plugin/CMakeLists.txt b/qad/libs/application/plugin/CMakeLists.txt similarity index 97% rename from qad/application/plugin/CMakeLists.txt rename to qad/libs/application/plugin/CMakeLists.txt index 326c825..3a43fc4 100644 --- a/qad/application/plugin/CMakeLists.txt +++ b/qad/libs/application/plugin/CMakeLists.txt @@ -1 +1 @@ -qad_plugin(application "Gui;Widgets" "") +qad_plugin(application "Gui;Widgets" "") diff --git a/qad/application/plugin/edockwidgetplugin.cpp b/qad/libs/application/plugin/edockwidgetplugin.cpp similarity index 100% rename from qad/application/plugin/edockwidgetplugin.cpp rename to qad/libs/application/plugin/edockwidgetplugin.cpp diff --git a/qad/application/plugin/edockwidgetplugin.h b/qad/libs/application/plugin/edockwidgetplugin.h similarity index 100% rename from qad/application/plugin/edockwidgetplugin.h rename to qad/libs/application/plugin/edockwidgetplugin.h diff --git a/qad/application/plugin/emainwindowplugin.cpp b/qad/libs/application/plugin/emainwindowplugin.cpp similarity index 100% rename from qad/application/plugin/emainwindowplugin.cpp rename to qad/libs/application/plugin/emainwindowplugin.cpp diff --git a/qad/application/plugin/emainwindowplugin.h b/qad/libs/application/plugin/emainwindowplugin.h similarity index 100% rename from qad/application/plugin/emainwindowplugin.h rename to qad/libs/application/plugin/emainwindowplugin.h diff --git a/qad/application/plugin/historyviewplugin.cpp b/qad/libs/application/plugin/historyviewplugin.cpp similarity index 100% rename from qad/application/plugin/historyviewplugin.cpp rename to qad/libs/application/plugin/historyviewplugin.cpp diff --git a/qad/application/plugin/historyviewplugin.h b/qad/libs/application/plugin/historyviewplugin.h similarity index 100% rename from qad/application/plugin/historyviewplugin.h rename to qad/libs/application/plugin/historyviewplugin.h diff --git a/qad/application/plugin/logviewplugin.cpp b/qad/libs/application/plugin/logviewplugin.cpp similarity index 100% rename from qad/application/plugin/logviewplugin.cpp rename to qad/libs/application/plugin/logviewplugin.cpp diff --git a/qad/application/plugin/logviewplugin.h b/qad/libs/application/plugin/logviewplugin.h similarity index 100% rename from qad/application/plugin/logviewplugin.h rename to qad/libs/application/plugin/logviewplugin.h diff --git a/qad/application/plugin/qad_application.cpp b/qad/libs/application/plugin/qad_application.cpp similarity index 100% rename from qad/application/plugin/qad_application.cpp rename to qad/libs/application/plugin/qad_application.cpp diff --git a/qad/application/plugin/qad_application.h b/qad/libs/application/plugin/qad_application.h similarity index 100% rename from qad/application/plugin/qad_application.h rename to qad/libs/application/plugin/qad_application.h diff --git a/qad/libs/application/qad_application.qrc b/qad/libs/application/qad_application.qrc new file mode 100644 index 0000000..ad3f2fd --- /dev/null +++ b/qad/libs/application/qad_application.qrc @@ -0,0 +1,34 @@ + + + ../../icons/application-exit.png + ../../icons/dialog-close.png + ../../icons/configure.png + ../../icons/document-edit.png + ../../icons/document-new.png + ../../icons/document-save.png + ../../icons/document-save-all.png + ../../icons/document-save-as.png + ../../icons/document-open.png + ../../icons/document-open-recent.png + ../../icons/document-close.png + ../../icons/edit-clear.png + ../../icons/edit-clear-locationbar-rtl.png + ../../icons/edit-find.png + ../../icons/list-add.png + ../../icons/edit-delete.png + ../../icons/edit-copy.png + ../../icons/edit-paste.png + ../../icons/edit-undo.png + ../../icons/edit-redo.png + ../../icons/border-line.png + ../../icons/edockwidget.png + ../../icons/historyview.png + ../../icons/clear-history.png + ../../icons/layer-visible-off.png + ../../icons/layer-visible-on.png + ../../icons/logview.png + ../../icons/qt.png + ../../icons/select-all.png + ../../icons/select-none.png + + diff --git a/qad/application/qsingleapplication.cpp b/qad/libs/application/qsingleapplication.cpp similarity index 100% rename from qad/application/qsingleapplication.cpp rename to qad/libs/application/qsingleapplication.cpp diff --git a/qad/application/qsingleapplication.h b/qad/libs/application/qsingleapplication.h similarity index 92% rename from qad/application/qsingleapplication.h rename to qad/libs/application/qsingleapplication.h index c52ea95..3c6163b 100644 --- a/qad/application/qsingleapplication.h +++ b/qad/libs/application/qsingleapplication.h @@ -22,10 +22,10 @@ #include #include -#include "qad_export.h" +#include "qad_application_export.h" -class QAD_EXPORT QSingleApplication: public QThread +class QAD_APPLICATION_EXPORT QSingleApplication: public QThread { Q_OBJECT public: diff --git a/qad/application/ribbon.cpp b/qad/libs/application/ribbon.cpp similarity index 100% rename from qad/application/ribbon.cpp rename to qad/libs/application/ribbon.cpp diff --git a/qad/application/ribbon.h b/qad/libs/application/ribbon.h similarity index 96% rename from qad/application/ribbon.h rename to qad/libs/application/ribbon.h index d189e72..669f8b5 100644 --- a/qad/application/ribbon.h +++ b/qad/libs/application/ribbon.h @@ -31,9 +31,10 @@ #include #include #include "etabwidget.h" +#include "qad_application_export.h" -class QAD_EXPORT Ribbon: public QToolBar +class QAD_APPLICATION_EXPORT Ribbon: public QToolBar { Q_OBJECT public: diff --git a/qad/libs/blockview/CMakeLists.txt b/qad/libs/blockview/CMakeLists.txt new file mode 100644 index 0000000..764dba9 --- /dev/null +++ b/qad/libs/blockview/CMakeLists.txt @@ -0,0 +1 @@ +qad_library(blockview "Gui;Widgets" "qad_utils;qad_widgets") diff --git a/qad/blockview/alignedtextitem.cpp b/qad/libs/blockview/alignedtextitem.cpp similarity index 100% rename from qad/blockview/alignedtextitem.cpp rename to qad/libs/blockview/alignedtextitem.cpp diff --git a/qad/blockview/alignedtextitem.h b/qad/libs/blockview/alignedtextitem.h similarity index 95% rename from qad/blockview/alignedtextitem.h rename to qad/libs/blockview/alignedtextitem.h index 54c846c..0dbf156 100644 --- a/qad/blockview/alignedtextitem.h +++ b/qad/libs/blockview/alignedtextitem.h @@ -24,10 +24,10 @@ #include #include #include -#include "qad_export.h" +#include "qad_blockview_export.h" -class QAD_EXPORT AlignedTextItem: public QGraphicsItem { +class QAD_BLOCKVIEW_EXPORT AlignedTextItem: public QGraphicsItem { public: AlignedTextItem(QGraphicsItem * parent = 0); AlignedTextItem(const QString & text, QGraphicsItem * parent = 0); diff --git a/qad/blockview/blockbase.cpp b/qad/libs/blockview/blockbase.cpp similarity index 100% rename from qad/blockview/blockbase.cpp rename to qad/libs/blockview/blockbase.cpp diff --git a/qad/blockview/blockbase.h b/qad/libs/blockview/blockbase.h similarity index 89% rename from qad/blockview/blockbase.h rename to qad/libs/blockview/blockbase.h index a92472e..0d13ea4 100644 --- a/qad/blockview/blockbase.h +++ b/qad/libs/blockview/blockbase.h @@ -29,6 +29,7 @@ #include #include #include "qad_types.h" +#include "qad_blockview_export.h" /// data: @@ -69,11 +70,11 @@ enum BlockviewItemType { bvitItemText, }; -QAD_EXPORT QDataStream & operator <<(QDataStream & s, const QGraphicsItem * item); -QAD_EXPORT QDataStream & operator >>(QDataStream & s, QGraphicsItem *& item); +QAD_BLOCKVIEW_EXPORT QDataStream & operator <<(QDataStream & s, const QGraphicsItem * item); +QAD_BLOCKVIEW_EXPORT QDataStream & operator >>(QDataStream & s, QGraphicsItem *& item); -class QAD_EXPORT BlockItemBase: public QObject +class QAD_BLOCKVIEW_EXPORT BlockItemBase: public QObject { Q_OBJECT Q_ENUMS(Action) diff --git a/qad/blockview/blockbusitem.cpp b/qad/libs/blockview/blockbusitem.cpp similarity index 100% rename from qad/blockview/blockbusitem.cpp rename to qad/libs/blockview/blockbusitem.cpp diff --git a/qad/blockview/blockbusitem.h b/qad/libs/blockview/blockbusitem.h similarity index 97% rename from qad/blockview/blockbusitem.h rename to qad/libs/blockview/blockbusitem.h index 54a5e45..773874a 100644 --- a/qad/blockview/blockbusitem.h +++ b/qad/libs/blockview/blockbusitem.h @@ -21,9 +21,10 @@ #define BLOCKBUSITEM_H #include "blockitem.h" +#include "qad_blockview_export.h" -class QAD_EXPORT BlockBusItem: public QGraphicsObject, public PropertyStorage { +class QAD_BLOCKVIEW_EXPORT BlockBusItem: public QGraphicsObject, public PropertyStorage { Q_OBJECT Q_INTERFACES(QGraphicsItem) Q_PROPERTY(double pointSize READ pointSize WRITE setPointSize DESIGNABLE false SCRIPTABLE false) diff --git a/qad/blockview/blockeditor.cpp b/qad/libs/blockview/blockeditor.cpp similarity index 96% rename from qad/blockview/blockeditor.cpp rename to qad/libs/blockview/blockeditor.cpp index 0bbdbf3..992c8fa 100644 --- a/qad/blockview/blockeditor.cpp +++ b/qad/libs/blockview/blockeditor.cpp @@ -1,400 +1,400 @@ -#include "blockeditor.h" -#include "ui_blockeditor.h" -#include "drawtools.h" -#include "blockview.h" -#include -#include -#include -#include -#include - - -BlockEditor::BlockEditor(QWidget *parent) : QWidget(parent), ui(new Ui::BlockEditor) { - init = false; - m_editorMode = false; - m_pinsEditable = true; - ui->setupUi(this); - src_title = windowTitle(); - connect(ui->blockView->scene(), SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); - block.setFlags(0); - ui->blockView->addItem(&block); - ui->blockView->viewport()->installEventFilter(this); - DrawTools * drawtools = new DrawTools(ui->blockView); - connect(drawtools, SIGNAL(itemCreated(QGraphicsItem*)), this, SLOT(addItem(QGraphicsItem*))); - drawtools->textEditCombo()->addItems(QStringList() << "%name" << "%value" << "%id"); - ui->layoutProperties->addWidget(drawtools->propertyWidget()); - ui->actionRemove_items->setEnabled(false); - ui->button_color->setColor(Qt::lightGray); - ui->treePins->setItemDelegateForColumn(1, new PinBusDelegate()); - connect(ui->treePins, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(updateBlock())); - ui->treePins->viewport()->installEventFilter(this); - - QToolBar * bar; - bar = new QToolBar(ui->widgetBar); - bar->setOrientation(Qt::Vertical); - bar->addActions(drawtools->actionsForAdd()); - ui->widgetBar->setMinimumSize(bar->sizeHint()); - - bar = new QToolBar(ui->widgetBarZ); - bar->setOrientation(Qt::Vertical); - bar->addActions(drawtools->actionsForZ()); - bar->addSeparator(); - bar->addActions(QList() << ui->actionRemove_items); - ui->widgetBarZ->setMinimumSize(bar->sizeHint()); - init = true; - on_buttonClear_clicked(); -} - - -BlockEditor::~BlockEditor() { - init = false; - delete ui; -} - - -void BlockEditor::loadFile(QString path) { - if (path.isEmpty()) return; - QFile f(path); - if (f.open(QIODevice::ReadOnly)) { - cur_file = path; - loadModel(f.readAll()); - QDir::setCurrent(QFileInfo(path).dir().path()); - } - setWindowTitle(src_title + QString(" - %1").arg(QFileInfo(path).baseName())); -} - - -void BlockEditor::loadModel(const QByteArray &model) { - BlockItem b; - b.loadModel(model); - ui->spin_w->setValue(b.width()); - ui->spin_h->setValue(b.height()); - ui->spin_margin->setValue(b.pinsMargin()); - ui->button_color->setColor(b.color()); - block.loadModel(model); - treePinsClear(); - ui->treePins->blockSignals(true); - QVector pins = block.pins(); - foreach (BlockItemPin * p, pins) { - QTreeWidgetItem * ti = new QTreeWidgetItem(QStringList() << p->text() << QString::number(p->busType())); - ti->setData(0, Qt::UserRole, qulonglong(p)); - ti->setData(0, Qt::UserRole + 1, (int)p->alignment()); - ti->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsDragEnabled); - pin_tli[p->alignment()]->addChild(ti); - } - foreach (QGraphicsItem * i, block.decors()) { - i->setData(1002, false); - i->setData(1100, true); - } - ui->treePins->blockSignals(false); -} - - -QByteArray BlockEditor::saveModel() { - return block.saveModel(); -} - - -void BlockEditor::setEditorMode(bool editorMode) { - m_editorMode = editorMode; - ui->buttonClear->setVisible(!editorMode); - ui->buttonSave->setVisible(!editorMode); - ui->buttonSaveAs->setVisible(!editorMode); - ui->buttonLoad->setVisible(!editorMode); -} - - -void BlockEditor::setPinsEditable(bool pinsEditable) { - m_pinsEditable = pinsEditable; - ui->treePins->setVisible(pinsEditable); - ui->buttonPinAdd->setVisible(pinsEditable); - ui->buttonPinClear->setVisible(pinsEditable); - ui->buttonPinDelete->setVisible(pinsEditable); - ui->buttonPinDup->setVisible(pinsEditable); - ui->groupPins->setVisible(pinsEditable); -} - - -void BlockEditor::selectionChanged() { - if (!init) return; - ui->actionRemove_items->setEnabled(!ui->blockView->scene()->selectedItems().isEmpty()); -} - - -void BlockEditor::addItem(QGraphicsItem *item) { - block.addDecor(item); - item->setData(1002, false); - item->setData(1100, true); -} - - -void BlockEditor::updateBlock() { - block.setSize(ui->spin_w->value(), ui->spin_h->value()); - block.setColor(ui->button_color->color()); - block.setPinsMargin(ui->spin_margin->value()); -} - - -void BlockEditor::treePinsClear() { - ui->treePins->blockSignals(true); - ui->treePins->clear(); - QFont bf(font()); bf.setBold(true); - QList al = QList() << Qt::AlignLeft << Qt::AlignRight << Qt::AlignTop << Qt::AlignBottom; - QStringList an = QStringList() << "Left" << "Right" << "Top" << "Bottom"; - pin_tli.clear(); - for (int i = 0; i < al.size(); ++i) { - QTreeWidgetItem * ti = new QTreeWidgetItem(); - ti->setFlags(Qt::ItemIsEnabled | Qt::ItemIsDropEnabled); - ti->setData(0, Qt::UserRole, al[i]); - ti->setText(0, an[i]); - ti->setFont(0, bf); - ui->treePins->addTopLevelItem(ti); - ti->setFirstColumnSpanned(true); - ti->setExpanded(true); - pin_tli[al[i]] = ti; - } - ui->treePins->blockSignals(false); -} - - -bool BlockEditor::eventFilter(QObject *o, QEvent *e) { - if (!init) QWidget::eventFilter(o, e); - if (o == ui->treePins->viewport()) { - if (e->type() == QEvent::Drop) { - QTimer::singleShot(0, this, SLOT(arrangePins())); - } - } - if (o == ui->blockView->viewport()) { - if (e->type() == QEvent::Resize) { - ui->blockView->centerOn(&block); - } - } - return QWidget::eventFilter(o, e); -} - - -void BlockEditor::changeEvent(QEvent * e) { - QWidget::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - ui->retranslateUi(this); - break; - default: break; - } -} - - -void BlockEditor::on_actionRemove_items_triggered() { - QList si = ui->blockView->scene()->selectedItems(); - foreach (QGraphicsItem * i, si) - block.removeDecor(i); -} - - -void BlockEditor::on_buttonSave_clicked() { - if (cur_file.isEmpty()) { - on_buttonSaveAs_clicked(); - return; - } - QFile f(cur_file); - if (f.open(QIODevice::WriteOnly)) { - f.write(saveModel()); - //setWindowTitle(src_title + QString(" - %1").arg(QFileInfo(c).baseName())); - } -} - - -void BlockEditor::on_buttonSaveAs_clicked() { - QString c = QFileDialog::getSaveFileName(this, "Save block model to file", cur_file, "*.blockmodel"); - if (!c.isEmpty()) { - QFile f(c); - if (f.open(QIODevice::WriteOnly)) { - cur_file = c; - f.write(saveModel()); - setWindowTitle(src_title + QString(" - %1").arg(QFileInfo(c).baseName())); - } - } -} - - -void BlockEditor::on_buttonLoad_clicked() { - QString c = QFileDialog::getOpenFileName(this, "Save block model to file", cur_file, "*.blockmodel"); - loadFile(c); -} - - -void BlockEditor::on_buttonClear_clicked() { - BlockItem b; - ui->spin_w->setValue(b.width()); - ui->spin_h->setValue(b.height()); - ui->spin_margin->setValue(b.pinsMargin()); - ui->button_color->setColor(b.color()); - block.loadModel(QByteArray()); - treePinsClear(); -} - - - -void BlockEditor::on_buttonPinAdd_clicked() { - ui->treePins->blockSignals(true); - QTreeWidgetItem * ti = new QTreeWidgetItem(QStringList() << "" << "0"); - ti->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsDragEnabled); - ti->setData(0, Qt::UserRole, qulonglong(block.addPin(Qt::AlignLeft, ti->text(1).toInt(), ti->text(0)))); - ti->setData(0, Qt::UserRole + 1, (int)Qt::AlignLeft); - pin_tli[Qt::AlignLeft]->addChild(ti); - ui->treePins->setCurrentItem(ti); - ui->treePins->blockSignals(false); - updateBlock(); -} - - -void BlockEditor::on_buttonPinDup_clicked() { - QTreeWidgetItem * ci = ui->treePins->currentItem(); - if (ci == 0) return; - ui->treePins->blockSignals(true); - QTreeWidgetItem * ti = ci->clone(); - ti->setText(0, ti->text(0)); - ti->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsDragEnabled); - Qt::Alignment al = (Qt::Alignment)ci->data(0, Qt::UserRole + 1).toInt(); - ti->setData(0, Qt::UserRole, qulonglong(block.addPin(al, ci->text(1).toInt(), ci->text(0)))); - ti->setData(0, Qt::UserRole + 1, (int)al); - pin_tli[al]->addChild(ti); - ui->treePins->setCurrentItem(ti); - ui->treePins->blockSignals(false); -} - - -void BlockEditor::on_buttonPinDelete_clicked() { - ui->treePins->blockSignals(true); - QList si = ui->treePins->selectedItems(); - foreach (QTreeWidgetItem * i, si) { - if (!i->parent()) continue; - block.removePin((BlockItemPin*)(i->data(0, Qt::UserRole).toLongLong())); - delete i; - } - ui->treePins->blockSignals(false); -} - - -void BlockEditor::on_buttonPinClear_clicked() { - treePinsClear(); - block.clearPins(); -} - - -void BlockEditor::on_treePins_itemChanged(QTreeWidgetItem * item, int column) { - if (!item) return; - BlockItemPin * pin = (BlockItemPin*)item->data(0, Qt::UserRole).toULongLong(); - if (!pin) return; - switch (column) { - case 0: - ui->treePins->blockSignals(true); - item->setText(0, item->text(0)); - pin->setText(item->text(0)); - ui->treePins->blockSignals(false); - break; - case 1: pin->setBusType(item->text(1).toInt()); break; - }; -} - - - -void BlockEditor::arrangePins() { - QVector pins = block.pins(); -// block.clearPins(); - QList tli = pin_tli.values(); - foreach (QTreeWidgetItem * ti, tli) { - for (int i = 0; i < ti->childCount(); ++i) { - foreach (BlockItemPin * p, pins) - if (p == (BlockItemPin*)(ti->child(i)->data(0, Qt::UserRole).toULongLong())) { - p->setAlignment((Qt::Alignment)ti->data(0, Qt::UserRole).toInt()); - BlockItemPin * np = block.addPin(p, false); - ti->child(i)->setData(0, Qt::UserRole, qulonglong(np)); - ti->child(i)->setData(0, Qt::UserRole + 1, ti->data(0, Qt::UserRole).toInt()); - break; - } - } - } - -// for (int i = 0; i < ui->treePins->topLevelItemCount(); ++i) { -// QTreeWidgetItem * ti = ui->treePins->topLevelItem(i); -// if (tli.contains(ti)) continue; -// ti = ui->treePins->takeTopLevelItem(i); -// pin_tli[ti->data(0, Qt::UserRole + 1).toInt()]->addChild(ti); -// foreach (BlockItemPin * p, pins) -// if (p->text() == ti->text(0)) { -// p->setAlignment((Qt::Alignment)ti->data(0, Qt::UserRole + 1).toInt()); -// block.addPin(p, false); -// break; -// } -// } - block.arrangePins(); -} - - -/// *********************************************************** -/// *********************************************************** -/// *********************************************************** -/// *********************************************************** - - -QWidget * PinAlignDelegate::createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const { - QComboBox * combo = new QComboBox(parent); - int cv = index.data().toInt(); - combo->addItem("Left", int(Qt::AlignLeft)); if (cv == Qt::AlignLeft) combo->setCurrentIndex(0); - combo->addItem("Right", int(Qt::AlignRight)); if (cv == Qt::AlignRight) combo->setCurrentIndex(1); - combo->addItem("Top", int(Qt::AlignTop)); if (cv == Qt::AlignTop) combo->setCurrentIndex(2); - combo->addItem("Bottom", int(Qt::AlignBottom)); if (cv == Qt::AlignBottom) combo->setCurrentIndex(3); - combo->setGeometry(option.rect); - return combo; -} - - -QString PinAlignDelegate::displayText(const QVariant & value, const QLocale & locale) const { - int cv = value.toInt(); - switch (cv) { - case Qt::AlignLeft: return tr("Left"); break; - case Qt::AlignRight: return tr("Right"); break; - case Qt::AlignTop: return tr("Top"); break; - case Qt::AlignBottom: return tr("Bottom"); break; - } - return tr("unknown"); -} - - -void PinAlignDelegate::setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const { - model->setData(index, ((QComboBox*)editor)->itemData(((QComboBox*)editor)->currentIndex()).toInt()); -} - - -/// *********************************************************** -/// *********************************************************** -/// *********************************************************** -/// *********************************************************** - - -QWidget * PinBusDelegate::createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const { - QSpinBox * spin = new QSpinBox(parent); - spin->setMinimum(-2147483648); - spin->setMaximum(2147483647); - spin->setValue(index.data().toInt()); - return spin; -} - - -QString PinBusDelegate::displayText(const QVariant & value, const QLocale & locale) const { - int cv = value.toInt(); - return QString::number(cv); -} - - -void PinBusDelegate::setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const { - model->setData(index, ((QSpinBox*)editor)->value()); -} - - - -//void BlockEditor::on_treePins_itemSelectionChanged() { -// arrangePins(); -// qDebug() << "111111111111111"; -//} +#include "blockeditor.h" +#include "ui_blockeditor.h" +#include "drawtools.h" +#include "blockview.h" +#include +#include +#include +#include +#include + + +BlockEditor::BlockEditor(QWidget *parent) : QWidget(parent), ui(new Ui::BlockEditor) { + init = false; + m_editorMode = false; + m_pinsEditable = true; + ui->setupUi(this); + src_title = windowTitle(); + connect(ui->blockView->scene(), SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); + block.setFlags(0); + ui->blockView->addItem(&block); + ui->blockView->viewport()->installEventFilter(this); + DrawTools * drawtools = new DrawTools(ui->blockView); + connect(drawtools, SIGNAL(itemCreated(QGraphicsItem*)), this, SLOT(addItem(QGraphicsItem*))); + drawtools->textEditCombo()->addItems(QStringList() << "%name" << "%value" << "%id"); + ui->layoutProperties->addWidget(drawtools->propertyWidget()); + ui->actionRemove_items->setEnabled(false); + ui->button_color->setColor(Qt::lightGray); + ui->treePins->setItemDelegateForColumn(1, new PinBusDelegate()); + connect(ui->treePins, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(updateBlock())); + ui->treePins->viewport()->installEventFilter(this); + + QToolBar * bar; + bar = new QToolBar(ui->widgetBar); + bar->setOrientation(Qt::Vertical); + bar->addActions(drawtools->actionsForAdd()); + ui->widgetBar->setMinimumSize(bar->sizeHint()); + + bar = new QToolBar(ui->widgetBarZ); + bar->setOrientation(Qt::Vertical); + bar->addActions(drawtools->actionsForZ()); + bar->addSeparator(); + bar->addActions(QList() << ui->actionRemove_items); + ui->widgetBarZ->setMinimumSize(bar->sizeHint()); + init = true; + on_buttonClear_clicked(); +} + + +BlockEditor::~BlockEditor() { + init = false; + delete ui; +} + + +void BlockEditor::loadFile(QString path) { + if (path.isEmpty()) return; + QFile f(path); + if (f.open(QIODevice::ReadOnly)) { + cur_file = path; + loadModel(f.readAll()); + QDir::setCurrent(QFileInfo(path).dir().path()); + } + setWindowTitle(src_title + QString(" - %1").arg(QFileInfo(path).baseName())); +} + + +void BlockEditor::loadModel(const QByteArray &model) { + BlockItem b; + b.loadModel(model); + ui->spin_w->setValue(b.width()); + ui->spin_h->setValue(b.height()); + ui->spin_margin->setValue(b.pinsMargin()); + ui->button_color->setColor(b.color()); + block.loadModel(model); + treePinsClear(); + ui->treePins->blockSignals(true); + QVector pins = block.pins(); + foreach (BlockItemPin * p, pins) { + QTreeWidgetItem * ti = new QTreeWidgetItem(QStringList() << p->text() << QString::number(p->busType())); + ti->setData(0, Qt::UserRole, qulonglong(p)); + ti->setData(0, Qt::UserRole + 1, (int)p->alignment()); + ti->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsDragEnabled); + pin_tli[p->alignment()]->addChild(ti); + } + foreach (QGraphicsItem * i, block.decors()) { + i->setData(1002, false); + i->setData(1100, true); + } + ui->treePins->blockSignals(false); +} + + +QByteArray BlockEditor::saveModel() { + return block.saveModel(); +} + + +void BlockEditor::setEditorMode(bool editorMode) { + m_editorMode = editorMode; + ui->buttonClear->setVisible(!editorMode); + ui->buttonSave->setVisible(!editorMode); + ui->buttonSaveAs->setVisible(!editorMode); + ui->buttonLoad->setVisible(!editorMode); +} + + +void BlockEditor::setPinsEditable(bool pinsEditable) { + m_pinsEditable = pinsEditable; + ui->treePins->setVisible(pinsEditable); + ui->buttonPinAdd->setVisible(pinsEditable); + ui->buttonPinClear->setVisible(pinsEditable); + ui->buttonPinDelete->setVisible(pinsEditable); + ui->buttonPinDup->setVisible(pinsEditable); + ui->groupPins->setVisible(pinsEditable); +} + + +void BlockEditor::selectionChanged() { + if (!init) return; + ui->actionRemove_items->setEnabled(!ui->blockView->scene()->selectedItems().isEmpty()); +} + + +void BlockEditor::addItem(QGraphicsItem *item) { + block.addDecor(item); + item->setData(1002, false); + item->setData(1100, true); +} + + +void BlockEditor::updateBlock() { + block.setSize(ui->spin_w->value(), ui->spin_h->value()); + block.setColor(ui->button_color->color()); + block.setPinsMargin(ui->spin_margin->value()); +} + + +void BlockEditor::treePinsClear() { + ui->treePins->blockSignals(true); + ui->treePins->clear(); + QFont bf(font()); bf.setBold(true); + QList al = QList() << Qt::AlignLeft << Qt::AlignRight << Qt::AlignTop << Qt::AlignBottom; + QStringList an = QStringList() << "Left" << "Right" << "Top" << "Bottom"; + pin_tli.clear(); + for (int i = 0; i < al.size(); ++i) { + QTreeWidgetItem * ti = new QTreeWidgetItem(); + ti->setFlags(Qt::ItemIsEnabled | Qt::ItemIsDropEnabled); + ti->setData(0, Qt::UserRole, al[i]); + ti->setText(0, an[i]); + ti->setFont(0, bf); + ui->treePins->addTopLevelItem(ti); + ti->setFirstColumnSpanned(true); + ti->setExpanded(true); + pin_tli[al[i]] = ti; + } + ui->treePins->blockSignals(false); +} + + +bool BlockEditor::eventFilter(QObject *o, QEvent *e) { + if (!init) QWidget::eventFilter(o, e); + if (o == ui->treePins->viewport()) { + if (e->type() == QEvent::Drop) { + QTimer::singleShot(0, this, SLOT(arrangePins())); + } + } + if (o == ui->blockView->viewport()) { + if (e->type() == QEvent::Resize) { + ui->blockView->centerOn(&block); + } + } + return QWidget::eventFilter(o, e); +} + + +void BlockEditor::changeEvent(QEvent * e) { + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: break; + } +} + + +void BlockEditor::on_actionRemove_items_triggered() { + QList si = ui->blockView->scene()->selectedItems(); + foreach (QGraphicsItem * i, si) + block.removeDecor(i); +} + + +void BlockEditor::on_buttonSave_clicked() { + if (cur_file.isEmpty()) { + on_buttonSaveAs_clicked(); + return; + } + QFile f(cur_file); + if (f.open(QIODevice::WriteOnly)) { + f.write(saveModel()); + //setWindowTitle(src_title + QString(" - %1").arg(QFileInfo(c).baseName())); + } +} + + +void BlockEditor::on_buttonSaveAs_clicked() { + QString c = QFileDialog::getSaveFileName(this, "Save block model to file", cur_file, "*.blockmodel"); + if (!c.isEmpty()) { + QFile f(c); + if (f.open(QIODevice::WriteOnly)) { + cur_file = c; + f.write(saveModel()); + setWindowTitle(src_title + QString(" - %1").arg(QFileInfo(c).baseName())); + } + } +} + + +void BlockEditor::on_buttonLoad_clicked() { + QString c = QFileDialog::getOpenFileName(this, "Save block model to file", cur_file, "*.blockmodel"); + loadFile(c); +} + + +void BlockEditor::on_buttonClear_clicked() { + BlockItem b; + ui->spin_w->setValue(b.width()); + ui->spin_h->setValue(b.height()); + ui->spin_margin->setValue(b.pinsMargin()); + ui->button_color->setColor(b.color()); + block.loadModel(QByteArray()); + treePinsClear(); +} + + + +void BlockEditor::on_buttonPinAdd_clicked() { + ui->treePins->blockSignals(true); + QTreeWidgetItem * ti = new QTreeWidgetItem(QStringList() << "" << "0"); + ti->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsDragEnabled); + ti->setData(0, Qt::UserRole, qulonglong(block.addPin(Qt::AlignLeft, ti->text(1).toInt(), ti->text(0)))); + ti->setData(0, Qt::UserRole + 1, (int)Qt::AlignLeft); + pin_tli[Qt::AlignLeft]->addChild(ti); + ui->treePins->setCurrentItem(ti); + ui->treePins->blockSignals(false); + updateBlock(); +} + + +void BlockEditor::on_buttonPinDup_clicked() { + QTreeWidgetItem * ci = ui->treePins->currentItem(); + if (ci == 0) return; + ui->treePins->blockSignals(true); + QTreeWidgetItem * ti = ci->clone(); + ti->setText(0, ti->text(0)); + ti->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsDragEnabled); + Qt::Alignment al = (Qt::Alignment)ci->data(0, Qt::UserRole + 1).toInt(); + ti->setData(0, Qt::UserRole, qulonglong(block.addPin(al, ci->text(1).toInt(), ci->text(0)))); + ti->setData(0, Qt::UserRole + 1, (int)al); + pin_tli[al]->addChild(ti); + ui->treePins->setCurrentItem(ti); + ui->treePins->blockSignals(false); +} + + +void BlockEditor::on_buttonPinDelete_clicked() { + ui->treePins->blockSignals(true); + QList si = ui->treePins->selectedItems(); + foreach (QTreeWidgetItem * i, si) { + if (!i->parent()) continue; + block.removePin((BlockItemPin*)(i->data(0, Qt::UserRole).toLongLong())); + delete i; + } + ui->treePins->blockSignals(false); +} + + +void BlockEditor::on_buttonPinClear_clicked() { + treePinsClear(); + block.clearPins(); +} + + +void BlockEditor::on_treePins_itemChanged(QTreeWidgetItem * item, int column) { + if (!item) return; + BlockItemPin * pin = (BlockItemPin*)item->data(0, Qt::UserRole).toULongLong(); + if (!pin) return; + switch (column) { + case 0: + ui->treePins->blockSignals(true); + item->setText(0, item->text(0)); + pin->setText(item->text(0)); + ui->treePins->blockSignals(false); + break; + case 1: pin->setBusType(item->text(1).toInt()); break; + }; +} + + + +void BlockEditor::arrangePins() { + QVector pins = block.pins(); +// block.clearPins(); + QList tli = pin_tli.values(); + foreach (QTreeWidgetItem * ti, tli) { + for (int i = 0; i < ti->childCount(); ++i) { + foreach (BlockItemPin * p, pins) + if (p == (BlockItemPin*)(ti->child(i)->data(0, Qt::UserRole).toULongLong())) { + p->setAlignment((Qt::Alignment)ti->data(0, Qt::UserRole).toInt()); + BlockItemPin * np = block.addPin(p, false); + ti->child(i)->setData(0, Qt::UserRole, qulonglong(np)); + ti->child(i)->setData(0, Qt::UserRole + 1, ti->data(0, Qt::UserRole).toInt()); + break; + } + } + } + +// for (int i = 0; i < ui->treePins->topLevelItemCount(); ++i) { +// QTreeWidgetItem * ti = ui->treePins->topLevelItem(i); +// if (tli.contains(ti)) continue; +// ti = ui->treePins->takeTopLevelItem(i); +// pin_tli[ti->data(0, Qt::UserRole + 1).toInt()]->addChild(ti); +// foreach (BlockItemPin * p, pins) +// if (p->text() == ti->text(0)) { +// p->setAlignment((Qt::Alignment)ti->data(0, Qt::UserRole + 1).toInt()); +// block.addPin(p, false); +// break; +// } +// } + block.arrangePins(); +} + + +/// *********************************************************** +/// *********************************************************** +/// *********************************************************** +/// *********************************************************** + + +QWidget * PinAlignDelegate::createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const { + QComboBox * combo = new QComboBox(parent); + int cv = index.data().toInt(); + combo->addItem("Left", int(Qt::AlignLeft)); if (cv == Qt::AlignLeft) combo->setCurrentIndex(0); + combo->addItem("Right", int(Qt::AlignRight)); if (cv == Qt::AlignRight) combo->setCurrentIndex(1); + combo->addItem("Top", int(Qt::AlignTop)); if (cv == Qt::AlignTop) combo->setCurrentIndex(2); + combo->addItem("Bottom", int(Qt::AlignBottom)); if (cv == Qt::AlignBottom) combo->setCurrentIndex(3); + combo->setGeometry(option.rect); + return combo; +} + + +QString PinAlignDelegate::displayText(const QVariant & value, const QLocale & locale) const { + int cv = value.toInt(); + switch (cv) { + case Qt::AlignLeft: return tr("Left"); break; + case Qt::AlignRight: return tr("Right"); break; + case Qt::AlignTop: return tr("Top"); break; + case Qt::AlignBottom: return tr("Bottom"); break; + } + return tr("unknown"); +} + + +void PinAlignDelegate::setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const { + model->setData(index, ((QComboBox*)editor)->itemData(((QComboBox*)editor)->currentIndex()).toInt()); +} + + +/// *********************************************************** +/// *********************************************************** +/// *********************************************************** +/// *********************************************************** + + +QWidget * PinBusDelegate::createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const { + QSpinBox * spin = new QSpinBox(parent); + spin->setMinimum(-2147483648); + spin->setMaximum(2147483647); + spin->setValue(index.data().toInt()); + return spin; +} + + +QString PinBusDelegate::displayText(const QVariant & value, const QLocale & locale) const { + int cv = value.toInt(); + return QString::number(cv); +} + + +void PinBusDelegate::setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const { + model->setData(index, ((QSpinBox*)editor)->value()); +} + + + +//void BlockEditor::on_treePins_itemSelectionChanged() { +// arrangePins(); +// qDebug() << "111111111111111"; +//} diff --git a/qad/blockview/blockeditor.h b/qad/libs/blockview/blockeditor.h similarity index 92% rename from qad/blockview/blockeditor.h rename to qad/libs/blockview/blockeditor.h index 5342bcb..2707df4 100644 --- a/qad/blockview/blockeditor.h +++ b/qad/libs/blockview/blockeditor.h @@ -1,111 +1,112 @@ -/* - QAD - Qt ADvanced - - Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#ifndef BLOCKEDITOR_H -#define BLOCKEDITOR_H - -#include -#include -#include -#include "blockitem.h" - - -namespace Ui { - class BlockEditor; -} - - -class QAD_EXPORT BlockEditor : public QWidget -{ - Q_OBJECT - Q_PROPERTY(bool editorMode READ editorMode WRITE setEditorMode) - Q_PROPERTY(bool pinsEditable READ pinsEditable WRITE setPinsEditable) -public: - explicit BlockEditor(QWidget *parent = 0); - ~BlockEditor(); - - - bool editorMode() const {return m_editorMode;} - bool pinsEditable() const {return m_pinsEditable;} - -public slots: - void loadFile(QString path); - void loadModel(const QByteArray & model); - QByteArray saveModel(); - void setEditorMode(bool editorMode); - void setPinsEditable(bool pinsEditable); - -private slots: - void selectionChanged(); - void addItem(QGraphicsItem * item); - void updateBlock(); - void treePinsClear(); - void arrangePins(); - void on_actionRemove_items_triggered(); - void on_buttonSave_clicked(); - void on_buttonSaveAs_clicked(); - void on_buttonLoad_clicked(); - void on_buttonClear_clicked(); - void on_buttonPinAdd_clicked(); - void on_buttonPinDup_clicked(); - void on_buttonPinDelete_clicked(); - void on_buttonPinClear_clicked(); - void on_treePins_itemChanged(QTreeWidgetItem *item, int column); -// void on_treePins_itemSelectionChanged(); - -private: - bool eventFilter(QObject * o, QEvent * e); - void changeEvent(QEvent * e); - - Ui::BlockEditor *ui; - QMap pin_tli; - BlockItem block; - QString src_title, cur_file; - bool init; - bool m_editorMode; - bool m_pinsEditable; -}; - - - -class QAD_EXPORT PinAlignDelegate: public QStyledItemDelegate { - Q_OBJECT -public: - PinAlignDelegate(QObject * parent = 0): QStyledItemDelegate(parent) {} - QWidget * createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const; - QString displayText(const QVariant & value, const QLocale & locale) const; - void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const; - QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const {return QSize(60, 26);} -}; - - -class QAD_EXPORT PinBusDelegate: public QStyledItemDelegate { - Q_OBJECT -public: - PinBusDelegate(QObject * parent = 0): QStyledItemDelegate(parent) {} - QWidget * createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const; - QString displayText(const QVariant & value, const QLocale & locale) const; - void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const; - QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const {return QSize(60, 26);} -private: - typedef QPair ISPair; - QVector buses; -}; - -#endif // BLOCKEDITOR_H +/* + QAD - Qt ADvanced + + Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +#ifndef BLOCKEDITOR_H +#define BLOCKEDITOR_H + +#include +#include +#include +#include "blockitem.h" +#include "qad_blockview_export.h" + + +namespace Ui { + class BlockEditor; +} + + +class QAD_BLOCKVIEW_EXPORT BlockEditor : public QWidget +{ + Q_OBJECT + Q_PROPERTY(bool editorMode READ editorMode WRITE setEditorMode) + Q_PROPERTY(bool pinsEditable READ pinsEditable WRITE setPinsEditable) +public: + explicit BlockEditor(QWidget *parent = 0); + ~BlockEditor(); + + + bool editorMode() const {return m_editorMode;} + bool pinsEditable() const {return m_pinsEditable;} + +public slots: + void loadFile(QString path); + void loadModel(const QByteArray & model); + QByteArray saveModel(); + void setEditorMode(bool editorMode); + void setPinsEditable(bool pinsEditable); + +private slots: + void selectionChanged(); + void addItem(QGraphicsItem * item); + void updateBlock(); + void treePinsClear(); + void arrangePins(); + void on_actionRemove_items_triggered(); + void on_buttonSave_clicked(); + void on_buttonSaveAs_clicked(); + void on_buttonLoad_clicked(); + void on_buttonClear_clicked(); + void on_buttonPinAdd_clicked(); + void on_buttonPinDup_clicked(); + void on_buttonPinDelete_clicked(); + void on_buttonPinClear_clicked(); + void on_treePins_itemChanged(QTreeWidgetItem *item, int column); +// void on_treePins_itemSelectionChanged(); + +private: + bool eventFilter(QObject * o, QEvent * e); + void changeEvent(QEvent * e); + + Ui::BlockEditor *ui; + QMap pin_tli; + BlockItem block; + QString src_title, cur_file; + bool init; + bool m_editorMode; + bool m_pinsEditable; +}; + + + +class QAD_BLOCKVIEW_EXPORT PinAlignDelegate: public QStyledItemDelegate { + Q_OBJECT +public: + PinAlignDelegate(QObject * parent = 0): QStyledItemDelegate(parent) {} + QWidget * createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const; + QString displayText(const QVariant & value, const QLocale & locale) const; + void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const; + QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const {return QSize(60, 26);} +}; + + +class QAD_BLOCKVIEW_EXPORT PinBusDelegate: public QStyledItemDelegate { + Q_OBJECT +public: + PinBusDelegate(QObject * parent = 0): QStyledItemDelegate(parent) {} + QWidget * createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const; + QString displayText(const QVariant & value, const QLocale & locale) const; + void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const; + QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const {return QSize(60, 26);} +private: + typedef QPair ISPair; + QVector buses; +}; + +#endif // BLOCKEDITOR_H diff --git a/qad/blockview/blockeditor.ui b/qad/libs/blockview/blockeditor.ui similarity index 96% rename from qad/blockview/blockeditor.ui rename to qad/libs/blockview/blockeditor.ui index 6ff5ad3..81e4169 100644 --- a/qad/blockview/blockeditor.ui +++ b/qad/libs/blockview/blockeditor.ui @@ -1,543 +1,543 @@ - - - BlockEditor - - - - 0 - 0 - 847 - 810 - - - - Block editor - - - - :/icons/blockview.png:/icons/blockview.png - - - - - - Qt::Vertical - - - - Qt::Horizontal - - - - Block parameters - - - Qt::AlignCenter - - - - QFormLayout::AllNonFixedFieldsGrow - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 4 - - - 4 - - - 4 - - - 4 - - - - - Width: - - - - - - - 1000 - - - 20 - - - 100 - - - - - - - Heigth: - - - - - - - 1000 - - - 20 - - - 60 - - - - - - - Pins margin: - - - - - - - 100 - - - 10 - - - 10 - - - - - - - Color: - - - - - - - - - - - Pins - - - Qt::AlignCenter - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - - 0 - 200 - - - - QAbstractItemView::InternalMove - - - Qt::MoveAction - - - QAbstractItemView::ExtendedSelection - - - QAbstractItemView::ScrollPerPixel - - - false - - - false - - - 200 - - - - Name - - - - - Bus - - - - - - - - - - Add - - - - :/icons/list-add.png:/icons/list-add.png - - - - - - - Clone - - - - :/icons/edit-copy.png:/icons/edit-copy.png - - - - - - - Qt::Vertical - - - QSizePolicy::Preferred - - - - 20 - 20 - - - - - - - - Remove selected - - - - :/icons/edit-delete.png:/icons/edit-delete.png - - - - - - - Remove all - - - - :/icons/edit-clear.png:/icons/edit-clear.png - - - - - - - Qt::Vertical - - - - 20 - 1 - - - - - - - - - - - - - 0 - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - - - - - - - - - - - - - - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - true - - - false - - - true - - - - - - - - - - - - - - - Save - - - - :/icons/document-save.png:/icons/document-save.png - - - Ctrl+S - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 10 - 20 - - - - - - - - Save as ... - - - - :/icons/document-save.png:/icons/document-save.png - - - Ctrl+S - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 20 - 20 - - - - - - - - Load ... - - - - :/icons/document-open.png:/icons/document-open.png - - - Ctrl+O - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Clear - - - - :/icons/edit-clear.png:/icons/edit-clear.png - - - - - - - - - - :/icons/edit-delete.png:/icons/edit-delete.png - - - Remove items - - - Del - - - - - - BlockView - QGraphicsView -
blockview.h
-
- - ColorButton - QPushButton -
colorbutton.h
-
-
- - - - - - - - spin_w - valueChanged(int) - BlockEditor - updateBlock() - - - 170 - 21 - - - 254 - 1 - - - - - spin_h - valueChanged(int) - BlockEditor - updateBlock() - - - 250 - 49 - - - 373 - 5 - - - - - spin_margin - valueChanged(int) - BlockEditor - updateBlock() - - - 350 - 90 - - - 492 - 8 - - - - - button_color - colorChanged(QColor) - BlockEditor - updateBlock() - - - 561 - 115 - - - 613 - 6 - - - - - - updateBlock() - -
+ + + BlockEditor + + + + 0 + 0 + 847 + 810 + + + + Block editor + + + + :/icons/blockview.png:/icons/blockview.png + + + + + + Qt::Vertical + + + + Qt::Horizontal + + + + Block parameters + + + Qt::AlignCenter + + + + QFormLayout::AllNonFixedFieldsGrow + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 4 + + + 4 + + + 4 + + + 4 + + + + + Width: + + + + + + + 1000 + + + 20 + + + 100 + + + + + + + Heigth: + + + + + + + 1000 + + + 20 + + + 60 + + + + + + + Pins margin: + + + + + + + 100 + + + 10 + + + 10 + + + + + + + Color: + + + + + + + + + + + Pins + + + Qt::AlignCenter + + + + 2 + + + 2 + + + 2 + + + 2 + + + + + + 0 + 200 + + + + QAbstractItemView::InternalMove + + + Qt::MoveAction + + + QAbstractItemView::ExtendedSelection + + + QAbstractItemView::ScrollPerPixel + + + false + + + false + + + 200 + + + + Name + + + + + Bus + + + + + + + + + + Add + + + + :/icons/list-add.png:/icons/list-add.png + + + + + + + Clone + + + + :/icons/edit-copy.png:/icons/edit-copy.png + + + + + + + Qt::Vertical + + + QSizePolicy::Preferred + + + + 20 + 20 + + + + + + + + Remove selected + + + + :/icons/edit-delete.png:/icons/edit-delete.png + + + + + + + Remove all + + + + :/icons/edit-clear.png:/icons/edit-clear.png + + + + + + + Qt::Vertical + + + + 20 + 1 + + + + + + + + + + + + + 0 + + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 2 + + + 2 + + + 2 + + + 2 + + + + + + + + + + + + + + + + + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + true + + + false + + + true + + + + + + + + + + + + + + + Save + + + + :/icons/document-save.png:/icons/document-save.png + + + Ctrl+S + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 10 + 20 + + + + + + + + Save as ... + + + + :/icons/document-save.png:/icons/document-save.png + + + Ctrl+S + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 20 + 20 + + + + + + + + Load ... + + + + :/icons/document-open.png:/icons/document-open.png + + + Ctrl+O + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Clear + + + + :/icons/edit-clear.png:/icons/edit-clear.png + + + + + + + + + + :/icons/edit-delete.png:/icons/edit-delete.png + + + Remove items + + + Del + + + + + + BlockView + QGraphicsView +
blockview.h
+
+ + ColorButton + QPushButton +
colorbutton.h
+
+
+ + + + + + + + spin_w + valueChanged(int) + BlockEditor + updateBlock() + + + 170 + 21 + + + 254 + 1 + + + + + spin_h + valueChanged(int) + BlockEditor + updateBlock() + + + 250 + 49 + + + 373 + 5 + + + + + spin_margin + valueChanged(int) + BlockEditor + updateBlock() + + + 350 + 90 + + + 492 + 8 + + + + + button_color + colorChanged(QColor) + BlockEditor + updateBlock() + + + 561 + 115 + + + 613 + 6 + + + + + + updateBlock() + +
diff --git a/qad/blockview/blockitem.cpp b/qad/libs/blockview/blockitem.cpp similarity index 100% rename from qad/blockview/blockitem.cpp rename to qad/libs/blockview/blockitem.cpp diff --git a/qad/blockview/blockitem.h b/qad/libs/blockview/blockitem.h similarity index 97% rename from qad/blockview/blockitem.h rename to qad/libs/blockview/blockitem.h index 53d16b8..685ef39 100644 --- a/qad/blockview/blockitem.h +++ b/qad/libs/blockview/blockitem.h @@ -20,11 +20,12 @@ #ifndef BLOCKITEM_H #define BLOCKITEM_H -#include "blockitempin.h" #include +#include "blockitempin.h" +#include "qad_blockview_export.h" -class QAD_EXPORT BlockItem: public QGraphicsObject, public PropertyStorage +class QAD_BLOCKVIEW_EXPORT BlockItem: public QGraphicsObject, public PropertyStorage { friend class BlockView; friend class BlockItemPin; diff --git a/qad/blockview/blockitempin.cpp b/qad/libs/blockview/blockitempin.cpp similarity index 96% rename from qad/blockview/blockitempin.cpp rename to qad/libs/blockview/blockitempin.cpp index fe0e2f8..40c4320 100644 --- a/qad/blockview/blockitempin.cpp +++ b/qad/libs/blockview/blockitempin.cpp @@ -1,163 +1,163 @@ -#include "blockview.h" -#include - - -BlockItemPin::BlockItemPin(Qt::Alignment a, int bus_type_, const QString & text_, QGraphicsObject * _parent): QGraphicsObject(_parent), ell_item(this), text_item(this) { - parent_ = 0; - setData(1004, "pin"); - setAcceptHoverEvents(true); - text_item.setData(1002, true); - ell_item.setData(1003, true); - br[Disconnected] = QBrush(Qt::lightGray); - br[Connected] = QBrush(Qt::darkGreen); - br[Hover] = QBrush(Qt::blue); - br[Drop] = QBrush(Qt::green); - br[Accept] = QBrush(Qt::green); - br[Reject] = QBrush(Qt::red); - anim_pin_size.setTargetObject(this); - anim_pin_size.setPropertyName("pinSize"); - anim_pin_size.setEasingCurve(QEasingCurve::OutElastic); - anim_pin_size.setDuration(700); - anim_accept.setTargetObject(this); - anim_accept.setPropertyName("pinSize"); - anim_accept.setEasingCurve(QEasingCurve::InOutQuad); - anim_accept.setDuration(150); - connect(&anim_accept, SIGNAL(finished()), this, SLOT(animationAccept())); - setState(Disconnected); - setAlignment(a); - setBusType(bus_type_); - setText(text_); - setZValue(2.); - setDirection(BlockItemPin::InputOutput); - _reparent(); -} - - -void BlockItemPin::animAccept() { - if (!((BlockView *)scene()->views().back())->isBlockAnimationEnabled() && anim_accept.state() != QAbstractAnimation::Running) return; - anim_accept.setStartValue(pinSize()); - anim_accept.setEndValue(10.); - anim_accept.start(); -} - - -void BlockItemPin::setState(State s) { - State os = state_; - state_ = s; - setBrush(br[int(state_)]); - if (s == Accept && os != Accept) { - animAccept(); - } - update(); -} - - -void BlockItemPin::enlargePin(bool enlarge) { - double sz = enlarge ? 12. : 7; - if (anim_accept.state() == QAbstractAnimation::Running && enlarge) { - anim_accept.stop(); - resizePin(sz); - } - if (!((BlockView *)scene()->views().back())->isBlockAnimationEnabled()) { - resizePin(sz); - return; - } - if (sz == anim_pin_size.endValue()) - return; - anim_pin_size.stop(); - anim_pin_size.setStartValue(pinSize()); - anim_pin_size.setEndValue(sz); - anim_pin_size.start(); -} - - -void BlockItemPin::resizePin(double r) { - ell_item.setRect(-r, -r, r+r, r+r); -} - - -double BlockItemPin::pinSize() const { - return ell_item.rect().width() / 2.; -} - - -void BlockItemPin::animationAccept() { - if (anim_accept.endValue().toDouble() == 7.) return; - anim_accept.setStartValue(pinSize()); - anim_accept.setEndValue(7.); - anim_accept.start(); -} - - -void BlockItemPin::_init(bool affect_parent) { - text_item.setFont(AlignedTextItem::sceneFont(QApplication::font())); - QRectF tbr = text_item.boundingRect(); - const double r = 7.; - ell_item.setRect(-r, -r, r+r, r+r); - ell_item.setSpanAngle(16*180); - text_item.resetTransform(); - text_item.setPos(0, -tbr.height() / 2.); - text_item.setTransformOriginPoint(0, tbr.height() / 2.); - switch (align) { - case Qt::AlignBottom: ell_item.setStartAngle(16*0); text_item.setRotation(-90.); text_item.moveBy(0, -r * 1.5); break; - case Qt::AlignRight: ell_item.setStartAngle(16*90); text_item.setRotation(0.); text_item.moveBy(-tbr.width() - r * 1.5, 0); break; - case Qt::AlignTop: ell_item.setStartAngle(16*180); text_item.setRotation(-90.); text_item.moveBy(0, tbr.width() + r * 1.5); break; - case Qt::AlignLeft: ell_item.setStartAngle(16*270); text_item.setRotation(0.); text_item.moveBy(r * 1.5, 0); break; - default: break; - } - if (affect_parent && parent_) - parent_->arrangePins(); -} - - -void BlockItemPin::_reparent() { - if (parentItem() == 0) return; - if (qgraphicsitem_cast(parentItem()) == 0) return; - QPen p = qgraphicsitem_cast(parentItem())->g_main.pen(); - ell_item.setPen(p); - if (scene()) { - text_item.setFont(AlignedTextItem::sceneFont(scene()->font())); - QRectF tbr = text_item.boundingRect(); - text_item.resetTransform(); - text_item.setPos(0, -tbr.height() / 2.); - text_item.setTransformOriginPoint(0, tbr.height() / 2.); - } -} - - -QGraphicsView * BlockItemPin::_view() const { - if (!scene()) return 0; - if (scene()->views().isEmpty()) return 0; - return scene()->views().back(); -} - - -QVariant BlockItemPin::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant & value) { - if (change == QGraphicsItem::ItemParentChange) - _reparent(); - return QGraphicsItem::itemChange(change, value); -} - - -void BlockItemPin::hoverEnterEvent(QGraphicsSceneHoverEvent * e) { - QGraphicsView * v = _view(); - bool m_pin_mc = false; - if (v) { - QMetaObject::invokeMethod(v, "getPinMC", Q_ARG(bool*, &m_pin_mc)); - QMetaObject::invokeMethod(v, "pinHoverInOut", Qt::QueuedConnection, Q_ARG(BlockItemPin*, this)); - } - if ((state() != Disconnected) && !m_pin_mc) return; - saveState(); - setState(BlockItemPin::Hover); - enlargePin(true); - update(); -} - - -void BlockItemPin::hoverLeaveEvent(QGraphicsSceneHoverEvent * e) { - QGraphicsView * v = _view(); - restoreState(); - enlargePin(false); - update(); - if (v) QMetaObject::invokeMethod(v, "pinHoverInOut", Q_ARG(BlockItemPin*, 0)); -} +#include "blockview.h" +#include + + +BlockItemPin::BlockItemPin(Qt::Alignment a, int bus_type_, const QString & text_, QGraphicsObject * _parent): QGraphicsObject(_parent), ell_item(this), text_item(this) { + parent_ = 0; + setData(1004, "pin"); + setAcceptHoverEvents(true); + text_item.setData(1002, true); + ell_item.setData(1003, true); + br[Disconnected] = QBrush(Qt::lightGray); + br[Connected] = QBrush(Qt::darkGreen); + br[Hover] = QBrush(Qt::blue); + br[Drop] = QBrush(Qt::green); + br[Accept] = QBrush(Qt::green); + br[Reject] = QBrush(Qt::red); + anim_pin_size.setTargetObject(this); + anim_pin_size.setPropertyName("pinSize"); + anim_pin_size.setEasingCurve(QEasingCurve::OutElastic); + anim_pin_size.setDuration(700); + anim_accept.setTargetObject(this); + anim_accept.setPropertyName("pinSize"); + anim_accept.setEasingCurve(QEasingCurve::InOutQuad); + anim_accept.setDuration(150); + connect(&anim_accept, SIGNAL(finished()), this, SLOT(animationAccept())); + setState(Disconnected); + setAlignment(a); + setBusType(bus_type_); + setText(text_); + setZValue(2.); + setDirection(BlockItemPin::InputOutput); + _reparent(); +} + + +void BlockItemPin::animAccept() { + if (!((BlockView *)scene()->views().back())->isBlockAnimationEnabled() && anim_accept.state() != QAbstractAnimation::Running) return; + anim_accept.setStartValue(pinSize()); + anim_accept.setEndValue(10.); + anim_accept.start(); +} + + +void BlockItemPin::setState(State s) { + State os = state_; + state_ = s; + setBrush(br[int(state_)]); + if (s == Accept && os != Accept) { + animAccept(); + } + update(); +} + + +void BlockItemPin::enlargePin(bool enlarge) { + double sz = enlarge ? 12. : 7; + if (anim_accept.state() == QAbstractAnimation::Running && enlarge) { + anim_accept.stop(); + resizePin(sz); + } + if (!((BlockView *)scene()->views().back())->isBlockAnimationEnabled()) { + resizePin(sz); + return; + } + if (sz == anim_pin_size.endValue()) + return; + anim_pin_size.stop(); + anim_pin_size.setStartValue(pinSize()); + anim_pin_size.setEndValue(sz); + anim_pin_size.start(); +} + + +void BlockItemPin::resizePin(double r) { + ell_item.setRect(-r, -r, r+r, r+r); +} + + +double BlockItemPin::pinSize() const { + return ell_item.rect().width() / 2.; +} + + +void BlockItemPin::animationAccept() { + if (anim_accept.endValue().toDouble() == 7.) return; + anim_accept.setStartValue(pinSize()); + anim_accept.setEndValue(7.); + anim_accept.start(); +} + + +void BlockItemPin::_init(bool affect_parent) { + text_item.setFont(AlignedTextItem::sceneFont(QApplication::font())); + QRectF tbr = text_item.boundingRect(); + const double r = 7.; + ell_item.setRect(-r, -r, r+r, r+r); + ell_item.setSpanAngle(16*180); + text_item.resetTransform(); + text_item.setPos(0, -tbr.height() / 2.); + text_item.setTransformOriginPoint(0, tbr.height() / 2.); + switch (align) { + case Qt::AlignBottom: ell_item.setStartAngle(16*0); text_item.setRotation(-90.); text_item.moveBy(0, -r * 1.5); break; + case Qt::AlignRight: ell_item.setStartAngle(16*90); text_item.setRotation(0.); text_item.moveBy(-tbr.width() - r * 1.5, 0); break; + case Qt::AlignTop: ell_item.setStartAngle(16*180); text_item.setRotation(-90.); text_item.moveBy(0, tbr.width() + r * 1.5); break; + case Qt::AlignLeft: ell_item.setStartAngle(16*270); text_item.setRotation(0.); text_item.moveBy(r * 1.5, 0); break; + default: break; + } + if (affect_parent && parent_) + parent_->arrangePins(); +} + + +void BlockItemPin::_reparent() { + if (parentItem() == 0) return; + if (qgraphicsitem_cast(parentItem()) == 0) return; + QPen p = qgraphicsitem_cast(parentItem())->g_main.pen(); + ell_item.setPen(p); + if (scene()) { + text_item.setFont(AlignedTextItem::sceneFont(scene()->font())); + QRectF tbr = text_item.boundingRect(); + text_item.resetTransform(); + text_item.setPos(0, -tbr.height() / 2.); + text_item.setTransformOriginPoint(0, tbr.height() / 2.); + } +} + + +QGraphicsView * BlockItemPin::_view() const { + if (!scene()) return 0; + if (scene()->views().isEmpty()) return 0; + return scene()->views().back(); +} + + +QVariant BlockItemPin::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant & value) { + if (change == QGraphicsItem::ItemParentChange) + _reparent(); + return QGraphicsItem::itemChange(change, value); +} + + +void BlockItemPin::hoverEnterEvent(QGraphicsSceneHoverEvent * e) { + QGraphicsView * v = _view(); + bool m_pin_mc = false; + if (v) { + QMetaObject::invokeMethod(v, "getPinMC", Q_ARG(bool*, &m_pin_mc)); + QMetaObject::invokeMethod(v, "pinHoverInOut", Qt::QueuedConnection, Q_ARG(BlockItemPin*, this)); + } + if ((state() != Disconnected) && !m_pin_mc) return; + saveState(); + setState(BlockItemPin::Hover); + enlargePin(true); + update(); +} + + +void BlockItemPin::hoverLeaveEvent(QGraphicsSceneHoverEvent * e) { + QGraphicsView * v = _view(); + restoreState(); + enlargePin(false); + update(); + if (v) QMetaObject::invokeMethod(v, "pinHoverInOut", Q_ARG(BlockItemPin*, 0)); +} diff --git a/qad/blockview/blockitempin.h b/qad/libs/blockview/blockitempin.h similarity index 94% rename from qad/blockview/blockitempin.h rename to qad/libs/blockview/blockitempin.h index b9ebc26..e358e73 100644 --- a/qad/blockview/blockitempin.h +++ b/qad/libs/blockview/blockitempin.h @@ -1,131 +1,132 @@ -/* - QAD - Qt ADvanced - - Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#ifndef BLOCKITEMPIN_H -#define BLOCKITEMPIN_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "blockbase.h" -#include "alignedtextitem.h" - - -class BlockItem; -class BlockBusItem; - - -class QAD_EXPORT BlockItemPin: public QGraphicsObject, public PropertyStorage -{ - friend class BlockView; - friend class BlockItem; - Q_OBJECT - Q_PROPERTY(double pinSize READ pinSize WRITE resizePin DESIGNABLE false SCRIPTABLE false) -public: - BlockItemPin(Qt::Alignment a = Qt::AlignLeft, int bus_type = 0, const QString & text_ = QString(), QGraphicsObject * parent_ = 0); - - enum State { - Disconnected, - Connected, - Hover, - Drop, - Accept, - Reject - }; - - enum Direction { - None = 0x0, - Input = 0x1, - Output = 0x2, - InputOutput = 0x3 - }; - - void setPen(const QPen & p) {ell_item.setPen(p);} - QPen pen() const {return ell_item.pen();} - void setBrush(const QBrush & b) {ell_item.setBrush(b);} - QBrush brush() const {return ell_item.brush();} - - int busType() const {return bus_type;} - Qt::Alignment alignment() const {return align;} - Direction direction() const {return dir;} - QString text() const {return text_item.text();} - State state() const {return state_;} - - void setBusType(int type_) {bus_type = type_;} - void setAlignment(Qt::Alignment a) {align = a; _init(true);} - void setDirection(Direction d) {dir = d; _init(true);} - void setText(const QString & t) {text_item.setText(t); _init(true);} - void setState(State s); - - void saveState() {sstate_.push(state_);} - bool restoreState() {if (sstate_.isEmpty()) return false; setState(sstate_.pop()); return true;} - void clearStateStack() {sstate_.clear();} - - void enlargePin(bool enlarge); - - BlockItem * parent() const {return parent_;} - QList connectedBuses() const {return buses_;} - - enum {Type = UserType + 3}; - -public slots: - void animAccept(); - -protected: - void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0) {} - QRectF boundingRect() const {return ell_item.boundingRect().translated(ell_item.pos()) | text_item.boundingRect().translated(text_item.pos());} - int type() const {return Type;} - QVariant itemChange(GraphicsItemChange change, const QVariant & value); - void hoverEnterEvent(QGraphicsSceneHoverEvent * e); - void hoverLeaveEvent(QGraphicsSceneHoverEvent * e); - void _init(bool affect_parent = false); - void _reparent(); - QGraphicsView * _view() const; - int bus_type; - State state_; - QGraphicsEllipseItem ell_item; - QGraphicsSimpleTextItem text_item; - QStack sstate_; - QList buses_; - BlockItem * parent_; - Qt::Alignment align; - Direction dir; - QBrush br[6]; - -private slots: - void animationAccept(); - -private: - void resizePin(double r); - double pinSize() const; - - QPropertyAnimation anim_pin_size; - QPropertyAnimation anim_accept; - -}; - - -#endif // BLOCKITEMPIN_H +/* + QAD - Qt ADvanced + + Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +#ifndef BLOCKITEMPIN_H +#define BLOCKITEMPIN_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "blockbase.h" +#include "alignedtextitem.h" +#include "qad_blockview_export.h" + + +class BlockItem; +class BlockBusItem; + + +class QAD_BLOCKVIEW_EXPORT BlockItemPin: public QGraphicsObject, public PropertyStorage +{ + friend class BlockView; + friend class BlockItem; + Q_OBJECT + Q_PROPERTY(double pinSize READ pinSize WRITE resizePin DESIGNABLE false SCRIPTABLE false) +public: + BlockItemPin(Qt::Alignment a = Qt::AlignLeft, int bus_type = 0, const QString & text_ = QString(), QGraphicsObject * parent_ = 0); + + enum State { + Disconnected, + Connected, + Hover, + Drop, + Accept, + Reject + }; + + enum Direction { + None = 0x0, + Input = 0x1, + Output = 0x2, + InputOutput = 0x3 + }; + + void setPen(const QPen & p) {ell_item.setPen(p);} + QPen pen() const {return ell_item.pen();} + void setBrush(const QBrush & b) {ell_item.setBrush(b);} + QBrush brush() const {return ell_item.brush();} + + int busType() const {return bus_type;} + Qt::Alignment alignment() const {return align;} + Direction direction() const {return dir;} + QString text() const {return text_item.text();} + State state() const {return state_;} + + void setBusType(int type_) {bus_type = type_;} + void setAlignment(Qt::Alignment a) {align = a; _init(true);} + void setDirection(Direction d) {dir = d; _init(true);} + void setText(const QString & t) {text_item.setText(t); _init(true);} + void setState(State s); + + void saveState() {sstate_.push(state_);} + bool restoreState() {if (sstate_.isEmpty()) return false; setState(sstate_.pop()); return true;} + void clearStateStack() {sstate_.clear();} + + void enlargePin(bool enlarge); + + BlockItem * parent() const {return parent_;} + QList connectedBuses() const {return buses_;} + + enum {Type = UserType + 3}; + +public slots: + void animAccept(); + +protected: + void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0) {} + QRectF boundingRect() const {return ell_item.boundingRect().translated(ell_item.pos()) | text_item.boundingRect().translated(text_item.pos());} + int type() const {return Type;} + QVariant itemChange(GraphicsItemChange change, const QVariant & value); + void hoverEnterEvent(QGraphicsSceneHoverEvent * e); + void hoverLeaveEvent(QGraphicsSceneHoverEvent * e); + void _init(bool affect_parent = false); + void _reparent(); + QGraphicsView * _view() const; + int bus_type; + State state_; + QGraphicsEllipseItem ell_item; + QGraphicsSimpleTextItem text_item; + QStack sstate_; + QList buses_; + BlockItem * parent_; + Qt::Alignment align; + Direction dir; + QBrush br[6]; + +private slots: + void animationAccept(); + +private: + void resizePin(double r); + double pinSize() const; + + QPropertyAnimation anim_pin_size; + QPropertyAnimation anim_accept; + +}; + + +#endif // BLOCKITEMPIN_H diff --git a/qad/blockview/blockview.cpp b/qad/libs/blockview/blockview.cpp similarity index 100% rename from qad/blockview/blockview.cpp rename to qad/libs/blockview/blockview.cpp diff --git a/qad/blockview/blockview.h b/qad/libs/blockview/blockview.h similarity index 99% rename from qad/blockview/blockview.h rename to qad/libs/blockview/blockview.h index 0602ced..0f7c4f5 100644 --- a/qad/blockview/blockview.h +++ b/qad/libs/blockview/blockview.h @@ -30,6 +30,7 @@ #include #include "blockviewwavetrace.h" #include "blockbusitem.h" +#include "qad_blockview_export.h" Q_DECLARE_METATYPE(BlockItem*) @@ -37,7 +38,7 @@ Q_DECLARE_METATYPE(BlockItemPin*) Q_DECLARE_METATYPE(BlockBusItem*) -class QAD_EXPORT BlockView: public QGraphicsView +class QAD_BLOCKVIEW_EXPORT BlockView: public QGraphicsView { Q_OBJECT Q_ENUMS(SelectionMode) diff --git a/qad/blockview/blockviewwavetrace.cpp b/qad/libs/blockview/blockviewwavetrace.cpp similarity index 100% rename from qad/blockview/blockviewwavetrace.cpp rename to qad/libs/blockview/blockviewwavetrace.cpp diff --git a/qad/blockview/blockviewwavetrace.h b/qad/libs/blockview/blockviewwavetrace.h similarity index 95% rename from qad/blockview/blockviewwavetrace.h rename to qad/libs/blockview/blockviewwavetrace.h index c8d0f90..c7c48cb 100644 --- a/qad/blockview/blockviewwavetrace.h +++ b/qad/libs/blockview/blockviewwavetrace.h @@ -21,9 +21,10 @@ #define BLOCKVIEWWAVETRACE_H #include "blockitem.h" +#include "qad_blockview_export.h" -class QAD_EXPORT BlockViewWavetrace { +class QAD_BLOCKVIEW_EXPORT BlockViewWavetrace { public: BlockViewWavetrace(int width = 1, int height = 1); @@ -52,7 +53,7 @@ public: const QVector & path() const; private: - struct Cell { + struct QAD_BLOCKVIEW_EXPORT Cell { Cell(short v = Empty): value(v), direction(0) {} short value; short direction; diff --git a/qad/blockview/drawtools.cpp b/qad/libs/blockview/drawtools.cpp similarity index 100% rename from qad/blockview/drawtools.cpp rename to qad/libs/blockview/drawtools.cpp diff --git a/qad/blockview/drawtools.h b/qad/libs/blockview/drawtools.h similarity index 96% rename from qad/blockview/drawtools.h rename to qad/libs/blockview/drawtools.h index 51e8db9..2746aaf 100644 --- a/qad/blockview/drawtools.h +++ b/qad/libs/blockview/drawtools.h @@ -27,12 +27,13 @@ #include #include #include "blockview.h" +#include "qad_blockview_export.h" class QComboBox; -class QAD_EXPORT _DTSizeItem: public QGraphicsObject +class QAD_BLOCKVIEW_EXPORT _DTSizeItem: public QGraphicsObject { Q_OBJECT public: @@ -72,7 +73,7 @@ namespace Ui { } -class QAD_EXPORT DrawTools: public QWidget +class QAD_BLOCKVIEW_EXPORT DrawTools: public QWidget { Q_OBJECT Q_PROPERTY(bool resizeHandlesEnabled READ isResizeHandlesEnabled WRITE setResizeHandlesEnabled) diff --git a/qad/blockview/drawtools.ui b/qad/libs/blockview/drawtools.ui similarity index 100% rename from qad/blockview/drawtools.ui rename to qad/libs/blockview/drawtools.ui diff --git a/qad/blockview/lang/qad_blockview_en.ts b/qad/libs/blockview/lang/qad_blockview_en.ts similarity index 100% rename from qad/blockview/lang/qad_blockview_en.ts rename to qad/libs/blockview/lang/qad_blockview_en.ts diff --git a/qad/blockview/lang/qad_blockview_ru.ts b/qad/libs/blockview/lang/qad_blockview_ru.ts similarity index 100% rename from qad/blockview/lang/qad_blockview_ru.ts rename to qad/libs/blockview/lang/qad_blockview_ru.ts diff --git a/qad/blockview/lang/update.bat b/qad/libs/blockview/lang/update.bat similarity index 100% rename from qad/blockview/lang/update.bat rename to qad/libs/blockview/lang/update.bat diff --git a/qad/blockview/plugin/CMakeLists.txt b/qad/libs/blockview/plugin/CMakeLists.txt similarity index 97% rename from qad/blockview/plugin/CMakeLists.txt rename to qad/libs/blockview/plugin/CMakeLists.txt index fce055f..20a4b84 100644 --- a/qad/blockview/plugin/CMakeLists.txt +++ b/qad/libs/blockview/plugin/CMakeLists.txt @@ -1 +1 @@ -qad_plugin(blockview "Gui;Widgets" "") +qad_plugin(blockview "Gui;Widgets" "") diff --git a/qad/blockview/plugin/blockviewplugin.cpp b/qad/libs/blockview/plugin/blockviewplugin.cpp similarity index 100% rename from qad/blockview/plugin/blockviewplugin.cpp rename to qad/libs/blockview/plugin/blockviewplugin.cpp diff --git a/qad/blockview/plugin/blockviewplugin.h b/qad/libs/blockview/plugin/blockviewplugin.h similarity index 100% rename from qad/blockview/plugin/blockviewplugin.h rename to qad/libs/blockview/plugin/blockviewplugin.h diff --git a/qad/blockview/plugin/qad_blockview.cpp b/qad/libs/blockview/plugin/qad_blockview.cpp similarity index 100% rename from qad/blockview/plugin/qad_blockview.cpp rename to qad/libs/blockview/plugin/qad_blockview.cpp diff --git a/qad/blockview/plugin/qad_blockview.h b/qad/libs/blockview/plugin/qad_blockview.h similarity index 100% rename from qad/blockview/plugin/qad_blockview.h rename to qad/libs/blockview/plugin/qad_blockview.h diff --git a/qad/libs/blockview/qad_blockview.qrc b/qad/libs/blockview/qad_blockview.qrc new file mode 100644 index 0000000..fd87c3d --- /dev/null +++ b/qad/libs/blockview/qad_blockview.qrc @@ -0,0 +1,51 @@ + + + ../../icons/draw-line.png + ../../icons/align-hor.png + ../../icons/align-ver.png + ../../icons/dialog-close.png + ../../icons/edit-clear.png + ../../icons/edit-guides.png + ../../icons/view-grid.png + ../../icons/zoom-fit-best.png + ../../icons/configure.png + ../../icons/document-save.png + ../../icons/edit-clear-locationbar-rtl.png + ../../icons/edit-find.png + ../../icons/list-add.png + ../../icons/edit-delete.png + ../../icons/item.png + ../../icons/node-add.png + ../../icons/node.png + ../../icons/edit-copy.png + ../../icons/edit-paste.png + ../../icons/expand_s_x.png + ../../icons/expand_s_y.png + ../../icons/expand_x.png + ../../icons/expand_y.png + ../../icons/border-line.png + ../../icons/legend.png + ../../icons/blockview.png + ../../icons/view-fullscreen.png + ../../icons/draw-ellipse.png + ../../icons/draw-rectangle.png + ../../icons/draw-text.png + ../../icons/view-preview.png + ../../icons/format-fill-color.png + ../../icons/format-stroke-color.png + ../../icons/document-open.png + ../../icons/align-bottom-center.png + ../../icons/align-bottom-left.png + ../../icons/align-bottom-right.png + ../../icons/align-center-center.png + ../../icons/align-center-left.png + ../../icons/align-center-right.png + ../../icons/align-top-center.png + ../../icons/align-top-left.png + ../../icons/align-top-right.png + ../../icons/z-bottom.png + ../../icons/z-down.png + ../../icons/z-top.png + ../../icons/z-up.png + + diff --git a/qad/doc/CMakeLists.txt b/qad/libs/doc/CMakeLists.txt similarity index 91% rename from qad/doc/CMakeLists.txt rename to qad/libs/doc/CMakeLists.txt index 8df0534..9b9aab6 100644 --- a/qad/doc/CMakeLists.txt +++ b/qad/libs/doc/CMakeLists.txt @@ -1,25 +1,25 @@ -include(CheckIncludeFileCXX) -set(CHECK_INCLUDES "-include stdio.h") -if(WIN32) - set(CHECK_INCLUDES "-include windows.h -include stdio.h") -endif() -set(_mkd_header_found 0) -check_include_file_cxx("mkdio.h" MARKDOWN_HEADER_MKDIO ${CHECK_INCLUDES}) -if (MARKDOWN_HEADER_MKDIO OR APPLE) - set(_mkd_header_found 1) - add_definitions("-DMARKDOWN_HEADER=\"mkdio.h\"") -else() - check_include_file_cxx("markdown/markdown.h" MARKDOWN_HEADER_MARKDOWN ${CHECK_INCLUDES}) - if (MARKDOWN_HEADER_MARKDOWN) - set(_mkd_header_found 1) - add_definitions("-DMARKDOWN_HEADER=\"markdown/markdown.h\"") - endif() -endif() -find_library(MARKDOWN_LIBRARY markdown) -if (MARKDOWN_LIBRARY) - if(_mkd_header_found) - qad_project(doc "Core" "${MARKDOWN_LIBRARY}") - else() - message(STATUS "Found markdown library, but *.h missing!") - endif() -endif() +include(CheckIncludeFileCXX) +set(CHECK_INCLUDES "-include stdio.h") +if(WIN32) + set(CHECK_INCLUDES "-include windows.h -include stdio.h") +endif() +set(_mkd_header_found 0) +check_include_file_cxx("mkdio.h" MARKDOWN_HEADER_MKDIO ${CHECK_INCLUDES}) +if (MARKDOWN_HEADER_MKDIO OR APPLE) + set(_mkd_header_found 1) + add_definitions("-DMARKDOWN_HEADER=\"mkdio.h\"") +else() + check_include_file_cxx("markdown/markdown.h" MARKDOWN_HEADER_MARKDOWN ${CHECK_INCLUDES}) + if (MARKDOWN_HEADER_MARKDOWN) + set(_mkd_header_found 1) + add_definitions("-DMARKDOWN_HEADER=\"markdown/markdown.h\"") + endif() +endif() +find_library(MARKDOWN_LIBRARY markdown) +if (MARKDOWN_LIBRARY) + if(_mkd_header_found) + qad_library(doc "Core" "${MARKDOWN_LIBRARY}") + else() + message(STATUS "Found markdown library, but *.h missing!") + endif() +endif() diff --git a/qad/doc/markdown.cpp b/qad/libs/doc/markdown.cpp similarity index 96% rename from qad/doc/markdown.cpp rename to qad/libs/doc/markdown.cpp index 5b50af1..dce891f 100644 --- a/qad/doc/markdown.cpp +++ b/qad/libs/doc/markdown.cpp @@ -1,79 +1,79 @@ -#include "markdown.h" -#include -extern "C" { -#include MARKDOWN_HEADER -} -#ifndef mkd_flags_are -# ifndef MKD_DLEXTRA -# define MKD_DLEXTRA 0x01000000 -# endif -# ifndef MKD_FENCEDCODE -# define MKD_FENCEDCODE 0x02000000 -# endif -# ifndef MKD_EXTRA_FOOTNOTE -# define MKD_EXTRA_FOOTNOTE 0x00200000 -# endif -# ifndef MKD_TOC -# define MKD_TOC 0x00001000 -# endif -# ifndef MKD_AUTOLINK -# define MKD_AUTOLINK 0x00004000 -# endif -# ifndef MKD_GITHUBTAGS -# define MKD_GITHUBTAGS 0x08000000 -# endif -#endif - -static QString markdown_css = "table { margin: 5px; background-color: #cccccc; }" - "table tr { background-color: white; }" - "table td { vertical-align: middle; padding: 5px;}" - "table th { padding: 5px; };" -; - -QString md2html(const QByteArray & src) { - static bool _is_mkd_init = false; - if (src.isEmpty()) return QString(); - if (!_is_mkd_init) { - _is_mkd_init = true; - mkd_initialize(); - } -#ifdef _MARKDOWN_D - DWORD flagm = (MKD_DLEXTRA | MKD_FENCEDCODE); - Document -#endif -#ifdef _MKDIO_D - #ifdef mkd_flags_are - mkd_flag_t * flagm = mkd_flags(); - mkd_set_flag_num(flagm, MKD_DLEXTRA); - mkd_set_flag_num(flagm, MKD_FENCEDCODE); - #else - mkd_flag_t flagm = (MKD_DLEXTRA | MKD_FENCEDCODE | MKD_GITHUBTAGS | MKD_AUTOLINK); - #endif - MMIOT -#endif - * doc = mkd_string(src.constData(), src.size(), 0); - if (!doc) return QString(); - mkd_compile(doc, flagm); - char * html = 0; - int len = mkd_document(doc, &html); - if (!html) { - mkd_cleanup(doc); - return QString(); - } - QString ret = QString::fromUtf8(html, len); - mkd_cleanup(doc); - QString title = QTextStream(&ret, QIODevice::ReadOnly).readLine(); - title = title.mid(title.indexOf(">")+1); - title = title.left(title.indexOf("<")); - QString header = "\n" - "\n\n" - "\n" - "\n"; - header.append("" + title + "\n"); - header.append("\n"); - header.append("\n\n"); - ret.prepend(header); - ret.append("\n\n"); - return ret; -} - +#include "markdown.h" +#include +extern "C" { +#include MARKDOWN_HEADER +} +#ifndef mkd_flags_are +# ifndef MKD_DLEXTRA +# define MKD_DLEXTRA 0x01000000 +# endif +# ifndef MKD_FENCEDCODE +# define MKD_FENCEDCODE 0x02000000 +# endif +# ifndef MKD_EXTRA_FOOTNOTE +# define MKD_EXTRA_FOOTNOTE 0x00200000 +# endif +# ifndef MKD_TOC +# define MKD_TOC 0x00001000 +# endif +# ifndef MKD_AUTOLINK +# define MKD_AUTOLINK 0x00004000 +# endif +# ifndef MKD_GITHUBTAGS +# define MKD_GITHUBTAGS 0x08000000 +# endif +#endif + +static QString markdown_css = "table { margin: 5px; background-color: #cccccc; }" + "table tr { background-color: white; }" + "table td { vertical-align: middle; padding: 5px;}" + "table th { padding: 5px; };" +; + +QString md2html(const QByteArray & src) { + static bool _is_mkd_init = false; + if (src.isEmpty()) return QString(); + if (!_is_mkd_init) { + _is_mkd_init = true; + mkd_initialize(); + } +#ifdef _MARKDOWN_D + DWORD flagm = (MKD_DLEXTRA | MKD_FENCEDCODE); + Document +#endif +#ifdef _MKDIO_D + #ifdef mkd_flags_are + mkd_flag_t * flagm = mkd_flags(); + mkd_set_flag_num(flagm, MKD_DLEXTRA); + mkd_set_flag_num(flagm, MKD_FENCEDCODE); + #else + mkd_flag_t flagm = (MKD_DLEXTRA | MKD_FENCEDCODE | MKD_GITHUBTAGS | MKD_AUTOLINK); + #endif + MMIOT +#endif + * doc = mkd_string(src.constData(), src.size(), 0); + if (!doc) return QString(); + mkd_compile(doc, flagm); + char * html = 0; + int len = mkd_document(doc, &html); + if (!html) { + mkd_cleanup(doc); + return QString(); + } + QString ret = QString::fromUtf8(html, len); + mkd_cleanup(doc); + QString title = QTextStream(&ret, QIODevice::ReadOnly).readLine(); + title = title.mid(title.indexOf(">")+1); + title = title.left(title.indexOf("<")); + QString header = "\n" + "\n\n" + "\n" + "\n"; + header.append("" + title + "\n"); + header.append("\n"); + header.append("\n\n"); + ret.prepend(header); + ret.append("\n\n"); + return ret; +} + diff --git a/qad/doc/markdown.h b/qad/libs/doc/markdown.h similarity index 88% rename from qad/doc/markdown.h rename to qad/libs/doc/markdown.h index 1e7e51f..5d48ed5 100644 --- a/qad/doc/markdown.h +++ b/qad/libs/doc/markdown.h @@ -1,30 +1,30 @@ -/* - QAD - Qt ADvanced - - Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#ifndef QAD_MARKDOWN_H -#define QAD_MARKDOWN_H - -#include -#include "qad_export.h" - - -QAD_EXPORT QString md2html(const QByteArray & src); - - -#endif // QAD_MARKDOWN_H +/* + QAD - Qt ADvanced + + Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +#ifndef QAD_MARKDOWN_H +#define QAD_MARKDOWN_H + +#include +#include "qad_doc_export.h" + + +QAD_DOC_EXPORT QString md2html(const QByteArray & src); + + +#endif // QAD_MARKDOWN_H diff --git a/qad/libs/graphic/CMakeLists.txt b/qad/libs/graphic/CMakeLists.txt new file mode 100644 index 0000000..3222da4 --- /dev/null +++ b/qad/libs/graphic/CMakeLists.txt @@ -0,0 +1 @@ +qad_library(graphic "Gui;Widgets;OpenGL" "qad_widgets;qad_utils;${OPENGL_LIBRARIES}") diff --git a/qad/graphic/graphic.cpp b/qad/libs/graphic/graphic.cpp similarity index 100% rename from qad/graphic/graphic.cpp rename to qad/libs/graphic/graphic.cpp diff --git a/qad/graphic/graphic.h b/qad/libs/graphic/graphic.h similarity index 99% rename from qad/graphic/graphic.h rename to qad/libs/graphic/graphic.h index 125758c..199cf54 100644 --- a/qad/graphic/graphic.h +++ b/qad/libs/graphic/graphic.h @@ -35,6 +35,7 @@ #include #include "graphic_conf.h" #include "evalspinbox.h" +#include "qad_graphic_export.h" namespace Ui { @@ -48,7 +49,7 @@ class UGLWidget; Q_DECLARE_METATYPE(QVector) -class QAD_EXPORT Graphic: public QFrame +class QAD_GRAPHIC_EXPORT Graphic: public QFrame { Q_OBJECT Q_FLAGS(Buttons) @@ -448,7 +449,7 @@ inline QDataStream & operator <<(QDataStream & s, const Graphic::Graduation & v) inline QDataStream & operator >>(QDataStream & s, Graphic::Graduation & v) {s >> *((int*)(&v)); return s;} -class __GraphicRegistrator__ { +class QAD_GRAPHIC_EXPORT __GraphicRegistrator__ { public: __GraphicRegistrator__() { qRegisterMetaType >("QVector"); diff --git a/qad/graphic/graphic.ui b/qad/libs/graphic/graphic.ui similarity index 96% rename from qad/graphic/graphic.ui rename to qad/libs/graphic/graphic.ui index f096c8a..2e58869 100644 --- a/qad/graphic/graphic.ui +++ b/qad/libs/graphic/graphic.ui @@ -1,443 +1,443 @@ - - - Graphic - - - - 0 - 0 - 564 - 433 - - - - - 150 - 150 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 2 - - - - - - - -10 - 0 - 33 - 420 - - - - - 2 - - - - - Autofit - - - - :/icons/view-autofit.png:/icons/view-autofit.png - - - - - - - Grid - - - - :/icons/view-grid.png:/icons/view-grid.png - - - true - - - true - - - - - - - Cursor axis - - - - :/icons/edit-guides.png:/icons/edit-guides.png - - - true - - - - - - - Only expand Y - - - - :/icons/expand_s_y.png:/icons/expand_s_y.png - - - true - - - - - - - Only expand X - - - - :/icons/expand_s_x.png:/icons/expand_s_x.png - - - true - - - - - - - Fullscreen - - - - :/icons/view-fullscreen.png:/icons/view-fullscreen.png - - - - - - - Border inputs - - - - :/icons/border-line.png:/icons/border-line.png - - - true - - - true - - - - - - - Legend - - - - :/icons/legend.png:/icons/legend.png - - - true - - - false - - - - - - - Pause - - - - :/icons/media-playback-pause.png:/icons/media-playback-pause.png - - - true - - - - - - - Configure ... - - - - :/icons/configure.png:/icons/configure.png - - - - - - - Save image ... - - - - :/icons/document-save.png:/icons/document-save.png - - - - - - - Qt::Vertical - - - QSizePolicy::Preferred - - - - 0 - 30 - - - - - - - - Clear - - - - :/icons/edit-clear.png:/icons/edit-clear.png - - - - - - - Close - - - - :/icons/dialog-close.png:/icons/dialog-close.png - - - - - - - Qt::Vertical - - - - 0 - 79 - - - - - - - - - - - - Qt::RichText - - - Qt::AlignCenter - - - - - - - - - - - 0 - 0 - - - - QFrame::Box - - - QFrame::Sunken - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 0 - - - 2 - - - 2 - - - 2 - - - 2 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 0 - - - - - true - - - - - - - - - - 0 - 0 - - - - - 0 - - - 2 - - - 2 - - - 2 - - - 2 - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - Cursor: ( ; ) - - - - - - - - 0 - 0 - - - - - 1 - - - 1 - - - 1 - - - 1 - - - 4 - - - - - - - - - UWidget - QWidget -
uwidget.h
-
-
- - - - - - - -
+ + + Graphic + + + + 0 + 0 + 564 + 433 + + + + + 150 + 150 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 2 + + + + + + + -10 + 0 + 33 + 420 + + + + + 2 + + + + + Autofit + + + + :/icons/view-autofit.png:/icons/view-autofit.png + + + + + + + Grid + + + + :/icons/view-grid.png:/icons/view-grid.png + + + true + + + true + + + + + + + Cursor axis + + + + :/icons/edit-guides.png:/icons/edit-guides.png + + + true + + + + + + + Only expand Y + + + + :/icons/expand_s_y.png:/icons/expand_s_y.png + + + true + + + + + + + Only expand X + + + + :/icons/expand_s_x.png:/icons/expand_s_x.png + + + true + + + + + + + Fullscreen + + + + :/icons/view-fullscreen.png:/icons/view-fullscreen.png + + + + + + + Border inputs + + + + :/icons/border-line.png:/icons/border-line.png + + + true + + + true + + + + + + + Legend + + + + :/icons/legend.png:/icons/legend.png + + + true + + + false + + + + + + + Pause + + + + :/icons/media-playback-pause.png:/icons/media-playback-pause.png + + + true + + + + + + + Configure ... + + + + :/icons/configure.png:/icons/configure.png + + + + + + + Save image ... + + + + :/icons/document-save.png:/icons/document-save.png + + + + + + + Qt::Vertical + + + QSizePolicy::Preferred + + + + 0 + 30 + + + + + + + + Clear + + + + :/icons/edit-clear.png:/icons/edit-clear.png + + + + + + + Close + + + + :/icons/dialog-close.png:/icons/dialog-close.png + + + + + + + Qt::Vertical + + + + 0 + 79 + + + + + + + + + + + + Qt::RichText + + + Qt::AlignCenter + + + + + + + + + + + 0 + 0 + + + + QFrame::Box + + + QFrame::Sunken + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 0 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 0 + + + + + true + + + + + + + + + + 0 + 0 + + + + + 0 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + Cursor: ( ; ) + + + + + + + + 0 + 0 + + + + + 1 + + + 1 + + + 1 + + + 1 + + + 4 + + + + + + + + + UWidget + QWidget +
uwidget.h
+
+
+ + + + + + + +
diff --git a/qad/graphic/graphic_conf.cpp b/qad/libs/graphic/graphic_conf.cpp similarity index 100% rename from qad/graphic/graphic_conf.cpp rename to qad/libs/graphic/graphic_conf.cpp diff --git a/qad/graphic/graphic_conf.h b/qad/libs/graphic/graphic_conf.h similarity index 94% rename from qad/graphic/graphic_conf.h rename to qad/libs/graphic/graphic_conf.h index 5a36486..b88b3a7 100644 --- a/qad/graphic/graphic_conf.h +++ b/qad/libs/graphic/graphic_conf.h @@ -24,7 +24,7 @@ #include #include #include -#include "qad_export.h" +#include "qad_graphic_export.h" namespace Ui { @@ -32,7 +32,7 @@ namespace Ui { } -struct QAD_EXPORT GraphicType { +struct QAD_GRAPHIC_EXPORT GraphicType { GraphicType(QString name_ = "y(x)", QColor color = Qt::red, Qt::PenStyle style = Qt::SolidLine, double width = 0., bool visible_ = true) { pen.setColor(color); pen.setStyle(style); @@ -73,14 +73,14 @@ inline QDataStream & operator <<(QDataStream & s, const GraphicType & v) {s << v inline QDataStream & operator >>(QDataStream & s, GraphicType & v) {s >> v.name >> v.pen >> v.fill_color >> v.lines >> v.points >> v.fill >> v.pointWidth >> v.visible; return s;} -class QAD_EXPORT GraphicConf: public QDialog +class QAD_GRAPHIC_EXPORT GraphicConf: public QDialog { Q_OBJECT friend class Graphic; public: explicit GraphicConf(QVector & graphics_, QWidget * parent = 0); - struct GraphicItem { + struct QAD_GRAPHIC_EXPORT GraphicItem { QString name; QIcon icon; }; diff --git a/qad/graphic/graphic_conf.ui b/qad/libs/graphic/graphic_conf.ui similarity index 96% rename from qad/graphic/graphic_conf.ui rename to qad/libs/graphic/graphic_conf.ui index 7b26a2a..fc60581 100644 --- a/qad/graphic/graphic_conf.ui +++ b/qad/libs/graphic/graphic_conf.ui @@ -1,644 +1,644 @@ - - - GraphicConf - - - Qt::WindowModal - - - - 0 - 0 - 500 - 583 - - - - Graphic parameters - - - true - - - - - - Appearance - - - - - - - - Border inputs - - - - - - - Antialiasing - - - - - - - Status bar - - - - - - - OpenGL - - - - - - - Legend - - - - - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - - 0 - 0 - - - - Background color: - - - - - - - true - - - - - - - - 0 - 0 - - - - Text color: - - - - - - - true - - - - - - - - - - - - Graphics - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - - 0 - 0 - - - - - - - - Color: - - - - - - - true - - - - - - - Style: - - - - - - - - - - Lines width: - - - true - - - - - - - 2 - - - 1.000000000000000 - - - - - - - Points width: - - - true - - - - - - - 2 - - - 999.990000000000009 - - - 1.000000000000000 - - - - - - - Fill: - - - true - - - - - - - true - - - - - - - - - - Grid - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - Color: - - - - - - - true - - - - - - - Style: - - - - - - - - - - Width: - - - - - - - 2 - - - - - - - Step X: - - - - - - - Step Y: - - - - - - - Auto X - - - true - - - - - - - Auto Y - - - true - - - - - - - 30 - - - 30 - - - true - - - - - - - 50 - - - 50 - - - true - - - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Margins - - - - - - px - - - 100 - - - - - - - px - - - 100 - - - - - - - All: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - px - - - 100 - - - - - - - Right: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Left: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Bottom: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - px - - - 100 - - - - - - - Top: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - px - - - 100 - - - - - - - - - - - ColorButton - QPushButton -
colorbutton.h
- - colorChanged(QColor) - -
- - EvalSpinBox - QWidget -
evalspinbox.h
-
-
- - checkAAlias - checkOGL - colorBackground - colorText - colorGrid - comboStyleGrid - spinWidthGrid - cbGraphicNames - colorGraphic - comboStyleGraphic - checkLines - spinLineWidthGraphic - checkPoints - spinPointWidthGraphic - buttonBox - - - - - buttonBox - rejected() - GraphicConf - reject() - - - 255 - 641 - - - 245 - 207 - - - - - checkLines - toggled(bool) - spinLineWidthGraphic - setEnabled(bool) - - - 322 - 410 - - - 415 - 411 - - - - - checkPoints - toggled(bool) - spinPointWidthGraphic - setEnabled(bool) - - - 322 - 434 - - - 415 - 435 - - - - - buttonBox - accepted() - GraphicConf - accept() - - - 294 - 641 - - - 288 - 268 - - - - - checkFill - toggled(bool) - colorFill - setEnabled(bool) - - - 322 - 458 - - - 415 - 460 - - - - - spinMarginT_2 - valueChanged(int) - spinMarginT - setValue(int) - - - 259 - 221 - - - 249 - 191 - - - - - spinMarginT_2 - valueChanged(int) - spinMarginR - setValue(int) - - - 268 - 220 - - - 371 - 220 - - - - - spinMarginT_2 - valueChanged(int) - spinMarginB - setValue(int) - - - 233 - 230 - - - 234 - 252 - - - - - spinMarginT_2 - valueChanged(int) - spinMarginL - setValue(int) - - - 213 - 230 - - - 133 - 229 - - - - -
+ + + GraphicConf + + + Qt::WindowModal + + + + 0 + 0 + 500 + 583 + + + + Graphic parameters + + + true + + + + + + Appearance + + + + + + + + Border inputs + + + + + + + Antialiasing + + + + + + + Status bar + + + + + + + OpenGL + + + + + + + Legend + + + + + + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + + 0 + 0 + + + + Background color: + + + + + + + true + + + + + + + + 0 + 0 + + + + Text color: + + + + + + + true + + + + + + + + + + + + Graphics + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + + 0 + 0 + + + + + + + + Color: + + + + + + + true + + + + + + + Style: + + + + + + + + + + Lines width: + + + true + + + + + + + 2 + + + 1.000000000000000 + + + + + + + Points width: + + + true + + + + + + + 2 + + + 999.990000000000009 + + + 1.000000000000000 + + + + + + + Fill: + + + true + + + + + + + true + + + + + + + + + + Grid + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + Color: + + + + + + + true + + + + + + + Style: + + + + + + + + + + Width: + + + + + + + 2 + + + + + + + Step X: + + + + + + + Step Y: + + + + + + + Auto X + + + true + + + + + + + Auto Y + + + true + + + + + + + 30 + + + 30 + + + true + + + + + + + 50 + + + 50 + + + true + + + + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Margins + + + + + + px + + + 100 + + + + + + + px + + + 100 + + + + + + + All: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + px + + + 100 + + + + + + + Right: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Left: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Bottom: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + px + + + 100 + + + + + + + Top: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + px + + + 100 + + + + + + + + + + + ColorButton + QPushButton +
colorbutton.h
+ + colorChanged(QColor) + +
+ + EvalSpinBox + QWidget +
evalspinbox.h
+
+
+ + checkAAlias + checkOGL + colorBackground + colorText + colorGrid + comboStyleGrid + spinWidthGrid + cbGraphicNames + colorGraphic + comboStyleGraphic + checkLines + spinLineWidthGraphic + checkPoints + spinPointWidthGraphic + buttonBox + + + + + buttonBox + rejected() + GraphicConf + reject() + + + 255 + 641 + + + 245 + 207 + + + + + checkLines + toggled(bool) + spinLineWidthGraphic + setEnabled(bool) + + + 322 + 410 + + + 415 + 411 + + + + + checkPoints + toggled(bool) + spinPointWidthGraphic + setEnabled(bool) + + + 322 + 434 + + + 415 + 435 + + + + + buttonBox + accepted() + GraphicConf + accept() + + + 294 + 641 + + + 288 + 268 + + + + + checkFill + toggled(bool) + colorFill + setEnabled(bool) + + + 322 + 458 + + + 415 + 460 + + + + + spinMarginT_2 + valueChanged(int) + spinMarginT + setValue(int) + + + 259 + 221 + + + 249 + 191 + + + + + spinMarginT_2 + valueChanged(int) + spinMarginR + setValue(int) + + + 268 + 220 + + + 371 + 220 + + + + + spinMarginT_2 + valueChanged(int) + spinMarginB + setValue(int) + + + 233 + 230 + + + 234 + 252 + + + + + spinMarginT_2 + valueChanged(int) + spinMarginL + setValue(int) + + + 213 + 230 + + + 133 + 229 + + + + +
diff --git a/qad/graphic/lang/qad_graphic_en.ts b/qad/libs/graphic/lang/qad_graphic_en.ts similarity index 100% rename from qad/graphic/lang/qad_graphic_en.ts rename to qad/libs/graphic/lang/qad_graphic_en.ts diff --git a/qad/graphic/lang/qad_graphic_ru.ts b/qad/libs/graphic/lang/qad_graphic_ru.ts similarity index 100% rename from qad/graphic/lang/qad_graphic_ru.ts rename to qad/libs/graphic/lang/qad_graphic_ru.ts diff --git a/qad/graphic/lang/update.bat b/qad/libs/graphic/lang/update.bat similarity index 100% rename from qad/graphic/lang/update.bat rename to qad/libs/graphic/lang/update.bat diff --git a/qad/graphic/plugin/CMakeLists.txt b/qad/libs/graphic/plugin/CMakeLists.txt similarity index 97% rename from qad/graphic/plugin/CMakeLists.txt rename to qad/libs/graphic/plugin/CMakeLists.txt index fea0294..10022d3 100644 --- a/qad/graphic/plugin/CMakeLists.txt +++ b/qad/libs/graphic/plugin/CMakeLists.txt @@ -1 +1 @@ -qad_plugin(graphic "Gui;Widgets;OpenGL" "") +qad_plugin(graphic "Gui;Widgets;OpenGL" "") diff --git a/qad/graphic/plugin/graphicplugin.cpp b/qad/libs/graphic/plugin/graphicplugin.cpp similarity index 100% rename from qad/graphic/plugin/graphicplugin.cpp rename to qad/libs/graphic/plugin/graphicplugin.cpp diff --git a/qad/graphic/plugin/graphicplugin.h b/qad/libs/graphic/plugin/graphicplugin.h similarity index 100% rename from qad/graphic/plugin/graphicplugin.h rename to qad/libs/graphic/plugin/graphicplugin.h diff --git a/qad/graphic/plugin/qad_graphic.cpp b/qad/libs/graphic/plugin/qad_graphic.cpp similarity index 100% rename from qad/graphic/plugin/qad_graphic.cpp rename to qad/libs/graphic/plugin/qad_graphic.cpp diff --git a/qad/graphic/plugin/qad_graphic.h b/qad/libs/graphic/plugin/qad_graphic.h similarity index 100% rename from qad/graphic/plugin/qad_graphic.h rename to qad/libs/graphic/plugin/qad_graphic.h diff --git a/qad/libs/graphic/qad_graphic.qrc b/qad/libs/graphic/qad_graphic.qrc new file mode 100644 index 0000000..437c9e3 --- /dev/null +++ b/qad/libs/graphic/qad_graphic.qrc @@ -0,0 +1,28 @@ + + + ../../icons/media-playback-pause.png + ../../icons/dialog-close.png + ../../icons/edit-clear.png + ../../icons/edit-guides.png + ../../icons/view-grid.png + ../../icons/view-autofit.png + ../../icons/configure.png + ../../icons/document-save.png + ../../icons/edit-clear-locationbar-rtl.png + ../../icons/edit-find.png + ../../icons/list-add.png + ../../icons/edit-delete.png + ../../icons/edit-copy.png + ../../icons/edit-paste.png + ../../icons/expand_s_x.png + ../../icons/expand_s_y.png + ../../icons/expand_x.png + ../../icons/expand_y.png + ../../icons/border-line.png + ../../icons/legend.png + ../../icons/graphic.png + ../../icons/view-fullscreen.png + ../../icons/pause-back.png + ../../icons/pause-front.png + + diff --git a/qad/graphic/uglwidget.h b/qad/libs/graphic/uglwidget.h similarity index 95% rename from qad/graphic/uglwidget.h rename to qad/libs/graphic/uglwidget.h index 859070b..9a20903 100644 --- a/qad/graphic/uglwidget.h +++ b/qad/libs/graphic/uglwidget.h @@ -13,9 +13,10 @@ typedef QGLWidget __GLWidget__; # define GL_MULTISAMPLE 0x809D # endif #endif +#include "qad_graphic_export.h" -class UGLWidget: public __GLWidget__ +class QAD_GRAPHIC_EXPORT UGLWidget: public __GLWidget__ { Q_OBJECT public: diff --git a/qad/graphic/uwidget.h b/qad/libs/graphic/uwidget.h similarity index 93% rename from qad/graphic/uwidget.h rename to qad/libs/graphic/uwidget.h index e7f4151..1c61ad2 100644 --- a/qad/graphic/uwidget.h +++ b/qad/libs/graphic/uwidget.h @@ -6,9 +6,10 @@ #include #include #include +#include "qad_graphic_export.h" -class UWidget: public QWidget +class QAD_GRAPHIC_EXPORT UWidget: public QWidget { Q_OBJECT public: diff --git a/qad/libs/sql_table/CMakeLists.txt b/qad/libs/sql_table/CMakeLists.txt new file mode 100644 index 0000000..c8df55f --- /dev/null +++ b/qad/libs/sql_table/CMakeLists.txt @@ -0,0 +1 @@ +qad_library(sql_table "Gui;Widgets;Sql" "qad_utils;qad_widgets") diff --git a/qad/sql_table/lang/qad_sql_table_en.ts b/qad/libs/sql_table/lang/qad_sql_table_en.ts similarity index 100% rename from qad/sql_table/lang/qad_sql_table_en.ts rename to qad/libs/sql_table/lang/qad_sql_table_en.ts diff --git a/qad/sql_table/lang/qad_sql_table_ru.ts b/qad/libs/sql_table/lang/qad_sql_table_ru.ts similarity index 100% rename from qad/sql_table/lang/qad_sql_table_ru.ts rename to qad/libs/sql_table/lang/qad_sql_table_ru.ts diff --git a/qad/sql_table/lang/update.bat b/qad/libs/sql_table/lang/update.bat similarity index 100% rename from qad/sql_table/lang/update.bat rename to qad/libs/sql_table/lang/update.bat diff --git a/qad/sql_table/plugin/CMakeLists.txt b/qad/libs/sql_table/plugin/CMakeLists.txt similarity index 97% rename from qad/sql_table/plugin/CMakeLists.txt rename to qad/libs/sql_table/plugin/CMakeLists.txt index d6e9378..f547573 100644 --- a/qad/sql_table/plugin/CMakeLists.txt +++ b/qad/libs/sql_table/plugin/CMakeLists.txt @@ -1 +1 @@ -qad_plugin(sql_table "Gui;Widgets;Sql" "") +qad_plugin(sql_table "Gui;Widgets;Sql" "") diff --git a/qad/sql_table/plugin/qad_sql_table.cpp b/qad/libs/sql_table/plugin/qad_sql_table.cpp similarity index 100% rename from qad/sql_table/plugin/qad_sql_table.cpp rename to qad/libs/sql_table/plugin/qad_sql_table.cpp diff --git a/qad/sql_table/plugin/qad_sql_table.h b/qad/libs/sql_table/plugin/qad_sql_table.h similarity index 100% rename from qad/sql_table/plugin/qad_sql_table.h rename to qad/libs/sql_table/plugin/qad_sql_table.h diff --git a/qad/sql_table/plugin/sql_record_plugin.cpp b/qad/libs/sql_table/plugin/sql_record_plugin.cpp similarity index 100% rename from qad/sql_table/plugin/sql_record_plugin.cpp rename to qad/libs/sql_table/plugin/sql_record_plugin.cpp diff --git a/qad/sql_table/plugin/sql_record_plugin.h b/qad/libs/sql_table/plugin/sql_record_plugin.h similarity index 100% rename from qad/sql_table/plugin/sql_record_plugin.h rename to qad/libs/sql_table/plugin/sql_record_plugin.h diff --git a/qad/sql_table/plugin/sql_table_plugin.cpp b/qad/libs/sql_table/plugin/sql_table_plugin.cpp similarity index 100% rename from qad/sql_table/plugin/sql_table_plugin.cpp rename to qad/libs/sql_table/plugin/sql_table_plugin.cpp diff --git a/qad/sql_table/plugin/sql_table_plugin.h b/qad/libs/sql_table/plugin/sql_table_plugin.h similarity index 100% rename from qad/sql_table/plugin/sql_table_plugin.h rename to qad/libs/sql_table/plugin/sql_table_plugin.h diff --git a/qad/libs/sql_table/qad_sql_table.qrc b/qad/libs/sql_table/qad_sql_table.qrc new file mode 100644 index 0000000..4673462 --- /dev/null +++ b/qad/libs/sql_table/qad_sql_table.qrc @@ -0,0 +1,26 @@ + + + ../../icons/edit-table-insert-row-below.png + ../../icons/dialog-close.png + ../../icons/edit-clear.png + ../../icons/edit-guides.png + ../../icons/view-grid.png + ../../icons/zoom-fit-best.png + ../../icons/configure.png + ../../icons/document-save.png + ../../icons/edit-clear-locationbar-rtl.png + ../../icons/edit-find.png + ../../icons/list-add.png + ../../icons/edit-delete.png + ../../icons/item.png + ../../icons/node-add.png + ../../icons/node.png + ../../icons/edit-copy.png + ../../icons/edit-paste.png + ../../icons/expand_s_x.png + ../../icons/expand_s_y.png + ../../icons/expand_x.png + ../../icons/expand_y.png + ../../icons/sql_table.png + + diff --git a/qad/sql_table/sql_record_widget.cpp b/qad/libs/sql_table/sql_record_widget.cpp similarity index 100% rename from qad/sql_table/sql_record_widget.cpp rename to qad/libs/sql_table/sql_record_widget.cpp diff --git a/qad/sql_table/sql_record_widget.h b/qad/libs/sql_table/sql_record_widget.h similarity index 95% rename from qad/sql_table/sql_record_widget.h rename to qad/libs/sql_table/sql_record_widget.h index 4c28b55..1e0eb91 100644 --- a/qad/sql_table/sql_record_widget.h +++ b/qad/libs/sql_table/sql_record_widget.h @@ -26,10 +26,10 @@ #include #include #include -#include "qad_export.h" +#include "qad_sql_table_export.h" -class QAD_EXPORT SQLRecordWidget: public QWidget { +class QAD_SQL_TABLE_EXPORT SQLRecordWidget: public QWidget { Q_OBJECT public: SQLRecordWidget(QWidget * parent = 0); @@ -64,7 +64,7 @@ protected: void updateWidgets(); QVariant::Type fieldType(const QSqlField & f); - struct RelationSrc { + struct QAD_SQL_TABLE_EXPORT RelationSrc { RelationSrc(const QString & v0 = QString(), const QString & v1 = QString(), const QString & v2 = QString(), const QString & v3 = QString()): tcol(v0), table(v1), diff --git a/qad/sql_table/sql_table_widget.cpp b/qad/libs/sql_table/sql_table_widget.cpp similarity index 100% rename from qad/sql_table/sql_table_widget.cpp rename to qad/libs/sql_table/sql_table_widget.cpp diff --git a/qad/sql_table/sql_table_widget.h b/qad/libs/sql_table/sql_table_widget.h similarity index 96% rename from qad/sql_table/sql_table_widget.h rename to qad/libs/sql_table/sql_table_widget.h index 1bf1ced..d01cf10 100644 --- a/qad/sql_table/sql_table_widget.h +++ b/qad/libs/sql_table/sql_table_widget.h @@ -45,9 +45,10 @@ #include #include #include "qpiconfig.h" +#include "qad_sql_table_export.h" -struct QAD_EXPORT ColumnProperties { +struct QAD_SQL_TABLE_EXPORT ColumnProperties { enum DataType {Unknown, Int, Float, Chars, Text, Binary, Date, Time, DateTime}; ColumnProperties(const QString & table_, const QString & type_, const QString & name_, const QString & def_, bool auto_, bool prim_, bool option_); bool isRelation() const {return (!relation_key.isEmpty() && !relation_column.isEmpty());} @@ -77,7 +78,7 @@ struct QAD_EXPORT ColumnProperties { -struct QAD_EXPORT TableColumns { +struct QAD_SQL_TABLE_EXPORT TableColumns { int mapColumn(int abs_ind) const {if (abs_ind <= 0 || abs_ind >= column_indexes.size() + 1) return 0; return column_indexes[abs_ind - 1];} QVector column_indexes; QList columns; @@ -86,7 +87,7 @@ struct QAD_EXPORT TableColumns { -class QAD_EXPORT SQLQueryModel: public QSqlQueryModel { +class QAD_SQL_TABLE_EXPORT SQLQueryModel: public QSqlQueryModel { Q_OBJECT public: explicit SQLQueryModel(QString & t, QString & conn, QList & cp, QVector & ci, QObject* parent = 0): QSqlQueryModel(parent), table_(t), column_props(cp), column_indexes(ci), conn_name(conn) {;} @@ -107,7 +108,7 @@ signals: -class QAD_EXPORT SQLUniEdit: public QWidget { +class QAD_SQL_TABLE_EXPORT SQLUniEdit: public QWidget { Q_OBJECT public: explicit SQLUniEdit(const ColumnProperties & prop, const QString & conn_name, QWidget * parent = 0); @@ -147,7 +148,7 @@ signals: -class QAD_EXPORT SQLNewEdit: public QWidget { +class QAD_SQL_TABLE_EXPORT SQLNewEdit: public QWidget { Q_OBJECT friend class SQLTableWidget; public: @@ -166,7 +167,7 @@ private: -class QAD_EXPORT SQLFilterEdit: public QWidget { +class QAD_SQL_TABLE_EXPORT SQLFilterEdit: public QWidget { Q_OBJECT friend class SQLTableWidget; public: @@ -190,7 +191,7 @@ signals: -class QAD_EXPORT SQLItemDelegate: public QStyledItemDelegate { +class QAD_SQL_TABLE_EXPORT SQLItemDelegate: public QStyledItemDelegate { Q_OBJECT public: explicit SQLItemDelegate(QList & cp, QVector & ci, bool & ro, const QString & conn_name, QObject * parent = 0); @@ -216,7 +217,7 @@ namespace Ui { } -class QAD_EXPORT SQLTableWidget: public QWidget +class QAD_SQL_TABLE_EXPORT SQLTableWidget: public QWidget { Q_OBJECT Q_PROPERTY(QString tableName READ tableName WRITE setTableName) diff --git a/qad/sql_table/sql_table_widget.ui b/qad/libs/sql_table/sql_table_widget.ui similarity index 100% rename from qad/sql_table/sql_table_widget.ui rename to qad/libs/sql_table/sql_table_widget.ui diff --git a/qad/libs/touch_widgets/CMakeLists.txt b/qad/libs/touch_widgets/CMakeLists.txt new file mode 100644 index 0000000..e6b86ef --- /dev/null +++ b/qad/libs/touch_widgets/CMakeLists.txt @@ -0,0 +1 @@ +qad_library(touch_widgets "Gui;Widgets" "") diff --git a/qad/touch_widgets/plugin/CMakeLists.txt b/qad/libs/touch_widgets/plugin/CMakeLists.txt similarity index 97% rename from qad/touch_widgets/plugin/CMakeLists.txt rename to qad/libs/touch_widgets/plugin/CMakeLists.txt index 558030d..13ac6d6 100644 --- a/qad/touch_widgets/plugin/CMakeLists.txt +++ b/qad/libs/touch_widgets/plugin/CMakeLists.txt @@ -1 +1 @@ -qad_plugin(touch_widgets "Gui;Widgets" "") +qad_plugin(touch_widgets "Gui;Widgets" "") diff --git a/qad/touch_widgets/plugin/qad_touch_widgets.cpp b/qad/libs/touch_widgets/plugin/qad_touch_widgets.cpp similarity index 100% rename from qad/touch_widgets/plugin/qad_touch_widgets.cpp rename to qad/libs/touch_widgets/plugin/qad_touch_widgets.cpp diff --git a/qad/touch_widgets/plugin/qad_touch_widgets.h b/qad/libs/touch_widgets/plugin/qad_touch_widgets.h similarity index 100% rename from qad/touch_widgets/plugin/qad_touch_widgets.h rename to qad/libs/touch_widgets/plugin/qad_touch_widgets.h diff --git a/qad/touch_widgets/plugin/touchbuttframeplugin.cpp b/qad/libs/touch_widgets/plugin/touchbuttframeplugin.cpp similarity index 100% rename from qad/touch_widgets/plugin/touchbuttframeplugin.cpp rename to qad/libs/touch_widgets/plugin/touchbuttframeplugin.cpp diff --git a/qad/touch_widgets/plugin/touchbuttframeplugin.h b/qad/libs/touch_widgets/plugin/touchbuttframeplugin.h similarity index 100% rename from qad/touch_widgets/plugin/touchbuttframeplugin.h rename to qad/libs/touch_widgets/plugin/touchbuttframeplugin.h diff --git a/qad/touch_widgets/plugin/touchbuttonplugin.cpp b/qad/libs/touch_widgets/plugin/touchbuttonplugin.cpp similarity index 100% rename from qad/touch_widgets/plugin/touchbuttonplugin.cpp rename to qad/libs/touch_widgets/plugin/touchbuttonplugin.cpp diff --git a/qad/touch_widgets/plugin/touchbuttonplugin.h b/qad/libs/touch_widgets/plugin/touchbuttonplugin.h similarity index 100% rename from qad/touch_widgets/plugin/touchbuttonplugin.h rename to qad/libs/touch_widgets/plugin/touchbuttonplugin.h diff --git a/qad/touch_widgets/plugin/touchsliderplugin.cpp b/qad/libs/touch_widgets/plugin/touchsliderplugin.cpp similarity index 100% rename from qad/touch_widgets/plugin/touchsliderplugin.cpp rename to qad/libs/touch_widgets/plugin/touchsliderplugin.cpp diff --git a/qad/touch_widgets/plugin/touchsliderplugin.h b/qad/libs/touch_widgets/plugin/touchsliderplugin.h similarity index 100% rename from qad/touch_widgets/plugin/touchsliderplugin.h rename to qad/libs/touch_widgets/plugin/touchsliderplugin.h diff --git a/qad/touch_widgets/touch_bar.h b/qad/libs/touch_widgets/touch_bar.h similarity index 96% rename from qad/touch_widgets/touch_bar.h rename to qad/libs/touch_widgets/touch_bar.h index 8bedee9..e2b6f7a 100644 --- a/qad/touch_widgets/touch_bar.h +++ b/qad/libs/touch_widgets/touch_bar.h @@ -1,36 +1,36 @@ -/* - QAD - Qt ADvanced - - Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#ifndef TOUCH_BAR_H -#define TOUCH_BAR_H - -#include - -class touch_bar: public QProgressBar { - Q_OBJECT -public: - touch_bar(QWidget * parent = 0): QProgressBar(parent) - { - //setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum); - } -signals: - void mouseMoveEvent(QMouseEvent * e); - void mousePressEvent(QMouseEvent * e); -}; -#endif // TOUCH_BAR_H +/* + QAD - Qt ADvanced + + Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +#ifndef TOUCH_BAR_H +#define TOUCH_BAR_H + +#include + +class touch_bar: public QProgressBar { + Q_OBJECT +public: + touch_bar(QWidget * parent = 0): QProgressBar(parent) + { + //setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum); + } +signals: + void mouseMoveEvent(QMouseEvent * e); + void mousePressEvent(QMouseEvent * e); +}; +#endif // TOUCH_BAR_H diff --git a/qad/libs/touch_widgets/touch_widgets.qrc b/qad/libs/touch_widgets/touch_widgets.qrc new file mode 100644 index 0000000..ff1d228 --- /dev/null +++ b/qad/libs/touch_widgets/touch_widgets.qrc @@ -0,0 +1,7 @@ + + + ../../icons/touchbuttframe.png + ../../icons/touchbutton.png + ../../icons/touchslider.png + + diff --git a/qad/touch_widgets/touchbuttframe.cpp b/qad/libs/touch_widgets/touchbuttframe.cpp similarity index 100% rename from qad/touch_widgets/touchbuttframe.cpp rename to qad/libs/touch_widgets/touchbuttframe.cpp diff --git a/qad/touch_widgets/touchbuttframe.h b/qad/libs/touch_widgets/touchbuttframe.h similarity index 98% rename from qad/touch_widgets/touchbuttframe.h rename to qad/libs/touch_widgets/touchbuttframe.h index 32c8ca3..9f52eac 100644 --- a/qad/touch_widgets/touchbuttframe.h +++ b/qad/libs/touch_widgets/touchbuttframe.h @@ -24,9 +24,10 @@ #include #include #include "touchbutton.h" +#include "qad_touch_widgets_export.h" -class QAD_EXPORT TouchButtFrame: public QFrame +class QAD_TOUCH_WIDGETS_EXPORT TouchButtFrame: public QFrame { Q_OBJECT Q_PROPERTY(QColor colorYes READ colorYes WRITE setColorYes) diff --git a/qad/touch_widgets/touchbutton.cpp b/qad/libs/touch_widgets/touchbutton.cpp similarity index 100% rename from qad/touch_widgets/touchbutton.cpp rename to qad/libs/touch_widgets/touchbutton.cpp diff --git a/qad/touch_widgets/touchbutton.h b/qad/libs/touch_widgets/touchbutton.h similarity index 97% rename from qad/touch_widgets/touchbutton.h rename to qad/libs/touch_widgets/touchbutton.h index 3308894..56bd0fd 100644 --- a/qad/touch_widgets/touchbutton.h +++ b/qad/libs/touch_widgets/touchbutton.h @@ -25,10 +25,10 @@ #include #include #include -#include "qad_export.h" +#include "qad_touch_widgets_export.h" -class QAD_EXPORT TouchButton: public QToolButton +class QAD_TOUCH_WIDGETS_EXPORT TouchButton: public QToolButton { Q_OBJECT Q_ENUMS(State) @@ -53,7 +53,7 @@ public: TouchButton(int id, const QString & text = QString()); ~TouchButton(); - enum State {Gray, Yes, No}; + enum State {Gray, Yes, No}; int clickID() const {return id_click;} int yesID() const {return id_yes;} @@ -77,7 +77,7 @@ public: private: void timerEvent(QTimerEvent * e); void mousePressEvent(QMouseEvent * e); - void mouseReleaseEvent(QMouseEvent * e); + void mouseReleaseEvent(QMouseEvent * e); void init(); void animateColor(const QColor & tc); diff --git a/qad/touch_widgets/touchslider.cpp b/qad/libs/touch_widgets/touchslider.cpp similarity index 96% rename from qad/touch_widgets/touchslider.cpp rename to qad/libs/touch_widgets/touchslider.cpp index 515acdc..f903314 100644 --- a/qad/touch_widgets/touchslider.cpp +++ b/qad/libs/touch_widgets/touchslider.cpp @@ -1,242 +1,242 @@ -#include "touchslider.h" -#include "ui_touchslider.h" - - -TouchSlider::TouchSlider(QWidget * parent): QGroupBox(parent), ui(new Ui::TouchSlider) { - ui->setupUi(this); - ui->barNeg->setMinimum(0); - prec = 1; - id_click = id_set = -1; - hasZero = true; - m_readOnly = false; - m_showMinMax = false; -} - - -TouchSlider::~TouchSlider() { - delete ui; -} - - -void TouchSlider::on_pbMin_clicked() { - if (m_readOnly) return; - ui->barNeg->setValue(ui->barNeg->maximum()); - ui->barPos->setValue(ui->barPos->minimum()); -} - - -void TouchSlider::on_pbMax_clicked() { - if (m_readOnly) return; - ui->barNeg->setValue(ui->barNeg->minimum()); - ui->barPos->setValue(ui->barPos->maximum()); -} - - -void TouchSlider::on_pbInc_clicked() { - if (ui->barPos->value() >= 0 && ui->barNeg->value() == 0) ui->barPos->setValue(ui->barPos->value() + 1); - if (ui->barNeg->value() > 0) ui->barNeg->setValue(ui->barNeg->value() - 1); -} - - -void TouchSlider::on_pbDec_clicked() { - if (ui->barNeg->value() >= 0 && ui->barPos->value() == 0 && hasZero) ui->barNeg->setValue(ui->barNeg->value() + 1); - if (ui->barPos->value() > 0) ui->barPos->setValue(ui->barPos->value() - 1); -} - - -void TouchSlider::on_pbZero_clicked() { - ui->barNeg->setValue(ui->barNeg->minimum()); - ui->barPos->setValue(ui->barPos->minimum()); -} - - -void TouchSlider::setValue(double val) { - if (val < minimum()) val = minimum(); - if (val > maximum()) val = maximum(); - if (val < 0) { - ui->barPos->setValue(ui->barPos->minimum()); - if (hasZero) ui->barNeg->setValue(qRound(-val / prec)); - } else { - ui->barPos->setValue(qRound(val / prec)); - ui->barNeg->setValue(ui->barNeg->minimum()); - } - updateCaption(); -} - - -double TouchSlider::value() const { - if (ui->barNeg->value() <= ui->barNeg->minimum()) - return (double)(ui->barPos->value()) * prec; - else return -(double)(ui->barNeg->value()) * prec; -} - - -void TouchSlider::setMaximum(double max) { - double val = value(); - if (max < 0) return; - ui->barPos->setMaximum(qRound(max / prec)); - setValue(val); - ui->pbMax->setText(QString::number(maximum())); -} - - -double TouchSlider::maximum() const { - return (double)(ui->barPos->maximum()) * prec; -} - - -void TouchSlider::setMinimum(double min) { - double val = value(); - if (min < 0) { - hasZero = true; - ui->barNeg->setMaximum(qRound(-min / prec)); - ui->barPos->setMinimum(0); - ui->barNeg->setVisible(true); - ui->pbZero->setVisible(true); - setValue(val); - } else { - hasZero = false; - ui->barNeg->setMaximum(0); - ui->barNeg->setVisible(false); - ui->pbZero->setVisible(false); - ui->barPos->setMinimum(qRound(min / prec)); - setValue(val); - } - ui->pbMin->setText(QString::number(minimum())); -} - - -double TouchSlider::minimum() const { - if (hasZero) return -(double)(ui->barNeg->maximum()) * prec; - return (double)(ui->barPos->minimum()) * prec; -} - - -void TouchSlider::setPrecision(double precision) { - double min = minimum(); - double max = maximum(); - double val = value(); - prec = precision; - setMinimum(min); - setMaximum(max); - setValue(val); - ui->pbInc->setText("+" + QString::number(precision)); - ui->pbDec->setText("-" + QString::number(precision)); -} - - -double TouchSlider::precision() const { - return prec; -} - - -void TouchSlider::updateCaption() { - setTitle(pref + " " + QString::number(value()) + " " + suff); - emit valueChanged(value()); - emit valueChanged((int)value()); - emit valueChangedID(id_click, value()); - emit valueChangedID(id_click, (int)value()); -} - - -void TouchSlider::on_barPos_mouseMoveEvent(QMouseEvent * e) { - if (m_readOnly) return; - int tx = e->x(); - if (tx > ui->barPos->width()) tx = ui->barPos->width(); - if (tx < 0) { - if (hasZero) { - int nx = tx + ui->barNeg->width() + layout()->spacing(); - if (nx < ui->barNeg->width()) { - QMouseEvent * event = new QMouseEvent(QMouseEvent::MouseMove, QPoint(nx, 0), Qt::NoButton, Qt::NoButton, Qt::NoModifier); - on_barNeg_mouseMoveEvent(event); - return; - } - } - tx = 0; - } - ui->barPos->setValue(ui->barPos->minimum() + qRound((double)(tx * (ui->barPos->maximum() - ui->barPos->minimum())) / (double)(ui->barPos->width()))); - ui->barNeg->setValue(ui->barNeg->minimum()); -} - - -void TouchSlider::on_barNeg_mouseMoveEvent(QMouseEvent * e) { - if (m_readOnly) return; - int tx = e->x(); - if (tx < 0) tx = 0; - if (tx > ui->barNeg->width()) { - int nx = tx - ui->barPos->width() - layout()->spacing(); - if (nx > 0) { - QMouseEvent * event = new QMouseEvent(QMouseEvent::MouseMove, QPoint(nx, 0), Qt::NoButton, Qt::NoButton, Qt::NoModifier); - on_barPos_mouseMoveEvent(event); - return; - } - tx = ui->barNeg->width(); - } - ui->barNeg->setValue(ui->barNeg->maximum() - qRound((double)(tx * ui->barNeg->maximum()) / (double)(ui->barNeg->width()))); - ui->barPos->setValue(ui->barPos->minimum()); -} - - -void TouchSlider::on_barPos_mousePressEvent(QMouseEvent * e) { - if (m_readOnly) return; - ui->barPos->setValue(ui->barPos->minimum() + qRound((double)(e->x() * (ui->barPos->maximum() - ui->barPos->minimum())) / (double)(ui->barPos->width()))); - ui->barNeg->setValue(ui->barNeg->minimum()); -} - - -void TouchSlider::on_barNeg_mousePressEvent(QMouseEvent * e) { - if (m_readOnly) return; - ui->barNeg->setValue(ui->barNeg->maximum() - qRound((double)(e->x()*ui->barNeg->maximum()) / (double)(ui->barNeg->width()))); - ui->barPos->setValue(ui->barPos->minimum()); -} - - -void TouchSlider::on_barNeg_valueChanged(int) { - updateCaption(); -} - - -void TouchSlider::on_barPos_valueChanged(int) { - updateCaption(); -} - - -void TouchSlider::setReadOnly(bool arg) { - QBoxLayout * bl = qobject_cast(layout()); - m_readOnly = arg; - if (arg) { - ui->pbDec->hide(); - ui->pbInc->hide(); - if (hasZero) - ui->pbZero->hide(); - bl->setStretchFactor(ui->pbMin, 2); - bl->setStretchFactor(ui->pbMax, 2); - } else { - ui->pbDec->show(); - ui->pbInc->show(); - if (hasZero) - ui->pbZero->show(); - bl->setStretchFactor(ui->pbMin, 1); - bl->setStretchFactor(ui->pbMax, 1); - } -} - - -void TouchSlider::setShowMinMax(bool arg) { - QBoxLayout * bl = qobject_cast(layout()); - m_showMinMax = arg; - if (arg) { - ui->pbMin->hide(); - ui->pbMax->hide(); - bl->setStretchFactor(ui->pbInc, 2); - bl->setStretchFactor(ui->pbDec, 2); - bl->setStretchFactor(ui->pbZero, 2); - } else { - ui->pbMin->show(); - ui->pbMax->show(); - bl->setStretchFactor(ui->pbInc, 1); - bl->setStretchFactor(ui->pbDec, 1); - bl->setStretchFactor(ui->pbZero, 1); - } -} - +#include "touchslider.h" +#include "ui_touchslider.h" + + +TouchSlider::TouchSlider(QWidget * parent): QGroupBox(parent), ui(new Ui::TouchSlider) { + ui->setupUi(this); + ui->barNeg->setMinimum(0); + prec = 1; + id_click = id_set = -1; + hasZero = true; + m_readOnly = false; + m_showMinMax = false; +} + + +TouchSlider::~TouchSlider() { + delete ui; +} + + +void TouchSlider::on_pbMin_clicked() { + if (m_readOnly) return; + ui->barNeg->setValue(ui->barNeg->maximum()); + ui->barPos->setValue(ui->barPos->minimum()); +} + + +void TouchSlider::on_pbMax_clicked() { + if (m_readOnly) return; + ui->barNeg->setValue(ui->barNeg->minimum()); + ui->barPos->setValue(ui->barPos->maximum()); +} + + +void TouchSlider::on_pbInc_clicked() { + if (ui->barPos->value() >= 0 && ui->barNeg->value() == 0) ui->barPos->setValue(ui->barPos->value() + 1); + if (ui->barNeg->value() > 0) ui->barNeg->setValue(ui->barNeg->value() - 1); +} + + +void TouchSlider::on_pbDec_clicked() { + if (ui->barNeg->value() >= 0 && ui->barPos->value() == 0 && hasZero) ui->barNeg->setValue(ui->barNeg->value() + 1); + if (ui->barPos->value() > 0) ui->barPos->setValue(ui->barPos->value() - 1); +} + + +void TouchSlider::on_pbZero_clicked() { + ui->barNeg->setValue(ui->barNeg->minimum()); + ui->barPos->setValue(ui->barPos->minimum()); +} + + +void TouchSlider::setValue(double val) { + if (val < minimum()) val = minimum(); + if (val > maximum()) val = maximum(); + if (val < 0) { + ui->barPos->setValue(ui->barPos->minimum()); + if (hasZero) ui->barNeg->setValue(qRound(-val / prec)); + } else { + ui->barPos->setValue(qRound(val / prec)); + ui->barNeg->setValue(ui->barNeg->minimum()); + } + updateCaption(); +} + + +double TouchSlider::value() const { + if (ui->barNeg->value() <= ui->barNeg->minimum()) + return (double)(ui->barPos->value()) * prec; + else return -(double)(ui->barNeg->value()) * prec; +} + + +void TouchSlider::setMaximum(double max) { + double val = value(); + if (max < 0) return; + ui->barPos->setMaximum(qRound(max / prec)); + setValue(val); + ui->pbMax->setText(QString::number(maximum())); +} + + +double TouchSlider::maximum() const { + return (double)(ui->barPos->maximum()) * prec; +} + + +void TouchSlider::setMinimum(double min) { + double val = value(); + if (min < 0) { + hasZero = true; + ui->barNeg->setMaximum(qRound(-min / prec)); + ui->barPos->setMinimum(0); + ui->barNeg->setVisible(true); + ui->pbZero->setVisible(true); + setValue(val); + } else { + hasZero = false; + ui->barNeg->setMaximum(0); + ui->barNeg->setVisible(false); + ui->pbZero->setVisible(false); + ui->barPos->setMinimum(qRound(min / prec)); + setValue(val); + } + ui->pbMin->setText(QString::number(minimum())); +} + + +double TouchSlider::minimum() const { + if (hasZero) return -(double)(ui->barNeg->maximum()) * prec; + return (double)(ui->barPos->minimum()) * prec; +} + + +void TouchSlider::setPrecision(double precision) { + double min = minimum(); + double max = maximum(); + double val = value(); + prec = precision; + setMinimum(min); + setMaximum(max); + setValue(val); + ui->pbInc->setText("+" + QString::number(precision)); + ui->pbDec->setText("-" + QString::number(precision)); +} + + +double TouchSlider::precision() const { + return prec; +} + + +void TouchSlider::updateCaption() { + setTitle(pref + " " + QString::number(value()) + " " + suff); + emit valueChanged(value()); + emit valueChanged((int)value()); + emit valueChangedID(id_click, value()); + emit valueChangedID(id_click, (int)value()); +} + + +void TouchSlider::on_barPos_mouseMoveEvent(QMouseEvent * e) { + if (m_readOnly) return; + int tx = e->x(); + if (tx > ui->barPos->width()) tx = ui->barPos->width(); + if (tx < 0) { + if (hasZero) { + int nx = tx + ui->barNeg->width() + layout()->spacing(); + if (nx < ui->barNeg->width()) { + QMouseEvent * event = new QMouseEvent(QMouseEvent::MouseMove, QPoint(nx, 0), Qt::NoButton, Qt::NoButton, Qt::NoModifier); + on_barNeg_mouseMoveEvent(event); + return; + } + } + tx = 0; + } + ui->barPos->setValue(ui->barPos->minimum() + qRound((double)(tx * (ui->barPos->maximum() - ui->barPos->minimum())) / (double)(ui->barPos->width()))); + ui->barNeg->setValue(ui->barNeg->minimum()); +} + + +void TouchSlider::on_barNeg_mouseMoveEvent(QMouseEvent * e) { + if (m_readOnly) return; + int tx = e->x(); + if (tx < 0) tx = 0; + if (tx > ui->barNeg->width()) { + int nx = tx - ui->barPos->width() - layout()->spacing(); + if (nx > 0) { + QMouseEvent * event = new QMouseEvent(QMouseEvent::MouseMove, QPoint(nx, 0), Qt::NoButton, Qt::NoButton, Qt::NoModifier); + on_barPos_mouseMoveEvent(event); + return; + } + tx = ui->barNeg->width(); + } + ui->barNeg->setValue(ui->barNeg->maximum() - qRound((double)(tx * ui->barNeg->maximum()) / (double)(ui->barNeg->width()))); + ui->barPos->setValue(ui->barPos->minimum()); +} + + +void TouchSlider::on_barPos_mousePressEvent(QMouseEvent * e) { + if (m_readOnly) return; + ui->barPos->setValue(ui->barPos->minimum() + qRound((double)(e->x() * (ui->barPos->maximum() - ui->barPos->minimum())) / (double)(ui->barPos->width()))); + ui->barNeg->setValue(ui->barNeg->minimum()); +} + + +void TouchSlider::on_barNeg_mousePressEvent(QMouseEvent * e) { + if (m_readOnly) return; + ui->barNeg->setValue(ui->barNeg->maximum() - qRound((double)(e->x()*ui->barNeg->maximum()) / (double)(ui->barNeg->width()))); + ui->barPos->setValue(ui->barPos->minimum()); +} + + +void TouchSlider::on_barNeg_valueChanged(int) { + updateCaption(); +} + + +void TouchSlider::on_barPos_valueChanged(int) { + updateCaption(); +} + + +void TouchSlider::setReadOnly(bool arg) { + QBoxLayout * bl = qobject_cast(layout()); + m_readOnly = arg; + if (arg) { + ui->pbDec->hide(); + ui->pbInc->hide(); + if (hasZero) + ui->pbZero->hide(); + bl->setStretchFactor(ui->pbMin, 2); + bl->setStretchFactor(ui->pbMax, 2); + } else { + ui->pbDec->show(); + ui->pbInc->show(); + if (hasZero) + ui->pbZero->show(); + bl->setStretchFactor(ui->pbMin, 1); + bl->setStretchFactor(ui->pbMax, 1); + } +} + + +void TouchSlider::setShowMinMax(bool arg) { + QBoxLayout * bl = qobject_cast(layout()); + m_showMinMax = arg; + if (arg) { + ui->pbMin->hide(); + ui->pbMax->hide(); + bl->setStretchFactor(ui->pbInc, 2); + bl->setStretchFactor(ui->pbDec, 2); + bl->setStretchFactor(ui->pbZero, 2); + } else { + ui->pbMin->show(); + ui->pbMax->show(); + bl->setStretchFactor(ui->pbInc, 1); + bl->setStretchFactor(ui->pbDec, 1); + bl->setStretchFactor(ui->pbZero, 1); + } +} + diff --git a/qad/touch_widgets/touchslider.h b/qad/libs/touch_widgets/touchslider.h similarity index 95% rename from qad/touch_widgets/touchslider.h rename to qad/libs/touch_widgets/touchslider.h index 4f2f043..29ab8c3 100644 --- a/qad/touch_widgets/touchslider.h +++ b/qad/libs/touch_widgets/touchslider.h @@ -1,127 +1,127 @@ -/* - QAD - Qt ADvanced - - Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#ifndef TOUCHSLIDER_H -#define TOUCHSLIDER_H - -#include -#include -#include "qad_export.h" - - -namespace Ui { - class TouchSlider; -} - - -class QAD_EXPORT TouchSlider: public QGroupBox -{ - Q_OBJECT - Q_PROPERTY(bool readOnly READ readOnly WRITE setReadOnly) - Q_PROPERTY(bool showMinMax READ showMinMax WRITE setShowMinMax) - Q_PROPERTY(double minimum READ minimum WRITE setMinimum) - Q_PROPERTY(double maximum READ maximum WRITE setMaximum) - Q_PROPERTY(double value READ value WRITE setValue) - Q_PROPERTY(double precision READ precision WRITE setPrecision) - Q_PROPERTY(QString prefix READ prefix WRITE setPrefix) - Q_PROPERTY(QString suffix READ suffix WRITE setSuffix) - Q_PROPERTY(int clickID READ clickID WRITE setClickID) - Q_PROPERTY(int setID READ setID WRITE setSetID) - -public: - explicit TouchSlider(QWidget *parent = 0); - ~TouchSlider(); - - int clickID() const {return id_click;} - int setID() const {return id_set;} - - double minimum() const; - double maximum() const; - double value() const; - double precision() const; - QString prefix() const {return pref;} - QString suffix() const {return suff;} - bool readOnly() const {return m_readOnly;} - bool showMinMax() const {return m_showMinMax;} - -private: - void updateCaption(); - - Ui::TouchSlider *ui; - bool hasZero; - bool m_readOnly; - bool m_showMinMax; - double prec; - int id_click, id_set; - QString pref, suff; - -public slots: - void enable() {setEnabled(true);} - void disable() {setEnabled(false);} - - void setClickID(int id) {id_click = id;} - void setSetID(int id) {id_set = id;} - - void setSuffix(const QString & text) {suff = text; updateCaption();} - void setPrefix(const QString & text) {pref = text; updateCaption();} - void setPrecision(double precision); - void setPrecision(int precision) {setPrecision((double)precision);} - void setMinimum(double min); - void setMinimum(int min) {setMinimum((double)min);} - void setMaximum(double max); - void setMaximum(int max) {setMaximum((double)max);} - void setReadOnly(bool yes); - void setShowMinMax(bool yes); - - void setValue(double val); - void setValue(int val) {setValue((double)val);} - - void enableID(int set_id) {if (set_id == id_set) enable();} - void disableID(int set_id) {if (set_id == id_set) disable();} - - void setValueID(int set_id, double val) {if (set_id == id_set) setValue(val);} - void setValueID(int set_id, int val) {if (set_id == id_set) setValue(val);} - - void clickMin() {on_pbMin_clicked();} - void clickMax() {on_pbMax_clicked();} - void clickInc() {on_pbInc_clicked();} - void clickDec() {on_pbDec_clicked();} - void clickZero() {on_pbZero_clicked();} - -private slots: - void on_barPos_valueChanged(int value); - void on_barNeg_valueChanged(int value); - void on_barNeg_mousePressEvent(QMouseEvent*); - void on_barPos_mousePressEvent(QMouseEvent*); - void on_barNeg_mouseMoveEvent(QMouseEvent*); - void on_barPos_mouseMoveEvent(QMouseEvent*); - void on_pbZero_clicked(); - void on_pbDec_clicked(); - void on_pbInc_clicked(); - void on_pbMax_clicked(); - void on_pbMin_clicked(); - -signals: - void valueChanged(double val); - void valueChanged(int val); - void valueChangedID(int id, double val); - void valueChangedID(int id, int val); -}; - -#endif // TOUCHSLIDER_H +/* + QAD - Qt ADvanced + + Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +#ifndef TOUCHSLIDER_H +#define TOUCHSLIDER_H + +#include +#include +#include "qad_touch_widgets_export.h" + + +namespace Ui { + class TouchSlider; +} + + +class QAD_TOUCH_WIDGETS_EXPORT TouchSlider: public QGroupBox +{ + Q_OBJECT + Q_PROPERTY(bool readOnly READ readOnly WRITE setReadOnly) + Q_PROPERTY(bool showMinMax READ showMinMax WRITE setShowMinMax) + Q_PROPERTY(double minimum READ minimum WRITE setMinimum) + Q_PROPERTY(double maximum READ maximum WRITE setMaximum) + Q_PROPERTY(double value READ value WRITE setValue) + Q_PROPERTY(double precision READ precision WRITE setPrecision) + Q_PROPERTY(QString prefix READ prefix WRITE setPrefix) + Q_PROPERTY(QString suffix READ suffix WRITE setSuffix) + Q_PROPERTY(int clickID READ clickID WRITE setClickID) + Q_PROPERTY(int setID READ setID WRITE setSetID) + +public: + explicit TouchSlider(QWidget *parent = 0); + ~TouchSlider(); + + int clickID() const {return id_click;} + int setID() const {return id_set;} + + double minimum() const; + double maximum() const; + double value() const; + double precision() const; + QString prefix() const {return pref;} + QString suffix() const {return suff;} + bool readOnly() const {return m_readOnly;} + bool showMinMax() const {return m_showMinMax;} + +private: + void updateCaption(); + + Ui::TouchSlider *ui; + bool hasZero; + bool m_readOnly; + bool m_showMinMax; + double prec; + int id_click, id_set; + QString pref, suff; + +public slots: + void enable() {setEnabled(true);} + void disable() {setEnabled(false);} + + void setClickID(int id) {id_click = id;} + void setSetID(int id) {id_set = id;} + + void setSuffix(const QString & text) {suff = text; updateCaption();} + void setPrefix(const QString & text) {pref = text; updateCaption();} + void setPrecision(double precision); + void setPrecision(int precision) {setPrecision((double)precision);} + void setMinimum(double min); + void setMinimum(int min) {setMinimum((double)min);} + void setMaximum(double max); + void setMaximum(int max) {setMaximum((double)max);} + void setReadOnly(bool yes); + void setShowMinMax(bool yes); + + void setValue(double val); + void setValue(int val) {setValue((double)val);} + + void enableID(int set_id) {if (set_id == id_set) enable();} + void disableID(int set_id) {if (set_id == id_set) disable();} + + void setValueID(int set_id, double val) {if (set_id == id_set) setValue(val);} + void setValueID(int set_id, int val) {if (set_id == id_set) setValue(val);} + + void clickMin() {on_pbMin_clicked();} + void clickMax() {on_pbMax_clicked();} + void clickInc() {on_pbInc_clicked();} + void clickDec() {on_pbDec_clicked();} + void clickZero() {on_pbZero_clicked();} + +private slots: + void on_barPos_valueChanged(int value); + void on_barNeg_valueChanged(int value); + void on_barNeg_mousePressEvent(QMouseEvent*); + void on_barPos_mousePressEvent(QMouseEvent*); + void on_barNeg_mouseMoveEvent(QMouseEvent*); + void on_barPos_mouseMoveEvent(QMouseEvent*); + void on_pbZero_clicked(); + void on_pbDec_clicked(); + void on_pbInc_clicked(); + void on_pbMax_clicked(); + void on_pbMin_clicked(); + +signals: + void valueChanged(double val); + void valueChanged(int val); + void valueChangedID(int id, double val); + void valueChangedID(int id, int val); +}; + +#endif // TOUCHSLIDER_H diff --git a/qad/touch_widgets/touchslider.ui b/qad/libs/touch_widgets/touchslider.ui similarity index 100% rename from qad/touch_widgets/touchslider.ui rename to qad/libs/touch_widgets/touchslider.ui diff --git a/qad/libs/utils/CMakeLists.txt b/qad/libs/utils/CMakeLists.txt new file mode 100644 index 0000000..9c23d41 --- /dev/null +++ b/qad/libs/utils/CMakeLists.txt @@ -0,0 +1 @@ +qad_library(utils "Gui;Widgets" "") diff --git a/qad/utils/chunkstream.cpp b/qad/libs/utils/chunkstream.cpp similarity index 100% rename from qad/utils/chunkstream.cpp rename to qad/libs/utils/chunkstream.cpp diff --git a/qad/utils/chunkstream.h b/qad/libs/utils/chunkstream.h similarity index 98% rename from qad/utils/chunkstream.h rename to qad/libs/utils/chunkstream.h index 0ade48f..0572e9f 100644 --- a/qad/utils/chunkstream.h +++ b/qad/libs/utils/chunkstream.h @@ -24,10 +24,10 @@ #include #include #include -#include "qad_export.h" +#include "qad_utils_export.h" -class QAD_EXPORT ChunkStream +class QAD_UTILS_EXPORT ChunkStream { public: enum Version { diff --git a/qad/utils/plugin/CMakeLists.txt b/qad/libs/utils/plugin/CMakeLists.txt similarity index 96% rename from qad/utils/plugin/CMakeLists.txt rename to qad/libs/utils/plugin/CMakeLists.txt index 283b630..77d80c6 100644 --- a/qad/utils/plugin/CMakeLists.txt +++ b/qad/libs/utils/plugin/CMakeLists.txt @@ -1 +1 @@ -qad_plugin(utils "Gui" "") +qad_plugin(utils "Gui" "") diff --git a/qad/utils/plugin/qad_utils.cpp b/qad/libs/utils/plugin/qad_utils.cpp similarity index 100% rename from qad/utils/plugin/qad_utils.cpp rename to qad/libs/utils/plugin/qad_utils.cpp diff --git a/qad/utils/plugin/qad_utils.h b/qad/libs/utils/plugin/qad_utils.h similarity index 100% rename from qad/utils/plugin/qad_utils.h rename to qad/libs/utils/plugin/qad_utils.h diff --git a/qad/utils/propertystorage.cpp b/qad/libs/utils/propertystorage.cpp similarity index 100% rename from qad/utils/propertystorage.cpp rename to qad/libs/utils/propertystorage.cpp diff --git a/qad/utils/propertystorage.h b/qad/libs/utils/propertystorage.h similarity index 98% rename from qad/utils/propertystorage.h rename to qad/libs/utils/propertystorage.h index d301dc9..99d5cf6 100644 --- a/qad/utils/propertystorage.h +++ b/qad/libs/utils/propertystorage.h @@ -29,11 +29,11 @@ #include "chunkstream.h" -class QAD_EXPORT PropertyStorage { +class QAD_UTILS_EXPORT PropertyStorage { public: PropertyStorage() {} - struct Property { + struct QAD_UTILS_EXPORT Property { Property(const QString & n = QString(), const QString & c = QString(), const QVariant & v = QVariant(), int f = 0): name(n), comment(c), value(v), flags(f) {} bool toBool() const {return value.toBool();} diff --git a/qad/utils/qad_locations.cpp b/qad/libs/utils/qad_locations.cpp similarity index 100% rename from qad/utils/qad_locations.cpp rename to qad/libs/utils/qad_locations.cpp diff --git a/qad/utils/qad_locations.h b/qad/libs/utils/qad_locations.h similarity index 82% rename from qad/utils/qad_locations.h rename to qad/libs/utils/qad_locations.h index 3168b18..3367e99 100644 --- a/qad/utils/qad_locations.h +++ b/qad/libs/utils/qad_locations.h @@ -20,8 +20,8 @@ #ifndef QAD_LOCATIONS_H #define QAD_LOCATIONS_H -#include "qad_export.h" #include +#include "qad_utils_export.h" namespace QAD { @@ -36,7 +36,7 @@ namespace QAD { //! Extension is selected by "loc": //! * ltConfig - "conf" //! * ltCache - "cache" - QAD_EXPORT QString userPath(LocationType loc, QString name = QString()); + QAD_UTILS_EXPORT QString userPath(LocationType loc, QString name = QString()); //! Returns search directories for resource "type" @@ -44,13 +44,13 @@ namespace QAD { //! * :/ on mobile platforms //! * <.app>/Resources/ on MacOS //! * /usr/share/[organizationName/]/ on Linux - QAD_EXPORT QStringList resourcePaths(QString type); + QAD_UTILS_EXPORT QStringList resourcePaths(QString type); - QAD_EXPORT void loadTranslations(QString lang = QString()); + QAD_UTILS_EXPORT void loadTranslations(QString lang = QString()); - QAD_EXPORT QStringList availableTranslations(); + QAD_UTILS_EXPORT QStringList availableTranslations(); } diff --git a/qad/utils/qad_types.cpp b/qad/libs/utils/qad_types.cpp similarity index 100% rename from qad/utils/qad_types.cpp rename to qad/libs/utils/qad_types.cpp diff --git a/qad/utils/qad_types.h b/qad/libs/utils/qad_types.h similarity index 90% rename from qad/utils/qad_types.h rename to qad/libs/utils/qad_types.h index 06f35ab..9de13b4 100644 --- a/qad/utils/qad_types.h +++ b/qad/libs/utils/qad_types.h @@ -20,9 +20,9 @@ #ifndef QAD_TYPES_H #define QAD_TYPES_H -#include "propertystorage.h" -#include "qad_export.h" #include +#include "propertystorage.h" +#include "qad_utils_export.h" //! Set QCoreApplication properties from CMake "deploy_properties" //! Affect applicationName, organizationName and applicationVersion @@ -36,13 +36,13 @@ class QMetaEnum; namespace QAD { - struct QAD_EXPORT Enumerator { + struct QAD_UTILS_EXPORT Enumerator { Enumerator(int v = 0, const QString & n = QString()): value(v), name(n) {} int value; QString name; }; - struct QAD_EXPORT Enum { + struct QAD_UTILS_EXPORT Enum { Enum(const QString & n = QString()): enum_name(n) {} Enum(const QMetaEnum & meta, int selected = 0); int selectedValue() const; @@ -62,7 +62,7 @@ namespace QAD { Enum & operator <<(const QStringList & v); }; - struct QAD_EXPORT File { + struct QAD_UTILS_EXPORT File { File(const QString & p = QString(), const QString & f = QString(), bool abs = false, bool save_mode = false): file(p), filter(f), is_abs(abs), is_save(save_mode) {} QString toString() const {return file;} @@ -72,7 +72,7 @@ namespace QAD { bool is_save; }; - struct QAD_EXPORT Dir { + struct QAD_UTILS_EXPORT Dir { Dir(const QString & d = QString(), bool abs = false): dir(d), is_abs(abs) {} QString toString() const {return dir;} @@ -80,7 +80,7 @@ namespace QAD { bool is_abs; }; - struct QAD_EXPORT IODevice { + struct QAD_UTILS_EXPORT IODevice { IODevice(const QString & device_prefix = QString(), const PropertyStorage & device_properties = PropertyStorage(), int open_mode = QIODevice::ReadWrite, int device_options = 0) : prefix(device_prefix), mode(open_mode), options(device_options), props(device_properties) {} @@ -92,12 +92,12 @@ namespace QAD { PropertyStorage props; }; - struct QAD_EXPORT MathVector { + struct QAD_UTILS_EXPORT MathVector { MathVector(const QVector & vec = QVector()) {v = vec;} QVector v; }; - struct QAD_EXPORT MathMatrix { + struct QAD_UTILS_EXPORT MathMatrix { MathMatrix(const QVector > & mat = QVector > ()) {m = mat;} QVector > m; // [Row][Column] }; @@ -140,7 +140,7 @@ inline QDataStream & operator >>(QDataStream & s, QAD::MathMatrix & v) {s >> v.m inline QDebug operator <<(QDebug s, const QAD::MathMatrix & v) {s.nospace() << "Matrix " << v.m; return s.space();} -class QAD_EXPORT __QADTypesRegistrator__ { +class QAD_UTILS_EXPORT __QADTypesRegistrator__ { public: __QADTypesRegistrator__(int); static __QADTypesRegistrator__ * instance(); @@ -167,13 +167,13 @@ inline QRectF enlargedRect(const QRectF & r, qreal dx, qreal dy, qreal v) { return QRectF(r.left() - v + dx, r.top() - v + dy, r.width() + v+v, r.height() + v+v); } -QAD_EXPORT QVariant::Type typeFromLetter(const QString & l); -QAD_EXPORT QString uniqueName(QString n, const QStringList & names); +QAD_UTILS_EXPORT QVariant::Type typeFromLetter(const QString & l); +QAD_UTILS_EXPORT QString uniqueName(QString n, const QStringList & names); -QAD_EXPORT int fontHeight(const QWidget * w = 0); -QAD_EXPORT int lineThickness(const QWidget * w = 0); -QAD_EXPORT QSize preferredIconSize(float x = 1.f, const QWidget * w = 0); -QAD_EXPORT double appScale(const QWidget * w = 0); +QAD_UTILS_EXPORT int fontHeight(const QWidget * w = 0); +QAD_UTILS_EXPORT int lineThickness(const QWidget * w = 0); +QAD_UTILS_EXPORT QSize preferredIconSize(float x = 1.f, const QWidget * w = 0); +QAD_UTILS_EXPORT double appScale(const QWidget * w = 0); #endif // QAD_TYPES_H diff --git a/qad/libs/utils/qad_utils.qrc b/qad/libs/utils/qad_utils.qrc new file mode 100644 index 0000000..4df8988 --- /dev/null +++ b/qad/libs/utils/qad_utils.qrc @@ -0,0 +1,17 @@ + + + ../../icons/edit-clear.png + ../../icons/document-save.png + ../../icons/edit-clear-locationbar-rtl.png + ../../icons/edit-find.png + ../../icons/list-add.png + ../../icons/edit-delete.png + ../../icons/item-add.png + ../../icons/item.png + ../../icons/node-add.png + ../../icons/node.png + ../../icons/edit-copy.png + ../../icons/edit-paste.png + ../../icons/document-open_16.png + + diff --git a/qad/utils/qpiconfig.cpp b/qad/libs/utils/qpiconfig.cpp similarity index 100% rename from qad/utils/qpiconfig.cpp rename to qad/libs/utils/qpiconfig.cpp diff --git a/qad/utils/qpiconfig.h b/qad/libs/utils/qpiconfig.h similarity index 96% rename from qad/utils/qpiconfig.h rename to qad/libs/utils/qpiconfig.h index 66540a8..816a482 100644 --- a/qad/utils/qpiconfig.h +++ b/qad/libs/utils/qpiconfig.h @@ -20,33 +20,33 @@ #ifndef QPICONFIG_H #define QPICONFIG_H -#include "QFile" -#include "QVector" -#include "QStringList" -#include "QTextStream" +#include +#include +#include +#include #include #include #include #include #include -#include "qad_export.h" +#include "qad_utils_export.h" inline QByteArray QString2QByteArray(const QString & string) {return string.isEmpty() ? QByteArray() : qUncompress(QByteArray::fromBase64(string.toLatin1()));} -QAD_EXPORT int QString2int(const QString & string); +QAD_UTILS_EXPORT int QString2int(const QString & string); inline QColor QString2QColor(const QString & string) {return (string.left(1) == "#" ? QColor(string.right(string.length() - 1).toInt(0, 16)) : QColor(QString2int(string)));} -QAD_EXPORT QRect QString2QRect(const QString & string); -QAD_EXPORT QRectF QString2QRectF(const QString & string); -QAD_EXPORT QPoint QString2QPoint(const QString & string); -QAD_EXPORT QPointF QString2QPointF(const QString & string); +QAD_UTILS_EXPORT QRect QString2QRect(const QString & string); +QAD_UTILS_EXPORT QRectF QString2QRectF(const QString & string); +QAD_UTILS_EXPORT QPoint QString2QPoint(const QString & string); +QAD_UTILS_EXPORT QPointF QString2QPointF(const QString & string); inline QString QColor2QString(const QColor & color) {QString s = color.name(); return "0x" + QString::number(color.alpha(), 16).rightJustified(2, '0') + s.right(s.length() - 1);} inline QString QPoint2QString(const QPoint & point) {return QString::number(point.x()) + ";" + QString::number(point.y());} inline QString QPointF2QString(const QPointF & point) {return QString::number(point.x()) + ";" + QString::number(point.y());} inline QString QByteArray2QString(const QByteArray & array) {return array.isEmpty() ? QString() : QString(qCompress(array, 9).toBase64());} -QAD_EXPORT QString QRect2QString(const QRect & rect); -QAD_EXPORT QString QRectF2QString(const QRectF & rect); +QAD_UTILS_EXPORT QString QRect2QString(const QRect & rect); +QAD_UTILS_EXPORT QString QRectF2QString(const QRectF & rect); #define QPICONFIG_GET_VALUE \ Entry & getValue(const QString & vname, const char * def, bool * exist = 0) {return getValue(vname, QString(def), exist);} \ @@ -69,7 +69,7 @@ QAD_EXPORT QString QRectF2QString(const QRectF & rect); Entry & getValue(const QString & vname, const QPointF & def, bool * exist = 0) {return getValue(vname, QPointF2QString(def), exist);} \ Entry & getValue(const QString & vname, const QByteArray & def, bool * exist = 0) {return getValue(vname, QByteArray2QString(def), exist);} -class QAD_EXPORT QPIConfig: public QFile +class QAD_UTILS_EXPORT QPIConfig: public QFile { friend class Entry; friend class Branch; @@ -90,7 +90,7 @@ public: class Entry; - class QAD_EXPORT Branch: public QVector { + class QAD_UTILS_EXPORT Branch: public QVector { friend class QPIConfig; friend class Entry; public: @@ -116,7 +116,7 @@ public: }; - class QAD_EXPORT Entry { + class QAD_UTILS_EXPORT Entry { friend class QPIConfig; friend class Branch; friend class QPIConfigWidget; diff --git a/qad/utils/qpievaluator.cpp b/qad/libs/utils/qpievaluator.cpp similarity index 100% rename from qad/utils/qpievaluator.cpp rename to qad/libs/utils/qpievaluator.cpp diff --git a/qad/utils/qpievaluator.h b/qad/libs/utils/qpievaluator.h similarity index 97% rename from qad/utils/qpievaluator.h rename to qad/libs/utils/qpievaluator.h index 070a225..5a5ba11 100644 --- a/qad/utils/qpievaluator.h +++ b/qad/libs/utils/qpievaluator.h @@ -26,7 +26,7 @@ #include #include #include -#include "qad_export.h" +#include "qad_utils_export.h" #ifndef PIP_MATH_COMPLEX @@ -67,7 +67,7 @@ namespace QPIEvaluatorTypes { bfIm, bfRe, bfArg, bfLen, bfConj, bfRad, bfDeg}; - struct QAD_EXPORT Instruction { + struct QAD_UTILS_EXPORT Instruction { Instruction() {;} Instruction(Operation oper, QVector opers, int out_ind, int func = -1) { operation = oper; operators = opers; out = out_ind; function = func;} @@ -75,20 +75,20 @@ namespace QPIEvaluatorTypes { QVector operators; int out; int function;}; - struct QAD_EXPORT Element { + struct QAD_UTILS_EXPORT Element { Element() {;} Element(eType new_type, int new_num, int new_var_num = -1) {set(new_type, new_num, new_var_num);} void set(eType new_type, int new_num, int new_var_num = -1) {type = new_type; num = new_num; var_num = new_var_num;} eType type; int num; int var_num;}; - struct QAD_EXPORT Function { + struct QAD_UTILS_EXPORT Function { Function() {arguments = 0; type = bfUnknown;} Function(const QString & name, int args, BaseFunctions ftype) {identifier = name; arguments = args; type = ftype;} QString identifier; BaseFunctions type; int arguments;}; - struct QAD_EXPORT Variable { + struct QAD_UTILS_EXPORT Variable { Variable() {value = 0.;} Variable(const QString & var_name, complexd val) {name = var_name; value = val;} QString name; @@ -108,7 +108,7 @@ namespace QPIEvaluatorTypes { ⋀ & ⋁ | */ -class QAD_EXPORT QPIEvaluatorContent +class QAD_UTILS_EXPORT QPIEvaluatorContent { friend class QPIEvaluator; public: @@ -146,7 +146,7 @@ private: }; -class QAD_EXPORT QPIEvaluator +class QAD_UTILS_EXPORT QPIEvaluator { public: QPIEvaluator() {correct = false ;} diff --git a/qad/libs/widgets/CMakeLists.txt b/qad/libs/widgets/CMakeLists.txt new file mode 100644 index 0000000..cc21a27 --- /dev/null +++ b/qad/libs/widgets/CMakeLists.txt @@ -0,0 +1 @@ +qad_library(widgets "Gui;Widgets" "qad_utils") diff --git a/qad/widgets/chardialog.cpp b/qad/libs/widgets/chardialog.cpp similarity index 100% rename from qad/widgets/chardialog.cpp rename to qad/libs/widgets/chardialog.cpp diff --git a/qad/widgets/chardialog.h b/qad/libs/widgets/chardialog.h similarity index 95% rename from qad/widgets/chardialog.h rename to qad/libs/widgets/chardialog.h index 714372d..b9a28da 100644 --- a/qad/widgets/chardialog.h +++ b/qad/libs/widgets/chardialog.h @@ -23,7 +23,7 @@ #include #include #include -#include "qad_export.h" +#include "qad_widgets_export.h" namespace Ui { @@ -31,7 +31,7 @@ namespace Ui { } -class QAD_EXPORT CharDialog: public QDialog +class QAD_WIDGETS_EXPORT CharDialog: public QDialog { Q_OBJECT public: diff --git a/qad/widgets/chardialog.ui b/qad/libs/widgets/chardialog.ui similarity index 100% rename from qad/widgets/chardialog.ui rename to qad/libs/widgets/chardialog.ui diff --git a/qad/widgets/clineedit.cpp b/qad/libs/widgets/clineedit.cpp similarity index 100% rename from qad/widgets/clineedit.cpp rename to qad/libs/widgets/clineedit.cpp diff --git a/qad/widgets/clineedit.h b/qad/libs/widgets/clineedit.h similarity index 95% rename from qad/widgets/clineedit.h rename to qad/libs/widgets/clineedit.h index e0faa89..9424a74 100644 --- a/qad/widgets/clineedit.h +++ b/qad/libs/widgets/clineedit.h @@ -24,10 +24,10 @@ #include #include #include -#include "qad_export.h" +#include "qad_widgets_export.h" -class QAD_EXPORT CLineEdit: public QLineEdit +class QAD_WIDGETS_EXPORT CLineEdit: public QLineEdit { Q_OBJECT Q_PROPERTY(QString defaultText READ defaultText WRITE setDefaultText) diff --git a/qad/widgets/colorbutton.cpp b/qad/libs/widgets/colorbutton.cpp similarity index 100% rename from qad/widgets/colorbutton.cpp rename to qad/libs/widgets/colorbutton.cpp diff --git a/qad/widgets/colorbutton.h b/qad/libs/widgets/colorbutton.h similarity index 96% rename from qad/widgets/colorbutton.h rename to qad/libs/widgets/colorbutton.h index 1b73324..5987b06 100644 --- a/qad/widgets/colorbutton.h +++ b/qad/libs/widgets/colorbutton.h @@ -28,10 +28,10 @@ #include #include #include -#include "qad_export.h" +#include "qad_widgets_export.h" -class QAD_EXPORT ColorButton: public QPushButton +class QAD_WIDGETS_EXPORT ColorButton: public QPushButton { Q_OBJECT Q_PROPERTY(QColor color READ color WRITE setColor) diff --git a/qad/widgets/ecombobox.cpp b/qad/libs/widgets/ecombobox.cpp similarity index 100% rename from qad/widgets/ecombobox.cpp rename to qad/libs/widgets/ecombobox.cpp diff --git a/qad/widgets/ecombobox.h b/qad/libs/widgets/ecombobox.h similarity index 93% rename from qad/widgets/ecombobox.h rename to qad/libs/widgets/ecombobox.h index 7f5c6e6..4d1c88e 100644 --- a/qad/widgets/ecombobox.h +++ b/qad/libs/widgets/ecombobox.h @@ -25,9 +25,10 @@ #include #include #include "clineedit.h" +#include "qad_widgets_export.h" -class QAD_EXPORT EComboBox: public QComboBox +class QAD_WIDGETS_EXPORT EComboBox: public QComboBox { Q_OBJECT public: diff --git a/qad/widgets/evalspinbox.cpp b/qad/libs/widgets/evalspinbox.cpp similarity index 100% rename from qad/widgets/evalspinbox.cpp rename to qad/libs/widgets/evalspinbox.cpp diff --git a/qad/widgets/evalspinbox.h b/qad/libs/widgets/evalspinbox.h similarity index 96% rename from qad/widgets/evalspinbox.h rename to qad/libs/widgets/evalspinbox.h index 7b1de2f..81d98d0 100644 --- a/qad/widgets/evalspinbox.h +++ b/qad/libs/widgets/evalspinbox.h @@ -23,11 +23,12 @@ #include #include #include "qpievaluator.h" +#include "qad_widgets_export.h" class QLabel; -class QAD_EXPORT EvalSpinBox: public QAbstractSpinBox +class QAD_WIDGETS_EXPORT EvalSpinBox: public QAbstractSpinBox { Q_OBJECT Q_PROPERTY(double value READ value WRITE setValue NOTIFY valueChanged USER true) diff --git a/qad/widgets/iconedlabel.cpp b/qad/libs/widgets/iconedlabel.cpp similarity index 95% rename from qad/widgets/iconedlabel.cpp rename to qad/libs/widgets/iconedlabel.cpp index 5d690a1..40bc52d 100644 --- a/qad/widgets/iconedlabel.cpp +++ b/qad/libs/widgets/iconedlabel.cpp @@ -1,93 +1,93 @@ -#include "iconedlabel.h" -#include "qad_types.h" -#include -#include -#include - - -IconedLabel::IconedLabel(QWidget * parent): QFrame(parent) { - label_.setAlignment(Qt::AlignCenter); - icon_.setAlignment(Qt::AlignCenter); - icon_.setScaledContents(true); - icon_.setHidden(true); - setIconSize(QSize()); - setDirection(RightToLeft); -} - - -QString IconedLabel::text() const { - return label_.text(); -} - - -QIcon IconedLabel::icon() const { -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - return icon_.pixmap(Qt::ReturnByValue).isNull() ? QIcon() : QIcon(icon_.pixmap(Qt::ReturnByValue)); -#else - return icon_.pixmap() == 0 ? QIcon() : QIcon(*icon_.pixmap()); -#endif -} - - -bool IconedLabel::event(QEvent * e) { - if (e->type() == QEvent::FontChange || e->type() == QEvent::Polish) - setIconSize(iconSize()); - return QFrame::event(e); -} - - -void IconedLabel::checkSpacing() { - label_.setHidden(label_.text().isEmpty()); - if (!layout()) return; - if (label_.isHidden() || icon_.isHidden()) { - layout()->setSpacing(0); - } else { - QStyle * s = style(); - if (s) - layout()->setSpacing(s->layoutSpacing(QSizePolicy::Label, QSizePolicy::Label, - dir_ <= Direction::RightToLeft ? Qt::Horizontal : Qt::Vertical)); - } -} - - -QSize IconedLabel::realIconSize() const { - return size_.isValid() ? size_ : preferredIconSize(1.f, this); -} - - -void IconedLabel::setText(const QString & t) { - label_.setText(t); - checkSpacing(); -} - - -void IconedLabel::setIcon(const QIcon & i) { - sicon_ = i; - setIconSize(iconSize()); - icon_.setHidden(icon().isNull()); - checkSpacing(); -} - - -void IconedLabel::setIconSize(const QSize & s) { - size_ = s; - QSize sz = realIconSize(); - icon_.setPixmap(sicon_.pixmap(sz)); - icon_.setFixedSize(sz); -} - - -void IconedLabel::setDirection(IconedLabel::Direction d) { - dir_ = d; - if (layout() != 0) - delete layout(); - QLayout * lay = new QBoxLayout((QBoxLayout::Direction)dir_); - lay->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Expanding)); - lay->addWidget(&label_); - lay->addWidget(&icon_); - lay->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Expanding)); - lay->setContentsMargins(0, 0, 0, 0); - setLayout(lay); - checkSpacing(); - update(); -} +#include "iconedlabel.h" +#include "qad_types.h" +#include +#include +#include + + +IconedLabel::IconedLabel(QWidget * parent): QFrame(parent) { + label_.setAlignment(Qt::AlignCenter); + icon_.setAlignment(Qt::AlignCenter); + icon_.setScaledContents(true); + icon_.setHidden(true); + setIconSize(QSize()); + setDirection(RightToLeft); +} + + +QString IconedLabel::text() const { + return label_.text(); +} + + +QIcon IconedLabel::icon() const { +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + return icon_.pixmap(Qt::ReturnByValue).isNull() ? QIcon() : QIcon(icon_.pixmap(Qt::ReturnByValue)); +#else + return icon_.pixmap() == 0 ? QIcon() : QIcon(*icon_.pixmap()); +#endif +} + + +bool IconedLabel::event(QEvent * e) { + if (e->type() == QEvent::FontChange || e->type() == QEvent::Polish) + setIconSize(iconSize()); + return QFrame::event(e); +} + + +void IconedLabel::checkSpacing() { + label_.setHidden(label_.text().isEmpty()); + if (!layout()) return; + if (label_.isHidden() || icon_.isHidden()) { + layout()->setSpacing(0); + } else { + QStyle * s = style(); + if (s) + layout()->setSpacing(s->layoutSpacing(QSizePolicy::Label, QSizePolicy::Label, + dir_ <= Direction::RightToLeft ? Qt::Horizontal : Qt::Vertical)); + } +} + + +QSize IconedLabel::realIconSize() const { + return size_.isValid() ? size_ : preferredIconSize(1.f, this); +} + + +void IconedLabel::setText(const QString & t) { + label_.setText(t); + checkSpacing(); +} + + +void IconedLabel::setIcon(const QIcon & i) { + sicon_ = i; + setIconSize(iconSize()); + icon_.setHidden(icon().isNull()); + checkSpacing(); +} + + +void IconedLabel::setIconSize(const QSize & s) { + size_ = s; + QSize sz = realIconSize(); + icon_.setPixmap(sicon_.pixmap(sz)); + icon_.setFixedSize(sz); +} + + +void IconedLabel::setDirection(IconedLabel::Direction d) { + dir_ = d; + if (layout() != 0) + delete layout(); + QLayout * lay = new QBoxLayout((QBoxLayout::Direction)dir_); + lay->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Expanding)); + lay->addWidget(&label_); + lay->addWidget(&icon_); + lay->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Expanding)); + lay->setContentsMargins(0, 0, 0, 0); + setLayout(lay); + checkSpacing(); + update(); +} diff --git a/qad/widgets/iconedlabel.h b/qad/libs/widgets/iconedlabel.h similarity index 94% rename from qad/widgets/iconedlabel.h rename to qad/libs/widgets/iconedlabel.h index 01ad746..3572e66 100644 --- a/qad/widgets/iconedlabel.h +++ b/qad/libs/widgets/iconedlabel.h @@ -1,68 +1,69 @@ -/* - QAD - Qt ADvanced - - Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#ifndef ICONEDLABEL_H -#define ICONEDLABEL_H - -#include -#include -#include "qad_types.h" - - -class QAD_EXPORT IconedLabel: public QFrame -{ - Q_OBJECT - Q_ENUMS(Direction) - Q_PROPERTY(QString text READ text WRITE setText) - Q_PROPERTY(QIcon icon READ icon WRITE setIcon) - Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) - Q_PROPERTY(Direction direction READ direction WRITE setDirection) -public: - enum Direction {LeftToRight = 0, RightToLeft = 1, TopToBottom = 2, BottomToTop = 3}; - - explicit IconedLabel(QWidget * parent = 0); - - QString text() const; - QIcon icon() const; - QSize iconSize() const {return size_;} - Direction direction() const {return dir_;} - - QLabel * textLabel() {return &label_;} - -protected: - virtual bool event(QEvent * e); - void checkSpacing(); - QSize realIconSize() const; - - QLabel label_, icon_; - QIcon sicon_; - QSize size_; - Direction dir_; - -public slots: - void setText(const QString & t); - void setIcon(const QIcon & i); - void setIconSize(const QSize & s); - void setDirection(Direction d); - -signals: - -}; - -#endif // ICONEDLABEL_H +/* + QAD - Qt ADvanced + + Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +#ifndef ICONEDLABEL_H +#define ICONEDLABEL_H + +#include +#include +#include "qad_types.h" +#include "qad_widgets_export.h" + + +class QAD_WIDGETS_EXPORT IconedLabel: public QFrame +{ + Q_OBJECT + Q_ENUMS(Direction) + Q_PROPERTY(QString text READ text WRITE setText) + Q_PROPERTY(QIcon icon READ icon WRITE setIcon) + Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) + Q_PROPERTY(Direction direction READ direction WRITE setDirection) +public: + enum Direction {LeftToRight = 0, RightToLeft = 1, TopToBottom = 2, BottomToTop = 3}; + + explicit IconedLabel(QWidget * parent = 0); + + QString text() const; + QIcon icon() const; + QSize iconSize() const {return size_;} + Direction direction() const {return dir_;} + + QLabel * textLabel() {return &label_;} + +protected: + virtual bool event(QEvent * e); + void checkSpacing(); + QSize realIconSize() const; + + QLabel label_, icon_; + QIcon sicon_; + QSize size_; + Direction dir_; + +public slots: + void setText(const QString & t); + void setIcon(const QIcon & i); + void setIconSize(const QSize & s); + void setDirection(Direction d); + +signals: + +}; + +#endif // ICONEDLABEL_H diff --git a/qad/widgets/image_view.cpp b/qad/libs/widgets/image_view.cpp similarity index 95% rename from qad/widgets/image_view.cpp rename to qad/libs/widgets/image_view.cpp index 516dc22..d1a4539 100644 --- a/qad/widgets/image_view.cpp +++ b/qad/libs/widgets/image_view.cpp @@ -1,145 +1,145 @@ -#include "image_view.h" -#include -#include -#include -#include -#include -#include -#include - - -ImageView::ImageView(QWidget * parent): QGraphicsView(parent) { - setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setDragMode(QGraphicsView::NoDrag); - setTransformationAnchor(QGraphicsView::AnchorUnderMouse); - setScene(new QGraphicsScene()); - setRenderHint(QPainter::Antialiasing, true); - setRenderHint(QPainter::SmoothPixmapTransform, true); - item.setTransformationMode(Qt::SmoothTransformation); - item.setFlags(QGraphicsItem::GraphicsItemFlags()); - scene()->addItem(&item); - viewport()->setAutoFillBackground(false); - viewport()->installEventFilter(this); - autofit_ = true; -} - - -ImageView::~ImageView() { -} - - -QPixmap ImageView::pixmap() const { - return map; -} - - -void ImageView::setPixmap(QPixmap pixmap) { - map = pixmap; - adjustView(); -} - - -void ImageView::setImage(const QImage & i) { - im_data.clear(); - if (i.isNull()) { - item.setPixmap(QPixmap()); - map = QPixmap(); - return; - } - QBuffer b(&im_data); b.open(QIODevice::ReadWrite); - i.save(&b, "png"); - b.close(); - map = QPixmap::fromImage(i); - adjustView(); -} - - -void ImageView::setImage(const QByteArray & i) { - im_data = i; - if (i.isEmpty()) { - item.setPixmap(QPixmap()); - map = QPixmap(); - return; - } - map = QPixmap::fromImage(QImage::fromData(i)); - adjustView(); -} - - -void ImageView::clear() { - im_data.clear(); - item.setPixmap(QPixmap()); - map = QPixmap(); -} - - -void ImageView::mouseDoubleClickEvent(QMouseEvent * e) { - autofit(); -} - - -void ImageView::mousePressEvent(QMouseEvent * e) { - QGraphicsView::mousePressEvent(e); - emit clicked(mapToScene(e->pos()), e->buttons()); -} - - -void ImageView::mouseMoveEvent(QMouseEvent * e) { - //if (e->buttons().testFlag(Qt::RightButton) && !autofit_ && isInteractive()) return;; - QGraphicsView::mouseMoveEvent(e); -} - - -//void ImageView::wheelEvent(QWheelEvent * e) { -// if (!e->modifiers().testFlag(Qt::ControlModifier) || !isInteractive()) return; -// double scl = 1. + e->delta() / 500.; -// //autofit_ = false; -// //scale(scl, scl); -//} - - -bool ImageView::eventFilter(QObject * o, QEvent * e) { - QMouseEvent * me = (QMouseEvent *)e; - switch (e->type()) { - case QEvent::Resize: - adjustView(); - break; - case QEvent::MouseButtonPress: - prev_pos = me->pos(); - break; - case QEvent::MouseMove: - if (!me->buttons().testFlag(Qt::RightButton) || autofit_ || !isInteractive()) break; - { - //double scl = 1. / qSqrt(transform().determinant()); - //QPointF dp = QPointF(me->pos() - prev_pos) * scl; - //qDebug() << dp; - //translate(0.00001, 0); - prev_pos = me->pos(); - } - break; - default: break; - } - return QGraphicsView::eventFilter(o, e); -} - - -void ImageView::adjustView() { - qreal mp = map.width() / map.size().boundedTo(size()).width(); - if (mp > 1) { - item.setPixmap(map.scaled(map.size()/mp, Qt::KeepAspectRatio, Qt::SmoothTransformation)); - } else { - item.setPixmap(map); - } - if (!autofit_) return; - setSceneRect(item.boundingRect()); - fitInView(&item, Qt::KeepAspectRatio); - centerOn(&item); - -} - - -void ImageView::autofit() { - autofit_ = true; - adjustView(); -} +#include "image_view.h" +#include +#include +#include +#include +#include +#include +#include + + +ImageView::ImageView(QWidget * parent): QGraphicsView(parent) { + setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + setDragMode(QGraphicsView::NoDrag); + setTransformationAnchor(QGraphicsView::AnchorUnderMouse); + setScene(new QGraphicsScene()); + setRenderHint(QPainter::Antialiasing, true); + setRenderHint(QPainter::SmoothPixmapTransform, true); + item.setTransformationMode(Qt::SmoothTransformation); + item.setFlags(QGraphicsItem::GraphicsItemFlags()); + scene()->addItem(&item); + viewport()->setAutoFillBackground(false); + viewport()->installEventFilter(this); + autofit_ = true; +} + + +ImageView::~ImageView() { +} + + +QPixmap ImageView::pixmap() const { + return map; +} + + +void ImageView::setPixmap(QPixmap pixmap) { + map = pixmap; + adjustView(); +} + + +void ImageView::setImage(const QImage & i) { + im_data.clear(); + if (i.isNull()) { + item.setPixmap(QPixmap()); + map = QPixmap(); + return; + } + QBuffer b(&im_data); b.open(QIODevice::ReadWrite); + i.save(&b, "png"); + b.close(); + map = QPixmap::fromImage(i); + adjustView(); +} + + +void ImageView::setImage(const QByteArray & i) { + im_data = i; + if (i.isEmpty()) { + item.setPixmap(QPixmap()); + map = QPixmap(); + return; + } + map = QPixmap::fromImage(QImage::fromData(i)); + adjustView(); +} + + +void ImageView::clear() { + im_data.clear(); + item.setPixmap(QPixmap()); + map = QPixmap(); +} + + +void ImageView::mouseDoubleClickEvent(QMouseEvent * e) { + autofit(); +} + + +void ImageView::mousePressEvent(QMouseEvent * e) { + QGraphicsView::mousePressEvent(e); + emit clicked(mapToScene(e->pos()), e->buttons()); +} + + +void ImageView::mouseMoveEvent(QMouseEvent * e) { + //if (e->buttons().testFlag(Qt::RightButton) && !autofit_ && isInteractive()) return;; + QGraphicsView::mouseMoveEvent(e); +} + + +//void ImageView::wheelEvent(QWheelEvent * e) { +// if (!e->modifiers().testFlag(Qt::ControlModifier) || !isInteractive()) return; +// double scl = 1. + e->delta() / 500.; +// //autofit_ = false; +// //scale(scl, scl); +//} + + +bool ImageView::eventFilter(QObject * o, QEvent * e) { + QMouseEvent * me = (QMouseEvent *)e; + switch (e->type()) { + case QEvent::Resize: + adjustView(); + break; + case QEvent::MouseButtonPress: + prev_pos = me->pos(); + break; + case QEvent::MouseMove: + if (!me->buttons().testFlag(Qt::RightButton) || autofit_ || !isInteractive()) break; + { + //double scl = 1. / qSqrt(transform().determinant()); + //QPointF dp = QPointF(me->pos() - prev_pos) * scl; + //qDebug() << dp; + //translate(0.00001, 0); + prev_pos = me->pos(); + } + break; + default: break; + } + return QGraphicsView::eventFilter(o, e); +} + + +void ImageView::adjustView() { + qreal mp = map.width() / map.size().boundedTo(size()).width(); + if (mp > 1) { + item.setPixmap(map.scaled(map.size()/mp, Qt::KeepAspectRatio, Qt::SmoothTransformation)); + } else { + item.setPixmap(map); + } + if (!autofit_) return; + setSceneRect(item.boundingRect()); + fitInView(&item, Qt::KeepAspectRatio); + centerOn(&item); + +} + + +void ImageView::autofit() { + autofit_ = true; + adjustView(); +} diff --git a/qad/widgets/image_view.h b/qad/libs/widgets/image_view.h similarity index 91% rename from qad/widgets/image_view.h rename to qad/libs/widgets/image_view.h index dbed10d..5598a1b 100644 --- a/qad/widgets/image_view.h +++ b/qad/libs/widgets/image_view.h @@ -1,67 +1,67 @@ -/* - QAD - Qt ADvanced - - Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#ifndef IMAGE_VIEW_H -#define IMAGE_VIEW_H - -#include -#include -#include "qad_export.h" - - -class QAD_EXPORT ImageView: public QGraphicsView -{ - Q_OBJECT - Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap) -public: - ImageView(QWidget * parent = 0); - ~ImageView(); - - void setImage(const QImage & i); - void setImage(const QByteArray & i); - QByteArray image() const {return im_data;} - QPixmap pixmap() const; - - void clear(); - -private: - void mouseDoubleClickEvent(QMouseEvent * e); - void mousePressEvent(QMouseEvent * e); - void mouseMoveEvent(QMouseEvent * e); -// void wheelEvent(QWheelEvent * e); - bool eventFilter(QObject * o, QEvent * e); - void adjustView(); - - QGraphicsPixmapItem item; - QByteArray im_data; - QPoint prev_pos; - bool autofit_; - QPixmap map; - - -public slots: - void autofit(); - void setPixmap(QPixmap pixmap); - -signals: - void clicked(QPointF, Qt::MouseButtons); - -}; - -#endif // IMAGE_VIEW_H +/* + QAD - Qt ADvanced + + Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +#ifndef IMAGE_VIEW_H +#define IMAGE_VIEW_H + +#include +#include +#include "qad_widgets_export.h" + + +class QAD_WIDGETS_EXPORT ImageView: public QGraphicsView +{ + Q_OBJECT + Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap) +public: + ImageView(QWidget * parent = 0); + ~ImageView(); + + void setImage(const QImage & i); + void setImage(const QByteArray & i); + QByteArray image() const {return im_data;} + QPixmap pixmap() const; + + void clear(); + +private: + void mouseDoubleClickEvent(QMouseEvent * e); + void mousePressEvent(QMouseEvent * e); + void mouseMoveEvent(QMouseEvent * e); +// void wheelEvent(QWheelEvent * e); + bool eventFilter(QObject * o, QEvent * e); + void adjustView(); + + QGraphicsPixmapItem item; + QByteArray im_data; + QPoint prev_pos; + bool autofit_; + QPixmap map; + + +public slots: + void autofit(); + void setPixmap(QPixmap pixmap); + +signals: + void clicked(QPointF, Qt::MouseButtons); + +}; + +#endif // IMAGE_VIEW_H diff --git a/qad/widgets/lang/qad_widgets_en.ts b/qad/libs/widgets/lang/qad_widgets_en.ts similarity index 100% rename from qad/widgets/lang/qad_widgets_en.ts rename to qad/libs/widgets/lang/qad_widgets_en.ts diff --git a/qad/widgets/lang/qad_widgets_ru.ts b/qad/libs/widgets/lang/qad_widgets_ru.ts similarity index 100% rename from qad/widgets/lang/qad_widgets_ru.ts rename to qad/libs/widgets/lang/qad_widgets_ru.ts diff --git a/qad/widgets/lang/update.bat b/qad/libs/widgets/lang/update.bat similarity index 100% rename from qad/widgets/lang/update.bat rename to qad/libs/widgets/lang/update.bat diff --git a/qad/widgets/mathmatrixedit.cpp b/qad/libs/widgets/mathmatrixedit.cpp similarity index 100% rename from qad/widgets/mathmatrixedit.cpp rename to qad/libs/widgets/mathmatrixedit.cpp diff --git a/qad/widgets/mathmatrixedit.h b/qad/libs/widgets/mathmatrixedit.h similarity index 90% rename from qad/widgets/mathmatrixedit.h rename to qad/libs/widgets/mathmatrixedit.h index c465573..f01cff4 100644 --- a/qad/widgets/mathmatrixedit.h +++ b/qad/libs/widgets/mathmatrixedit.h @@ -22,12 +22,13 @@ #include #include "qad_types.h" +#include "qad_widgets_export.h" class MatrixEdit; -class QAD_EXPORT MathMatrixEdit: public QWidget { +class QAD_WIDGETS_EXPORT MathMatrixEdit: public QWidget { Q_OBJECT Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged) Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) @@ -51,7 +52,7 @@ signals: }; -class __MathMatrixEditRegistrator__ { +class QAD_WIDGETS_EXPORT __MathMatrixEditRegistrator__ { public: __MathMatrixEditRegistrator__(); }; diff --git a/qad/widgets/mathvectoredit.cpp b/qad/libs/widgets/mathvectoredit.cpp similarity index 100% rename from qad/widgets/mathvectoredit.cpp rename to qad/libs/widgets/mathvectoredit.cpp diff --git a/qad/widgets/mathvectoredit.h b/qad/libs/widgets/mathvectoredit.h similarity index 90% rename from qad/widgets/mathvectoredit.h rename to qad/libs/widgets/mathvectoredit.h index ca965f2..3997b31 100644 --- a/qad/widgets/mathvectoredit.h +++ b/qad/libs/widgets/mathvectoredit.h @@ -22,12 +22,13 @@ #include #include "qad_types.h" +#include "qad_widgets_export.h" class MatrixEdit; -class QAD_EXPORT MathVectorEdit: public QWidget { +class QAD_WIDGETS_EXPORT MathVectorEdit: public QWidget { Q_OBJECT Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged) Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) @@ -51,7 +52,7 @@ signals: }; -class __MathVectorEditRegistrator__ { +class QAD_WIDGETS_EXPORT __MathVectorEditRegistrator__ { public: __MathVectorEditRegistrator__(); }; diff --git a/qad/widgets/matrixedit.cpp b/qad/libs/widgets/matrixedit.cpp similarity index 100% rename from qad/widgets/matrixedit.cpp rename to qad/libs/widgets/matrixedit.cpp diff --git a/qad/widgets/matrixedit.h b/qad/libs/widgets/matrixedit.h similarity index 94% rename from qad/widgets/matrixedit.h rename to qad/libs/widgets/matrixedit.h index 53af595..7558a9b 100644 --- a/qad/widgets/matrixedit.h +++ b/qad/libs/widgets/matrixedit.h @@ -21,7 +21,7 @@ #define MATRIXEDIT_H #include -#include "qad_export.h" +#include "qad_widgets_export.h" namespace Ui { @@ -29,7 +29,7 @@ namespace Ui { } -class QAD_EXPORT MatrixEdit: public QWidget { +class QAD_WIDGETS_EXPORT MatrixEdit: public QWidget { Q_OBJECT public: explicit MatrixEdit(QWidget * parent = 0); diff --git a/qad/widgets/matrixedit.ui b/qad/libs/widgets/matrixedit.ui similarity index 100% rename from qad/widgets/matrixedit.ui rename to qad/libs/widgets/matrixedit.ui diff --git a/qad/widgets/plugin/CMakeLists.txt b/qad/libs/widgets/plugin/CMakeLists.txt similarity index 97% rename from qad/widgets/plugin/CMakeLists.txt rename to qad/libs/widgets/plugin/CMakeLists.txt index 74db060..bd64a4d 100644 --- a/qad/widgets/plugin/CMakeLists.txt +++ b/qad/libs/widgets/plugin/CMakeLists.txt @@ -1 +1 @@ -qad_plugin(widgets "Gui;Widgets" "") +qad_plugin(widgets "Gui;Widgets" "") diff --git a/qad/widgets/plugin/chardialogplugin.cpp b/qad/libs/widgets/plugin/chardialogplugin.cpp similarity index 100% rename from qad/widgets/plugin/chardialogplugin.cpp rename to qad/libs/widgets/plugin/chardialogplugin.cpp diff --git a/qad/widgets/plugin/chardialogplugin.h b/qad/libs/widgets/plugin/chardialogplugin.h similarity index 100% rename from qad/widgets/plugin/chardialogplugin.h rename to qad/libs/widgets/plugin/chardialogplugin.h diff --git a/qad/widgets/plugin/clineeditplugin.cpp b/qad/libs/widgets/plugin/clineeditplugin.cpp similarity index 100% rename from qad/widgets/plugin/clineeditplugin.cpp rename to qad/libs/widgets/plugin/clineeditplugin.cpp diff --git a/qad/widgets/plugin/clineeditplugin.h b/qad/libs/widgets/plugin/clineeditplugin.h similarity index 100% rename from qad/widgets/plugin/clineeditplugin.h rename to qad/libs/widgets/plugin/clineeditplugin.h diff --git a/qad/widgets/plugin/colorbuttonplugin.cpp b/qad/libs/widgets/plugin/colorbuttonplugin.cpp similarity index 100% rename from qad/widgets/plugin/colorbuttonplugin.cpp rename to qad/libs/widgets/plugin/colorbuttonplugin.cpp diff --git a/qad/widgets/plugin/colorbuttonplugin.h b/qad/libs/widgets/plugin/colorbuttonplugin.h similarity index 100% rename from qad/widgets/plugin/colorbuttonplugin.h rename to qad/libs/widgets/plugin/colorbuttonplugin.h diff --git a/qad/widgets/plugin/ecomboboxplugin.cpp b/qad/libs/widgets/plugin/ecomboboxplugin.cpp similarity index 100% rename from qad/widgets/plugin/ecomboboxplugin.cpp rename to qad/libs/widgets/plugin/ecomboboxplugin.cpp diff --git a/qad/widgets/plugin/ecomboboxplugin.h b/qad/libs/widgets/plugin/ecomboboxplugin.h similarity index 100% rename from qad/widgets/plugin/ecomboboxplugin.h rename to qad/libs/widgets/plugin/ecomboboxplugin.h diff --git a/qad/widgets/plugin/evalspinboxplugin.cpp b/qad/libs/widgets/plugin/evalspinboxplugin.cpp similarity index 100% rename from qad/widgets/plugin/evalspinboxplugin.cpp rename to qad/libs/widgets/plugin/evalspinboxplugin.cpp diff --git a/qad/widgets/plugin/evalspinboxplugin.h b/qad/libs/widgets/plugin/evalspinboxplugin.h similarity index 100% rename from qad/widgets/plugin/evalspinboxplugin.h rename to qad/libs/widgets/plugin/evalspinboxplugin.h diff --git a/qad/widgets/plugin/iconedlabelplugin.h b/qad/libs/widgets/plugin/iconedlabelplugin.h similarity index 100% rename from qad/widgets/plugin/iconedlabelplugin.h rename to qad/libs/widgets/plugin/iconedlabelplugin.h diff --git a/qad/widgets/plugin/imageviewplugin.cpp b/qad/libs/widgets/plugin/imageviewplugin.cpp similarity index 100% rename from qad/widgets/plugin/imageviewplugin.cpp rename to qad/libs/widgets/plugin/imageviewplugin.cpp diff --git a/qad/widgets/plugin/imageviewplugin.h b/qad/libs/widgets/plugin/imageviewplugin.h similarity index 100% rename from qad/widgets/plugin/imageviewplugin.h rename to qad/libs/widgets/plugin/imageviewplugin.h diff --git a/qad/widgets/plugin/lconedlabelplugin.cpp b/qad/libs/widgets/plugin/lconedlabelplugin.cpp similarity index 100% rename from qad/widgets/plugin/lconedlabelplugin.cpp rename to qad/libs/widgets/plugin/lconedlabelplugin.cpp diff --git a/qad/widgets/plugin/qad_widgets.cpp b/qad/libs/widgets/plugin/qad_widgets.cpp similarity index 100% rename from qad/widgets/plugin/qad_widgets.cpp rename to qad/libs/widgets/plugin/qad_widgets.cpp diff --git a/qad/widgets/plugin/qad_widgets.h b/qad/libs/widgets/plugin/qad_widgets.h similarity index 100% rename from qad/widgets/plugin/qad_widgets.h rename to qad/libs/widgets/plugin/qad_widgets.h diff --git a/qad/widgets/plugin/qcodeeditplugin.cpp b/qad/libs/widgets/plugin/qcodeeditplugin.cpp similarity index 100% rename from qad/widgets/plugin/qcodeeditplugin.cpp rename to qad/libs/widgets/plugin/qcodeeditplugin.cpp diff --git a/qad/widgets/plugin/qcodeeditplugin.h b/qad/libs/widgets/plugin/qcodeeditplugin.h similarity index 100% rename from qad/widgets/plugin/qcodeeditplugin.h rename to qad/libs/widgets/plugin/qcodeeditplugin.h diff --git a/qad/widgets/plugin/qipeditplugin.cpp b/qad/libs/widgets/plugin/qipeditplugin.cpp similarity index 100% rename from qad/widgets/plugin/qipeditplugin.cpp rename to qad/libs/widgets/plugin/qipeditplugin.cpp diff --git a/qad/widgets/plugin/qipeditplugin.h b/qad/libs/widgets/plugin/qipeditplugin.h similarity index 100% rename from qad/widgets/plugin/qipeditplugin.h rename to qad/libs/widgets/plugin/qipeditplugin.h diff --git a/qad/widgets/plugin/qpiconfigplugin.cpp b/qad/libs/widgets/plugin/qpiconfigplugin.cpp similarity index 100% rename from qad/widgets/plugin/qpiconfigplugin.cpp rename to qad/libs/widgets/plugin/qpiconfigplugin.cpp diff --git a/qad/widgets/plugin/qpiconfigplugin.h b/qad/libs/widgets/plugin/qpiconfigplugin.h similarity index 100% rename from qad/widgets/plugin/qpiconfigplugin.h rename to qad/libs/widgets/plugin/qpiconfigplugin.h diff --git a/qad/widgets/plugin/qpiconsoleplugin.cpp b/qad/libs/widgets/plugin/qpiconsoleplugin.cpp similarity index 100% rename from qad/widgets/plugin/qpiconsoleplugin.cpp rename to qad/libs/widgets/plugin/qpiconsoleplugin.cpp diff --git a/qad/widgets/plugin/qpiconsoleplugin.h b/qad/libs/widgets/plugin/qpiconsoleplugin.h similarity index 100% rename from qad/widgets/plugin/qpiconsoleplugin.h rename to qad/libs/widgets/plugin/qpiconsoleplugin.h diff --git a/qad/widgets/plugin/qpointeditplugin.cpp b/qad/libs/widgets/plugin/qpointeditplugin.cpp similarity index 100% rename from qad/widgets/plugin/qpointeditplugin.cpp rename to qad/libs/widgets/plugin/qpointeditplugin.cpp diff --git a/qad/widgets/plugin/qpointeditplugin.h b/qad/libs/widgets/plugin/qpointeditplugin.h similarity index 100% rename from qad/widgets/plugin/qpointeditplugin.h rename to qad/libs/widgets/plugin/qpointeditplugin.h diff --git a/qad/widgets/plugin/qrecteditplugin.cpp b/qad/libs/widgets/plugin/qrecteditplugin.cpp similarity index 100% rename from qad/widgets/plugin/qrecteditplugin.cpp rename to qad/libs/widgets/plugin/qrecteditplugin.cpp diff --git a/qad/widgets/plugin/qrecteditplugin.h b/qad/libs/widgets/plugin/qrecteditplugin.h similarity index 100% rename from qad/widgets/plugin/qrecteditplugin.h rename to qad/libs/widgets/plugin/qrecteditplugin.h diff --git a/qad/widgets/plugin/qvarianteditplugin.cpp b/qad/libs/widgets/plugin/qvarianteditplugin.cpp similarity index 100% rename from qad/widgets/plugin/qvarianteditplugin.cpp rename to qad/libs/widgets/plugin/qvarianteditplugin.cpp diff --git a/qad/widgets/plugin/qvarianteditplugin.h b/qad/libs/widgets/plugin/qvarianteditplugin.h similarity index 100% rename from qad/widgets/plugin/qvarianteditplugin.h rename to qad/libs/widgets/plugin/qvarianteditplugin.h diff --git a/qad/widgets/plugin/scroll_spin_boxplugin.cpp b/qad/libs/widgets/plugin/scroll_spin_boxplugin.cpp similarity index 100% rename from qad/widgets/plugin/scroll_spin_boxplugin.cpp rename to qad/libs/widgets/plugin/scroll_spin_boxplugin.cpp diff --git a/qad/widgets/plugin/scroll_spin_boxplugin.h b/qad/libs/widgets/plugin/scroll_spin_boxplugin.h similarity index 100% rename from qad/widgets/plugin/scroll_spin_boxplugin.h rename to qad/libs/widgets/plugin/scroll_spin_boxplugin.h diff --git a/qad/widgets/plugin/shortcutsplugin.cpp b/qad/libs/widgets/plugin/shortcutsplugin.cpp similarity index 100% rename from qad/widgets/plugin/shortcutsplugin.cpp rename to qad/libs/widgets/plugin/shortcutsplugin.cpp diff --git a/qad/widgets/plugin/shortcutsplugin.h b/qad/libs/widgets/plugin/shortcutsplugin.h similarity index 100% rename from qad/widgets/plugin/shortcutsplugin.h rename to qad/libs/widgets/plugin/shortcutsplugin.h diff --git a/qad/widgets/plugin/spinsliderplugin.cpp b/qad/libs/widgets/plugin/spinsliderplugin.cpp similarity index 100% rename from qad/widgets/plugin/spinsliderplugin.cpp rename to qad/libs/widgets/plugin/spinsliderplugin.cpp diff --git a/qad/widgets/plugin/spinsliderplugin.h b/qad/libs/widgets/plugin/spinsliderplugin.h similarity index 100% rename from qad/widgets/plugin/spinsliderplugin.h rename to qad/libs/widgets/plugin/spinsliderplugin.h diff --git a/qad/widgets/propertystorage_editor.cpp b/qad/libs/widgets/propertystorage_editor.cpp similarity index 100% rename from qad/widgets/propertystorage_editor.cpp rename to qad/libs/widgets/propertystorage_editor.cpp diff --git a/qad/widgets/propertystorage_editor.h b/qad/libs/widgets/propertystorage_editor.h similarity index 92% rename from qad/widgets/propertystorage_editor.h rename to qad/libs/widgets/propertystorage_editor.h index fde0be0..76a79e1 100644 --- a/qad/widgets/propertystorage_editor.h +++ b/qad/libs/widgets/propertystorage_editor.h @@ -22,9 +22,10 @@ #include #include "propertystorage.h" +#include "qad_widgets_export.h" -class QAD_EXPORT PropertyStorageEditor: public QWidget { +class QAD_WIDGETS_EXPORT PropertyStorageEditor: public QWidget { Q_OBJECT public: explicit PropertyStorageEditor(QWidget * parent = 0); diff --git a/qad/libs/widgets/qad_widgets.qrc b/qad/libs/widgets/qad_widgets.qrc new file mode 100644 index 0000000..50d5263 --- /dev/null +++ b/qad/libs/widgets/qad_widgets.qrc @@ -0,0 +1,46 @@ + + + ../../icons/go-next.png + ../../icons/go-previous.png + ../../icons/dialog-close.png + ../../icons/edit-clear.png + ../../icons/edit-guides.png + ../../icons/view-grid.png + ../../icons/zoom-fit-best.png + ../../icons/configure.png + ../../icons/alpha.png + ../../icons/document-save.png + ../../icons/edit-clear-locationbar-rtl.png + ../../icons/edit-find.png + ../../icons/list-add.png + ../../icons/edit-delete.png + ../../icons/item-add.png + ../../icons/item.png + ../../icons/node-add.png + ../../icons/node.png + ../../icons/edit-copy.png + ../../icons/edit-paste.png + ../../icons/expand_s_x.png + ../../icons/expand_s_y.png + ../../icons/expand_x.png + ../../icons/expand_y.png + ../../icons/border-line.png + ../../icons/legend.png + ../../icons/chardialog.png + ../../icons/clineedit.png + ../../icons/colorbutton.png + ../../icons/ecombobox.png + ../../icons/qpiconsole.png + ../../icons/spinslider.png + ../../icons/etabwidget.png + ../../icons/qcodeedit.png + ../../icons/qvariantedit.png + ../../icons/code-word.png + ../../icons/f1.png + ../../icons/dialog-ok-apply.png + ../../icons/dialog-warning.png + ../../icons/tools-wizard.png + ../../icons/evalspinbox.png + ../../icons/scroll_spin.png + + diff --git a/qad/widgets/qcodeedit.cpp b/qad/libs/widgets/qcodeedit.cpp similarity index 100% rename from qad/widgets/qcodeedit.cpp rename to qad/libs/widgets/qcodeedit.cpp diff --git a/qad/widgets/qcodeedit.h b/qad/libs/widgets/qcodeedit.h similarity index 97% rename from qad/widgets/qcodeedit.h rename to qad/libs/widgets/qcodeedit.h index 6b437c3..63059a1 100644 --- a/qad/widgets/qcodeedit.h +++ b/qad/libs/widgets/qcodeedit.h @@ -24,6 +24,7 @@ #include #include #include "iconedlabel.h" +#include "qad_widgets_export.h" namespace Ui { @@ -31,7 +32,7 @@ namespace Ui { } -class QAD_EXPORT QCodeEdit: public QWidget +class QAD_WIDGETS_EXPORT QCodeEdit: public QWidget { Q_OBJECT Q_PROPERTY(QString text READ text WRITE setText) @@ -93,7 +94,7 @@ protected: Ui::QCodeEdit * ui; private: - struct ACClass { + struct QAD_WIDGETS_EXPORT ACClass { ACClass(int i = -2, ACClassType c = QCodeEdit::Keyword, const QString & n = QString(), const QIcon & ic = QIcon()): id(i), class_(c), name(n), icon(ic) {} int id; ACClassType class_; diff --git a/qad/widgets/qcodeedit.ui b/qad/libs/widgets/qcodeedit.ui similarity index 100% rename from qad/widgets/qcodeedit.ui rename to qad/libs/widgets/qcodeedit.ui diff --git a/qad/widgets/qipedit.cpp b/qad/libs/widgets/qipedit.cpp similarity index 100% rename from qad/widgets/qipedit.cpp rename to qad/libs/widgets/qipedit.cpp diff --git a/qad/widgets/qipedit.h b/qad/libs/widgets/qipedit.h similarity index 95% rename from qad/widgets/qipedit.h rename to qad/libs/widgets/qipedit.h index c1d72f2..2396e86 100644 --- a/qad/widgets/qipedit.h +++ b/qad/libs/widgets/qipedit.h @@ -26,10 +26,10 @@ #include #include #include -#include "qad_export.h" +#include "qad_widgets_export.h" -class QAD_EXPORT QIPEdit: public QWidget +class QAD_WIDGETS_EXPORT QIPEdit: public QWidget { Q_OBJECT Q_PROPERTY(QString IP READ IP WRITE setIP) diff --git a/qad/widgets/qpiconfignewdialog.cpp b/qad/libs/widgets/qpiconfignewdialog.cpp similarity index 100% rename from qad/widgets/qpiconfignewdialog.cpp rename to qad/libs/widgets/qpiconfignewdialog.cpp diff --git a/qad/widgets/qpiconfignewdialog.h b/qad/libs/widgets/qpiconfignewdialog.h similarity index 93% rename from qad/widgets/qpiconfignewdialog.h rename to qad/libs/widgets/qpiconfignewdialog.h index 2730507..2553c85 100644 --- a/qad/widgets/qpiconfignewdialog.h +++ b/qad/libs/widgets/qpiconfignewdialog.h @@ -22,7 +22,7 @@ #include #include -#include "qad_export.h" +#include "qad_widgets_export.h" namespace Ui { @@ -30,7 +30,7 @@ namespace Ui { } -class QAD_EXPORT QPIConfigNewDialog: public QDialog +class QAD_WIDGETS_EXPORT QPIConfigNewDialog: public QDialog { Q_OBJECT diff --git a/qad/widgets/qpiconfignewdialog.ui b/qad/libs/widgets/qpiconfignewdialog.ui similarity index 100% rename from qad/widgets/qpiconfignewdialog.ui rename to qad/libs/widgets/qpiconfignewdialog.ui diff --git a/qad/widgets/qpiconfigvaluewidget.cpp b/qad/libs/widgets/qpiconfigvaluewidget.cpp similarity index 100% rename from qad/widgets/qpiconfigvaluewidget.cpp rename to qad/libs/widgets/qpiconfigvaluewidget.cpp diff --git a/qad/widgets/qpiconfigvaluewidget.h b/qad/libs/widgets/qpiconfigvaluewidget.h similarity index 95% rename from qad/widgets/qpiconfigvaluewidget.h rename to qad/libs/widgets/qpiconfigvaluewidget.h index e71e512..6ddadbe 100644 --- a/qad/widgets/qpiconfigvaluewidget.h +++ b/qad/libs/widgets/qpiconfigvaluewidget.h @@ -20,6 +20,10 @@ #ifndef QPICONFIGVALUEWIDGET_H #define QPICONFIGVALUEWIDGET_H +#include +#include +#include +#include #include "qpiconfig.h" #include "qvariantedit.h" #include "qrectedit.h" @@ -29,13 +33,10 @@ #include "qipedit.h" #include "limits.h" #include "float.h" -#include -#include -#include -#include +#include "qad_widgets_export.h" -class QAD_EXPORT ConfigValueWidget: public QWidget +class QAD_WIDGETS_EXPORT ConfigValueWidget: public QWidget { Q_OBJECT friend class QPIConfigWidget; diff --git a/qad/widgets/qpiconfigwidget.cpp b/qad/libs/widgets/qpiconfigwidget.cpp similarity index 100% rename from qad/widgets/qpiconfigwidget.cpp rename to qad/libs/widgets/qpiconfigwidget.cpp diff --git a/qad/widgets/qpiconfigwidget.h b/qad/libs/widgets/qpiconfigwidget.h similarity index 97% rename from qad/widgets/qpiconfigwidget.h rename to qad/libs/widgets/qpiconfigwidget.h index 464cf70..4929ba1 100644 --- a/qad/widgets/qpiconfigwidget.h +++ b/qad/libs/widgets/qpiconfigwidget.h @@ -20,18 +20,19 @@ #ifndef QPICONFIGWIDGET_H #define QPICONFIGWIDGET_H -#include "qpiconfig.h" -#include "qpiconfignewdialog.h" -#include "qpiconfigvaluewidget.h" #include #include #include #include #include #include +#include "qpiconfig.h" +#include "qpiconfignewdialog.h" +#include "qpiconfigvaluewidget.h" +#include "qad_widgets_export.h" -class QAD_EXPORT UComboBox: public QComboBox +class QAD_WIDGETS_EXPORT UComboBox: public QComboBox { Q_OBJECT public: @@ -43,7 +44,7 @@ signals: }; -class QAD_EXPORT QPIConfigWidget: public QTreeWidget +class QAD_WIDGETS_EXPORT QPIConfigWidget: public QTreeWidget { Q_OBJECT Q_PROPERTY(bool readOnlyName READ readOnlyName WRITE setReadOnlyName) diff --git a/qad/widgets/qpiconsole.cpp b/qad/libs/widgets/qpiconsole.cpp similarity index 100% rename from qad/widgets/qpiconsole.cpp rename to qad/libs/widgets/qpiconsole.cpp diff --git a/qad/widgets/qpiconsole.h b/qad/libs/widgets/qpiconsole.h similarity index 97% rename from qad/widgets/qpiconsole.h rename to qad/libs/widgets/qpiconsole.h index 1937d44..9426421 100644 --- a/qad/widgets/qpiconsole.h +++ b/qad/libs/widgets/qpiconsole.h @@ -26,7 +26,7 @@ #include #include #include -#include "qad_export.h" +#include "qad_widgets_export.h" typedef long long llong; @@ -38,7 +38,7 @@ typedef unsigned long long ullong; typedef long double ldouble; -class QAD_EXPORT QPIConsole: public QTabWidget { +class QAD_WIDGETS_EXPORT QPIConsole: public QTabWidget { Q_OBJECT public: QPIConsole(QWidget * parent = 0); @@ -143,7 +143,7 @@ private: return QString::number(v); } - struct Variable { + struct QAD_WIDGETS_EXPORT Variable { Variable() {label = widget = 0;} QString name; Formats format; @@ -157,7 +157,7 @@ private: bitFrom = src.bitFrom; bitCount = src.bitCount; ptr = src.ptr;} }; - struct Column { + struct QAD_WIDGETS_EXPORT Column { Column(Qt::Alignment align = Qt::AlignRight) {variables.reserve(16); alignment = align;} QVector variables; Qt::Alignment alignment; @@ -169,7 +169,7 @@ private: void operator =(const Column & src) {variables = src.variables; alignment = src.alignment;} }; - struct Tab { + struct QAD_WIDGETS_EXPORT Tab { Tab(QString n = "", char k = 0) {columns.reserve(16); name = n; key = k;} QVector columns; QString name; diff --git a/qad/widgets/qpointedit.cpp b/qad/libs/widgets/qpointedit.cpp similarity index 100% rename from qad/widgets/qpointedit.cpp rename to qad/libs/widgets/qpointedit.cpp diff --git a/qad/widgets/qpointedit.h b/qad/libs/widgets/qpointedit.h similarity index 95% rename from qad/widgets/qpointedit.h rename to qad/libs/widgets/qpointedit.h index c56ce95..1006257 100644 --- a/qad/widgets/qpointedit.h +++ b/qad/libs/widgets/qpointedit.h @@ -24,10 +24,10 @@ #include #include #include -#include "qad_export.h" +#include "qad_widgets_export.h" -class QAD_EXPORT QPointEdit: public QWidget +class QAD_WIDGETS_EXPORT QPointEdit: public QWidget { Q_OBJECT Q_PROPERTY(QPointF value READ value WRITE setValue) diff --git a/qad/widgets/qrectedit.cpp b/qad/libs/widgets/qrectedit.cpp similarity index 100% rename from qad/widgets/qrectedit.cpp rename to qad/libs/widgets/qrectedit.cpp diff --git a/qad/widgets/qrectedit.h b/qad/libs/widgets/qrectedit.h similarity index 96% rename from qad/widgets/qrectedit.h rename to qad/libs/widgets/qrectedit.h index df955c9..5fc0d33 100644 --- a/qad/widgets/qrectedit.h +++ b/qad/libs/widgets/qrectedit.h @@ -24,10 +24,10 @@ #include #include #include -#include "qad_export.h" +#include "qad_widgets_export.h" -class QAD_EXPORT QRectEdit: public QWidget +class QAD_WIDGETS_EXPORT QRectEdit: public QWidget { Q_OBJECT Q_PROPERTY(QRectF value READ value WRITE setValue) diff --git a/qad/widgets/qvariantedit.cpp b/qad/libs/widgets/qvariantedit.cpp similarity index 100% rename from qad/widgets/qvariantedit.cpp rename to qad/libs/widgets/qvariantedit.cpp diff --git a/qad/widgets/qvariantedit.h b/qad/libs/widgets/qvariantedit.h similarity index 94% rename from qad/widgets/qvariantedit.h rename to qad/libs/widgets/qvariantedit.h index aaaea63..4bd466a 100644 --- a/qad/widgets/qvariantedit.h +++ b/qad/libs/widgets/qvariantedit.h @@ -20,6 +20,9 @@ #ifndef QVARIANTEDIT_H #define QVARIANTEDIT_H +#include +#include +#include #include "qvariantedit_custom.h" #include "qad_types.h" #include "clineedit.h" @@ -28,12 +31,10 @@ #include "qrectedit.h" #include "qpointedit.h" #include "evalspinbox.h" -#include -#include -#include +#include "qad_widgets_export.h" -class QAD_EXPORT StringListEdit: public QWidget +class QAD_WIDGETS_EXPORT StringListEdit: public QWidget { Q_OBJECT public: @@ -66,7 +67,7 @@ signals: -class QAD_EXPORT PathEdit: public QWidget +class QAD_WIDGETS_EXPORT PathEdit: public QWidget { Q_OBJECT public: @@ -100,7 +101,7 @@ signals: -class QAD_EXPORT QVariantEdit: public QWidget +class QAD_WIDGETS_EXPORT QVariantEdit: public QWidget { Q_OBJECT Q_PROPERTY(QVariant value READ value WRITE setValue) diff --git a/qad/widgets/qvariantedit_custom.cpp b/qad/libs/widgets/qvariantedit_custom.cpp similarity index 100% rename from qad/widgets/qvariantedit_custom.cpp rename to qad/libs/widgets/qvariantedit_custom.cpp diff --git a/qad/widgets/qvariantedit_custom.h b/qad/libs/widgets/qvariantedit_custom.h similarity index 91% rename from qad/widgets/qvariantedit_custom.h rename to qad/libs/widgets/qvariantedit_custom.h index 8d392c3..2511dba 100644 --- a/qad/widgets/qvariantedit_custom.h +++ b/qad/libs/widgets/qvariantedit_custom.h @@ -23,13 +23,13 @@ #include #include #include -#include "qad_export.h" +#include "qad_widgets_export.h" class QVariantEdit; -class QAD_EXPORT QVariantEditorFactoryBase { +class QAD_WIDGETS_EXPORT QVariantEditorFactoryBase { friend class QVariantEdit; public: QVariantEditorFactoryBase() {} @@ -39,7 +39,7 @@ private: }; -class QAD_EXPORT QVariantEditorFactories { +class QAD_WIDGETS_EXPORT QVariantEditorFactories { public: static void registerEditorFactory(int meta_id, QVariantEditorFactoryBase * f); static void unregisterEditorFactory(int meta_id); diff --git a/qad/widgets/scroll_spin_box.cpp b/qad/libs/widgets/scroll_spin_box.cpp similarity index 100% rename from qad/widgets/scroll_spin_box.cpp rename to qad/libs/widgets/scroll_spin_box.cpp diff --git a/qad/widgets/scroll_spin_box.h b/qad/libs/widgets/scroll_spin_box.h similarity index 95% rename from qad/widgets/scroll_spin_box.h rename to qad/libs/widgets/scroll_spin_box.h index 2dedcbc..266bbdc 100644 --- a/qad/widgets/scroll_spin_box.h +++ b/qad/libs/widgets/scroll_spin_box.h @@ -21,7 +21,7 @@ #define SCROLL_SPIN_BOX_H #include -#include "qad_export.h" +#include "qad_widgets_export.h" namespace Ui { @@ -32,7 +32,7 @@ namespace Ui { class EvalSpinBox; -class QAD_EXPORT ScrollSpinBox: public QWidget +class QAD_WIDGETS_EXPORT ScrollSpinBox: public QWidget { Q_OBJECT Q_PROPERTY(double sensivity READ sensivity WRITE setSensivity) diff --git a/qad/widgets/scroll_spin_box.ui b/qad/libs/widgets/scroll_spin_box.ui similarity index 100% rename from qad/widgets/scroll_spin_box.ui rename to qad/libs/widgets/scroll_spin_box.ui diff --git a/qad/widgets/session_manager.cpp b/qad/libs/widgets/session_manager.cpp similarity index 100% rename from qad/widgets/session_manager.cpp rename to qad/libs/widgets/session_manager.cpp diff --git a/qad/widgets/session_manager.h b/qad/libs/widgets/session_manager.h similarity index 98% rename from qad/widgets/session_manager.h rename to qad/libs/widgets/session_manager.h index d788b2c..b3c84fa 100644 --- a/qad/widgets/session_manager.h +++ b/qad/libs/widgets/session_manager.h @@ -35,6 +35,7 @@ #include "spinslider.h" #include "evalspinbox.h" #include "qpiconfig.h" +#include "qad_widgets_export.h" /// for all children widgets of "QMainWindow"s and MainWidgets @@ -43,7 +44,7 @@ /// * void sessionLoad(QByteArray * data); -class QAD_EXPORT SessionManager: public QObject +class QAD_WIDGETS_EXPORT SessionManager: public QObject { Q_OBJECT public: diff --git a/qad/widgets/shortcuts.cpp b/qad/libs/widgets/shortcuts.cpp similarity index 100% rename from qad/widgets/shortcuts.cpp rename to qad/libs/widgets/shortcuts.cpp diff --git a/qad/widgets/shortcuts.h b/qad/libs/widgets/shortcuts.h similarity index 84% rename from qad/widgets/shortcuts.h rename to qad/libs/widgets/shortcuts.h index cc41df3..2bdc1f8 100644 --- a/qad/widgets/shortcuts.h +++ b/qad/libs/widgets/shortcuts.h @@ -33,14 +33,15 @@ #include #include #include "clineedit.h" +#include "qad_widgets_export.h" -class QAD_EXPORT ShortcutEdit: public CLineEdit +class QAD_WIDGETS_EXPORT ShortcutEdit: public CLineEdit { Q_OBJECT friend class Shortcuts; public: - explicit ShortcutEdit(QWidget * parent = 0): CLineEdit(parent) {ti = 0; ca = 0; connect(this, SIGNAL(textChanged(QString)), this, SLOT(textChanged_(QString)));} + explicit ShortcutEdit(QWidget * parent = 0): CLineEdit(parent) {ti = 0; ca = 0; connect(this, SIGNAL(textChanged(QString)), this, SLOT(textChanged_(QString)));} void assignAction(QAction * a) {clear(); ca = a; reset();} QAction * action() const {return ca;} @@ -60,7 +61,7 @@ private: }; -class QAD_EXPORT Shortcuts: public QTreeWidget +class QAD_WIDGETS_EXPORT Shortcuts: public QTreeWidget { Q_OBJECT @@ -82,7 +83,7 @@ public slots: void filter(const QString & what); private: - virtual void updateEditorGeometries() {foreach (ShortcutEdit * i, edits) i->setGeometry(visualRect(indexFromItem(i->ti, 1)));} + virtual void updateEditorGeometries() {foreach (ShortcutEdit * i, edits) i->setGeometry(visualRect(indexFromItem(i->ti, 1)));} virtual void changeEvent(QEvent * ); bool filterTree(QTreeWidgetItem * ti, QString f); diff --git a/qad/widgets/spinslider.cpp b/qad/libs/widgets/spinslider.cpp similarity index 100% rename from qad/widgets/spinslider.cpp rename to qad/libs/widgets/spinslider.cpp diff --git a/qad/widgets/spinslider.h b/qad/libs/widgets/spinslider.h similarity index 92% rename from qad/widgets/spinslider.h rename to qad/libs/widgets/spinslider.h index 1fbc185..fda4742 100644 --- a/qad/widgets/spinslider.h +++ b/qad/libs/widgets/spinslider.h @@ -23,10 +23,10 @@ #include #include #include -#include "qad_export.h" +#include "qad_widgets_export.h" -class QAD_EXPORT SpinSlider: public QWidget +class QAD_WIDGETS_EXPORT SpinSlider: public QWidget { Q_OBJECT Q_ENUMS(Direction) @@ -72,13 +72,13 @@ public: bool invertedAppearance() const {return slider->invertedAppearance();} bool squareScale() const {return square;} - void setSingleStep(double step) {spin->setSingleStep(step); slider->setPageStep(qRound(step * delim));} + void setSingleStep(double step) {spin->setSingleStep(step); slider->setPageStep(qRound(step * delim));} void setAdaptiveStep(bool on); - void setPageStep(double step) {page = step; slider->setPageStep(qRound(page * delim));} + void setPageStep(double step) {page = step; slider->setPageStep(qRound(page * delim));} void setPrefix(QString prefix) {spin->setPrefix(prefix);} void setSuffix(QString suffix) {spin->setSuffix(suffix);} void setTickPosition(QSlider::TickPosition tp) {slider->setTickPosition(tp);} - void setTickInterval(int ti) {ticks_ = ti; slider->setTickInterval(qRound(ticks_ * delim));} + void setTickInterval(int ti) {ticks_ = ti; slider->setTickInterval(qRound(ticks_ * delim));} void setOrientation(Qt::Orientation orient); void setDirection(Direction d) {direc = d; layout->setDirection((QBoxLayout::Direction)d);} void setInvertedAppearance(bool yes) {slider->setInvertedAppearance(yes);} diff --git a/qad/qad_export.h b/qad/qad_export.h deleted file mode 100644 index 1f7e882..0000000 --- a/qad/qad_export.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef QAD_EXPORT_H -#define QAD_EXPORT_H - -#include - -#if defined(QAD_STATIC_DEFINE) || defined(DOXYGEN) -# define QAD_EXPORT -#else -# ifdef QAD_SHARED_DEFINE -# define QAD_EXPORT Q_DECL_EXPORT -# else -# define QAD_EXPORT Q_DECL_IMPORT -# endif -#endif - -#endif //QAD_EXPORT_H diff --git a/qad/sql_table/CMakeLists.txt b/qad/sql_table/CMakeLists.txt deleted file mode 100644 index c7f7282..0000000 --- a/qad/sql_table/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -qad_project(sql_table "Gui;Widgets;Sql" "qad_utils;qad_widgets") diff --git a/qad/sql_table/qad_sql_table.qrc b/qad/sql_table/qad_sql_table.qrc deleted file mode 100644 index b1caabc..0000000 --- a/qad/sql_table/qad_sql_table.qrc +++ /dev/null @@ -1,26 +0,0 @@ - - - ../icons/edit-table-insert-row-below.png - ../icons/dialog-close.png - ../icons/edit-clear.png - ../icons/edit-guides.png - ../icons/view-grid.png - ../icons/zoom-fit-best.png - ../icons/configure.png - ../icons/document-save.png - ../icons/edit-clear-locationbar-rtl.png - ../icons/edit-find.png - ../icons/list-add.png - ../icons/edit-delete.png - ../icons/item.png - ../icons/node-add.png - ../icons/node.png - ../icons/edit-copy.png - ../icons/edit-paste.png - ../icons/expand_s_x.png - ../icons/expand_s_y.png - ../icons/expand_x.png - ../icons/expand_y.png - ../icons/sql_table.png - - diff --git a/qad/touch_widgets/CMakeLists.txt b/qad/touch_widgets/CMakeLists.txt deleted file mode 100644 index 1140e08..0000000 --- a/qad/touch_widgets/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -qad_project(touch_widgets "Gui;Widgets" "") diff --git a/qad/touch_widgets/touch_widgets.qrc b/qad/touch_widgets/touch_widgets.qrc deleted file mode 100644 index cfb77f1..0000000 --- a/qad/touch_widgets/touch_widgets.qrc +++ /dev/null @@ -1,7 +0,0 @@ - - - ../icons/touchbuttframe.png - ../icons/touchbutton.png - ../icons/touchslider.png - - diff --git a/qad/utils/CMakeLists.txt b/qad/utils/CMakeLists.txt index c6c681c..dc9a712 100644 --- a/qad/utils/CMakeLists.txt +++ b/qad/utils/CMakeLists.txt @@ -1 +1 @@ -qad_project(utils "Gui;Widgets" "") +add_directories("qad_") diff --git a/qad/utils/blockeditor/CMakeLists.txt b/qad/utils/blockeditor/CMakeLists.txt new file mode 100644 index 0000000..5b2a417 --- /dev/null +++ b/qad/utils/blockeditor/CMakeLists.txt @@ -0,0 +1,14 @@ +project(blockeditor) +if(APPLE) + set(APP_ICON "") +elseif(WIN32) + set(APP_ICON "icons/blockview.ico") +else() + set(APP_ICON "icons/blockview.png") +endif() +set(APP_INFO "Editor for BlockView Blocks") +qad_application(${PROJECT_NAME} "Gui;Widgets" "qad_utils;qad_widgets;qad_blockview") +if (Qt5_FOUND) + import_version(${PROJ_NAME}5 ${PROJECT_NAME}) + deploy_target(${PROJECT_NAME}5 DEPLOY_DIR ${CMAKE_CURRENT_BINARY_DIR} DESTINATION ${ROOT_DIR}/release) +endif() diff --git a/qad/blockview/blockeditor/blockeditor_main.cpp b/qad/utils/blockeditor/blockeditor_main.cpp similarity index 95% rename from qad/blockview/blockeditor/blockeditor_main.cpp rename to qad/utils/blockeditor/blockeditor_main.cpp index 0a6a3a7..bf103af 100644 --- a/qad/blockview/blockeditor/blockeditor_main.cpp +++ b/qad/utils/blockeditor/blockeditor_main.cpp @@ -1,16 +1,16 @@ -#include -#include "blockeditor.h" - - -int main(int argc, char * argv[]) { - QApplication a(argc, argv); -#if QT_VERSION >= 0x050000 - a.setAttribute(Qt::AA_UseHighDpiPixmaps, true); -#endif - a.setWindowIcon(QIcon(":/icons/blockview.png")); - BlockEditor w; - if (a.arguments().size() > 1) - w.loadFile(a.arguments().back()); - w.show(); - return a.exec(); -} +#include +#include "blockeditor.h" + + +int main(int argc, char * argv[]) { + QApplication a(argc, argv); +#if QT_VERSION >= 0x050000 + a.setAttribute(Qt::AA_UseHighDpiPixmaps, true); +#endif + a.setWindowIcon(QIcon(":/icons/blockview.png")); + BlockEditor w; + if (a.arguments().size() > 1) + w.loadFile(a.arguments().back()); + w.show(); + return a.exec(); +} diff --git a/qad/blockview/blockeditor/icons/blockview.ico b/qad/utils/blockeditor/icons/blockview.ico similarity index 100% rename from qad/blockview/blockeditor/icons/blockview.ico rename to qad/utils/blockeditor/icons/blockview.ico diff --git a/qad/blockview/blockeditor/icons/blockview.png b/qad/utils/blockeditor/icons/blockview.png similarity index 100% rename from qad/blockview/blockeditor/icons/blockview.png rename to qad/utils/blockeditor/icons/blockview.png diff --git a/qad/utils/qad_utils.qrc b/qad/utils/qad_utils.qrc deleted file mode 100644 index 12a8c2d..0000000 --- a/qad/utils/qad_utils.qrc +++ /dev/null @@ -1,17 +0,0 @@ - - - ../icons/edit-clear.png - ../icons/document-save.png - ../icons/edit-clear-locationbar-rtl.png - ../icons/edit-find.png - ../icons/list-add.png - ../icons/edit-delete.png - ../icons/item-add.png - ../icons/item.png - ../icons/node-add.png - ../icons/node.png - ../icons/edit-copy.png - ../icons/edit-paste.png - ../icons/document-open_16.png - - diff --git a/qad/utils/qpicalculator/CMakeLists.txt b/qad/utils/qpicalculator/CMakeLists.txt new file mode 100644 index 0000000..27ecf2c --- /dev/null +++ b/qad/utils/qpicalculator/CMakeLists.txt @@ -0,0 +1,14 @@ +project(qpicalc) +if(APPLE) + set(APP_ICON "") +elseif(WIN32) + set(APP_ICON "icons/qpicalculator.ico") +else() + set(APP_ICON "icons/qpicalculator.png") +endif() +set(APP_INFO "Small calculator ang grapher") +qad_application(${PROJECT_NAME} "Gui;Widgets" "qad_utils;qad_widgets;qad_graphic") +if (Qt5_FOUND) + import_version(${PROJ_NAME}5 ${PROJECT_NAME}) + deploy_target(${PROJECT_NAME}5 DEPLOY_DIR ${CMAKE_CURRENT_BINARY_DIR} DESTINATION ${ROOT_DIR}/release) +endif() diff --git a/qad/utils/qpicalculator/icons/qpicalculator.ico b/qad/utils/qpicalculator/icons/qpicalculator.ico new file mode 100644 index 0000000..99388c5 Binary files /dev/null and b/qad/utils/qpicalculator/icons/qpicalculator.ico differ diff --git a/qad/utils/qpicalculator/icons/qpicalculator.png b/qad/utils/qpicalculator/icons/qpicalculator.png new file mode 100644 index 0000000..dad22b7 Binary files /dev/null and b/qad/utils/qpicalculator/icons/qpicalculator.png differ diff --git a/qad/graphic/qpicalculator/main.cpp b/qad/utils/qpicalculator/main.cpp similarity index 100% rename from qad/graphic/qpicalculator/main.cpp rename to qad/utils/qpicalculator/main.cpp diff --git a/qad/graphic/qpicalculator/mainwindow.cpp b/qad/utils/qpicalculator/mainwindow.cpp similarity index 100% rename from qad/graphic/qpicalculator/mainwindow.cpp rename to qad/utils/qpicalculator/mainwindow.cpp diff --git a/qad/graphic/qpicalculator/mainwindow.h b/qad/utils/qpicalculator/mainwindow.h similarity index 100% rename from qad/graphic/qpicalculator/mainwindow.h rename to qad/utils/qpicalculator/mainwindow.h diff --git a/qad/graphic/qpicalculator/mainwindow.ui b/qad/utils/qpicalculator/mainwindow.ui similarity index 99% rename from qad/graphic/qpicalculator/mainwindow.ui rename to qad/utils/qpicalculator/mainwindow.ui index 234fed7..dae08e6 100644 --- a/qad/graphic/qpicalculator/mainwindow.ui +++ b/qad/utils/qpicalculator/mainwindow.ui @@ -15,7 +15,7 @@ - :/icons/Apps-accessories-calculator-icon.png:/icons/Apps-accessories-calculator-icon.png + :/icons/qpicalculator.png:/icons/qpicalculator.png diff --git a/qad/utils/qpicalculator/qpicalculator.qrc b/qad/utils/qpicalculator/qpicalculator.qrc new file mode 100644 index 0000000..1a48626 --- /dev/null +++ b/qad/utils/qpicalculator/qpicalculator.qrc @@ -0,0 +1,5 @@ + + + icons/qpicalculator.png + + diff --git a/qad/widgets/CMakeLists.txt b/qad/widgets/CMakeLists.txt deleted file mode 100644 index 6d5872d..0000000 --- a/qad/widgets/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -qad_project(widgets "Gui;Widgets" "qad_utils") diff --git a/qad/widgets/qad_widgets.qrc b/qad/widgets/qad_widgets.qrc deleted file mode 100644 index 5b064ed..0000000 --- a/qad/widgets/qad_widgets.qrc +++ /dev/null @@ -1,47 +0,0 @@ - - - ../icons/go-next.png - ../icons/go-previous.png - lang/qad_widgets_ru.ts - ../icons/dialog-close.png - ../icons/edit-clear.png - ../icons/edit-guides.png - ../icons/view-grid.png - ../icons/zoom-fit-best.png - ../icons/configure.png - ../icons/alpha.png - ../icons/document-save.png - ../icons/edit-clear-locationbar-rtl.png - ../icons/edit-find.png - ../icons/list-add.png - ../icons/edit-delete.png - ../icons/item-add.png - ../icons/item.png - ../icons/node-add.png - ../icons/node.png - ../icons/edit-copy.png - ../icons/edit-paste.png - ../icons/expand_s_x.png - ../icons/expand_s_y.png - ../icons/expand_x.png - ../icons/expand_y.png - ../icons/border-line.png - ../icons/legend.png - ../icons/chardialog.png - ../icons/clineedit.png - ../icons/colorbutton.png - ../icons/ecombobox.png - ../icons/qpiconsole.png - ../icons/spinslider.png - ../icons/etabwidget.png - ../icons/qcodeedit.png - ../icons/qvariantedit.png - ../icons/code-word.png - ../icons/f1.png - ../icons/dialog-ok-apply.png - ../icons/dialog-warning.png - ../icons/tools-wizard.png - ../icons/evalspinbox.png - ../icons/scroll_spin.png - - diff --git a/qcd_utils/CMakeLists.txt b/qcd_utils/CMakeLists.txt deleted file mode 100644 index 913edec..0000000 --- a/qcd_utils/CMakeLists.txt +++ /dev/null @@ -1,78 +0,0 @@ -cmake_minimum_required(VERSION 3.0) -project(qcd_utils) -set(_QCD_MAJOR 1) -set(_QCD_MINOR 0) -set(_QCD_REVISION 0) -set(_QCD_SUFFIX "") -set(_QCD_COMPANY SHS) -set(_QCD_DOMAIN org.SHS) -if(NOT DEFINED BUILD_NUMBER) - set(BUILD_NUMBER 9999) -endif() -if (NOT LIBPROJECT) - find_package(PIP REQUIRED) - option(LIB "System install" 0) - if (CMAKE_BUILD_TYPE MATCHES Debug) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -Wall") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3 -Wall") - else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -Wall") - endif() - include(DeployMacros) -endif() -set_version(${PROJECT_NAME} - MAJOR ${_QCD_MAJOR} - MINOR ${_QCD_MINOR} - REVISION ${_QCD_REVISION} - BUILD "${BUILD_NUMBER}" - SUFFIX "${_QCD_SUFFIX}") - -find_package(QAD REQUIRED) -list(APPEND QT_MULTILIB_LIST ${PROJECT_NAME}) -set(QT_MULTILIB_LIST ${QT_MULTILIB_LIST} PARENT_SCOPE) -include_directories(${PIP_INCLUDES} ${QAD_INCLUDES}) -file(GLOB SRC "*.h" "*.cpp" "*.ui" "*.qrc" "lang/*.ts") -find_qt(${QtVersions} Core Gui) -set_deploy_property(${PROJECT_NAME} SHARED - LABEL ${PROJECT_NAME} - FULLNAME "${_QCD_DOMAIN}.${PROJECT_NAME}" - COMPANY ${_QCD_COMPANY} - INFO "QCD library") -make_rc(${PROJECT_NAME} out_RC) -qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM) -qt_add_library(${PROJECT_NAME} SHARED out_CPP ${out_RC}) -qt_target_link_libraries(${PROJECT_NAME} pip qad_utils qad_widgets qad_graphic cd_utils piqt) -message(STATUS "Building ${PROJECT_NAME}") - -set(QCD_UTILS_UTILS 1) -if(LIBPROJECT) - sdk_install("" "${PROJECT_NAME}" "${out_HDR}" "${out_QM}") - set(QCD_UTILS_UTILS ${UTILS}) -else() - if(LIB) - if(WIN32) - install(FILES ${out_HDR} DESTINATION ${MINGW_INCLUDE}) - qt_install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION ${MINGW_LIB}) - qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${MINGW_BIN}) - qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION QtBin) - else() - install(FILES ${out_HDR} DESTINATION ${CMAKE_INSTALL_PREFIX}/include) - qt_install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) - endif() - message(STATUS "Install ${PROJECT_NAME} to system \"${CMAKE_INSTALL_PREFIX}\"") - else() - if(WIN32) - qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin) - qt_install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib) - else() - qt_install(TARGETS ${PROJECT_NAME} DESTINATION lib) - endif() - install(FILES ${out_HDR} DESTINATION include) - message(STATUS "Install ${PROJECT_NAME} to local \"bin\", \"lib\" and \"include\"") - endif() -endif() - -if(QCD_UTILS_UTILS) - add_subdirectory(pult) -endif() diff --git a/qcd_utils/LICENSE.txt b/qcd_utils/LICENSE.txt deleted file mode 100644 index 0a04128..0000000 --- a/qcd_utils/LICENSE.txt +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/qcd_utils/pult/CMakeLists.txt b/qcd_utils/pult/CMakeLists.txt deleted file mode 100644 index b7f80cb..0000000 --- a/qcd_utils/pult/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -project(cd_pult) -import_version(${PROJECT_NAME} qcd_utils) -find_qt(${QtVersions} Core Gui OpenGL) -set_deploy_property(${PROJECT_NAME} - LABEL ${PROJECT_NAME} - FULLNAME "${_QCD_DOMAIN}.${PROJECT_NAME}" - COMPANY ${_QCD_COMPANY} - INFO "CD Pult") -if (Qt5_FOUND) - import_version(${PROJECT_NAME}5 ${PROJECT_NAME}) - import_deploy_properties(${PROJECT_NAME}5 ${PROJECT_NAME}) -endif() -make_rc(${PROJECT_NAME} out_RC) -qt_sources(SRC) -qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM) -qt_add_executable(${PROJECT_NAME} WIN32 out_CPP ${out_RC}) -qt_target_link_libraries(${PROJECT_NAME} qad_utils qad_widgets qad_graphic qad_application qcd_utils piqt_utils) -qt_target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../" "${CMAKE_CURRENT_SOURCE_DIR}/../../piqt_utils" ${QAD_INCLUDES}) -message(STATUS "Building ${PROJECT_NAME}") -if(LIB) - if(WIN32) - qt_install(TARGETS ${PROJECT_NAME} DESTINATION ${MINGW_BIN}) - else() - if (DEFINED ANDROID_PLATFORM) - qt_install(TARGETS ${PROJECT_NAME} DESTINATION ${ANDROID_SYSTEM_LIBRARY_PATH}/usr/bin) - else() - qt_install(TARGETS ${PROJECT_NAME} DESTINATION /usr/local/bin) - endif() - endif() - #message(STATUS "Install ${PROJECT_NAME} to system \"${CMAKE_INSTALL_PREFIX}\"") -else() - qt_install(TARGETS ${PROJECT_NAME} DESTINATION bin) -endif() -if (Qt5_FOUND) - deploy_target(${PROJECT_NAME}5 VERBOSE DEPLOY_DIR ${CMAKE_CURRENT_BINARY_DIR} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/../release) -endif() diff --git a/qcd_utils/pult/cdpult.qrc b/qcd_utils/pult/cdpult.qrc deleted file mode 100644 index 76a8d63..0000000 --- a/qcd_utils/pult/cdpult.qrc +++ /dev/null @@ -1,16 +0,0 @@ - - - icons/db-export.png - icons/db-import.png - icons/Apps-accessories-calculator-icon.png - icons/dialog-information.png - icons/dialog-cancel.png - icons/dialog-ok-apply.png - icons/timer.png - icons/document-revert.png - icons/flame.png - icons/view-refresh.png - icons/format-stroke-color.png - icons/accessories-text-editor.png - - diff --git a/qcd_utils/pult/icons/Apps-accessories-calculator-icon.png b/qcd_utils/pult/icons/Apps-accessories-calculator-icon.png deleted file mode 100644 index 37a3035..0000000 Binary files a/qcd_utils/pult/icons/Apps-accessories-calculator-icon.png and /dev/null differ diff --git a/qcd_utils/pult/icons/dialog-cancel.png b/qcd_utils/pult/icons/dialog-cancel.png deleted file mode 100644 index ace88ab..0000000 Binary files a/qcd_utils/pult/icons/dialog-cancel.png and /dev/null differ diff --git a/qcd_utils/pult/icons/dialog-ok-apply.png b/qcd_utils/pult/icons/dialog-ok-apply.png deleted file mode 100644 index 3260f60..0000000 Binary files a/qcd_utils/pult/icons/dialog-ok-apply.png and /dev/null differ diff --git a/qcd_utils/pult/icons/document-revert.png b/qcd_utils/pult/icons/document-revert.png deleted file mode 100644 index e04514b..0000000 Binary files a/qcd_utils/pult/icons/document-revert.png and /dev/null differ diff --git a/qcd_utils/pult/icons/format-stroke-color.png b/qcd_utils/pult/icons/format-stroke-color.png deleted file mode 100644 index 4c4d290..0000000 Binary files a/qcd_utils/pult/icons/format-stroke-color.png and /dev/null differ diff --git a/qcd_utils/pult/icons/view-refresh.png b/qcd_utils/pult/icons/view-refresh.png deleted file mode 100644 index 66f0ceb..0000000 Binary files a/qcd_utils/pult/icons/view-refresh.png and /dev/null differ diff --git a/qglengine/CMakeLists.txt b/qglengine/CMakeLists.txt index 92f4339..93542ec 100644 --- a/qglengine/CMakeLists.txt +++ b/qglengine/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.0) project(qglengine) find_package(QAD REQUIRED) +set(_DOMAIN "org.SHS") +set(_COMPANY "SHS") find_qt(Qt5 Core Gui OpenGL Xml) if (NOT Qt5) message(WARNING "Building ${PROJECT_NAME} available only on Qt5!") @@ -52,7 +54,7 @@ else() add_subdirectory(widgets) set(QT_MULTILIB_LIST ${QT_MULTILIB_LIST} PARENT_SCOPE) if (LIBPROJECT) - sdk_install("qglengine" "qglengine_core" "${out_HDR}" "${out_QM}") + sdk_install("qglengine" FALSE "qglengine_core" "${out_HDR}" "${out_QM}") else() if (LIB) if (WIN32) diff --git a/qglengine/widgets/CMakeLists.txt b/qglengine/widgets/CMakeLists.txt index f650aaa..4cf64b1 100644 --- a/qglengine/widgets/CMakeLists.txt +++ b/qglengine/widgets/CMakeLists.txt @@ -22,7 +22,7 @@ list(APPEND QT_MULTILIB_LIST ${PROJECT_NAME}) set(QT_MULTILIB_LIST ${QT_MULTILIB_LIST} PARENT_SCOPE) #message(STATUS "Building ${PROJECT_NAME}") if (LIBPROJECT) - sdk_install("qglengine" "${PROJECT_NAME}" "${out_HDR}" "${out_QM}") + sdk_install("qglengine" FALSE "${PROJECT_NAME}" "${out_HDR}" "${out_QM}") else() if (LIB) if (WIN32) diff --git a/qglview/CMakeLists.txt b/qglview/CMakeLists.txt index 31aa195..86e1110 100644 --- a/qglview/CMakeLists.txt +++ b/qglview/CMakeLists.txt @@ -28,7 +28,7 @@ else() qt_target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") message(STATUS "Building ${PROJECT_NAME}") if (LIBPROJECT) - sdk_install("qad" "${PROJECT_NAME}" "${out_HDR}" "${out_QM}") + sdk_install("qad" FALSE "${PROJECT_NAME}" "${out_HDR}" "${out_QM}") else() if (LIB) if (WIN32)