Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
DlgSettingsTelnet.cpp
1#include "DlgSettingsTelnet.h"
2#include "ui_DlgSettingsTelnet.h"
3
4CDlgSettingsTelnet::CDlgSettingsTelnet(CParameterTerminal *pPara, QWidget *parent) :
5 QDialog(parent),
6 ui(new Ui::CDlgSettingsTelnet),
7 m_pPara(pPara)
8{
9 ui->setupUi(this);
10
11 ui->leName->setText(m_pPara->GetName());
12 ui->leHost->setText(m_pPara->GetHost());
13 ui->spPort->setValue(m_pPara->GetPort());
14
15 m_pFrmParaAppearance =
17 if(m_pFrmParaAppearance)
18 ui->tabWidget->addTab(m_pFrmParaAppearance,
19 m_pFrmParaAppearance->windowTitle());
20
21 m_pFrmParaBehavior = new CFrmParameterTerminalBehavior(m_pPara, this);
22 if(m_pFrmParaBehavior)
23 ui->tabWidget->addTab(m_pFrmParaBehavior, m_pFrmParaBehavior->windowTitle());
24}
25
26CDlgSettingsTelnet::~CDlgSettingsTelnet()
27{
28 delete ui;
29}
30
31void CDlgSettingsTelnet::on_pbOK_clicked()
32{
33 m_pPara->SetName(ui->leHost->text());
34 m_pPara->SetHost(ui->leHost->text());
35 m_pPara->SetPort(ui->spPort->value());
36
37 if(m_pFrmParaAppearance)
38 m_pFrmParaAppearance->AcceptSettings();
39 if(m_pFrmParaBehavior)
40 m_pFrmParaBehavior->AcceptSettings();
41 this->accept();
42}
43
44void CDlgSettingsTelnet::on_pbCancel_clicked()
45{
46 this->reject();
47}
48
49void CDlgSettingsTelnet::on_leHost_editingFinished()
50{
51 auto s = ui->leHost->text().split(":");
52 if(s.size() == 2)
53 {
54 ui->spPort->setValue(s[1].toUInt());
55 ui->leHost->setText(s[0]);
56 }
57}