mirror of
https://github.com/LorenEteval/Furious.git
synced 2026-09-29 10:28:07 +03:00
Use SpinBox for Tun2socks memory optimization UI
Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
@@ -105,8 +105,8 @@ def getUserTUNSettings(*args, **kwargs):
|
||||
functools.partial(getUserTUNSettings, 'tunAdapterInterfaceDNS', ''),
|
||||
functools.partial(getUserTUNSettings, 'bypassTUNAdapterInterfaceIP', ''),
|
||||
functools.partial(getUserTUNSettings, 'disablePrimaryAdapterInterfaceDNS', 'True'),
|
||||
functools.partial(getUserTUNSettings, 'tcpSendBufferSize', ''),
|
||||
functools.partial(getUserTUNSettings, 'tcpReceiveBufferSize', ''),
|
||||
functools.partial(getUserTUNSettings, 'tcpSendBufferSize', 1),
|
||||
functools.partial(getUserTUNSettings, 'tcpReceiveBufferSize', 1),
|
||||
functools.partial(getUserTUNSettings, 'tcpAutoTuning', 'False'),
|
||||
)
|
||||
|
||||
@@ -424,8 +424,8 @@ class CoreManager(Mixins.CleanupOnExit):
|
||||
'error',
|
||||
f'socks5://{configcopy.socksProxy()}',
|
||||
'',
|
||||
tcpSendBufferSize,
|
||||
tcpReceiveBufferSize,
|
||||
f'{tcpSendBufferSize}MB',
|
||||
f'{tcpReceiveBufferSize}MB',
|
||||
tcpAutoTuning,
|
||||
):
|
||||
return False
|
||||
|
||||
Vendored
+8
-8
@@ -1674,32 +1674,32 @@ TRANSLATION = {
|
||||
"source": [
|
||||
"Furious.Widget.GuiTUNSettings"
|
||||
],
|
||||
"ZH": "内存优化",
|
||||
"RU": "Оптимизация памяти",
|
||||
"ZH": "内存优化",
|
||||
"isReviewed": "True"
|
||||
},
|
||||
"TCP Send Buffer Size": {
|
||||
"TCP Send Buffer Size (MiB)": {
|
||||
"source": [
|
||||
"Furious.Widget.GuiTUNSettings"
|
||||
],
|
||||
"ZH": "TCP发送缓冲区大小",
|
||||
"RU": "Размер буфера отправки TCP",
|
||||
"RU": "Размер буфера отправки TCP (MiB)",
|
||||
"ZH": "TCP发送缓冲区大小(MiB)",
|
||||
"isReviewed": "True"
|
||||
},
|
||||
"TCP Receive Buffer Size": {
|
||||
"TCP Receive Buffer Size (MiB)": {
|
||||
"source": [
|
||||
"Furious.Widget.GuiTUNSettings"
|
||||
],
|
||||
"ZH": "TCP接收缓冲区大小",
|
||||
"RU": "Размер буфера приема TCP",
|
||||
"RU": "Размер буфера приема TCP (MiB)",
|
||||
"ZH": "TCP接收缓冲区大小(MiB)",
|
||||
"isReviewed": "True"
|
||||
},
|
||||
"TCP Receive Buffer Auto-tuning": {
|
||||
"source": [
|
||||
"Furious.Widget.GuiTUNSettings"
|
||||
],
|
||||
"ZH": "TCP接收缓冲区自动调优",
|
||||
"RU": "Автоматическая настройка буфера приема TCP",
|
||||
"ZH": "TCP接收缓冲区自动调优",
|
||||
"isReviewed": "True"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,43 @@ class GuiTUNSettingsItemXXX(GuiEditorItemTextInput):
|
||||
self.setText(config.get(self.key, ''))
|
||||
|
||||
|
||||
class GuiTUNSettingsItemSpinBoxBufferSizeXXX(GuiEditorItemTextSpinBox):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.key = kwargs.pop('key', '')
|
||||
self.default = kwargs.pop('default', 1)
|
||||
self.start = kwargs.pop('start', 1)
|
||||
self.end = kwargs.pop('end', 4)
|
||||
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
# Range
|
||||
self.setRange(self.start, self.end)
|
||||
|
||||
def inputToFactory(self, config: dict) -> bool:
|
||||
oldValue = config.get(self.key, self.default)
|
||||
newValue = self.value()
|
||||
|
||||
if not isinstance(oldValue, int):
|
||||
oldValue = -1e8
|
||||
|
||||
if newValue != oldValue:
|
||||
config[self.key] = newValue
|
||||
|
||||
# Modified
|
||||
return True
|
||||
else:
|
||||
# Not modified
|
||||
return False
|
||||
|
||||
def factoryToInput(self, config: dict):
|
||||
oldValue = config.get(self.key, self.default)
|
||||
|
||||
if not isinstance(oldValue, int):
|
||||
config[self.key] = oldValue = self.default
|
||||
|
||||
self.setValue(oldValue)
|
||||
|
||||
|
||||
class GuiTUNSettingsItemCheckBoxXXX(GuiEditorItemTextCheckBox):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.key = kwargs.pop('key', '')
|
||||
@@ -165,13 +202,19 @@ class GuiTUNSettingsGroupBoxMemory(GuiEditorWidgetQGroupBox):
|
||||
|
||||
def containerSequence(self):
|
||||
return [
|
||||
GuiTUNSettingsItemXXX(
|
||||
title=_('TCP Send Buffer Size'),
|
||||
GuiTUNSettingsItemSpinBoxBufferSizeXXX(
|
||||
title=_('TCP Send Buffer Size (MiB)'),
|
||||
key='tcpSendBufferSize',
|
||||
default=1,
|
||||
start=1,
|
||||
end=4,
|
||||
),
|
||||
GuiTUNSettingsItemXXX(
|
||||
title=_('TCP Receive Buffer Size'),
|
||||
GuiTUNSettingsItemSpinBoxBufferSizeXXX(
|
||||
title=_('TCP Receive Buffer Size (MiB)'),
|
||||
key='tcpReceiveBufferSize',
|
||||
default=1,
|
||||
start=1,
|
||||
end=4,
|
||||
),
|
||||
GuiTUNSettingsItemCheckBoxXXX(
|
||||
title=_('TCP Receive Buffer Auto-tuning'),
|
||||
|
||||
Reference in New Issue
Block a user