diff --git a/SDKMacros.cmake b/SDKMacros.cmake index c5ab609..a615860 100644 --- a/SDKMacros.cmake +++ b/SDKMacros.cmake @@ -9,17 +9,13 @@ macro(sdk_install _DIR _TARGET _H_FILES _QM_FILES) qt_install(TARGETS ${_TARGET} DESTINATION ${MINGW_LIB}) qt_install(TARGETS ${_TARGET} DESTINATION ${MINGW_BIN}) qt_install(TARGETS ${_TARGET} DESTINATION QtBin) - if(NOT "x${_QM_FILES}" STREQUAL "x") - qt_install(FILES ${_QM_FILES} DESTINATION QtLang) - endif() + qt_install(FILES ${_QM_FILES} DESTINATION QtLang) else() if (NOT "x${_H_FILES}" STREQUAL "x") install(FILES ${_H_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${_DIR}) endif() qt_install(TARGETS ${_TARGET} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) - if(NOT "x${_QM_FILES}" STREQUAL "x") - qt_install(FILES ${_QM_FILES} DESTINATION QtLang) - endif() + qt_install(FILES ${_QM_FILES} DESTINATION QtLang) endif() #message(STATUS "Install ${_TARGET} to system \"${CMAKE_INSTALL_PREFIX}\"") else() diff --git a/qad/CMakeLists.txt b/qad/CMakeLists.txt index c36621e..47c35ef 100644 --- a/qad/CMakeLists.txt +++ b/qad/CMakeLists.txt @@ -56,7 +56,7 @@ macro(qad_install _TARGET _H_FILES _QM_FILES) qt_install(TARGETS ${_TARGET} DESTINATION ${MINGW_LIB}) qt_install(TARGETS ${_TARGET} DESTINATION ${MINGW_BIN}) qt_install(TARGETS ${_TARGET} DESTINATION QtBin) - qt_install(FILES ${_QM_FILES} DESTINATION QtLang) + qt_install(FILES "${_QM_FILES}" DESTINATION QtLang) else() if(NOT _H_FILES STREQUAL "") install(FILES ${_H_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/qad) diff --git a/qad/QtWraps.cmake b/qad/QtWraps.cmake index dc94d22..27566cd 100644 --- a/qad/QtWraps.cmake +++ b/qad/QtWraps.cmake @@ -296,6 +296,7 @@ macro(qt_wrap) qt4_wrap_ui(CUIS${_v} ${UI_LIST}) qt4_add_resources(CRES${_v} ${RES_LIST}) if (WAS_QM_ARG) + set(${QM${_v}_VAR} "") qt4_add_translation(${QM${_v}_VAR} ${TS_LIST}) endif() else() @@ -304,6 +305,7 @@ macro(qt_wrap) qt5_wrap_ui(CUIS${_v} ${UI_LIST}) qt5_add_resources(CRES${_v} ${RES_LIST}) if (WAS_QM_ARG) + set(${QM${_v}_VAR} "") qt5_add_translation(${QM${_v}_VAR} ${TS_LIST}) endif() else() @@ -442,6 +444,7 @@ macro(qt_install) set(_IS_FILES 0) set(_IS_DEST 0) set(_IS_LANG 0) + set(_INVALID 0) foreach(_i ${ARGN}) if ("x${_i}" STREQUAL "xQtLang") set(_IS_LANG 1) @@ -460,7 +463,8 @@ macro(qt_install) set(_IS_FILES 0) if (_IS_LANG) if (("x${${_i}_Qt${_v}}" STREQUAL "x") OR ("x${_i}" STREQUAL "xDESTINATION")) - return() + #return() + set(_INVALID 1) else() set(_INST_LIST ${_INST_LIST} ${${_i}_Qt${_v}}) endif() @@ -503,10 +507,12 @@ macro(qt_install) endif() endif() endforeach() - if (NOT ("x${_prev_inst}" STREQUAL "x${_INST_LIST}")) - #message("install: ${_INST_LIST}") - install(${_INST_LIST}) - set(_prev_inst "${_INST_LIST}") + if (NOT _INVALID) + if (NOT ("x${_prev_inst}" STREQUAL "x${_INST_LIST}")) + #message("install: ${_INST_LIST}") + install(${_INST_LIST}) + set(_prev_inst "${_INST_LIST}") + endif() endif() endif() endforeach() diff --git a/qad/touch_widgets/plugin/qad_touch_widgets.cpp b/qad/touch_widgets/plugin/qad_touch_widgets.cpp new file mode 100644 index 0000000..caf2bbe --- /dev/null +++ b/qad/touch_widgets/plugin/qad_touch_widgets.cpp @@ -0,0 +1,21 @@ +#include "qad_touch_widgets.h" +#include "touchsliderplugin.h" +#include "touchbuttframeplugin.h" +#include "touchbuttonplugin.h" + + +QADTouchWidgets::QADTouchWidgets(QObject * parent): QObject(parent) { + m_widgets.append(new TouchSliderPlugin(this)); + m_widgets.append(new TouchButtFramePlugin(this)); + m_widgets.append(new TouchButtonPlugin(this)); +} + + +QList QADTouchWidgets::customWidgets() const { + return m_widgets; +} + + +#if QT_VERSION < 0x050000 +Q_EXPORT_PLUGIN2(qad_touch_widgets_plugin, QADTouchWidgets) +#endif diff --git a/qad/touch_widgets/plugin/qad_touch_widgets.h b/qad/touch_widgets/plugin/qad_touch_widgets.h new file mode 100644 index 0000000..e7cbf2a --- /dev/null +++ b/qad/touch_widgets/plugin/qad_touch_widgets.h @@ -0,0 +1,23 @@ +#ifndef QAD_TOUCH_WIDGETS_H +#define QAD_TOUCH_WIDGETS_H + +#include +#include + +class QADTouchWidgets: public QObject, public QDesignerCustomWidgetCollectionInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetCollectionInterface) +#if QT_VERSION >= 0x050000 + Q_PLUGIN_METADATA(IID "qad.touch_widgets") +#endif +public: + explicit QADTouchWidgets(QObject *parent = 0); + virtual QList customWidgets() const; + +private: + QList m_widgets; + +}; + +#endif // QAD_TOUCH_WIDGETS_H diff --git a/qad/touch_widgets/plugin/touch_widgets.cpp b/qad/touch_widgets/plugin/touch_widgets.cpp deleted file mode 100644 index b3e20b5..0000000 --- a/qad/touch_widgets/plugin/touch_widgets.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "touch_widgets.h" -#include "touchsliderplugin.h" -#include "touchbuttframeplugin.h" -#include "touchbuttonplugin.h" - -TW::TW(QObject *parent) - : QObject(parent) -{ - m_widgets.append(new TouchSliderPlugin(this)); - m_widgets.append(new TouchButtFramePlugin(this)); - m_widgets.append(new TouchButtonPlugin(this)); -} - -QList TW::customWidgets() const -{ - return m_widgets; -} - - -#if QT_VERSION < 0x050000 -Q_EXPORT_PLUGIN2(twplugin, TW) -#endif diff --git a/qad/touch_widgets/plugin/touch_widgets.h b/qad/touch_widgets/plugin/touch_widgets.h deleted file mode 100644 index c968bd6..0000000 --- a/qad/touch_widgets/plugin/touch_widgets.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef TW_H -#define TW_H - -#include -#include - -class TW : public QObject, public QDesignerCustomWidgetCollectionInterface -{ - Q_OBJECT - Q_INTERFACES(QDesignerCustomWidgetCollectionInterface) -#if QT_VERSION >= 0x050000 - Q_PLUGIN_METADATA(IID "qad.touch_widgets") -#endif -public: - explicit TW(QObject *parent = 0); - - virtual QList customWidgets() const; - -private: - QList m_widgets; -}; - -#endif diff --git a/qad/utils/qad_types.cpp b/qad/utils/qad_types.cpp index 843b1f8..9b010d5 100644 --- a/qad/utils/qad_types.cpp +++ b/qad/utils/qad_types.cpp @@ -10,6 +10,30 @@ bool __QADTypesRegistrator__::_inited = false; +__QADTypesRegistrator__::__QADTypesRegistrator__() { + if (_inited) return; + _inited = true; + qRegisterMetaType("QAD::Enumerator"); + qRegisterMetaTypeStreamOperators("QAD::Enumerator"); + qRegisterMetaType("QAD::Enum"); + qRegisterMetaTypeStreamOperators("QAD::Enum"); + + qRegisterMetaType("QAD::File"); + qRegisterMetaTypeStreamOperators("QAD::File"); + + qRegisterMetaType("QAD::Dir"); + qRegisterMetaTypeStreamOperators("QAD::Dir"); + +#if QT_VERSION >= 0x050200 + QMetaType::registerConverter(&QAD::Enum::selectedValue); + QMetaType::registerConverter(&QAD::Enum::selectedName); + QMetaType::registerConverter(&QAD::File::toString); + QMetaType::registerConverter(&QAD::Dir::toString); +#endif +} + +__QADTypesRegistrator__ __registrator__; + int QAD::Enum::selectedValue() const { foreach (const Enumerator & e, enum_list) diff --git a/qad/utils/qad_types.h b/qad/utils/qad_types.h index 023d2ae..f991e55 100644 --- a/qad/utils/qad_types.h +++ b/qad/utils/qad_types.h @@ -77,32 +77,10 @@ inline QDebug operator <<(QDebug s, const QAD::Dir & v) {s.nospace() << v.dir; r class __QADTypesRegistrator__ { public: - __QADTypesRegistrator__() { - if (_inited) return; - _inited = true; - qRegisterMetaType("QAD::Enumerator"); - qRegisterMetaTypeStreamOperators("QAD::Enumerator"); - qRegisterMetaType("QAD::Enum"); - qRegisterMetaTypeStreamOperators("QAD::Enum"); - - qRegisterMetaType("QAD::File"); - qRegisterMetaTypeStreamOperators("QAD::File"); - - qRegisterMetaType("QAD::Dir"); - qRegisterMetaTypeStreamOperators("QAD::Dir"); - -#if QT_VERSION >= 0x050200 - QMetaType::registerConverter(&QAD::Enum::selectedValue); - QMetaType::registerConverter(&QAD::Enum::selectedName); - QMetaType::registerConverter(&QAD::File::toString); - QMetaType::registerConverter(&QAD::Dir::toString); -#endif - } + __QADTypesRegistrator__(); static bool _inited; }; -static __QADTypesRegistrator__ __registrator__; - inline qreal quantize(qreal x, qreal q = 10.f) {return qRound(x / q) * q;} inline QPointF quantize(QPointF x, qreal q = 10.f) {return QPointF(quantize(x.x(), q), quantize(x.y(), q));}