fix sciter more bitrate, change max bitrate to 2000%

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2023-07-27 18:39:19 +08:00
parent 63bf4b5fa8
commit fa420c4825
2 changed files with 29 additions and 20 deletions

View File

@ -947,7 +947,9 @@ showSetOSPassword(
Function()? closeCallback,
) async {
final controller = TextEditingController();
osPassword ??= await bind.sessionGetOption(sessionId: sessionId, arg: 'os-password') ?? '';
osPassword ??=
await bind.sessionGetOption(sessionId: sessionId, arg: 'os-password') ??
'';
var autoLogin =
await bind.sessionGetOption(sessionId: sessionId, arg: 'auto-login') !=
'';
@ -957,6 +959,7 @@ showSetOSPassword(
close();
if (closeCallback != null) closeCallback();
}
submit() {
var text = controller.text.trim();
bind.sessionPeerOption(
@ -1221,7 +1224,7 @@ customImageQualityDialog(SessionID sessionId, String id, FFI ffi) async {
quality != null && quality.isNotEmpty ? quality[0].toDouble() : 50.0;
const qualityMinValue = 10.0;
const qualityMoreThresholdValue = 100.0;
const qualityMaxValue = 4000.0;
const qualityMaxValue = 2000.0;
if (qualityInitValue < qualityMinValue) {
qualityInitValue = qualityMinValue;
}
@ -1269,22 +1272,23 @@ customImageQualityDialog(SessionID sessionId, String id, FFI ffi) async {
Expanded(
flex: 1,
child: Row(
children: [
Checkbox(
value: moreQualityChecked.value,
onChanged: (bool? value) {
moreQualityChecked.value = value!;
if (!value &&
qualitySliderValue.value > qualityMoreThresholdValue) {
qualitySliderValue.value = qualityMoreThresholdValue;
debouncerQuality.value = qualityMoreThresholdValue;
}
},
).marginOnly(right: 5),
Expanded(
child: Text(translate('More')),
)
],
children: [
Checkbox(
value: moreQualityChecked.value,
onChanged: (bool? value) {
moreQualityChecked.value = value!;
if (!value &&
qualitySliderValue.value >
qualityMoreThresholdValue) {
qualitySliderValue.value = qualityMoreThresholdValue;
debouncerQuality.value = qualityMoreThresholdValue;
}
},
).marginOnly(right: 5),
Expanded(
child: Text(translate('More')),
)
],
)),
],
));

View File

@ -425,14 +425,19 @@ function handle_custom_image_quality() {
var tmp = handler.get_custom_image_quality();
var bitrate = (tmp[0] || 50);
var extendedBitrate = bitrate > 100;
var maxRate = extendedBitrate ? 4000 : 100;
var maxRate = extendedBitrate ? 2000 : 100;
msgbox("custom-image-quality", "Custom Image Quality", "<div .form> \
<div><input #bitrate-slider type=\"hslider\" style=\"width: 50%\" name=\"bitrate\" max=\"" + maxRate + "\" min=\"10\" value=\"" + bitrate + "\"/ buddy=\"bitrate-buddy\"><b #bitrate-buddy>x</b>% Bitrate <button|checkbox #extended-slider .custom-event " + (extendedBitrate ? "checked" : "") + ">More</button></div> \
</div>", "", function(res=null) {
if (!res) return;
if (res.id === "extended-slider") {
var slider = res.parent.$(#bitrate-slider)
slider.slider.max = res.checked ? 4000 : 100;
slider.slider.max = res.checked ? 2000 : 100;
if (slider.value > slider.slider.max) {
slider.value = slider.slider.max;
}
var buddy = res.parent.$(#bitrate-buddy);
buddy.value = slider.value;
return;
}
if (!res.bitrate) return;