-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuploadwindow.cpp
87 lines (75 loc) · 2.59 KB
/
uploadwindow.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
#include "uploadwindow.h"
extern double xscale;
extern double yscale;
UploadWindow::UploadWindow(QWidget *parent, QString mode)
:PostureWindow(parent), m_sHandMode(mode)
{
BuildBottomRight();
CloseFuncs();
}
UploadWindow::~UploadWindow()
{
}
void UploadWindow::BuildBottomRight()
{
switch (m_sHandMode.toInt())
{
case 0: case 2:default:
m_uwUpload = new UploadWidget(m_qwBottomRight, TWO_HANDS);
break;
case 1:
m_uwUpload = new UploadWidget(m_qwBottomRight, TWO_HANDS_OBJECT);
break;
}
m_uwUpload->setObjectName("upload");
m_uwUpload->setFixedSize(UPLOADWIDGET_W*xscale, UPLOADWIDGET_H*yscale);
if (m_sHandMode == "1")
{
m_qlCardMsg = new QLabel("Is card captured: false", m_qwBottomRight);
m_qlCardMsg->setStyleSheet(QString("color: #FF7189;font-family:'Myriad Pro Light SemiExt';font-weight:bold;font-size:16pt;}"));
m_qlCardMsg->setMinimumWidth(800 * xscale);
connect(m_uwUpload, SIGNAL(cardMsg(bool)), this, SLOT(displayCardMsg(bool)));
}
m_qpbStop = new QPushButton("Stop", m_qwBottomRight);
m_qpbStop->setObjectName("detail");
m_qpbStop->setFixedSize(DETAIL_W*xscale, DETAIL_H*yscale);
m_qpbCancel = new QPushButton("Cancel", m_qwBottomRight);
m_qpbCancel->setObjectName("detail");
m_qpbCancel->setFixedSize(DETAIL_W*xscale, DETAIL_H*yscale);
connect(m_qpbStop, SIGNAL(clicked()), m_uwUpload, SLOT(stop()));
connect(m_qpbStop, SIGNAL(clicked()), this, SLOT(upload()));
connect(m_qpbCancel, SIGNAL(clicked()), m_uwUpload, SLOT(stop()));
connect(m_qpbCancel, SIGNAL(clicked()), this, SIGNAL(toUpload()));
connect(m_uwUpload, SIGNAL(msg(const QString&)), this, SLOT(msg(const QString&)));
QVBoxLayout *mainLayout = new QVBoxLayout();
mainLayout->addStretch();
mainLayout->addWidget(m_uwUpload, 0, Qt::AlignCenter);
if (m_sHandMode == "1")
mainLayout->addWidget(m_qlCardMsg, 0, Qt::AlignCenter);
QHBoxLayout *buttonLayout = new QHBoxLayout();
buttonLayout->addStretch();
buttonLayout->addWidget(m_qpbStop);
buttonLayout->addWidget(m_qpbCancel);
buttonLayout->addStretch();
mainLayout->addLayout(buttonLayout);
mainLayout->addStretch();
m_qwBottomRight->setLayout(mainLayout);
}
void UploadWindow::upload()
{
emit toUploadInfo(m_sHandMode);
}
void UploadWindow::msg(const QString &message)
{
m_uwUpload->close();
m_qmbMsg = new QMessageBox(this);
m_qmbMsg->setText(message);
m_qmbMsg->setWindowModality(Qt::WindowModal);
m_qmbMsg->show();
connect(m_qmbMsg, SIGNAL(buttonClicked(QAbstractButton*)), this, SIGNAL(toUpload()));
}
void UploadWindow::displayCardMsg(bool isCardCaptured)
{
m_qlCardMsg->setText(QString("Is card captured: %1").arg(isCardCaptured));
update();
}