Rabbit Remote Control
0.1.0-bate14
Toggle main menu visibility
Loading...
Searching...
No Matches
Src
DlgUserPassword.cpp
1
// Author: Kang Lin <kl222@126.com>
2
3
#include "DlgUserPassword.h"
4
#include "ui_DlgUserPassword.h"
5
#include <QLoggingCategory>
6
7
static
Q_LOGGING_CATEGORY(log,
"Client.DlgUserPassword"
)
8
9
static
int
g_CDlgUserPassword = qRegisterMetaType<
CDlgUserPassword
>();
10
11
CDlgUserPassword
::
CDlgUserPassword
(QWidget *parent)
12
: QDialog(parent)
13
, ui(new
Ui
::
CDlgUserPassword
)
14
, m_pUser(
nullptr
)
15
{
16
ui->setupUi(
this
);
17
setWindowTitle(tr(
"Set user and password"
));
18
}
19
20
CDlgUserPassword::~CDlgUserPassword()
21
{
22
delete
ui;
23
}
24
25
CDlgUserPassword::CDlgUserPassword(
const
CDlgUserPassword
&other)
26
{
27
m_pUser = other.m_pUser;
28
}
29
30
void
CDlgUserPassword::SetContext(
void
*pContext)
31
{
32
auto
pNet = (CParameterNet*)pContext;
33
if
(!pNet) {
34
qCritical(log) <<
"The pContext is null"
;
35
return
;
36
}
37
m_pUser = &pNet->m_User;
38
ui->lbText->setText(windowTitle() +
"\n"
+ tr(
"Server: "
)
39
+ pNet->GetHost()
40
+
":"
+ QString::number(pNet->GetPort()));
41
ui->wUser->SetParameter(m_pUser);
42
}
43
44
int
CDlgUserPassword::SetUser(
const
QString &szPrompt,
CParameterUser
* pUser)
45
{
46
m_pUser = pUser;
47
ui->lbText->setText(szPrompt);
48
ui->wUser->SetParameter(m_pUser);
49
return
0;
50
}
51
52
void
CDlgUserPassword::accept()
53
{
54
if
(!m_pUser) {
55
qCritical(log) <<
"The pContext is null"
;
56
return
;
57
}
58
ui->wUser->Accept();
59
emit m_pUser->
sigChanged
();
60
QDialog::accept();
61
}
CDlgUserPassword
Definition
DlgUserPassword.h:13
CParameterUser
It contains user and password It only valid in plugin.
Definition
ParameterUser.h:23
CParameter::sigChanged
void sigChanged()
emit when the parameter changes Usually if required, the corresponding parameter corresponds to a cha...
Ui
Definition
FrmFullScreenToolBar.h:14
Author: Kang Lin (kl222@126.com)
Copyright (c) Kang Lin Studios All Rights Reserved