-
Notifications
You must be signed in to change notification settings - Fork 0
/
slots.cpp
134 lines (131 loc) · 3.4 KB
/
slots.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#include "uiTest.h"
#include <QMessageBox>
#include <QLabel>
#include <math.h>
#include <QFileDialog>
#include <QtCore/QTextStream>
#include <QTime>
void uiTest::slotSerialPortTestInit()
{
QString name = "COM6";
serialPortInit(serialPortTest, &name);
}
void uiTest::slotSerialPortClose()
{
QString name = ui.comboBox_2->currentText();
QString str;
serialPortClose(serialPort, &name);
currentTime = QTime::currentTime();
str = "serial port is closed " + currentTime.toString("hh:mm:ss");
ui.textBrowser->append(str);
ui.pushButton_2->setDisabled(true);
}
void uiTest::slotSerialPortSendData()
{
QString s = "OK";
ui.pushButton_2->setDisabled(true);
ui.pushButton_4->setEnabled(true);
serialSendData(serialPort, &s);
}
void uiTest::slotSerialPortInit()
{
QString name = ui.comboBox_2->currentText();
serialPortInit(serialPort, &name);
if (serialPort->isOpen() == true)
{
ui.pushButton_2->setEnabled(true);
}
}
void uiTest::slotControlInput()
{
if (ui.checkBox->isChecked() == true)
{
ui.lineEdit->setEnabled(false);
ui.lineEdit_2->setEnabled(false);
ui.lineEdit_3->setEnabled(false);
ui.lineEdit_4->setEnabled(false);
ui.pushButton_6->setEnabled(false);
ui.lineEdit_5->setEnabled(true);
ui.pushButton_5->setEnabled(true);
}
else
{
ui.lineEdit->setEnabled(true);
ui.lineEdit_2->setEnabled(true);
ui.lineEdit_3->setEnabled(true);
ui.lineEdit_4->setEnabled(true);
ui.pushButton_6->setEnabled(true);
ui.lineEdit_5->setEnabled(false);
ui.pushButton_5->setEnabled(false);
}
}
void uiTest::slotTest2()
{
QMessageBox::about(NULL, "Message", "Close");
}
void uiTest::slotOpenFile()
{
}
void uiTest::slotSaveFile()
{
QString s1;
int choose;
//s1 = QString("%1").arg(firstAxisA);
s1 = CN("主轴幅值")+" " + QString("%1").arg(firstAxisA) + " "+CN("主轴频率") +" "+QString("%1").arg(firstAxisF)
+ " " + CN("副轴幅值") + " " + QString("%1").arg(secondAxisA) + " " + CN("副轴频率") + " " + QString("%1").arg(secondAxisF);
choose=QMessageBox::question(this, CN("保存"), CN("是否保存该工况?"), QMessageBox::Yes | QMessageBox::No);
if (choose == QMessageBox::Yes)
{
saveFileAsTxt(s1);
}
}
void uiTest::slotViewCurve()
{
if (ui.checkBox->isChecked() == false)
{
firstAxisA = ui.lineEdit->text().toFloat();
firstAxisF = ui.lineEdit_2->text().toFloat();
secondAxisA = ui.lineEdit_3->text().toFloat();
secondAxisF = ui.lineEdit_4->text().toFloat();
showCurve();
}
else
{
GKNumber = ui.lineEdit_5->text().toInt();
setGKNumber();
ui.lineEdit->setText(QString::number(firstAxisA));
ui.lineEdit_2->setText(QString::number(firstAxisF));
ui.lineEdit_3->setText(QString::number(secondAxisA));
ui.lineEdit_4->setText(QString::number(secondAxisF));
showCurve();
}
}
void uiTest::slotChangeGKPram()
{
firstAxisA = ui.lineEdit->text().toFloat();
firstAxisF = ui.lineEdit_2->text().toFloat();
secondAxisA = ui.lineEdit_3->text().toFloat();
secondAxisF = ui.lineEdit_4->text().toFloat();
}
void uiTest::slotSelectGKFile()
{
openFileAsTxt(GKNumber);
}
void uiTest::slotSelectGKNumber()
{
GKNumber = ui.lineEdit_5->text().toInt();
GKNumber = ui.lineEdit_5->text().toInt();
//QMessageBox::about(NULL, "OK", "OK");
}
void uiTest::slotStopSys()
{
if (serialPort->isOpen() == true)
{
QMessageBox::about(this, "about", "OK");
ui.pushButton_2->setEnabled(true);
ui.pushButton_4->setDisabled(true);
QString strData = "{s}";
QByteArray byteData = strData.toLatin1();
serialPort->write(byteData);
}
}