-
Notifications
You must be signed in to change notification settings - Fork 0
/
messageframe.cpp
106 lines (98 loc) · 2.37 KB
/
messageframe.cpp
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
#include "messageframe.h"
#include "ui_messageframe.h"
MessageFrame::MessageFrame(QWidget *parent) :
QFrame(parent),
ui(new Ui::MessageFrame)
{
ui->setupUi(this);
}
MessageFrame::~MessageFrame()
{
delete ui;
}
void MessageFrame::packetReceived(packet p, int i)
{
switch (p.app_id) {
case 0:
switch (p.data.menu.currentItem) {
case 1:
if(i == 1){
showMessage(1, "bekle");
}else if(i == 2){
showMessage(1, "cevap ver");
}
break;
default:
break;
}
break;
case 7:
switch (p.data.menu._cursor) {
case 1: // reddet
ui->ok->setChecked(true);
ui->cancel->setChecked(false);
break;
case 2: // kabul et
ui->ok->setChecked(false);
ui->cancel->setChecked(true);
break;
default:
break;
}
emit blSendData(p);
if(p.data.menu.isAccepted == 1){
emit changeUIRequest(p.data.menu.currentItem);
}else if(p.data.menu.isAccepted == 2){
emit changeUIRequest(0);
}
break;
case 6:
break;
case 9:
break;
case 10:
break;
case 11:
break;
case 99:
emit blSendData(p);
changeUIRequest(0);
qDebug() << "RESET REQUEST RECEIVED";
break;
default:
qDebug() << "[MESSAGEFRAME]Unkown appid: " << p.app_id;
break;
}
}
void MessageFrame::showMessage(int type, QString message)
{
switch (type) {
case 6:
ui->title->setText("Oyun İsteği");
ui->ok->setVisible(false);
ui->cancel->setVisible(false);
break;
case 7:
ui->title->setText("Oyun İsteği");
ui->ok->setVisible(true);
ui->cancel->setVisible(true);
break;
case 9:
ui->title->setText("Oyun Sonucu");
ui->ok->setVisible(false);
ui->cancel->setVisible(false);
break;
case 10:
ui->title->setText("Oyun Sonucu");
ui->ok->setVisible(false);
ui->cancel->setVisible(false);
break;
case 11:
ui->title->setText("Oyun Sonucu");
ui->ok->setVisible(false);
ui->cancel->setVisible(false);
break;
}
ui->message->setText(message);
ui->message->setVisible(true);
}