forked from AgoraIO/Basic-Video-Call
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnettestdetail.cpp
80 lines (68 loc) · 2.03 KB
/
nettestdetail.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
#include "nettestdetail.h"
#include "ui_nettestdetail.h"
#include "agorawindowmanager.h"
#include <QString>
NetTestDetail::NetTestDetail(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::NetTestDetail)
{
ui->setupUi(this);
this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint);
this->setAttribute(Qt::WA_TranslucentBackground);
AgoraWindowManager::getInstance()->insertItem(qWndType_NetTestDetail,this);
}
NetTestDetail::~NetTestDetail()
{
delete ui;
}
void NetTestDetail::receiver_network_detail(int quality,const LastmileProbeResult& lr)
{
qDebug(__FUNCTION__);
ui->lb_rtt_up->setText(QString::number(lr.rtt));
ui->lb_lost_up->setText(QString::number(lr.uplinkReport.packetLossRate));
ui->lb_lost_down->setText(QString::number(lr.downlinkReport.packetLossRate));
ui->lb_bandwidth_up->setText(QString::number(lr.uplinkReport.availableBandwidth));
ui->lb_bandwidth_down->setText(QString::number(lr.downlinkReport.availableBandwidth));
}
void NetTestDetail::mousePressEvent(QMouseEvent *e)
{
if(e->button() == Qt::LeftButton) {
m_mousePosition = e->pos();
if(m_mousePosition.x() < lnTitleWidth &&
m_mousePosition.x() >= lnGapWidth &&
m_mousePosition.y() >= lnGapHeight &&
m_mousePosition.y() < lnTitleHeight)
m_bMousePressed = true;
}
}
void NetTestDetail::mouseMoveEvent(QMouseEvent *e)
{
if(m_bMousePressed == true) {
QPoint movePos = e->globalPos() - m_mousePosition;
move(movePos);
e->accept();
}
}
void NetTestDetail::mouseReleaseEvent(QMouseEvent *e)
{
m_bMousePressed = false;
}
void NetTestDetail::on_btn_back_clicked()
{
this->hide();
QMainWindow* pWnd = AgoraWindowManager::getInstance()->getQWnd(qWndType_OpenVideoCall);
if(pWnd)
pWnd->show();
}
void NetTestDetail::on_btn_min_clicked()
{
this->showMinimized();
}
void NetTestDetail::on_btn_close_clicked()
{
on_btn_back_clicked();
}
void NetTestDetail::on_btn_ok_clicked()
{
on_btn_back_clicked();
}