添加DLink,用于把所有的通讯设备都聚到一起管理的一个插件
This commit is contained in:
+35
-39
@@ -36,6 +36,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
nav->addItem(tr("关于"));
|
||||
|
||||
node = new MavLinkNode();
|
||||
//node->start();
|
||||
|
||||
qDebug() << "mainwindow " << QThread::currentThreadId();
|
||||
|
||||
@@ -60,6 +61,9 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
map->close();
|
||||
delete map;
|
||||
|
||||
copk->deleteLater();
|
||||
delete copk;
|
||||
|
||||
@@ -90,52 +94,44 @@ void MainWindow::resizeEvent(QResizeEvent *e)
|
||||
|
||||
void MainWindow::dlink_triggered()
|
||||
{
|
||||
//if(dlink->statesPort())
|
||||
if(dlink->statesPort())
|
||||
{
|
||||
//disconnectdialog dlg(this);
|
||||
disconnectdialog dlg(this);
|
||||
|
||||
//dlg.setWindowTitle(tr("SerialPort"));
|
||||
// dlg.setWindowIcon(ui->action_dlink->icon());
|
||||
|
||||
//int ret = dlg.exec();
|
||||
//if (QDialog::Accepted == ret)
|
||||
{
|
||||
// dlink->stopPort();
|
||||
// statusBar()->showMessage(tr("SerialPort Disconnect"));
|
||||
|
||||
// if(tts->state()==QTextToSpeech::Ready)
|
||||
// {
|
||||
// tts->say("airplane offline");
|
||||
// }
|
||||
}
|
||||
}
|
||||
//else
|
||||
{
|
||||
//ConnectDialog dlg(this);
|
||||
|
||||
//dlg.setWindowTitle(tr("SerialPort"));
|
||||
dlg.setWindowTitle(tr("SerialPort"));
|
||||
//dlg.setWindowIcon(ui->action_dlink->icon());
|
||||
|
||||
//dlg.baudrate = 115200;
|
||||
//dlg.parity = QSerialPort::NoParity;
|
||||
//int ret = dlg.exec();
|
||||
//if (QDialog::Accepted == ret)
|
||||
//{
|
||||
//dlink->setupPort(dlg.port, dlg.baudrate,dlg.parity);
|
||||
int ret = dlg.exec();
|
||||
if (QDialog::Accepted == ret)
|
||||
{
|
||||
dlink->stopPort();
|
||||
// statusBar()->showMessage(tr("SerialPort Disconnect"));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ConnectDialog dlg(this);
|
||||
|
||||
dlg.setWindowTitle(tr("SerialPort"));
|
||||
//dlg.setWindowIcon(ui->action_dlink->icon());
|
||||
|
||||
dlg.baudrate = 115200;
|
||||
dlg.parity = QSerialPort::NoParity;
|
||||
int ret = dlg.exec();
|
||||
if (QDialog::Accepted == ret)
|
||||
{
|
||||
dlink->setupPort(dlg.port, dlg.baudrate,dlg.parity);
|
||||
//statusBar()->showMessage(tr("SerialPort Connected:") + dlg.port + tr(",") + QString::number(dlg.baudrate));
|
||||
|
||||
//if(tts->state()==QTextToSpeech::Ready)
|
||||
//{
|
||||
// tts->say("connect to serial port");
|
||||
//}
|
||||
node->start();
|
||||
|
||||
// node->start();
|
||||
|
||||
//}
|
||||
// else
|
||||
// {
|
||||
// node->stop();
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
node->stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user