-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathclhandler.cpp
More file actions
42 lines (34 loc) · 831 Bytes
/
clhandler.cpp
File metadata and controls
42 lines (34 loc) · 831 Bytes
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
#include "clhandler.h"
#include <QTextStream>
QTextStream cout(stdout, QIODevice::WriteOnly);
void CLHandler::run()
{
connect(&loader, SIGNAL(output(QString)), this, SLOT(log(QString)));
cout << "> Connecting to port " << portName;
cout.flush();
if(bootPol == "1")
loader.setBootEnablePolarity(true);
else
loader.setBootEnablePolarity(false);
if(loader.open(portName))
loader.upload(filePath);
cout << "\n";
cout.flush();
emit done();
}
void CLHandler::log(const QString &message)
{
static bool firstPercent = true;
if(message.contains("/"))
{
if(firstPercent)
{
cout << "\n";
firstPercent = false;
}
cout << message << "\r";
}
else
cout << "\n> " << message;
cout.flush();
}