current widget name displayed on current profile label

This commit is contained in:
TrueZhuanjia
2025-07-02 10:55:35 +08:00
parent 97d17f505b
commit 6be5aa6507
3 changed files with 42 additions and 2 deletions
@@ -93,6 +93,29 @@
}
}
},
" Profile: %@ Widget: %@" : {
"extractionState" : "manual",
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : " 当前布局: %@ 当前组件: %@"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : " 当前布局: %@ 当前组件: %@"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : " 当前布局: %@ 当前组件: %@"
}
}
}
},
" Wake-on-LAN" : {
"extractionState" : "manual",
"localizations" : {
@@ -13,8 +13,10 @@
+ (NSString *)localizedStringForKey:(NSString *)key, ... {
va_list args;
va_start(args, key);
NSString *format = NSLocalizedStringFromTable(key, @"Localizable", nil);
NSString *result = [[NSString alloc] initWithFormat:format arguments:args];
va_end(args);
return result;
}
@@ -650,13 +650,19 @@
OnScreenWidgetView* widgetView = (OnScreenWidgetView* )notification.object;
[self->selectedWidgetView.stickBallLayer removeFromSuperlayer];
[self->selectedWidgetView.crossMarkLayer removeFromSuperlayer];
self->widgetViewSelected = true;
self->controllerLayerSelected = false;
self->selectedWidgetView = widgetView;
[self autoFitLabel:self.currentProfileLabel];
self.currentProfileLabel.textAlignment = NSTextAlignmentLeft;
[self.currentProfileLabel setText:
[LocalizationHelper localizedStringForKey:@" Profile: %@ Widget: %@",
[profilesManager getSelectedProfile].name,
selectedWidgetView.buttonLabel]];
self.undoButton.alpha = selectedWidgetView.layoutChanges.count>1 ? 1.0 : 0.3;
[self.layoutOSC updateGuidelinesForOnScreenWidget:self->selectedWidgetView]; // shows guideline immediately when widget is tapped
@@ -739,6 +745,14 @@
self->selectedControllerLayer = controllerLayer;
self->controllerLoadedBounds = controllerLayer.bounds;
[self autoFitLabel:self.currentProfileLabel];
self.currentProfileLabel.textAlignment = NSTextAlignmentLeft;
[self.currentProfileLabel setText:
[LocalizationHelper localizedStringForKey:@" Profile: %@ Widget: %@",
[profilesManager getSelectedProfile].name,
selectedControllerLayer.name]];
// setup slider values
CGFloat sizeFactor = [OnScreenControls getControllerLayerSizeFactor:controllerLayer]; // calculated sizeFactor from loaded layer bounds.
[self.widgetSizeSlider setValue:sizeFactor];
@@ -906,7 +920,8 @@
[self.currentProfileLabel setText:[LocalizationHelper localizedStringForKey:@"Profile: %@",[profilesManager getSelectedProfile].name]];
self.currentProfileLabel.layer.cornerRadius = [self isIPhone] ? 9 : 12;
self.currentProfileLabel.clipsToBounds = YES;
self.currentProfileLabel.textAlignment = NSTextAlignmentCenter;
self.widgetSizeStack.userInteractionEnabled = YES;
for(UIView* view in _widgetPanelStack.subviews){
view.userInteractionEnabled = YES;