Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
DlgSettingsLibVnc.cpp
1// Author: Kang Lin <kl222@126.com>
2
3#include "DlgSettingsLibVnc.h"
4#include "ui_DlgSettingsLibVnc.h"
5
6#include <QLoggingCategory>
7static Q_LOGGING_CATEGORY(log, "LibVNCServer.Setting.Dialog")
8
10 QDialog(parent),
11 ui(new Ui::CDlgSettingsLibVnc),
12 m_pPara(pPara),
13 m_pProxyUI(nullptr)
14{
15 setAttribute(Qt::WA_DeleteOnClose);
16 ui->setupUi(this);
17
18 // Server
19 ui->leName->setText(m_pPara->GetName());
20 ui->wNet->SetParameter(&m_pPara->m_Net);
21
22 ui->cbShowServerName->setChecked(m_pPara->GetShowServerName());
23
24 ui->cbShared->setChecked(m_pPara->GetShared());
25 ui->cbOnlyView->setChecked(m_pPara->GetOnlyView());
26 ui->cbLocalCursor->setChecked(m_pPara->GetLocalCursor());
27 ui->cbClipboard->setChecked(m_pPara->GetClipboard());
28
29 m_pProxyUI = new CParameterProxyUI(ui->tabWidget);
30 m_pProxyUI->SetParameter(&m_pPara->m_Proxy);
31 ui->tabWidget->insertTab(1, m_pProxyUI, tr("Proxy"));
32
33 // Compress
34 // ui->cbCompressAutoSelect->setChecked(m_pPara->bAutoSelect);
35
36 // switch(m_pPara->nEncoding)
37 // {
38 // case rfb::encodingTight:
39 // ui->rbTight->setChecked(true);
40 // break;
41 // case rfb::encodingRaw:
42 // ui->rbRaw->setChecked(true);
43 // break;
44 // case rfb::encodingRRE:
45 // ui->rbRRE->setChecked(true);
46 // break;
47 // case rfb::encodingZRLE:
48 // ui->rbZRLE->setChecked(true);
49 // break;
50 // case rfb::encodingCoRRE:
51 // ui->rbCoRRE->setChecked(true);
52 // break;
53 // case rfb::encodingCopyRect:
54 // ui->rbCopyRect->setChecked(true);
55 // break;
56 // case rfb::encodingHextile:
57 // ui->rbHextile->setChecked(true);
58 // break;
59 // }
60
61 ui->cbCompress->setChecked(m_pPara->GetEnableCompressLevel());
62 ui->spCompressLevel->setEnabled(m_pPara->GetEnableCompressLevel());
63 ui->spCompressLevel->setValue(m_pPara->GetCompressLevel());
64 ui->spJPEGLevel->setEnabled(m_pPara->GetJpeg());
65 ui->cbJPEG->setChecked(m_pPara->GetJpeg());
66 ui->spJPEGLevel->setValue(m_pPara->GetQualityLevel());
67
68}
69
70CDlgSettingsLibVnc::~CDlgSettingsLibVnc()
71{
72 qDebug(log) << "CDlgSettingsLibVnc::~CDlgSettingsLibVnc()";
73 delete ui;
74}
75
76void CDlgSettingsLibVnc::on_pbOk_clicked()
77{
78 int nRet = 0;
79
80 if(!m_pPara)
81 return;
82
83 if(!ui->wNet->CheckValidity(true)) {
84 ui->tabWidget->setCurrentIndex(0);
85 return;
86 }
87 if(!m_pProxyUI->CheckValidity(true)) {
88 ui->tabWidget->setCurrentWidget(m_pProxyUI);
89 return;
90 }
91
92 // Server
93 m_pPara->SetName(ui->leName->text());
94
95 nRet = ui->wNet->Accept();
96 if(nRet) return;
97
98 m_pPara->SetShowServerName(ui->cbShowServerName->isChecked());
99 m_pPara->SetShared(ui->cbShared->isChecked());
100 m_pPara->SetOnlyView(ui->cbOnlyView->isChecked());
101 m_pPara->SetLocalCursor(ui->cbLocalCursor->isChecked());
102 m_pPara->SetClipboard(ui->cbClipboard->isChecked());
103
104 nRet = m_pProxyUI->Accept();
105 if(nRet)
106 return;
107
108// // Compress
109// m_pPara->bAutoSelect = ui->cbCompressAutoSelect->isChecked();
110
111// if(ui->rbTight->isChecked()) m_pPara->nEncoding = rfb::encodingTight;
112// if(ui->rbRaw->isChecked()) m_pPara->nEncoding = rfb::encodingRaw;
113// if(ui->rbRRE->isChecked()) m_pPara->nEncoding = rfb::encodingRRE;
114// if(ui->rbZRLE->isChecked()) m_pPara->nEncoding = rfb::encodingZRLE;
115// if(ui->rbCoRRE->isChecked()) m_pPara->nEncoding = rfb::encodingCoRRE;
116// if(ui->rbCopyRect->isChecked()) m_pPara->nEncoding = rfb::encodingCopyRect;
117// if(ui->rbHextile->isChecked()) m_pPara->nEncoding = rfb::encodingHextile;
118
119
120 m_pPara->SetEnableCompressLevel(ui->cbCompress->isChecked());
121 m_pPara->SetCompressLevel(ui->spCompressLevel->value());
122 m_pPara->SetJpeg(ui->cbJPEG->isChecked());
123 m_pPara->SetQualityLevel(ui->spJPEGLevel->value());
124
125 accept();
126}
127
128void CDlgSettingsLibVnc::on_pbCancel_clicked()
129{
130 reject();
131}
132
133void CDlgSettingsLibVnc::on_cbCompress_stateChanged(int arg1)
134{
135 m_pPara->SetEnableCompressLevel(arg1);
136 ui->spCompressLevel->setEnabled(arg1);
137}
138
139void CDlgSettingsLibVnc::on_cbJPEG_stateChanged(int arg1)
140{
141 m_pPara->SetJpeg(arg1);
142 ui->spJPEGLevel->setEnabled(m_pPara->GetJpeg());
143}
The proxy parameter UI.
bool CheckValidity(bool validity=false)
Check parameters validity.
int Accept()
Accept parameters.