-
Notifications
You must be signed in to change notification settings - Fork 0
/
connectframe.cpp
58 lines (51 loc) · 2.15 KB
/
connectframe.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
#include "connectframe.h"
#include "ui_connectframe.h"
ConnectFrame::ConnectFrame(QWidget *parent) :
QFrame(parent),
ui(new Ui::ConnectFrame)
{
ui->setupUi(this);
}
ConnectFrame::~ConnectFrame()
{
delete ui;
}
void ConnectFrame::setDevice(QString addr, QString name)
{
if(ui->bl1addr->text().compare("Mac Address 1") == 0){
ui->bl1name->setText(name);
ui->bl1name->setStyleSheet("color: rgb(0, 0, 0);");
ui->bl1addr->setText(addr);
ui->bl1clear->setStyleSheet("border-color: rgba(11, 104, 81, 202);\ncolor: rgb(238, 238, 236);\nbackground-color: rgb(227, 136, 0); border: none;");
} else if(ui->bl2addr->text().compare("Mac Address 2") == 0){
ui->bl2name->setText(name);
ui->bl2name->setStyleSheet("color: rgb(0, 0, 0);");
ui->bl2addr->setText(addr);
ui->bl2clear->setStyleSheet("border-color: rgba(11, 104, 81, 202);\ncolor: rgb(238, 238, 236);\nbackground-color: rgb(227, 136, 0); border: none;");
}
if(ui->bl1addr->text().compare("Mac Address 1") != 0 && ui->bl2addr->text().compare("Mac Address 2") != 0){
ui->connect->setStyleSheet("background-color: rgb(13, 126, 91); color: rgb(238, 238, 236); border: none;");
}
}
void ConnectFrame::on_bl1clear_clicked()
{
ui->bl1name->setText("Bluetooth 1");
ui->bl1name->setStyleSheet("color: rgb(136, 138, 133);");
ui->bl1addr->setText("Mac Address 1");
ui->bl1clear->setStyleSheet("background-color: rgb(136, 138, 133); border: none;");
ui->connect->setStyleSheet("background-color: rgb(136, 138, 133); border: none;");
}
void ConnectFrame::on_bl2clear_clicked()
{
ui->bl2name->setText("Bluetooth 2");
ui->bl2name->setStyleSheet("color: rgb(136, 138, 133);");
ui->bl2addr->setText("Mac Address 2");
ui->bl2clear->setStyleSheet("background-color: rgb(136, 138, 133); border: none;");
ui->connect->setStyleSheet("background-color: rgb(136, 138, 133); border: none;");
}
void ConnectFrame::on_connect_clicked()
{
if(ui->bl2addr->text().compare("Mac Address 2") != 0 && ui->bl1addr->text().compare("Mac Address 1") != 0){
emit bluetoothConnect(ui->bl1addr->text(), ui->bl2addr->text());
}
}