Browse Source

Add probe slot button that get the isEnables of the probe slot states.

develop
miladS 9 months ago
parent
commit
7c3de270ee
  1. 3
      logic/include/model/ButtonHelper.h
  2. 8
      logic/include/viewModel/MainViewModel.h
  3. 17
      logic/include/viewModel/utils/Property.h

3
logic/include/model/ButtonHelper.h

@ -34,10 +34,11 @@ private: \
SIGNAL(SMALL_NAME ## LedChanged(char))); \
} \
public: \
void press ## CAPITAL_NAME() \
void press ## CAPITAL_NAME(bool isEnable1) \
{ \
auto arr = _ ## SMALL_NAME.press(); \
arr[5] = static_cast<char>(this->selectedProbe ## SLOT_NUMBER); \
arr[6] = isEnable1 ? 1 : 0; \
_dataSender->sendProbeSlots(arr); \
emit changeProbeSelectionEnable ## SLOT_NUMBER(); \
} \

8
logic/include/viewModel/MainViewModel.h

@ -21,10 +21,10 @@ class MainViewModel : public QtMvvm::ViewModel
MVVM_PROPERTY(int, stepDec, -1)
//Probes
BUTTON_LED_PROPERTY(slot1, Slot1, false, LED_COLOR_GREEN)
BUTTON_LED_PROPERTY(slot2, Slot2, false, LED_COLOR_WHITE)
BUTTON_LED_PROPERTY(slot3, Slot3, false, LED_COLOR_WHITE)
BUTTON_LED_PROPERTY(slot4, Slot4, false, LED_COLOR_WHITE)
BUTTON_SLOT_LED_PROPERTY(slot1, Slot1, false, LED_COLOR_GREEN, 1)
BUTTON_SLOT_LED_PROPERTY(slot2, Slot2, false, LED_COLOR_WHITE, 2)
BUTTON_SLOT_LED_PROPERTY(slot3, Slot3, false, LED_COLOR_WHITE, 3)
BUTTON_SLOT_LED_PROPERTY(slot4, Slot4, false, LED_COLOR_WHITE, 4)
MVVM_PROPERTY(QList<QVariant>, probeList, {})

17
logic/include/viewModel/utils/Property.h

@ -38,6 +38,11 @@
LED_PROPERTY(NAME, LED_DEF_VAL) \
BUTTON_PROPERTY(NAME, CAP_NAME, DEFAULT_VALUE)
/**************************************************************************************************/
#define BUTTON_SLOT_LED_PROPERTY(NAME, CAP_NAME, DEFAULT_VALUE, LED_DEF_VAL, SLOT_NUMBER) \
LED_PROPERTY(NAME, LED_DEF_VAL) \
BUTTON_SLOT_PROPERTY(NAME, CAP_NAME, DEFAULT_VALUE, SLOT_NUMBER)
/**************************************************************************************************/
#define BUTTON_PROPERTY(NAME, CAP_NAME, DEFAULT_VALUE) \
MVVM_PROPERTY_CUSTOM(bool, NAME, DEFAULT_VALUE) \
@ -50,6 +55,18 @@
} \
} \
/**************************************************************************************************/
#define BUTTON_SLOT_PROPERTY(NAME, CAP_NAME, DEFAULT_VALUE, SLOT_NUMBER) \
MVVM_PROPERTY_CUSTOM(bool, NAME, DEFAULT_VALUE) \
void NAME ## Handle() { \
if(_ ## NAME){ \
panel->press ## CAP_NAME(isProbeSelectionEnable ## SLOT_NUMBER()); \
} \
else { \
panel->release ## CAP_NAME(); \
} \
} \
/**************************************************************************************************/
#define LED_PROPERTY(NAME, LED_DEF_VAL) \
MVVM_PROPERTY(int, NAME ## Led, LED_DEF_VAL) \

Loading…
Cancel
Save