-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathterminal.h
executable file
·71 lines (64 loc) · 1.73 KB
/
terminal.h
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
#ifndef TERMINAL_H
#define TERMINAL_H
#define WRITE_FILE_CHUNK_SIZE 1000
#define READ_FILE_CHUNK_SIZE 1000
#define TIME_TO_WRITE 300
#include <QWidget>
#include <QSerialPort>
#include <QMutex>
#include <QFileSystemModel>
#include <QTimer>
namespace Ui {
class Terminal;
}
class Terminal : public QWidget
{
Q_OBJECT
public:
explicit Terminal(QWidget *parent = 0);
~Terminal();
QString get_target_current_dir();
signals:
void connected(QString portName, bool state = false);
void sendScannedTargetFiles(QStringList items, QStringList icons);
void update_target_dir(QString dir);
void port_connected(bool c);
void targetFileOpened(QString file, QString content);
void update_file_status(int value);
public slots:
void openTargetFile(QString file);
void writeData(const QByteArray &data);
void chdir(QString dir);
void saveTargetFile(QString path, QByteArray content);
void createTargetDir(QString path);
void transferFileToTarget(QString fileName, QByteArray content);
void deleteTargetFile(QString fileName);
void deleteTargetDir(QString dirName);
QString pwd();
private slots:
void cancelar();
void on_pushButton_clicked();
void readData();
void on_pushButton_3_clicked();
void scan_ports();
void open_port();
void close_port();
void scanTargetFileSystem();
void on_pushButton_2_clicked();
void targetDirChanged(QString dir);
void killCom();
private:
QSerialPort *port;
int readDelay;
Ui::Terminal *ui;
QMutex mutex;
bool toConsole;
bool kill;
bool idle;
QByteArray internalData;
QByteArray auxInternalData;
QFileSystemModel *tfs;
QString targetCurrentDir;
QTimer *toTimer;
};
#endif // TERMINAL_H