#ifndef BUTTON_H #define BUTTON_H #include #include #include #include "model/csm/core/consoleComponent/ControlAbstract.h" /*****************************************************************************/ /** * @brief Button Class, this class is a part of console button * @author Mohammad Mohsen Talaie * @details * @date 12 Jan 2021 */ /*****************************************************************************/ class Button : public ControlAbstract { private: bool _down; QMutex _downLoker; QElapsedTimer _timer; QList _currentCommandList; QList _longPressCommands; QList _commonLongPressCommands; QMap > _longPressCommandListBasedOnState; bool _longPressEnable; public: Button() { } QList getCommandList(const EConsole::eConsoleState& consoleState) override; QList getLongPressCommandList(const EConsole::eConsoleState& consoleState); EConsole::eControlType getType() const override; void loadLongPressCommands(const EConsole::eConsoleState& consoleState); void enable() override; void disable() override; void appendCommonLongPressCommandList(const CommandControl_t& commandControl); void appendLongPressCommandListBasedOnConsoleState(const QString& consoleState, const CommandControl_t& commandControl); //start timer void keyDown(); //calculate timer between down and up long keyUp(); bool isDown() const; bool hasLongPress() const; bool hasTimeOutExpired(const long& timeOut); }; #endif //BUTTON_H