mirror of
https://github.com/TigerVNC/tigervnc.git
synced 2024-08-21 17:54:34 +02:00
Added new parameter NoJPEG, hooked up with GUI
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@57 3789f03b-4d11-0410-bbf8-ca57d06f2519
This commit is contained in:
parent
142e84dafd
commit
0b8702662a
@ -28,7 +28,7 @@ using namespace rfb;
|
||||
ConnParams::ConnParams()
|
||||
: majorVersion(0), minorVersion(0), width(0), height(0), useCopyRect(false),
|
||||
supportsLocalCursor(false), supportsDesktopResize(false),
|
||||
supportsLastRect(false), qualityLevel(-1),
|
||||
supportsLastRect(false), qualityLevel(-1), noJpeg(false),
|
||||
name_(0), nEncodings_(0), encodings_(0),
|
||||
currentEncoding_(encodingRaw), verStrPos(0)
|
||||
{
|
||||
@ -90,6 +90,7 @@ void ConnParams::setEncodings(int nEncodings, const rdr::U32* encodings)
|
||||
supportsLocalCursor = false;
|
||||
supportsLastRect = false;
|
||||
qualityLevel = -1;
|
||||
noJpeg = false;
|
||||
currentEncoding_ = encodingRaw;
|
||||
|
||||
for (int i = nEncodings-1; i >= 0; i--) {
|
||||
@ -105,7 +106,7 @@ void ConnParams::setEncodings(int nEncodings, const rdr::U32* encodings)
|
||||
supportsLastRect = true;
|
||||
else if (encodings[i] >= pseudoEncodingQualityLevel0 &&
|
||||
encodings[i] <= pseudoEncodingQualityLevel9)
|
||||
qualityLevel = encodings[i] - pseudoEncodingQualityLevel0;
|
||||
qualityLevel = encodings[i] - pseudoEncodingQualityLevel0;
|
||||
else if (encodings[i] <= encodingMax && Encoder::supported(encodings[i]))
|
||||
currentEncoding_ = encodings[i];
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ namespace rfb {
|
||||
bool supportsLastRect;
|
||||
|
||||
int qualityLevel;
|
||||
bool noJpeg;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -86,6 +86,10 @@ static IntParameter qualityLevel("QualityLevel",
|
||||
"0 = Low, 9 = High",
|
||||
5);
|
||||
|
||||
static BoolParameter noJpeg("NoJPEG",
|
||||
"Disable lossy JPEG compression in Tight encoding.",
|
||||
false);
|
||||
|
||||
CViewOptions::CViewOptions()
|
||||
: useLocalCursor(::useLocalCursor), useDesktopResize(::useDesktopResize),
|
||||
autoSelect(::autoSelect), fullColour(::fullColour), fullScreen(::fullScreen),
|
||||
@ -93,7 +97,7 @@ shared(::sharedConnection), sendPtrEvents(::sendPtrEvents), sendKeyEvents(::send
|
||||
preferredEncoding(encodingZRLE), clientCutText(::clientCutText), serverCutText(::serverCutText),
|
||||
protocol3_3(::protocol3_3), acceptBell(::acceptBell), lowColourLevel(::lowColourLevel),
|
||||
pointerEventInterval(ptrEventInterval), emulate3(::emulate3), monitor(::monitor.getData()),
|
||||
qualityLevel(::qualityLevel)
|
||||
qualityLevel(::qualityLevel), noJpeg(::noJpeg)
|
||||
{
|
||||
CharArray encodingName(::preferredEncoding.getData());
|
||||
preferredEncoding = encodingNum(encodingName.buf);
|
||||
@ -195,7 +199,8 @@ void CViewOptions::readFromFile(const char* filename) {
|
||||
setMenuKey(value.buf);
|
||||
} else if (stricmp(name.buf, "QualityLevel") == 0) {
|
||||
qualityLevel = atoi(value.buf);
|
||||
|
||||
} else if (stricmp(name.buf, "NoJPEG") == 0) {
|
||||
noJpeg = atoi(value.buf);
|
||||
// Legacy options
|
||||
} else if (stricmp(name.buf, "Preferred_Encoding") == 0) {
|
||||
preferredEncoding = atoi(value.buf);
|
||||
@ -280,6 +285,7 @@ void CViewOptions::writeToFile(const char* filename) {
|
||||
fprintf(f, "Monitor=%s\n", monitor.buf);
|
||||
fprintf(f, "MenuKey=%s\n", CharArray(menuKeyName()).buf);
|
||||
fprintf(f, "QualityLevel=%d\n", qualityLevel);
|
||||
fprintf(f, "NoJPEG=%d\n", noJpeg);
|
||||
fclose(f); f=0;
|
||||
|
||||
setConfigFileName(filename);
|
||||
@ -313,6 +319,7 @@ void CViewOptions::writeDefaults() {
|
||||
key.setString(_T("Monitor"), TStr(monitor.buf));
|
||||
key.setString(_T("MenuKey"), TCharArray(menuKeyName()).buf);
|
||||
key.setInt(_T("QualityLevel"), qualityLevel);
|
||||
key.setInt(_T("NoJPEG"), noJpeg);
|
||||
}
|
||||
|
||||
|
||||
@ -368,5 +375,6 @@ CViewOptions& CViewOptions::operator=(const CViewOptions& o) {
|
||||
setMonitor(o.monitor.buf);
|
||||
menuKey = o.menuKey;
|
||||
qualityLevel = o.qualityLevel;
|
||||
noJpeg = o.noJpeg;
|
||||
return *this;
|
||||
}
|
||||
|
@ -78,6 +78,7 @@ namespace rfb {
|
||||
void setMenuKey(const char* keyName);
|
||||
char* menuKeyName();
|
||||
int qualityLevel;
|
||||
bool noJpeg;
|
||||
};
|
||||
|
||||
|
||||
|
@ -93,12 +93,14 @@ public:
|
||||
case encodingHextile: setItemChecked(IDC_ENCODING_HEXTILE, true); break;
|
||||
case encodingRaw: setItemChecked(IDC_ENCODING_RAW, true); break;
|
||||
}
|
||||
setItemChecked(IDC_ALLOW_JPEG, !dlg->options.noJpeg);
|
||||
setItemInt(IDC_QUALITYLEVEL, dlg->options.qualityLevel);
|
||||
onCommand(IDC_ENCODING_AUTO, 0 /* ? */); // Force enableItem status to refresh
|
||||
}
|
||||
virtual bool onOk() {
|
||||
dlg->options.autoSelect = isItemChecked(IDC_ENCODING_AUTO);
|
||||
dlg->options.fullColour = isItemChecked(IDC_FORMAT_FULLCOLOUR);
|
||||
dlg->options.noJpeg = !isItemChecked(IDC_ALLOW_JPEG);
|
||||
dlg->options.qualityLevel = getItemInt(IDC_QUALITYLEVEL);
|
||||
if (isItemChecked(IDC_FORMAT_VERYLOWCOLOUR))
|
||||
dlg->options.lowColourLevel = 0;
|
||||
|
@ -253,6 +253,7 @@ CView::applyOptions(CViewOptions& opt) {
|
||||
cp.supportsLocalCursor = options.useLocalCursor = opt.useLocalCursor;
|
||||
cp.supportsDesktopResize = options.useDesktopResize = opt.useDesktopResize;
|
||||
cp.qualityLevel = options.qualityLevel = opt.qualityLevel;
|
||||
cp.noJpeg = options.noJpeg = opt.noJpeg;
|
||||
if (cursorAvailable)
|
||||
hideLocalCursor();
|
||||
cursorAvailable = cursorAvailable && options.useLocalCursor;
|
||||
|
Loading…
Reference in New Issue
Block a user