玉兔远程控制
0.1.0-bate11
Toggle main menu visibility
载入中...
搜索中...
未找到
Src
ParameterCompone
ParameterSSH.cpp
1
// Author: Kang Lin <kl222@126.com>
2
3
#include "ParameterSSH.h"
4
5
CParameterSSH::CParameterSSH(
CParameterOperate
*parent,
const
QString &szPrefix)
6
:
CParameterOperate
(parent, szPrefix)
7
, m_Net(this)
8
{
9
m_Net.SetPort(22);
10
QList<CParameterUser::TYPE> lstType;
11
lstType << CParameterUser::TYPE::UserPassword
12
<< CParameterUser::TYPE::PublicKey;
13
m_Net.m_User.SetType(lstType);
14
m_Net.SetPrompt(tr(
"The host is empty. please set it"
));
15
}
16
17
int
CParameterSSH::OnLoad(QSettings &set)
18
{
19
SetPcapFile(set.value(
"PacpFile"
, GetPcapFile()).toString());
20
return
0;
21
}
22
23
int
CParameterSSH::OnSave(QSettings &set)
24
{
25
set.setValue(
"PacpFile"
, GetPcapFile());
26
return
0;
27
}
28
29
QString CParameterSSH::GetPcapFile()
const
30
{
31
return
m_pcapFile;
32
}
33
34
int
CParameterSSH::SetPcapFile(
const
QString &szFile)
35
{
36
m_pcapFile = szFile;
37
return
0;
38
}
39
40
CParameterSSHTunnel::CParameterSSHTunnel(
CParameterOperate
*parent,
const
QString &szPrefix)
41
:
CParameterSSH
(parent, szPrefix)
42
, m_szSourceHost(
"localhost"
)
43
, m_nSourcePort(0)
44
{}
45
46
QString CParameterSSHTunnel::GetSourceHost()
const
47
{
48
return
m_szSourceHost;
49
}
50
51
int
CParameterSSHTunnel::SetSourceHost(
const
QString szHost)
52
{
53
m_szSourceHost = szHost;
54
return
0;
55
}
56
57
quint16 CParameterSSHTunnel::GetSourcePort()
const
58
{
59
return
m_nSourcePort;
60
}
61
62
int
CParameterSSHTunnel::SetSourcePort(
const
quint16 nPort)
63
{
64
m_nSourcePort = nPort;
65
return
0;
66
}
67
68
int
CParameterSSHTunnel::OnLoad(QSettings &set)
69
{
70
SetSourceHost(set.value(
"SourceHost"
, GetSourceHost()).toString());
71
SetSourcePort(set.value(
"SourcePort"
, GetSourcePort()).toUInt());
72
return
0;
73
}
74
75
int
CParameterSSHTunnel::OnSave(QSettings &set)
76
{
77
set.setValue(
"SourceHost"
, GetSourceHost());
78
set.setValue(
"SourcePort"
, GetSourcePort());
79
return
0;
80
}
CParameterOperate
操作参数接口。仅在插件内有效。
定义
ParameterOperate.h:210
CParameterSSH
定义
ParameterSSH.h:8
作者:康林 (kl222@126.com)
版权所有(c) 康林工作室 保留所有权力