4#include <QLoggingCategory>
5#include "DlgSettingsVnc.h"
6#include "ui_DlgSettingsVnc.h"
7#include "rfb/encodings.h"
15static Q_LOGGING_CATEGORY(log,
"VNC.Settings")
22 setAttribute(Qt::WA_DeleteOnClose);
25 ui->wNet->SetParameter(&m_pPara->m_Net);
28 m_pProxyUI->SetParameter(&m_pPara->m_Proxy);
29 ui->tabWidget->insertTab(1, m_pProxyUI, tr(
"Proxy"));
32 m_pRecordUI->SetParameter(&m_pPara->m_Record);
33 ui->tabWidget->addTab(m_pRecordUI, m_pRecordUI->windowIcon(), tr(
"Record"));
50 ui->gpIce->setChecked(
true);
51 ui->wNet->setEnabled(
false);
53 ui->gpIce->setChecked(
false);
56 ui->gpIce->setEnabled(
false);
59 ui->lePeerUser->setText(m_pPara->GetPeerUser());
61 ui->leName->setText(m_pPara->GetName());
63 ui->cbOnlyView->setChecked(m_pPara->GetOnlyView());
64 ui->cbShowServerName->setChecked(m_pPara->GetShowServerName());
66 ui->cbShared->setChecked(m_pPara->GetShared());
67 ui->cbRealTimeUpdate->setChecked(!m_pPara->GetBufferEndRefresh());
68 ui->cbLocalCursor->setChecked(m_pPara->GetLocalCursor());
69 ui->cbCursorPosition->setChecked(m_pPara->GetCursorPosition());
70 ui->cbResizeWindows->setChecked(m_pPara->GetSupportsDesktopResize());
71 ui->cbLedState->setChecked(m_pPara->GetLedState());
72 ui->cbClipboard->setChecked(m_pPara->GetClipboard());
75 ui->cbCompressAutoSelect->setChecked(m_pPara->GetAutoSelect());
77 ui->rbH264->setVisible(
true);
79 ui->rbH264->setVisible(
false);
81 switch(m_pPara->GetPreferredEncoding())
83 case rfb::encodingTight:
84 ui->rbTight->setChecked(
true);
86 case rfb::encodingRaw:
87 ui->rbRaw->setChecked(
true);
89 case rfb::encodingRRE:
90 ui->rbRRE->setChecked(
true);
92 case rfb::encodingZRLE:
93 ui->rbZRLE->setChecked(
true);
95 case rfb::encodingCoRRE:
96 ui->rbCoRRE->setChecked(
true);
98 case rfb::encodingCopyRect:
99 ui->rbCopyRect->setChecked(
true);
101 case rfb::encodingHextile:
102 ui->rbHextile->setChecked(
true);
105 case rfb::encodingH264:
106 ui->rbH264->setChecked(
true);
111 switch(m_pPara->GetColorLevel())
113 case CParameterVnc::Full:
114 ui->rbFull->setChecked(
true);
116 case CParameterVnc::Medium:
117 ui->rbMeduim->setChecked(
true);
119 case CParameterVnc::Low:
120 ui->rbLow->setChecked(
true);
122 case CParameterVnc::VeryLow:
123 ui->rbVeryLow->setChecked(
true);
127 ui->cbCompress->setChecked(m_pPara->GetEnableCompressLevel());
128 ui->spCompressLevel->setValue(m_pPara->GetCompressLevel());
129 ui->cbJPEG->setChecked(!m_pPara->GetNoJpeg());
130 ui->spJPEGLevel->setValue(m_pPara->GetQualityLevel());
132 if(m_pPara->GetAutoSelect())
134 ui->spCompressLevel->setEnabled(
false);
135 ui->spJPEGLevel->setEnabled(
false);
137 ui->spCompressLevel->setEnabled(m_pPara->GetEnableCompressLevel());
138 ui->spJPEGLevel->setEnabled(!m_pPara->GetNoJpeg());
142CDlgSettingsVnc::~CDlgSettingsVnc()
144 qDebug(log) <<
"CDlgSettingsVnc::~CDlgSettingsVnc()";
148void CDlgSettingsVnc::on_pbOK_clicked()
154 if(!ui->wNet->CheckValidity(
true)) {
155 ui->tabWidget->setCurrentIndex(0);
160 ui->tabWidget->setCurrentWidget(m_pProxyUI);
165 ui->tabWidget->setCurrentWidget(m_pRecordUI);
174 if(ui->gpIce->isChecked() && ice)
176 m_pPara->SetIce(
true);
177 m_pPara->SetPeerUser(ui->lePeerUser->text());
179 m_pPara->SetIce(
false);
182 nRet = ui->wNet->Accept();
184 nRet = m_pProxyUI->
Accept();
186 nRet = m_pRecordUI->Accept();
189 m_pPara->SetName(ui->leName->text());
190 m_pPara->SetShared(ui->cbShared->isChecked());
191 m_pPara->SetBufferEndRefresh(!ui->cbRealTimeUpdate->isChecked());
192 m_pPara->SetLocalCursor(ui->cbLocalCursor->isChecked());
193 m_pPara->SetCursorPosition(ui->cbCursorPosition->isChecked());
194 m_pPara->SetSupportsDesktopResize(ui->cbResizeWindows->isChecked());
195 m_pPara->SetLedState(ui->cbLedState->isChecked());
196 m_pPara->SetClipboard(ui->cbClipboard->isChecked());
197 m_pPara->SetShowServerName(ui->cbShowServerName->isChecked());
200 m_pPara->SetAutoSelect(ui->cbCompressAutoSelect->isChecked());
201 if(m_pPara->GetAutoSelect()) {
202 m_pPara->SetPreferredEncoding(rfb::encodingTight);
203 m_pPara->SetColorLevel(CParameterVnc::Full);
204 m_pPara->SetCompressLevel(2);
205 m_pPara->SetQualityLevel(8);
207 if(ui->rbTight->isChecked()) m_pPara->SetPreferredEncoding(rfb::encodingTight);
208 if(ui->rbRaw->isChecked()) m_pPara->SetPreferredEncoding(rfb::encodingRaw);
209 if(ui->rbRRE->isChecked()) m_pPara->SetPreferredEncoding(rfb::encodingRRE);
210 if(ui->rbZRLE->isChecked()) m_pPara->SetPreferredEncoding(rfb::encodingZRLE);
211 if(ui->rbCoRRE->isChecked()) m_pPara->SetPreferredEncoding(rfb::encodingCoRRE);
212 if(ui->rbCopyRect->isChecked()) m_pPara->SetPreferredEncoding(rfb::encodingCopyRect);
213 if(ui->rbHextile->isChecked()) m_pPara->SetPreferredEncoding(rfb::encodingHextile);
215 if(ui->rbH264->isChecked()) m_pPara->SetPreferredEncoding(rfb::encodingH264);
218 if(ui->rbFull->isChecked()) m_pPara->SetColorLevel(CParameterVnc::Full);
219 if(ui->rbMeduim->isChecked()) m_pPara->SetColorLevel(CParameterVnc::Medium);
220 if(ui->rbLow->isChecked()) m_pPara->SetColorLevel(CParameterVnc::Low);
221 if(ui->rbVeryLow->isChecked()) m_pPara->SetColorLevel(CParameterVnc::VeryLow);
223 m_pPara->SetEnableCompressLevel(ui->cbCompress->isChecked());
224 m_pPara->SetCompressLevel(ui->spCompressLevel->value());
225 m_pPara->SetNoJpeg(!ui->cbJPEG->isChecked());
226 m_pPara->SetQualityLevel(ui->spJPEGLevel->value());
232void CDlgSettingsVnc::on_pbCancel_clicked()
237void CDlgSettingsVnc::on_cbCompressAutoSelect_stateChanged(
int arg1)
239 m_pPara->SetAutoSelect(arg1);
240 if(m_pPara->GetAutoSelect())
242 ui->gpPreferredEncodeing->setEnabled(
false);
243 ui->gpColorLevel->setEnabled(
false);
244 ui->cbJPEG->setEnabled(
false);
245 ui->spJPEGLevel->setEnabled(
false);
246 ui->cbCompress->setEnabled(
false);
247 ui->spCompressLevel->setEnabled(
false);
249 ui->gpPreferredEncodeing->setEnabled(
true);
250 ui->gpColorLevel->setEnabled(
true);
251 ui->cbJPEG->setEnabled(
true);
252 if(ui->cbJPEG->isChecked())
253 ui->spJPEGLevel->setEnabled(
true);
254 ui->cbCompress->setEnabled(
true);
255 if(ui->cbCompress->isChecked())
256 ui->spCompressLevel->setEnabled(
true);
260void CDlgSettingsVnc::on_cbCompress_stateChanged(
int arg1)
262 m_pPara->SetCompressLevel(arg1);
264 ui->spCompressLevel->setEnabled(m_pPara->GetEnableCompressLevel());
267void CDlgSettingsVnc::on_cbJPEG_stateChanged(
int arg1)
269 m_pPara->SetNoJpeg(!arg1);
271 ui->spJPEGLevel->setEnabled(!m_pPara->GetNoJpeg());
274void CDlgSettingsVnc::on_gpIce_clicked(
bool checked)
276 ui->wNet->setEnabled(!checked);
static CICE * Instance()
Single instance.
bool CheckValidity(bool validity=false)
Check parameters validity.
int Accept()
Accept parameters.
virtual bool CheckValidity(bool validity=false)
Check parameters validity.