Index: sources/main.h =================================================================== diff -u -r14c541d2b780b0a244bc84860aa565cf8dd7fe4b -rf688ed9f1c64a2603a6d10fbb090b257a43e1f6f --- sources/main.h (.../main.h) (revision 14c541d2b780b0a244bc84860aa565cf8dd7fe4b) +++ sources/main.h (.../main.h) (revision f688ed9f1c64a2603a6d10fbb090b257a43e1f6f) @@ -5,11 +5,11 @@ * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * - * \file main.h - * \author (last) Peter Lucia - * \date (last) 15-Oct-2020 - * \author (original) Behrouz NematiPour - * \date (original) 28-Oct-2019 + * \file main.h + * \author (last) Behrouz NematiPour + * \date (last) 31-Mar-2021 + * \author (original) Behrouz NematiPour + * \date (original) 28-Oct-2019 * */ #pragma once @@ -19,6 +19,14 @@ #include // Project +// Application +#define PRINT_THREAD_NAME_ENABLE 0 +#if (PRINT_THREAD_NAME_ENABLE) + #define PRINT_THREAD_NAME qDebug() << " ----- " << QThread::currentThread()->objectName() << __func__ ; +#else + #define PRINT_THREAD_NAME +#endif + // TODO : A singleton parent class needs to be created // to taking care of the Threading, init, quit, and so @@ -64,7 +72,7 @@ the notify signal (...Changed) passes the new value as its parameter. \n \param new value */\ - void vVARIABLE ( const vTYPE & v##vVARIABLE ) { \ + void vVARIABLE ( const vTYPE & v##vVARIABLE ) { \ static bool init = false; \ if ( !init || _##vVARIABLE != v##vVARIABLE ) { \ DEBUG_PROPERTY_CHANGED(vVARIABLE, v) \ @@ -89,6 +97,24 @@ emit vVARIABLE##Triggered( _##vVARIABLE ); \ } //--------------------------------------------------------------------------------// +#define STATE_SLOT( vTYPE , vVARIABLE ) \ + protected : \ + /*! \brief Property setter + \details The property setter which update the private variable \n + - if only the value has been changed \n + emits the Property notify (...Entered) signal on update. \n + the notify signal (...Entered) passes the new value as its parameter. \n + \param new value + */\ + void vVARIABLE ( const vTYPE & v##vVARIABLE ) { \ + if ( _##vVARIABLE != v##vVARIABLE ) { \ + DEBUG_PROPERTY_CHANGED(vVARIABLE, v) \ + _##vVARIABLE = v##vVARIABLE; \ + emit vVARIABLE##Entered( _##vVARIABLE ); \ + } \ + } + +//--------------------------------------------------------------------------------// #define PROPERTY_BASE(vTYPE , vVARIABLE , vDEFVALUE, vSIGNAL) \ /*! \brief Qt Property declaration \details The Qt Property definition by Q_PROPERTY documentation. @@ -125,8 +151,13 @@ #define TRIGGER( vTYPE , vVARIABLE , vDEFVALUE ) \ \ PROPERTY_BASE( vTYPE , vVARIABLE , vDEFVALUE , Triggered) \ - TRIGGER_SLOT( vTYPE , vVARIABLE) + TRIGGER_SLOT ( vTYPE , vVARIABLE) //--------------------------------------------------------------------------------// +#define STATE( vTYPE , vVARIABLE , vDEFVALUE ) \ + \ + PROPERTY_BASE( vTYPE , vVARIABLE , vDEFVALUE , Entered ) \ + STATE_SLOT ( vTYPE , vVARIABLE) +//--------------------------------------------------------------------------------// #define CONSTANT( vTYPE , vVARIABLE , vDEFVALUE ) \ /*! \brief Qt Constant Property declaration \details The Qt Property definition by Q_PROPERTY documentation.