Added options CompressLevel and CustomCompressLevel
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@58 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/vncviewer/CViewOptions.cxx b/vncviewer/CViewOptions.cxx
index 199ddb5..457da48 100644
--- a/vncviewer/CViewOptions.cxx
+++ b/vncviewer/CViewOptions.cxx
@@ -81,15 +81,24 @@
static StringParameter monitor("Monitor", "The monitor to open the VNC Viewer window on, if available.", "");
static StringParameter menuKey("MenuKey", "The key which brings up the popup menu", "F8");
-static IntParameter qualityLevel("QualityLevel",
- "JPEG quality level. "
- "0 = Low, 9 = High",
- 5);
+static BoolParameter customCompressLevel("CustomCompressLevel",
+ "Use custom compression level",
+ false);
+
+static IntParameter compressLevel("CompressLevel",
+ "Use specified compression level"
+ "0 = Low, 9 = High",
+ 6);
static BoolParameter noJpeg("NoJPEG",
"Disable lossy JPEG compression in Tight encoding.",
false);
+static IntParameter qualityLevel("QualityLevel",
+ "JPEG quality level. "
+ "0 = Low, 9 = High",
+ 6);
+
CViewOptions::CViewOptions()
: useLocalCursor(::useLocalCursor), useDesktopResize(::useDesktopResize),
autoSelect(::autoSelect), fullColour(::fullColour), fullScreen(::fullScreen),
@@ -97,7 +106,8 @@
preferredEncoding(encodingZRLE), clientCutText(::clientCutText), serverCutText(::serverCutText),
protocol3_3(::protocol3_3), acceptBell(::acceptBell), lowColourLevel(::lowColourLevel),
pointerEventInterval(ptrEventInterval), emulate3(::emulate3), monitor(::monitor.getData()),
-qualityLevel(::qualityLevel), noJpeg(::noJpeg)
+customCompressLevel(::customCompressLevel), compressLevel(::compressLevel),
+noJpeg(::noJpeg), qualityLevel(::qualityLevel)
{
CharArray encodingName(::preferredEncoding.getData());
preferredEncoding = encodingNum(encodingName.buf);
@@ -197,10 +207,14 @@
monitor.replaceBuf(value.takeBuf());
} else if (stricmp(name.buf, "MenuKey") == 0) {
setMenuKey(value.buf);
- } else if (stricmp(name.buf, "QualityLevel") == 0) {
- qualityLevel = atoi(value.buf);
+ } else if (stricmp(name.buf, "CustomCompressLevel") == 0) {
+ customCompressLevel = atoi(value.buf);
+ } else if (stricmp(name.buf, "CompressLevel") == 0) {
+ compressLevel = atoi(value.buf);
} else if (stricmp(name.buf, "NoJPEG") == 0) {
noJpeg = atoi(value.buf);
+ } else if (stricmp(name.buf, "QualityLevel") == 0) {
+ qualityLevel = atoi(value.buf);
// Legacy options
} else if (stricmp(name.buf, "Preferred_Encoding") == 0) {
preferredEncoding = atoi(value.buf);
@@ -284,8 +298,10 @@
if (monitor.buf)
fprintf(f, "Monitor=%s\n", monitor.buf);
fprintf(f, "MenuKey=%s\n", CharArray(menuKeyName()).buf);
- fprintf(f, "QualityLevel=%d\n", qualityLevel);
+ fprintf(f, "CustomCompressLevel=%d\n", customCompressLevel);
+ fprintf(f, "CompressLevel=%d\n", compressLevel);
fprintf(f, "NoJPEG=%d\n", noJpeg);
+ fprintf(f, "QualityLevel=%d\n", qualityLevel);
fclose(f); f=0;
setConfigFileName(filename);
@@ -318,8 +334,10 @@
if (monitor.buf)
key.setString(_T("Monitor"), TStr(monitor.buf));
key.setString(_T("MenuKey"), TCharArray(menuKeyName()).buf);
- key.setInt(_T("QualityLevel"), qualityLevel);
+ key.setInt(_T("CustomCompressLevel"), customCompressLevel);
+ key.setInt(_T("CompressLevel"), compressLevel);
key.setInt(_T("NoJPEG"), noJpeg);
+ key.setInt(_T("QualityLevel"), qualityLevel);
}
@@ -374,7 +392,10 @@
setHost(o.host.buf);
setMonitor(o.monitor.buf);
menuKey = o.menuKey;
- qualityLevel = o.qualityLevel;
+ customCompressLevel = o.customCompressLevel;
+ compressLevel = o.compressLevel;
noJpeg = o.noJpeg;
+ qualityLevel = o.qualityLevel;
+
return *this;
}
diff --git a/vncviewer/CViewOptions.h b/vncviewer/CViewOptions.h
index 88b659f..e45612c 100644
--- a/vncviewer/CViewOptions.h
+++ b/vncviewer/CViewOptions.h
@@ -77,8 +77,12 @@
unsigned int menuKey;
void setMenuKey(const char* keyName);
char* menuKeyName();
- int qualityLevel;
+
+ bool customCompressLevel;
+ int compressLevel;
bool noJpeg;
+ int qualityLevel;
+
};
diff --git a/vncviewer/OptionsDialog.cxx b/vncviewer/OptionsDialog.cxx
index 4ff4600..ae3f08a 100644
--- a/vncviewer/OptionsDialog.cxx
+++ b/vncviewer/OptionsDialog.cxx
@@ -93,6 +93,8 @@
case encodingHextile: setItemChecked(IDC_ENCODING_HEXTILE, true); break;
case encodingRaw: setItemChecked(IDC_ENCODING_RAW, true); break;
}
+ setItemChecked(IDC_ALLOW_COMPRESSLEVEL, dlg->options.customCompressLevel);
+ setItemInt(IDC_COMPRESSLEVEL, dlg->options.compressLevel);
setItemChecked(IDC_ALLOW_JPEG, !dlg->options.noJpeg);
setItemInt(IDC_QUALITYLEVEL, dlg->options.qualityLevel);
onCommand(IDC_ENCODING_AUTO, 0 /* ? */); // Force enableItem status to refresh
@@ -100,6 +102,8 @@
virtual bool onOk() {
dlg->options.autoSelect = isItemChecked(IDC_ENCODING_AUTO);
dlg->options.fullColour = isItemChecked(IDC_FORMAT_FULLCOLOUR);
+ dlg->options.customCompressLevel = isItemChecked(IDC_ALLOW_COMPRESSLEVEL);
+ dlg->options.compressLevel = getItemInt(IDC_COMPRESSLEVEL);
dlg->options.noJpeg = !isItemChecked(IDC_ALLOW_JPEG);
dlg->options.qualityLevel = getItemInt(IDC_QUALITYLEVEL);
if (isItemChecked(IDC_FORMAT_VERYLOWCOLOUR))
diff --git a/vncviewer/cview.cxx b/vncviewer/cview.cxx
index ef0aa3e..1a7507a 100644
--- a/vncviewer/cview.cxx
+++ b/vncviewer/cview.cxx
@@ -252,8 +252,10 @@
(options.useDesktopResize != opt.useDesktopResize));
cp.supportsLocalCursor = options.useLocalCursor = opt.useLocalCursor;
cp.supportsDesktopResize = options.useDesktopResize = opt.useDesktopResize;
- cp.qualityLevel = options.qualityLevel = opt.qualityLevel;
+ cp.customCompressLevel = options.customCompressLevel = opt.customCompressLevel;
+ cp.compressLevel = options.compressLevel = opt.compressLevel;
cp.noJpeg = options.noJpeg = opt.noJpeg;
+ cp.qualityLevel = options.qualityLevel = opt.qualityLevel;
if (cursorAvailable)
hideLocalCursor();
cursorAvailable = cursorAvailable && options.useLocalCursor;