tweak statsOverlay

This commit is contained in:
TrueZhuanjia
2025-09-13 21:21:57 +08:00
parent adce543c45
commit 0e51a49898
6 changed files with 55 additions and 39 deletions
+34 -28
View File
@@ -375,25 +375,25 @@
}
}
},
"[ Toggle stats overlay & graphs ]" : {
"[ Toggle stats overlay ]" : {
"extractionState" : "manual",
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "[ 切换统计覆盖层和图表 ]"
"value" : "[ 切换统计覆盖层 ]"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "[ 切換統計覆蓋層和圖表 ]"
"value" : "[ 切換統計覆蓋層 ]"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "[ 切換統計覆蓋層和圖表 ]"
"value" : "[ 切換統計覆蓋層 ]"
}
}
}
@@ -467,7 +467,7 @@
}
}
},
"%u ms (variance: %u ms)" : {
"%u ms (var: %u ms)" : {
"extractionState" : "manual",
"localizations" : {
"zh-Hans" : {
@@ -2079,29 +2079,6 @@
}
}
},
"FPS: %5.2f Network dropped frames: %.2f%% Network latency: %@" : {
"extractionState" : "manual",
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "帧率: %5.2f 网络丢帧: %.2f%% 网络延迟: %@"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "FPS:%5.2f 網路掉幀:%.2f%% 網路延遲:%@"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "FPS:%5.2f 網路掉幀:%.2f%% 網路延遲:%@"
}
}
}
},
"framePacingStackTip" : {
"extractionState" : "manual",
"localizations" : {
@@ -4880,6 +4857,35 @@
}
}
},
"simplifiedOsdText" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "FPS: %6.2f Dropped frames: %.1f%% Bitrate: %5.1f Mbps Latency: %@"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "帧率: %6.2f 丢帧: %.1f%% 码率: %5.1f Mbps 延迟: %@"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "FPS: %6.2f 掉幀: %.1f%% 位元速率: %5.1f Mbps 延遲: %@"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "FPS: %6.2f 掉幀: %.1f%% 位元速率: %5.1f Mbps 延遲: %@"
}
}
}
},
"Size" : {
"extractionState" : "manual",
"localizations" : {
+3 -2
View File
@@ -169,7 +169,7 @@
uint32_t rtt, variance;
NSString* latencyString;
if (LiGetEstimatedRttInfo(&rtt, &variance)) {
latencyString = [LocalizationHelper localizedStringForKey:@"%u ms (variance: %u ms)", rtt, variance];
latencyString = [LocalizationHelper localizedStringForKey:@"%u ms (var: %u ms)", rtt, variance];
}
else {
latencyString = @"N/A";
@@ -205,9 +205,10 @@
double avgVideoMbps = [_connection getBwTracker].averageMbps;
double peakVideoMbps = [_connection getBwTracker].peakMbps;
if(overlayLevel == 1) return [LocalizationHelper localizedStringForKey:@"FPS: %5.2f Network dropped frames: %.2f%% Network latency: %@",
if(overlayLevel == 1) return [LocalizationHelper localizedStringForKey:@"simplifiedOsdText",
fps,
stats.networkDroppedFrames / interval,
avgVideoMbps,
latencyString];
else {
if (framePacingMode == FramePacingModeLegacy || framePacingMode == FramePacingModeOff) {
@@ -38,5 +38,6 @@
- (NSInteger)requestForBitrate:(NSInteger)bitrateKbps;
#endif
- (void)fillResolutionTable:(CGSize*)resolutionTable externalDisplayMode:(NSInteger)externalDisplayMode;
- (bool)isIPhone;
@end
@@ -1540,7 +1540,7 @@ static NSMutableSet* hostList;
[self setupNavBar];
// Set the gesture
if(![self isIPhonePortrait]) [self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer]; // to prevent buggy settings view in iphone portrait mode;
[self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer];
// Get callbacks associated with the viewController
[self.revealViewController setDelegate:self];
@@ -355,6 +355,8 @@
_settings = [[[DataManager alloc] init] getSettings]; //StreamFrameViewController retrieve the settings here.
}
overlayLevel = _settings.statsOverlayLevel.intValue;
[self setupOverlayView];
if(viewIsBeingResized) viewIsBeingResized = false;
else [self configOscLayoutTool];
[self updateToolboxSpecialEntries];
@@ -871,13 +873,13 @@
});
}
- (void)updateOverlayText:(NSString*)text {
- (void)setupOverlayView{
if (_overlayView == nil) {
_overlayView = [[PaddedLabel alloc] initWithFrame:CGRectZero];
[_overlayView setTextInsets:UIEdgeInsetsMake(10, 15, 10, 15)];
[_overlayView setTextInsets:UIEdgeInsetsMake([_mainFrameViewcontroller isIPhone]?4:6, 12, [_mainFrameViewcontroller isIPhone]?4:6, 12)];
[_overlayView setUserInteractionEnabled:NO];
[_overlayView setNumberOfLines:100];
[_overlayView.layer setCornerRadius:12];
[_overlayView.layer setCornerRadius:[_mainFrameViewcontroller isIPhone]?7:10];
[_overlayView.layer setMasksToBounds:YES];
// HACK: If not using stats overlay, center the text
@@ -890,13 +892,19 @@
#if TARGET_OS_TV
[_overlayView setFont:[UIFont systemFontOfSize:24 weight:UIFontWeightMedium]];
#else
[_overlayView setFont:[UIFont systemFontOfSize:12 weight:UIFontWeightMedium]];
[_overlayView setFont:[UIFont systemFontOfSize: [_mainFrameViewcontroller isIPhone]?10:12 weight:UIFontWeightMedium]];
#endif
[_overlayView setAlpha:(float)[_settings.graphOpacity intValue]/ 100.0];
[self.view addSubview:_overlayView];
}
if (@available(iOS 13.0, *)) {
if(overlayLevel == 1) _overlayView.font = [UIFont monospacedSystemFontOfSize:[_mainFrameViewcontroller isIPhone]?10:12 weight:UIFontWeightMedium];
}
[_overlayView setHidden:YES];
}
- (void)updateOverlayText:(NSString*)text {
if (text != nil) {
// We set our bounds to the maximum width in order to work around a bug where
// sizeToFit interacts badly with the UITextView's line breaks, causing the
@@ -907,7 +915,7 @@
_overlayView.frame.size.height)];
[_overlayView setText:text];
[_overlayView sizeToFit];
[_overlayView setCenter:CGPointMake(self.view.frame.size.width / 2, (12 + (_overlayView.frame.size.height / 2)))];
[_overlayView setCenter:CGPointMake(self.view.frame.size.width / 2, (4 + (_overlayView.frame.size.height / 2)))];
[_overlayView setHidden:NO];
}
else {
@@ -1491,7 +1499,7 @@
- (void)toggleStatsOverlay{
// Toggle the values on the current in-memory settings object for a temporary effect
_settings.statsOverlayEnabled = !_settings.statsOverlayEnabled;
_settings.enableGraphs = _settings.statsOverlayEnabled;
// _settings.enableGraphs = _settings.statsOverlayEnabled;
// Reconfigure the UI using the current in-memory settings, without reloading from disk
[self reConfigStreamViewRealtimeAndReloadSettings:NO];
@@ -36,7 +36,7 @@ import UIKit
"widgetLayoutTool":SwiftLocalizationHelper.localizedString(forKey: "[ On-screen widget tool ]"),
"bringUpSoftKeyboard":SwiftLocalizationHelper.localizedString(forKey: "[ Bring up soft keyboard ]"),
"enterPip":SwiftLocalizationHelper.localizedString(forKey: "[ Enter picture-in-picture mode ]"),
"toggleStatsOverlay":SwiftLocalizationHelper.localizedString(forKey: "[ Toggle stats overlay & graphs ]"),
"toggleStatsOverlay":SwiftLocalizationHelper.localizedString(forKey: "[ Toggle stats overlay ]"),
"disconnectAndQuitApp":SwiftLocalizationHelper.localizedString(forKey: "[ Disconnect & quit app ]")
]