forked from Ylianst/MeshCentralRouter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
KVMSettingsForm.cs
148 lines (132 loc) · 6.3 KB
/
KVMSettingsForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
Copyright 2009-2022 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System;
using System.Windows.Forms;
namespace MeshCentralRouter
{
public partial class KVMSettingsForm : Form
{
public KVMSettingsForm(int features2)
{
InitializeComponent();
Translate.TranslateControl(this);
qualityComboBox.Items.Add(new DropListItem(90, "90%"));
qualityComboBox.Items.Add(new DropListItem(80, "80%"));
qualityComboBox.Items.Add(new DropListItem(70, "70%"));
qualityComboBox.Items.Add(new DropListItem(60, "60%"));
qualityComboBox.Items.Add(new DropListItem(50, "50%"));
qualityComboBox.Items.Add(new DropListItem(40, "40%"));
qualityComboBox.Items.Add(new DropListItem(30, "30%"));
qualityComboBox.Items.Add(new DropListItem(20, "20%"));
qualityComboBox.Items.Add(new DropListItem(10, "10%"));
qualityComboBox.Items.Add(new DropListItem(5, "5%"));
qualityComboBox.Items.Add(new DropListItem(1, "1%"));
scalingComboBox.Items.Add(new DropListItem(1024, "100%"));
scalingComboBox.Items.Add(new DropListItem(896, "87.5%"));
scalingComboBox.Items.Add(new DropListItem(768, "75%"));
scalingComboBox.Items.Add(new DropListItem(640, "62.5%"));
scalingComboBox.Items.Add(new DropListItem(512, "50%"));
scalingComboBox.Items.Add(new DropListItem(384, "37.5%"));
scalingComboBox.Items.Add(new DropListItem(256, "25%"));
scalingComboBox.Items.Add(new DropListItem(128, "12.5%"));
frameRateComboBox.Items.Add(new DropListItem(50, Translate.T(Properties.Resources.Fast)));
frameRateComboBox.Items.Add(new DropListItem(100, Translate.T(Properties.Resources.Medium)));
frameRateComboBox.Items.Add(new DropListItem(400, Translate.T(Properties.Resources.Slow)));
frameRateComboBox.Items.Add(new DropListItem(1000, Translate.T(Properties.Resources.VerySlow)));
qualityComboBox.SelectedIndex = 4;
scalingComboBox.SelectedIndex = 0;
frameRateComboBox.SelectedIndex = 1;
if ((features2 & 0x1000) != 0) {
this.Height -= (autoSendClipboardCheckBox.Top - remoteKeyboardMapCheckBox.Top);
autoSendClipboardCheckBox.Visible = false;
}
}
private class DropListItem
{
public int value;
public string str;
public DropListItem(int value, string str) { this.value = value; this.str = str; }
public override string ToString() { return str; }
}
private void SettingsForm_Load(object sender, EventArgs e)
{
}
public int Compression
{
get { return ((DropListItem)qualityComboBox.SelectedItem).value; }
set
{
if (value >= 90) { qualityComboBox.SelectedIndex = 0; return; }
if (value >= 80) { qualityComboBox.SelectedIndex = 1; return; }
if (value >= 70) { qualityComboBox.SelectedIndex = 2; return; }
if (value >= 60) { qualityComboBox.SelectedIndex = 3; return; }
if (value >= 50) { qualityComboBox.SelectedIndex = 4; return; }
if (value >= 40) { qualityComboBox.SelectedIndex = 5; return; }
if (value >= 30) { qualityComboBox.SelectedIndex = 6; return; }
if (value >= 20) { qualityComboBox.SelectedIndex = 7; return; }
if (value >= 10) { qualityComboBox.SelectedIndex = 8; return; }
if (value >= 5) { qualityComboBox.SelectedIndex = 9; return; }
qualityComboBox.SelectedIndex = 10;
}
}
public int Scaling
{
get { return ((DropListItem)scalingComboBox.SelectedItem).value; }
set
{
if (value >= 1024) { scalingComboBox.SelectedIndex = 0; return; }
if (value >= 896) { scalingComboBox.SelectedIndex = 1; return; }
if (value >= 768) { scalingComboBox.SelectedIndex = 2; return; }
if (value >= 640) { scalingComboBox.SelectedIndex = 3; return; }
if (value >= 512) { scalingComboBox.SelectedIndex = 4; return; }
if (value >= 384) { scalingComboBox.SelectedIndex = 5; return; }
if (value >= 256) { scalingComboBox.SelectedIndex = 6; return; }
scalingComboBox.SelectedIndex = 7;
}
}
public int FrameRate
{
get { return ((DropListItem)frameRateComboBox.SelectedItem).value; }
set
{
if (value <= 50) { frameRateComboBox.SelectedIndex = 0; return; }
if (value <= 100) { frameRateComboBox.SelectedIndex = 1; return; }
if (value <= 400) { frameRateComboBox.SelectedIndex = 2; return; }
frameRateComboBox.SelectedIndex = 3;
}
}
public bool SwamMouseButtons
{
get { return swapMouseButtonsCheckBox.Checked; }
set { swapMouseButtonsCheckBox.Checked = value; }
}
public bool RemoteKeyboardMap
{
get { return remoteKeyboardMapCheckBox.Checked; }
set { remoteKeyboardMapCheckBox.Checked = value; }
}
public bool AutoSendClipboard
{
get { return autoSendClipboardCheckBox.Checked; }
set { autoSendClipboardCheckBox.Checked = value; }
}
private void okButton_Click(object sender, EventArgs e)
{
DialogResult = System.Windows.Forms.DialogResult.OK;
}
private void cancelButton_Click(object sender, EventArgs e)
{
DialogResult = System.Windows.Forms.DialogResult.Cancel;
}
}
}