blob: 98a59c1043b80143a632ba4939ac2efe63b6a65f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#ifndef QMAP_DECODE_CLICK_COALESCER_H
#define QMAP_DECODE_CLICK_COALESCER_H
#include <functional>
#include <QByteArray>
#include <QString>
#include <QTimer>
class QObject;
enum class DecodeClickGesture
{
Press,
SingleClick,
DoubleClick,
};
class DecodeClickCoalescer
{
public:
using Dispatch = std::function<void (QByteArray const&, DecodeClickGesture)>;
DecodeClickCoalescer (QObject * context, Dispatch dispatch, int interval = -1);
void press (QString const& identity, QByteArray const& decodeRow);
void doubleClick (QString const& identity, QByteArray const& decodeRow);
private:
void dispatchPending ();
Dispatch dispatch_;
QTimer timer_;
QString pendingIdentity_;
QByteArray pending_;
};
#endif // QMAP_DECODE_CLICK_COALESCER_H
|