forked from jmesquita/esldebugger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconnectdialog.cpp
37 lines (33 loc) · 1.04 KB
/
connectdialog.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
#include "connectdialog.h"
#include "ui_connectdialog.h"
#include "esl_oop.h"
#include <QSocketNotifier>
#include <QDebug>
#include <QSharedPointer>
ConnectDialog::ConnectDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::ConnectDialog)
{
ui->setupUi(this);
m_con = 0;
m_snotifier = 0;
qRegisterMetaType<QSharedPointer<ESLevent> >("QSharedPointer<ESLevent>");
}
ConnectDialog::~ConnectDialog()
{
delete ui;
}
void ConnectDialog::accept()
{
m_con = new ESLconnection(ui->lineHost->text().toAscii().constData(),
QString::number(ui->spinPort->value()).toAscii().constData(),
ui->linePass->text().toAscii().constData());
m_snotifier = new QSocketNotifier(m_con->socketDescriptor(), QSocketNotifier::Read, this);
connect(m_snotifier, SIGNAL(activated(int)), this, SLOT(readyRead()));
m_con->events("plain", "all");
QDialog::accept();
}
void ConnectDialog::readyRead() {
ESLevent *e = m_con->recvEvent();
emit eventReceived(QSharedPointer<ESLevent>(e));
}