Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
DlgGetUserPasswordVNC.cpp
1#include "DlgGetUserPasswordVNC.h"
2#include "ui_DlgGetUserPasswordVNC.h"
3#include <QLoggingCategory>
4
5static Q_LOGGING_CATEGORY(log, "VNC.Dialog.GetPassword")
6
7static int g_CDlgGetPasswordVNC = qRegisterMetaType<CDlgGetPasswordVNC>();
8
10 QDialog(parent),
11 ui(new Ui::CDlgGetPasswordVNC),
12 m_pConnecter(nullptr),
13 m_pParameter(nullptr)
14{
15 ui->setupUi(this);
16}
17
18CDlgGetPasswordVNC::~CDlgGetPasswordVNC()
19{
20 delete ui;
21}
22
23CDlgGetPasswordVNC::CDlgGetPasswordVNC(const CDlgGetPasswordVNC& dlg)
24{
25 m_pConnecter = dlg.m_pConnecter;
26 m_pParameter = dlg.m_pParameter;
27}
28
29void CDlgGetPasswordVNC::SetContext(void *pContext)
30{
31}
32
33void CDlgGetPasswordVNC::SetConnecter(CConnecter *pConnecter)
34{
35 Q_ASSERT(pConnecter);
36 qDebug(log) << "class name:" << pConnecter->metaObject()->className();
37 m_pConnecter = qobject_cast<CConnecterVnc*>(pConnecter);
38 Q_ASSERT(m_pConnecter);
39 if(!m_pConnecter) {
40 qCritical(log) << "The connecter is nullptr";
41 return;
42 }
43
44 m_pParameter = qobject_cast<CParameterVnc*>(m_pConnecter->GetParameter());
45 if(!m_pParameter) {
46 qCritical(log) << "The m_pParameter is nullptr";
47 return;
48 }
49
50 ui->lbText->setText(tr("Set password for %1").arg(m_pConnecter->Name()));
51 ui->wUser->SetParameter(&m_pParameter->m_Net.m_User);
52}
53
54void CDlgGetPasswordVNC::on_pbOK_clicked()
55{
56 if(!m_pParameter) {
57 qCritical(log) << "The m_pParameter is nullptr";
58 return;
59 }
60 ui->wUser->Accept();
61 emit m_pParameter->sigChanged();
62 accept();
63}
64
65void CDlgGetPasswordVNC::on_pbCancel_clicked()
66{
67 reject();
68}
virtual CParameterBase * GetParameter()
Get parameter.
virtual const QString Name() override
Display order:
Connecter interface.
Definition Connecter.h:62
CParameterUser m_User
[Instance user]
void sigChanged()
emit when the parameter changes Usually if required, the corresponding parameter corresponds to a cha...