-
Notifications
You must be signed in to change notification settings - Fork 2
/
tablesframe.h
135 lines (109 loc) · 2.44 KB
/
tablesframe.h
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#ifndef TABLESFRAME_H
#define TABLESFRAME_H
#include <QFrame>
#include <QToolButton>
#include <QList>
#include <QThread>
#include "OrderData.h"
#include "redis-cli/redisclient.h"
#include "gridlayoutex.h"
#include "appordersframe.h"
using namespace Redis;
class TablesFrame;
/**
* @brief The KaiTaiDlg class
* 开台对话框,主要是实现,就餐人数和拼桌功能
*
*/
class KaiTaiDlg : public QFrame
{
Q_OBJECT
public:
KaiTaiDlg(QWidget* parent = nullptr);
public:
void resizeEvent(QResizeEvent*) override;
void showEvent(QShowEvent *event) override;
public:
void addTab(const QString& tab) ;
public slots:
void onKeyDown(const QString&);
void onVKeyDown(const QString&);
private:
void kaiTai();
private:
QList<QString> _tabs; //拼桌的量
GridLayoutEx* _layout;
VKeyboardEx* _vkb;
bool _bmergeTab; //是否拼桌
};
class TabPushButton : public QToolButton
{
Q_OBJECT
public:
TabPushButton(const QString& tname, TablesFrame* target, QWidget* parent = nullptr);
public:
inline int getTabId() { return m_tid;}
private slots:
void onClicked();
signals:
void onTabClicked(const QString& tname);
private:
int m_tid;
TablesFrame* m_pWnd;
};
class TableItem {
public:
TableItem() {
id = 0;
satdown = 0;
holdTime = 0;
oid = 0;
btn = nullptr;
name = "";
}
public:
int id;
int satdown;
QString name;
int holdTime;
QString satTime;
//绑定的订单号
int oid; //订单号
public:
TabPushButton* btn;
};
class TablesFrame : public QFrame
{
Q_OBJECT
public:
explicit TablesFrame(QWidget *parent = nullptr);
~TablesFrame() override;
public:
void resizeEvent(QResizeEvent *e) override;
void showEvent(QShowEvent* e) override;
public:
void init();
private:
//台桌信息存入缓存中
void tab2Redis(const QString& tname);
void updateTable(QVariantMap tab);
public:
void updateTables();
int getOrderId(const QString& tabName);
//重置台桌
void resetTable(const QString&);
public slots:
void connected();
void disconnected();
void onReply(const QString& cmd, Reply value);
void onMonitor4TablStatus();
void onTabClicked(const QString& tname);
private:
GridLayoutEx* _layout;
AppOrdersFrame* _appFrm;
KaiTaiDlg* _ktFrm;
QMap<QString, TableItem> m_tables;
public:
RedisClient* _rediscli;
};
#endif // TABLESFRAME_H