-
Notifications
You must be signed in to change notification settings - Fork 0
/
mythread.h
40 lines (31 loc) · 812 Bytes
/
mythread.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
#ifndef MYTHREAD_H
#define MYTHREAD_H
#include "mainwindow.h"
#define DEFAULT_PORT 80
#define DEFAULT_IP 127<<24|1
#define DEFAULT_PATH "./"
#define THREAD_ERROR -1
class MyThread : public QThread
{
Q_OBJECT
public:
MyThread(MainWindow* parent=0,int ip = DEFAULT_IP, int port = DEFAULT_PORT, QString path = DEFAULT_PATH) : QThread(parent){
this->parent = parent;
this->ip = ip;
this->port = port;
this->path = path;
connect(this, SIGNAL(myprint(QString)), parent, SLOT(append_cosole(QString)));
}
virtual ~MyThread() {}
MainWindow * parent;
virtual void run();
int ip;
int port;
SOCKET sListen, sAccept;
QString path;
signals:
void myprint(QString text);
public slots:
void get_ip(int ip);
};
#endif // MYTHREAD_H