You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
3.1 KiB
125 lines
3.1 KiB
#ifndef TRACKBALLCORE_H
|
|
#define TRACKBALLCORE_H
|
|
|
|
#include <QObject>
|
|
#include <QMutex>
|
|
#include <QtXml>
|
|
#include <QMouseEvent>
|
|
#include <QPoint>
|
|
#include <QCursor>
|
|
|
|
#include "model/csm/utils/XmlGraphStateReader.h"
|
|
#include "model/csm/utils/XmlTrackballConfigReader.h"
|
|
#include "model/csm/core/trackballComponent/HidButton.h"
|
|
#include "model/csm/core/trackballComponent/MiceButton.h"
|
|
#include "model/csm/core/trackballComponent/CenterBall.h"
|
|
#include "model/csm/dto/TrackballConfig.h"
|
|
#include "model/csm/type/EConsole.h"
|
|
#include "config/Configuration.h"
|
|
#include "model/csm/dto/HidPacket.h"
|
|
#include "model/ultrasoundModule/UsHelper.h"
|
|
#include "model/csm/core/Hid.h"
|
|
|
|
class Hid;
|
|
|
|
class TrackballCore : public QObject
|
|
{
|
|
Q_OBJECT
|
|
SINGLETON(TrackballCore)
|
|
|
|
private:
|
|
Hid* _hidHandler;
|
|
XmlGraphStateReader* _graphStateReader;
|
|
XmlTrackballConfigReader* _trackballConfigReader;
|
|
|
|
QString _configPath;
|
|
TrackballConfig_t _currentConfig;
|
|
|
|
//mice button
|
|
MiceButton* _middleTop;
|
|
MiceButton* _left;
|
|
MiceButton* _right;
|
|
|
|
//hid button
|
|
HidButton* _topLeft;
|
|
HidButton* _topRight;
|
|
HidButton* _bottomLeft;
|
|
HidButton* _bottomRight;
|
|
HidButton* _middleBottom;
|
|
|
|
//center ball
|
|
CenterBall* _centerBall;
|
|
|
|
QMap<quint8, HidButton*> hidFucitonMap;
|
|
|
|
//state
|
|
EConsole::eTrackballState _currentState;
|
|
|
|
//mode
|
|
EConsole::eTrackballMode _currentMode;
|
|
|
|
//Pointer temp Memory
|
|
QPoint _pointerMemory;
|
|
|
|
QPoint _currentTrackballPos;
|
|
QPoint _trackballPosTemp;
|
|
QPoint _trackballPosDifference;
|
|
|
|
Graph _trackballStateGraph;
|
|
|
|
TrackballCore();
|
|
|
|
void sendCommandForMicePushButton(MiceButton* miceButton, const QMouseEvent* mouseEvent);
|
|
|
|
void trackballModeMiceEventHandler(QEvent* ev);
|
|
|
|
void mouseModeEventHandler(QEvent* ev);
|
|
|
|
void trackballMoveEventHandler(QEvent* ev);
|
|
|
|
void miceButtonPushHandler(MiceButton* miceButton,
|
|
const QMouseEvent* mouseEvent,
|
|
const QString interruptValue);
|
|
|
|
void newInterrupt(EConsole::eCsmInterruptType interrupt, QString value);
|
|
|
|
void readConfigFile();
|
|
|
|
void changeMiceToTrackball();
|
|
|
|
void changeMiceToMouse();
|
|
|
|
QPoint getCursorPosiotion();
|
|
|
|
protected:
|
|
bool event(QEvent*) override;
|
|
|
|
public:
|
|
//virtual bool eventFilter(QObject* object, QEvent* ev) override;
|
|
|
|
void init();
|
|
|
|
TrackballConfig_t getCurrentConfig();
|
|
|
|
void loadConfig(const EConsole::eTrackballState tracballState);
|
|
void refreshAndSendConfig();
|
|
void clearConfig();
|
|
void configFiller(const EConsole::eTrackballItem item,
|
|
const QString text,
|
|
const bool enable = true,
|
|
const bool active = true);
|
|
void setTrackballState(EConsole::eTrackballState state);
|
|
void swapMode();
|
|
|
|
signals:
|
|
void sendConfigToCsmModule(TrackballConfig_t config);
|
|
void sendCommandToCsmModule(CommandControl_t command);
|
|
//uncrustify off
|
|
public slots:
|
|
//uncrustify on
|
|
void reciveEvents(QMouseEvent* ev);
|
|
void recievePush(HidPacket_t data);
|
|
void recieveChangeTrackballState(EConsole::eCsmInterruptType interruptType, QString value);
|
|
};
|
|
|
|
#endif //TRACKBALLCORE_H
|
|
|