diff options
author | Peter Åstrand <astrand@cendio.se> | 2004-12-29 15:56:30 +0000 |
---|---|---|
committer | Peter Åstrand <astrand@cendio.se> | 2004-12-29 15:56:30 +0000 |
commit | fdd69322b115d09c360bcb6f4aed5a30857916d8 (patch) | |
tree | 5c402f160c0d3e03e2e18f0ac68a1734abc860ad /vncviewer_unix | |
parent | 2dd021bb81db770aba1beee808fc4ccc3e349b7e (diff) | |
download | tigervnc-fdd69322b115d09c360bcb6f4aed5a30857916d8.tar.gz tigervnc-fdd69322b115d09c360bcb6f4aed5a30857916d8.zip |
Added support for selecting zlib compression and jpeg quality in the UNIX client (both from GUI and command line)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@62 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'vncviewer_unix')
-rw-r--r-- | vncviewer_unix/CConn.cxx | 18 | ||||
-rw-r--r-- | vncviewer_unix/OptionsDialog.h | 37 | ||||
-rw-r--r-- | vncviewer_unix/parameters.h | 3 | ||||
-rw-r--r-- | vncviewer_unix/vncviewer.cxx | 15 |
4 files changed, 69 insertions, 4 deletions
diff --git a/vncviewer_unix/CConn.cxx b/vncviewer_unix/CConn.cxx index ff8b694c..3d5d84c6 100644 --- a/vncviewer_unix/CConn.cxx +++ b/vncviewer_unix/CConn.cxx @@ -74,6 +74,9 @@ CConn::CConn(Display* dpy_, int argc_, char** argv_, network::Socket* sock_, } cp.supportsDesktopResize = true; cp.supportsLocalCursor = useLocalCursor; + cp.customCompressLevel = customCompressLevel; + cp.compressLevel = compressLevel; + cp.noJpeg = noJpeg; cp.qualityLevel = qualityLevel; initMenu(); @@ -480,6 +483,7 @@ void CConn::menuSelect(long id, TXMenu* m) { // options dialog's checkboxes. void CConn::setOptions() { + char digit[2] = "0"; options.autoSelect.checked(autoSelect); options.fullColour.checked(fullColour); options.veryLowColour.checked(!fullColour && lowColourLevel == 0); @@ -489,6 +493,14 @@ void CConn::setOptions() { options.zrle.checked(currentEncoding == encodingZRLE); options.hextile.checked(currentEncoding == encodingHextile); options.raw.checked(currentEncoding == encodingRaw); + + options.customCompressLevel.checked(customCompressLevel); + digit[0] = '0' + compressLevel; + options.compressLevel.setText(digit); + options.noJpeg.checked(!noJpeg); + digit[0] = '0' + qualityLevel; + options.qualityLevel.setText(digit); + options.viewOnly.checked(viewOnly); options.acceptClipboard.checked(acceptClipboard); options.sendClipboard.checked(sendClipboard); @@ -523,6 +535,12 @@ void CConn::getOptions() { currentEncoding = newEncoding; encodingChange = true; } + + customCompressLevel.setParam(options.customCompressLevel.checked()); + compressLevel.setParam(options.compressLevel.getText()); + noJpeg.setParam(!options.noJpeg.checked()); + qualityLevel.setParam(options.qualityLevel.getText()); + viewOnly.setParam(options.viewOnly.checked()); acceptClipboard.setParam(options.acceptClipboard.checked()); sendClipboard.setParam(options.sendClipboard.checked()); diff --git a/vncviewer_unix/OptionsDialog.h b/vncviewer_unix/OptionsDialog.h index 9c524370..8c9adb6d 100644 --- a/vncviewer_unix/OptionsDialog.h +++ b/vncviewer_unix/OptionsDialog.h @@ -36,10 +36,10 @@ public: }; class OptionsDialog : public TXDialog, public TXButtonCallback, - public TXCheckboxCallback { + public TXCheckboxCallback, public TXEntryCallback { public: OptionsDialog(Display* dpy, OptionsDialogCallback* cb_) - : TXDialog(dpy, 400, 400, "VNC Viewer: Connection Options"), cb(cb_), + : TXDialog(dpy, 400, 450, "VNC Viewer: Connection Options"), cb(cb_), formatAndEnc(dpy, "Encoding and Colour Level:", this), inputs(dpy, "Inputs:", this), misc(dpy, "Misc:", this), @@ -52,6 +52,12 @@ public: zrle(dpy, "ZRLE", this, true, this), hextile(dpy, "Hextile", this, true, this), raw(dpy, "Raw", this, true, this), + customCompressLevel(dpy, "Custom compression level:", this, false, this), + compressLevel(dpy, this, this, false, 30), + compressLevelLabel(dpy, "level (1=fast, 9=best)", this), + noJpeg(dpy, "Allow JPEG compression:", this, false, this), + qualityLevel(dpy, this, this, false, 30), + qualityLevelLabel(dpy, "quality (1=poor, 9=best)", this), viewOnly(dpy, "View only (ignore mouse & keyboard)", this, false, this), acceptClipboard(dpy, "Accept clipboard from server", this, false, this), sendClipboard(dpy, "Send clipboard to server", this, false, this), @@ -81,7 +87,19 @@ public: veryLowColour.move(x2, y); y += hextile.height(); raw.move(xPad, y); - y += raw.height(); + y += raw.height() + yPad; + + customCompressLevel.move(xPad, y); + y += customCompressLevel.height(); + compressLevel.move(xPad*10, y); + compressLevelLabel.move(xPad*20, y); + y += compressLevel.height(); + + noJpeg.move(xPad, y); + y += noJpeg.height(); + qualityLevel.move(xPad*10, y); + qualityLevelLabel.move(xPad*20, y); + y += qualityLevel.height(); y += yPad*4; inputs.move(xPad, y); @@ -126,6 +144,8 @@ public: veryLowColour.disabled(autoSelect.checked()); sendPrimary.disabled(!sendClipboard.checked()); dotWhenNoCursor.disabled(!useLocalCursor.checked()); + compressLevel.disabled(!customCompressLevel.checked()); + qualityLevel.disabled(!noJpeg.checked()); } virtual void takeFocus(Time time) { @@ -166,14 +186,25 @@ public: sendPrimary.disabled(!sendClipboard.checked()); } else if (checkbox == &useLocalCursor) { dotWhenNoCursor.disabled(!useLocalCursor.checked()); + } else if (checkbox == &customCompressLevel) { + compressLevel.disabled(!customCompressLevel.checked()); + } else if (checkbox == &noJpeg) { + qualityLevel.disabled(!noJpeg.checked()); } } + virtual void entryCallback(TXEntry* e, Detail detail, Time time) { + } + OptionsDialogCallback* cb; TXLabel formatAndEnc, inputs, misc; TXCheckbox autoSelect; TXCheckbox fullColour, mediumColour, lowColour, veryLowColour; TXCheckbox tight, zrle, hextile, raw; + + TXCheckbox customCompressLevel; TXEntry compressLevel; TXLabel compressLevelLabel; + TXCheckbox noJpeg; TXEntry qualityLevel; TXLabel qualityLevelLabel; + TXCheckbox viewOnly, acceptClipboard, sendClipboard, sendPrimary; TXCheckbox shared, fullScreen, useLocalCursor, dotWhenNoCursor; TXButton okButton, cancelButton; diff --git a/vncviewer_unix/parameters.h b/vncviewer_unix/parameters.h index 41eb5293..ffb0afd3 100644 --- a/vncviewer_unix/parameters.h +++ b/vncviewer_unix/parameters.h @@ -37,6 +37,9 @@ extern rfb::BoolParameter sendClipboard; extern rfb::BoolParameter sendPrimary; extern rfb::BoolParameter fullScreen; extern rfb::StringParameter geometry; +extern rfb::BoolParameter customCompressLevel; +extern rfb::IntParameter compressLevel; +extern rfb::BoolParameter noJpeg; extern rfb::IntParameter qualityLevel; extern char aboutText[]; diff --git a/vncviewer_unix/vncviewer.cxx b/vncviewer_unix/vncviewer.cxx index ad2db155..3a8d226e 100644 --- a/vncviewer_unix/vncviewer.cxx +++ b/vncviewer_unix/vncviewer.cxx @@ -91,10 +91,23 @@ BoolParameter listenMode("listen", "Listen for connections from VNC servers", StringParameter geometry("geometry", "X geometry specification", ""); StringParameter displayname("display", "The X display", ""); +BoolParameter customCompressLevel("CustomCompressLevel", + "Use custom compression level", + false); + +IntParameter compressLevel("CompressLevel", + "Use specified compression level" + "0 = Low, 9 = High", + 6); + +BoolParameter noJpeg("NoJPEG", + "Disable lossy JPEG compression in Tight encoding.", + false); + IntParameter qualityLevel("QualityLevel", "JPEG quality level. " "0 = Low, 9 = High", - 5); + 6); char aboutText[256]; char* programName; |