1#include "FrmParameterClient.h"
2#include "ui_FrmParameterClient.h"
3#include <RabbitCommonTools.h>
5CFrmParameterClient::CFrmParameterClient(QWidget *parent) :
11 if(RabbitCommon::CTools::HasAdministratorPrivilege()) {
12 ui->cbHookKeyboard->setText(
13 tr(
"Hook: capture system key"));
14 ui->cbShowHookAdminPrivilege->setText(
"");
15 ui->cbShowHookAdminPrivilege->hide();
17 ui->cbHookKeyboard->setText(
18 tr(
"Hook: capture system key(System shortcuts is need administrator privilege)"));
19 ui->cbShowHookAdminPrivilege->setText(
20 tr(
"Hook: show restart program with administrator privilege"));
21 ui->cbShowHookAdminPrivilege->show();
25CFrmParameterClient::~CFrmParameterClient()
34 m_pPara->SetHookKeyboard(ui->cbHookKeyboard->isChecked());
35 m_pPara->SetHookShowAdministratorPrivilege(ui->cbShowHookAdminPrivilege->isChecked());
36 m_pPara->SetEnableSystemUserToUser(ui->cbEnableUserName->isChecked());
39 m_pPara->SetEncryptKey(ui->leEncryptKey->text());
40 m_pPara->SetSavePassword(ui->cbSavePassword->isChecked());
41 m_pPara->SetViewPassowrd(ui->cbEnableViewPassword->isChecked());
42 if(ui->rbPromptAlways->isChecked())
43 m_pPara->SetPromptType(CParameterClient::PromptType::Always);
44 if(ui->rbPromptFirst->isChecked())
45 m_pPara->SetPromptType(CParameterClient::PromptType::First);
46 if(ui->rbPromptNo->isChecked())
47 m_pPara->SetPromptType(CParameterClient::PromptType::No);
48 m_pPara->SetShowProtocolPrefix(ui->cbShowPrefix->isChecked());
49 m_pPara->SetShowIpPortInName(ui->cbShowIPPort->isChecked());
53void CFrmParameterClient::on_cbEnableViewPassword_clicked(
bool checked)
55 ui->pbEncryptKey->setEnabled(checked);
58void CFrmParameterClient::on_pbEncryptKey_clicked()
60 switch(ui->leEncryptKey->echoMode())
62 case QLineEdit::Password:
63 ui->leEncryptKey->setEchoMode(QLineEdit::Normal);
64 ui->pbEncryptKey->setIcon(QIcon::fromTheme(
"eye-off"));
66 case QLineEdit::Normal:
67 ui->leEncryptKey->setEchoMode(QLineEdit::Password);
68 ui->pbEncryptKey->setIcon(QIcon::fromTheme(
"eye-on"));
77 m_pPara = qobject_cast<CParameterClient*>(pParameter);
80 ui->cbHookKeyboard->setChecked(m_pPara->GetHookKeyboard());
81 ui->cbShowHookAdminPrivilege->setChecked(m_pPara->GetHookShowAdministratorPrivilege());
82 ui->cbEnableUserName->setChecked(m_pPara->GetEnableSystemUserToUser());
84 ui->cbViewZoom->addItem(QIcon::fromTheme(
"zoom-original"),
89 ui->cbViewZoom->addItem(QIcon::fromTheme(
"zoom"), tr(
"Zoom"),
91 ui->cbViewZoom->addItem(QIcon::fromTheme(
"zoom-fit-best"),
94 ui->cbViewZoom->addItem(QIcon::fromTheme(
"zoom-aspect-ratio"),
95 tr(
"Keep desktop aspectration adapt to windows"),
97 int nIndex = ui->cbViewZoom->findData((
int)m_pPara->GetAdaptWindows());
99 ui->cbViewZoom->setCurrentIndex(nIndex);
101 ui->leEncryptKey->setText(m_pPara->GetEncryptKey());
102 ui->cbSavePassword->setChecked(m_pPara->GetSavePassword());
103 ui->cbEnableViewPassword->setChecked(m_pPara->GetViewPassowrd());
104 ui->pbEncryptKey->setEnabled(ui->cbEnableViewPassword->isChecked());
105 switch (m_pPara->GetPromptType()) {
106 case CParameterClient::PromptType::Always:
107 ui->rbPromptAlways->setChecked(
true);
109 case CParameterClient::PromptType::First:
110 ui->rbPromptFirst->setChecked(
true);
112 case CParameterClient::PromptType::No:
113 ui->rbPromptNo->setChecked(
true);
116 ui->cbShowPrefix->setChecked(m_pPara->GetShowProtocolPrefix());
117 ui->cbShowIPPort->setChecked(m_pPara->GetShowIpPortInName());
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.
@ 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.