-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuploadwidget.cpp
77 lines (63 loc) · 1.34 KB
/
uploadwidget.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
#include "uploadwidget.h"
UploadWidget::UploadWidget(QWidget *parent, CAPTURE_MODE mode)
:QGLWidget(parent), m_cmMode(mode)
{
m_cmCaptureManager = new CaptureManager(mode);
m_pTimer = new QTimer(this);
m_pTimer->start(30);
//connect(m_pTimer, SIGNAL(timeout()), this, SLOT(start()));
connect(m_pTimer, SIGNAL(timeout()), this, SLOT(updateGL()));
}
UploadWidget::~UploadWidget()
{
//delete m_cmCaptureManager;
m_cmCaptureManager->Close();
}
void UploadWidget::initializeGL()
{
try
{
if (m_cmCaptureManager->Init() != PXC_STATUS_NO_ERROR)
throw "error in init";
else
m_cmCaptureManager->Start();
}
catch (char *str)
{
m_cmCaptureManager->SetFlag(1);
emit msg(str);
return;
}
}
void UploadWidget::resizeGL(int width, int height)
{
const float ar = (float)width / (float)height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(100.f, ar, 0.1f, 1000.f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
void UploadWidget::paintGL()
{
m_cmCaptureManager->Draw();
if (m_cmMode == TWO_HANDS_OBJECT)
emit cardMsg(m_cmCaptureManager->GetCardCaptured());
}
void UploadWidget::stop()
{
m_cmCaptureManager->Stop();
}
void UploadWidget::Close()
{
m_cmCaptureManager->Close();
}
void UploadWidget::Start()
{
m_cmCaptureManager->Restart();
}
void UploadWidget::cancel()
{
Close();
}