]> source.dussan.org Git - tigervnc.git/commitdiff
Added support for selecting zlib compression and jpeg quality in the UNIX client...
authorPeter Åstrand <astrand@cendio.se>
Wed, 29 Dec 2004 15:56:30 +0000 (15:56 +0000)
committerPeter Åstrand <astrand@cendio.se>
Wed, 29 Dec 2004 15:56:30 +0000 (15:56 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@62 3789f03b-4d11-0410-bbf8-ca57d06f2519

vncviewer_unix/CConn.cxx
vncviewer_unix/OptionsDialog.h
vncviewer_unix/parameters.h
vncviewer_unix/vncviewer.cxx

index ff8b694c8a97ca3a712dd0b73480048251ff16a4..3d5d84c6f57c5e42a527a032f2a62967d063e231 100644 (file)
@@ -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());
index 9c524370a64ec688a9e3bf83bdef46448663c96b..8c9adb6d0876cbc235c22c8c27a3acca886fbea5 100644 (file)
@@ -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;
index 41eb52936b44b4d02db39c0cbb2dcb561deee7cc..ffb0afd300b45201949465d8de3cf958b105db0b 100644 (file)
@@ -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[];
index ad2db155c08acb22d98abab5199b4f431c1dd98b..3a8d226ed4baa8d6da357bf45eb17abf6fe56d4d 100644 (file)
@@ -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;