Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
FrmParameterClient.cpp
1#include "FrmParameterClient.h"
2#include "ui_FrmParameterClient.h"
3
4CFrmParameterClient::CFrmParameterClient(QWidget *parent) :
5 CParameterUI(parent),
6 ui(new Ui::CFrmParameterClient),
7 m_pPara(nullptr)
8{
9 ui->setupUi(this);
10}
11
12CFrmParameterClient::~CFrmParameterClient()
13{
14 delete ui;
15}
16
18{
19 if(!m_pPara)
20 return -1;
21 m_pPara->SetHookKeyboard(ui->cbHookKeyboard->isChecked());
22 m_pPara->SetEnableSystemUserToUser(ui->cbEnableUserName->isChecked());
23 m_pPara->SetAdaptWindows((CFrmViewer::ADAPT_WINDOWS)ui->cbViewZoom->currentData().toInt());
24
25 m_pPara->SetEncryptKey(ui->leEncryptKey->text());
26 m_pPara->SetSavePassword(ui->cbSavePassword->isChecked());
27 m_pPara->SetViewPassowrd(ui->cbEnableViewPassword->isChecked());
28 if(ui->rbPromptAlways->isChecked())
29 m_pPara->SetPromptType(CParameterClient::PromptType::Always);
30 if(ui->rbPromptFirst->isChecked())
31 m_pPara->SetPromptType(CParameterClient::PromptType::First);
32 if(ui->rbPromptNo->isChecked())
33 m_pPara->SetPromptType(CParameterClient::PromptType::No);
34 m_pPara->SetShowProtocolPrefix(ui->cbShowPrefix->isChecked());
35 m_pPara->SetShowIpPortInName(ui->cbShowIPPort->isChecked());
36 return 0;
37}
38
39void CFrmParameterClient::on_cbEnableViewPassword_clicked(bool checked)
40{
41 ui->pbEncryptKey->setEnabled(checked);
42}
43
44void CFrmParameterClient::on_pbEncryptKey_clicked()
45{
46 switch(ui->leEncryptKey->echoMode())
47 {
48 case QLineEdit::Password:
49 ui->leEncryptKey->setEchoMode(QLineEdit::Normal);
50 ui->pbEncryptKey->setIcon(QIcon::fromTheme("eye-off"));
51 break;
52 case QLineEdit::Normal:
53 ui->leEncryptKey->setEchoMode(QLineEdit::Password);
54 ui->pbEncryptKey->setIcon(QIcon::fromTheme("eye-on"));
55 break;
56 default:
57 break;
58 }
59}
60
62{
63 m_pPara = qobject_cast<CParameterClient*>(pParameter);
64 if(!m_pPara)
65 return -1;
66 ui->cbHookKeyboard->setChecked(m_pPara->GetHookKeyboard());
67 ui->cbEnableUserName->setChecked(m_pPara->GetEnableSystemUserToUser());
68
69 ui->cbViewZoom->addItem(QIcon::fromTheme("zoom-original"),
70 tr("Original"),
72 /*ui->cbViewZoom->addItem(tr("Original Center"),
73 (int)CFrmViewer::ADAPT_WINDOWS::OriginalCenter);*/
74 ui->cbViewZoom->addItem(QIcon::fromTheme("zoom"), tr("Zoom"),
76 ui->cbViewZoom->addItem(QIcon::fromTheme("zoom-fit-best"),
77 tr("Zoom to window"),
79 ui->cbViewZoom->addItem(QIcon::fromTheme("zoom-aspect-ratio"),
80 tr("Keep desktop aspectration adapt to windows"),
82 int nIndex = ui->cbViewZoom->findData((int)m_pPara->GetAdaptWindows());
83 if(-1 != nIndex)
84 ui->cbViewZoom->setCurrentIndex(nIndex);
85
86 ui->leEncryptKey->setText(m_pPara->GetEncryptKey());
87 ui->cbSavePassword->setChecked(m_pPara->GetSavePassword());
88 ui->cbEnableViewPassword->setChecked(m_pPara->GetViewPassowrd());
89 ui->pbEncryptKey->setEnabled(ui->cbEnableViewPassword->isChecked());
90 switch (m_pPara->GetPromptType()) {
91 case CParameterClient::PromptType::Always:
92 ui->rbPromptAlways->setChecked(true);
93 break;
94 case CParameterClient::PromptType::First:
95 ui->rbPromptFirst->setChecked(true);
96 break;
97 case CParameterClient::PromptType::No:
98 ui->rbPromptNo->setChecked(true);
99 break;
100 }
101 ui->cbShowPrefix->setChecked(m_pPara->GetShowProtocolPrefix());
102 ui->cbShowIPPort->setChecked(m_pPara->GetShowIpPortInName());
103 return 0;
104}
virtual int Accept() override
Accept parameters.
virtual int SetParameter(CParameter *pParameter) override
Set the parameters and initialize the user interface.
ADAPT_WINDOWS
The ADAPT_WINDOWS enum.
Definition FrmViewer.h:61
@ Original
Original desktop size, the left-top of the desktop is aligned with the left-top of the window.
@ Zoom
zoom windows = desktop size * factor
@ KeepAspectRationToWindow
Keep desktop aspectration adapt to windows.
@ ZoomToWindow
Desktop adapt to windows.
The parameter UI interface.
Definition ParameterUI.h:15
Parameter interface.
Definition Parameter.h:169