1#include "DlgSettingsSSH.h"
2#include "ui_DlgSettingsSSH.h"
3#include "RabbitCommonDir.h"
4#include <QStandardPaths>
6CDlgSettingsSSH::CDlgSettingsSSH(
CParameterSSH *pPara, QWidget *parent) :
14 ui->leName->setText(m_pPara->GetName());
15 ui->leHost->setText(m_pPara->GetHost());
16 ui->spPort->setValue(m_pPara->GetPort());
17 ui->cbSavePassword->setChecked(m_pPara->GetSavePassword());
18 ui->leUser->setText(m_pPara->GetUser());
19 ui->lePassword->setText(m_pPara->GetPassword());
21 ui->leCapFile->setText(m_pPara->captrueFile);
23 m_pFrmParaAppearance =
25 if(m_pFrmParaAppearance)
26 ui->tabWidget->addTab(m_pFrmParaAppearance,
27 m_pFrmParaAppearance->windowTitle());
29 if(m_pFrmParaBehavior)
30 ui->tabWidget->addTab(m_pFrmParaBehavior, m_pFrmParaBehavior->windowTitle());
33CDlgSettingsSSH::~CDlgSettingsSSH()
38void CDlgSettingsSSH::on_pbOK_clicked()
40 m_pPara->SetName(ui->leName->text());
41 m_pPara->SetHost(ui->leHost->text());
42 m_pPara->SetPort(ui->spPort->value());
43 m_pPara->SetSavePassword(ui->cbSavePassword->isChecked());
44 m_pPara->SetUser(ui->leUser->text());
45 m_pPara->SetPassword(ui->lePassword->text());
47 m_pPara->captrueFile = ui->leCapFile->text();
49 if(m_pFrmParaAppearance)
50 m_pFrmParaAppearance->AcceptSettings();
51 if(m_pFrmParaBehavior)
52 m_pFrmParaBehavior->AcceptSettings();
57void CDlgSettingsSSH::on_pbCancel_clicked()
62void CDlgSettingsSSH::on_pbCapFileBrowser_clicked()
64 ui->leCapFile->setText(
65 RabbitCommon::CDir::Instance()->GetSaveFileName(
this,
67 QStandardPaths::writableLocation(QStandardPaths::TempLocation)
68 + QDir::separator() +
"capfile.dat"));
71void CDlgSettingsSSH::on_leHost_editingFinished()
73 auto s = ui->leHost->text().split(
":");
76 ui->spPort->setValue(s[1].toUInt());
77 ui->leHost->setText(s[0]);