Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
DlgLibVNCServerPassword.cpp
1#include "DlgLibVNCServerPassword.h"
2#include "ui_DlgLibVNCServerPassword.h"
3#include <QLoggingCategory>
4
5static Q_LOGGING_CATEGORY(log, "LibVNCServer.Dialog.GetPassword")
6
7static int g_CDlgGetUserPassword = qRegisterMetaType<CDlgLibVNCServerPassword>();
8
10 QDialog(parent),
12 m_pConnecter(nullptr),
13 m_pParameter(nullptr)
14{
15 ui->setupUi(this);
16}
17
18CDlgLibVNCServerPassword::~CDlgLibVNCServerPassword()
19{
20 delete ui;
21}
22
23CDlgLibVNCServerPassword::CDlgLibVNCServerPassword(const CDlgLibVNCServerPassword& dlg)
24{
25 m_pConnecter = dlg.m_pConnecter;
26 m_pParameter = dlg.m_pParameter;
27}
28
29void CDlgLibVNCServerPassword::SetContext(void *pContext)
30{
31}
32
33void CDlgLibVNCServerPassword::SetConnecter(CConnecter *pConnecter)
34{
35 m_pConnecter = qobject_cast<CConnecterLibVNCServer*>(pConnecter);
36 if(!m_pConnecter) {
37 qCritical(log) << "The connecter is nullptr";
38 return;
39 }
40
41 m_pParameter = qobject_cast<CParameterLibVNCServer*>(m_pConnecter->GetParameter());
42 if(!m_pParameter) {
43 qCritical(log) << "The m_pParameter is nullptr";
44 return;
45 }
46
47 ui->lbText->setText(tr("Set password for %1").arg(m_pConnecter->Name()));
48 ui->wUser->SetParameter(&m_pParameter->m_Net.m_User);
49}
50
51void CDlgLibVNCServerPassword::on_pbOK_clicked()
52{
53 if(!m_pParameter) {
54 qCritical(log) << "The m_pParameter is nullptr";
55 return;
56 }
57 ui->wUser->Accept();
58 emit m_pParameter->sigChanged();
59 accept();
60}
61
62void CDlgLibVNCServerPassword::on_pbCancel_clicked()
63{
64 reject();
65}
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...